|
@@ -9,25 +9,13 @@ Page({ |
|
@@ -9,25 +9,13 @@ Page({ |
|
9
|
*/
|
9
|
*/
|
|
10
|
data: {
|
10
|
data: {
|
|
11
|
cookbooklist: [],
|
11
|
cookbooklist: [],
|
|
12
|
- sellerName: '',
|
|
|
|
13
|
- sellerid: '',
|
|
|
|
14
|
probablyPrice: '',
|
12
|
probablyPrice: '',
|
|
15
|
vipProbablyPrice: '',
|
13
|
vipProbablyPrice: '',
|
|
16
|
- discount: '',
|
|
|
|
17
|
- stringifyUse: '',
|
|
|
|
18
|
- priceInfo: '',
|
|
|
|
19
|
- scoreInfo: '',
|
|
|
|
20
|
notes: '',
|
14
|
notes: '',
|
|
21
|
- marketing: {},
|
|
|
|
22
|
- recharge_data: {},
|
|
|
|
23
|
- coupon_data: {},
|
|
|
|
24
|
- rid: '',
|
|
|
|
25
|
- oid: '',
|
|
|
|
26
|
tpls: [],
|
15
|
tpls: [],
|
|
27
|
- current: 0,
|
|
|
|
28
|
seller: {},
|
16
|
seller: {},
|
|
29
|
options: {},
|
17
|
options: {},
|
|
30
|
- dataStr: Date.now() * 1 / 1000,
|
18
|
+ rechargeList:[],
|
|
31
|
},
|
19
|
},
|
|
32
|
/**
|
20
|
/**
|
|
33
|
* 生命周期函数--监听页面加载
|
21
|
* 生命周期函数--监听页面加载
|
|
@@ -287,6 +275,9 @@ Page({ |
|
@@ -287,6 +275,9 @@ Page({ |
|
287
|
this.setData({
|
275
|
this.setData({
|
|
288
|
cookbooklist
|
276
|
cookbooklist
|
|
289
|
})
|
277
|
})
|
|
|
|
278
|
+ setTimeout(() => {
|
|
|
|
279
|
+ this.getNewRechargeListfFun();
|
|
|
|
280
|
+ }, 0);
|
|
290
|
})
|
281
|
})
|
|
291
|
this.GetDzSellerConfFun()
|
282
|
this.GetDzSellerConfFun()
|
|
292
|
},
|
283
|
},
|
|
@@ -304,8 +295,8 @@ Page({ |
|
@@ -304,8 +295,8 @@ Page({ |
|
304
|
themeColor = '77,78,80,1'; //未设置 为灰色
|
295
|
themeColor = '77,78,80,1'; //未设置 为灰色
|
|
305
|
}
|
296
|
}
|
|
306
|
if (themeColor == '251,246,241,1') {
|
297
|
if (themeColor == '251,246,241,1') {
|
|
307
|
- textColor = '81,81,81,1'
|
|
|
|
308
|
- navColor = "81,81,81,1"
|
298
|
+ textColor = '0,0,0,1'
|
|
|
|
299
|
+ navColor='0,0,0,1'
|
|
309
|
} else {
|
300
|
} else {
|
|
310
|
navColor = "255,255,255,1"
|
301
|
navColor = "255,255,255,1"
|
|
311
|
textColor = '251,246,241,1'
|
302
|
textColor = '251,246,241,1'
|
|
@@ -365,14 +356,14 @@ Page({ |
|
@@ -365,14 +356,14 @@ Page({ |
|
365
|
let reserev = RS.reserve(res.data)
|
356
|
let reserev = RS.reserve(res.data)
|
|
366
|
let dateSmart;
|
357
|
let dateSmart;
|
|
367
|
if (res.data.type == 1) {
|
358
|
if (res.data.type == 1) {
|
|
368
|
- dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStrSmart[0])
|
359
|
+ dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[0].timeStrSmart[0])
|
|
369
|
if (res.data.is_set_ddate == 1) {
|
360
|
if (res.data.is_set_ddate == 1) {
|
|
370
|
- dateSmart += ' ' + util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStrSmart[1])
|
361
|
+ dateSmart += ' ' + util.unixtoTime(reserev.ddate, this.data.tpls[0].timeStrSmart[1])
|
|
371
|
} else {
|
362
|
} else {
|
|
372
|
dateSmart += ' ' + reserev.soltName
|
363
|
dateSmart += ' ' + reserev.soltName
|
|
373
|
}
|
364
|
}
|
|
374
|
} else {
|
365
|
} else {
|
|
375
|
- dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStr)
|
366
|
+ dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[0].timeStr)
|
|
376
|
}
|
367
|
}
|
|
377
|
this.setData({
|
368
|
this.setData({
|
|
378
|
seller: {
|
369
|
seller: {
|
|
@@ -383,62 +374,59 @@ Page({ |
|
@@ -383,62 +374,59 @@ Page({ |
|
383
|
tableNum,
|
374
|
tableNum,
|
|
384
|
}
|
375
|
}
|
|
385
|
})
|
376
|
})
|
|
386
|
- setTimeout(() => {
|
|
|
|
387
|
- this.getSellerTemplateConfFun(reserev.sid);
|
|
|
|
388
|
- }, 0);
|
|
|
|
389
|
}).catch(res => {
|
377
|
}).catch(res => {
|
|
390
|
console.log(res, '详情请求失败');
|
378
|
console.log(res, '详情请求失败');
|
|
391
|
})
|
379
|
})
|
|
392
|
},
|
380
|
},
|
|
393
|
- // 获取券 充值信息
|
|
|
|
394
|
- getSellerTemplateConfFun() {
|
|
|
|
395
|
- App.Seller.GetSellerTemplateConf({
|
|
|
|
396
|
- sid: this.data.options.sid
|
381
|
+ // 获取充值列表信息
|
|
|
|
382
|
+ getNewRechargeListfFun() {
|
|
|
|
383
|
+ App.Activity.GetNewRechargeList({
|
|
|
|
384
|
+ sellerid: this.data.options.sid,
|
|
|
|
385
|
+ is_expire: '0'
|
|
397
|
}).then(res => {
|
386
|
}).then(res => {
|
|
398
|
- let data = res.data
|
|
|
|
399
|
- let marketing, coupon_data, priceInfo, scoreInfo, recharge_list, stringifyUse;
|
|
|
|
400
|
- marketing = util.determine(data.marketing);
|
|
|
|
401
|
- console.log('marketing', marketing);
|
|
|
|
402
|
- if (marketing.coupon_data) {
|
|
|
|
403
|
- coupon_data = marketing.coupon_data;
|
|
|
|
404
|
- stringifyUse = JSON.stringify(marketing.coupon_data.use)
|
|
|
|
405
|
- }
|
|
|
|
406
|
- console.log('coupon_data', coupon_data);
|
|
|
|
407
|
- console.log('stringifyUse', stringifyUse);
|
|
|
|
408
|
- if (marketing.is_recharge == '1' && marketing.recharge_data) {
|
|
|
|
409
|
- let recharge_data = marketing.recharge_data
|
|
|
|
410
|
- recharge_list = marketing.recharge_data.recharge_list
|
|
|
|
411
|
- if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';
|
|
|
|
412
|
- if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';
|
|
|
|
413
|
- console.log('scoreInfo', scoreInfo);
|
|
|
|
414
|
- console.log('priceInfo', priceInfo);
|
|
|
|
415
|
- this.setData({
|
|
|
|
416
|
- recharge_data: marketing.recharge_data
|
|
|
|
417
|
- })
|
|
|
|
418
|
- console.log('recharge_data', recharge_data);
|
|
|
|
419
|
- }
|
|
|
|
420
|
- this.setData({
|
|
|
|
421
|
- coupon_data,
|
|
|
|
422
|
- stringifyUse
|
387
|
+ let list = res.data;
|
|
|
|
388
|
+ list.forEach((item,index) => {
|
|
|
|
389
|
+ if(item.is_open=='0'){
|
|
|
|
390
|
+ list.splice(index,1)
|
|
|
|
391
|
+ }
|
|
|
|
392
|
+ item.recharge_lists = item.recharge_list ? JSON.parse(item.recharge_list) : '';
|
|
|
|
393
|
+ let recharge_lists = item.recharge_lists;
|
|
|
|
394
|
+ item.priceInfo = '';
|
|
|
|
395
|
+ item.scoreInfo = '';
|
|
|
|
396
|
+ item.certificate = '';
|
|
|
|
397
|
+ if (recharge_lists.is_price == '1') item.priceInfo = '会员充值满' + item.recharge_money + '元赠送' + item.recharge_lists.price + '元余额';
|
|
|
|
398
|
+ if (recharge_lists.is_score == '1') item.scoreInfo = '会员充值满' + item.recharge_money + '元赠送' + item.recharge_lists.score + '积分';
|
|
|
|
399
|
+ if (recharge_lists.is_coupons == '1' && recharge_lists.coupons_names.length > 0) item.certificate = recharge_lists.coupons_names.join('、');
|
|
423
|
})
|
400
|
})
|
|
424
|
- // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
|
|
|
|
425
|
- if (marketing.is_coupon == '1' && coupon_data && (!coupon_data.use.is_cash || coupon_data.use.is_cash == '1')) {
|
|
|
|
426
|
- let cash = coupon_data.use.cash;
|
|
|
|
427
|
- let price = coupon_data.price * 1;
|
|
|
|
428
|
- let discount = ((price / cash) * 10).toFixed(2);
|
401
|
+ let item=this.findClosest(list,this.data.probablyPrice)
|
|
|
|
402
|
+ let rechargeList=[];
|
|
|
|
403
|
+ item?rechargeList.push(item):'';
|
|
|
|
404
|
+ wx.nextTick(()=>{
|
|
429
|
this.setData({
|
405
|
this.setData({
|
|
430
|
- discount
|
406
|
+ rechargeList,
|
|
431
|
})
|
407
|
})
|
|
432
|
- }
|
|
|
|
433
|
- this.setData({
|
|
|
|
434
|
- marketing,
|
|
|
|
435
|
- priceInfo,
|
|
|
|
436
|
- scoreInfo
|
|
|
|
437
|
})
|
408
|
})
|
|
438
|
}).catch(res => {
|
409
|
}).catch(res => {
|
|
439
|
console.log('GetSellerTemplateConf请求失败');
|
410
|
console.log('GetSellerTemplateConf请求失败');
|
|
440
|
})
|
411
|
})
|
|
441
|
},
|
412
|
},
|
|
|
|
413
|
+ // 筛选出合适的充值优惠
|
|
|
|
414
|
+ findClosest (list,price){
|
|
|
|
415
|
+ let i=0;
|
|
|
|
416
|
+ let changzhi=0;
|
|
|
|
417
|
+ list.forEach((item,index)=>{
|
|
|
|
418
|
+ if (index==0) {
|
|
|
|
419
|
+ changzhi=Math.abs(price*1-item.recharge_money*1)
|
|
|
|
420
|
+ i=index
|
|
|
|
421
|
+ }else{
|
|
|
|
422
|
+ if (changzhi*1-Math.abs((price*1-item.recharge_money*1))>0) {
|
|
|
|
423
|
+ changzhi=Math.abs(price*1-item.recharge_money*1)
|
|
|
|
424
|
+ i=index
|
|
|
|
425
|
+ }
|
|
|
|
426
|
+ }
|
|
|
|
427
|
+ })
|
|
|
|
428
|
+ return list[i]
|
|
|
|
429
|
+ },
|
|
442
|
/**
|
430
|
/**
|
|
443
|
* 用户点击右上角分享
|
431
|
* 用户点击右上角分享
|
|
444
|
*/
|
432
|
*/
|