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