|
...
|
...
|
@@ -25,7 +25,7 @@ Page({ |
|
|
|
signboard: {},
|
|
|
|
store: {},
|
|
|
|
recharge_data:{},
|
|
|
|
coupon_data:{},
|
|
|
|
coupon_dataList:[],
|
|
|
|
homeColor: '',
|
|
|
|
stringifyUse:'',
|
|
|
|
current: 0,
|
|
...
|
...
|
@@ -273,17 +273,40 @@ Page({ |
|
|
|
}).then(res => {
|
|
|
|
let data=res.data
|
|
|
|
console.log('data',data);
|
|
|
|
let home,chef,marketing,reserve,swich_phone,signboard,store,homeColor,coupon_data,priceInfo,certificate,scoreInfo,recharge_list,stringifyUse;
|
|
|
|
chef = util.determine(data.chef);
|
|
|
|
let coupon_dataList=[]
|
|
|
|
let home,chef,marketing,reserve,swich_phone,signboard,store,homeColor,priceInfo,certificate,scoreInfo,recharge_list,stringifyUse;
|
|
|
|
chef = util.determine(data.chef);
|
|
|
|
reserve = util.determine(data.reserve);
|
|
|
|
swich_phone = reserve && reserve.swich_phone?reserve.swich_phone:'';
|
|
|
|
marketing = util.determine(data.marketing);
|
|
|
|
signboard = util.determine(data.signboard);
|
|
|
|
store = util.determine(data.store);
|
|
|
|
home = util.determine(data.home);
|
|
|
|
if(marketing && marketing.coupon_data){
|
|
|
|
coupon_data=marketing.coupon_data;
|
|
|
|
stringifyUse=JSON.stringify(marketing.coupon_data.use)
|
|
|
|
let coupon=util.determine(marketing.coupon_data)
|
|
|
|
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
|
|
|
|
if(coupon && util.getType(coupon)=='object'){
|
|
|
|
coupon.stringifyUse=JSON.stringify(coupon.use)
|
|
|
|
if(marketing.is_coupon=='1' && coupon && (!coupon.use.is_cash || coupon.use.is_cash=='1')){
|
|
|
|
let cash=coupon.use.cash;
|
|
|
|
let price=coupon.price*1;
|
|
|
|
console.log('cash',cash+'---'+'price',price+'---'+'discount',((price/cash)*10).toFixed(2));
|
|
|
|
coupon.discount=((price/cash)*10).toFixed(2);
|
|
|
|
}
|
|
|
|
coupon_dataList.push(coupon);
|
|
|
|
}
|
|
|
|
if(coupon && util.getType(coupon)=='array'){
|
|
|
|
if(coupon.length>0){
|
|
|
|
coupon.forEach(item=>{
|
|
|
|
item.stringifyUse=JSON.stringify(item.use)
|
|
|
|
if((!item.use.is_cash || item.use.is_cash=='1')){
|
|
|
|
let cash=item.use.cash;
|
|
|
|
let price=item.price*1;
|
|
|
|
console.log('cash',cash+'---'+'price',price+'---'+'discount',((price/cash)*10).toFixed(2));
|
|
|
|
item.discount=((price/cash)*10).toFixed(2);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
coupon_dataList=coupon;
|
|
|
|
}
|
|
|
|
let obj={
|
|
|
|
chef,
|
|
...
|
...
|
@@ -293,7 +316,8 @@ Page({ |
|
|
|
store,
|
|
|
|
home,
|
|
|
|
stringifyUse,
|
|
|
|
coupon_data,
|
|
|
|
coupon,
|
|
|
|
coupon_dataList,
|
|
|
|
swich_phone
|
|
|
|
}
|
|
|
|
console.log('获取数据', {...obj});
|
|
...
|
...
|
@@ -312,21 +336,9 @@ Page({ |
|
|
|
console.log('recharge_data',recharge_data);
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
coupon_data,
|
|
|
|
coupon_dataList,
|
|
|
|
stringifyUse
|
|
|
|
})
|
|
|
|
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
|
|
|
|
if(marketing && marketing.is_coupon=='1' && coupon_data && (!coupon_data.use.is_cash || coupon_data.use.is_cash=='1')){
|
|
|
|
let cash=coupon_data.use.cash;
|
|
|
|
let price=coupon_data.price*1;
|
|
|
|
let discount=((price/cash)*10).toFixed(2);
|
|
|
|
console.log('cash',cash);
|
|
|
|
console.log('price',price);
|
|
|
|
console.log('discount',discount);
|
|
|
|
this.setData({
|
|
|
|
discount
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if(store && store.images.length>0) store.images =util.determine(store.images);
|
|
|
|
if(signboard && signboard.images) signboard.images = util.determine(signboard.images);
|
|
|
|
if (marketing && marketing.is_online_book=='1' && marketing.is_transpond =='1') {
|
...
|
...
|
|