优惠券逻辑遗漏修整

develop
mice2333 4 years ago
parent 6064ce17fb
commit 73aeef6fa9

@ -175,16 +175,22 @@ Page({
},
// 使用最大减免优惠券
getRecommendCoupons(drama_id,tid){
http('/api/v1/coupon-list', "post", {drama_id,tid,mode:1}).then(Response => {
getRecommendCoupons(drama_id, tid) {
http('/api/v1/coupon-list', "post", {
drama_id,
tid,
mode: 1
}).then(Response => {
if (Response.coupon_list.length > 0) {
let coupon_list = Response.coupon_list
// 去除日期格式
// 选出status == 1 去除日期格式
let a = []
coupon_list.forEach((item) => {
item.end_date = item.end_date.replace(/[\u4e00-\u9fa5]/g, '')
a.push(item)
if (item.status == 1) {
item.end_date = item.end_date.replace(/[\u4e00-\u9fa5]/g, '')
a.push(item)
}
})
coupon_list = a
@ -209,7 +215,7 @@ getRecommendCoupons(drama_id,tid){
})
return l;
}
let recommendCoupons = couponSort(couponSort(couponSort(coupon_list, "subtract"), 'full'), 'end_date', 'asc')
if (recommendCoupons && recommendCoupons.length > 0) {
this.setData({
@ -218,7 +224,7 @@ getRecommendCoupons(drama_id,tid){
}
}
})
},
},
/**
@ -235,8 +241,8 @@ getRecommendCoupons(drama_id,tid){
tprice += _info.ticket_info[i].price * _info.ticket_info[i].tkt_num
}
this.getRecommendCoupons(options.drama_id,options.tid)
this.getRecommendCoupons(options.drama_id, options.tid)
this.setData({
_info,
tprice,

Loading…
Cancel
Save