Commit 62a4ed9b418ec0c8c43565c32ea762916a676227

Authored by pengye
1 parent 953dbc61

券详情领取后显示券有效期

... ... @@ -209,7 +209,7 @@ Page({
})
},
// 获取券信息
getDetail() {
getDetail(cdate,activity_id) {
App.Activity.GetActivityById({
id: this.data.opt.id
}).then(res => {
... ... @@ -235,23 +235,24 @@ Page({
detail.foreverText = '永久有效';
detail.useEtimeStr = '永久有效';
}
let t = cdate ? cdate : detail.cdate;
// today 领券当日起天数
if (condition.valid_forever === '0' && condition.today) {
let obj = this.setTimeRange(detail.cdate, 0, parseInt(condition.today)-1);
let obj = this.setTimeRange(t, 0, parseInt(condition.today)-1);
detail.useStime = obj.useStime;
detail.useEtime = obj.useEtime;
detail.useEtimeStr = '领取当日起' + condition.today + '天内有效';
}
// tomorrow 领券次日起天数
if (condition.valid_forever === '0' && condition.tomorrow) {
let obj = this.setTimeRange(detail.cdate, 1, condition.tomorrow*1);
let obj = this.setTimeRange(t, 1, condition.tomorrow*1);
detail.useStime = obj.useStime;
detail.useEtime = obj.useEtime;
detail.useEtimeStr = '领取次日起' + condition.tomorrow + '天内有效';
}
// sday 领券后第几天的开始天数 eday 领券后第几天的结束天数
if (condition.valid_forever === '0' && condition.sday && condition.eday) {
let obj = this.setTimeRange(detail.cdate, parseInt(condition.sday) - 1, parseInt(condition.eday) - 1);
let obj = this.setTimeRange(t, parseInt(condition.sday) - 1, parseInt(condition.eday) - 1);
detail.useStime = obj.useStime;
detail.useEtime = obj.useEtime;
detail.useEtimeStr = '领取后第' + condition.sday + '天至' + condition.eday + '天可用';
... ... @@ -283,6 +284,8 @@ Page({
}
let price = detail.price * 1;
let num = this.data.num * 1;
detail.activity_id = activity_id;
console.log('券详情--',{...detail});
this.setData({
detail,
exp_date,
... ... @@ -475,17 +478,17 @@ Page({
}
},
// 是否已领取
getCoupon() {
getCoupon(i) {
App.Activity.ActivityListByOpenid({
aid: this.data.opt.id,
sellerid:this.data.opt.sid
}).then(res => {
if (res.ret === 200) {
let detail = this.data.detail;
detail.activity_id = res.data.length > 0 ? res.data[0].activity_id : '';
let activity_id = res.data.length > 0 ? res.data[0].activity_id : '';
this.setData({
resultCoupon: res.data.length > 0 && detail.is_type == '3' ? '1' : '0',
resultCoupon: res.data.length > 0 && res.data[0].is_type == '3' ? '1' : '0',
})
if(i) this.getDetail(res.data[0].cdate,activity_id);
}
})
},
... ... @@ -494,9 +497,9 @@ Page({
*/
onReady() {
this.myToast = this.selectComponent("#myToast")
this.getDetail();
this.getSellerDetail();
this.getCoupon()
this.getCoupon('1')
},
// 计算2点之间的距离
getDistance(lat1, lon1, lat2, lon2) {
... ...