Commit 3160b78f714e46cbb495c85cfe73f8391698835b

Authored by pengye
1 parent 384f643d

邀请函2-17付费券、免费券

Too many changes to show.

To preserve performance only 21 of 21+ files are displayed.

@@ -96,7 +96,8 @@ @@ -96,7 +96,8 @@
96 "pack/examineCertificate", 96 "pack/examineCertificate",
97 "pack/subscribeDrawback", 97 "pack/subscribeDrawback",
98 "pack/vipRecharge", 98 "pack/vipRecharge",
99 - "pack/seeRecharge" 99 + "pack/seeRecharge",
  100 + "pack/receiveCoupon"
100 ] 101 ]
101 }, 102 },
102 { 103 {
@@ -66,6 +66,7 @@ Page({ @@ -66,6 +66,7 @@ Page({
66 isMoreBtn:'',//再次预订按钮 66 isMoreBtn:'',//再次预订按钮
67 isPaymenBtn:'',//支付定金按钮 67 isPaymenBtn:'',//支付定金按钮
68 isShareItem:'',//转发客人按钮 68 isShareItem:'',//转发客人按钮
  69 + couponArr: [],//待领取的优惠券列表
69 }, 70 },
70 tablestr: '', 71 tablestr: '',
71 urlsValue: [], 72 urlsValue: [],
@@ -75,6 +76,7 @@ Page({ @@ -75,6 +76,7 @@ Page({
75 timers: null, // 动画定时器 76 timers: null, // 动画定时器
76 n: 0, 77 n: 0,
77 modal:'', 78 modal:'',
  79 + couponModal: '',
78 /** 80 /**
79 * 生命周期函数--监听页面加载 81 * 生命周期函数--监听页面加载
80 */ 82 */
@@ -102,6 +104,7 @@ Page({ @@ -102,6 +104,7 @@ Page({
102 wx.onUserCaptureScreen((res)=> { 104 wx.onUserCaptureScreen((res)=> {
103 this.showModal() 105 this.showModal()
104 }) 106 })
  107 + this.couponModal = this.selectComponent("#couponModal");
105 }, 108 },
106 // 打开截屏弹框 109 // 打开截屏弹框
107 showModal() { 110 showModal() {
@@ -111,6 +114,10 @@ Page({ @@ -111,6 +114,10 @@ Page({
111 closeModal() { 114 closeModal() {
112 this.modal.closeModal() 115 this.modal.closeModal()
113 }, 116 },
  117 + // 关闭优惠券弹框
  118 + closeCouponModal() {
  119 + this.couponModal.closeModal()
  120 + },
114 // 页面滚动事件 121 // 页面滚动事件
115 onPageScroll: function (event) { 122 onPageScroll: function (event) {
116 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离 123 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
@@ -456,9 +463,10 @@ Page({ @@ -456,9 +463,10 @@ Page({
456 uid 463 uid
457 }).then((json) => { 464 }).then((json) => {
458 if (json.ret == 200) { 465 if (json.ret == 200) {
459 - console.log('staffinfostaffinfostaffinfo', json.data) 466 + console.log('客户经理获取基本信息------', json.data)
460 this.setData({ 467 this.setData({
461 - staffinfo: json.data 468 + staffinfo: json.data,
  469 + couponArr:[],
462 }) 470 })
463 this.getSellerTemplateConfFun(sid); 471 this.getSellerTemplateConfFun(sid);
464 } 472 }
@@ -579,7 +587,7 @@ Page({ @@ -579,7 +587,7 @@ Page({
579 let data = res.data 587 let data = res.data
580 console.log('data', data); 588 console.log('data', data);
581 let couponList = [] 589 let couponList = []
582 - let themeColor, StyleType, titleType, themeSixteen, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store; 590 + let themeColor, StyleType, titleType, themeSixteen, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
583 chef = util.determine(data.chef); 591 chef = util.determine(data.chef);
584 reserve = util.determine(data.reserve); 592 reserve = util.determine(data.reserve);
585 marketing = util.determine(data.marketing); 593 marketing = util.determine(data.marketing);
@@ -598,29 +606,23 @@ Page({ @@ -598,29 +606,23 @@ Page({
598 if (marketing) { 606 if (marketing) {
599 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : ''; 607 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
600 is_comments = marketing.is_comments ? marketing.is_comments : ''; 608 is_comments = marketing.is_comments ? marketing.is_comments : '';
601 - coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : ''; 609 + coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
  610 + coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
  611 + marketing.coupon_data_payList = coupon_data_pay
  612 + coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
  613 + marketing.coupon_data_freeList = coupon_data_free
602 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : ''; 614 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
603 let couponDataId = info && info.length > 0 ? info[0].id : {} 615 let couponDataId = info && info.length > 0 ? info[0].id : {}
604 // 根据券ID获取评价赠送的券详情 616 // 根据券ID获取评价赠送的券详情
605 if(couponDataId) this.getEvaluateFun(couponDataId) 617 if(couponDataId) this.getEvaluateFun(couponDataId)
606 } 618 }
607 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 619 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
608 - if (coupon && util.getType(coupon) == 'object') {  
609 - couponList.push({  
610 - id: coupon.id  
611 - });  
612 - }  
613 - if (coupon && util.getType(coupon) == 'array') {  
614 - if (coupon.length > 0) {  
615 - coupon.forEach(item => {  
616 - couponList.push({  
617 - id: item.id  
618 - })  
619 - })  
620 - }  
621 - } 620 + // 获取全部的优惠券(商家券、个人券、免费券、付费券)
  621 + couponList = this.addCoupons(coupon,couponList);
  622 + couponList = this.addCoupons(coupon_data_pay,couponList);
  623 + couponList = this.addCoupons(coupon_data_free,couponList);
622 // 根据券ID获取券详情 624 // 根据券ID获取券详情
623 - this.getActivityByIdFun(couponList, couponList.length) 625 + this.getActivityByIdFun(couponList)
624 // 根据充值ID获取充值详情 626 // 根据充值ID获取充值详情
625 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) { 627 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
626 this.getRechargeDetail(marketing.recharge_data.id) 628 this.getRechargeDetail(marketing.recharge_data.id)
@@ -742,13 +744,16 @@ Page({ @@ -742,13 +744,16 @@ Page({
742 }) 744 })
743 }, 745 },
744 // 点击商家有礼 746 // 点击商家有礼
745 - gotoSellerGift(){  
746 - let url = util.http_build_query({ 747 + gotoSellerGift(e){
  748 + this.couponModal.closeModal()
  749 + const form = e.currentTarget.dataset['form'];
  750 + let url = util.http_build_query({
747 id: this.data.detail.id, 751 id: this.data.detail.id,
748 - }, '/pages/reserve/sellerGift')  
749 - wx.navigateTo({  
750 - url  
751 - }) 752 + form
  753 + }, '/pages/reserve/sellerGift')
  754 + wx.navigateTo({
  755 + url
  756 + })
752 }, 757 },
753 // 再次预订 758 // 再次预订
754 secondbook() { 759 secondbook() {
@@ -902,34 +907,172 @@ Page({ @@ -902,34 +907,172 @@ Page({
902 }) 907 })
903 }, 908 },
904 // 根据券ID获取券详情 909 // 根据券ID获取券详情
905 - getActivityByIdFun(ids, length) {  
906 - let coupon_dataList = [];  
907 - ids.forEach(i => {  
908 - App.Activity.GetActivityById({  
909 - id: i.id  
910 - }).then(res => {  
911 - if (res.data.length > 0) {  
912 - let detail = res.data[0];  
913 - detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';  
914 - detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';  
915 - detail.use = detail.use ? util.determine(detail.use) : '';  
916 - if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {  
917 - let cash = detail.use.cash * 1;  
918 - let price = detail.price * 1;  
919 - detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
920 - }  
921 - coupon_dataList.push(detail);  
922 - if (length === coupon_dataList.length) {  
923 - coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})  
924 - console.log('邀请函--------------------优惠券',coupon_dataList);  
925 - this.setData({  
926 - coupon_dataList,  
927 - })  
928 - }  
929 - }  
930 - })  
931 - })  
932 - }, 910 + getActivityByIdFun(obj) {
  911 + App.Activity.GetActivityById({
  912 + id: obj.map(item => item.id).join(','),
  913 + }).then(res => {
  914 + if (res.data.length > 0) {
  915 + let list = res.data.filter(item => {
  916 + return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
  917 + })
  918 + list.forEach(detail => {
  919 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  920 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  921 + detail.arule = detail.arule ? util.determine(detail.arule) : '';
  922 + detail.use = detail.use ? util.determine(detail.use) : '';
  923 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  924 + let cash = detail.use.cash * 1;
  925 + let price = detail.price * 1;
  926 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  927 + }
  928 + let num = detail.receiveNum;
  929 + if (num > 0) {
  930 + detail.receiveNumText = ''
  931 + if (num >= 0 && num <= 100) {
  932 + detail.receiveNumText = num.toString();
  933 + } else if (num >= 101 && num <= 199) {
  934 + detail.receiveNumText = '100+';
  935 + } else if (num >= 200 && num <= 299) {
  936 + detail.receiveNumText = '200+';
  937 + } else {
  938 + detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
  939 + }
  940 + }
  941 + if (detail.exp_date && detail.exp_date.week_data) {
  942 + let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
  943 + let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
  944 + if (noon) noon = '午餐:' + noon
  945 + if (nig) nig = '晚餐:' + nig
  946 + detail.noonText = noon;
  947 + detail.nigText = nig;
  948 + }
  949 + })
  950 + let freeCoupons = list.filter(item => {
  951 + return item.is_type == '3'
  952 + })
  953 + // 免费券判断是否领取,弹框领取
  954 + if (freeCoupons.length > 0) {
  955 + let length = freeCoupons.length - 1
  956 + freeCoupons.forEach(i => {
  957 + this.getCoupon(i, freeCoupons[length].id, obj)
  958 + })
  959 + }
  960 + console.log('邀请函--------------------优惠券', list);
  961 + this.setData({
  962 + coupon_dataList: list,
  963 + })
  964 + }
  965 + })
  966 + },
  967 + // 获取所有的券并且展示
  968 + addCoupons(coupons, couponList) {
  969 + if (coupons && util.getType(coupons) == 'object') {
  970 + couponList.push({
  971 + id: coupon.id,
  972 + number: coupon.number
  973 + });
  974 + }
  975 + if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
  976 + coupons.forEach(item => {
  977 + couponList.push({
  978 + id: item.id,
  979 + number: item.number
  980 + });
  981 + });
  982 + }
  983 + return couponList
  984 + },
  985 + // 弹框领取免费券
  986 + setcouponFun(arr) {
  987 + let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
  988 + console.log('弹框领取免费券id', str);
  989 + App.Activity.SetActivityAsReserve({
  990 + aid: str,
  991 + rid: this.id,
  992 + }).then((json) => {
  993 + if (json.ret != 200) {
  994 + wx.showToast({
  995 + title: res.msg,
  996 + duration: 2000,
  997 + mask: true
  998 + })
  999 + }
  1000 + })
  1001 + },
  1002 + // 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
  1003 + getCoupon(item, id, obj) {
  1004 + let couponArr = this.data.couponArr;
  1005 + let totalPrice = this.data.totalPrice;
  1006 + App.Activity.ActivityListByOpenid({
  1007 + aid: item.id
  1008 + }).then(res => {
  1009 + if (res.ret == 200) {
  1010 + if (res.data.length == 0) {
  1011 + couponArr.push(item)
  1012 + }
  1013 + if (item.id == id && couponArr.length > 0) {
  1014 + couponArr.forEach(item => {
  1015 + let match = obj.find(b => b.id === item.id);
  1016 + if (match) {
  1017 + item.number = match.number;
  1018 + }
  1019 + });
  1020 + totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
  1021 + this.setcouponFun(couponArr)
  1022 + this.couponModal.showModal()
  1023 + }
  1024 + console.log('未领取的券列表-----------', couponArr);
  1025 + this.setData({
  1026 + couponArr,
  1027 + totalPrice
  1028 + })
  1029 + }
  1030 + })
  1031 + },
  1032 + // 处理优惠券不可用日期数据
  1033 + hasConsecutiveSelect(arr, type) {
  1034 + let firstTitle = null;
  1035 + let lastTitle = null;
  1036 + let rArr = []
  1037 + let num = 0
  1038 + for (let i = 0; i < arr.length; i++) {
  1039 + let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
  1040 + if (str) {
  1041 + rArr.push(arr[i].title)
  1042 + num++
  1043 + if (num == 1) {
  1044 + firstTitle = arr[i].title
  1045 + }
  1046 + if (num >= 5) {
  1047 + lastTitle = arr[i].title
  1048 + }
  1049 + if (num >= 5 && i >= (arr.length - 1)) {
  1050 + let fi = rArr.findIndex((item) => {
  1051 + return item == firstTitle
  1052 + })
  1053 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1054 + num = 0
  1055 + }
  1056 + } else {
  1057 + if (num < 5) {
  1058 + num = 0
  1059 + firstTitle = null;
  1060 + lastTitle = null;
  1061 + } else {
  1062 + let fi = rArr.findIndex((item) => {
  1063 + return item == firstTitle
  1064 + })
  1065 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1066 + num = 0
  1067 + }
  1068 + }
  1069 + }
  1070 + return {
  1071 + rArr,
  1072 + lastTitle,
  1073 + firstTitle
  1074 + };
  1075 + },
933 /** 1076 /**
934 * 生命周期函数--监听页面隐藏 1077 * 生命周期函数--监听页面隐藏
935 */ 1078 */
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 /> 11 />
12 <image class="giftImg" 12 <image class="giftImg"
13 bindtap="gotoSellerGift" 13 bindtap="gotoSellerGift"
  14 + data-form="1"
14 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}" 15 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}"
15 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/> 16 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
16 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" /> 17 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
@@ -83,29 +84,49 @@ @@ -83,29 +84,49 @@
83 </view> 84 </view>
84 </view> 85 </view>
85 </block> 86 </block>
86 - <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}"> 87 + <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
87 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> 88 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
88 - <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"> 89 + <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">
89 <view class="preferentialItems"> 90 <view class="preferentialItems">
90 <view class="itemLeft"> 91 <view class="itemLeft">
91 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> 92 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
  93 + <view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
92 <view class="priceText" wx:if="{{item.price}}"> 94 <view class="priceText" wx:if="{{item.price}}">
93 - <view class="icons font40r">¥</view>{{item.price}} 95 + <view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
94 </view> 96 </view>
  97 + <view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
95 </view> 98 </view>
  99 + <view class="couponLine"></view>
96 <view class="itemRight"> 100 <view class="itemRight">
97 <view class="btns"> 101 <view class="btns">
98 <text class="font40r">{{item.aname}}</text> 102 <text class="font40r">{{item.aname}}</text>
99 - <view class="font24r orderingFood">  
100 - 抢购  
101 - </view> 103 + <block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
  104 + <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</view>
  105 + <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
  106 + 无限制{{item.desc?','+item.desc+'。':'。'}}
  107 + </view>
  108 + <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
  109 + 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
  110 + </view>
  111 + </block>
  112 + <block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
  113 + <view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
  114 + <view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可使用:</view>
  115 + <view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
  116 + <view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
  117 + <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
  118 + <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
  119 + </block>
102 </view> 120 </view>
103 - <text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</text>  
104 - <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">  
105 - 无限制{{item.desc?','+item.desc+'。':'。'}} 121 + <view class="btnBox" wx:if="{{item.is_type == '3'}}" >
  122 + <view class="font24r orderingFood orderingFood1">已领取</view>
  123 + <view class="grantNum" wx:if="{{item.receiveNumText}}">
  124 + <view class="font24r">已被领取</view>
  125 + <view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
  126 + </view>
106 </view> 127 </view>
107 - <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">  
108 - 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}} 128 + <view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
  129 + 立即抢购
109 </view> 130 </view>
110 </view> 131 </view>
111 </view> 132 </view>
@@ -326,4 +347,24 @@ @@ -326,4 +347,24 @@
326 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button> 347 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
327 </view> 348 </view>
328 </view> 349 </view>
  350 +</my-modal>
  351 +<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
  352 + <view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
  353 + <image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
  354 + <view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
  355 + <view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
  356 + </view>
  357 + <view slot="modalContent">
  358 + <view class="couponBox">
  359 + <view wx:for="{{couponArr}}" class="couponItems">
  360 + <view class="couponNum font20r">×{{item.number}}</view>
  361 + <view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
  362 + <view class="couponLines"></view>
  363 + <view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
  364 + <view class="font28r couponCondition" wx:else>无门槛</view>
  365 + </view>
  366 + </view>
  367 + <view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
  368 + <view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
  369 + </view>
329 </my-modal> 370 </my-modal>
@@ -271,13 +271,103 @@ @@ -271,13 +271,103 @@
271 flex-shrink: 0; 271 flex-shrink: 0;
272 } 272 }
273 273
  274 +.preferentialCoupon .itemRight {
  275 + width: 74%;
  276 + display: flex;
  277 + align-items: center;
  278 +}
  279 +
  280 +.preferentialCoupon .itemLeft {
  281 + width: 26%;
  282 +}
  283 +
  284 +.preferentialCoupon .couponLine{
  285 + margin: 24rpx 0;
  286 + border-right: 2rpx dashed #f6231b;
  287 +}
  288 +
  289 +.preferentialCoupon .orderingFood {
  290 + padding: 0 20rpx;
  291 + color: #fff !important;
  292 + border: none !important;
  293 + text-align: center;
  294 + border-radius: 20rpx;
  295 + line-height: 44rpx;
  296 + height: 44rpx;
  297 + width: max-content;
  298 + flex-shrink: 0;
  299 + background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
  300 +}
  301 +.preferentialCoupon .icons {
  302 + color: #F6231B;
  303 + text-align: center;
  304 +}
  305 +
  306 +.preferentialCoupon .priceText {
  307 + display: flex;
  308 + align-items: baseline;
  309 + justify-content: center;
  310 + font-family: PingFang SC;
  311 + color: #F6231B;
  312 + font-weight: 600;
  313 + font-size: 48rpx;
  314 + margin-top: 6rpx;
  315 +}
  316 +
  317 +.preferentialCoupon .priceText text {
  318 + font-size: 48rpx;
  319 +}
  320 +
  321 +.preferentialCoupon .btns {
  322 + flex: 1;
  323 +}
  324 +.preferentialCoupon .btnBox {
  325 + display: flex;
  326 + flex-direction: column;
  327 +}
  328 +
  329 +.preferentialCoupon .grantNum {
  330 + display: flex;
  331 + flex-direction: column;
  332 + align-items: center;
  333 + color: #C36607;
  334 + margin-top: 10rpx;
  335 +}
  336 +
  337 +.preferentialCoupon .grantNum text {
  338 + color: #F6231B;
  339 + margin-right: 10rpx;
  340 +}
  341 +
  342 +.preferentialCoupon .btns text {
  343 + font-weight: 600;
  344 +}
  345 +
  346 +.preferentialCoupon .orderingFood1 {
  347 + border: 2rpx solid #fa4b20 !important;
  348 + background: transparent !important;
  349 + color: #fa4b20 !important;
  350 +}
  351 +
  352 +.preferentialCoupon .btns text {
  353 + color: #0B0805 !important;
  354 +}
  355 +
  356 +.preferentialCoupon .bottom {
  357 + color: #C36607 !important;
  358 +}
  359 +
  360 +.preferentialCoupon .nodate{
  361 + margin-left: 20rpx;
  362 +}
  363 +
274 .preferentialItems { 364 .preferentialItems {
275 display: flex; 365 display: flex;
276 - background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat;  
277 - background-size: 100% 100%; 366 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
278 margin-bottom: 20rpx; 367 margin-bottom: 20rpx;
279 min-height: 160rpx; 368 min-height: 160rpx;
280 padding-bottom: 10rpx; 369 padding-bottom: 10rpx;
  370 + border: 2rpx solid #ff7e06;
281 } 371 }
282 372
283 .rechargeItems { 373 .rechargeItems {
@@ -290,6 +380,7 @@ @@ -290,6 +380,7 @@
290 height: auto; 380 height: auto;
291 padding: 12rpx 0; 381 padding: 12rpx 0;
292 margin: 0 20rpx; 382 margin: 0 20rpx;
  383 + border: none;
293 } 384 }
294 385
295 .rechargeItems .orderingFood { 386 .rechargeItems .orderingFood {
@@ -331,6 +422,20 @@ @@ -331,6 +422,20 @@
331 top: 12rpx; 422 top: 12rpx;
332 } 423 }
333 424
  425 +.discountText1{
  426 + text-align: center;
  427 + color: #FD4D59;
  428 + border: 2rpx solid #FD4D59;
  429 + border-radius: 6rpx;
  430 + font-family: PingFang SC;
  431 + background: transparent;
  432 + width: max-content;
  433 + padding: 0 6rpx;
  434 + position: absolute;
  435 + left: 16rpx;
  436 + top: 12rpx;
  437 +}
  438 +
334 .famousChefBox .labelBox, 439 .famousChefBox .labelBox,
335 .stopBox .labelBox { 440 .stopBox .labelBox {
336 border-bottom: none; 441 border-bottom: none;
@@ -424,9 +529,7 @@ @@ -424,9 +529,7 @@
424 } 529 }
425 530
426 .priceText .icons { 531 .priceText .icons {
427 - font-family: 'Abel';  
428 color: #FD4D59; 532 color: #FD4D59;
429 - font-size: 40rpx;  
430 } 533 }
431 534
432 .itemRight { 535 .itemRight {
@@ -440,6 +543,7 @@ @@ -440,6 +543,7 @@
440 display: flex; 543 display: flex;
441 justify-content: space-between; 544 justify-content: space-between;
442 align-items: baseline; 545 align-items: baseline;
  546 + flex-direction: column;
443 } 547 }
444 548
445 .btns text { 549 .btns text {
@@ -696,6 +800,145 @@ @@ -696,6 +800,145 @@
696 box-sizing: border-box; 800 box-sizing: border-box;
697 } 801 }
698 802
  803 +#couponModal .titleModal {
  804 + margin-top: 30%;
  805 + position: relative;
  806 +}
  807 +
  808 +#couponModal .titleModal2 {
  809 + margin-top: 80%;
  810 +}
  811 +
  812 +#couponModal .titleModal3 {
  813 + margin-top: 60%;
  814 +}
  815 +
  816 +#couponModal .titleModal4 {
  817 + margin-top: 30%;
  818 +}
  819 +
  820 +#couponModal .mymodal {
  821 + background: rgba(0, 0, 0, 0.8);
  822 + width: 100% !important;
  823 + top: 0 !important;
  824 + height: auto !important;
  825 + z-index: 300;
  826 +}
  827 +
  828 +.nameInfo {
  829 + font-family: PingFang SC;
  830 + font-weight: 400;
  831 + font-size: 52rpx;
  832 + line-height: 56rpx;
  833 + color: #fff;
  834 + margin-bottom: 40rpx;
  835 + padding-top: 60rpx;
  836 +}
  837 +
  838 +.couponTotal {
  839 + color: #dfdfdf;
  840 + font-family: PingFang SC;
  841 + font-weight: 400;
  842 + font-size: 40rpx;
  843 + line-height: 48rpx;
  844 + margin-bottom: 40rpx;
  845 + display: flex;
  846 + align-items: center;
  847 + justify-content: center;
  848 +}
  849 +
  850 +.couponTotal text {
  851 + color: #ffc806;
  852 + font-weight: 600;
  853 + font-size: 80rpx;
  854 + margin: 0 14rpx;
  855 +}
  856 +
  857 +.couponBox {
  858 + width: 80%;
  859 + margin: 0 auto;
  860 + display: flex;
  861 + flex-wrap: wrap;
  862 + justify-content: space-evenly;
  863 +}
  864 +
  865 +.couponItems {
  866 + width: 46%;
  867 + margin-bottom: 24rpx;
  868 + padding-bottom: 52rpx;
  869 + border-radius: 20rpx;
  870 + border: 2rpx solid #ff7e06;
  871 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
  872 +}
  873 +
  874 +.couponNum {
  875 + background: #727272;
  876 + border-radius: 50%;
  877 + color: #fff;
  878 + width: 40rpx;
  879 + height: 40rpx;
  880 + display: flex;
  881 + align-items: center;
  882 + justify-content: center;
  883 + margin: 8rpx 0 0 8rpx;
  884 +}
  885 +
  886 +.couponPrice {
  887 + display: flex;
  888 + align-items: center;
  889 + justify-content: center;
  890 + color: #F6231B;
  891 + font-weight: 500;
  892 +}
  893 +
  894 +.couponLines{
  895 + width: 80%;
  896 + margin: 0 auto;
  897 + height: 2rpx;
  898 + border-bottom: 2rpx dashed #F6231B;
  899 +}
  900 +
  901 +.couponPrice text {
  902 + margin-left: 4rpx;
  903 + font-size: 76rpx;
  904 + font-weight: 700;
  905 +}
  906 +
  907 +.couponCondition {
  908 + color: #C36607;
  909 + display: flex;
  910 + align-items: center;
  911 + justify-content: center;
  912 + padding-top: 24rpx;
  913 +}
  914 +
  915 +.couponBtn {
  916 + width: 80%;
  917 + margin: 0 auto;
  918 + border-radius: 42rpx;
  919 + background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
  920 + font-weight: 400;
  921 + color: #fff;
  922 + text-align: center;
  923 + border: 4rpx solid #fff;
  924 + padding: 12rpx 0;
  925 + margin: 16rpx auto 20rpx auto;
  926 +}
  927 +
  928 +.couponText {
  929 + color: #fff;
  930 + text-decoration: underline;
  931 + text-align: center;
  932 +}
  933 +
  934 +.closeImg {
  935 + width: 60rpx;
  936 + height: 60rpx;
  937 + position: absolute;
  938 + right: 0;
  939 + top: 0;
  940 +}
  941 +
699 /* 深中国红 */ 942 /* 深中国红 */
700 .crimson, 943 .crimson,
701 .crimson .positioningBox { 944 .crimson .positioningBox {
@@ -987,14 +1230,6 @@ @@ -987,14 +1230,6 @@
987 color: #578C69; 1230 color: #578C69;
988 } 1231 }
989 1232
990 -.pearlWhite .preferentialItems {  
991 - background: url(https://nosqn.colorcun.com/certificateWhiteBj1.png) no-repeat;  
992 - background-size: 100% 100%;  
993 - margin-bottom: 20rpx;  
994 - min-height: 160rpx;  
995 - padding-bottom: 10rpx;  
996 -}  
997 -  
998 .pearlWhite .rechargeItems { 1233 .pearlWhite .rechargeItems {
999 background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat; 1234 background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat;
1000 background-size: 100% 100%; 1235 background-size: 100% 100%;
@@ -1053,12 +1288,6 @@ @@ -1053,12 +1288,6 @@
1053 color: #578C69; 1288 color: #578C69;
1054 } 1289 }
1055 1290
1056 -.pearlWhite .discountText {  
1057 - background: transparent;  
1058 - border: 2rpx solid #FD4D59;  
1059 - color: #FD4D59;  
1060 -}  
1061 -  
1062 .toastBox { 1291 .toastBox {
1063 width: fit-content; 1292 width: fit-content;
1064 position: fixed; 1293 position: fixed;
@@ -66,6 +66,7 @@ Page({ @@ -66,6 +66,7 @@ Page({
66 isMoreBtn:'',//再次预订按钮 66 isMoreBtn:'',//再次预订按钮
67 isPaymenBtn:'',//支付定金按钮 67 isPaymenBtn:'',//支付定金按钮
68 isShareItem:'',//转发客人按钮 68 isShareItem:'',//转发客人按钮
  69 + couponArr: [],//待领取的优惠券列表
69 }, 70 },
70 tablestr: '', 71 tablestr: '',
71 urlsValue: [], 72 urlsValue: [],
@@ -75,6 +76,7 @@ Page({ @@ -75,6 +76,7 @@ Page({
75 timers: null, // 动画定时器 76 timers: null, // 动画定时器
76 n: 0, 77 n: 0,
77 modal:'', 78 modal:'',
  79 + couponModal: '',
78 /** 80 /**
79 * 生命周期函数--监听页面加载 81 * 生命周期函数--监听页面加载
80 */ 82 */
@@ -102,6 +104,7 @@ Page({ @@ -102,6 +104,7 @@ Page({
102 wx.onUserCaptureScreen((res)=> { 104 wx.onUserCaptureScreen((res)=> {
103 this.showModal() 105 this.showModal()
104 }) 106 })
  107 + this.couponModal = this.selectComponent("#couponModal");
105 }, 108 },
106 // 打开截屏弹框 109 // 打开截屏弹框
107 showModal() { 110 showModal() {
@@ -111,6 +114,10 @@ Page({ @@ -111,6 +114,10 @@ Page({
111 closeModal() { 114 closeModal() {
112 this.modal.closeModal() 115 this.modal.closeModal()
113 }, 116 },
  117 + // 关闭优惠券弹框
  118 + closeCouponModal() {
  119 + this.couponModal.closeModal()
  120 + },
114 // 页面滚动事件 121 // 页面滚动事件
115 onPageScroll: function (event) { 122 onPageScroll: function (event) {
116 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离 123 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
@@ -456,9 +463,10 @@ Page({ @@ -456,9 +463,10 @@ Page({
456 uid 463 uid
457 }).then((json) => { 464 }).then((json) => {
458 if (json.ret == 200) { 465 if (json.ret == 200) {
459 - console.log('staffinfostaffinfostaffinfo', json.data) 466 + console.log('客户经理获取基本信息------', json.data)
460 this.setData({ 467 this.setData({
461 - staffinfo: json.data 468 + staffinfo: json.data,
  469 + couponArr:[],
462 }) 470 })
463 this.getSellerTemplateConfFun(sid); 471 this.getSellerTemplateConfFun(sid);
464 } 472 }
@@ -579,7 +587,7 @@ Page({ @@ -579,7 +587,7 @@ Page({
579 let data = res.data 587 let data = res.data
580 console.log('data', data); 588 console.log('data', data);
581 let couponList = [] 589 let couponList = []
582 - let themeColor, StyleType, titleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store; 590 + let themeColor, StyleType, titleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
583 chef = util.determine(data.chef); 591 chef = util.determine(data.chef);
584 reserve = util.determine(data.reserve); 592 reserve = util.determine(data.reserve);
585 marketing = util.determine(data.marketing); 593 marketing = util.determine(data.marketing);
@@ -598,29 +606,23 @@ Page({ @@ -598,29 +606,23 @@ Page({
598 if (marketing) { 606 if (marketing) {
599 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : ''; 607 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
600 is_comments = marketing.is_comments ? marketing.is_comments : ''; 608 is_comments = marketing.is_comments ? marketing.is_comments : '';
601 - coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : ''; 609 + coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
  610 + coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
  611 + marketing.coupon_data_payList = coupon_data_pay
  612 + coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
  613 + marketing.coupon_data_freeList = coupon_data_free
602 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : ''; 614 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
603 let couponDataId = info && info.length > 0 ? info[0].id : {} 615 let couponDataId = info && info.length > 0 ? info[0].id : {}
604 // 根据券ID获取评价赠送的券详情 616 // 根据券ID获取评价赠送的券详情
605 if(couponDataId) this.getEvaluateFun(couponDataId) 617 if(couponDataId) this.getEvaluateFun(couponDataId)
606 } 618 }
607 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 619 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
608 - if (coupon && util.getType(coupon) == 'object') {  
609 - couponList.push({  
610 - id: coupon.id  
611 - });  
612 - }  
613 - if (coupon && util.getType(coupon) == 'array') {  
614 - if (coupon.length > 0) {  
615 - coupon.forEach(item => {  
616 - couponList.push({  
617 - id: item.id  
618 - })  
619 - })  
620 - }  
621 - } 620 + // 获取全部的优惠券(商家券、个人券、免费券、付费券)
  621 + couponList = this.addCoupons(coupon,couponList);
  622 + couponList = this.addCoupons(coupon_data_pay,couponList);
  623 + couponList = this.addCoupons(coupon_data_free,couponList);
622 // 根据券ID获取券详情 624 // 根据券ID获取券详情
623 - this.getActivityByIdFun(couponList, couponList.length) 625 + this.getActivityByIdFun(couponList)
624 // 根据充值ID获取充值详情 626 // 根据充值ID获取充值详情
625 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) { 627 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
626 this.getRechargeDetail(marketing.recharge_data.id) 628 this.getRechargeDetail(marketing.recharge_data.id)
@@ -697,13 +699,16 @@ Page({ @@ -697,13 +699,16 @@ Page({
697 }) 699 })
698 }, 700 },
699 // 点击商家有礼 701 // 点击商家有礼
700 - gotoSellerGift(){  
701 - let url = util.http_build_query({ 702 + gotoSellerGift(e){
  703 + this.couponModal.closeModal()
  704 + const form = e.currentTarget.dataset['form'];
  705 + let url = util.http_build_query({
702 id: this.data.detail.id, 706 id: this.data.detail.id,
703 - }, '/pages/reserve/sellerGift')  
704 - wx.navigateTo({  
705 - url  
706 - }) 707 + form
  708 + }, '/pages/reserve/sellerGift')
  709 + wx.navigateTo({
  710 + url
  711 + })
707 }, 712 },
708 // 再次预订 713 // 再次预订
709 secondbook() { 714 secondbook() {
@@ -857,34 +862,172 @@ Page({ @@ -857,34 +862,172 @@ Page({
857 }) 862 })
858 }, 863 },
859 // 根据券ID获取券详情 864 // 根据券ID获取券详情
860 - getActivityByIdFun(ids, length) {  
861 - let coupon_dataList = [];  
862 - ids.forEach(i => {  
863 - App.Activity.GetActivityById({  
864 - id: i.id  
865 - }).then(res => {  
866 - if (res.data.length > 0) {  
867 - let detail = res.data[0];  
868 - detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';  
869 - detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';  
870 - detail.use = detail.use ? util.determine(detail.use) : '';  
871 - if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {  
872 - let cash = detail.use.cash * 1;  
873 - let price = detail.price * 1;  
874 - detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
875 - }  
876 - coupon_dataList.push(detail);  
877 - if (length === coupon_dataList.length) {  
878 - coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})  
879 - console.log('邀请函--------------------优惠券',coupon_dataList);  
880 - this.setData({  
881 - coupon_dataList,  
882 - })  
883 - }  
884 - }  
885 - })  
886 - })  
887 - }, 865 + getActivityByIdFun(obj) {
  866 + App.Activity.GetActivityById({
  867 + id: obj.map(item => item.id).join(','),
  868 + }).then(res => {
  869 + if (res.data.length > 0) {
  870 + let list = res.data.filter(item => {
  871 + return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
  872 + })
  873 + list.forEach(detail => {
  874 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  875 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  876 + detail.arule = detail.arule ? util.determine(detail.arule) : '';
  877 + detail.use = detail.use ? util.determine(detail.use) : '';
  878 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  879 + let cash = detail.use.cash * 1;
  880 + let price = detail.price * 1;
  881 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  882 + }
  883 + let num = detail.receiveNum;
  884 + if (num > 0) {
  885 + detail.receiveNumText = ''
  886 + if (num >= 0 && num <= 100) {
  887 + detail.receiveNumText = num.toString();
  888 + } else if (num >= 101 && num <= 199) {
  889 + detail.receiveNumText = '100+';
  890 + } else if (num >= 200 && num <= 299) {
  891 + detail.receiveNumText = '200+';
  892 + } else {
  893 + detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
  894 + }
  895 + }
  896 + if (detail.exp_date && detail.exp_date.week_data) {
  897 + let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
  898 + let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
  899 + if (noon) noon = '午餐:' + noon
  900 + if (nig) nig = '晚餐:' + nig
  901 + detail.noonText = noon;
  902 + detail.nigText = nig;
  903 + }
  904 + })
  905 + let freeCoupons = list.filter(item => {
  906 + return item.is_type == '3'
  907 + })
  908 + // 免费券判断是否领取,弹框领取
  909 + if (freeCoupons.length > 0) {
  910 + let length = freeCoupons.length - 1
  911 + freeCoupons.forEach(i => {
  912 + this.getCoupon(i, freeCoupons[length].id, obj)
  913 + })
  914 + }
  915 + console.log('邀请函--------------------优惠券', list);
  916 + this.setData({
  917 + coupon_dataList: list,
  918 + })
  919 + }
  920 + })
  921 + },
  922 + // 获取所有的券并且展示
  923 + addCoupons(coupons, couponList) {
  924 + if (coupons && util.getType(coupons) == 'object') {
  925 + couponList.push({
  926 + id: coupon.id,
  927 + number: coupon.number
  928 + });
  929 + }
  930 + if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
  931 + coupons.forEach(item => {
  932 + couponList.push({
  933 + id: item.id,
  934 + number: item.number
  935 + });
  936 + });
  937 + }
  938 + return couponList
  939 + },
  940 + // 弹框领取免费券
  941 + setcouponFun(arr) {
  942 + let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
  943 + console.log('弹框领取免费券id', str);
  944 + App.Activity.SetActivityAsReserve({
  945 + aid: str,
  946 + rid: this.id,
  947 + }).then((json) => {
  948 + if (json.ret != 200) {
  949 + wx.showToast({
  950 + title: res.msg,
  951 + duration: 2000,
  952 + mask: true
  953 + })
  954 + }
  955 + })
  956 + },
  957 + // 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
  958 + getCoupon(item, id, obj) {
  959 + let couponArr = this.data.couponArr;
  960 + let totalPrice = this.data.totalPrice;
  961 + App.Activity.ActivityListByOpenid({
  962 + aid: item.id
  963 + }).then(res => {
  964 + if (res.ret == 200) {
  965 + if (res.data.length == 0) {
  966 + couponArr.push(item)
  967 + }
  968 + if (item.id == id && couponArr.length > 0) {
  969 + couponArr.forEach(item => {
  970 + let match = obj.find(b => b.id === item.id);
  971 + if (match) {
  972 + item.number = match.number;
  973 + }
  974 + });
  975 + totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
  976 + this.setcouponFun(couponArr)
  977 + this.couponModal.showModal()
  978 + }
  979 + console.log('未领取的券列表-----------', couponArr);
  980 + this.setData({
  981 + couponArr,
  982 + totalPrice
  983 + })
  984 + }
  985 + })
  986 + },
  987 + // 处理优惠券不可用日期数据
  988 + hasConsecutiveSelect(arr, type) {
  989 + let firstTitle = null;
  990 + let lastTitle = null;
  991 + let rArr = []
  992 + let num = 0
  993 + for (let i = 0; i < arr.length; i++) {
  994 + let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
  995 + if (str) {
  996 + rArr.push(arr[i].title)
  997 + num++
  998 + if (num == 1) {
  999 + firstTitle = arr[i].title
  1000 + }
  1001 + if (num >= 5) {
  1002 + lastTitle = arr[i].title
  1003 + }
  1004 + if (num >= 5 && i >= (arr.length - 1)) {
  1005 + let fi = rArr.findIndex((item) => {
  1006 + return item == firstTitle
  1007 + })
  1008 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1009 + num = 0
  1010 + }
  1011 + } else {
  1012 + if (num < 5) {
  1013 + num = 0
  1014 + firstTitle = null;
  1015 + lastTitle = null;
  1016 + } else {
  1017 + let fi = rArr.findIndex((item) => {
  1018 + return item == firstTitle
  1019 + })
  1020 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1021 + num = 0
  1022 + }
  1023 + }
  1024 + }
  1025 + return {
  1026 + rArr,
  1027 + lastTitle,
  1028 + firstTitle
  1029 + };
  1030 + },
888 /** 1031 /**
889 * 生命周期函数--监听页面隐藏 1032 * 生命周期函数--监听页面隐藏
890 */ 1033 */
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 /> 11 />
12 <image class="giftImg" 12 <image class="giftImg"
13 bindtap="gotoSellerGift" 13 bindtap="gotoSellerGift"
  14 + data-form="1"
14 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}" 15 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}"
15 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/> 16 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
16 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" /> 17 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
@@ -89,29 +90,49 @@ @@ -89,29 +90,49 @@
89 </button> 90 </button>
90 </view> 91 </view>
91 </view> 92 </view>
92 - <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}"> 93 + <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
93 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> 94 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
94 - <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"> 95 + <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">
95 <view class="preferentialItems"> 96 <view class="preferentialItems">
96 <view class="itemLeft"> 97 <view class="itemLeft">
97 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> 98 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
  99 + <view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
98 <view class="priceText" wx:if="{{item.price}}"> 100 <view class="priceText" wx:if="{{item.price}}">
99 - <view class="icons font40r">¥</view>{{item.price}} 101 + <view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
100 </view> 102 </view>
  103 + <view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
101 </view> 104 </view>
  105 + <view class="couponLine"></view>
102 <view class="itemRight"> 106 <view class="itemRight">
103 <view class="btns"> 107 <view class="btns">
104 <text class="font40r">{{item.aname}}</text> 108 <text class="font40r">{{item.aname}}</text>
105 - <view class="font24r orderingFood">  
106 - 抢购  
107 - </view> 109 + <block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
  110 + <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</view>
  111 + <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
  112 + 无限制{{item.desc?','+item.desc+'。':'。'}}
  113 + </view>
  114 + <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
  115 + 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
  116 + </view>
  117 + </block>
  118 + <block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
  119 + <view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
  120 + <view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
  121 + <view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
  122 + <view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
  123 + <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
  124 + <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
  125 + </block>
108 </view> 126 </view>
109 - <text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</text>  
110 - <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">  
111 - 无限制{{item.desc?','+item.desc+'。':'。'}} 127 + <view class="btnBox" wx:if="{{item.is_type == '3'}}" >
  128 + <view class="font24r orderingFood orderingFood1">已领取</view>
  129 + <view class="grantNum" wx:if="{{item.receiveNumText}}">
  130 + <view class="font24r">已被领取</view>
  131 + <view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
  132 + </view>
112 </view> 133 </view>
113 - <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">  
114 - 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}} 134 + <view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
  135 + 立即抢购
115 </view> 136 </view>
116 </view> 137 </view>
117 </view> 138 </view>
@@ -331,4 +352,24 @@ @@ -331,4 +352,24 @@
331 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button> 352 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
332 </view> 353 </view>
333 </view> 354 </view>
  355 +</my-modal>
  356 +<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
  357 + <view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
  358 + <image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
  359 + <view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
  360 + <view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
  361 + </view>
  362 + <view slot="modalContent">
  363 + <view class="couponBox">
  364 + <view wx:for="{{couponArr}}" class="couponItems">
  365 + <view class="couponNum font20r">×{{item.number}}</view>
  366 + <view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
  367 + <view class="couponLines"></view>
  368 + <view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
  369 + <view class="font28r couponCondition" wx:else>无门槛</view>
  370 + </view>
  371 + </view>
  372 + <view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
  373 + <view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
  374 + </view>
334 </my-modal> 375 </my-modal>
@@ -298,13 +298,104 @@ @@ -298,13 +298,104 @@
298 flex-shrink: 0; 298 flex-shrink: 0;
299 } 299 }
300 300
  301 +.preferentialCoupon .itemRight {
  302 + width: 74%;
  303 + display: flex;
  304 + align-items: center;
  305 +}
  306 +
  307 +.preferentialCoupon .itemLeft {
  308 + width: 26%;
  309 +}
  310 +
  311 +.preferentialCoupon .couponLine{
  312 + margin: 24rpx 0;
  313 + border-right: 2rpx dashed #f6231b;
  314 +}
  315 +
  316 +.preferentialCoupon .orderingFood {
  317 + padding: 0 20rpx;
  318 + color: #fff !important;
  319 + border: none !important;
  320 + text-align: center;
  321 + border-radius: 20rpx;
  322 + line-height: 44rpx;
  323 + height: 44rpx;
  324 + width: max-content;
  325 + flex-shrink: 0;
  326 + background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
  327 +}
  328 +.preferentialCoupon .icons {
  329 + color: #F6231B;
  330 + text-align: center;
  331 +}
  332 +
  333 +.preferentialCoupon .priceText {
  334 + display: flex;
  335 + align-items: baseline;
  336 + justify-content: center;
  337 + font-family: PingFang SC;
  338 + color: #F6231B;
  339 + font-weight: 600;
  340 + font-size: 48rpx;
  341 + margin-top: 6rpx;
  342 +}
  343 +
  344 +.preferentialCoupon .priceText text {
  345 + font-size: 48rpx;
  346 +}
  347 +
  348 +.preferentialCoupon .btns {
  349 + flex: 1;
  350 +}
  351 +.preferentialCoupon .btnBox {
  352 + display: flex;
  353 + flex-direction: column;
  354 +}
  355 +
  356 +.preferentialCoupon .grantNum {
  357 + display: flex;
  358 + flex-direction: column;
  359 + align-items: center;
  360 + color: #C36607;
  361 + margin-top: 10rpx;
  362 +}
  363 +
  364 +.preferentialCoupon .grantNum text {
  365 + color: #F6231B;
  366 + margin-right: 10rpx;
  367 +}
  368 +
  369 +.preferentialCoupon .btns text {
  370 + font-weight: 600;
  371 +}
  372 +
  373 +.preferentialCoupon .orderingFood1 {
  374 + border: 2rpx solid #fa4b20 !important;
  375 + background: transparent !important;
  376 + color: #fa4b20 !important;
  377 +}
  378 +
  379 +.preferentialCoupon .btns text {
  380 + color: #0B0805 !important;
  381 +}
  382 +
  383 +.preferentialCoupon .bottom {
  384 + color: #C36607 !important;
  385 +}
  386 +
  387 +.preferentialCoupon .nodate{
  388 + margin-left: 20rpx;
  389 +}
  390 +
301 .preferentialItems { 391 .preferentialItems {
302 display: flex; 392 display: flex;
303 - background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat;  
304 - background-size: 100% 100%; 393 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
305 margin-bottom: 20rpx; 394 margin-bottom: 20rpx;
306 min-height: 160rpx; 395 min-height: 160rpx;
307 padding-bottom: 10rpx; 396 padding-bottom: 10rpx;
  397 + border-radius: 20rpx;
  398 + border: 2rpx solid #ff7e06;
308 } 399 }
309 400
310 .rechargeItems { 401 .rechargeItems {
@@ -317,6 +408,7 @@ @@ -317,6 +408,7 @@
317 height: auto; 408 height: auto;
318 padding: 12rpx 0; 409 padding: 12rpx 0;
319 margin: 0 20rpx; 410 margin: 0 20rpx;
  411 + border: none;
320 } 412 }
321 413
322 .rechargeItems .orderingFood { 414 .rechargeItems .orderingFood {
@@ -358,6 +450,20 @@ @@ -358,6 +450,20 @@
358 top: 12rpx; 450 top: 12rpx;
359 } 451 }
360 452
  453 +.discountText1{
  454 + text-align: center;
  455 + color: #FD4D59;
  456 + border: 2rpx solid #FD4D59;
  457 + border-radius: 6rpx;
  458 + font-family: PingFang SC;
  459 + background: transparent;
  460 + width: max-content;
  461 + padding: 0 6rpx;
  462 + position: absolute;
  463 + left: 16rpx;
  464 + top: 12rpx;
  465 +}
  466 +
361 .famousChefBox .labelBox, 467 .famousChefBox .labelBox,
362 .stopBox .labelBox { 468 .stopBox .labelBox {
363 border-bottom: none; 469 border-bottom: none;
@@ -451,9 +557,7 @@ @@ -451,9 +557,7 @@
451 } 557 }
452 558
453 .priceText .icons { 559 .priceText .icons {
454 - font-family: 'Abel';  
455 color: #FD4D59; 560 color: #FD4D59;
456 - font-size: 40rpx;  
457 } 561 }
458 562
459 .itemRight { 563 .itemRight {
@@ -467,6 +571,7 @@ @@ -467,6 +571,7 @@
467 display: flex; 571 display: flex;
468 justify-content: space-between; 572 justify-content: space-between;
469 align-items: baseline; 573 align-items: baseline;
  574 + flex-direction: column;
470 } 575 }
471 576
472 .btns text { 577 .btns text {
@@ -727,6 +832,145 @@ @@ -727,6 +832,145 @@
727 box-sizing: border-box; 832 box-sizing: border-box;
728 } 833 }
729 834
  835 +#couponModal .titleModal {
  836 + margin-top: 30%;
  837 + position: relative;
  838 +}
  839 +
  840 +#couponModal .titleModal2 {
  841 + margin-top: 80%;
  842 +}
  843 +
  844 +#couponModal .titleModal3 {
  845 + margin-top: 60%;
  846 +}
  847 +
  848 +#couponModal .titleModal4 {
  849 + margin-top: 30%;
  850 +}
  851 +
  852 +#couponModal .mymodal {
  853 + background: rgba(0, 0, 0, 0.8);
  854 + width: 100% !important;
  855 + top: 0 !important;
  856 + height: auto !important;
  857 + z-index: 300;
  858 +}
  859 +
  860 +.nameInfo {
  861 + font-family: PingFang SC;
  862 + font-weight: 400;
  863 + font-size: 52rpx;
  864 + line-height: 56rpx;
  865 + color: #fff;
  866 + margin-bottom: 40rpx;
  867 + padding-top: 60rpx;
  868 +}
  869 +
  870 +.couponTotal {
  871 + color: #dfdfdf;
  872 + font-family: PingFang SC;
  873 + font-weight: 400;
  874 + font-size: 40rpx;
  875 + line-height: 48rpx;
  876 + margin-bottom: 40rpx;
  877 + display: flex;
  878 + align-items: center;
  879 + justify-content: center;
  880 +}
  881 +
  882 +.couponTotal text {
  883 + color: #ffc806;
  884 + font-weight: 600;
  885 + font-size: 80rpx;
  886 + margin: 0 14rpx;
  887 +}
  888 +
  889 +.couponBox {
  890 + width: 80%;
  891 + margin: 0 auto;
  892 + display: flex;
  893 + flex-wrap: wrap;
  894 + justify-content: space-evenly;
  895 +}
  896 +
  897 +.couponItems {
  898 + width: 46%;
  899 + margin-bottom: 24rpx;
  900 + padding-bottom: 52rpx;
  901 + border-radius: 20rpx;
  902 + border: 2rpx solid #ff7e06;
  903 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
  904 +}
  905 +
  906 +.couponNum {
  907 + background: #727272;
  908 + border-radius: 50%;
  909 + color: #fff;
  910 + width: 40rpx;
  911 + height: 40rpx;
  912 + display: flex;
  913 + align-items: center;
  914 + justify-content: center;
  915 + margin: 8rpx 0 0 8rpx;
  916 +}
  917 +
  918 +.couponPrice {
  919 + display: flex;
  920 + align-items: center;
  921 + justify-content: center;
  922 + color: #F6231B;
  923 + font-weight: 500;
  924 +}
  925 +
  926 +.couponLines{
  927 + width: 80%;
  928 + margin: 0 auto;
  929 + height: 2rpx;
  930 + border-bottom: 2rpx dashed #F6231B;
  931 +}
  932 +
  933 +.couponPrice text {
  934 + margin-left: 4rpx;
  935 + font-size: 76rpx;
  936 + font-weight: 700;
  937 +}
  938 +
  939 +.couponCondition {
  940 + color: #C36607;
  941 + display: flex;
  942 + align-items: center;
  943 + justify-content: center;
  944 + padding-top: 24rpx;
  945 +}
  946 +
  947 +.couponBtn {
  948 + width: 80%;
  949 + margin: 0 auto;
  950 + border-radius: 42rpx;
  951 + background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
  952 + font-weight: 400;
  953 + color: #fff;
  954 + text-align: center;
  955 + border: 4rpx solid #fff;
  956 + padding: 12rpx 0;
  957 + margin: 16rpx auto 20rpx auto;
  958 +}
  959 +
  960 +.couponText {
  961 + color: #fff;
  962 + text-decoration: underline;
  963 + text-align: center;
  964 +}
  965 +
  966 +.closeImg {
  967 + width: 60rpx;
  968 + height: 60rpx;
  969 + position: absolute;
  970 + right: 0;
  971 + top: 0;
  972 +}
  973 +
730 /* 深中国红 */ 974 /* 深中国红 */
731 .crimson, 975 .crimson,
732 .crimson .positioningBox { 976 .crimson .positioningBox {
@@ -1017,14 +1261,6 @@ @@ -1017,14 +1261,6 @@
1017 color: #578C69; 1261 color: #578C69;
1018 } 1262 }
1019 1263
1020 -.pearlWhite .preferentialItems {  
1021 - background: url(https://nosqn.colorcun.com/certificateWhiteBj1.png) no-repeat;  
1022 - background-size: 100% 100%;  
1023 - margin-bottom: 20rpx;  
1024 - min-height: 160rpx;  
1025 - padding-bottom: 10rpx;  
1026 -}  
1027 -  
1028 .pearlWhite .rechargeItems { 1264 .pearlWhite .rechargeItems {
1029 background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat; 1265 background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat;
1030 background-size: 100% 100%; 1266 background-size: 100% 100%;
@@ -1080,12 +1316,6 @@ @@ -1080,12 +1316,6 @@
1080 border: none; 1316 border: none;
1081 } 1317 }
1082 1318
1083 -.pearlWhite .discountText {  
1084 - background: transparent;  
1085 - border: 2rpx solid #FD4D59;  
1086 - color: #FD4D59;  
1087 -}  
1088 -  
1089 .toastBox { 1319 .toastBox {
1090 width: fit-content; 1320 width: fit-content;
1091 position: fixed; 1321 position: fixed;
@@ -66,6 +66,7 @@ Page({ @@ -66,6 +66,7 @@ Page({
66 isMoreBtn:'',//再次预订按钮 66 isMoreBtn:'',//再次预订按钮
67 isPaymenBtn:'',//支付定金按钮 67 isPaymenBtn:'',//支付定金按钮
68 isShareItem:'',//转发客人按钮 68 isShareItem:'',//转发客人按钮
  69 + couponArr: [],//待领取的优惠券列表
69 }, 70 },
70 tablestr: '', 71 tablestr: '',
71 urlsValue: [], 72 urlsValue: [],
@@ -75,6 +76,7 @@ Page({ @@ -75,6 +76,7 @@ Page({
75 timers: null, // 动画定时器 76 timers: null, // 动画定时器
76 n: 0, 77 n: 0,
77 modal:'', 78 modal:'',
  79 + couponModal: '',
78 /** 80 /**
79 * 生命周期函数--监听页面加载 81 * 生命周期函数--监听页面加载
80 */ 82 */
@@ -102,6 +104,7 @@ Page({ @@ -102,6 +104,7 @@ Page({
102 wx.onUserCaptureScreen((res)=> { 104 wx.onUserCaptureScreen((res)=> {
103 this.showModal() 105 this.showModal()
104 }) 106 })
  107 + this.couponModal = this.selectComponent("#couponModal");
105 }, 108 },
106 // 打开截屏弹框 109 // 打开截屏弹框
107 showModal() { 110 showModal() {
@@ -111,6 +114,10 @@ Page({ @@ -111,6 +114,10 @@ Page({
111 closeModal() { 114 closeModal() {
112 this.modal.closeModal() 115 this.modal.closeModal()
113 }, 116 },
  117 + // 关闭优惠券弹框
  118 + closeCouponModal() {
  119 + this.couponModal.closeModal()
  120 + },
114 // 页面滚动事件 121 // 页面滚动事件
115 onPageScroll: function (event) { 122 onPageScroll: function (event) {
116 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离 123 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
@@ -456,9 +463,10 @@ Page({ @@ -456,9 +463,10 @@ Page({
456 uid 463 uid
457 }).then((json) => { 464 }).then((json) => {
458 if (json.ret == 200) { 465 if (json.ret == 200) {
459 - console.log('staffinfostaffinfostaffinfo', json.data) 466 + console.log('客户经理获取基本信息------', json.data)
460 this.setData({ 467 this.setData({
461 - staffinfo: json.data 468 + staffinfo: json.data,
  469 + couponArr:[],
462 }) 470 })
463 this.getSellerTemplateConfFun(sid); 471 this.getSellerTemplateConfFun(sid);
464 } 472 }
@@ -579,7 +587,7 @@ Page({ @@ -579,7 +587,7 @@ Page({
579 let data = res.data 587 let data = res.data
580 console.log('data', data); 588 console.log('data', data);
581 let couponList = [] 589 let couponList = []
582 - let themeColor, StyleType, titleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store; 590 + let themeColor, StyleType, titleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
583 chef = util.determine(data.chef); 591 chef = util.determine(data.chef);
584 reserve = util.determine(data.reserve); 592 reserve = util.determine(data.reserve);
585 marketing = util.determine(data.marketing); 593 marketing = util.determine(data.marketing);
@@ -598,29 +606,23 @@ Page({ @@ -598,29 +606,23 @@ Page({
598 if (marketing) { 606 if (marketing) {
599 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : ''; 607 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
600 is_comments = marketing.is_comments ? marketing.is_comments : ''; 608 is_comments = marketing.is_comments ? marketing.is_comments : '';
601 - coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : ''; 609 + coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
  610 + coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
  611 + marketing.coupon_data_payList = coupon_data_pay
  612 + coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
  613 + marketing.coupon_data_freeList = coupon_data_free
602 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : ''; 614 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
603 let couponDataId = info && info.length > 0 ? info[0].id : {} 615 let couponDataId = info && info.length > 0 ? info[0].id : {}
604 // 根据券ID获取评价赠送的券详情 616 // 根据券ID获取评价赠送的券详情
605 if(couponDataId) this.getEvaluateFun(couponDataId) 617 if(couponDataId) this.getEvaluateFun(couponDataId)
606 } 618 }
607 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 619 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
608 - if (coupon && util.getType(coupon) == 'object') {  
609 - couponList.push({  
610 - id: coupon.id  
611 - });  
612 - }  
613 - if (coupon && util.getType(coupon) == 'array') {  
614 - if (coupon.length > 0) {  
615 - coupon.forEach(item => {  
616 - couponList.push({  
617 - id: item.id  
618 - })  
619 - })  
620 - }  
621 - } 620 + // 获取全部的优惠券(商家券、个人券、免费券、付费券)
  621 + couponList = this.addCoupons(coupon,couponList);
  622 + couponList = this.addCoupons(coupon_data_pay,couponList);
  623 + couponList = this.addCoupons(coupon_data_free,couponList);
622 // 根据券ID获取券详情 624 // 根据券ID获取券详情
623 - this.getActivityByIdFun(couponList, couponList.length) 625 + this.getActivityByIdFun(couponList)
624 // 根据充值ID获取充值详情 626 // 根据充值ID获取充值详情
625 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) { 627 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
626 this.getRechargeDetail(marketing.recharge_data.id) 628 this.getRechargeDetail(marketing.recharge_data.id)
@@ -697,13 +699,16 @@ Page({ @@ -697,13 +699,16 @@ Page({
697 }) 699 })
698 }, 700 },
699 // 点击商家有礼 701 // 点击商家有礼
700 - gotoSellerGift(){  
701 - let url = util.http_build_query({ 702 + gotoSellerGift(e){
  703 + this.couponModal.closeModal()
  704 + const form = e.currentTarget.dataset['form'];
  705 + let url = util.http_build_query({
702 id: this.data.detail.id, 706 id: this.data.detail.id,
703 - }, '/pages/reserve/sellerGift')  
704 - wx.navigateTo({  
705 - url  
706 - }) 707 + form
  708 + }, '/pages/reserve/sellerGift')
  709 + wx.navigateTo({
  710 + url
  711 + })
707 }, 712 },
708 // 再次预订 713 // 再次预订
709 secondbook() { 714 secondbook() {
@@ -857,34 +862,172 @@ Page({ @@ -857,34 +862,172 @@ Page({
857 }) 862 })
858 }, 863 },
859 // 根据券ID获取券详情 864 // 根据券ID获取券详情
860 - getActivityByIdFun(ids, length) {  
861 - let coupon_dataList = [];  
862 - ids.forEach(i => {  
863 - App.Activity.GetActivityById({  
864 - id: i.id  
865 - }).then(res => {  
866 - if (res.data.length > 0) {  
867 - let detail = res.data[0];  
868 - detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';  
869 - detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';  
870 - detail.use = detail.use ? util.determine(detail.use) : '';  
871 - if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {  
872 - let cash = detail.use.cash * 1;  
873 - let price = detail.price * 1;  
874 - detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
875 - }  
876 - coupon_dataList.push(detail);  
877 - if (length === coupon_dataList.length) {  
878 - coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})  
879 - console.log('邀请函--------------------优惠券',coupon_dataList);  
880 - this.setData({  
881 - coupon_dataList,  
882 - })  
883 - }  
884 - }  
885 - })  
886 - })  
887 - }, 865 + getActivityByIdFun(obj) {
  866 + App.Activity.GetActivityById({
  867 + id: obj.map(item => item.id).join(','),
  868 + }).then(res => {
  869 + if (res.data.length > 0) {
  870 + let list = res.data.filter(item => {
  871 + return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
  872 + })
  873 + list.forEach(detail => {
  874 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  875 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  876 + detail.arule = detail.arule ? util.determine(detail.arule) : '';
  877 + detail.use = detail.use ? util.determine(detail.use) : '';
  878 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  879 + let cash = detail.use.cash * 1;
  880 + let price = detail.price * 1;
  881 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  882 + }
  883 + let num = detail.receiveNum;
  884 + if (num > 0) {
  885 + detail.receiveNumText = ''
  886 + if (num >= 0 && num <= 100) {
  887 + detail.receiveNumText = num.toString();
  888 + } else if (num >= 101 && num <= 199) {
  889 + detail.receiveNumText = '100+';
  890 + } else if (num >= 200 && num <= 299) {
  891 + detail.receiveNumText = '200+';
  892 + } else {
  893 + detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
  894 + }
  895 + }
  896 + if (detail.exp_date && detail.exp_date.week_data) {
  897 + let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
  898 + let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
  899 + if (noon) noon = '午餐:' + noon
  900 + if (nig) nig = '晚餐:' + nig
  901 + detail.noonText = noon;
  902 + detail.nigText = nig;
  903 + }
  904 + })
  905 + let freeCoupons = list.filter(item => {
  906 + return item.is_type == '3'
  907 + })
  908 + // 免费券判断是否领取,弹框领取
  909 + if (freeCoupons.length > 0) {
  910 + let length = freeCoupons.length - 1
  911 + freeCoupons.forEach(i => {
  912 + this.getCoupon(i, freeCoupons[length].id, obj)
  913 + })
  914 + }
  915 + console.log('邀请函--------------------优惠券', list);
  916 + this.setData({
  917 + coupon_dataList: list,
  918 + })
  919 + }
  920 + })
  921 + },
  922 + // 获取所有的券并且展示
  923 + addCoupons(coupons, couponList) {
  924 + if (coupons && util.getType(coupons) == 'object') {
  925 + couponList.push({
  926 + id: coupon.id,
  927 + number: coupon.number
  928 + });
  929 + }
  930 + if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
  931 + coupons.forEach(item => {
  932 + couponList.push({
  933 + id: item.id,
  934 + number: item.number
  935 + });
  936 + });
  937 + }
  938 + return couponList
  939 + },
  940 + // 弹框领取免费券
  941 + setcouponFun(arr) {
  942 + let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
  943 + console.log('弹框领取免费券id', str);
  944 + App.Activity.SetActivityAsReserve({
  945 + aid: str,
  946 + rid: this.id,
  947 + }).then((json) => {
  948 + if (json.ret != 200) {
  949 + wx.showToast({
  950 + title: res.msg,
  951 + duration: 2000,
  952 + mask: true
  953 + })
  954 + }
  955 + })
  956 + },
  957 + // 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
  958 + getCoupon(item, id, obj) {
  959 + let couponArr = this.data.couponArr;
  960 + let totalPrice = this.data.totalPrice;
  961 + App.Activity.ActivityListByOpenid({
  962 + aid: item.id
  963 + }).then(res => {
  964 + if (res.ret == 200) {
  965 + if (res.data.length == 0) {
  966 + couponArr.push(item)
  967 + }
  968 + if (item.id == id && couponArr.length > 0) {
  969 + couponArr.forEach(item => {
  970 + let match = obj.find(b => b.id === item.id);
  971 + if (match) {
  972 + item.number = match.number;
  973 + }
  974 + });
  975 + totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
  976 + this.setcouponFun(couponArr)
  977 + this.couponModal.showModal()
  978 + }
  979 + console.log('未领取的券列表-----------', couponArr);
  980 + this.setData({
  981 + couponArr,
  982 + totalPrice
  983 + })
  984 + }
  985 + })
  986 + },
  987 + // 处理优惠券不可用日期数据
  988 + hasConsecutiveSelect(arr, type) {
  989 + let firstTitle = null;
  990 + let lastTitle = null;
  991 + let rArr = []
  992 + let num = 0
  993 + for (let i = 0; i < arr.length; i++) {
  994 + let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
  995 + if (str) {
  996 + rArr.push(arr[i].title)
  997 + num++
  998 + if (num == 1) {
  999 + firstTitle = arr[i].title
  1000 + }
  1001 + if (num >= 5) {
  1002 + lastTitle = arr[i].title
  1003 + }
  1004 + if (num >= 5 && i >= (arr.length - 1)) {
  1005 + let fi = rArr.findIndex((item) => {
  1006 + return item == firstTitle
  1007 + })
  1008 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1009 + num = 0
  1010 + }
  1011 + } else {
  1012 + if (num < 5) {
  1013 + num = 0
  1014 + firstTitle = null;
  1015 + lastTitle = null;
  1016 + } else {
  1017 + let fi = rArr.findIndex((item) => {
  1018 + return item == firstTitle
  1019 + })
  1020 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1021 + num = 0
  1022 + }
  1023 + }
  1024 + }
  1025 + return {
  1026 + rArr,
  1027 + lastTitle,
  1028 + firstTitle
  1029 + };
  1030 + },
888 /** 1031 /**
889 * 生命周期函数--监听页面隐藏 1032 * 生命周期函数--监听页面隐藏
890 */ 1033 */
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 /> 10 />
11 <image class="giftImg" 11 <image class="giftImg"
12 bindtap="gotoSellerGift" 12 bindtap="gotoSellerGift"
  13 + data-form="1"
13 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}" 14 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}"
14 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/> 15 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
15 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" /> 16 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
@@ -72,29 +73,49 @@ @@ -72,29 +73,49 @@
72 导航到店 73 导航到店
73 </button> 74 </button>
74 </view> 75 </view>
75 - <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}"> 76 + <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
76 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> 77 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
77 - <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"> 78 + <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">
78 <view class="preferentialItems"> 79 <view class="preferentialItems">
79 <view class="itemLeft"> 80 <view class="itemLeft">
80 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> 81 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
  82 + <view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
81 <view class="priceText" wx:if="{{item.price}}"> 83 <view class="priceText" wx:if="{{item.price}}">
82 - <view class="icons font40r">¥</view>{{item.price}} 84 + <view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
83 </view> 85 </view>
  86 + <view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
84 </view> 87 </view>
  88 + <view class="couponLine"></view>
85 <view class="itemRight"> 89 <view class="itemRight">
86 <view class="btns"> 90 <view class="btns">
87 <text class="font40r">{{item.aname}}</text> 91 <text class="font40r">{{item.aname}}</text>
88 - <view class="font24r orderingFood">  
89 - 抢购  
90 - </view> 92 + <block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
  93 + <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</view>
  94 + <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
  95 + 无限制{{item.desc?','+item.desc+'。':'。'}}
  96 + </view>
  97 + <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
  98 + 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
  99 + </view>
  100 + </block>
  101 + <block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
  102 + <view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
  103 + <view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
  104 + <view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
  105 + <view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
  106 + <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
  107 + <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
  108 + </block>
91 </view> 109 </view>
92 - <text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</text>  
93 - <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">  
94 - 无限制{{item.desc?','+item.desc+'。':'。'}} 110 + <view class="btnBox" wx:if="{{item.is_type == '3'}}" >
  111 + <view class="font24r orderingFood orderingFood1">已领取</view>
  112 + <view class="grantNum" wx:if="{{item.receiveNumText}}">
  113 + <view class="font24r">已被领取</view>
  114 + <view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
  115 + </view>
95 </view> 116 </view>
96 - <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">  
97 - 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}} 117 + <view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
  118 + 立即抢购
98 </view> 119 </view>
99 </view> 120 </view>
100 </view> 121 </view>
@@ -314,4 +335,24 @@ @@ -314,4 +335,24 @@
314 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button> 335 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
315 </view> 336 </view>
316 </view> 337 </view>
  338 +</my-modal>
  339 +<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
  340 + <view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
  341 + <image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
  342 + <view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
  343 + <view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
  344 + </view>
  345 + <view slot="modalContent">
  346 + <view class="couponBox">
  347 + <view wx:for="{{couponArr}}" class="couponItems">
  348 + <view class="couponNum font20r">×{{item.number}}</view>
  349 + <view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
  350 + <view class="couponLines"></view>
  351 + <view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
  352 + <view class="font28r couponCondition" wx:else>无门槛</view>
  353 + </view>
  354 + </view>
  355 + <view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
  356 + <view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
  357 + </view>
317 </my-modal> 358 </my-modal>
@@ -288,13 +288,104 @@ @@ -288,13 +288,104 @@
288 flex-shrink: 0; 288 flex-shrink: 0;
289 } 289 }
290 290
  291 +.preferentialCoupon .itemRight {
  292 + width: 74%;
  293 + display: flex;
  294 + align-items: center;
  295 +}
  296 +
  297 +.preferentialCoupon .itemLeft {
  298 + width: 26%;
  299 +}
  300 +
  301 +.preferentialCoupon .couponLine{
  302 + margin: 24rpx 0;
  303 + border-right: 2rpx dashed #f6231b;
  304 +}
  305 +
  306 +.preferentialCoupon .orderingFood {
  307 + padding: 0 20rpx;
  308 + color: #fff !important;
  309 + border: none !important;
  310 + text-align: center;
  311 + border-radius: 20rpx;
  312 + line-height: 44rpx;
  313 + height: 44rpx;
  314 + width: max-content;
  315 + flex-shrink: 0;
  316 + background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
  317 +}
  318 +.preferentialCoupon .icons {
  319 + color: #F6231B;
  320 + text-align: center;
  321 +}
  322 +
  323 +.preferentialCoupon .priceText {
  324 + display: flex;
  325 + align-items: baseline;
  326 + justify-content: center;
  327 + font-family: PingFang SC;
  328 + color: #F6231B;
  329 + font-weight: 600;
  330 + font-size: 48rpx;
  331 + margin-top: 6rpx;
  332 +}
  333 +
  334 +.preferentialCoupon .priceText text {
  335 + font-size: 48rpx;
  336 +}
  337 +
  338 +.preferentialCoupon .btns {
  339 + flex: 1;
  340 +}
  341 +.preferentialCoupon .btnBox {
  342 + display: flex;
  343 + flex-direction: column;
  344 +}
  345 +
  346 +.preferentialCoupon .grantNum {
  347 + display: flex;
  348 + flex-direction: column;
  349 + align-items: center;
  350 + color: #C36607;
  351 + margin-top: 10rpx;
  352 +}
  353 +
  354 +.preferentialCoupon .grantNum text {
  355 + color: #F6231B;
  356 + margin-right: 10rpx;
  357 +}
  358 +
  359 +.preferentialCoupon .btns text {
  360 + font-weight: 600;
  361 +}
  362 +
  363 +.preferentialCoupon .orderingFood1 {
  364 + border: 2rpx solid #fa4b20 !important;
  365 + background: transparent !important;
  366 + color: #fa4b20 !important;
  367 +}
  368 +
  369 +.preferentialCoupon .btns text {
  370 + color: #0B0805 !important;
  371 +}
  372 +
  373 +.preferentialCoupon .bottom {
  374 + color: #C36607 !important;
  375 +}
  376 +
  377 +.preferentialCoupon .nodate{
  378 + margin-left: 20rpx;
  379 +}
  380 +
291 .preferentialItems { 381 .preferentialItems {
292 display: flex; 382 display: flex;
293 - background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat;  
294 - background-size: 100% 100%; 383 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
295 margin-bottom: 20rpx; 384 margin-bottom: 20rpx;
296 min-height: 160rpx; 385 min-height: 160rpx;
297 padding-bottom: 10rpx; 386 padding-bottom: 10rpx;
  387 + border-radius: 20rpx;
  388 + border: 2rpx solid #ff7e06;
298 } 389 }
299 390
300 .rechargeItems { 391 .rechargeItems {
@@ -307,6 +398,7 @@ @@ -307,6 +398,7 @@
307 height: auto; 398 height: auto;
308 padding: 12rpx 0; 399 padding: 12rpx 0;
309 margin: 0 20rpx; 400 margin: 0 20rpx;
  401 + border: none;
310 } 402 }
311 403
312 .rechargeItems .orderingFood { 404 .rechargeItems .orderingFood {
@@ -348,6 +440,20 @@ @@ -348,6 +440,20 @@
348 top: 12rpx; 440 top: 12rpx;
349 } 441 }
350 442
  443 +.discountText1{
  444 + text-align: center;
  445 + color: #FD4D59;
  446 + border: 2rpx solid #FD4D59;
  447 + border-radius: 6rpx;
  448 + font-family: PingFang SC;
  449 + background: transparent;
  450 + width: max-content;
  451 + padding: 0 6rpx;
  452 + position: absolute;
  453 + left: 16rpx;
  454 + top: 12rpx;
  455 +}
  456 +
351 .famousChefBox .labelBox, 457 .famousChefBox .labelBox,
352 .stopBox .labelBox { 458 .stopBox .labelBox {
353 border-bottom: none; 459 border-bottom: none;
@@ -441,9 +547,7 @@ @@ -441,9 +547,7 @@
441 } 547 }
442 548
443 .priceText .icons { 549 .priceText .icons {
444 - font-family: 'Abel';  
445 color: #FD4D59; 550 color: #FD4D59;
446 - font-size: 40rpx;  
447 } 551 }
448 552
449 .itemRight { 553 .itemRight {
@@ -457,6 +561,7 @@ @@ -457,6 +561,7 @@
457 display: flex; 561 display: flex;
458 justify-content: space-between; 562 justify-content: space-between;
459 align-items: baseline; 563 align-items: baseline;
  564 + flex-direction: column;
460 } 565 }
461 566
462 .btns text { 567 .btns text {
@@ -717,6 +822,145 @@ @@ -717,6 +822,145 @@
717 box-sizing: border-box; 822 box-sizing: border-box;
718 } 823 }
719 824
  825 +#couponModal .titleModal {
  826 + margin-top: 30%;
  827 + position: relative;
  828 +}
  829 +
  830 +#couponModal .titleModal2 {
  831 + margin-top: 80%;
  832 +}
  833 +
  834 +#couponModal .titleModal3 {
  835 + margin-top: 60%;
  836 +}
  837 +
  838 +#couponModal .titleModal4 {
  839 + margin-top: 30%;
  840 +}
  841 +
  842 +#couponModal .mymodal {
  843 + background: rgba(0, 0, 0, 0.8);
  844 + width: 100% !important;
  845 + top: 0 !important;
  846 + height: auto !important;
  847 + z-index: 300;
  848 +}
  849 +
  850 +.nameInfo {
  851 + font-family: PingFang SC;
  852 + font-weight: 400;
  853 + font-size: 52rpx;
  854 + line-height: 56rpx;
  855 + color: #fff;
  856 + margin-bottom: 40rpx;
  857 + padding-top: 60rpx;
  858 +}
  859 +
  860 +.couponTotal {
  861 + color: #dfdfdf;
  862 + font-family: PingFang SC;
  863 + font-weight: 400;
  864 + font-size: 40rpx;
  865 + line-height: 48rpx;
  866 + margin-bottom: 40rpx;
  867 + display: flex;
  868 + align-items: center;
  869 + justify-content: center;
  870 +}
  871 +
  872 +.couponTotal text {
  873 + color: #ffc806;
  874 + font-weight: 600;
  875 + font-size: 80rpx;
  876 + margin: 0 14rpx;
  877 +}
  878 +
  879 +.couponBox {
  880 + width: 80%;
  881 + margin: 0 auto;
  882 + display: flex;
  883 + flex-wrap: wrap;
  884 + justify-content: space-evenly;
  885 +}
  886 +
  887 +.couponItems {
  888 + width: 46%;
  889 + margin-bottom: 24rpx;
  890 + padding-bottom: 52rpx;
  891 + border-radius: 20rpx;
  892 + border: 2rpx solid #ff7e06;
  893 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
  894 +}
  895 +
  896 +.couponNum {
  897 + background: #727272;
  898 + border-radius: 50%;
  899 + color: #fff;
  900 + width: 40rpx;
  901 + height: 40rpx;
  902 + display: flex;
  903 + align-items: center;
  904 + justify-content: center;
  905 + margin: 8rpx 0 0 8rpx;
  906 +}
  907 +
  908 +.couponPrice {
  909 + display: flex;
  910 + align-items: center;
  911 + justify-content: center;
  912 + color: #F6231B;
  913 + font-weight: 500;
  914 +}
  915 +
  916 +.couponLines{
  917 + width: 80%;
  918 + margin: 0 auto;
  919 + height: 2rpx;
  920 + border-bottom: 2rpx dashed #F6231B;
  921 +}
  922 +
  923 +.couponPrice text {
  924 + margin-left: 4rpx;
  925 + font-size: 76rpx;
  926 + font-weight: 700;
  927 +}
  928 +
  929 +.couponCondition {
  930 + color: #C36607;
  931 + display: flex;
  932 + align-items: center;
  933 + justify-content: center;
  934 + padding-top: 24rpx;
  935 +}
  936 +
  937 +.couponBtn {
  938 + width: 80%;
  939 + margin: 0 auto;
  940 + border-radius: 42rpx;
  941 + background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
  942 + font-weight: 400;
  943 + color: #fff;
  944 + text-align: center;
  945 + border: 4rpx solid #fff;
  946 + padding: 12rpx 0;
  947 + margin: 16rpx auto 20rpx auto;
  948 +}
  949 +
  950 +.couponText {
  951 + color: #fff;
  952 + text-decoration: underline;
  953 + text-align: center;
  954 +}
  955 +
  956 +.closeImg {
  957 + width: 60rpx;
  958 + height: 60rpx;
  959 + position: absolute;
  960 + right: 0;
  961 + top: 0;
  962 +}
  963 +
720 /* 深中国红 */ 964 /* 深中国红 */
721 .crimson, 965 .crimson,
722 .crimson .positioningBox { 966 .crimson .positioningBox {
@@ -1050,14 +1294,6 @@ @@ -1050,14 +1294,6 @@
1050 color: #578C69; 1294 color: #578C69;
1051 } 1295 }
1052 1296
1053 -.pearlWhite .preferentialItems {  
1054 - background: url(https://nosqn.colorcun.com/certificateWhiteBj1.png) no-repeat;  
1055 - background-size: 100% 100%;  
1056 - margin-bottom: 20rpx;  
1057 - min-height: 160rpx;  
1058 - padding-bottom: 10rpx;  
1059 -}  
1060 -  
1061 .pearlWhite .rechargeItems { 1297 .pearlWhite .rechargeItems {
1062 background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat; 1298 background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat;
1063 background-size: 100% 100%; 1299 background-size: 100% 100%;
@@ -1125,12 +1361,6 @@ @@ -1125,12 +1361,6 @@
1125 border: none; 1361 border: none;
1126 } 1362 }
1127 1363
1128 -.pearlWhite .discountText {  
1129 - background: transparent;  
1130 - border: 2rpx solid #FD4D59;  
1131 - color: #FD4D59;  
1132 -}  
1133 -  
1134 .toastBox { 1364 .toastBox {
1135 width: fit-content; 1365 width: fit-content;
1136 position: fixed; 1366 position: fixed;
@@ -65,6 +65,7 @@ Page({ @@ -65,6 +65,7 @@ Page({
65 isMoreBtn:'',//再次预订按钮 65 isMoreBtn:'',//再次预订按钮
66 isPaymenBtn:'',//支付定金按钮 66 isPaymenBtn:'',//支付定金按钮
67 isShareItem:'',//转发客人按钮 67 isShareItem:'',//转发客人按钮
  68 + couponArr: [],//待领取的优惠券列表
68 }, 69 },
69 tablestr: '', 70 tablestr: '',
70 urlsValue: [], 71 urlsValue: [],
@@ -74,6 +75,7 @@ Page({ @@ -74,6 +75,7 @@ Page({
74 timers: null, // 动画定时器 75 timers: null, // 动画定时器
75 n: 0, 76 n: 0,
76 modal:'', 77 modal:'',
  78 + couponModal: '',
77 /** 79 /**
78 * 生命周期函数--监听页面加载 80 * 生命周期函数--监听页面加载
79 */ 81 */
@@ -101,6 +103,7 @@ Page({ @@ -101,6 +103,7 @@ Page({
101 wx.onUserCaptureScreen((res)=> { 103 wx.onUserCaptureScreen((res)=> {
102 this.showModal() 104 this.showModal()
103 }) 105 })
  106 + this.couponModal = this.selectComponent("#couponModal");
104 }, 107 },
105 // 打开截屏弹框 108 // 打开截屏弹框
106 showModal() { 109 showModal() {
@@ -110,6 +113,10 @@ Page({ @@ -110,6 +113,10 @@ Page({
110 closeModal() { 113 closeModal() {
111 this.modal.closeModal() 114 this.modal.closeModal()
112 }, 115 },
  116 + // 关闭优惠券弹框
  117 + closeCouponModal() {
  118 + this.couponModal.closeModal()
  119 + },
113 // 页面滚动事件 120 // 页面滚动事件
114 onPageScroll: function (event) { 121 onPageScroll: function (event) {
115 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离 122 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
@@ -455,9 +462,10 @@ Page({ @@ -455,9 +462,10 @@ Page({
455 uid 462 uid
456 }).then((json) => { 463 }).then((json) => {
457 if (json.ret == 200) { 464 if (json.ret == 200) {
458 - console.log('staffinfostaffinfostaffinfo', json.data) 465 + console.log('客户经理获取基本信息------', json.data)
459 this.setData({ 466 this.setData({
460 - staffinfo: json.data 467 + staffinfo: json.data,
  468 + couponArr:[],
461 }) 469 })
462 this.getSellerTemplateConfFun(sid); 470 this.getSellerTemplateConfFun(sid);
463 } 471 }
@@ -578,7 +586,7 @@ Page({ @@ -578,7 +586,7 @@ Page({
578 let data = res.data 586 let data = res.data
579 console.log('data', data); 587 console.log('data', data);
580 let couponList = [] 588 let couponList = []
581 - let themeColor, StyleType, titleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store; 589 + let themeColor, StyleType, titleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
582 chef = util.determine(data.chef); 590 chef = util.determine(data.chef);
583 reserve = util.determine(data.reserve); 591 reserve = util.determine(data.reserve);
584 marketing = util.determine(data.marketing); 592 marketing = util.determine(data.marketing);
@@ -597,29 +605,23 @@ Page({ @@ -597,29 +605,23 @@ Page({
597 if (marketing) { 605 if (marketing) {
598 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : ''; 606 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
599 is_comments = marketing.is_comments ? marketing.is_comments : ''; 607 is_comments = marketing.is_comments ? marketing.is_comments : '';
600 - coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : ''; 608 + coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
  609 + coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
  610 + marketing.coupon_data_payList = coupon_data_pay
  611 + coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
  612 + marketing.coupon_data_freeList = coupon_data_free
601 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : ''; 613 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
602 let couponDataId = info && info.length > 0 ? info[0].id : {} 614 let couponDataId = info && info.length > 0 ? info[0].id : {}
603 // 根据券ID获取评价赠送的券详情 615 // 根据券ID获取评价赠送的券详情
604 if(couponDataId) this.getEvaluateFun(couponDataId) 616 if(couponDataId) this.getEvaluateFun(couponDataId)
605 } 617 }
606 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 618 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
607 - if (coupon && util.getType(coupon) == 'object') {  
608 - couponList.push({  
609 - id: coupon.id  
610 - });  
611 - }  
612 - if (coupon && util.getType(coupon) == 'array') {  
613 - if (coupon.length > 0) {  
614 - coupon.forEach(item => {  
615 - couponList.push({  
616 - id: item.id  
617 - })  
618 - })  
619 - }  
620 - } 619 + // 获取全部的优惠券(商家券、个人券、免费券、付费券)
  620 + couponList = this.addCoupons(coupon,couponList);
  621 + couponList = this.addCoupons(coupon_data_pay,couponList);
  622 + couponList = this.addCoupons(coupon_data_free,couponList);
621 // 根据券ID获取券详情 623 // 根据券ID获取券详情
622 - this.getActivityByIdFun(couponList, couponList.length) 624 + this.getActivityByIdFun(couponList)
623 // 根据充值ID获取充值详情 625 // 根据充值ID获取充值详情
624 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) { 626 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
625 this.getRechargeDetail(marketing.recharge_data.id) 627 this.getRechargeDetail(marketing.recharge_data.id)
@@ -696,13 +698,16 @@ Page({ @@ -696,13 +698,16 @@ Page({
696 }) 698 })
697 }, 699 },
698 // 点击商家有礼 700 // 点击商家有礼
699 - gotoSellerGift(){  
700 - let url = util.http_build_query({ 701 + gotoSellerGift(e){
  702 + this.couponModal.closeModal()
  703 + const form = e.currentTarget.dataset['form'];
  704 + let url = util.http_build_query({
701 id: this.data.detail.id, 705 id: this.data.detail.id,
702 - }, '/pages/reserve/sellerGift')  
703 - wx.navigateTo({  
704 - url  
705 - }) 706 + form
  707 + }, '/pages/reserve/sellerGift')
  708 + wx.navigateTo({
  709 + url
  710 + })
706 }, 711 },
707 // 再次预订 712 // 再次预订
708 secondbook() { 713 secondbook() {
@@ -856,34 +861,172 @@ Page({ @@ -856,34 +861,172 @@ Page({
856 }) 861 })
857 }, 862 },
858 // 根据券ID获取券详情 863 // 根据券ID获取券详情
859 - getActivityByIdFun(ids, length) {  
860 - let coupon_dataList = [];  
861 - ids.forEach(i => {  
862 - App.Activity.GetActivityById({  
863 - id: i.id  
864 - }).then(res => {  
865 - if (res.data.length > 0) {  
866 - let detail = res.data[0];  
867 - detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';  
868 - detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';  
869 - detail.use = detail.use ? util.determine(detail.use) : '';  
870 - if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {  
871 - let cash = detail.use.cash * 1;  
872 - let price = detail.price * 1;  
873 - detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
874 - }  
875 - coupon_dataList.push(detail);  
876 - if (length === coupon_dataList.length) {  
877 - coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})  
878 - console.log('邀请函--------------------优惠券',coupon_dataList);  
879 - this.setData({  
880 - coupon_dataList,  
881 - })  
882 - }  
883 - }  
884 - })  
885 - })  
886 - }, 864 + getActivityByIdFun(obj) {
  865 + App.Activity.GetActivityById({
  866 + id: obj.map(item => item.id).join(','),
  867 + }).then(res => {
  868 + if (res.data.length > 0) {
  869 + let list = res.data.filter(item => {
  870 + return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
  871 + })
  872 + list.forEach(detail => {
  873 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  874 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  875 + detail.arule = detail.arule ? util.determine(detail.arule) : '';
  876 + detail.use = detail.use ? util.determine(detail.use) : '';
  877 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  878 + let cash = detail.use.cash * 1;
  879 + let price = detail.price * 1;
  880 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  881 + }
  882 + let num = detail.receiveNum;
  883 + if (num > 0) {
  884 + detail.receiveNumText = ''
  885 + if (num >= 0 && num <= 100) {
  886 + detail.receiveNumText = num.toString();
  887 + } else if (num >= 101 && num <= 199) {
  888 + detail.receiveNumText = '100+';
  889 + } else if (num >= 200 && num <= 299) {
  890 + detail.receiveNumText = '200+';
  891 + } else {
  892 + detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
  893 + }
  894 + }
  895 + if (detail.exp_date && detail.exp_date.week_data) {
  896 + let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
  897 + let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
  898 + if (noon) noon = '午餐:' + noon
  899 + if (nig) nig = '晚餐:' + nig
  900 + detail.noonText = noon;
  901 + detail.nigText = nig;
  902 + }
  903 + })
  904 + let freeCoupons = list.filter(item => {
  905 + return item.is_type == '3'
  906 + })
  907 + // 免费券判断是否领取,弹框领取
  908 + if (freeCoupons.length > 0) {
  909 + let length = freeCoupons.length - 1
  910 + freeCoupons.forEach(i => {
  911 + this.getCoupon(i, freeCoupons[length].id, obj)
  912 + })
  913 + }
  914 + console.log('邀请函--------------------优惠券', list);
  915 + this.setData({
  916 + coupon_dataList: list,
  917 + })
  918 + }
  919 + })
  920 + },
  921 + // 获取所有的券并且展示
  922 + addCoupons(coupons, couponList) {
  923 + if (coupons && util.getType(coupons) == 'object') {
  924 + couponList.push({
  925 + id: coupon.id,
  926 + number: coupon.number
  927 + });
  928 + }
  929 + if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
  930 + coupons.forEach(item => {
  931 + couponList.push({
  932 + id: item.id,
  933 + number: item.number
  934 + });
  935 + });
  936 + }
  937 + return couponList
  938 + },
  939 + // 弹框领取免费券
  940 + setcouponFun(arr) {
  941 + let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
  942 + console.log('弹框领取免费券id', str);
  943 + App.Activity.SetActivityAsReserve({
  944 + aid: str,
  945 + rid: this.id,
  946 + }).then((json) => {
  947 + if (json.ret != 200) {
  948 + wx.showToast({
  949 + title: res.msg,
  950 + duration: 2000,
  951 + mask: true
  952 + })
  953 + }
  954 + })
  955 + },
  956 + // 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
  957 + getCoupon(item, id, obj) {
  958 + let couponArr = this.data.couponArr;
  959 + let totalPrice = this.data.totalPrice;
  960 + App.Activity.ActivityListByOpenid({
  961 + aid: item.id
  962 + }).then(res => {
  963 + if (res.ret == 200) {
  964 + if (res.data.length == 0) {
  965 + couponArr.push(item)
  966 + }
  967 + if (item.id == id && couponArr.length > 0) {
  968 + couponArr.forEach(item => {
  969 + let match = obj.find(b => b.id === item.id);
  970 + if (match) {
  971 + item.number = match.number;
  972 + }
  973 + });
  974 + totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
  975 + this.setcouponFun(couponArr)
  976 + this.couponModal.showModal()
  977 + }
  978 + console.log('未领取的券列表-----------', couponArr);
  979 + this.setData({
  980 + couponArr,
  981 + totalPrice
  982 + })
  983 + }
  984 + })
  985 + },
  986 + // 处理优惠券不可用日期数据
  987 + hasConsecutiveSelect(arr, type) {
  988 + let firstTitle = null;
  989 + let lastTitle = null;
  990 + let rArr = []
  991 + let num = 0
  992 + for (let i = 0; i < arr.length; i++) {
  993 + let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
  994 + if (str) {
  995 + rArr.push(arr[i].title)
  996 + num++
  997 + if (num == 1) {
  998 + firstTitle = arr[i].title
  999 + }
  1000 + if (num >= 5) {
  1001 + lastTitle = arr[i].title
  1002 + }
  1003 + if (num >= 5 && i >= (arr.length - 1)) {
  1004 + let fi = rArr.findIndex((item) => {
  1005 + return item == firstTitle
  1006 + })
  1007 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1008 + num = 0
  1009 + }
  1010 + } else {
  1011 + if (num < 5) {
  1012 + num = 0
  1013 + firstTitle = null;
  1014 + lastTitle = null;
  1015 + } else {
  1016 + let fi = rArr.findIndex((item) => {
  1017 + return item == firstTitle
  1018 + })
  1019 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1020 + num = 0
  1021 + }
  1022 + }
  1023 + }
  1024 + return {
  1025 + rArr,
  1026 + lastTitle,
  1027 + firstTitle
  1028 + };
  1029 + },
887 /** 1030 /**
888 * 生命周期函数--监听页面隐藏 1031 * 生命周期函数--监听页面隐藏
889 */ 1032 */
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 /> 10 />
11 <image class="giftImg" 11 <image class="giftImg"
12 bindtap="gotoSellerGift" 12 bindtap="gotoSellerGift"
  13 + data-form="1"
13 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}" 14 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}"
14 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/> 15 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
15 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" /> 16 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
@@ -70,29 +71,49 @@ @@ -70,29 +71,49 @@
70 </button> 71 </button>
71 </view> 72 </view>
72 </view> 73 </view>
73 - <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}"> 74 + <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
74 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> 75 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
75 - <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"> 76 + <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">
76 <view class="preferentialItems"> 77 <view class="preferentialItems">
77 <view class="itemLeft"> 78 <view class="itemLeft">
78 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> 79 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
  80 + <view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
79 <view class="priceText" wx:if="{{item.price}}"> 81 <view class="priceText" wx:if="{{item.price}}">
80 - <view class="icons font40r">¥</view>{{item.price}} 82 + <view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
81 </view> 83 </view>
  84 + <view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
82 </view> 85 </view>
  86 + <view class="couponLine"></view>
83 <view class="itemRight"> 87 <view class="itemRight">
84 <view class="btns"> 88 <view class="btns">
85 <text class="font40r">{{item.aname}}</text> 89 <text class="font40r">{{item.aname}}</text>
86 - <view class="font24r orderingFood">  
87 - 抢购  
88 - </view> 90 + <block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
  91 + <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</view>
  92 + <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
  93 + 无限制{{item.desc?','+item.desc+'。':'。'}}
  94 + </view>
  95 + <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
  96 + 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
  97 + </view>
  98 + </block>
  99 + <block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
  100 + <view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
  101 + <view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
  102 + <view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
  103 + <view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
  104 + <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
  105 + <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
  106 + </block>
89 </view> 107 </view>
90 - <text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</text>  
91 - <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">  
92 - 无限制{{item.desc?','+item.desc+'。':'。'}} 108 + <view class="btnBox" wx:if="{{item.is_type == '3'}}" >
  109 + <view class="font24r orderingFood orderingFood1">已领取</view>
  110 + <view class="grantNum" wx:if="{{item.receiveNumText}}">
  111 + <view class="font24r">已被领取</view>
  112 + <view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
  113 + </view>
93 </view> 114 </view>
94 - <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">  
95 - 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}} 115 + <view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
  116 + 立即抢购
96 </view> 117 </view>
97 </view> 118 </view>
98 </view> 119 </view>
@@ -313,4 +334,24 @@ @@ -313,4 +334,24 @@
313 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button> 334 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
314 </view> 335 </view>
315 </view> 336 </view>
  337 +</my-modal>
  338 +<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
  339 + <view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
  340 + <image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
  341 + <view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
  342 + <view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
  343 + </view>
  344 + <view slot="modalContent">
  345 + <view class="couponBox">
  346 + <view wx:for="{{couponArr}}" class="couponItems">
  347 + <view class="couponNum font20r">×{{item.number}}</view>
  348 + <view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
  349 + <view class="couponLines"></view>
  350 + <view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
  351 + <view class="font28r couponCondition" wx:else>无门槛</view>
  352 + </view>
  353 + </view>
  354 + <view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
  355 + <view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
  356 + </view>
316 </my-modal> 357 </my-modal>
@@ -287,13 +287,104 @@ @@ -287,13 +287,104 @@
287 flex-shrink: 0; 287 flex-shrink: 0;
288 } 288 }
289 289
  290 +.preferentialCoupon .itemRight {
  291 + width: 74%;
  292 + display: flex;
  293 + align-items: center;
  294 +}
  295 +
  296 +.preferentialCoupon .itemLeft {
  297 + width: 26%;
  298 +}
  299 +
  300 +.preferentialCoupon .couponLine{
  301 + margin: 24rpx 0;
  302 + border-right: 2rpx dashed #f6231b;
  303 +}
  304 +
  305 +.preferentialCoupon .orderingFood {
  306 + padding: 0 20rpx;
  307 + color: #fff !important;
  308 + border: none !important;
  309 + text-align: center;
  310 + border-radius: 20rpx;
  311 + line-height: 44rpx;
  312 + height: 44rpx;
  313 + width: max-content;
  314 + flex-shrink: 0;
  315 + background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
  316 +}
  317 +.preferentialCoupon .icons {
  318 + color: #F6231B;
  319 + text-align: center;
  320 +}
  321 +
  322 +.preferentialCoupon .priceText {
  323 + display: flex;
  324 + align-items: baseline;
  325 + justify-content: center;
  326 + font-family: PingFang SC;
  327 + color: #F6231B;
  328 + font-weight: 600;
  329 + font-size: 48rpx;
  330 + margin-top: 6rpx;
  331 +}
  332 +
  333 +.preferentialCoupon .priceText text {
  334 + font-size: 48rpx;
  335 +}
  336 +
  337 +.preferentialCoupon .btns {
  338 + flex: 1;
  339 +}
  340 +.preferentialCoupon .btnBox {
  341 + display: flex;
  342 + flex-direction: column;
  343 +}
  344 +
  345 +.preferentialCoupon .grantNum {
  346 + display: flex;
  347 + flex-direction: column;
  348 + align-items: center;
  349 + color: #C36607;
  350 + margin-top: 10rpx;
  351 +}
  352 +
  353 +.preferentialCoupon .grantNum text {
  354 + color: #F6231B;
  355 + margin-right: 10rpx;
  356 +}
  357 +
  358 +.preferentialCoupon .btns text {
  359 + font-weight: 600;
  360 +}
  361 +
  362 +.preferentialCoupon .orderingFood1 {
  363 + border: 2rpx solid #fa4b20 !important;
  364 + background: transparent !important;
  365 + color: #fa4b20 !important;
  366 +}
  367 +
  368 +.preferentialCoupon .btns text {
  369 + color: #0B0805 !important;
  370 +}
  371 +
  372 +.preferentialCoupon .bottom {
  373 + color: #C36607 !important;
  374 +}
  375 +
  376 +.preferentialCoupon .nodate{
  377 + margin-left: 20rpx;
  378 +}
  379 +
290 .preferentialItems { 380 .preferentialItems {
291 display: flex; 381 display: flex;
292 - background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat;  
293 - background-size: 100% 100%; 382 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
294 margin-bottom: 20rpx; 383 margin-bottom: 20rpx;
295 min-height: 160rpx; 384 min-height: 160rpx;
296 padding-bottom: 10rpx; 385 padding-bottom: 10rpx;
  386 + border-radius: 20rpx;
  387 + border: 2rpx solid #ff7e06;
297 } 388 }
298 389
299 .rechargeItems { 390 .rechargeItems {
@@ -306,6 +397,7 @@ @@ -306,6 +397,7 @@
306 height: auto; 397 height: auto;
307 padding: 12rpx 0; 398 padding: 12rpx 0;
308 margin: 0 20rpx; 399 margin: 0 20rpx;
  400 + border: none;
309 } 401 }
310 402
311 .rechargeItems .orderingFood { 403 .rechargeItems .orderingFood {
@@ -347,6 +439,20 @@ @@ -347,6 +439,20 @@
347 top: 12rpx; 439 top: 12rpx;
348 } 440 }
349 441
  442 +.discountText1{
  443 + text-align: center;
  444 + color: #FD4D59;
  445 + border: 2rpx solid #FD4D59;
  446 + border-radius: 6rpx;
  447 + font-family: PingFang SC;
  448 + background: transparent;
  449 + width: max-content;
  450 + padding: 0 6rpx;
  451 + position: absolute;
  452 + left: 16rpx;
  453 + top: 12rpx;
  454 +}
  455 +
350 .famousChefBox .labelBox, 456 .famousChefBox .labelBox,
351 .stopBox .labelBox { 457 .stopBox .labelBox {
352 border-bottom: none; 458 border-bottom: none;
@@ -440,9 +546,7 @@ @@ -440,9 +546,7 @@
440 } 546 }
441 547
442 .priceText .icons { 548 .priceText .icons {
443 - font-family: 'Abel';  
444 color: #FD4D59; 549 color: #FD4D59;
445 - font-size: 40rpx;  
446 } 550 }
447 551
448 .itemRight { 552 .itemRight {
@@ -456,6 +560,7 @@ @@ -456,6 +560,7 @@
456 display: flex; 560 display: flex;
457 justify-content: space-between; 561 justify-content: space-between;
458 align-items: baseline; 562 align-items: baseline;
  563 + flex-direction: column;
459 } 564 }
460 565
461 .btns text { 566 .btns text {
@@ -716,6 +821,145 @@ @@ -716,6 +821,145 @@
716 box-sizing: border-box; 821 box-sizing: border-box;
717 } 822 }
718 823
  824 +#couponModal .titleModal {
  825 + margin-top: 30%;
  826 + position: relative;
  827 +}
  828 +
  829 +#couponModal .titleModal2 {
  830 + margin-top: 80%;
  831 +}
  832 +
  833 +#couponModal .titleModal3 {
  834 + margin-top: 60%;
  835 +}
  836 +
  837 +#couponModal .titleModal4 {
  838 + margin-top: 30%;
  839 +}
  840 +
  841 +#couponModal .mymodal {
  842 + background: rgba(0, 0, 0, 0.8);
  843 + width: 100% !important;
  844 + top: 0 !important;
  845 + height: auto !important;
  846 + z-index: 300;
  847 +}
  848 +
  849 +.nameInfo {
  850 + font-family: PingFang SC;
  851 + font-weight: 400;
  852 + font-size: 52rpx;
  853 + line-height: 56rpx;
  854 + color: #fff;
  855 + margin-bottom: 40rpx;
  856 + padding-top: 60rpx;
  857 +}
  858 +
  859 +.couponTotal {
  860 + color: #dfdfdf;
  861 + font-family: PingFang SC;
  862 + font-weight: 400;
  863 + font-size: 40rpx;
  864 + line-height: 48rpx;
  865 + margin-bottom: 40rpx;
  866 + display: flex;
  867 + align-items: center;
  868 + justify-content: center;
  869 +}
  870 +
  871 +.couponTotal text {
  872 + color: #ffc806;
  873 + font-weight: 600;
  874 + font-size: 80rpx;
  875 + margin: 0 14rpx;
  876 +}
  877 +
  878 +.couponBox {
  879 + width: 80%;
  880 + margin: 0 auto;
  881 + display: flex;
  882 + flex-wrap: wrap;
  883 + justify-content: space-evenly;
  884 +}
  885 +
  886 +.couponItems {
  887 + width: 46%;
  888 + margin-bottom: 24rpx;
  889 + padding-bottom: 52rpx;
  890 + border-radius: 20rpx;
  891 + border: 2rpx solid #ff7e06;
  892 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
  893 +}
  894 +
  895 +.couponNum {
  896 + background: #727272;
  897 + border-radius: 50%;
  898 + color: #fff;
  899 + width: 40rpx;
  900 + height: 40rpx;
  901 + display: flex;
  902 + align-items: center;
  903 + justify-content: center;
  904 + margin: 8rpx 0 0 8rpx;
  905 +}
  906 +
  907 +.couponPrice {
  908 + display: flex;
  909 + align-items: center;
  910 + justify-content: center;
  911 + color: #F6231B;
  912 + font-weight: 500;
  913 +}
  914 +
  915 +.couponLines{
  916 + width: 80%;
  917 + margin: 0 auto;
  918 + height: 2rpx;
  919 + border-bottom: 2rpx dashed #F6231B;
  920 +}
  921 +
  922 +.couponPrice text {
  923 + margin-left: 4rpx;
  924 + font-size: 76rpx;
  925 + font-weight: 700;
  926 +}
  927 +
  928 +.couponCondition {
  929 + color: #C36607;
  930 + display: flex;
  931 + align-items: center;
  932 + justify-content: center;
  933 + padding-top: 24rpx;
  934 +}
  935 +
  936 +.couponBtn {
  937 + width: 80%;
  938 + margin: 0 auto;
  939 + border-radius: 42rpx;
  940 + background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
  941 + font-weight: 400;
  942 + color: #fff;
  943 + text-align: center;
  944 + border: 4rpx solid #fff;
  945 + padding: 12rpx 0;
  946 + margin: 16rpx auto 20rpx auto;
  947 +}
  948 +
  949 +.couponText {
  950 + color: #fff;
  951 + text-decoration: underline;
  952 + text-align: center;
  953 +}
  954 +
  955 +.closeImg {
  956 + width: 60rpx;
  957 + height: 60rpx;
  958 + position: absolute;
  959 + right: 0;
  960 + top: 0;
  961 +}
  962 +
719 /* 深中国红 */ 963 /* 深中国红 */
720 .crimson, 964 .crimson,
721 .crimson .positioningBox { 965 .crimson .positioningBox {
@@ -1047,14 +1291,6 @@ @@ -1047,14 +1291,6 @@
1047 color: #578C69; 1291 color: #578C69;
1048 } 1292 }
1049 1293
1050 -.pearlWhite .preferentialItems {  
1051 - background: url(https://nosqn.colorcun.com/certificateWhiteBj1.png) no-repeat;  
1052 - background-size: 100% 100%;  
1053 - margin-bottom: 20rpx;  
1054 - min-height: 160rpx;  
1055 - padding-bottom: 10rpx;  
1056 -}  
1057 -  
1058 .pearlWhite .rechargeItems { 1294 .pearlWhite .rechargeItems {
1059 background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat; 1295 background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat;
1060 background-size: 100% 100%; 1296 background-size: 100% 100%;
@@ -1122,12 +1358,6 @@ @@ -1122,12 +1358,6 @@
1122 border: none; 1358 border: none;
1123 } 1359 }
1124 1360
1125 -.pearlWhite .discountText {  
1126 - background: transparent;  
1127 - border: 2rpx solid #FD4D59;  
1128 - color: #FD4D59;  
1129 -}  
1130 -  
1131 .toastBox { 1361 .toastBox {
1132 width: fit-content; 1362 width: fit-content;
1133 position: fixed; 1363 position: fixed;
@@ -67,6 +67,7 @@ Page({ @@ -67,6 +67,7 @@ Page({
67 isMoreBtn:'',//再次预订按钮 67 isMoreBtn:'',//再次预订按钮
68 isPaymenBtn:'',//支付定金按钮 68 isPaymenBtn:'',//支付定金按钮
69 isShareItem:'',//转发客人按钮 69 isShareItem:'',//转发客人按钮
  70 + couponArr: [],//待领取的优惠券列表
70 }, 71 },
71 screenHeight: '', 72 screenHeight: '',
72 attentionAnim: {}, 73 attentionAnim: {},
@@ -74,6 +75,7 @@ Page({ @@ -74,6 +75,7 @@ Page({
74 timers: null, // 动画定时器 75 timers: null, // 动画定时器
75 n: 0, 76 n: 0,
76 modal:'', 77 modal:'',
  78 + couponModal: '',
77 /** 79 /**
78 * 生命周期函数--监听页面加载 80 * 生命周期函数--监听页面加载
79 */ 81 */
@@ -101,6 +103,7 @@ Page({ @@ -101,6 +103,7 @@ Page({
101 wx.onUserCaptureScreen((res)=> { 103 wx.onUserCaptureScreen((res)=> {
102 this.showModal() 104 this.showModal()
103 }) 105 })
  106 + this.couponModal = this.selectComponent("#couponModal");
104 }, 107 },
105 // 打开截屏弹框 108 // 打开截屏弹框
106 showModal() { 109 showModal() {
@@ -110,6 +113,10 @@ Page({ @@ -110,6 +113,10 @@ Page({
110 closeModal() { 113 closeModal() {
111 this.modal.closeModal() 114 this.modal.closeModal()
112 }, 115 },
  116 + // 关闭优惠券弹框
  117 + closeCouponModal() {
  118 + this.couponModal.closeModal()
  119 + },
113 // 页面滚动事件 120 // 页面滚动事件
114 onPageScroll: function (event) { 121 onPageScroll: function (event) {
115 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离 122 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
@@ -409,9 +416,10 @@ Page({ @@ -409,9 +416,10 @@ Page({
409 uid 416 uid
410 }).then((json) => { 417 }).then((json) => {
411 if (json.ret == 200) { 418 if (json.ret == 200) {
412 - console.log('staffinfostaffinfostaffinfo', json.data) 419 + console.log('客户经理获取基本信息------', json.data)
413 this.setData({ 420 this.setData({
414 - staffinfo: json.data 421 + staffinfo: json.data,
  422 + couponArr:[],
415 }) 423 })
416 this.getSellerTemplateConfFun(sid); 424 this.getSellerTemplateConfFun(sid);
417 } 425 }
@@ -529,7 +537,7 @@ Page({ @@ -529,7 +537,7 @@ Page({
529 let data = res.data 537 let data = res.data
530 console.log('data', data); 538 console.log('data', data);
531 let couponList = [] 539 let couponList = []
532 - let themeColor, StyleType, titleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store; 540 + let themeColor, StyleType, titleType, whiteBj, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
533 chef = util.determine(data.chef); 541 chef = util.determine(data.chef);
534 reserve = util.determine(data.reserve); 542 reserve = util.determine(data.reserve);
535 marketing = util.determine(data.marketing); 543 marketing = util.determine(data.marketing);
@@ -548,29 +556,23 @@ Page({ @@ -548,29 +556,23 @@ Page({
548 if (marketing) { 556 if (marketing) {
549 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : ''; 557 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
550 is_comments = marketing.is_comments ? marketing.is_comments : ''; 558 is_comments = marketing.is_comments ? marketing.is_comments : '';
551 - coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : ''; 559 + coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
  560 + coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
  561 + marketing.coupon_data_payList = coupon_data_pay
  562 + coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
  563 + marketing.coupon_data_freeList = coupon_data_free
552 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : ''; 564 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
553 let couponDataId = info && info.length > 0 ? info[0].id : {} 565 let couponDataId = info && info.length > 0 ? info[0].id : {}
554 // 根据券ID获取评价赠送的券详情 566 // 根据券ID获取评价赠送的券详情
555 if(couponDataId) this.getEvaluateFun(couponDataId) 567 if(couponDataId) this.getEvaluateFun(couponDataId)
556 } 568 }
557 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 569 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
558 - if (coupon && util.getType(coupon) == 'object') {  
559 - couponList.push({  
560 - id: coupon.id  
561 - });  
562 - }  
563 - if (coupon && util.getType(coupon) == 'array') {  
564 - if (coupon.length > 0) {  
565 - coupon.forEach(item => {  
566 - couponList.push({  
567 - id: item.id  
568 - })  
569 - })  
570 - }  
571 - } 570 + // 获取全部的优惠券(商家券、个人券、免费券、付费券)
  571 + couponList = this.addCoupons(coupon,couponList);
  572 + couponList = this.addCoupons(coupon_data_pay,couponList);
  573 + couponList = this.addCoupons(coupon_data_free,couponList);
572 // 根据券ID获取券详情 574 // 根据券ID获取券详情
573 - this.getActivityByIdFun(couponList, couponList.length) 575 + this.getActivityByIdFun(couponList)
574 // 根据充值ID获取充值详情 576 // 根据充值ID获取充值详情
575 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) { 577 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
576 this.getRechargeDetail(marketing.recharge_data.id) 578 this.getRechargeDetail(marketing.recharge_data.id)
@@ -654,8 +656,11 @@ Page({ @@ -654,8 +656,11 @@ Page({
654 }, 656 },
655 // 点击商家有礼 657 // 点击商家有礼
656 gotoSellerGift(){ 658 gotoSellerGift(){
  659 + this.couponModal.closeModal()
  660 + const form = e.currentTarget.dataset['form'];
657 let url = util.http_build_query({ 661 let url = util.http_build_query({
658 id: this.data.detail.id, 662 id: this.data.detail.id,
  663 + form
659 }, '/pages/reserve/sellerGift') 664 }, '/pages/reserve/sellerGift')
660 wx.navigateTo({ 665 wx.navigateTo({
661 url 666 url
@@ -812,35 +817,173 @@ Page({ @@ -812,35 +817,173 @@ Page({
812 } 817 }
813 }) 818 })
814 }, 819 },
815 - // 根据券ID获取券详情  
816 - getActivityByIdFun(ids, length) {  
817 - let coupon_dataList = [];  
818 - ids.forEach(i => {  
819 - App.Activity.GetActivityById({  
820 - id: i.id  
821 - }).then(res => {  
822 - if (res.data.length > 0) {  
823 - let detail = res.data[0];  
824 - detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';  
825 - detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';  
826 - detail.use = detail.use ? util.determine(detail.use) : '';  
827 - if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {  
828 - let cash = detail.use.cash * 1;  
829 - let price = detail.price * 1;  
830 - detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
831 - }  
832 - coupon_dataList.push(detail);  
833 - if (length === coupon_dataList.length) {  
834 - coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})  
835 - console.log('邀请函--------------------优惠券',coupon_dataList);  
836 - this.setData({  
837 - coupon_dataList,  
838 - })  
839 - }  
840 - }  
841 - })  
842 - })  
843 - }, 820 + // 根据券ID获取券详情
  821 + getActivityByIdFun(obj) {
  822 + App.Activity.GetActivityById({
  823 + id: obj.map(item => item.id).join(','),
  824 + }).then(res => {
  825 + if (res.data.length > 0) {
  826 + let list = res.data.filter(item => {
  827 + return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
  828 + })
  829 + list.forEach(detail => {
  830 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  831 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  832 + detail.arule = detail.arule ? util.determine(detail.arule) : '';
  833 + detail.use = detail.use ? util.determine(detail.use) : '';
  834 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  835 + let cash = detail.use.cash * 1;
  836 + let price = detail.price * 1;
  837 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  838 + }
  839 + let num = detail.receiveNum;
  840 + if (num > 0) {
  841 + detail.receiveNumText = ''
  842 + if (num >= 0 && num <= 100) {
  843 + detail.receiveNumText = num.toString();
  844 + } else if (num >= 101 && num <= 199) {
  845 + detail.receiveNumText = '100+';
  846 + } else if (num >= 200 && num <= 299) {
  847 + detail.receiveNumText = '200+';
  848 + } else {
  849 + detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
  850 + }
  851 + }
  852 + if (detail.exp_date && detail.exp_date.week_data) {
  853 + let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
  854 + let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
  855 + if (noon) noon = '午餐:' + noon
  856 + if (nig) nig = '晚餐:' + nig
  857 + detail.noonText = noon;
  858 + detail.nigText = nig;
  859 + }
  860 + })
  861 + let freeCoupons = list.filter(item => {
  862 + return item.is_type == '3'
  863 + })
  864 + // 免费券判断是否领取,弹框领取
  865 + if (freeCoupons.length > 0) {
  866 + let length = freeCoupons.length - 1
  867 + freeCoupons.forEach(i => {
  868 + this.getCoupon(i, freeCoupons[length].id, obj)
  869 + })
  870 + }
  871 + console.log('邀请函--------------------优惠券', list);
  872 + this.setData({
  873 + coupon_dataList: list,
  874 + })
  875 + }
  876 + })
  877 + },
  878 + // 获取所有的券并且展示
  879 + addCoupons(coupons, couponList) {
  880 + if (coupons && util.getType(coupons) == 'object') {
  881 + couponList.push({
  882 + id: coupon.id,
  883 + number: coupon.number
  884 + });
  885 + }
  886 + if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
  887 + coupons.forEach(item => {
  888 + couponList.push({
  889 + id: item.id,
  890 + number: item.number
  891 + });
  892 + });
  893 + }
  894 + return couponList
  895 + },
  896 + // 弹框领取免费券
  897 + setcouponFun(arr) {
  898 + let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
  899 + console.log('弹框领取免费券id', str);
  900 + App.Activity.SetActivityAsReserve({
  901 + aid: str,
  902 + rid: this.id,
  903 + }).then((json) => {
  904 + if (json.ret != 200) {
  905 + wx.showToast({
  906 + title: res.msg,
  907 + duration: 2000,
  908 + mask: true
  909 + })
  910 + }
  911 + })
  912 + },
  913 + // 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
  914 + getCoupon(item, id, obj) {
  915 + let couponArr = this.data.couponArr;
  916 + let totalPrice = this.data.totalPrice;
  917 + App.Activity.ActivityListByOpenid({
  918 + aid: item.id
  919 + }).then(res => {
  920 + if (res.ret == 200) {
  921 + if (res.data.length == 0) {
  922 + couponArr.push(item)
  923 + }
  924 + if (item.id == id && couponArr.length > 0) {
  925 + couponArr.forEach(item => {
  926 + let match = obj.find(b => b.id === item.id);
  927 + if (match) {
  928 + item.number = match.number;
  929 + }
  930 + });
  931 + totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
  932 + this.setcouponFun(couponArr)
  933 + this.couponModal.showModal()
  934 + }
  935 + console.log('未领取的券列表-----------', couponArr);
  936 + this.setData({
  937 + couponArr,
  938 + totalPrice
  939 + })
  940 + }
  941 + })
  942 + },
  943 + // 处理优惠券不可用日期数据
  944 + hasConsecutiveSelect(arr, type) {
  945 + let firstTitle = null;
  946 + let lastTitle = null;
  947 + let rArr = []
  948 + let num = 0
  949 + for (let i = 0; i < arr.length; i++) {
  950 + let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
  951 + if (str) {
  952 + rArr.push(arr[i].title)
  953 + num++
  954 + if (num == 1) {
  955 + firstTitle = arr[i].title
  956 + }
  957 + if (num >= 5) {
  958 + lastTitle = arr[i].title
  959 + }
  960 + if (num >= 5 && i >= (arr.length - 1)) {
  961 + let fi = rArr.findIndex((item) => {
  962 + return item == firstTitle
  963 + })
  964 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  965 + num = 0
  966 + }
  967 + } else {
  968 + if (num < 5) {
  969 + num = 0
  970 + firstTitle = null;
  971 + lastTitle = null;
  972 + } else {
  973 + let fi = rArr.findIndex((item) => {
  974 + return item == firstTitle
  975 + })
  976 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  977 + num = 0
  978 + }
  979 + }
  980 + }
  981 + return {
  982 + rArr,
  983 + lastTitle,
  984 + firstTitle
  985 + };
  986 + },
844 /** 987 /**
845 * 生命周期函数--监听页面隐藏 988 * 生命周期函数--监听页面隐藏
846 */ 989 */
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 /> 11 />
12 <image class="giftImg" 12 <image class="giftImg"
13 bindtap="gotoSellerGift" 13 bindtap="gotoSellerGift"
  14 + data-form="1"
14 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}" 15 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}"
15 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/> 16 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
16 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" /> 17 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
@@ -92,29 +93,50 @@ @@ -92,29 +93,50 @@
92 </view> 93 </view>
93 </view> 94 </view>
94 </view> 95 </view>
95 - <view class="preferential" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}"> 96 + <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
96 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> 97 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
97 - <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"> 98 + <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">
98 <view class="preferentialItems"> 99 <view class="preferentialItems">
99 - <view class="left">  
100 - <view class="top">  
101 - <text class="font28r">{{item.aname}}</text>  
102 - <view class="price font24r" wx:if="{{item.price}}">  
103 - <view class="icons font24r">¥</view>{{item.price}}  
104 - </view>  
105 - <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->  
106 - <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discount font24r">{{item.discount}}折</text> 100 + <view class="itemLeft">
  101 + <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
  102 + <view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
  103 + <view class="priceText" wx:if="{{item.price}}">
  104 + <view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
107 </view> 105 </view>
108 - <text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r oneBottom">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</text>  
109 - <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">  
110 - 无限制{{item.desc?','+item.desc+'。':'。'}} 106 + <view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
  107 + </view>
  108 + <view class="couponLine"></view>
  109 + <view class="itemRight">
  110 + <view class="btns">
  111 + <text class="font40r">{{item.aname}}</text>
  112 + <block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
  113 + <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</view>
  114 + <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
  115 + 无限制{{item.desc?','+item.desc+'。':'。'}}
  116 + </view>
  117 + <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
  118 + 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
  119 + </view>
  120 + </block>
  121 + <block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
  122 + <view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
  123 + <view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
  124 + <view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
  125 + <view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
  126 + <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
  127 + <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
  128 + </block>
111 </view> 129 </view>
112 - <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">  
113 - 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}} 130 + <view class="btnBox" wx:if="{{item.is_type == '3'}}" >
  131 + <view class="font24r orderingFood orderingFood1">已领取</view>
  132 + <view class="grantNum" wx:if="{{item.receiveNumText}}">
  133 + <view class="font24r">已被领取</view>
  134 + <view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
  135 + </view>
  136 + </view>
  137 + <view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
  138 + 立即抢购
114 </view> 139 </view>
115 - </view>  
116 - <view class="font24r orderingFood">  
117 - 去抢购  
118 </view> 140 </view>
119 </view> 141 </view>
120 </navigator> 142 </navigator>
@@ -241,7 +263,7 @@ @@ -241,7 +263,7 @@
241 特别优惠 263 特别优惠
242 </view> 264 </view>
243 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover"> 265 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
244 - <view class="preferentialItems"> 266 + <view class="rechargeItems">
245 <view class="left"> 267 <view class="left">
246 <view class="top"> 268 <view class="top">
247 <text class="font28r">{{recharge_data.rname}}</text> 269 <text class="font28r">{{recharge_data.rname}}</text>
@@ -300,4 +322,24 @@ @@ -300,4 +322,24 @@
300 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button> 322 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
301 </view> 323 </view>
302 </view> 324 </view>
  325 +</my-modal>
  326 +<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
  327 + <view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
  328 + <image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
  329 + <view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
  330 + <view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
  331 + </view>
  332 + <view slot="modalContent">
  333 + <view class="couponBox">
  334 + <view wx:for="{{couponArr}}" class="couponItems">
  335 + <view class="couponNum font20r">×{{item.number}}</view>
  336 + <view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
  337 + <view class="couponLines"></view>
  338 + <view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
  339 + <view class="font28r couponCondition" wx:else>无门槛</view>
  340 + </view>
  341 + </view>
  342 + <view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
  343 + <view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
  344 + </view>
303 </my-modal> 345 </my-modal>
@@ -22,8 +22,16 @@ @@ -22,8 +22,16 @@
22 font-family: PingFang SC; 22 font-family: PingFang SC;
23 font-size: 72rpx; 23 font-size: 72rpx;
24 color: #FFD200; 24 color: #FFD200;
25 - position: relative;  
26 - top: -50rpx; 25 + position: absolute;
  26 + top: 40rpx;
  27 + left: 0;
  28 + right: 0;
  29 + overflow: hidden;
  30 + word-break: break-all;
  31 + text-overflow: ellipsis;
  32 + display: -webkit-box;
  33 + -webkit-box-orient: vertical;
  34 + -webkit-line-clamp: 1;
27 } 35 }
28 36
29 37
@@ -455,14 +463,172 @@ @@ -455,14 +463,172 @@
455 flex-shrink: 0; 463 flex-shrink: 0;
456 } 464 }
457 465
  466 +.preferentialCoupon .nodate{
  467 + margin-left: 20rpx;
  468 +}
  469 +
458 .preferentialItems { 470 .preferentialItems {
459 - padding: 16rpx 16rpx 16rpx 24rpx;  
460 display: flex; 471 display: flex;
461 - justify-content: space-between;  
462 - align-items: center; 472 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
  473 + margin: 0 20rpx 20rpx 20rpx;
  474 + min-height: 160rpx;
  475 + padding-bottom: 10rpx;
  476 + border-radius: 20rpx;
  477 + border: 2rpx solid #ff7e06;
  478 +}
  479 +
  480 +.rechargeItems {
463 background: url('https://qn.colorcun.com/certificateBj.png') no-repeat; 481 background: url('https://qn.colorcun.com/certificateBj.png') no-repeat;
464 background-size: 100% 100%; 482 background-size: 100% 100%;
465 - margin-bottom: 20rpx; 483 + min-height: 160rpx;
  484 + display: flex;
  485 + justify-content: space-between;
  486 + align-items: center;
  487 + height: auto;
  488 + padding: 12rpx 20rpx 12rpx 32rpx;
  489 + margin: 0 20rpx;
  490 + border: none;
  491 +}
  492 +
  493 +.preferentialCoupon .itemRight {
  494 + width: 74%;
  495 + display: flex;
  496 + align-items: center;
  497 +}
  498 +
  499 +.preferentialCoupon .itemLeft {
  500 + width: 26%;
  501 +}
  502 +
  503 +.preferentialCoupon .couponLine{
  504 + margin: 24rpx 0;
  505 + border-right: 2rpx dashed #f6231b;
  506 +}
  507 +
  508 +.preferentialCoupon .orderingFood {
  509 + padding: 0 20rpx;
  510 + color: #fff !important;
  511 + border: none !important;
  512 + text-align: center;
  513 + border-radius: 20rpx;
  514 + line-height: 44rpx;
  515 + height: 44rpx;
  516 + width: max-content;
  517 + flex-shrink: 0;
  518 + background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
  519 +}
  520 +.preferentialCoupon .icons {
  521 + color: #F6231B;
  522 + text-align: center;
  523 +}
  524 +
  525 +.preferentialCoupon .priceText {
  526 + display: flex;
  527 + align-items: baseline;
  528 + justify-content: center;
  529 + font-family: PingFang SC;
  530 + color: #F6231B;
  531 + font-weight: 600;
  532 + font-size: 48rpx;
  533 + margin-top: 6rpx;
  534 +}
  535 +
  536 +.preferentialCoupon .priceText text {
  537 + font-size: 48rpx;
  538 +}
  539 +
  540 +.preferentialCoupon .btns {
  541 + flex: 1;
  542 +}
  543 +.preferentialCoupon .btnBox {
  544 + display: flex;
  545 + flex-direction: column;
  546 +}
  547 +
  548 +.preferentialCoupon .grantNum {
  549 + display: flex;
  550 + flex-direction: column;
  551 + align-items: center;
  552 + color: #C36607;
  553 + margin-top: 10rpx;
  554 +}
  555 +
  556 +.preferentialCoupon .grantNum text {
  557 + color: #F6231B;
  558 + margin-right: 10rpx;
  559 +}
  560 +
  561 +.preferentialCoupon .btns text {
  562 + font-weight: 600;
  563 +}
  564 +
  565 +.preferentialCoupon .orderingFood1 {
  566 + border: 2rpx solid #fa4b20 !important;
  567 + background: transparent !important;
  568 + color: #fa4b20 !important;
  569 +}
  570 +
  571 +.preferentialItems .priceText .icons {
  572 + color: #FD4D59;
  573 +}
  574 +
  575 +.preferentialItems .btns {
  576 + margin: 24rpx 20rpx 0 0;
  577 + display: flex;
  578 + justify-content: space-between;
  579 + align-items: baseline;
  580 + flex-direction: column;
  581 +}
  582 +
  583 +.preferentialItems .bottom {
  584 + color: #C36607;
  585 +}
  586 +
  587 +.preferentialItems .priceText {
  588 + display: flex;
  589 + align-items: center;
  590 + justify-content: center;
  591 +}
  592 +
  593 +.preferentialItems .discountText {
  594 + text-align: center;
  595 + color: #FFEFC5;
  596 + border-radius: 6rpx;
  597 + font-family: PingFang SC;
  598 + background: #FD4D59;
  599 + width: max-content;
  600 + padding: 6rpx;
  601 + position: absolute;
  602 + left: 16rpx;
  603 + top: 12rpx;
  604 +}
  605 +
  606 +.preferentialItems .discountText1{
  607 + text-align: center;
  608 + color: #FD4D59;
  609 + border: 2rpx solid #FD4D59;
  610 + border-radius: 6rpx;
  611 + font-family: PingFang SC;
  612 + background: transparent;
  613 + width: max-content;
  614 + padding: 0 6rpx;
  615 + position: absolute;
  616 + left: 16rpx;
  617 + top: 12rpx;
  618 +}
  619 +
  620 +.preferentialItems .itemRight {
  621 + width: 70%;
  622 + padding-right: 10rpx;
  623 + margin-left: 18rpx;
  624 +}
  625 +
  626 +.preferentialItems .itemLeft {
  627 + width: 30%;
  628 + display: flex;
  629 + flex-direction: column;
  630 + justify-content: center;
  631 + position: relative;
466 } 632 }
467 633
468 .rubric1 { 634 .rubric1 {
@@ -806,6 +972,145 @@ @@ -806,6 +972,145 @@
806 box-sizing: border-box; 972 box-sizing: border-box;
807 } 973 }
808 974
  975 +#couponModal .titleModal {
  976 + margin-top: 30%;
  977 + position: relative;
  978 +}
  979 +
  980 +#couponModal .titleModal2 {
  981 + margin-top: 80%;
  982 +}
  983 +
  984 +#couponModal .titleModal3 {
  985 + margin-top: 60%;
  986 +}
  987 +
  988 +#couponModal .titleModal4 {
  989 + margin-top: 30%;
  990 +}
  991 +
  992 +#couponModal .mymodal {
  993 + background: rgba(0, 0, 0, 0.8);
  994 + width: 100% !important;
  995 + top: 0 !important;
  996 + height: auto !important;
  997 + z-index: 300;
  998 +}
  999 +
  1000 +.nameInfo {
  1001 + font-family: PingFang SC;
  1002 + font-weight: 400;
  1003 + font-size: 52rpx;
  1004 + line-height: 56rpx;
  1005 + color: #fff;
  1006 + margin-bottom: 40rpx;
  1007 + padding-top: 60rpx;
  1008 +}
  1009 +
  1010 +.couponTotal {
  1011 + color: #dfdfdf;
  1012 + font-family: PingFang SC;
  1013 + font-weight: 400;
  1014 + font-size: 40rpx;
  1015 + line-height: 48rpx;
  1016 + margin-bottom: 40rpx;
  1017 + display: flex;
  1018 + align-items: center;
  1019 + justify-content: center;
  1020 +}
  1021 +
  1022 +.couponTotal text {
  1023 + color: #ffc806;
  1024 + font-weight: 600;
  1025 + font-size: 80rpx;
  1026 + margin: 0 14rpx;
  1027 +}
  1028 +
  1029 +.couponBox {
  1030 + width: 80%;
  1031 + margin: 0 auto;
  1032 + display: flex;
  1033 + flex-wrap: wrap;
  1034 + justify-content: space-evenly;
  1035 +}
  1036 +
  1037 +.couponItems {
  1038 + width: 46%;
  1039 + margin-bottom: 24rpx;
  1040 + padding-bottom: 52rpx;
  1041 + border-radius: 20rpx;
  1042 + border: 2rpx solid #ff7e06;
  1043 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
  1044 +}
  1045 +
  1046 +.couponNum {
  1047 + background: #727272;
  1048 + border-radius: 50%;
  1049 + color: #fff;
  1050 + width: 40rpx;
  1051 + height: 40rpx;
  1052 + display: flex;
  1053 + align-items: center;
  1054 + justify-content: center;
  1055 + margin: 8rpx 0 0 8rpx;
  1056 +}
  1057 +
  1058 +.couponPrice {
  1059 + display: flex;
  1060 + align-items: center;
  1061 + justify-content: center;
  1062 + color: #F6231B;
  1063 + font-weight: 500;
  1064 +}
  1065 +
  1066 +.couponLines{
  1067 + width: 80%;
  1068 + margin: 0 auto;
  1069 + height: 2rpx;
  1070 + border-bottom: 2rpx dashed #F6231B;
  1071 +}
  1072 +
  1073 +.couponPrice text {
  1074 + margin-left: 4rpx;
  1075 + font-size: 76rpx;
  1076 + font-weight: 700;
  1077 +}
  1078 +
  1079 +.couponCondition {
  1080 + color: #C36607;
  1081 + display: flex;
  1082 + align-items: center;
  1083 + justify-content: center;
  1084 + padding-top: 24rpx;
  1085 +}
  1086 +
  1087 +.couponBtn {
  1088 + width: 80%;
  1089 + margin: 0 auto;
  1090 + border-radius: 42rpx;
  1091 + background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
  1092 + font-weight: 400;
  1093 + color: #fff;
  1094 + text-align: center;
  1095 + border: 4rpx solid #fff;
  1096 + padding: 12rpx 0;
  1097 + margin: 16rpx auto 20rpx auto;
  1098 +}
  1099 +
  1100 +.couponText {
  1101 + color: #fff;
  1102 + text-decoration: underline;
  1103 + text-align: center;
  1104 +}
  1105 +
  1106 +.closeImg {
  1107 + width: 60rpx;
  1108 + height: 60rpx;
  1109 + position: absolute;
  1110 + right: 0;
  1111 + top: 0;
  1112 +}
  1113 +
809 .arrivalBox{ 1114 .arrivalBox{
810 display: flex; 1115 display: flex;
811 width: 100%; 1116 width: 100%;
@@ -66,6 +66,7 @@ Page({ @@ -66,6 +66,7 @@ Page({
66 isMoreBtn:'',//再次预订按钮 66 isMoreBtn:'',//再次预订按钮
67 isPaymenBtn:'',//支付定金按钮 67 isPaymenBtn:'',//支付定金按钮
68 isShareItem:'',//转发客人按钮 68 isShareItem:'',//转发客人按钮
  69 + couponArr: [],//待领取的优惠券列表
69 }, 70 },
70 tablestr: '', 71 tablestr: '',
71 urlsValue: [], 72 urlsValue: [],
@@ -75,6 +76,7 @@ Page({ @@ -75,6 +76,7 @@ Page({
75 timers: null, // 动画定时器 76 timers: null, // 动画定时器
76 n: 0, 77 n: 0,
77 modal:'', 78 modal:'',
  79 + couponModal: '',
78 /** 80 /**
79 * 生命周期函数--监听页面加载 81 * 生命周期函数--监听页面加载
80 */ 82 */
@@ -102,6 +104,7 @@ Page({ @@ -102,6 +104,7 @@ Page({
102 wx.onUserCaptureScreen((res)=> { 104 wx.onUserCaptureScreen((res)=> {
103 this.showModal() 105 this.showModal()
104 }) 106 })
  107 + this.couponModal = this.selectComponent("#couponModal");
105 }, 108 },
106 // 打开截屏弹框 109 // 打开截屏弹框
107 showModal() { 110 showModal() {
@@ -111,6 +114,10 @@ Page({ @@ -111,6 +114,10 @@ Page({
111 closeModal() { 114 closeModal() {
112 this.modal.closeModal() 115 this.modal.closeModal()
113 }, 116 },
  117 + // 关闭优惠券弹框
  118 + closeCouponModal() {
  119 + this.couponModal.closeModal()
  120 + },
114 // 页面滚动事件 121 // 页面滚动事件
115 onPageScroll: function (event) { 122 onPageScroll: function (event) {
116 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离 123 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
@@ -456,9 +463,10 @@ Page({ @@ -456,9 +463,10 @@ Page({
456 uid 463 uid
457 }).then((json) => { 464 }).then((json) => {
458 if (json.ret == 200) { 465 if (json.ret == 200) {
459 - console.log('staffinfostaffinfostaffinfo', json.data) 466 + console.log('客户经理获取基本信息------', json.data)
460 this.setData({ 467 this.setData({
461 - staffinfo: json.data 468 + staffinfo: json.data,
  469 + couponArr:[],
462 }) 470 })
463 this.getSellerTemplateConfFun(sid); 471 this.getSellerTemplateConfFun(sid);
464 } 472 }
@@ -579,7 +587,7 @@ Page({ @@ -579,7 +587,7 @@ Page({
579 let data = res.data 587 let data = res.data
580 console.log('data', data); 588 console.log('data', data);
581 let couponList = [] 589 let couponList = []
582 - let themeColor, StyleType, titleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store; 590 + let themeColor, StyleType, titleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
583 chef = util.determine(data.chef); 591 chef = util.determine(data.chef);
584 reserve = util.determine(data.reserve); 592 reserve = util.determine(data.reserve);
585 marketing = util.determine(data.marketing); 593 marketing = util.determine(data.marketing);
@@ -598,29 +606,23 @@ Page({ @@ -598,29 +606,23 @@ Page({
598 if (marketing) { 606 if (marketing) {
599 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : ''; 607 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
600 is_comments = marketing.is_comments ? marketing.is_comments : ''; 608 is_comments = marketing.is_comments ? marketing.is_comments : '';
601 - coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : ''; 609 + coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
  610 + coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
  611 + marketing.coupon_data_payList = coupon_data_pay
  612 + coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
  613 + marketing.coupon_data_freeList = coupon_data_free
602 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : ''; 614 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
603 let couponDataId = info && info.length > 0 ? info[0].id : {} 615 let couponDataId = info && info.length > 0 ? info[0].id : {}
604 // 根据券ID获取评价赠送的券详情 616 // 根据券ID获取评价赠送的券详情
605 if(couponDataId) this.getEvaluateFun(couponDataId) 617 if(couponDataId) this.getEvaluateFun(couponDataId)
606 } 618 }
607 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 619 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
608 - if (coupon && util.getType(coupon) == 'object') {  
609 - couponList.push({  
610 - id: coupon.id  
611 - });  
612 - }  
613 - if (coupon && util.getType(coupon) == 'array') {  
614 - if (coupon.length > 0) {  
615 - coupon.forEach(item => {  
616 - couponList.push({  
617 - id: item.id  
618 - })  
619 - })  
620 - }  
621 - } 620 + // 获取全部的优惠券(商家券、个人券、免费券、付费券)
  621 + couponList = this.addCoupons(coupon,couponList);
  622 + couponList = this.addCoupons(coupon_data_pay,couponList);
  623 + couponList = this.addCoupons(coupon_data_free,couponList);
622 // 根据券ID获取券详情 624 // 根据券ID获取券详情
623 - this.getActivityByIdFun(couponList, couponList.length) 625 + this.getActivityByIdFun(couponList)
624 // 根据充值ID获取充值详情 626 // 根据充值ID获取充值详情
625 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) { 627 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
626 this.getRechargeDetail(marketing.recharge_data.id) 628 this.getRechargeDetail(marketing.recharge_data.id)
@@ -697,9 +699,12 @@ Page({ @@ -697,9 +699,12 @@ Page({
697 }) 699 })
698 }, 700 },
699 // 点击商家有礼 701 // 点击商家有礼
700 - gotoSellerGift(){  
701 - let url = util.http_build_query({ 702 + gotoSellerGift(e){
  703 + this.couponModal.closeModal()
  704 + const form = e.currentTarget.dataset['form'];
  705 + let url = util.http_build_query({
702 id: this.data.detail.id, 706 id: this.data.detail.id,
  707 + form
703 }, '/pages/reserve/sellerGift') 708 }, '/pages/reserve/sellerGift')
704 wx.navigateTo({ 709 wx.navigateTo({
705 url 710 url
@@ -856,35 +861,173 @@ Page({ @@ -856,35 +861,173 @@ Page({
856 } 861 }
857 }) 862 })
858 }, 863 },
859 - // 根据券ID获取券详情  
860 - getActivityByIdFun(ids, length) {  
861 - let coupon_dataList = [];  
862 - ids.forEach(i => {  
863 - App.Activity.GetActivityById({  
864 - id: i.id  
865 - }).then(res => {  
866 - if (res.data.length > 0) {  
867 - let detail = res.data[0];  
868 - detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';  
869 - detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';  
870 - detail.use = detail.use ? util.determine(detail.use) : '';  
871 - if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {  
872 - let cash = detail.use.cash * 1;  
873 - let price = detail.price * 1;  
874 - detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
875 - }  
876 - coupon_dataList.push(detail);  
877 - if (length === coupon_dataList.length) {  
878 - coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})  
879 - console.log('邀请函--------------------优惠券',coupon_dataList);  
880 - this.setData({  
881 - coupon_dataList,  
882 - })  
883 - }  
884 - }  
885 - })  
886 - })  
887 - }, 864 + // 根据券ID获取券详情
  865 + getActivityByIdFun(obj) {
  866 + App.Activity.GetActivityById({
  867 + id: obj.map(item => item.id).join(','),
  868 + }).then(res => {
  869 + if (res.data.length > 0) {
  870 + let list = res.data.filter(item => {
  871 + return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
  872 + })
  873 + list.forEach(detail => {
  874 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  875 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  876 + detail.arule = detail.arule ? util.determine(detail.arule) : '';
  877 + detail.use = detail.use ? util.determine(detail.use) : '';
  878 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  879 + let cash = detail.use.cash * 1;
  880 + let price = detail.price * 1;
  881 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  882 + }
  883 + let num = detail.receiveNum;
  884 + if (num > 0) {
  885 + detail.receiveNumText = ''
  886 + if (num >= 0 && num <= 100) {
  887 + detail.receiveNumText = num.toString();
  888 + } else if (num >= 101 && num <= 199) {
  889 + detail.receiveNumText = '100+';
  890 + } else if (num >= 200 && num <= 299) {
  891 + detail.receiveNumText = '200+';
  892 + } else {
  893 + detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
  894 + }
  895 + }
  896 + if (detail.exp_date && detail.exp_date.week_data) {
  897 + let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
  898 + let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
  899 + if (noon) noon = '午餐:' + noon
  900 + if (nig) nig = '晚餐:' + nig
  901 + detail.noonText = noon;
  902 + detail.nigText = nig;
  903 + }
  904 + })
  905 + let freeCoupons = list.filter(item => {
  906 + return item.is_type == '3'
  907 + })
  908 + // 免费券判断是否领取,弹框领取
  909 + if (freeCoupons.length > 0) {
  910 + let length = freeCoupons.length - 1
  911 + freeCoupons.forEach(i => {
  912 + this.getCoupon(i, freeCoupons[length].id, obj)
  913 + })
  914 + }
  915 + console.log('邀请函--------------------优惠券', list);
  916 + this.setData({
  917 + coupon_dataList: list,
  918 + })
  919 + }
  920 + })
  921 + },
  922 + // 获取所有的券并且展示
  923 + addCoupons(coupons, couponList) {
  924 + if (coupons && util.getType(coupons) == 'object') {
  925 + couponList.push({
  926 + id: coupon.id,
  927 + number: coupon.number
  928 + });
  929 + }
  930 + if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
  931 + coupons.forEach(item => {
  932 + couponList.push({
  933 + id: item.id,
  934 + number: item.number
  935 + });
  936 + });
  937 + }
  938 + return couponList
  939 + },
  940 + // 弹框领取免费券
  941 + setcouponFun(arr) {
  942 + let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
  943 + console.log('弹框领取免费券id', str);
  944 + App.Activity.SetActivityAsReserve({
  945 + aid: str,
  946 + rid: this.id,
  947 + }).then((json) => {
  948 + if (json.ret != 200) {
  949 + wx.showToast({
  950 + title: res.msg,
  951 + duration: 2000,
  952 + mask: true
  953 + })
  954 + }
  955 + })
  956 + },
  957 + // 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
  958 + getCoupon(item, id, obj) {
  959 + let couponArr = this.data.couponArr;
  960 + let totalPrice = this.data.totalPrice;
  961 + App.Activity.ActivityListByOpenid({
  962 + aid: item.id
  963 + }).then(res => {
  964 + if (res.ret == 200) {
  965 + if (res.data.length == 0) {
  966 + couponArr.push(item)
  967 + }
  968 + if (item.id == id && couponArr.length > 0) {
  969 + couponArr.forEach(item => {
  970 + let match = obj.find(b => b.id === item.id);
  971 + if (match) {
  972 + item.number = match.number;
  973 + }
  974 + });
  975 + totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
  976 + this.setcouponFun(couponArr)
  977 + this.couponModal.showModal()
  978 + }
  979 + console.log('未领取的券列表-----------', couponArr);
  980 + this.setData({
  981 + couponArr,
  982 + totalPrice
  983 + })
  984 + }
  985 + })
  986 + },
  987 + // 处理优惠券不可用日期数据
  988 + hasConsecutiveSelect(arr, type) {
  989 + let firstTitle = null;
  990 + let lastTitle = null;
  991 + let rArr = []
  992 + let num = 0
  993 + for (let i = 0; i < arr.length; i++) {
  994 + let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
  995 + if (str) {
  996 + rArr.push(arr[i].title)
  997 + num++
  998 + if (num == 1) {
  999 + firstTitle = arr[i].title
  1000 + }
  1001 + if (num >= 5) {
  1002 + lastTitle = arr[i].title
  1003 + }
  1004 + if (num >= 5 && i >= (arr.length - 1)) {
  1005 + let fi = rArr.findIndex((item) => {
  1006 + return item == firstTitle
  1007 + })
  1008 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1009 + num = 0
  1010 + }
  1011 + } else {
  1012 + if (num < 5) {
  1013 + num = 0
  1014 + firstTitle = null;
  1015 + lastTitle = null;
  1016 + } else {
  1017 + let fi = rArr.findIndex((item) => {
  1018 + return item == firstTitle
  1019 + })
  1020 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1021 + num = 0
  1022 + }
  1023 + }
  1024 + }
  1025 + return {
  1026 + rArr,
  1027 + lastTitle,
  1028 + firstTitle
  1029 + };
  1030 + },
888 /** 1031 /**
889 * 生命周期函数--监听页面隐藏 1032 * 生命周期函数--监听页面隐藏
890 */ 1033 */
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 /> 11 />
12 <image class="giftImg" 12 <image class="giftImg"
13 bindtap="gotoSellerGift" 13 bindtap="gotoSellerGift"
  14 + data-form="1"
14 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}" 15 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}"
15 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/> 16 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
16 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" /> 17 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
@@ -85,29 +86,49 @@ @@ -85,29 +86,49 @@
85 </button> 86 </button>
86 </view> 87 </view>
87 </view> 88 </view>
88 - <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}"> 89 + <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
89 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> 90 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
90 - <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"> 91 + <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">
91 <view class="preferentialItems"> 92 <view class="preferentialItems">
92 <view class="itemLeft"> 93 <view class="itemLeft">
93 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> 94 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
  95 + <view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
94 <view class="priceText" wx:if="{{item.price}}"> 96 <view class="priceText" wx:if="{{item.price}}">
95 - <view class="icons font40r">¥</view>{{item.price}} 97 + <view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
96 </view> 98 </view>
  99 + <view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
97 </view> 100 </view>
  101 + <view class="couponLine"></view>
98 <view class="itemRight"> 102 <view class="itemRight">
99 <view class="btns"> 103 <view class="btns">
100 <text class="font40r">{{item.aname}}</text> 104 <text class="font40r">{{item.aname}}</text>
101 - <view class="font24r orderingFood">  
102 - 抢购  
103 - </view> 105 + <block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
  106 + <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</view>
  107 + <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
  108 + 无限制{{item.desc?','+item.desc+'。':'。'}}
  109 + </view>
  110 + <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
  111 + 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
  112 + </view>
  113 + </block>
  114 + <block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
  115 + <view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
  116 + <view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
  117 + <view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
  118 + <view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
  119 + <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
  120 + <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
  121 + </block>
104 </view> 122 </view>
105 - <text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</text>  
106 - <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">  
107 - 无限制{{item.desc?','+item.desc+'。':'。'}} 123 + <view class="btnBox" wx:if="{{item.is_type == '3'}}" >
  124 + <view class="font24r orderingFood orderingFood1">已领取</view>
  125 + <view class="grantNum" wx:if="{{item.receiveNumText}}">
  126 + <view class="font24r">已被领取</view>
  127 + <view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
  128 + </view>
108 </view> 129 </view>
109 - <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">  
110 - 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}} 130 + <view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
  131 + 立即抢购
111 </view> 132 </view>
112 </view> 133 </view>
113 </view> 134 </view>
@@ -326,4 +347,24 @@ @@ -326,4 +347,24 @@
326 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button> 347 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
327 </view> 348 </view>
328 </view> 349 </view>
  350 +</my-modal>
  351 +<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
  352 + <view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
  353 + <image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
  354 + <view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
  355 + <view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
  356 + </view>
  357 + <view slot="modalContent">
  358 + <view class="couponBox">
  359 + <view wx:for="{{couponArr}}" class="couponItems">
  360 + <view class="couponNum font20r">×{{item.number}}</view>
  361 + <view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
  362 + <view class="couponLines"></view>
  363 + <view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
  364 + <view class="font28r couponCondition" wx:else>无门槛</view>
  365 + </view>
  366 + </view>
  367 + <view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
  368 + <view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
  369 + </view>
329 </my-modal> 370 </my-modal>
@@ -264,7 +264,7 @@ @@ -264,7 +264,7 @@
264 264
265 /* 优惠券开始 */ 265 /* 优惠券开始 */
266 .preferentialCoupon { 266 .preferentialCoupon {
267 - padding: 60rpx 40rpx 0 40rpx; 267 + padding: 40rpx 40rpx 0 40rpx;
268 } 268 }
269 269
270 .orderingFood { 270 .orderingFood {
@@ -281,13 +281,114 @@ @@ -281,13 +281,114 @@
281 flex-shrink: 0; 281 flex-shrink: 0;
282 } 282 }
283 283
  284 +.preferentialCoupon .itemRight {
  285 + width: 74%;
  286 + display: flex;
  287 + align-items: center;
  288 +}
  289 +
  290 +.preferentialCoupon .itemLeft {
  291 + width: 26%;
  292 +}
  293 +
  294 +.preferentialCoupon .couponLine{
  295 + margin: 24rpx 0;
  296 + border-right: 2rpx dashed #f6231b;
  297 +}
  298 +
  299 +.preferentialCoupon .orderingFood {
  300 + padding: 0 20rpx;
  301 + color: #fff !important;
  302 + border: none !important;
  303 + text-align: center;
  304 + border-radius: 20rpx;
  305 + line-height: 44rpx;
  306 + height: 44rpx;
  307 + width: max-content;
  308 + flex-shrink: 0;
  309 + background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
  310 +}
  311 +.preferentialCoupon .icons {
  312 + color: #F6231B;
  313 + text-align: center;
  314 +}
  315 +
  316 +.preferentialCoupon .priceText {
  317 + display: flex;
  318 + align-items: baseline;
  319 + justify-content: center;
  320 + font-family: PingFang SC;
  321 + color: #F6231B;
  322 + font-weight: 600;
  323 + font-size: 48rpx;
  324 + margin-top: 6rpx;
  325 +}
  326 +
  327 +.preferentialCoupon .priceText text {
  328 + font-size: 48rpx;
  329 +}
  330 +
  331 +.preferentialCoupon .btns {
  332 + flex: 1;
  333 +}
  334 +.preferentialCoupon .btnBox {
  335 + display: flex;
  336 + flex-direction: column;
  337 +}
  338 +
  339 +.preferentialCoupon .grantNum {
  340 + display: flex;
  341 + flex-direction: column;
  342 + align-items: center;
  343 + color: #C36607;
  344 + margin-top: 10rpx;
  345 +}
  346 +
  347 +.preferentialCoupon .grantNum text {
  348 + color: #F6231B;
  349 + margin-right: 10rpx;
  350 +}
  351 +
  352 +.preferentialCoupon .btns text {
  353 + font-weight: 600;
  354 +}
  355 +
  356 +.preferentialCoupon .orderingFood1 {
  357 + border: 2rpx solid #fa4b20 !important;
  358 + background: transparent !important;
  359 + color: #fa4b20 !important;
  360 +}
  361 +
  362 +.preferentialCoupon .btns text {
  363 + color: #0B0805 !important;
  364 +}
  365 +
  366 +.preferentialCoupon .bottom {
  367 + margin-top: 4rpx;
  368 + width: 100%;
  369 + color: #C36607 !important;
  370 + font-family: PingFang SC;
  371 + font-weight: 500;
  372 + display: -webkit-box;
  373 + word-break: break-all;
  374 + word-wrap: break-word;
  375 + overflow: hidden;
  376 + text-align: left;
  377 +}
  378 +
  379 +.preferentialCoupon .nodate{
  380 + margin-left: 20rpx;
  381 +}
  382 +
284 .preferentialItems { 383 .preferentialItems {
285 display: flex; 384 display: flex;
286 - background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat; 385 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
287 background-size: 100% 100%; 386 background-size: 100% 100%;
288 margin-bottom: 20rpx; 387 margin-bottom: 20rpx;
289 min-height: 160rpx; 388 min-height: 160rpx;
290 padding-bottom: 10rpx; 389 padding-bottom: 10rpx;
  390 + border-radius: 20rpx;
  391 + border: 2rpx solid #ff7e06;
291 } 392 }
292 393
293 .rechargeItems { 394 .rechargeItems {
@@ -300,6 +401,7 @@ @@ -300,6 +401,7 @@
300 height: auto; 401 height: auto;
301 padding: 12rpx 0; 402 padding: 12rpx 0;
302 margin: 0 20rpx; 403 margin: 0 20rpx;
  404 + border: none;
303 } 405 }
304 406
305 .rechargeItems .orderingFood { 407 .rechargeItems .orderingFood {
@@ -341,6 +443,20 @@ @@ -341,6 +443,20 @@
341 top: 12rpx; 443 top: 12rpx;
342 } 444 }
343 445
  446 +.discountText1{
  447 + text-align: center;
  448 + color: #FD4D59;
  449 + border: 2rpx solid #FD4D59;
  450 + border-radius: 6rpx;
  451 + font-family: PingFang SC;
  452 + background: transparent;
  453 + width: max-content;
  454 + padding: 0 6rpx;
  455 + position: absolute;
  456 + left: 16rpx;
  457 + top: 12rpx;
  458 +}
  459 +
344 .famousChefBox .labelBox, 460 .famousChefBox .labelBox,
345 .stopBox .labelBox { 461 .stopBox .labelBox {
346 border-bottom: none; 462 border-bottom: none;
@@ -433,9 +549,7 @@ @@ -433,9 +549,7 @@
433 } 549 }
434 550
435 .priceText .icons { 551 .priceText .icons {
436 - font-family: 'Abel';  
437 color: #FD4D59; 552 color: #FD4D59;
438 - font-size: 40rpx;  
439 } 553 }
440 554
441 .itemRight { 555 .itemRight {
@@ -449,10 +563,7 @@ @@ -449,10 +563,7 @@
449 display: flex; 563 display: flex;
450 justify-content: space-between; 564 justify-content: space-between;
451 align-items: baseline; 565 align-items: baseline;
452 -}  
453 -  
454 -.btns text {  
455 - color: #0B0805; 566 + flex-direction: column;
456 } 567 }
457 568
458 .priceText { 569 .priceText {
@@ -709,6 +820,145 @@ @@ -709,6 +820,145 @@
709 box-sizing: border-box; 820 box-sizing: border-box;
710 } 821 }
711 822
  823 +#couponModal .titleModal {
  824 + margin-top: 30%;
  825 + position: relative;
  826 +}
  827 +
  828 +#couponModal .titleModal2 {
  829 + margin-top: 80%;
  830 +}
  831 +
  832 +#couponModal .titleModal3 {
  833 + margin-top: 60%;
  834 +}
  835 +
  836 +#couponModal .titleModal4 {
  837 + margin-top: 30%;
  838 +}
  839 +
  840 +#couponModal .mymodal {
  841 + background: rgba(0, 0, 0, 0.8);
  842 + width: 100% !important;
  843 + top: 0 !important;
  844 + height: auto !important;
  845 + z-index: 300;
  846 +}
  847 +
  848 +.nameInfo {
  849 + font-family: PingFang SC;
  850 + font-weight: 400;
  851 + font-size: 52rpx;
  852 + line-height: 56rpx;
  853 + color: #fff;
  854 + margin-bottom: 40rpx;
  855 + padding-top: 60rpx;
  856 +}
  857 +
  858 +.couponTotal {
  859 + color: #dfdfdf;
  860 + font-family: PingFang SC;
  861 + font-weight: 400;
  862 + font-size: 40rpx;
  863 + line-height: 48rpx;
  864 + margin-bottom: 40rpx;
  865 + display: flex;
  866 + align-items: center;
  867 + justify-content: center;
  868 +}
  869 +
  870 +.couponTotal text {
  871 + color: #ffc806;
  872 + font-weight: 600;
  873 + font-size: 80rpx;
  874 + margin: 0 14rpx;
  875 +}
  876 +
  877 +.couponBox {
  878 + width: 80%;
  879 + margin: 0 auto;
  880 + display: flex;
  881 + flex-wrap: wrap;
  882 + justify-content: space-evenly;
  883 +}
  884 +
  885 +.couponItems {
  886 + width: 46%;
  887 + margin-bottom: 24rpx;
  888 + padding-bottom: 52rpx;
  889 + border-radius: 20rpx;
  890 + border: 2rpx solid #ff7e06;
  891 + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
  892 +}
  893 +
  894 +.couponNum {
  895 + background: #727272;
  896 + border-radius: 50%;
  897 + color: #fff;
  898 + width: 40rpx;
  899 + height: 40rpx;
  900 + display: flex;
  901 + align-items: center;
  902 + justify-content: center;
  903 + margin: 8rpx 0 0 8rpx;
  904 +}
  905 +
  906 +.couponPrice {
  907 + display: flex;
  908 + align-items: center;
  909 + justify-content: center;
  910 + color: #F6231B;
  911 + font-weight: 500;
  912 +}
  913 +
  914 +.couponLines{
  915 + width: 80%;
  916 + margin: 0 auto;
  917 + height: 2rpx;
  918 + border-bottom: 2rpx dashed #F6231B;
  919 +}
  920 +
  921 +.couponPrice text {
  922 + margin-left: 4rpx;
  923 + font-size: 76rpx;
  924 + font-weight: 700;
  925 +}
  926 +
  927 +.couponCondition {
  928 + color: #C36607;
  929 + display: flex;
  930 + align-items: center;
  931 + justify-content: center;
  932 + padding-top: 24rpx;
  933 +}
  934 +
  935 +.couponBtn {
  936 + width: 80%;
  937 + margin: 0 auto;
  938 + border-radius: 42rpx;
  939 + background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
  940 + font-weight: 400;
  941 + color: #fff;
  942 + text-align: center;
  943 + border: 4rpx solid #fff;
  944 + padding: 12rpx 0;
  945 + margin: 16rpx auto 20rpx auto;
  946 +}
  947 +
  948 +.couponText {
  949 + color: #fff;
  950 + text-decoration: underline;
  951 + text-align: center;
  952 +}
  953 +
  954 +.closeImg {
  955 + width: 60rpx;
  956 + height: 60rpx;
  957 + position: absolute;
  958 + right: 0;
  959 + top: 0;
  960 +}
  961 +
712 /* 深中国红 */ 962 /* 深中国红 */
713 .crimson, 963 .crimson,
714 .crimson .positioningBox { 964 .crimson .positioningBox {
@@ -1041,14 +1291,6 @@ @@ -1041,14 +1291,6 @@
1041 color: #578C69; 1291 color: #578C69;
1042 } 1292 }
1043 1293
1044 -.pearlWhite .preferentialItems {  
1045 - background: url(https://nosqn.colorcun.com/certificateWhiteBj1.png) no-repeat;  
1046 - background-size: 100% 100%;  
1047 - margin-bottom: 20rpx;  
1048 - min-height: 160rpx;  
1049 - padding-bottom: 10rpx;  
1050 -}  
1051 -  
1052 .pearlWhite .rechargeItems { 1294 .pearlWhite .rechargeItems {
1053 background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat; 1295 background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat;
1054 background-size: 100% 100%; 1296 background-size: 100% 100%;
@@ -1117,12 +1359,6 @@ @@ -1117,12 +1359,6 @@
1117 border: none; 1359 border: none;
1118 } 1360 }
1119 1361
1120 -.pearlWhite .discountText {  
1121 - background: transparent;  
1122 - border: 2rpx solid #FD4D59;  
1123 - color: #FD4D59;  
1124 -}  
1125 -  
1126 .toastBox { 1362 .toastBox {
1127 width: fit-content; 1363 width: fit-content;
1128 position: fixed; 1364 position: fixed;
@@ -66,6 +66,7 @@ Page({ @@ -66,6 +66,7 @@ Page({
66 isMoreBtn:'',//再次预订按钮 66 isMoreBtn:'',//再次预订按钮
67 isPaymenBtn:'',//支付定金按钮 67 isPaymenBtn:'',//支付定金按钮
68 isShareItem:'',//转发客人按钮 68 isShareItem:'',//转发客人按钮
  69 + couponArr: [],//待领取的优惠券列表
69 }, 70 },
70 tablestr: '', 71 tablestr: '',
71 urlsValue: [], 72 urlsValue: [],
@@ -75,6 +76,7 @@ Page({ @@ -75,6 +76,7 @@ Page({
75 timers: null, // 动画定时器 76 timers: null, // 动画定时器
76 n: 0, 77 n: 0,
77 modal:'', 78 modal:'',
  79 + couponModal: '',
78 /** 80 /**
79 * 生命周期函数--监听页面加载 81 * 生命周期函数--监听页面加载
80 */ 82 */
@@ -102,6 +104,7 @@ Page({ @@ -102,6 +104,7 @@ Page({
102 wx.onUserCaptureScreen((res)=> { 104 wx.onUserCaptureScreen((res)=> {
103 this.showModal() 105 this.showModal()
104 }) 106 })
  107 + this.couponModal = this.selectComponent("#couponModal");
105 }, 108 },
106 // 打开截屏弹框 109 // 打开截屏弹框
107 showModal() { 110 showModal() {
@@ -111,6 +114,10 @@ Page({ @@ -111,6 +114,10 @@ Page({
111 closeModal() { 114 closeModal() {
112 this.modal.closeModal() 115 this.modal.closeModal()
113 }, 116 },
  117 + // 关闭优惠券弹框
  118 + closeCouponModal() {
  119 + this.couponModal.closeModal()
  120 + },
114 // 页面滚动事件 121 // 页面滚动事件
115 onPageScroll: function (event) { 122 onPageScroll: function (event) {
116 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离 123 const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
@@ -455,9 +462,10 @@ Page({ @@ -455,9 +462,10 @@ Page({
455 uid 462 uid
456 }).then((json) => { 463 }).then((json) => {
457 if (json.ret == 200) { 464 if (json.ret == 200) {
458 - console.log('staffinfostaffinfostaffinfo', json.data) 465 + console.log('客户经理获取基本信息------', json.data)
459 this.setData({ 466 this.setData({
460 - staffinfo: json.data 467 + staffinfo: json.data,
  468 + couponArr:[],
461 }) 469 })
462 this.getSellerTemplateConfFun(sid); 470 this.getSellerTemplateConfFun(sid);
463 } 471 }
@@ -578,7 +586,7 @@ Page({ @@ -578,7 +586,7 @@ Page({
578 let data = res.data 586 let data = res.data
579 console.log('data', data); 587 console.log('data', data);
580 let couponList = [] 588 let couponList = []
581 - let themeColor, StyleType, titleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store; 589 + let themeColor, StyleType, titleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
582 chef = util.determine(data.chef); 590 chef = util.determine(data.chef);
583 reserve = util.determine(data.reserve); 591 reserve = util.determine(data.reserve);
584 marketing = util.determine(data.marketing); 592 marketing = util.determine(data.marketing);
@@ -597,29 +605,23 @@ Page({ @@ -597,29 +605,23 @@ Page({
597 if (marketing) { 605 if (marketing) {
598 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : ''; 606 marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
599 is_comments = marketing.is_comments ? marketing.is_comments : ''; 607 is_comments = marketing.is_comments ? marketing.is_comments : '';
600 - coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : ''; 608 + coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
  609 + coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
  610 + marketing.coupon_data_payList = coupon_data_pay
  611 + coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
  612 + marketing.coupon_data_freeList = coupon_data_free
601 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : ''; 613 let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
602 let couponDataId = info && info.length > 0 ? info[0].id : {} 614 let couponDataId = info && info.length > 0 ? info[0].id : {}
603 // 根据券ID获取评价赠送的券详情 615 // 根据券ID获取评价赠送的券详情
604 if(couponDataId) this.getEvaluateFun(couponDataId) 616 if(couponDataId) this.getEvaluateFun(couponDataId)
605 } 617 }
606 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 618 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
607 - if (coupon && util.getType(coupon) == 'object') {  
608 - couponList.push({  
609 - id: coupon.id  
610 - });  
611 - }  
612 - if (coupon && util.getType(coupon) == 'array') {  
613 - if (coupon.length > 0) {  
614 - coupon.forEach(item => {  
615 - couponList.push({  
616 - id: item.id  
617 - })  
618 - })  
619 - }  
620 - } 619 + // 获取全部的优惠券(商家券、个人券、免费券、付费券)
  620 + couponList = this.addCoupons(coupon,couponList);
  621 + couponList = this.addCoupons(coupon_data_pay,couponList);
  622 + couponList = this.addCoupons(coupon_data_free,couponList);
621 // 根据券ID获取券详情 623 // 根据券ID获取券详情
622 - this.getActivityByIdFun(couponList, couponList.length) 624 + this.getActivityByIdFun(couponList)
623 // 根据充值ID获取充值详情 625 // 根据充值ID获取充值详情
624 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) { 626 if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
625 this.getRechargeDetail(marketing.recharge_data.id) 627 this.getRechargeDetail(marketing.recharge_data.id)
@@ -696,9 +698,12 @@ Page({ @@ -696,9 +698,12 @@ Page({
696 }) 698 })
697 }, 699 },
698 // 点击商家有礼 700 // 点击商家有礼
699 - gotoSellerGift(){  
700 - let url = util.http_build_query({ 701 + gotoSellerGift(e){
  702 + this.couponModal.closeModal()
  703 + const form = e.currentTarget.dataset['form'];
  704 + let url = util.http_build_query({
701 id: this.data.detail.id, 705 id: this.data.detail.id,
  706 + form
702 }, '/pages/reserve/sellerGift') 707 }, '/pages/reserve/sellerGift')
703 wx.navigateTo({ 708 wx.navigateTo({
704 url 709 url
@@ -855,35 +860,173 @@ Page({ @@ -855,35 +860,173 @@ Page({
855 } 860 }
856 }) 861 })
857 }, 862 },
858 - // 根据券ID获取券详情  
859 - getActivityByIdFun(ids, length) {  
860 - let coupon_dataList = [];  
861 - ids.forEach(i => {  
862 - App.Activity.GetActivityById({  
863 - id: i.id  
864 - }).then(res => {  
865 - if (res.data.length > 0) {  
866 - let detail = res.data[0];  
867 - detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';  
868 - detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';  
869 - detail.use = detail.use ? util.determine(detail.use) : '';  
870 - if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {  
871 - let cash = detail.use.cash * 1;  
872 - let price = detail.price * 1;  
873 - detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
874 - }  
875 - coupon_dataList.push(detail);  
876 - if (length === coupon_dataList.length) {  
877 - coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})  
878 - console.log('邀请函--------------------优惠券',coupon_dataList);  
879 - this.setData({  
880 - coupon_dataList,  
881 - })  
882 - }  
883 - }  
884 - })  
885 - })  
886 - }, 863 + // 根据券ID获取券详情
  864 + getActivityByIdFun(obj) {
  865 + App.Activity.GetActivityById({
  866 + id: obj.map(item => item.id).join(','),
  867 + }).then(res => {
  868 + if (res.data.length > 0) {
  869 + let list = res.data.filter(item => {
  870 + return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
  871 + })
  872 + list.forEach(detail => {
  873 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  874 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  875 + detail.arule = detail.arule ? util.determine(detail.arule) : '';
  876 + detail.use = detail.use ? util.determine(detail.use) : '';
  877 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  878 + let cash = detail.use.cash * 1;
  879 + let price = detail.price * 1;
  880 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  881 + }
  882 + let num = detail.receiveNum;
  883 + if (num > 0) {
  884 + detail.receiveNumText = ''
  885 + if (num >= 0 && num <= 100) {
  886 + detail.receiveNumText = num.toString();
  887 + } else if (num >= 101 && num <= 199) {
  888 + detail.receiveNumText = '100+';
  889 + } else if (num >= 200 && num <= 299) {
  890 + detail.receiveNumText = '200+';
  891 + } else {
  892 + detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
  893 + }
  894 + }
  895 + if (detail.exp_date && detail.exp_date.week_data) {
  896 + let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
  897 + let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
  898 + if (noon) noon = '午餐:' + noon
  899 + if (nig) nig = '晚餐:' + nig
  900 + detail.noonText = noon;
  901 + detail.nigText = nig;
  902 + }
  903 + })
  904 + let freeCoupons = list.filter(item => {
  905 + return item.is_type == '3'
  906 + })
  907 + // 免费券判断是否领取,弹框领取
  908 + if (freeCoupons.length > 0) {
  909 + let length = freeCoupons.length - 1
  910 + freeCoupons.forEach(i => {
  911 + this.getCoupon(i, freeCoupons[length].id, obj)
  912 + })
  913 + }
  914 + console.log('邀请函--------------------优惠券', list);
  915 + this.setData({
  916 + coupon_dataList: list,
  917 + })
  918 + }
  919 + })
  920 + },
  921 + // 获取所有的券并且展示
  922 + addCoupons(coupons, couponList) {
  923 + if (coupons && util.getType(coupons) == 'object') {
  924 + couponList.push({
  925 + id: coupon.id,
  926 + number: coupon.number
  927 + });
  928 + }
  929 + if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
  930 + coupons.forEach(item => {
  931 + couponList.push({
  932 + id: item.id,
  933 + number: item.number
  934 + });
  935 + });
  936 + }
  937 + return couponList
  938 + },
  939 + // 弹框领取免费券
  940 + setcouponFun(arr) {
  941 + let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
  942 + console.log('弹框领取免费券id', str);
  943 + App.Activity.SetActivityAsReserve({
  944 + aid: str,
  945 + rid: this.id,
  946 + }).then((json) => {
  947 + if (json.ret != 200) {
  948 + wx.showToast({
  949 + title: res.msg,
  950 + duration: 2000,
  951 + mask: true
  952 + })
  953 + }
  954 + })
  955 + },
  956 + // 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
  957 + getCoupon(item, id, obj) {
  958 + let couponArr = this.data.couponArr;
  959 + let totalPrice = this.data.totalPrice;
  960 + App.Activity.ActivityListByOpenid({
  961 + aid: item.id
  962 + }).then(res => {
  963 + if (res.ret == 200) {
  964 + if (res.data.length == 0) {
  965 + couponArr.push(item)
  966 + }
  967 + if (item.id == id && couponArr.length > 0) {
  968 + couponArr.forEach(item => {
  969 + let match = obj.find(b => b.id === item.id);
  970 + if (match) {
  971 + item.number = match.number;
  972 + }
  973 + });
  974 + totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
  975 + this.setcouponFun(couponArr)
  976 + this.couponModal.showModal()
  977 + }
  978 + console.log('未领取的券列表-----------', couponArr);
  979 + this.setData({
  980 + couponArr,
  981 + totalPrice
  982 + })
  983 + }
  984 + })
  985 + },
  986 + // 处理优惠券不可用日期数据
  987 + hasConsecutiveSelect(arr, type) {
  988 + let firstTitle = null;
  989 + let lastTitle = null;
  990 + let rArr = []
  991 + let num = 0
  992 + for (let i = 0; i < arr.length; i++) {
  993 + let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
  994 + if (str) {
  995 + rArr.push(arr[i].title)
  996 + num++
  997 + if (num == 1) {
  998 + firstTitle = arr[i].title
  999 + }
  1000 + if (num >= 5) {
  1001 + lastTitle = arr[i].title
  1002 + }
  1003 + if (num >= 5 && i >= (arr.length - 1)) {
  1004 + let fi = rArr.findIndex((item) => {
  1005 + return item == firstTitle
  1006 + })
  1007 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1008 + num = 0
  1009 + }
  1010 + } else {
  1011 + if (num < 5) {
  1012 + num = 0
  1013 + firstTitle = null;
  1014 + lastTitle = null;
  1015 + } else {
  1016 + let fi = rArr.findIndex((item) => {
  1017 + return item == firstTitle
  1018 + })
  1019 + rArr.splice(fi, num, firstTitle + '至' + lastTitle)
  1020 + num = 0
  1021 + }
  1022 + }
  1023 + }
  1024 + return {
  1025 + rArr,
  1026 + lastTitle,
  1027 + firstTitle
  1028 + };
  1029 + },
887 /** 1030 /**
888 * 生命周期函数--监听页面隐藏 1031 * 生命周期函数--监听页面隐藏
889 */ 1032 */
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 /> 11 />
12 <image class="giftImg" 12 <image class="giftImg"
13 bindtap="gotoSellerGift" 13 bindtap="gotoSellerGift"
  14 + data-form="1"
14 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}" 15 wx:if="{{(hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}"
15 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/> 16 src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
16 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" /> 17 <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
@@ -82,29 +83,49 @@ @@ -82,29 +83,49 @@
82 </button> 83 </button>
83 </view> 84 </view>
84 </view> 85 </view>
85 - <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}"> 86 + <view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
86 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> 87 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
87 - <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"> 88 + <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">
88 <view class="preferentialItems"> 89 <view class="preferentialItems">
89 <view class="itemLeft"> 90 <view class="itemLeft">
90 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> 91 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
  92 + <view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
91 <view class="priceText" wx:if="{{item.price}}"> 93 <view class="priceText" wx:if="{{item.price}}">
92 - <view class="icons font40r">¥</view>{{item.price}} 94 + <view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
93 </view> 95 </view>
  96 + <view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
94 </view> 97 </view>
  98 + <view class="couponLine"></view>
95 <view class="itemRight"> 99 <view class="itemRight">
96 <view class="btns"> 100 <view class="btns">
97 <text class="font40r">{{item.aname}}</text> 101 <text class="font40r">{{item.aname}}</text>
98 - <view class="font24r orderingFood">  
99 - 抢购  
100 - </view> 102 + <block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
  103 + <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</view>
  104 + <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
  105 + 无限制{{item.desc?','+item.desc+'。':'。'}}
  106 + </view>
  107 + <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
  108 + 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
  109 + </view>
  110 + </block>
  111 + <block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
  112 + <view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
  113 + <view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
  114 + <view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
  115 + <view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
  116 + <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
  117 + <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
  118 + </block>
101 </view> 119 </view>
102 - <text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</text>  
103 - <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">  
104 - 无限制{{item.desc?','+item.desc+'。':'。'}} 120 + <view class="btnBox" wx:if="{{item.is_type == '3'}}" >
  121 + <view class="font24r orderingFood orderingFood1">已领取</view>
  122 + <view class="grantNum" wx:if="{{item.receiveNumText}}">
  123 + <view class="font24r">已被领取</view>
  124 + <view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
  125 + </view>
105 </view> 126 </view>
106 - <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">  
107 - 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}} 127 + <view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
  128 + 立即抢购
108 </view> 129 </view>
109 </view> 130 </view>
110 </view> 131 </view>
@@ -324,4 +345,25 @@ @@ -324,4 +345,25 @@
324 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button> 345 <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
325 </view> 346 </view>
326 </view> 347 </view>
  348 +</my-modal>
  349 +
  350 +<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
  351 + <view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
  352 + <image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
  353 + <view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
  354 + <view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
  355 + </view>
  356 + <view slot="modalContent">
  357 + <view class="couponBox">
  358 + <view wx:for="{{couponArr}}" class="couponItems">
  359 + <view class="couponNum font20r">×{{item.number}}</view>
  360 + <view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
  361 + <view class="couponLines"></view>
  362 + <view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
  363 + <view class="font28r couponCondition" wx:else>无门槛</view>
  364 + </view>
  365 + </view>
  366 + <view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
  367 + <view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
  368 + </view>
327 </my-modal> 369 </my-modal>