Jacob
2026-10-12 24836dd1775b36ac260ec12068d1b303aec40460
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
<template>
   <view class="popCoupon" :class="isShow?'show':''">
   <!--     <view class="guoqing_box">
           <image class="guoqing_img" src="https://ossacmall.bluedeer.com.cn/app/static/images/pop_guoqing.png">
           </image>
           <view class="guoqing_btn" @click="getCoupon('all')"></view>
           <view class="guoqing_close" @click="hide()"> </view>
       </view> -->
       <view class="box" v-if="true">
           <view class="title" v-if="pageName == 'zone' && zoneType==3"></view>
           <view class="title" v-else>恭喜获得商城优惠券</view>
           <view class="zone-content" v-if="pageName == 'zone' && zoneType==3">
               签到成功,赠您悦养商城优惠券
           </view>
           <view class="couponList" v-else-if="couponList.length">
               <view class="couponList_item" v-for="(item,index) in couponList" :key="item.uniKey">
                   <view class="line"></view>
                   <block v-if="item.moneyType==2">
                       <view class="amount">{{item.money?Number(item.money)*10:''}}<text class="unit2">折</text></view>
                   </block>
                   <block v-else-if="item.moneyType==4">
                       <view class="amount amountSmall">
                           <block v-if="item.userLvType==4">
                               <text>臻享专区</text><br><text class="unit2">惠购权</text>
                           </block>
                           <block v-else-if="item.userLvType==3">
                               <text>臻享会员</text><br><text class="unit2">权益券</text>
                           </block>
                           <block v-else-if="item.userLvType==2">
                               <text>悦享会员</text><br><text class="unit2">权益券</text>
                           </block>
                           <block v-else-if="item.userLvType==1">
                               <text>畅享会员</text><br><text class="unit2">权益券</text>
                           </block>
                           <block v-else-if="item.userLvType==0">
                               <text>普通会员</text><br><text class="unit2">权益券</text>
                           </block>
                           <block v-else-if="item.userLvType==-1">
                               <text>臻享会员</text><br><text class="unit2">体验券</text>
                           </block>
                           <block v-else>
                               {{item.name}}
                           </block>
                       </view>
                   </block>
                   <block v-else>
                       <view class="amount"><text class="unit1">¥</text>{{item.money}}</view>
                   </block>
                   <view class="info" v-if="item.moneyType!==4">满{{item.minPrice}}元可用</view>
                   <view class="name">
                       <text class="type" v-if="item.type==3">品类</text>
                       <text class="type" v-else-if="item.type==2">商品</text>
                       <text class="type" v-else-if="item.moneyType==4">权益</text>
                       <text class="type" v-else>通用</text>
                       <text v-if="item.moneyType==4&&item.userLvType==4">仅限臻享专区使用</text>
                       <text v-else-if="item.moneyType==4&item.userLvType!==4">仅限分类商品使用</text>
                       <text v-else>{{item.name}}</text>
                   </view>
                   <view class="time">
                       {{item.useStartTimeStr?item.useStartTimeStr:''}}{{(item.useStartTimeStr&&item.useEndTimeStr)?'-':''}}{{item.useEndTimeStr?item.useEndTimeStr:''}}
                   </view>
                   <view class="get_btn" @click="getCoupon(false,item,index)" :class="item.isUse?'used':''">
                       {{item.isUse?'去使用':'立即领取'}}
                   </view>
               </view>
           </view>
           <view class="btn_box" v-if="pageName == 'zone' && zoneType==3">
               <view class="btn ok" @click="getZoneCoupon()">一键领取</view>
           </view>
           <view class="btn_box" v-else-if="!isGetAll">
               <view class="btn ok" @click="getCoupon('all')">一键领取全部</view>
           </view>
           <view class="popCoupon_close" @click="hide()"></view>
       </view>
   </view>
 
</template>
 
<script>
   import {
       getStoreZoneAndCouponPopupList,
       getZoneCouponList
   } from '@/api/store.js';
   import {
       setWholeCouponReceive,
       setCouponReceive
   }
   from '@/api/api.js';
   export default {
       name: "popCoupon",
       props: {
           pageName: String,
           zoneId: Number,
           zoneType:Number
       },
       data() {
           return {
               isShow: false,
               couponList: [],
               isGetAll: false,
               isClicking:false
           };
       },
       methods: {
           getZoneCoupon(){
               this.$util.Tips({
                   title: '领取成功'
               });
               this.hide()
           },
           getCoupon: function(isWhole, item, index) {
               let that = this;
               if (!that.$store.getters.isLogin) {
                   that.goToLogin();
                   return false;
               }
               if(that.isClicking){
                   return false;
               }
               //领取优惠券
               if (isWhole) {
                   let nameArr = {
                       index: '首页',
                       addCart: '购物车',
                       user: '我的',
                       zone: '专区',
                       goodsCate: '商品分类',
                       goodsDetails: '商品详情'
                   };
                   this.addTrack('yy_marketPageClick', {
                       pageTitle_var: nameArr[that.pageName] ? nameArr[that.pageName] : '-',
                       firstTabName_var: '-',
                       moduleName_var: '优惠券弹窗',
                       buttonName_var: '一键领取'
                   });
                   let couponIds = [];
                   that.couponList.forEach((item1, index1) => {
                       if (!item1.isUse) {
                           couponIds.push(item1.id);
                       }
                   })
                   if (couponIds.length > 0) {
                       var useNum = 0;
                       that.isClicking=true;
                       uni.showLoading()
                       setWholeCouponReceive({
                           couponIds: couponIds,
                       }).then(function(res) {
                           uni.hideLoading();
                           that.isClicking=false;
                           let nameArr = [];
                           let idArr = [];
                           that.couponList.forEach((item1, index1) => {
                               if (!item1.isUse) {
                                   that.couponList[index1].isUse = true;
                                   nameArr.push(item1.name);
                                   idArr.push(item1.id);
                               }
                           });
                           that.isGetAll = true;
                           that.hide();
                           if (that.pageName == 'index' || that.pageName == 'addcart' || that
                               .pageName == 'user') {
                               that.$parent.$refs.showConfirm.show({
                                   title: '领取成功',
                                   content: '优惠券已收入囊中!可在<span class="strong" style="color:#016DCC;">「我的优惠券」</span>中查看,快去挑选心仪好物吧~',
                                   center: true,
                                   hideCancel: true,
                                   showClose: true,
                                   confirmText: '去使用',
                                   success: function(res) {
                                       that.hide();
                                       uni.switchTab({
                                           url: '/pages/goods_cate/goods_cate'
                                       })
                                   }
                               });
                           } else {
                               that.$util.Tips({
                                   title: '领取成功'
                               });
                           }
                           that.addTrack('yy_getCoupon', {
                               'couponName_var': nameArr.join(','),
                               'couponId_var': idArr.join(',')
                           });
                           if (that.pageName == 'index') {
                               that.$emit('resetCoupon', idArr)
                           }else if (that.pageName == 'goodsDetails') {
                               console.log(22222,that.pageName );
                               that.$emit('getInitData',false)
                           }
                       }).catch(err => {
                           uni.hideLoading();
                           that.isClicking=false;
                           return that.$util.Tips({
                               title: (err && err.message) ? err.message : err
                           });
                       });
                   } else {
                       that.isGetAll = true;
                       that.hide();
                   }
               } else {
                   if (item.isUse) {
                       if (that.pageName == 'index' || that.pageName == 'addcart' || that.pageName == 'user') {
                           that.hide();
                           that.isClicking=true;
                           var timer=setTimeout(()=>{
                               clearTimeout(timer);
                               that.isClicking=false;
                           },500)
                           if (item.appId && item.toPath) {
                               that.goToThird(item.toPath, item.appId);
                           } else if (item.toPath) {
                               if (that.isTabLink(item.toPath)) {
                                   uni.switchTab({
                                       url: item.toPath
                                   })
                               } else {
                                   uni.navigateTo({
                                       url: item.toPath
                                   })
                               }
                           } else {
                               uni.switchTab({
                                   url: '/pages/goods_cate/goods_cate'
                               })
                           }
                       } else {
                           that.hide();
                       }
                   } else {
                       that.isClicking=true;
                       uni.showLoading()
                       setCouponReceive(item.id).then(function(res) {
                           that.isClicking=false;
                           uni.hideLoading()
                           that.addTrack('yy_getCoupon', {
                               'couponName_var': item.name,
                               'couponId_var': item.id
                           });
                           that.$set(that.couponList[index], 'isUse', true);
                           that.$util.Tips({
                               title: '领取成功'
                           });
                           if (that.pageName == 'index') {
                               that.$emit('resetCoupon', [item.id])
                           }else if (that.pageName == 'goodsDetails') {
                               console.log('11111111',that.pageName );
                               that.$emit('getInitData',false)
                           }
                       }).catch(err => {
                           that.isClicking=false;
                           uni.hideLoading()
                           return that.$util.Tips({
                               title: (err && err.message) ? err.message : err
                           });
                       })
                   }
               }
           },
           show(parentCouponList) {
               let that = this;
               this.hide()
               return false;
               function getCouponList(couponList) {
                   if (couponList.length > 0) {
                       couponList.map((item, index) => {
                           item.uniKey = 'popCouponList' + index;
                       })
                       that.isGetAll = false;
                       that.$set(that, 'couponList', couponList);
                       that.isShow = true;
                   } else {
                       that.hide()
                   }
               }
               if (that.pageName == 'zone') {
                   if(that.zoneType==3){
                       //签到专区
                       const hasShown=uni.getStorageSync(that.zoneId+'-hasCoupon');
                       if(!hasShown){
                           that.isShow = true;
                           uni.setStorageSync(that.zoneId+'-hasCoupon',true);
                       }
                   } else {                        
                       getZoneCouponList(that.zoneId).then(res => {
                           getCouponList((res.data && res.data.length) > 0 ? res.data : []);
                       });
                   }
               } else {
                   getStoreZoneAndCouponPopupList({}).then(res => {
                       getCouponList((res.data && res.data.storeCouponList) ? res.data.storeCouponList : []);
                   });
               }
 
           },
           hide() {
               this.isShow = false;
               this.$emit('hide')
           },
       }
   }
</script>
 
<style lang="scss" scoped>
   .popCoupon {
       position: fixed;
       left: 0;
       top: 0;
       width: 100%;
       height: 100%;
       z-index: 11111;
       background-color: rgba(0, 0, 0, .7);
       display: none;
 
       &.show {
           display: block;
       }
 
       .box {
           width: 600rpx;
           padding: 90rpx 0 70rpx 0;
           background: url("https://ossacmall.bluedeer.com.cn/app/static/images/confirm_bg.png") center -120rpx/100% auto no-repeat;
           background-color: #f5f5f5;
           position: absolute;
           left: 50%;
           top: 50%;
           transform: translate(-50%, -50%);
           border-radius: 14rpx;
       }
 
       .popCoupon_close {
           position: absolute;
           right: 10rpx;
           top: 10rpx;
           width: 90rpx;
           height: 90rpx;
           background: url("https://ossacmall.bluedeer.com.cn/app/static/images/pop_close.png") center center/30rpx auto no-repeat;
       }
 
       .title {
           lineh-height: 40rpx;
           font-size: 30rpx;
           font-weight: bold;
           color: #000000;
           text-align: center;
       }
 
       .couponList {
           width: 100%;
           max-height: 100vw;
           overflow-y: scroll;
           margin-top: 50rpx;
           margin-bottom: 50rpx;
       }
       .zone-content{
           font-size: 30rpx;
           font-weight: bold;
           color: #000000;
           text-align: center;
           margin-top: 50rpx;
           margin-bottom: 50rpx;
       }
 
       .couponList_item {
           position: relative;
           width: 520rpx;
           height: 146rpx;
           color: #000000;
           background: #FFE20E;
           border-radius: 11rpx;
           overflow: hidden;
           margin: 0 auto 20rpx auto;
 
           &:last-child {
               margin-bottom: 0;
           }
 
           &:before,
           &:after {
               content: '';
               display: block;
               width: 18rpx;
               height: 18rpx;
               position: absolute;
               left: 205rpx;
               margin-left: -9rpx;
               background: #f5f5f5;
               border-radius: 50%;
               z-index: 2;
           }
 
           &:before {
               top: -9rpx;
           }
 
           &:after {
               bottom: -9rpx;
           }
 
           .line {
               height: 100%;
               border-left: 1px dashed #f5f5f5;
               position: absolute;
               left: 205rpx;
               top: 0;
           }
 
           .amount {
               font-size: 57rpx;
               line-height: 1em;
               position: absolute;
               left: 102rpx;
               top: 30rpx;
               width: max-content;
               transform: translateX(-50%);
               font-weight: bold;
               text-align: center;
 
               &.amountSmall {
                   font-size: 30rpx;
                   padding-top: 15rpx;
               }
 
               .unit1 {
                   font-size: 22rpx;
                   position: absolute;
                   left: -15rpx;
                   top: -18rpx;
               }
 
               .unit2 {
                   font-size: 23rpx;
                   line-height: 30rpx;
               }
           }
 
           .info {
               font-size: 19rpx;
               line-height: 29rpx;
               position: absolute;
               left: 102rpx;
               top: 93rpx;
               width: max-content;
               transform: translateX(-50%);
           }
 
           .get_btn {
               width: 111rpx;
               font-size: 19rpx;
               line-height: 40rpx;
               text-align: center;
               background: #016DCC;
               color: #ffffff;
               border-radius: 6rpx;
               position: absolute;
               right: 19rpx;
               bottom: 19rpx;
           }
 
           .name {
               font-weight: bold;
               font-size: 23rpx;
               line-height: 30rpx;
               position: absolute;
               left: 218rpx;
               top: 30rpx;
               display: flex;
 
               .type {
                   border-radius: 15rpx;
                   background-color: #04C763;
                   padding: 0 12rpx;
                   font-size: 17rpx;
                   color: #ffffff;
                   margin-right: 10rpx;
               }
           }
 
           .time {}
       }
 
       .btn_box {
           display: flex;
           display: flex;
           justify-content: space-around;
           margin: 0 auto;
           text-align: center;
       }
 
       .btn {
           width: 237rpx;
           font-size: 27rpx;
           line-height: 80rpx;
           background: #002561;
           color: #ffffff;
           border-radius: 11rpx;
       }
 
       .ok {
           background: #016DCC;
       }
   }
 
   .guoqing_box {
       width: 643rpx;
       height: 1024rpx;
       position: absolute;
       left: 50%;
       top: 50%;
       transform: translate(-50%, -50%);
 
       .guoqing_img {
           width: 643rpx;
           height: 894rpx;
       }
 
       .guoqing_btn {
           width: 360rpx;
           height: 82rpx;
           position: absolute;
           left: 50%;
           margin-left: -180rpx;
           bottom: 130rpx;
       }
 
       .guoqing_close {
           position: absolute;
           left: 50%;
           margin-left: -45rpx;
           bottom: 0;
           width: 90rpx;
           height: 90rpx;
           background: url("https://ossacmall.bluedeer.com.cn/app/static/images/pop_close2.png") center center/78rpx auto no-repeat;
 
       }
   }
</style>