|
...
|
...
|
@@ -116,19 +116,16 @@ Page({ |
|
|
|
let data = res.data
|
|
|
|
console.log('data', data);
|
|
|
|
let couponList = []
|
|
|
|
let StyleType, couponData, marketing, coupon, is_comments;
|
|
|
|
let StyleType, marketing, coupon, is_comments;
|
|
|
|
marketing = util.determine(data.marketing);
|
|
|
|
StyleType = data.type;
|
|
|
|
if (marketing) {
|
|
|
|
is_comments = marketing.is_comments ? marketing.is_comments : '';
|
|
|
|
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
|
|
|
|
couponData = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
|
|
|
|
couponData = couponData && couponData.length > 0 ? couponData[0] : {}
|
|
|
|
if ((couponData.use && (!couponData.use.is_cash || couponData.use.is_cash == '1'))) {
|
|
|
|
let cash = couponData.use.cash * 1;
|
|
|
|
let price = couponData.price * 1;
|
|
|
|
couponData.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
|
|
|
|
}
|
|
|
|
let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
|
|
|
|
let couponDataId = info && info.length > 0 ? info[0].id : {}
|
|
|
|
// 根据券ID获取评价赠送的券详情
|
|
|
|
if(couponDataId) this.getEvaluateFun(couponDataId)
|
|
|
|
}
|
|
|
|
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
|
|
|
|
if (coupon && util.getType(coupon) == 'object') {
|
|
...
|
...
|
@@ -150,7 +147,6 @@ Page({ |
|
|
|
coupon,
|
|
|
|
couponList,
|
|
|
|
is_comments,
|
|
|
|
couponData,
|
|
|
|
StyleType,
|
|
|
|
}
|
|
|
|
console.log('获取数据', {
|
|
...
|
...
|
@@ -167,13 +163,33 @@ Page({ |
|
|
|
coupon,
|
|
|
|
is_comments,
|
|
|
|
couponList,
|
|
|
|
couponData,
|
|
|
|
StyleType,
|
|
|
|
})
|
|
|
|
}).catch(res => {
|
|
|
|
console.log('GetSellerTemplateConf请求失败');
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取评价赠送的券最新详情
|
|
|
|
getEvaluateFun(id){
|
|
|
|
App.Activity.GetActivityById({
|
|
|
|
id
|
|
|
|
}).then(res => {
|
|
|
|
if (res.data.length > 0) {
|
|
|
|
let couponData = res.data[0]
|
|
|
|
if ((couponData.use && (!couponData.use.is_cash || couponData.use.is_cash == '1'))) {
|
|
|
|
let cash = couponData.use.cash * 1;
|
|
|
|
let price = couponData.price * 1;
|
|
|
|
couponData.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
|
|
|
|
}
|
|
|
|
// showCoupon 代表赠送的券没过有效期 && 是开启状态
|
|
|
|
couponData.showCoupon = (this.data.dataStr<(couponData.etime*1) && couponData.is_open=='1') ? '1' : '0';
|
|
|
|
console.log('邀请函--------------------评价赠送的优惠券',couponData);
|
|
|
|
this.setData({
|
|
|
|
couponData:res.data[0]
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 根据充值ID获取充值详情
|
|
|
|
getRechargeDetail(id) {
|
|
|
|
App.Activity.GetNewRecharge({
|
|
...
|
...
|
@@ -188,8 +204,10 @@ Page({ |
|
|
|
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
|
|
|
|
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
|
|
|
|
if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
|
|
|
|
let recharge_data = (this.data.dataStr<detail.etime*1 && detail.is_open == '1') ? detail : ''
|
|
|
|
console.log('邀请函--------------充值',recharge_data);
|
|
|
|
this.setData({
|
|
|
|
recharge_data: detail,
|
|
|
|
recharge_data,
|
|
|
|
scoreInfo,
|
|
|
|
priceInfo,
|
|
|
|
certificate
|
|
...
|
...
|
@@ -214,11 +232,13 @@ Page({ |
|
|
|
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
|
|
|
|
}
|
|
|
|
coupon_dataList.push(detail);
|
|
|
|
if (length === ids.length) {
|
|
|
|
this.setData({
|
|
|
|
coupon_dataList,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (length === coupon_dataList.length) {
|
|
|
|
coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})
|
|
|
|
console.log('邀请函--------------------优惠券',coupon_dataList);
|
|
|
|
this.setData({
|
|
|
|
coupon_dataList,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
...
|
...
|
|