|
@@ -60,9 +60,7 @@ Page({ |
|
@@ -60,9 +60,7 @@ Page({ |
|
60
|
sellerid: this.sid
|
60
|
sellerid: this.sid
|
|
61
|
}).then(res => {
|
61
|
}).then(res => {
|
|
62
|
if (res.ret == 200 && res.data && res.data.length > 0) {
|
62
|
if (res.ret == 200 && res.data && res.data.length > 0) {
|
|
63
|
- let list = res.data.filter(item => {
|
|
|
|
64
|
- return this.data.dataStr < (item.etime * 1)
|
|
|
|
65
|
- })
|
63
|
+ let list = res.data
|
|
66
|
// console.log('listlistlist',JSON.stringify(list));
|
64
|
// console.log('listlistlist',JSON.stringify(list));
|
|
67
|
// list= monidata
|
65
|
// list= monidata
|
|
68
|
list.forEach(detail => {
|
66
|
list.forEach(detail => {
|
|
@@ -82,8 +80,32 @@ Page({ |
|
@@ -82,8 +80,32 @@ Page({ |
|
82
|
}
|
80
|
}
|
|
83
|
detail.checked = false;
|
81
|
detail.checked = false;
|
|
84
|
detail.showCpupon = '0';
|
82
|
detail.showCpupon = '0';
|
|
85
|
- detail.cdateText = util.unixtoTime(detail.cdate, 'YYYY-MM-DD')
|
|
|
|
86
|
- detail.endDateStr = util.unixtoTime(detail.stime, 'YYYY-MM-DD') + '至' + util.unixtoTime(detail.etime, 'YYYY-MM-DD')
|
83
|
+ let cdateText = ''; //有效期开始时间(如果领取当天可用,领取之日, 否则就是次日)
|
|
|
|
84
|
+ let edateText = ''; //有效期截止时间(领取日期+领取后几天有效的日期)
|
|
|
|
85
|
+ let date = new Date(detail.cdate * 1000);
|
|
|
|
86
|
+ if (detail.arule.is_same_day != '1') {
|
|
|
|
87
|
+ date.setDate(date.getDate() + 1);
|
|
|
|
88
|
+ }
|
|
|
|
89
|
+ date.setHours(0, 0, 0, 0);
|
|
|
|
90
|
+ let newTimestamp = Math.floor(date.getTime() / 1000);
|
|
|
|
91
|
+ cdateText = util.unixtoTime(newTimestamp, 'YYYY-MM-DD HH:II')
|
|
|
|
92
|
+ detail.cdateText = cdateText;
|
|
|
|
93
|
+ if (detail.aexpiration == '0' || detail.aexpiration == '') {
|
|
|
|
94
|
+ edateText = util.unixtoTime(detail.etime, 'YYYY-MM-DD HH:II')
|
|
|
|
95
|
+ detail.deadlineDate = detail.etime
|
|
|
|
96
|
+ } else {
|
|
|
|
97
|
+ let time = new Date(detail.cdate * 1000);
|
|
|
|
98
|
+ time.setDate(time.getDate() + parseInt(detail.aexpiration));
|
|
|
|
99
|
+ time.setHours(23, 59, 0, 0);
|
|
|
|
100
|
+ let deadlineDate = Math.floor(time.getTime() / 1000);
|
|
|
|
101
|
+ detail.deadlineDate = deadlineDate
|
|
|
|
102
|
+ edateText = util.unixtoTime(deadlineDate, 'YYYY-MM-DD HH:II')
|
|
|
|
103
|
+ }
|
|
|
|
104
|
+ detail.endDateStr = cdateText + '至' + edateText
|
|
|
|
105
|
+ })
|
|
|
|
106
|
+ // 筛选出当前时间 > 领取日期+领取后几天有效的日期
|
|
|
|
107
|
+ list = list.filter(item => {
|
|
|
|
108
|
+ return this.data.dataStr < (item.deadlineDate * 1)
|
|
87
|
})
|
109
|
})
|
|
88
|
list.sort((a, b) => {
|
110
|
list.sort((a, b) => {
|
|
89
|
return (a.etime * 1) - (b.etime * 1)
|
111
|
return (a.etime * 1) - (b.etime * 1)
|
|
@@ -319,6 +341,7 @@ Page({ |
|
@@ -319,6 +341,7 @@ Page({ |
|
319
|
} else {
|
341
|
} else {
|
|
320
|
endUseDate.setDate(couponDate.getDate() + parseInt(coupon.aexpiration));
|
342
|
endUseDate.setDate(couponDate.getDate() + parseInt(coupon.aexpiration));
|
|
321
|
}
|
343
|
}
|
|
|
|
344
|
+ endUseDate.setHours(23, 59, 59, 999);
|
|
322
|
// 今天不是领取当日,但在有效天数内 && 今天是领取当日且可用 && 券是开启状态
|
345
|
// 今天不是领取当日,但在有效天数内 && 今天是领取当日且可用 && 券是开启状态
|
|
323
|
const isUseDate = (currentDate > startUseDate && currentDate < endUseDate) && coupon.is_open == '1'
|
346
|
const isUseDate = (currentDate > startUseDate && currentDate < endUseDate) && coupon.is_open == '1'
|
|
324
|
let selectedValue = true;
|
347
|
let selectedValue = true;
|
|
@@ -362,10 +385,7 @@ Page({ |
|
@@ -362,10 +385,7 @@ Page({ |
|
362
|
availableDate = false
|
385
|
availableDate = false
|
|
363
|
}
|
386
|
}
|
|
364
|
coupon.isOk = isUseDate && (availableDate || coupon.exp_date.week_show == '无') ? '1' : '0'; //是否在可用时间内 1可使用 2不可使用
|
387
|
coupon.isOk = isUseDate && (availableDate || coupon.exp_date.week_show == '无') ? '1' : '0'; //是否在可用时间内 1可使用 2不可使用
|
|
365
|
- endUseDate.setHours(23, 59, 59, 999); // 设置时间为23:59:59.999
|
|
|
|
366
|
- const timestamp = Math.floor(endUseDate.getTime() / 1000);
|
|
|
|
367
|
- let c = coupon.etime * 1
|
|
|
|
368
|
- coupon.expirationDate = Math.min(timestamp, c);
|
388
|
+ coupon.expirationDate = coupon.deadlineDate;
|
|
369
|
});
|
389
|
});
|
|
370
|
return list
|
390
|
return list
|
|
371
|
},
|
391
|
},
|