Commit 14df66daf9590a4c6e1bc79922290742aff2f70b

Authored by yiren
1 parent 989c722d

提前点餐菜品分享页面增加充值推荐

... ... @@ -39,7 +39,7 @@ Page({
let obj = JSON.parse(options.cookbookObj);
let textColor;
if(obj.themeColor=='251,246,241,1'){
textColor='81,81,81,1'
textColor='0,0,0,1'
}else{
textColor='251,246,241,1'
}
... ...
... ... @@ -494,8 +494,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 = "255,255,255,1"
... ...
... ... @@ -139,7 +139,6 @@ page {
font-weight: 500;
font-size: 80rpx;
margin-right: 20rpx;
-webkit-text-stroke: 1rpx #fff;
}
.practice {
... ...
... ... @@ -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]
},
/**
* 用户点击右上角分享
*/
... ...
... ... @@ -44,48 +44,24 @@
</view>
<view class="information font36r">特别优惠</view>
<view class="poop font24r">根据您选择的菜品,我们推荐您参加以下活动,本次消费可用,预计可以节约大笔开销!</view>
<view class="preferential" wx:if="{{marketing && (marketing.is_coupon=='1' || marketing.is_recharge=='1')}}">
<view class="preferentialItems" wx:if="{{marketing && marketing.is_coupon=='1' && dataStr<(coupon_data.etime*1)}}">
<view class="left">
<view class="top">
<text>{{coupon_data.aname}}</text>
<text class="price" wx:if="{{coupon_data.price}}">¥{{coupon_data.price}}</text>
<!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
<text wx:if="{{discount!='0.00' && (coupon_data.use.is_cash=='1' || coupon_data.use.is_cash)}}" class="discount">{{discount}}折</text>
</view>
<view wx:if="{{coupon_data.exp_date.is_week=='1' || coupon_data.exp_date.is_week===true}}" class="bottom">
{{coupon_data.exp_date.week_show?coupon_data.exp_date.week_show+'可用':''}}{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
</view>
<view wx:if="{{coupon_data.exp_date.is_none=='1' || coupon_data.exp_date.is_none===true}}" class="bottom">
无限制{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
</view>
<view wx:if="{{coupon_data.exp_date.is_birthday=='1' || coupon_data.exp_date.is_birthday===true}}" class="bottom">
会员生日当天可用{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
</view>
</view>
<navigator url="/pack-activity/pack/buyCoupon?id={{coupon_data.id}}&name={{options.sellerName}}&use={{stringifyUse}}&rid={{options.rid}}&sid={{options.sid}}&oid={{options.oid}}&types=2" hover-class="navigator-hover">
<view class="font24r orderingFood">
去抢购
</view>
</navigator>
</view>
<view class="preferential" wx:if="{{rechargeList.length>0}}">
<!-- 当前日期要大于限制结束日期 -->
<view class="preferentialItems" wx:if="{{marketing && marketing.is_recharge=='1' && recharge_data && (is_fix!='1' || (is_fix=='1' && dataStr<(recharge_data.exp_date.fix_edate*1)))}}">
<view class="preferentialItems" wx:for="{{rechargeList}}" data-id="{{item.id}}">
<view class="left">
<view class="top">
<text>{{recharge_data.rname}}</text>
<text>{{item.rname}}</text>
</view>
<view class="bottom" wx:if="{{priceInfo}}">
{{priceInfo}}{{(recharge_data.recharge_list.is_coupons=='0' && recharge_data.recharge_list.is_score=='0')?'。':';'}}
<view class="bottom" wx:if="{{item.priceInfo}}">
{{item.priceInfo}}{{(item.recharge_lists.is_coupons=='0' && item.recharge_lists.is_score=='0')?'。':';'}}
</view>
<view class="bottom" wx:if="{{scoreInfo}}">
{{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
<view class="bottom" wx:if="{{item.scoreInfo}}">
{{item.scoreInfo}}{{item.recharge_lists.is_coupons=='0'?'。':';'}}
</view>
<view class="bottom" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送优惠券':''}}。
<view class="bottom" wx:if="{{item.recharge_lists.is_coupons=='1'}}">
{{item.recharge_lists.is_coupons=='1'?'会员充值满'+item.recharge_money+'元赠送'+item.certificate:''}}。
</view>
</view>
<navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{options.sellerName}}&sid={{options.sid}}&oid={{options.oid}}&rid={{options.rid}}&types=2" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/vipRecharge?id={{item.id}}&name={{options.sellerName}}&sid={{options.sid}}&oid={{options.oid}}&rid={{options.rid}}&types=2" hover-class="navigator-hover">
<view class="font24r orderingFood">
去充值
</view>
... ...