Commit ae65dddffa8239ead4fbe836361f77c3e35e85f4

Authored by pengye
1 parent b1e08d47

邀请函生日宴、婚宴、商务宴-------付费券免费券

... ... @@ -61,6 +61,8 @@ Page({
openOrder: '', //点餐
isComments: '', //券和充值
markers: [], //地图标注
couponArr: [],//待领取的优惠券列表
couponList:[],//优惠券列表
},
tablestr: '', //桌位id拼接
urlsValue: [], //包间预览图片列表
... ... @@ -70,6 +72,7 @@ Page({
timers: null, // 动画定时器
n: 0,
modal: '',
couponModal: '',
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -97,6 +100,7 @@ Page({
wx.onUserCaptureScreen((res) => {
this.modal.showModal()
})
this.couponModal = this.selectComponent("#couponModal");
},
//预览图片
previewImage(e) {
... ... @@ -114,6 +118,11 @@ Page({
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框(更新已被领取数量)
closeCouponModal() {
this.getActivityByIdFun(this.data.couponList,'1')
this.couponModal.closeModal()
},
// 页面滚动事件
onPageScroll: function (event) {
const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
... ... @@ -471,9 +480,10 @@ Page({
uid
}).then((json) => {
if (json.ret == 200) {
console.log('经理信息staffinfo', json.data)
console.log('客户经理获取基本信息------', json.data)
this.setData({
staffinfo: json.data
staffinfo: json.data,
couponArr:[],
})
this.getSellerTemplateConfFun(sid);
}
... ... @@ -592,7 +602,7 @@ Page({
}).then(res => {
let data = res.data
let couponList = []
let StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
let StyleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -609,29 +619,23 @@ Page({
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo != '0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
marketing.coupon_data_payList = coupon_data_pay
coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
marketing.coupon_data_freeList = coupon_data_free
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') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
// 获取全部的优惠券(商家券、个人券、免费券、付费券)
couponList = this.addCoupons(coupon,couponList);
couponList = this.addCoupons(coupon_data_pay,couponList);
couponList = this.addCoupons(coupon_data_free,couponList);
// 根据券ID获取券详情
this.getActivityByIdFun(couponList)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
... ... @@ -665,6 +669,7 @@ Page({
lite_style: data.lite_style,
timeList,
is_comments,
couponList,
isMoreBtn: marketing && marketing.is_online_book == '1' && this.data.options.onlineReserve == '1',
isShareItem: this.data.options.isOrder != '1' && marketing && marketing.is_transpond == '1',
isComments: is_comments == '1' && marketing && marketing.is_comments_coupon == '1',
... ... @@ -712,9 +717,12 @@ Page({
})
},
// 点击商家有礼
gotoSellerGift() {
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
... ... @@ -861,56 +869,219 @@ Page({
id
}).then(res => {
if (res.data.length > 0) {
let couponData = res.data[0]
couponData.use = couponData.use ? util.determine(couponData.use) : '';
couponData.exp_date = couponData.exp_date ? util.determine(couponData.exp_date) : '';
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 detail = res.data[0]
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.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);
let num = detail.grant_num*1-detail.grant_last*1;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
detail.showCoupon = (this.data.dataStr < (detail.etime * 1) && detail.is_open == '1') ? '1' : '0';
console.log('邀请函--------------------评价赠送的优惠券', detail);
this.setData({
couponData: res.data[0]
couponData: detail
})
}
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
getActivityByIdFun(obj,setcoupon) {
App.Activity.GetActivityById({
id: obj.map(item => item.id).join(','),
}).then(res => {
if (res.data.length > 0) {
let list = res.data.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
detail.stimeStr = util.unixtoTime(detail.stime, 'YYYY-MM-DD HH:II')
detail.etimeStr = util.unixtoTime(detail.etime, 'YYYY-MM-DD HH:II')
coupon_dataList.push(detail);
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,
})
let num = detail.grant_num*1-detail.grant_last*1;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
})
let freeCoupons = list.filter(item => {
return item.is_type == '3'
})
// 免费券判断是否领取,弹框领取
if (freeCoupons.length > 0 && setcoupon!='1') {
let length = freeCoupons.length - 1
freeCoupons.forEach(i => {
this.getCoupon(i, freeCoupons[length].id, obj)
})
}
})
console.log('邀请函--------------------优惠券', list);
this.setData({
coupon_dataList: list,
})
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
let couponArr = this.data.couponArr;
let totalPrice = this.data.totalPrice;
App.Activity.ActivityListByOpenid({
aid: item.id,
sellerid:this.data.seller.sid,
}).then(res => {
if (res.ret == 200) {
if (res.data.length == 0) {
couponArr.push(item)
}
if (item.id == id && couponArr.length > 0) {
couponArr.forEach((item,index) => {
let match = obj.find(b => b.id === item.id);
if (match) {
item.number = match.number;
}
item.grant_num = item.grant_num*1
if(item.grant_num < 0 || item.grant_num == 0) couponArr.splice(index,1)
if(item.number>item.grant_num){
item.number = item.grant_num
}
});
if(couponArr.length>0){
totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
this.setcouponFun(couponArr)
this.couponModal.showModal()
}
}
console.log('未领取的券列表-----------', couponArr);
this.setData({
couponArr,
totalPrice
})
}
})
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
... ... @@ -3,7 +3,7 @@
<nav hasHome class="navhome" backgroundColor="#ffeddc" place="{{true}}"></nav>
<scroll-view scroll-y class="viewBox">
<image wx:if="{{hasValueBroadcast && isVoice=='1'}}" class="musicImg" src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}" bindtap="stopMusic" animation="{{attentionAnim}}" />
<image class="giftImg" bindtap="gotoSellerGift" wx:if="{{(hasValueCertificate && marketing.is_coupon=='1' && coupon_dataList.length>0) || (!is_user_comments && isComments =='1' && couponData.showCoupon =='1') || (hasValueRecharge && marketing.is_recharge=='1' && recharge_data)}}" src="https://nosqn.colorcun.com/sellerGift.png" mode="" />
<image class="giftImg" bindtap="gotoSellerGift" data-form="1" wx:if="{{(hasValueCertificate && coupon_dataList.length>0) || (!is_user_comments && isComments =='1' && couponData.showCoupon =='1') || (hasValueRecharge && marketing.is_recharge=='1' && recharge_data)}}" src="https://nosqn.colorcun.com/sellerGift.png" mode="" />
<image wx:if="{{detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
<image wx:if="{{options.isOrder == '1' && detail.status !='4'}}" class="cannotImg" src="https://qn.colorcun.com/overImg.png" />
<view class="reservationInfo">
... ... @@ -71,10 +71,10 @@
</view>
</view>
<!-- 优惠券 -->
<view class="publicModule couponBox" wx:if="{{hasValueCertificate && marketing.is_coupon=='1' && coupon_dataList.length>0}}">
<view class="publicModule couponBoxWrap" wx:if="{{hasValueCertificate && coupon_dataList.length>0}}">
<image class="titleImg5" src="https://qn.colorcun.com/invitation10Title1.png" mode="" />
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="purchase">
<view class="priceText" wx:if="{{item.price}}">
... ... @@ -86,7 +86,7 @@
<view class="certificateInfo">
<view class="preferentialDetails">
<view class="information">
<text class="discountText font20r">{{item.use.is_cash=='1'?'代金券':item.use.is_discount=='1'?'超值折扣':item.use.is_dish=='1'?'特惠菜品':''}}</text>
<text class="discountText font20r">{{item.use.is_cash=='1'?'代金券':item.use.is_discount=='1'?'超值折扣':item.use.is_dish=='1'?'特惠菜品':'代金券'}}</text>
<text class="ticketName font24r">{{item.aname}}</text>
</view>
<text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="limitation font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}</text>
... ... @@ -96,16 +96,35 @@
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="limitation font24r">
会员生日当天可用
</view>
<view wx:if="{{item.desc}}" class="limitation showDesc">
<view wx:if="{{item.is_type == '4' && item.desc}}" class="limitation showDesc">
<text class="font24r">消费要求</text>
</view>
<view wx:if="{{item.is_type == '3' && (item.noonText || item.nigText)}}" class="limitation showDesc">
<text class="font24r">不可用日期</text>
</view>
</view>
<view class="limitationBtn">
<view class="limitationBtn" wx:if="{{item.is_type != '3'}}">
<view class="font24r couponBtn">立即抢购</view>
</view>
<view class="btnBox" wx:if="{{item.is_type == '3'}}" >
<view class="font24r orderingFood">已领取</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
</view>
</view>
</view>
</view>
<view wx:if="{{item.desc}}" class="bottomLimitation limitation font24r"><text></text>{{item.desc}}</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottomLimitation limitation font24r">
<text></text>
<view>消费满{{item.desc}}元可用</view>
</view>
<view wx:if="{{item.is_type == '3' && item.noonText}}" class="bottomLimitation limitation font24r">
<text></text>{{item.noonText}}
</view>
<view wx:if="{{item.is_type == '3' && item.nigText}}" class="bottomLimitation limitation font24r">
<text></text>{{item.nigText}}
</view>
</navigator>
</block>
</view>
... ... @@ -135,7 +154,7 @@
</view>
</view>
<!-- 评价券 -->
<view class="publicModule couponBox" wx:if="{{!is_user_comments && isComments =='1' && couponData.showCoupon =='1'}}">
<view class="publicModule couponBoxWrap" wx:if="{{!is_user_comments && isComments =='1' && couponData.showCoupon =='1'}}">
<image class="titleImg4" src="https://qn.colorcun.com/invitation10Title3.png" mode="" />
<view class="font28r evaluateTitleText">期待您的声音,帮助我们持续改进</view>
<view class="couponInfo" bindtap="evaluateFun">
... ... @@ -150,7 +169,7 @@
<view class="certificateInfo">
<view class="preferentialDetails">
<view class="information">
<text class="discountText font20r">{{couponData.use.is_cash=='1'?'代金券':couponData.use.is_discount=='1'?'超值折扣':couponData.use.is_dish=='1'?'特惠菜品':''}}</text>
<text class="discountText font20r">{{couponData.use.is_cash=='1'?'代金券':couponData.use.is_discount=='1'?'超值折扣':couponData.use.is_dish=='1'?'特惠菜品':'代金券'}}</text>
<text class="ticketName font24r">{{couponData.aname}}</text>
</view>
<text wx:if="{{couponData.exp_date.is_week=='1' || couponData.exp_date.is_week===true}}" class="limitation font24r">{{couponData.exp_date.week_show?couponData.exp_date.week_show+'可用':''}}</text>
... ... @@ -160,16 +179,35 @@
<view wx:if="{{couponData.exp_date.is_birthday=='1' || couponData.exp_date.is_birthday===true}}" class="limitation font24r">
会员生日当天可用
</view>
<view wx:if="{{couponData.desc}}" class="limitation showDesc">
<view wx:if="{{couponData.is_type == '4' && couponData.desc}}" class="limitation showDesc">
<text class="font24r">消费要求</text>
</view>
<view wx:if="{{couponData.is_type == '3' && (couponData.noonText || couponData.nigText)}}" class="limitation showDesc">
<text class="font24r">不可用日期</text>
</view>
</view>
<view class="limitationBtn">
<view class="font24r couponBtn">立即领取</view>
<view class="limitationBtn" wx:if="{{couponData.is_type != '3'}}">
<view class="font24r couponBtn">立即抢购</view>
</view>
<view class="btnBox" wx:if="{{couponData.is_type == '3'}}" >
<view class="font24r orderingFood">已领取</view>
<view class="grantNum" wx:if="{{couponData.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{couponData.receiveNumText}}</text>张</view>
</view>
</view>
</view>
</view>
<view wx:if="{{couponData.desc}}" class="bottomLimitation limitation font24r"><text></text>{{couponData.desc}}</view>
<view wx:if="{{couponData.is_type == '4' && couponData.desc!='0'}}" class="bottomLimitation limitation font24r">
<text></text>
<view>消费满{{couponData.desc}}元可用</view>
</view>
<view wx:if="{{couponData.is_type == '3' && couponData.noonText}}" class="bottomLimitation limitation font24r">
<text></text>{{couponData.noonText}}
</view>
<view wx:if="{{couponData.is_type == '3' && couponData.nigText}}" class="bottomLimitation limitation font24r">
<text></text>{{couponData.nigText}}
</view>
</view>
</view>
<!-- 评价没有券 -->
... ... @@ -275,4 +313,24 @@
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
<view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
</view>
<view slot="modalContent">
<view class="couponBox">
<view wx:for="{{couponArr}}" class="couponItems">
<view class="couponNum font20r">×{{item.number}}</view>
<view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
<view class="couponLines"></view>
<view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="font28r couponCondition" wx:else>无门槛</view>
</view>
</view>
<view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -283,15 +283,28 @@
padding: 0 20rpx;
border-radius: 22rpx;
text-align: center;
color: #000;
border-radius: 20rpx;
line-height: 44rpx;
height: 44rpx;
background: #fff;
border: 2rpx solid #fff;
width: max-content;
margin-top: 24rpx;
flex-shrink: 0;
border: 2rpx solid #999;
background: transparent;
color: #999;
}
.grantNum {
display: flex;
flex-direction: column;
align-items: center;
color: #999;
margin-top: 10rpx;
}
.grantNum text {
color: #CC9B6A;
margin-right: 10rpx;
}
.limitation {
... ... @@ -370,30 +383,33 @@
text-align: center;
}
.couponBox navigator,
.couponBox .couponInfo {
.couponBoxWrap navigator,
.couponBoxWrap .couponInfo {
width: 100%;
margin-bottom: 20rpx;
padding-bottom: 10rpx;
border-radius: 10rpx;
background: #fff;
}
.couponBox .preferentialItems {
.couponBoxWrap .preferentialItems {
box-shadow: 0rpx 4rpx 8rpx #0000000d;
}
.couponBox .showDesc {
.couponBoxWrap .showDesc {
display: flex;
align-items: center;
}
.bottomLimitation {
padding: 20rpx;
padding: 0 20rpx;
display: flex;
align-items: center;
}
.bottomLimitation:nth-last-of-type(1){
padding-bottom: 20rpx;
}
.bottomLimitation text {
display: block;
width: 8rpx;
... ... @@ -403,37 +419,37 @@
border-radius: 50%;
}
.couponBox .certificateInfo {
.couponBoxWrap .certificateInfo {
flex-direction: row;
background: #fff;
align-items: center;
}
.couponBox .couponBtn {
.couponBoxWrap .couponBtn {
width: 100%;
height: fit-content;
background: #CC9B6A;
color: #fff;
}
.couponBox .certificateInfo .preferentialDetails {
.couponBoxWrap .certificateInfo .preferentialDetails {
width: 100%;
display: flex;
flex-direction: column;
}
.couponBox .information {
.couponBoxWrap .information {
display: flex;
align-items: center;
}
.couponBox .certificateInfo .limitation {
.couponBoxWrap .certificateInfo .limitation {
margin-right: 20rpx;
flex: 1;
width: auto;
}
.couponBox .discountInfo {
.couponBoxWrap .discountInfo {
font-family: PingFang SC;
background: #FD4D59;
position: absolute;
... ... @@ -449,7 +465,7 @@
width: max-content;
}
.couponBox .certificateImg {
.couponBoxWrap .certificateImg {
position: absolute;
top: 0;
left: 0;
... ... @@ -457,7 +473,7 @@
height: 28rpx;
}
.couponBox .limitationBtn {
.couponBoxWrap .limitationBtn {
width: 40%;
display: flex;
flex-direction: column;
... ... @@ -769,4 +785,143 @@
.mymodal .mymodal-content {
height: auto !important;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
}
#couponModal .titleModal2 {
margin-top: 80%;
}
#couponModal .titleModal3 {
margin-top: 60%;
}
#couponModal .titleModal4 {
margin-top: 30%;
}
#couponModal .mymodal {
background: rgba(0, 0, 0, 0.8);
width: 100% !important;
top: 0 !important;
height: auto !important;
z-index: 300;
}
.nameInfo {
font-family: PingFang SC;
font-weight: 400;
font-size: 52rpx;
line-height: 56rpx;
color: #fff;
margin-bottom: 40rpx;
padding-top: 60rpx;
}
.couponTotal {
color: #dfdfdf;
font-family: PingFang SC;
font-weight: 400;
font-size: 40rpx;
line-height: 48rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponTotal text {
color: #ffc806;
font-weight: 600;
font-size: 80rpx;
margin: 0 14rpx;
}
.couponBox {
width: 80%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.couponItems {
width: 46%;
margin-bottom: 24rpx;
padding-bottom: 52rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
}
.couponNum {
background: #727272;
border-radius: 50%;
color: #fff;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 8rpx 0 0 8rpx;
}
.couponPrice {
display: flex;
align-items: center;
justify-content: center;
color: #F6231B;
font-weight: 500;
}
.couponLines{
width: 80%;
margin: 0 auto;
height: 2rpx;
border-bottom: 2rpx dashed #F6231B;
}
.couponPrice text {
margin-left: 4rpx;
font-size: 76rpx;
font-weight: 700;
}
.couponCondition {
color: #C36607;
display: flex;
align-items: center;
justify-content: center;
padding-top: 24rpx;
}
.couponBtn {
width: 80%;
margin: 0 auto;
border-radius: 42rpx;
background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
font-weight: 400;
color: #fff;
text-align: center;
border: 4rpx solid #fff;
padding: 12rpx 0;
margin: 16rpx auto 20rpx auto;
}
.couponText {
color: #fff;
text-decoration: underline;
text-align: center;
}
.closeImg {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0;
top: 0;
}
\ No newline at end of file
... ...
... ... @@ -66,6 +66,8 @@ Page({
roomimage: [], //包间信息列表
activeTitle: '1', //选择的标题 1优惠券 2充值 3评价
titleList: [], //优惠券、充值、评价标题数组
couponArr: [],//待领取的优惠券列表
couponList:[],//优惠券列表
},
tablestr: '', //桌位id拼接
screenHeight: '',
... ... @@ -74,6 +76,7 @@ Page({
timers: null, // 动画定时器
n: 0,
modal: '',
couponModal: '',
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -105,6 +108,7 @@ Page({
wx.onUserCaptureScreen((res) => {
this.modal.showModal()
})
this.couponModal = this.selectComponent("#couponModal");
},
// 锚点定位
gotoModule(e) {
... ... @@ -126,6 +130,11 @@ Page({
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框(更新已被领取数量)
closeCouponModal() {
this.getActivityByIdFun(this.data.couponList,'1')
this.couponModal.closeModal()
},
// 页面滚动事件
onPageScroll: function (event) {
if (event.scrollTop > 150) { //当页面滚动到某个位置时(这里设置为50),将导航栏背景颜色设置为白色
... ... @@ -248,9 +257,11 @@ Page({
sellerid,
tableids: this.tablestr
}).then((json) => {
console.log('客户经理获取基本信息------', json.data)
if (json.ret == 200) {
this.setData({
roomimage: json.data
roomimage: json.data,
couponArr:[],
})
var urlsArr = [];
json.data.forEach((v, i) => {
... ... @@ -601,7 +612,7 @@ Page({
}).then(res => {
let data = res.data
let couponList = []
let StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
let StyleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -618,29 +629,23 @@ Page({
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo != '0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
marketing.coupon_data_payList = coupon_data_pay
coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
marketing.coupon_data_freeList = coupon_data_free
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') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
// 获取全部的优惠券(商家券、个人券、免费券、付费券)
couponList = this.addCoupons(coupon,couponList);
couponList = this.addCoupons(coupon_data_pay,couponList);
couponList = this.addCoupons(coupon_data_free,couponList);
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
this.getActivityByIdFun(couponList)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
... ... @@ -679,6 +684,7 @@ Page({
lite_style: data.lite_style,
timeList,
is_comments,
couponList,
isMoreBtn: marketing && marketing.is_online_book == '1' && this.data.options.onlineReserve == '1',
isShareItem: this.data.options.isOrder != '1' && marketing && marketing.is_transpond == '1',
isComments: is_comments == '1' && marketing && marketing.is_comments_coupon == '1',
... ... @@ -728,9 +734,12 @@ Page({
})
},
// 点击商家有礼
gotoSellerGift() {
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
... ... @@ -898,19 +907,39 @@ Page({
id
}).then(res => {
if (res.data.length > 0) {
let couponData = res.data[0]
couponData.use = couponData.use ? util.determine(couponData.use) : '';
couponData.exp_date = couponData.exp_date ? util.determine(couponData.exp_date) : '';
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 detail = res.data[0]
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
let num = detail.grant_num*1-detail.grant_last*1;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
// showCoupon 代表赠送的券没过有效期 && 是开启状态
couponData.showCoupon = (this.data.dataStr < (couponData.etime * 1) && couponData.is_open == '1') ? '1' : '0';
console.log('邀请函--------------------评价赠送的优惠券', couponData);
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
detail.showCoupon = (this.data.dataStr < (detail.etime * 1) && detail.is_open == '1') ? '1' : '0';
let entry = this.data.titleList
if ((!this.data.is_user_comments && this.data.isComments == '1' && couponData.showCoupon == '1') || (this.data.is_comments == '1' && (this.data.marketing.is_comments_coupon != '1' || couponData.showCoupon != '1'))) {
if ((!this.data.is_user_comments && this.data.isComments == '1' && detail.showCoupon == '1') || (this.data.is_comments == '1' && (this.data.marketing.is_comments_coupon != '1' || detail.showCoupon != '1'))) {
entry.push({
id: 3,
title: '评价反馈'
... ... @@ -919,8 +948,9 @@ Page({
entry.sort((a, b) => a.id - b.id);
}
}
console.log('邀请函--------------------评价赠送的优惠券', detail);
this.setData({
couponData: res.data[0],
couponData: detail,
titleList: entry,
activeTitle: entry.length > 0 ? entry[0].id : '',
})
... ... @@ -928,50 +958,194 @@ Page({
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
getActivityByIdFun(obj,setcoupon) {
App.Activity.GetActivityById({
id: obj.map(item => item.id).join(','),
}).then(res => {
if (res.data.length > 0) {
let list = res.data.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
let num = detail.grant_num * 1 - detail.grant_last * 1;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
detail.stimeStr = util.unixtoTime(detail.stime, 'YYYY-MM-DD HH:II')
detail.etimeStr = util.unixtoTime(detail.etime, 'YYYY-MM-DD HH:II')
coupon_dataList.push(detail);
if (length === coupon_dataList.length) {
coupon_dataList = coupon_dataList.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
let entry = this.data.titleList
if (this.data.hasValueCertificate && this.data.marketing.is_coupon == '1' && coupon_dataList.length > 0) {
entry.push({
id: 1,
title: '专属优惠券'
})
if (entry.length > 0) {
entry.sort((a, b) => a.id - b.id);
}
})
let freeCoupons = list.filter(item => {
return item.is_type == '3'
})
let entry = this.data.titleList
if (this.data.hasValueCertificate && list.length > 0 && setcoupon != '1') {
entry.push({
id: 1,
title: '专属优惠券'
})
if (entry.length > 0) {
entry.sort((a, b) => a.id - b.id);
}
}
// 免费券判断是否领取,弹框领取
if (freeCoupons.length > 0 && setcoupon != '1') {
let length = freeCoupons.length - 1
freeCoupons.forEach(i => {
this.getCoupon(i, freeCoupons[length].id, obj)
})
}
console.log('邀请函--------------------优惠券', list);
this.setData({
coupon_dataList: list,
titleList: entry,
activeTitle: entry.length > 0 ? entry[0].id : '',
})
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
let couponArr = this.data.couponArr;
let totalPrice = this.data.totalPrice;
App.Activity.ActivityListByOpenid({
aid: item.id,
sellerid:this.data.seller.sid,
}).then(res => {
if (res.ret == 200) {
if (res.data.length == 0) {
couponArr.push(item)
}
if (item.id == id && couponArr.length > 0) {
couponArr.forEach((item,index) => {
let match = obj.find(b => b.id === item.id);
if (match) {
item.number = match.number;
}
console.log('邀请函--------------------优惠券', coupon_dataList);
this.setData({
coupon_dataList,
titleList: entry,
activeTitle: entry.length > 0 ? entry[0].id : '',
})
item.grant_num = item.grant_num*1
if(item.grant_num < 0 || item.grant_num == 0) couponArr.splice(index,1)
if(item.number>item.grant_num){
item.number = item.grant_num
}
});
if(couponArr.length>0){
totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
this.setcouponFun(couponArr)
this.couponModal.showModal()
}
}
})
console.log('未领取的券列表-----------', couponArr);
this.setData({
couponArr,
totalPrice
})
}
})
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
... ... @@ -3,7 +3,7 @@
<nav hasHome class="navhome" backgroundColor="{{show_white ? colors : 'transparent'}}" place="{{false}}"></nav>
<scroll-view scroll-y class="viewBox viewBox{{bookType}}">
<image wx:if="{{hasValueBroadcast && isVoice=='1'}}" class="musicImg" src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}" bindtap="stopMusic" animation="{{attentionAnim}}" />
<image class="giftImg" bindtap="gotoSellerGift" wx:if="{{(hasValueCertificate && marketing.is_coupon=='1' && coupon_dataList.length>0) || (!is_user_comments && isComments =='1' && couponData.showCoupon =='1') || (hasValueRecharge && marketing.is_recharge=='1' && recharge_data)}}" src="https://nosqn.colorcun.com/sellerGift.png" mode="" />
<image class="giftImg" bindtap="gotoSellerGift" data-form="1" wx:if="{{(hasValueCertificate && coupon_dataList.length>0) || (!is_user_comments && isComments =='1' && couponData.showCoupon =='1') || (hasValueRecharge && marketing.is_recharge=='1' && recharge_data)}}" src="https://nosqn.colorcun.com/sellerGift.png" mode="" />
<image wx:if="{{detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
<image wx:if="{{options.isOrder == '1' && detail.status !='4'}}" class="cannotImg" src="https://qn.colorcun.com/overImg.png" />
<view class="reservationInfoBox">
... ... @@ -109,9 +109,9 @@
<view wx:for="{{titleList}}" wx:key="index" wx:for-index="index" bindtap="checkTitleFun" data-type="{{item.id}}" class="titleItem {{activeTitle==item.id?'activeTitleItem':''}}">{{item.title}}</view>
</view>
<!-- 优惠券 -->
<view class="regionItem couponBox" wx:if="{{activeTitle == '1'}}">
<view class="regionItem couponBoxWrap" wx:if="{{activeTitle == '1'}}">
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="purchase">
<view class="priceText" wx:if="{{item.price}}">
... ... @@ -123,7 +123,7 @@
<view class="certificateInfo">
<view class="preferentialDetails">
<view class="information">
<text class="discountText font20r">{{item.use.is_cash=='1'?'代金券':item.use.is_discount=='1'?'超值折扣':item.use.is_dish=='1'?'特惠菜品':''}}</text>
<text class="discountText font20r">{{item.use.is_cash=='1'?'代金券':item.use.is_discount=='1'?'超值折扣':item.use.is_dish=='1'?'特惠菜品':'代金券'}}</text>
<text class="ticketName font24r">{{item.aname}}</text>
</view>
<text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="limitation font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}</text>
... ... @@ -133,16 +133,35 @@
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="limitation font24r">
会员生日当天可用
</view>
<view wx:if="{{item.desc}}" class="showDesc">
<view wx:if="{{item.is_type == '4' && item.desc}}" class="limitation showDesc">
<text class="font24r">消费要求</text>
</view>
<view wx:if="{{item.is_type == '3' && (item.noonText || item.nigText)}}" class="limitation showDesc">
<text class="font24r">不可用日期</text>
</view>
</view>
<view class="limitationBtn">
<view class="limitationBtn" wx:if="{{item.is_type != '3'}}">
<view class="font24r couponBtn">立即抢购</view>
</view>
<view class="btnBox" wx:if="{{item.is_type == '3'}}" >
<view class="font24r orderingFood">已领取</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
</view>
</view>
</view>
</view>
<view wx:if="{{item.desc}}" class="bottomLimitation font24r"><text></text>{{item.desc}}</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottomLimitation limitation font24r bottomLimitationTop">
<text></text>
<view>消费满{{item.desc}}元可用</view>
</view>
<view wx:if="{{item.is_type == '3' && item.noonText}}" class="bottomLimitation limitation font24r bottomLimitationTop">
<text></text>{{item.noonText}}
</view>
<view wx:if="{{item.is_type == '3' && item.nigText}}" class="bottomLimitation limitation font24r">
<text></text>{{item.nigText}}
</view>
</navigator>
</block>
</view>
... ... @@ -179,7 +198,7 @@
</view>
</view>
<!-- 评价券 -->
<view class="regionItem certificateBox couponBox" wx:if="{{activeTitle == '3' && !is_user_comments && isComments =='1' && couponData.showCoupon =='1'}}">
<view class="regionItem certificateBox couponBoxWrap" wx:if="{{activeTitle == '3' && !is_user_comments && isComments =='1' && couponData.showCoupon =='1'}}">
<view class="font28r evaluateTitleText">期待您的声音,帮助我们持续改进</view>
<view class="couponInfo" bindtap="evaluateFun">
<view class="preferentialItems">
... ... @@ -193,7 +212,7 @@
<view class="certificateInfo">
<view class="preferentialDetails">
<view class="information">
<text class="discountText font20r">{{couponData.use.is_cash=='1'?'代金券':couponData.use.is_discount=='1'?'超值折扣':couponData.use.is_dish=='1'?'特惠菜品':''}}</text>
<text class="discountText font20r">{{couponData.use.is_cash=='1'?'代金券':couponData.use.is_discount=='1'?'超值折扣':couponData.use.is_dish=='1'?'特惠菜品':'代金券'}}</text>
<text class="ticketName font24r">{{couponData.aname}}</text>
</view>
<text wx:if="{{couponData.exp_date.is_week=='1' || couponData.exp_date.is_week===true}}" class="limitation font24r">{{couponData.exp_date.week_show?couponData.exp_date.week_show+'可用':''}}</text>
... ... @@ -203,16 +222,35 @@
<view wx:if="{{couponData.exp_date.is_birthday=='1' || couponData.exp_date.is_birthday===true}}" class="limitation font24r">
会员生日当天可用
</view>
<view wx:if="{{couponData.desc}}" class="showDesc">
<view wx:if="{{couponData.is_type == '4' && couponData.desc}}" class="limitation showDesc">
<text class="font24r">消费要求</text>
</view>
<view wx:if="{{couponData.is_type == '3' && (couponData.noonText || couponData.nigText)}}" class="limitation showDesc">
<text class="font24r">不可用日期</text>
</view>
</view>
<view class="limitationBtn">
<view class="font24r couponBtn">立即领取</view>
<view class="limitationBtn" wx:if="{{couponData.is_type != '3'}}">
<view class="font24r couponBtn">立即抢购</view>
</view>
<view class="btnBox" wx:if="{{couponData.is_type == '3'}}" >
<view class="font24r orderingFood">已领取</view>
<view class="grantNum" wx:if="{{couponData.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{couponData.receiveNumText}}</text>张</view>
</view>
</view>
</view>
</view>
<view wx:if="{{couponData.desc}}" class="bottomLimitation font24r"><text></text>{{couponData.desc}}</view>
<view wx:if="{{couponData.is_type == '4' && couponData.desc!='0'}}" class="bottomLimitation limitation font24r bottomLimitationTop">
<text></text>
<view>消费满{{couponData.desc}}元可用</view>
</view>
<view wx:if="{{couponData.is_type == '3' && couponData.noonText}}" class="bottomLimitation limitation font24r bottomLimitationTop">
<text></text>{{couponData.noonText}}
</view>
<view wx:if="{{couponData.is_type == '3' && couponData.nigText}}" class="bottomLimitation limitation font24r">
<text></text>{{couponData.nigText}}
</view>
</view>
</view>
<view class="regionItem evaluateCoupon" wx:if="{{activeTitle == '3' && is_comments=='1' && (marketing.is_comments_coupon!='1' || couponData.showCoupon!='1')}}">
... ... @@ -436,4 +474,24 @@
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
<view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
</view>
<view slot="modalContent">
<view class="couponBox">
<view wx:for="{{couponArr}}" class="couponItems">
<view class="couponNum font20r">×{{item.number}}</view>
<view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
<view class="couponLines"></view>
<view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="font28r couponCondition" wx:else>无门槛</view>
</view>
</view>
<view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -368,15 +368,28 @@
padding: 0 20rpx;
border-radius: 22rpx;
text-align: center;
color: #000;
border-radius: 20rpx;
line-height: 44rpx;
height: 44rpx;
background: #fff;
border: 2rpx solid #fff;
width: max-content;
margin-top: 24rpx;
flex-shrink: 0;
border: 2rpx solid #999;
background: transparent;
color: #999;
}
.grantNum {
display: flex;
flex-direction: column;
align-items: center;
color: #999;
margin-top: 10rpx;
}
.grantNum text {
color: #CC9B6A;
margin-right: 10rpx;
}
.limitation {
... ... @@ -466,28 +479,30 @@
text-align: center;
}
.couponBox navigator,
.couponBox .couponInfo {
.couponBoxWrap navigator,
.couponBoxWrap .couponInfo {
width: 100%;
margin-bottom: 20rpx;
padding-bottom: 10rpx;
border-radius: 10rpx;
background: #fff;
}
.couponBox .preferentialItems {
.bottomLimitationTop{
margin-top: 20rpx !important;
}
.couponBoxWrap .preferentialItems {
box-shadow: 0rpx 4rpx 8rpx #0000000d;
}
.couponBox .showDesc {
display: flex;
align-items: center;
.couponBoxWrap .showDesc {
color: #666;
}
.couponBox .bottomLimitation {
padding: 20rpx;
.couponBoxWrap .bottomLimitation {
padding: 0 20rpx;
display: flex;
flex-direction: row !important;
align-items: center;
margin-top: 10rpx;
color: #666;
... ... @@ -495,7 +510,11 @@
font-weight: 500;
}
.couponBox .bottomLimitation text {
.bottomLimitation:nth-last-of-type(1){
padding-bottom: 20rpx;
}
.couponBoxWrap .bottomLimitation text {
display: block;
width: 8rpx;
height: 8rpx;
... ... @@ -504,36 +523,36 @@
border-radius: 50%;
}
.couponBox .certificateInfo {
.couponBoxWrap .certificateInfo {
flex-direction: row;
align-items: center;
}
.couponBox .couponBtn {
.couponBoxWrap .couponBtn {
width: 100%;
height: fit-content;
background: #AE2D2D;
color: #fff;
}
.couponBox .certificateInfo .preferentialDetails {
.couponBoxWrap .certificateInfo .preferentialDetails {
width: 100%;
display: flex;
flex-direction: column;
}
.couponBox .information {
.couponBoxWrap .information {
display: flex;
align-items: center;
}
.couponBox .certificateInfo .limitation {
.couponBoxWrap .certificateInfo .limitation {
margin-right: 20rpx;
flex: 1;
width: auto;
}
.couponBox .discountInfo {
.couponBoxWrap .discountInfo {
font-family: PingFang SC;
background: #FD4D59;
position: absolute;
... ... @@ -549,7 +568,7 @@
width: max-content;
}
.couponBox .certificateImg {
.couponBoxWrap .certificateImg {
position: absolute;
top: 0;
left: 0;
... ... @@ -557,7 +576,7 @@
height: 28rpx;
}
.couponBox .limitationBtn {
.couponBoxWrap .limitationBtn {
width: 40%;
display: flex;
flex-direction: column;
... ... @@ -871,6 +890,145 @@
background: #811a1f;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
}
#couponModal .titleModal2 {
margin-top: 80%;
}
#couponModal .titleModal3 {
margin-top: 60%;
}
#couponModal .titleModal4 {
margin-top: 30%;
}
#couponModal .mymodal {
background: rgba(0, 0, 0, 0.8);
width: 100% !important;
top: 0 !important;
height: auto !important;
z-index: 300;
}
.nameInfo {
font-family: PingFang SC;
font-weight: 400;
font-size: 52rpx;
line-height: 56rpx;
color: #fff;
margin-bottom: 40rpx;
padding-top: 60rpx;
}
.couponTotal {
color: #dfdfdf;
font-family: PingFang SC;
font-weight: 400;
font-size: 40rpx;
line-height: 48rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponTotal text {
color: #ffc806;
font-weight: 600;
font-size: 80rpx;
margin: 0 14rpx;
}
.couponBox {
width: 80%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.couponItems {
width: 46%;
margin-bottom: 24rpx;
padding-bottom: 52rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
}
.couponNum {
background: #727272;
border-radius: 50%;
color: #fff;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 8rpx 0 0 8rpx;
}
.couponPrice {
display: flex;
align-items: center;
justify-content: center;
color: #F6231B;
font-weight: 500;
}
.couponLines{
width: 80%;
margin: 0 auto;
height: 2rpx;
border-bottom: 2rpx dashed #F6231B;
}
.couponPrice text {
margin-left: 4rpx;
font-size: 76rpx;
font-weight: 700;
}
.couponCondition {
color: #C36607;
display: flex;
align-items: center;
justify-content: center;
padding-top: 24rpx;
}
.couponBtn {
width: 80%;
margin: 0 auto;
border-radius: 42rpx;
background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
font-weight: 400;
color: #fff;
text-align: center;
border: 4rpx solid #fff;
padding: 12rpx 0;
margin: 16rpx auto 20rpx auto;
}
.couponText {
color: #fff;
text-decoration: underline;
text-align: center;
}
.closeImg {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0;
top: 0;
}
/* 商务宴会 */
.viewBox2 {
background: #fff;
... ...
... ... @@ -68,6 +68,8 @@ Page({
titleList: [], //优惠券、充值、评价标题数组
modalType: '', //弹框
modalTitle: '', //弹框标题
couponArr: [],//待领取的优惠券列表
couponList:[],//优惠券列表
},
tablestr: '', //桌位id拼接
screenHeight: '',
... ... @@ -77,6 +79,7 @@ Page({
n: 0,
modal: '',
publicModal: '',
couponModal: '',
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -109,6 +112,7 @@ Page({
wx.onUserCaptureScreen((res) => {
this.modal.showModal()
})
this.couponModal = this.selectComponent("#couponModal");
},
//预览图片
previewImage(e) {
... ... @@ -126,6 +130,11 @@ Page({
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框(更新已被领取数量)
closeCouponModal() {
this.getActivityByIdFun(this.data.couponList,'1')
this.couponModal.closeModal()
},
// 公共弹框
publicShowModal(e) {
const modalType = e.currentTarget.dataset['type'];
... ... @@ -262,9 +271,11 @@ Page({
sellerid,
tableids: this.tablestr
}).then((json) => {
console.log('客户经理获取基本信息------', json.data)
if (json.ret == 200) {
this.setData({
roomimage: json.data
roomimage: json.data,
couponArr:[],
})
var urlsArr = [];
json.data.forEach((v, i) => {
... ... @@ -616,7 +627,7 @@ Page({
}).then(res => {
let data = res.data
let couponList = []
let StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
let StyleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -633,29 +644,23 @@ Page({
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo != '0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
marketing.coupon_data_payList = coupon_data_pay
coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
marketing.coupon_data_freeList = coupon_data_free
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') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
// 获取全部的优惠券(商家券、个人券、免费券、付费券)
couponList = this.addCoupons(coupon,couponList);
couponList = this.addCoupons(coupon_data_pay,couponList);
couponList = this.addCoupons(coupon_data_free,couponList);
// 根据券ID获取券详情
this.getActivityByIdFun(couponList)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
... ... @@ -694,6 +699,7 @@ Page({
lite_style: data.lite_style,
timeList,
is_comments,
couponList,
isMoreBtn: marketing && marketing.is_online_book == '1' && this.data.options.onlineReserve == '1',
isShareItem: this.data.options.isOrder != '1' && marketing && marketing.is_transpond == '1',
isComments: is_comments == '1' && marketing && marketing.is_comments_coupon == '1',
... ... @@ -743,9 +749,12 @@ Page({
})
},
// 点击商家有礼
gotoSellerGift() {
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
... ... @@ -913,29 +922,50 @@ Page({
id
}).then(res => {
if (res.data.length > 0) {
let couponData = res.data[0]
couponData.use = couponData.use ? util.determine(couponData.use) : '';
couponData.exp_date = couponData.exp_date ? util.determine(couponData.exp_date) : '';
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 detail = res.data[0]
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
let num = detail.grant_num*1-detail.grant_last*1;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
// showCoupon 代表赠送的券没过有效期 && 是开启状态
couponData.showCoupon = (this.data.dataStr < (couponData.etime * 1) && couponData.is_open == '1') ? '1' : '0';
console.log('邀请函--------------------评价赠送的优惠券', couponData);
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
detail.showCoupon = (this.data.dataStr < (detail.etime * 1) && detail.is_open == '1') ? '1' : '0';
let entry = this.data.titleList
if (!this.data.is_user_comments && this.data.isComments == '1' && couponData.showCoupon == '1') {
if ((!this.data.is_user_comments && this.data.isComments == '1' && detail.showCoupon == '1') || (this.data.is_comments == '1' && (this.data.marketing.is_comments_coupon != '1' || detail.showCoupon != '1'))) {
entry.push({
id: 3,
title: '意见反馈有礼'
title: '评价反馈'
})
if (entry.length > 0) {
entry.sort((a, b) => a.id - b.id);
}
}
console.log('邀请函--------------------评价赠送的优惠券', detail);
this.setData({
couponData: res.data[0],
couponData: detail,
titleList: entry,
activeTitle: entry.length > 0 ? entry[0].id : '',
})
... ... @@ -943,50 +973,194 @@ Page({
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
getActivityByIdFun(obj,setcoupon) {
App.Activity.GetActivityById({
id: obj.map(item => item.id).join(','),
}).then(res => {
if (res.data.length > 0) {
let list = res.data.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
let num = detail.grant_num * 1 - detail.grant_last * 1;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
detail.stimeStr = util.unixtoTime(detail.stime, 'YYYY-MM-DD HH:II')
detail.etimeStr = util.unixtoTime(detail.etime, 'YYYY-MM-DD HH:II')
coupon_dataList.push(detail);
if (length === coupon_dataList.length) {
coupon_dataList = coupon_dataList.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
let entry = this.data.titleList
if (this.data.hasValueCertificate && this.data.marketing.is_coupon == '1' && coupon_dataList.length > 0) {
entry.push({
id: 1,
title: '专属优惠券'
})
if (entry.length > 0) {
entry.sort((a, b) => a.id - b.id);
}
})
let freeCoupons = list.filter(item => {
return item.is_type == '3'
})
let entry = this.data.titleList
if (this.data.hasValueCertificate && list.length > 0 && setcoupon != '1') {
entry.push({
id: 1,
title: '专属优惠券'
})
if (entry.length > 0) {
entry.sort((a, b) => a.id - b.id);
}
}
// 免费券判断是否领取,弹框领取
if (freeCoupons.length > 0 && setcoupon != '1') {
let length = freeCoupons.length - 1
freeCoupons.forEach(i => {
this.getCoupon(i, freeCoupons[length].id, obj)
})
}
console.log('邀请函--------------------优惠券', list);
this.setData({
coupon_dataList: list,
titleList: entry,
activeTitle: entry.length > 0 ? entry[0].id : '',
})
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
let couponArr = this.data.couponArr;
let totalPrice = this.data.totalPrice;
App.Activity.ActivityListByOpenid({
aid: item.id,
sellerid:this.data.seller.sid,
}).then(res => {
if (res.ret == 200) {
if (res.data.length == 0) {
couponArr.push(item)
}
if (item.id == id && couponArr.length > 0) {
couponArr.forEach((item,index) => {
let match = obj.find(b => b.id === item.id);
if (match) {
item.number = match.number;
}
console.log('邀请函--------------------优惠券', coupon_dataList);
this.setData({
coupon_dataList,
titleList: entry,
activeTitle: entry.length > 0 ? entry[0].id : '',
})
item.grant_num = item.grant_num*1
if(item.grant_num < 0 || item.grant_num == 0) couponArr.splice(index,1)
if(item.number>item.grant_num){
item.number = item.grant_num
}
});
if(couponArr.length>0){
totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
this.setcouponFun(couponArr)
this.couponModal.showModal()
}
}
})
console.log('未领取的券列表-----------', couponArr);
this.setData({
couponArr,
totalPrice
})
}
})
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
... ... @@ -3,7 +3,7 @@
<nav hasHome class="navhome" backgroundColor="{{show_white ? colors : 'transparent'}}" place="{{false}}"></nav>
<scroll-view scroll-y class="viewBox viewBox{{bookType}}">
<image wx:if="{{hasValueBroadcast && isVoice=='1'}}" class="musicImg" src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}" bindtap="stopMusic" animation="{{attentionAnim}}" />
<image class="giftImg" bindtap="gotoSellerGift" wx:if="{{(hasValueCertificate && marketing.is_coupon=='1' && coupon_dataList.length>0) || (!is_user_comments && isComments =='1' && couponData.showCoupon =='1') || (hasValueRecharge && marketing.is_recharge=='1' && recharge_data)}}" src="https://nosqn.colorcun.com/sellerGift.png" mode="" />
<image class="giftImg" bindtap="gotoSellerGift" data-form="1" wx:if="{{(hasValueCertificate && coupon_dataList.length>0) || (!is_user_comments && isComments =='1' && couponData.showCoupon =='1') || (hasValueRecharge && marketing.is_recharge=='1' && recharge_data)}}" src="https://nosqn.colorcun.com/sellerGift.png" mode="" />
<image wx:if="{{detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
<image wx:if="{{options.isOrder == '1' && detail.status !='4'}}" class="cannotImg" src="https://qn.colorcun.com/overImg.png" />
<view class="reservationInfo">
... ... @@ -93,7 +93,7 @@
</view>
</view>
<view class="entrance">
<view bindtap="publicShowModal" data-type="1" data-title="专属优惠券" wx:if="{{hasValueCertificate && marketing.is_coupon=='1' && coupon_dataList.length>0}}" class="entranceItem">
<view bindtap="publicShowModal" data-type="1" data-title="专属优惠券" wx:if="{{hasValueCertificate && coupon_dataList.length>0}}" class="entranceItem">
<image src="https://qn.colorcun.com/invitation1{{bookType == '1'?'3':'4'}}Icon1.png" mode="" />
<view class="font24r">专属优惠券</view>
</view>
... ... @@ -153,9 +153,9 @@
<image bindtap="closepublicModal" src="https://qn.colorcun.com/invitation13Icons.png" mode="" />
</view>
<block wx:if="{{modalType == '1'}}">
<view class="regionItem couponBox" slot="modalContent">
<view class="regionItem couponBoxWrap" slot="modalContent">
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="purchase">
<view class="priceText" wx:if="{{item.price}}">
... ... @@ -167,7 +167,7 @@
<view class="certificateInfo">
<view class="preferentialDetails">
<view class="information">
<text class="discountText font20r">{{item.use.is_cash=='1'?'代金券':item.use.is_discount=='1'?'超值折扣':item.use.is_dish=='1'?'特惠菜品':''}}</text>
<text class="discountText font20r">{{item.use.is_cash=='1'?'代金券':item.use.is_discount=='1'?'超值折扣':item.use.is_dish=='1'?'特惠菜品':'代金券'}}</text>
<text class="ticketName font24r">{{item.aname}}</text>
</view>
<text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="limitation font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}</text>
... ... @@ -177,16 +177,35 @@
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="limitation font24r">
会员生日当天可用
</view>
<view wx:if="{{item.desc}}" class="showDesc">
<view wx:if="{{item.is_type == '4' && item.desc}}" class="limitation showDesc">
<text class="font24r">消费要求</text>
</view>
<view wx:if="{{item.is_type == '3' && (item.noonText || item.nigText)}}" class="limitation showDesc">
<text class="font24r">不可用日期</text>
</view>
</view>
<view class="limitationBtn">
<view class="limitationBtn" wx:if="{{item.is_type != '3'}}">
<view class="font24r couponBtn">立即抢购</view>
</view>
<view class="btnBox" wx:if="{{item.is_type == '3'}}" >
<view class="font24r orderingFood">已领取</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
</view>
</view>
</view>
</view>
<view wx:if="{{item.desc}}" class="bottomLimitation font24r"><text></text>{{item.desc}}</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottomLimitation limitation font24r bottomLimitationTop">
<text></text>
<view>消费满{{item.desc}}元可用</view>
</view>
<view wx:if="{{item.is_type == '3' && item.noonText}}" class="bottomLimitation limitation font24r bottomLimitationTop">
<text></text>{{item.noonText}}
</view>
<view wx:if="{{item.is_type == '3' && item.nigText}}" class="bottomLimitation limitation font24r">
<text></text>{{item.nigText}}
</view>
</navigator>
</block>
</view>
... ... @@ -217,7 +236,7 @@
</view>
</block>
<block wx:if="{{modalType == '3'}}">
<view class="publicModule couponBox" slot="modalContent" wx:if="{{!is_user_comments && isComments =='1' && couponData.showCoupon =='1'}}">
<view class="publicModule couponBoxWrap" slot="modalContent" wx:if="{{!is_user_comments && isComments =='1' && couponData.showCoupon =='1'}}">
<view class="font28r evaluateTitleText">期待您的声音,帮助我们持续改进</view>
<view class="couponInfo" bindtap="evaluateFun">
<view class="preferentialItems">
... ... @@ -231,7 +250,7 @@
<view class="certificateInfo">
<view class="preferentialDetails">
<view class="information">
<text class="discountText font20r">{{couponData.use.is_cash=='1'?'代金券':couponData.use.is_discount=='1'?'超值折扣':couponData.use.is_dish=='1'?'特惠菜品':''}}</text>
<text class="discountText font20r">{{couponData.use.is_cash=='1'?'代金券':couponData.use.is_discount=='1'?'超值折扣':couponData.use.is_dish=='1'?'特惠菜品':'代金券'}}</text>
<text class="ticketName font24r">{{couponData.aname}}</text>
</view>
<text wx:if="{{couponData.exp_date.is_week=='1' || couponData.exp_date.is_week===true}}" class="limitation font24r">{{couponData.exp_date.week_show?couponData.exp_date.week_show+'可用':''}}</text>
... ... @@ -241,16 +260,35 @@
<view wx:if="{{couponData.exp_date.is_birthday=='1' || couponData.exp_date.is_birthday===true}}" class="limitation font24r">
会员生日当天可用
</view>
<view wx:if="{{couponData.desc}}" class="limitation showDesc">
<view wx:if="{{couponData.is_type == '4' && couponData.desc}}" class="limitation showDesc">
<text class="font24r">消费要求</text>
</view>
<view wx:if="{{couponData.is_type == '3' && (couponData.noonText || couponData.nigText)}}" class="limitation showDesc">
<text class="font24r">不可用日期</text>
</view>
</view>
<view class="limitationBtn" wx:if="{{couponData.is_type != '3'}}">
<view class="font24r couponBtn">立即抢购</view>
</view>
<view class="limitationBtn">
<view class="font24r couponBtn">立即领取</view>
<view class="btnBox" wx:if="{{couponData.is_type == '3'}}" >
<view class="font24r orderingFood">已领取</view>
<view class="grantNum" wx:if="{{couponData.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{couponData.receiveNumText}}</text>张</view>
</view>
</view>
</view>
</view>
<view wx:if="{{couponData.desc}}" class="bottomLimitation limitation font24r"><text></text>{{couponData.desc}}</view>
<view wx:if="{{couponData.is_type == '4' && couponData.desc!='0'}}" class="bottomLimitation limitation font24r bottomLimitationTop">
<text></text>
<view>消费满{{couponData.desc}}元可用</view>
</view>
<view wx:if="{{couponData.is_type == '3' && couponData.noonText}}" class="bottomLimitation limitation font24r bottomLimitationTop">
<text></text>{{couponData.noonText}}
</view>
<view wx:if="{{couponData.is_type == '3' && couponData.nigText}}" class="bottomLimitation limitation font24r">
<text></text>{{couponData.nigText}}
</view>
</view>
</view>
<!-- 评价没有券 -->
... ... @@ -409,4 +447,24 @@
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
<view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
</view>
<view slot="modalContent">
<view class="couponBox">
<view wx:for="{{couponArr}}" class="couponItems">
<view class="couponNum font20r">×{{item.number}}</view>
<view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
<view class="couponLines"></view>
<view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="font28r couponCondition" wx:else>无门槛</view>
</view>
</view>
<view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -403,15 +403,28 @@
padding: 0 20rpx;
border-radius: 22rpx;
text-align: center;
color: #000;
border-radius: 20rpx;
line-height: 44rpx;
height: 44rpx;
background: #fff;
border: 2rpx solid #fff;
width: max-content;
margin-top: 24rpx;
flex-shrink: 0;
border: 2rpx solid #999;
background: transparent;
color: #999;
}
.grantNum {
display: flex;
flex-direction: column;
align-items: center;
color: #999;
margin-top: 10rpx;
}
.grantNum text {
color: #CC9B6A;
margin-right: 10rpx;
}
.limitation {
... ... @@ -510,28 +523,30 @@
}
.couponBox navigator,
.couponBox .couponInfo {
.couponBoxWrap navigator,
.couponBoxWrap .couponInfo {
width: 100%;
margin-bottom: 20rpx;
padding-bottom: 10rpx;
border-radius: 10rpx;
background: #FFF1E6;
}
.couponBox .preferentialItems {
.bottomLimitationTop{
margin-top: 20rpx !important;
}
.couponBoxWrap .preferentialItems {
box-shadow: 0rpx 4rpx 8rpx #0000000d;
}
.couponBox .showDesc {
display: flex;
align-items: center;
.couponBoxWrap .showDesc {
color: #666;
}
.bottomLimitation {
padding: 20rpx;
padding: 0 20rpx;
display: flex;
flex-direction: row !important;
align-items: center;
margin-top: 10rpx;
color: #666;
... ... @@ -539,6 +554,10 @@
font-weight: 500;
}
.bottomLimitation:nth-last-of-type(1){
padding-bottom: 20rpx;
}
.bottomLimitation text {
display: block;
width: 8rpx;
... ... @@ -548,20 +567,20 @@
border-radius: 50%;
}
.couponBox .certificateInfo {
.couponBoxWrap .certificateInfo {
flex-direction: row;
background: #FFF1E6;
align-items: center;
}
.couponBox .couponBtn {
.couponBoxWrap .couponBtn {
width: 100%;
height: fit-content;
background: #D2541C;
color: #fff;
}
.couponBox .certificateInfo .preferentialDetails {
.couponBoxWrap .certificateInfo .preferentialDetails {
width: 100%;
display: flex;
flex-direction: column;
... ... @@ -569,18 +588,18 @@
.couponBox .information {
.couponBoxWrap .information {
display: flex;
align-items: center;
}
.couponBox .certificateInfo .limitation {
.couponBoxWrap .certificateInfo .limitation {
margin-right: 20rpx;
flex: 1;
width: auto;
}
.couponBox .discountInfo {
.couponBoxWrap .discountInfo {
font-family: PingFang SC;
background: #FD4D59;
position: absolute;
... ... @@ -596,7 +615,7 @@
width: max-content;
}
.couponBox .certificateImg {
.couponBoxWrap .certificateImg {
position: absolute;
top: 0;
left: 0;
... ... @@ -604,7 +623,7 @@
height: 28rpx;
}
.couponBox .limitationBtn {
.couponBoxWrap .limitationBtn {
width: 40%;
display: flex;
flex-direction: column;
... ... @@ -924,6 +943,145 @@
background: #E4E7E0;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
}
#couponModal .titleModal2 {
margin-top: 80%;
}
#couponModal .titleModal3 {
margin-top: 60%;
}
#couponModal .titleModal4 {
margin-top: 30%;
}
#couponModal .mymodal {
background: rgba(0, 0, 0, 0.8);
width: 100% !important;
top: 0 !important;
height: auto !important;
z-index: 300;
}
.nameInfo {
font-family: PingFang SC;
font-weight: 400;
font-size: 52rpx;
line-height: 56rpx;
color: #fff;
margin-bottom: 40rpx;
padding-top: 60rpx;
}
.couponTotal {
color: #dfdfdf;
font-family: PingFang SC;
font-weight: 400;
font-size: 40rpx;
line-height: 48rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponTotal text {
color: #ffc806;
font-weight: 600;
font-size: 80rpx;
margin: 0 14rpx;
}
.couponBox {
width: 80%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.couponItems {
width: 46%;
margin-bottom: 24rpx;
padding-bottom: 52rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
}
.couponNum {
background: #727272;
border-radius: 50%;
color: #fff;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 8rpx 0 0 8rpx;
}
.couponPrice {
display: flex;
align-items: center;
justify-content: center;
color: #F6231B;
font-weight: 500;
}
.couponLines{
width: 80%;
margin: 0 auto;
height: 2rpx;
border-bottom: 2rpx dashed #F6231B;
}
.couponPrice text {
margin-left: 4rpx;
font-size: 76rpx;
font-weight: 700;
}
.couponCondition {
color: #C36607;
display: flex;
align-items: center;
justify-content: center;
padding-top: 24rpx;
}
.couponBtn {
width: 80%;
margin: 0 auto;
border-radius: 42rpx;
background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
font-weight: 400;
color: #fff;
text-align: center;
border: 4rpx solid #fff;
padding: 12rpx 0;
margin: 16rpx auto 20rpx auto;
}
.couponText {
color: #fff;
text-decoration: underline;
text-align: center;
}
.closeImg {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0;
top: 0;
}
/* 商务宴会 */
.viewBox2 {
background: #fffef8;
... ... @@ -1068,7 +1226,7 @@
background: #854F1E;
}
.publicModalBox2 .couponBox .couponBtn,
.publicModalBox2 .couponBoxWrap .couponBtn,
.publicModalBox2 .rechargeBtn view {
background: #854F1E;
}
... ...