|
...
|
...
|
@@ -9,25 +9,13 @@ Page({ |
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
cookbooklist: [],
|
|
|
|
sellerName: '',
|
|
|
|
sellerid: '',
|
|
|
|
probablyPrice: '',
|
|
|
|
vipProbablyPrice: '',
|
|
|
|
discount: '',
|
|
|
|
stringifyUse: '',
|
|
|
|
priceInfo: '',
|
|
|
|
scoreInfo: '',
|
|
|
|
notes: '',
|
|
|
|
marketing: {},
|
|
|
|
recharge_data: {},
|
|
|
|
coupon_data: {},
|
|
|
|
rid: '',
|
|
|
|
oid: '',
|
|
|
|
tpls: [],
|
|
|
|
current: 0,
|
|
|
|
seller: {},
|
|
|
|
options: {},
|
|
|
|
dataStr: Date.now() * 1 / 1000,
|
|
|
|
rechargeList:[],
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
...
|
...
|
@@ -287,6 +275,9 @@ Page({ |
|
|
|
this.setData({
|
|
|
|
cookbooklist
|
|
|
|
})
|
|
|
|
setTimeout(() => {
|
|
|
|
this.getNewRechargeListfFun();
|
|
|
|
}, 0);
|
|
|
|
})
|
|
|
|
this.GetDzSellerConfFun()
|
|
|
|
},
|
|
...
|
...
|
@@ -304,8 +295,8 @@ Page({ |
|
|
|
themeColor = '77,78,80,1'; //未设置 为灰色
|
|
|
|
}
|
|
|
|
if (themeColor == '251,246,241,1') {
|
|
|
|
textColor = '81,81,81,1'
|
|
|
|
navColor = "81,81,81,1"
|
|
|
|
textColor = '0,0,0,1'
|
|
|
|
navColor='0,0,0,1'
|
|
|
|
} else {
|
|
|
|
navColor = "255,255,255,1"
|
|
|
|
textColor = '251,246,241,1'
|
|
...
|
...
|
@@ -365,14 +356,14 @@ Page({ |
|
|
|
let reserev = RS.reserve(res.data)
|
|
|
|
let dateSmart;
|
|
|
|
if (res.data.type == 1) {
|
|
|
|
dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStrSmart[0])
|
|
|
|
dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[0].timeStrSmart[0])
|
|
|
|
if (res.data.is_set_ddate == 1) {
|
|
|
|
dateSmart += ' ' + util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStrSmart[1])
|
|
|
|
dateSmart += ' ' + util.unixtoTime(reserev.ddate, this.data.tpls[0].timeStrSmart[1])
|
|
|
|
} else {
|
|
|
|
dateSmart += ' ' + reserev.soltName
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStr)
|
|
|
|
dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[0].timeStr)
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
seller: {
|
|
...
|
...
|
@@ -383,62 +374,59 @@ Page({ |
|
|
|
tableNum,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
setTimeout(() => {
|
|
|
|
this.getSellerTemplateConfFun(reserev.sid);
|
|
|
|
}, 0);
|
|
|
|
}).catch(res => {
|
|
|
|
console.log(res, '详情请求失败');
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取券 充值信息
|
|
|
|
getSellerTemplateConfFun() {
|
|
|
|
App.Seller.GetSellerTemplateConf({
|
|
|
|
sid: this.data.options.sid
|
|
|
|
// 获取充值列表信息
|
|
|
|
getNewRechargeListfFun() {
|
|
|
|
App.Activity.GetNewRechargeList({
|
|
|
|
sellerid: this.data.options.sid,
|
|
|
|
is_expire: '0'
|
|
|
|
}).then(res => {
|
|
|
|
let data = res.data
|
|
|
|
let marketing, coupon_data, priceInfo, scoreInfo, recharge_list, stringifyUse;
|
|
|
|
marketing = util.determine(data.marketing);
|
|
|
|
console.log('marketing', marketing);
|
|
|
|
if (marketing.coupon_data) {
|
|
|
|
coupon_data = marketing.coupon_data;
|
|
|
|
stringifyUse = JSON.stringify(marketing.coupon_data.use)
|
|
|
|
}
|
|
|
|
console.log('coupon_data', coupon_data);
|
|
|
|
console.log('stringifyUse', stringifyUse);
|
|
|
|
if (marketing.is_recharge == '1' && marketing.recharge_data) {
|
|
|
|
let recharge_data = marketing.recharge_data
|
|
|
|
recharge_list = marketing.recharge_data.recharge_list
|
|
|
|
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';
|
|
|
|
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';
|
|
|
|
console.log('scoreInfo', scoreInfo);
|
|
|
|
console.log('priceInfo', priceInfo);
|
|
|
|
this.setData({
|
|
|
|
recharge_data: marketing.recharge_data
|
|
|
|
})
|
|
|
|
console.log('recharge_data', recharge_data);
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
coupon_data,
|
|
|
|
stringifyUse
|
|
|
|
let list = res.data;
|
|
|
|
list.forEach((item,index) => {
|
|
|
|
if(item.is_open=='0'){
|
|
|
|
list.splice(index,1)
|
|
|
|
}
|
|
|
|
item.recharge_lists = item.recharge_list ? JSON.parse(item.recharge_list) : '';
|
|
|
|
let recharge_lists = item.recharge_lists;
|
|
|
|
item.priceInfo = '';
|
|
|
|
item.scoreInfo = '';
|
|
|
|
item.certificate = '';
|
|
|
|
if (recharge_lists.is_price == '1') item.priceInfo = '会员充值满' + item.recharge_money + '元赠送' + item.recharge_lists.price + '元余额';
|
|
|
|
if (recharge_lists.is_score == '1') item.scoreInfo = '会员充值满' + item.recharge_money + '元赠送' + item.recharge_lists.score + '积分';
|
|
|
|
if (recharge_lists.is_coupons == '1' && recharge_lists.coupons_names.length > 0) item.certificate = recharge_lists.coupons_names.join('、');
|
|
|
|
})
|
|
|
|
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
|
|
|
|
if (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);
|
|
|
|
let item=this.findClosest(list,this.data.probablyPrice)
|
|
|
|
let rechargeList=[];
|
|
|
|
item?rechargeList.push(item):'';
|
|
|
|
wx.nextTick(()=>{
|
|
|
|
this.setData({
|
|
|
|
discount
|
|
|
|
rechargeList,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
marketing,
|
|
|
|
priceInfo,
|
|
|
|
scoreInfo
|
|
|
|
})
|
|
|
|
}).catch(res => {
|
|
|
|
console.log('GetSellerTemplateConf请求失败');
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 筛选出合适的充值优惠
|
|
|
|
findClosest (list,price){
|
|
|
|
let i=0;
|
|
|
|
let changzhi=0;
|
|
|
|
list.forEach((item,index)=>{
|
|
|
|
if (index==0) {
|
|
|
|
changzhi=Math.abs(price*1-item.recharge_money*1)
|
|
|
|
i=index
|
|
|
|
}else{
|
|
|
|
if (changzhi*1-Math.abs((price*1-item.recharge_money*1))>0) {
|
|
|
|
changzhi=Math.abs(price*1-item.recharge_money*1)
|
|
|
|
i=index
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
return list[i]
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
...
|
...
|
|