index.vue 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007
  1. <template>
  2. <div class="group-con">
  3. <div class="header acea-row row-between-wrapper">
  4. <div class="pictrue"><img :src="storeCombination.image" /></div>
  5. <div class="text">
  6. <div class="line1" v-text="storeCombination.title"></div>
  7. <div class="money">
  8. <span class="num" v-text="storeCombination.price || 0"></span>
  9. <span class="team cart-color">{{storeCombination.people +'人拼'}}</span>
  10. </div>
  11. </div>
  12. <div v-if="pinkBool === -1" class="iconfont icon-pintuanshibai"></div>
  13. <div v-else-if="pinkBool === 1" class="iconfont icon-pintuanchenggong font-color-red"></div>
  14. </div>
  15. <div class="wrapper">
  16. <div class="title acea-row row-center-wrapper" v-if="pinkBool === 0">
  17. <div class="line"></div>
  18. <div class="name acea-row row-center-wrapper">
  19. 剩余
  20. <CountDown :bgColor="bgColor" :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="' : '"
  21. :minute-text="' : '" :second-text="' '" :datatime="pinkT.stopTime/1000"></CountDown>
  22. <span class="end">结束</span>
  23. </div>
  24. <div class="line"></div>
  25. </div>
  26. <div class="tips font-color-red" v-if="pinkBool === 1">恭喜您拼团成功</div>
  27. <div class="tips" v-else-if="pinkBool === -1">还差{{ count }}人,拼团失败</div>
  28. <div class="tips font-color-red" v-else-if="pinkBool === 0">拼团中,还差{{ count }}人拼团成功</div>
  29. <div class="list acea-row row-middle"
  30. :class="[pinkBool === 1 || pinkBool === -1 ? 'result' : '', iShidden ? 'on' : '']">
  31. <div class="pinkT">
  32. <div class="pictrue"><img :src="pinkT.avatar" /></div>
  33. <div class="chief">团长</div>
  34. </div>
  35. <block v-if="pinkAll.length > 0">
  36. <div class="pictrue" v-for="(item, index) in pinkAll" :key="index"><img :src="item.avatar" /></div>
  37. </block>
  38. <div class="pictrue" v-for="index in count" :key="index"><img class="img-none"
  39. src="/static/images/vacancy.png" /></div>
  40. </div>
  41. <div v-if="(pinkBool === 1 || pinkBool === -1) && count > 9" class="lookAll acea-row row-center-wrapper"
  42. @click="lookAll">
  43. {{ iShidden ? '收起' : '查看全部' }}
  44. <span class="iconfont" :class="iShidden ? 'icon-xiangshang' : 'icon-xiangxia'"></span>
  45. </div>
  46. <!-- #ifndef MP -->
  47. <div v-if="userBool === 1 && isOk == 0 && pinkBool === 0">
  48. <div class="teamBnt bg-color-red" v-if='pinkT.stopTime>timestamp' @click="goPoster">邀请好友参团</div>
  49. </div>
  50. <!-- #endif -->
  51. <!-- #ifdef MP -->
  52. <button open-type="share" class="teamBnt bg-color-red"
  53. v-if="userBool === 1 && isOk == 0 && pinkBool === 0 && pinkT.stopTime>timestamp">邀请好友参团</button>
  54. <!-- #endif -->
  55. <div class="teamBnt bg-color-hui" v-if="pinkT.stopTime<timestamp && isOk == 0 && pinkBool === 0">拼团已过期</div>
  56. <div class="teamBnt bg-color-red"
  57. v-else-if="userBool === 0 && pinkBool === 0 && count > 0 && pinkT.stopTime>timestamp" @click="pay">我要参团
  58. </div>
  59. <div class="teamBnt bg-color-red" v-if="pinkBool === 1 || pinkBool === -1"
  60. @click="goDetail(storeCombination.id)">再次开团</div>
  61. <div class="cancel" @click="getCombinationRemove" v-if="pinkBool === 0 && userBool === 1">
  62. <span class="iconfont icon-guanbi3"></span>
  63. 取消开团
  64. </div>
  65. <div class="lookOrder" v-if="pinkBool === 1" @click="goOrder">
  66. 查看订单信息
  67. <span class="iconfont icon-xiangyou"></span>
  68. </div>
  69. </div>
  70. <div class="group-recommend">
  71. <div class="title acea-row row-between-wrapper">
  72. <div>大家都在拼</div>
  73. <div class="more" @click="goList">
  74. 更多拼团
  75. <span class="iconfont icon-jiantou"></span>
  76. </div>
  77. </div>
  78. <div class="list acea-row row-middle">
  79. <div class="item" v-for="(item, index) in storeCombinationHost" :key="index" @click="goDetail(item.id)">
  80. <div class="pictrue">
  81. <img :src="item.image" />
  82. <div class="team" v-text="item.people + '人团'"></div>
  83. </div>
  84. <div class="name line1" v-text="item.title"></div>
  85. <div class="money font-color-red" v-text="'¥' + item.price"></div>
  86. </div>
  87. </div>
  88. </div>
  89. <product-window :attr="attr" :limitNum="1" :iSbnt="1" @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
  90. @ChangeCartNum="ChangeCartNum" @iptCartNum="iptCartNum" @attrVal="attrVal" @goCat="goPay"></product-window>
  91. <view class="mask" v-if="posters || canvasStatus" @click="listenerActionClose"></view>
  92. <!-- 发送给朋友图片 -->
  93. <view class="share-box" v-if="H5ShareBox">
  94. <image src="/static/images/share-info.png" @click="H5ShareBox = false"></image>
  95. </view>
  96. <!-- 海报展示 -->
  97. <view class='poster-pop' v-if="canvasStatus">
  98. <image :src='imagePath'></image>
  99. <!-- #ifndef H5 -->
  100. <view class='save-poster' @click="savePosterPath">保存到手机</view>
  101. <!-- #endif -->
  102. <!-- #ifdef H5 -->
  103. <view class="keep">长按图片保存至相册</view>
  104. <view class='iconfont icon-cha2 close' @tap='listenerActionClose'></view>
  105. <!-- #endif -->
  106. </view>
  107. <view class="canvas">
  108. <canvas style="width:597px;height:850px;" canvas-id="activityCanvas"></canvas>
  109. <canvas canvas-id="qrcode" :style="{width: `${qrcodeSize}px`, height: `${qrcodeSize}px`}"
  110. style="opacity: 0;" />
  111. </view>
  112. <!-- #ifdef MP -->
  113. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  114. <!-- #endif -->
  115. <home></home>
  116. </div>
  117. </template>
  118. <script>
  119. import CountDown from '@/components/countDown';
  120. import ProductWindow from '@/components/productWindow';
  121. import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js';
  122. import {
  123. imageBase64
  124. } from "@/api/public";
  125. import {
  126. toLogin
  127. } from '@/libs/login.js';
  128. import {
  129. mapGetters
  130. } from 'vuex';
  131. import {
  132. getCombinationPink,
  133. postCombinationRemove,
  134. getCombinationMore
  135. } from '@/api/activity';
  136. import {
  137. postCartAdd
  138. } from '@/api/store';
  139. // #ifdef MP
  140. import authorize from '@/components/Authorize';
  141. // #endif
  142. import home from '@/components/home';
  143. const NAME = 'GroupRule';
  144. const app = getApp();
  145. export default {
  146. name: NAME,
  147. components: {
  148. CountDown,
  149. ProductWindow,
  150. home,
  151. // #ifdef MP
  152. authorize
  153. // #endif
  154. },
  155. props: {},
  156. data: function() {
  157. return {
  158. bgColor: {
  159. 'bgColor': '#333333',
  160. 'Color': '#fff',
  161. 'width': '44rpx',
  162. 'timeTxtwidth': '16rpx',
  163. 'isDay': true
  164. },
  165. currentPinkOrder: '', //当前拼团订单
  166. isOk: 0, //判断拼团是否完成
  167. pinkBool: 0, //判断拼团是否成功|0=失败,1=成功
  168. userBool: 0, //判断当前用户是否在团内|0=未在,1=在
  169. pinkAll: [], //团员
  170. pinkT: [], //团长信息
  171. storeCombination: {}, //拼团产品
  172. storeCombinationHost: [], //拼团推荐
  173. pinkId: 0,
  174. count: 0, //拼团剩余人数
  175. iShidden: false,
  176. isOpen: false, //是否打开属性组件
  177. attr: {
  178. cartAttr: false,
  179. productSelect: {
  180. image: '',
  181. storeName: '',
  182. price: '',
  183. quota: 0,
  184. unique: '',
  185. cart_num: 1,
  186. quotaShow: 0,
  187. stock: 0,
  188. num: 0
  189. },
  190. attrValue: '',
  191. productAttr: []
  192. },
  193. cart_num: '',
  194. limit: 10,
  195. page: 1,
  196. loading: false,
  197. loadend: false,
  198. userInfo: {},
  199. posters: false, // app分享
  200. H5ShareBox: false, //公众号分享图片
  201. isAuto: false, //没有授权的不会自动授权
  202. isShowAuth: false, //是否隐藏授权
  203. onceNum: 0, //一次可以购买几个,
  204. timestamp: 0, // 当前时间戳
  205. qrcodeSize: 600,
  206. posterbackgd: '/static/images/canbj.png',
  207. PromotionCode: '', //二维码
  208. canvasStatus: false,
  209. imgTop: '', //商品图base64位
  210. imagePath: '' // 海报图片
  211. };
  212. },
  213. watch: {
  214. userData: {
  215. handler: function(newV, oldV) {
  216. if (newV) {
  217. this.userInfo = newV;
  218. app.globalData.openPages = '/pages/activity/goods_combination_status/index?id=' + this.pinkId +
  219. "&spread=" + this.uid;
  220. }
  221. },
  222. deep: true
  223. }
  224. },
  225. computed: mapGetters({
  226. 'isLogin': 'isLogin',
  227. 'userData': 'userInfo',
  228. 'uid': 'uid'
  229. }),
  230. onLoad(options) {
  231. var that = this;
  232. that.pinkId = options.id;
  233. if (that.isLogin == false) {
  234. toLogin();
  235. } else {
  236. this.timestamp = (new Date()).getTime();
  237. this.getCombinationPink();
  238. }
  239. },
  240. onShow() {},
  241. mounted: function() {
  242. this.combinationMore();
  243. },
  244. // link: window.location.protocol + '//' + window.location.host +
  245. // '/pages/activity/goods_combination_status/index?id=' + that.pinkId + "&spread=" + this.uid,
  246. //#ifdef MP
  247. /**
  248. * 用户点击右上角分享
  249. */
  250. onShareAppMessage: function() {
  251. let that = this;
  252. return {
  253. title: '您的好友' + that.userInfo.nickname + '邀请您参团' + that.storeCombination.title,
  254. path: app.globalData.openPages,
  255. imageUrl: that.storeCombination.image
  256. };
  257. },
  258. //#endif
  259. methods: {
  260. // 分享关闭
  261. listenerActionClose: function() {
  262. this.posters = false;
  263. this.canvasStatus = false;
  264. },
  265. // 更多拼团
  266. combinationMore: function() {
  267. var that = this;
  268. if (that.loadend) return;
  269. if (that.loading) return;
  270. var data = {
  271. page: that.page,
  272. limit: that.limit,
  273. comId: that.pinkId
  274. };
  275. this.loading = true
  276. getCombinationMore(data)
  277. .then(res => {
  278. var storeCombinationHost = that.storeCombinationHost;
  279. var limit = that.limit;
  280. that.page++;
  281. that.loadend = limit > res.data.length;
  282. that.storeCombinationHost = storeCombinationHost.concat(res.data.list);
  283. that.page = that.data.page;
  284. that.loading = false;
  285. })
  286. .catch(res => {
  287. that.loading = false
  288. that.$util.Tips({
  289. title: res
  290. });
  291. });
  292. },
  293. // 授权关闭
  294. authColse: function(e) {
  295. this.isShowAuth = e;
  296. },
  297. // 授权后回调
  298. onLoadFun: function(e) {
  299. this.userInfo = e;
  300. app.globalData.openPages = '/pages/activity/goods_combination_status/index?id=' + this.pinkId;
  301. this.getCombinationPink();
  302. },
  303. /**
  304. * 购物车手动填写
  305. *
  306. */
  307. iptCartNum: function(e) {
  308. if (e > this.onceNum) {
  309. this.$util.Tips({
  310. title: `该商品每次限购${this.onceNum}${this.storeCombination.unitName}`
  311. });
  312. this.$set(this.attr.productSelect, 'cart_num', this.onceNum);
  313. this.$set(this, "cart_num", this.onceNum);
  314. } else {
  315. this.$set(this.attr.productSelect, 'cart_num', e);
  316. this.$set(this, "cart_num", e);
  317. }
  318. },
  319. attrVal(val) {
  320. this.attr.productAttr[val.indexw].index = this.attr.productAttr[val.indexw].attrValues[val.indexn];
  321. },
  322. onMyEvent: function() {
  323. this.$set(this.attr, 'cartAttr', false);
  324. this.$set(this, 'isOpen', false);
  325. },
  326. //将父级向子集多次传送的函数合二为一;
  327. // changeFun: function(opt) {
  328. // if (typeof opt !== "object") opt = {};
  329. // let action = opt.action || "";
  330. // let value = opt.value === undefined ? "" : opt.value;
  331. // this[action] && this[action](value);
  332. // },
  333. // changeattr: function(res) {
  334. // var that = this;
  335. // that.attr.cartAttr = res;
  336. // },
  337. //选择属性;
  338. ChangeAttr: function(res) {
  339. this.$set(this, 'cart_num', 1);
  340. let productSelect = this.productValue[res];
  341. if (productSelect) {
  342. this.$set(this.attr.productSelect, 'image', productSelect.image);
  343. this.$set(this.attr.productSelect, 'price', productSelect.price);
  344. this.$set(this.attr.productSelect, 'quota', productSelect.quota);
  345. this.$set(this.attr.productSelect, 'unique', productSelect.id);
  346. this.$set(this.attr.productSelect, 'cart_num', 1);
  347. this.$set(this.attr.productSelect, 'stock', productSelect.stock);
  348. this.$set(this.attr.productSelect, 'quotaShow', productSelect.quotaShow);
  349. this.attrValue = res;
  350. this.attrTxt = '已选择';
  351. } else {
  352. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  353. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  354. this.$set(this.attr.productSelect, 'quota', 0);
  355. this.$set(this.attr.productSelect, 'unique', '');
  356. this.$set(this.attr.productSelect, 'cart_num', 0);
  357. this.$set(this.attr.productSelect, 'quotaShow', 0);
  358. this.$set(this.attr.productSelect, 'stock', 0);
  359. this.attrValue = '';
  360. this.attrTxt = '请选择';
  361. }
  362. },
  363. ChangeCartNum: function(res) {
  364. //changeValue:是否 加|减
  365. //获取当前变动属性
  366. let productSelect = this.productValue[this.attrValue];
  367. if (this.cart_num) {
  368. productSelect.cart_num = this.cart_num;
  369. this.attr.productSelect.cart_num = this.cart_num;
  370. }
  371. //如果没有属性,赋值给商品默认库存
  372. if (productSelect === undefined && !this.attr.productAttr.length) productSelect = this.attr
  373. .productSelect;
  374. if (productSelect === undefined) return;
  375. let stock = productSelect.stock || 0;
  376. let quotaShow = productSelect.quotaShow || 0;
  377. let quota = productSelect.quota || 0;
  378. let num = this.attr.productSelect;
  379. let nums = this.storeCombination.num || 0;
  380. //设置默认数据
  381. if (productSelect.cart_num == undefined) productSelect.cart_num = 1;
  382. if (res) {
  383. num.cart_num++;
  384. let arrMin = [];
  385. arrMin.push(nums);
  386. arrMin.push(quota);
  387. arrMin.push(stock);
  388. let minN = Math.min.apply(null, arrMin);
  389. if (num.cart_num >= minN) {
  390. this.$set(this.attr.productSelect, 'cart_num', minN ? minN : 1);
  391. this.$set(this, 'cart_num', minN ? minN : 1);
  392. }
  393. this.$set(this, 'cart_num', num.cart_num);
  394. this.$set(this.attr.productSelect, 'cart_num', num.cart_num);
  395. } else {
  396. num.cart_num--;
  397. if (num.cart_num < 1) {
  398. this.$set(this.attr.productSelect, 'cart_num', 1);
  399. this.$set(this, 'cart_num', 1);
  400. }
  401. this.$set(this, 'cart_num', num.cart_num);
  402. this.$set(this.attr.productSelect, 'cart_num', num.cart_num);
  403. }
  404. },
  405. //默认选中属性;
  406. DefaultSelect() {
  407. let productAttr = this.attr.productAttr,
  408. value = [];
  409. for (var key in this.productValue) {
  410. if (this.productValue[key].quota > 0) {
  411. value = this.attr.productAttr.length ? key.split(',') : [];
  412. break;
  413. }
  414. }
  415. for (let i = 0; i < productAttr.length; i++) {
  416. this.$set(productAttr[i], 'index', value[i]);
  417. }
  418. //sort();排序函数:数字-英文-汉字;
  419. let productSelect = this.productValue[value.join(',')];
  420. if (productSelect && productAttr.length) {
  421. this.$set(this.attr.productSelect, 'storeName', this.storeCombination.title);
  422. this.$set(this.attr.productSelect, 'image', productSelect.image);
  423. this.$set(this.attr.productSelect, 'price', productSelect.price);
  424. this.$set(this.attr.productSelect, 'quota', productSelect.quota);
  425. this.$set(this.attr.productSelect, 'unique', productSelect.id);
  426. this.$set(this.attr.productSelect, 'cart_num', 1);
  427. this.$set(this.attr.productSelect, 'stock', productSelect.stock);
  428. this.$set(this.attr.productSelect, 'quotaShow', productSelect.quotaShow);
  429. //this.$set(this, 'attrValue', value.join(','));
  430. this.attrValue = value.join(',');
  431. this.attrTxt = '已选择';
  432. //this.$set(this, 'attrTxt', '已选择');
  433. } else if (!productSelect && productAttr.length) {
  434. this.$set(this.attr.productSelect, 'storeName', this.storeCombination.title);
  435. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  436. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  437. this.$set(this.attr.productSelect, 'quota', 0);
  438. this.$set(this.attr.productSelect, 'unique', '');
  439. this.$set(this.attr.productSelect, 'cart_num', 0);
  440. this.$set(this.attr.productSelect, 'stock', 0);
  441. this.$set(this.attr.productSelect, 'quotaShow', 0);
  442. //this.$set(this, 'attrValue', '');
  443. this.attrValue = '';
  444. this.attrTxt = '请选择';
  445. // this.$set(this, 'attrTxt', '请选择');
  446. } else if (!productSelect && !productAttr.length) {
  447. this.$set(this.attr.productSelect, 'storeName', this.storeCombination.title);
  448. this.$set(this.attr.productSelect, 'image', this.storeCombination.image);
  449. this.$set(this.attr.productSelect, 'price', this.storeCombination.price);
  450. this.$set(this.attr.productSelect, 'quota', 0);
  451. this.$set(this.attr.productSelect, 'unique', this.storeCombination.id || '');
  452. this.$set(this.attr.productSelect, 'cart_num', 1);
  453. this.$set(this.attr.productSelect, 'quotaShow', 0);
  454. this.$set(this.attr.productSelect, 'stock', 0);
  455. //this.$set(this, 'attrValue', '');
  456. this.attrValue = '';
  457. this.attrTxt = '请选择';
  458. //this.$set(this, 'attrTxt', '请选择');
  459. }
  460. },
  461. setProductSelect: function() {
  462. var that = this;
  463. var attr = that.attr;
  464. attr.productSelect.image = that.storeCombination.image;
  465. attr.productSelect.storeName = that.storeCombination.title;
  466. attr.productSelect.price = that.storeCombination.price;
  467. attr.productSelect.quota = 0;
  468. attr.productSelect.quotaShow = 0;
  469. attr.productSelect.stock = 0;
  470. attr.cartAttr = false;
  471. that.$set(that, 'attr', attr);
  472. },
  473. pay: function() {
  474. var that = this;
  475. that.attr.cartAttr = true;
  476. that.isOpen = true;
  477. },
  478. goPay() {
  479. this.$Order.getPreOrder("buyNow", [{
  480. "attrValueId": parseFloat(this.attr.productSelect.unique),
  481. "combinationId": parseFloat(this.storeCombination.id),
  482. "productNum": parseFloat(this.attr.productSelect.cart_num),
  483. "productId": parseFloat(this.storeCombination.productId),
  484. "pinkId": parseFloat(this.pinkId)
  485. }]);
  486. },
  487. goPoster: function() {
  488. //#ifdef H5
  489. if (this.$wechat.isWeixin()) {
  490. this.H5ShareBox = true;
  491. } else {
  492. uni.showLoading({
  493. title: '海报生成中',
  494. mask: true
  495. });
  496. this.posters = false;
  497. let arrImagesUrl = '';
  498. let arrImagesUrlTop = '';
  499. if (!this.PromotionCode) {
  500. uni.hideLoading();
  501. this.$util.Tips({
  502. title: this.errT
  503. });
  504. return
  505. }
  506. setTimeout(() => {
  507. if (!this.imgTop) {
  508. uni.hideLoading();
  509. this.$util.Tips({
  510. title: '无法生成商品海报!'
  511. });
  512. return
  513. }
  514. }, 1000);
  515. uni.downloadFile({
  516. url: this.imgTop,
  517. success: (res) => {
  518. arrImagesUrlTop = res.tempFilePath;
  519. let arrImages = [this.posterbackgd, arrImagesUrlTop, this.PromotionCode];
  520. setTimeout(() => {
  521. this.$util.activityCanvas(arrImages, this.storeCombination.title,
  522. this.storeCombination.price, this.storeCombination.people +
  523. '人团', '还差' + this.count + '人拼团成功', 9,
  524. (tempFilePath) => {
  525. this.imagePath = tempFilePath;
  526. this.canvasStatus = true;
  527. uni.hideLoading();
  528. });
  529. }, 500);
  530. }
  531. });
  532. }
  533. //#endif
  534. },
  535. goOrder: function() {
  536. var that = this;
  537. uni.navigateTo({
  538. url: '/pages/order_details/index?order_id=' + that.currentPinkOrder
  539. });
  540. },
  541. //拼团列表
  542. goList: function() {
  543. uni.navigateTo({
  544. url: '/pages/activity/goods_combination/index'
  545. });
  546. },
  547. //拼团详情
  548. goDetail: function(id) {
  549. this.pinkId = id;
  550. uni.navigateTo({
  551. url: '/pages/activity/goods_combination_details/index?id=' + id
  552. });
  553. },
  554. // 商品图片转base64
  555. getImageBase64: function(images) {
  556. let that = this;
  557. imageBase64({
  558. url: images
  559. }).then(res => {
  560. that.imgTop = res.data.code;
  561. })
  562. },
  563. // 生成二维码;
  564. make() {
  565. let href = location.protocol + '//' + location.host +
  566. '/pages/activity/goods_combination_status/index?id=' + this.pinkId + "&spread=" + this.uid;
  567. uQRCode.make({
  568. canvasId: 'qrcode',
  569. text: href,
  570. size: this.qrcodeSize,
  571. margin: 10,
  572. success: res => {
  573. this.PromotionCode = res;
  574. },
  575. complete: () => {},
  576. fail: res => {
  577. this.$util.Tips({
  578. title: '海报二维码生成失败!'
  579. });
  580. }
  581. })
  582. },
  583. //拼团信息
  584. getCombinationPink: function() {
  585. var that = this;
  586. getCombinationPink(that.pinkId)
  587. .then(res => {
  588. let storeCombination = res.data.storeCombination;
  589. res.data.pinkT.stop_time = parseInt(res.data.pinkT.stopTime);
  590. that.$set(that, 'storeCombination', storeCombination);
  591. that.$set(that.attr.productSelect, 'num', storeCombination.totalNum);
  592. that.$set(that, 'pinkT', res.data.pinkT);
  593. that.$set(that, 'pinkAll', res.data.pinkAll);
  594. that.$set(that, 'count', res.data.count);
  595. that.$set(that, 'userBool', res.data.userBool);
  596. that.$set(that, 'pinkBool', res.data.pinkBool);
  597. that.$set(that, 'isOk', res.data.isOk);
  598. that.$set(that, 'currentPinkOrder', res.data.currentPinkOrder);
  599. that.$set(that, 'userInfo', res.data.userInfo);
  600. that.onceNum = storeCombination.onceNum;
  601. that.attr.productAttr = storeCombination.productAttr;
  602. that.productValue = storeCombination.productValue;
  603. //#ifdef H5
  604. this.getImageBase64(storeCombination.image);
  605. that.make();
  606. that.setOpenShare();
  607. //#endif
  608. that.setProductSelect();
  609. if (that.attr.productAttr != 0) that.DefaultSelect();
  610. })
  611. .catch(err => {
  612. if (that.isLogin) {
  613. that.$util.Tips({
  614. title: err
  615. }, {
  616. url: '/pages/index/index'
  617. });
  618. }
  619. });
  620. },
  621. //#ifdef H5
  622. setOpenShare() {
  623. let that = this;
  624. let configTimeline = {
  625. title: '您的好友' + that.userInfo.nickname + '邀请您参团' + that.storeCombination.title,
  626. desc: that.storeCombination.title,
  627. link: window.location.protocol + '//' + window.location.host +
  628. '/pages/activity/goods_combination_status/index?id=' + that.pinkId + "&spread=" + this.uid,
  629. imgUrl: that.storeCombination.image
  630. };
  631. if (this.$wechat.isWeixin()) {
  632. this.$wechat
  633. .wechatEvevt(['updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage',
  634. 'onMenuShareTimeline'
  635. ], configTimeline)
  636. .then(res => {
  637. console.log(res);
  638. })
  639. .catch(res => {
  640. if (res.is_ready) {
  641. res.wx.updateAppMessageShareData(configTimeline);
  642. res.wx.updateTimelineShareData(configTimeline);
  643. res.wx.onMenuShareAppMessage(configTimeline);
  644. res.wx.onMenuShareTimeline(configTimeline);
  645. }
  646. });
  647. }
  648. },
  649. //#endif
  650. //拼团取消
  651. getCombinationRemove: function() {
  652. var that = this;
  653. postCombinationRemove({
  654. id: that.pinkId,
  655. cid: that.storeCombination.id
  656. })
  657. .then(res => {
  658. that.$util.Tips({
  659. title: res.msg
  660. }, {
  661. tab: 3
  662. });
  663. })
  664. .catch(res => {
  665. that.$util.Tips({
  666. title: res
  667. });
  668. });
  669. },
  670. lookAll: function() {
  671. this.iShidden = !this.iShidden;
  672. }
  673. }
  674. };
  675. </script>
  676. <style lang="scss" scoped>
  677. .pinkT {
  678. position: relative;
  679. .chief {
  680. position: absolute;
  681. width: 72rpx;
  682. height: 30rpx;
  683. background-color: #E93323;
  684. border-radius: 15rpx;
  685. font-size: 20rpx;
  686. line-height: 30rpx;
  687. text-align: center;
  688. right: -24rpx;
  689. top: -16rpx;
  690. color: #fff;
  691. }
  692. }
  693. .canvas {
  694. position: fixed;
  695. opacity: 0;
  696. }
  697. .poster-pop {
  698. width: 594rpx;
  699. height: 850rpx;
  700. position: fixed;
  701. left: 50%;
  702. transform: translateX(-50%);
  703. z-index: 999;
  704. top: 50%;
  705. margin-top: -466rpx;
  706. image {
  707. width: 100%;
  708. height: 100%;
  709. display: block;
  710. border-radius: 10rpx;
  711. }
  712. .close {
  713. text-align: center;
  714. margin-top: 55rpx;
  715. color: #fff;
  716. font-size: 52rpx;
  717. }
  718. .save-poster {
  719. background-color: #df2d0a;
  720. font-size: :22rpx;
  721. color: #fff;
  722. text-align: center;
  723. height: 76rpx;
  724. line-height: 76rpx;
  725. width: 100%;
  726. }
  727. .keep {
  728. color: #fff;
  729. text-align: center;
  730. font-size: 25rpx;
  731. margin-top: 25rpx;
  732. }
  733. }
  734. /*开团*/
  735. .group-con .header {
  736. width: 100%;
  737. height: 186rpx;
  738. background-color: #fff;
  739. border-top: 1px solid #f5f5f5;
  740. padding: 0 30rpx;
  741. position: relative;
  742. }
  743. .group-con .header .iconfont {
  744. font-size: 100rpx;
  745. position: absolute;
  746. color: #ccc;
  747. right: 33rpx;
  748. bottom: 20rpx;
  749. }
  750. .group-con .header .pictrue {
  751. width: 140rpx;
  752. height: 140rpx;
  753. }
  754. .group-con .header .pictrue img {
  755. width: 100%;
  756. height: 100%;
  757. border-radius: 6rpx;
  758. }
  759. .group-con .header .text {
  760. width: 540rpx;
  761. font-size: 30rpx;
  762. color: #222;
  763. }
  764. .group-con .header .text .money {
  765. font-size: 24rpx;
  766. font-weight: bold;
  767. margin-top: 15rpx;
  768. }
  769. .group-con .header .text .money .num {
  770. font-size: 32rpx;
  771. }
  772. .group-con .header .text .money .team {
  773. padding: 1rpx 10rpx;
  774. font-weight: normal;
  775. border-radius: 50rpx;
  776. font-size: 20rpx;
  777. vertical-align: 4rpx;
  778. margin-left: 15rpx;
  779. }
  780. .group-con .wrapper {
  781. background-color: #fff;
  782. margin-top: 20rpx;
  783. padding: 2rpx 0 35rpx 0;
  784. }
  785. .group-con .wrapper .title {
  786. margin-top: 30rpx;
  787. }
  788. .group-con .wrapper .title .line {
  789. width: 136rpx;
  790. height: 1px;
  791. background-color: #ddd;
  792. }
  793. .group-con .wrapper .title .name {
  794. margin: 0 45rpx;
  795. font-size: 28rpx;
  796. color: #282828;
  797. }
  798. .group-con .wrapper .title .name .time {
  799. margin: 0 14rpx;
  800. }
  801. .group-con .wrapper .title .name .timeTxt {
  802. color: #fc4141;
  803. }
  804. .group-con .wrapper .title .name .time .styleAll {
  805. background-color: #ffcfcb;
  806. text-align: center;
  807. border-radius: 3rpx;
  808. font-size: 28rpx;
  809. font-weight: bold;
  810. display: inline-block;
  811. vertical-align: middle;
  812. color: #fc4141;
  813. padding: 2rpx 5rpx;
  814. }
  815. .group-con .wrapper .tips {
  816. font-size: 30rpx;
  817. font-weight: bold;
  818. text-align: center;
  819. margin-top: 30rpx;
  820. color: #999;
  821. }
  822. .group-con .wrapper .list {
  823. padding: 0 30rpx;
  824. margin-top: 45rpx;
  825. }
  826. .group-con .wrapper .list.result {
  827. max-height: 240rpx;
  828. }
  829. .group-con .wrapper .list.result.on {
  830. max-height: 2000rpx;
  831. }
  832. .group-con .wrapper .list .pictrue {
  833. width: 94rpx;
  834. height: 94rpx;
  835. margin: 0 0 29rpx 35rpx;
  836. }
  837. .group-con .wrapper .list .pictrue img {
  838. width: 100%;
  839. height: 100%;
  840. border-radius: 50%;
  841. border: 2rpx solid #e93323;
  842. }
  843. .group-con .wrapper .list .pictrue img.img-none {
  844. border: none;
  845. }
  846. .group-con .wrapper .lookAll {
  847. font-size: 24rpx;
  848. color: #282828;
  849. padding-top: 10rpx;
  850. }
  851. .group-con .wrapper .lookAll .iconfont {
  852. font-size: 25rpx;
  853. margin: 2rpx 0 0 10rpx;
  854. }
  855. .group-con .wrapper .teamBnt {
  856. font-size: 30rpx;
  857. width: 620rpx;
  858. height: 86rpx;
  859. border-radius: 50rpx;
  860. text-align: center;
  861. line-height: 86rpx;
  862. color: #fff;
  863. margin: 21rpx auto 0 auto;
  864. }
  865. .group-con .wrapper .cancel,
  866. .group-con .wrapper .lookOrder {
  867. text-align: center;
  868. font-size: 24rpx;
  869. color: #282828;
  870. padding-top: 30rpx;
  871. }
  872. .group-con .wrapper .cancel .iconfont {
  873. font-size: 35rpx;
  874. color: #2c2c2c;
  875. vertical-align: -4rpx;
  876. margin-right: 9rpx;
  877. }
  878. .group-con .wrapper .lookOrder .iconfont {
  879. font-size: 25rpx;
  880. color: #2c2c2c;
  881. margin-left: 10rpx;
  882. }
  883. .group-con .group-recommend {
  884. background-color: #fff;
  885. margin-top: 25rpx;
  886. }
  887. .group-con .group-recommend .title {
  888. padding-right: 30rpx;
  889. margin-left: 30rpx;
  890. height: 85rpx;
  891. border-bottom: 1px solid #eee;
  892. font-size: 28rpx;
  893. color: #282828;
  894. }
  895. .group-con .group-recommend .title .more {
  896. color: #808080;
  897. }
  898. .group-con .group-recommend .title .more .iconfont {
  899. margin-left: 13rpx;
  900. font-size: 28rpx;
  901. }
  902. .group-con .group-recommend .list {
  903. margin-top: 30rpx;
  904. }
  905. .group-con .group-recommend .list .item {
  906. width: 210rpx;
  907. margin: 0 0 25rpx 30rpx;
  908. }
  909. .group-con .group-recommend .list .item .pictrue {
  910. width: 100%;
  911. height: 210rpx;
  912. position: relative;
  913. }
  914. .group-con .group-recommend .list .item .pictrue img {
  915. width: 100%;
  916. height: 100%;
  917. border-radius: 10rpx;
  918. }
  919. .group-con .group-recommend .list .item .pictrue .team {
  920. position: absolute;
  921. top: 28rpx;
  922. left: -5rpx;
  923. min-width: 100rpx;
  924. height: 36rpx;
  925. line-height: 36rpx;
  926. text-align: center;
  927. border-radius: 0 18rpx 18rpx 0;
  928. font-size: 20rpx;
  929. color: #fff;
  930. background-image: linear-gradient(to right, #fb5445 0%, #e93323 100%);
  931. background-image: -webkit-linear-gradient(to right, #fb5445 0%, #e93323 100%);
  932. background-image: -moz-linear-gradient(to right, #fb5445 0%, #e93323 100%);
  933. }
  934. .group-con .group-recommend .list .item .name {
  935. font-size: 28rpx;
  936. color: #333;
  937. margin-top: 0.18rem;
  938. }
  939. .group-con .group-recommend .list .item .money {
  940. font-weight: bold;
  941. font-size: 28rpx;
  942. }
  943. .share-box {
  944. z-index: 1000;
  945. position: fixed;
  946. left: 0;
  947. top: 0;
  948. width: 100%;
  949. height: 100%;
  950. image {
  951. width: 100%;
  952. height: 100%;
  953. }
  954. }
  955. </style>