Commit 62a4ed9b418ec0c8c43565c32ea762916a676227

Authored by pengye
1 parent 953dbc61

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

@@ -209,7 +209,7 @@ Page({ @@ -209,7 +209,7 @@ Page({
209 }) 209 })
210 }, 210 },
211 // 获取券信息 211 // 获取券信息
212 - getDetail() { 212 + getDetail(cdate,activity_id) {
213 App.Activity.GetActivityById({ 213 App.Activity.GetActivityById({
214 id: this.data.opt.id 214 id: this.data.opt.id
215 }).then(res => { 215 }).then(res => {
@@ -235,23 +235,24 @@ Page({ @@ -235,23 +235,24 @@ Page({
235 detail.foreverText = '永久有效'; 235 detail.foreverText = '永久有效';
236 detail.useEtimeStr = '永久有效'; 236 detail.useEtimeStr = '永久有效';
237 } 237 }
  238 + let t = cdate ? cdate : detail.cdate;
238 // today 领券当日起天数 239 // today 领券当日起天数
239 if (condition.valid_forever === '0' && condition.today) { 240 if (condition.valid_forever === '0' && condition.today) {
240 - let obj = this.setTimeRange(detail.cdate, 0, parseInt(condition.today)-1); 241 + let obj = this.setTimeRange(t, 0, parseInt(condition.today)-1);
241 detail.useStime = obj.useStime; 242 detail.useStime = obj.useStime;
242 detail.useEtime = obj.useEtime; 243 detail.useEtime = obj.useEtime;
243 detail.useEtimeStr = '领取当日起' + condition.today + '天内有效'; 244 detail.useEtimeStr = '领取当日起' + condition.today + '天内有效';
244 } 245 }
245 // tomorrow 领券次日起天数 246 // tomorrow 领券次日起天数
246 if (condition.valid_forever === '0' && condition.tomorrow) { 247 if (condition.valid_forever === '0' && condition.tomorrow) {
247 - let obj = this.setTimeRange(detail.cdate, 1, condition.tomorrow*1); 248 + let obj = this.setTimeRange(t, 1, condition.tomorrow*1);
248 detail.useStime = obj.useStime; 249 detail.useStime = obj.useStime;
249 detail.useEtime = obj.useEtime; 250 detail.useEtime = obj.useEtime;
250 detail.useEtimeStr = '领取次日起' + condition.tomorrow + '天内有效'; 251 detail.useEtimeStr = '领取次日起' + condition.tomorrow + '天内有效';
251 } 252 }
252 // sday 领券后第几天的开始天数 eday 领券后第几天的结束天数 253 // sday 领券后第几天的开始天数 eday 领券后第几天的结束天数
253 if (condition.valid_forever === '0' && condition.sday && condition.eday) { 254 if (condition.valid_forever === '0' && condition.sday && condition.eday) {
254 - let obj = this.setTimeRange(detail.cdate, parseInt(condition.sday) - 1, parseInt(condition.eday) - 1); 255 + let obj = this.setTimeRange(t, parseInt(condition.sday) - 1, parseInt(condition.eday) - 1);
255 detail.useStime = obj.useStime; 256 detail.useStime = obj.useStime;
256 detail.useEtime = obj.useEtime; 257 detail.useEtime = obj.useEtime;
257 detail.useEtimeStr = '领取后第' + condition.sday + '天至' + condition.eday + '天可用'; 258 detail.useEtimeStr = '领取后第' + condition.sday + '天至' + condition.eday + '天可用';
@@ -283,6 +284,8 @@ Page({ @@ -283,6 +284,8 @@ Page({
283 } 284 }
284 let price = detail.price * 1; 285 let price = detail.price * 1;
285 let num = this.data.num * 1; 286 let num = this.data.num * 1;
  287 + detail.activity_id = activity_id;
  288 + console.log('券详情--',{...detail});
286 this.setData({ 289 this.setData({
287 detail, 290 detail,
288 exp_date, 291 exp_date,
@@ -475,17 +478,17 @@ Page({ @@ -475,17 +478,17 @@ Page({
475 } 478 }
476 }, 479 },
477 // 是否已领取 480 // 是否已领取
478 - getCoupon() { 481 + getCoupon(i) {
479 App.Activity.ActivityListByOpenid({ 482 App.Activity.ActivityListByOpenid({
480 aid: this.data.opt.id, 483 aid: this.data.opt.id,
481 sellerid:this.data.opt.sid 484 sellerid:this.data.opt.sid
482 }).then(res => { 485 }).then(res => {
483 if (res.ret === 200) { 486 if (res.ret === 200) {
484 - let detail = this.data.detail;  
485 - detail.activity_id = res.data.length > 0 ? res.data[0].activity_id : ''; 487 + let activity_id = res.data.length > 0 ? res.data[0].activity_id : '';
486 this.setData({ 488 this.setData({
487 - resultCoupon: res.data.length > 0 && detail.is_type == '3' ? '1' : '0', 489 + resultCoupon: res.data.length > 0 && res.data[0].is_type == '3' ? '1' : '0',
488 }) 490 })
  491 + if(i) this.getDetail(res.data[0].cdate,activity_id);
489 } 492 }
490 }) 493 })
491 }, 494 },
@@ -494,9 +497,9 @@ Page({ @@ -494,9 +497,9 @@ Page({
494 */ 497 */
495 onReady() { 498 onReady() {
496 this.myToast = this.selectComponent("#myToast") 499 this.myToast = this.selectComponent("#myToast")
497 - this.getDetail(); 500 +
498 this.getSellerDetail(); 501 this.getSellerDetail();
499 - this.getCoupon() 502 + this.getCoupon('1')
500 }, 503 },
501 // 计算2点之间的距离 504 // 计算2点之间的距离
502 getDistance(lat1, lon1, lat2, lon2) { 505 getDistance(lat1, lon1, lat2, lon2) {