|
...
|
...
|
@@ -60,9 +60,7 @@ Page({ |
|
|
|
sellerid: this.sid
|
|
|
|
}).then(res => {
|
|
|
|
if (res.ret == 200 && res.data && res.data.length > 0) {
|
|
|
|
let list = res.data.filter(item => {
|
|
|
|
return this.data.dataStr < (item.etime * 1)
|
|
|
|
})
|
|
|
|
let list = res.data
|
|
|
|
// console.log('listlistlist',JSON.stringify(list));
|
|
|
|
// list= monidata
|
|
|
|
list.forEach(detail => {
|
|
...
|
...
|
@@ -82,8 +80,32 @@ Page({ |
|
|
|
}
|
|
|
|
detail.checked = false;
|
|
|
|
detail.showCpupon = '0';
|
|
|
|
detail.cdateText = util.unixtoTime(detail.cdate, 'YYYY-MM-DD')
|
|
|
|
detail.endDateStr = util.unixtoTime(detail.stime, 'YYYY-MM-DD') + '至' + util.unixtoTime(detail.etime, 'YYYY-MM-DD')
|
|
|
|
let cdateText = ''; //有效期开始时间(如果领取当天可用,领取之日, 否则就是次日)
|
|
|
|
let edateText = ''; //有效期截止时间(领取日期+领取后几天有效的日期)
|
|
|
|
let date = new Date(detail.cdate * 1000);
|
|
|
|
if (detail.arule.is_same_day != '1') {
|
|
|
|
date.setDate(date.getDate() + 1);
|
|
|
|
}
|
|
|
|
date.setHours(0, 0, 0, 0);
|
|
|
|
let newTimestamp = Math.floor(date.getTime() / 1000);
|
|
|
|
cdateText = util.unixtoTime(newTimestamp, 'YYYY-MM-DD HH:II')
|
|
|
|
detail.cdateText = cdateText;
|
|
|
|
if (detail.aexpiration == '0' || detail.aexpiration == '') {
|
|
|
|
edateText = util.unixtoTime(detail.etime, 'YYYY-MM-DD HH:II')
|
|
|
|
detail.deadlineDate = detail.etime
|
|
|
|
} else {
|
|
|
|
let time = new Date(detail.cdate * 1000);
|
|
|
|
time.setDate(time.getDate() + parseInt(detail.aexpiration));
|
|
|
|
time.setHours(23, 59, 0, 0);
|
|
|
|
let deadlineDate = Math.floor(time.getTime() / 1000);
|
|
|
|
detail.deadlineDate = deadlineDate
|
|
|
|
edateText = util.unixtoTime(deadlineDate, 'YYYY-MM-DD HH:II')
|
|
|
|
}
|
|
|
|
detail.endDateStr = cdateText + '至' + edateText
|
|
|
|
})
|
|
|
|
// 筛选出当前时间 > 领取日期+领取后几天有效的日期
|
|
|
|
list = list.filter(item => {
|
|
|
|
return this.data.dataStr < (item.deadlineDate * 1)
|
|
|
|
})
|
|
|
|
list.sort((a, b) => {
|
|
|
|
return (a.etime * 1) - (b.etime * 1)
|
|
...
|
...
|
@@ -319,6 +341,7 @@ Page({ |
|
|
|
} else {
|
|
|
|
endUseDate.setDate(couponDate.getDate() + parseInt(coupon.aexpiration));
|
|
|
|
}
|
|
|
|
endUseDate.setHours(23, 59, 59, 999);
|
|
|
|
// 今天不是领取当日,但在有效天数内 && 今天是领取当日且可用 && 券是开启状态
|
|
|
|
const isUseDate = (currentDate > startUseDate && currentDate < endUseDate) && coupon.is_open == '1'
|
|
|
|
let selectedValue = true;
|
|
...
|
...
|
@@ -362,10 +385,7 @@ Page({ |
|
|
|
availableDate = false
|
|
|
|
}
|
|
|
|
coupon.isOk = isUseDate && (availableDate || coupon.exp_date.week_show == '无') ? '1' : '0'; //是否在可用时间内 1可使用 2不可使用
|
|
|
|
endUseDate.setHours(23, 59, 59, 999); // 设置时间为23:59:59.999
|
|
|
|
const timestamp = Math.floor(endUseDate.getTime() / 1000);
|
|
|
|
let c = coupon.etime * 1
|
|
|
|
coupon.expirationDate = Math.min(timestamp, c);
|
|
|
|
coupon.expirationDate = coupon.deadlineDate;
|
|
|
|
});
|
|
|
|
return list
|
|
|
|
},
|
...
|
...
|
|