Commit 384f643dedf2ef48879e51b65779c6b63f147dc2
1 parent
b7909fb4
新增付费券、免费券(商家详情页、商家有礼页、付费券详情、免费券详情)
Showing
13 changed files
with
1336 additions
and
139 deletions
| @@ -27,13 +27,16 @@ | @@ -27,13 +27,16 @@ | ||
| 27 | {{use.dish}} | 27 | {{use.dish}} |
| 28 | </text> | 28 | </text> |
| 29 | </view> | 29 | </view> |
| 30 | - <view class="info"> | 30 | + <view class="info" wx:if="{{detail.desc && detail.desc!='0'}}"> |
| 31 | <view class="info_left font32r"> | 31 | <view class="info_left font32r"> |
| 32 | 券要求 | 32 | 券要求 |
| 33 | </view> | 33 | </view> |
| 34 | - <view class="info_right text_info font32r"> | 34 | + <view wx:if="{{detail.is_type == '1' || detail.is_type == '2'}}" class="info_right text_info font32r"> |
| 35 | {{detail.desc}} | 35 | {{detail.desc}} |
| 36 | </view> | 36 | </view> |
| 37 | + <view wx:else class="info_right text_info font32r"> | ||
| 38 | + 消费满{{detail.desc}}元可用 | ||
| 39 | + </view> | ||
| 37 | </view> | 40 | </view> |
| 38 | <view class="info"> | 41 | <view class="info"> |
| 39 | <view class="info_left font32r"> | 42 | <view class="info_left font32r"> |
| @@ -53,21 +56,26 @@ | @@ -53,21 +56,26 @@ | ||
| 53 | </view> | 56 | </view> |
| 54 | <view class="info info2"> | 57 | <view class="info info2"> |
| 55 | <view class="info_left font32r"> | 58 | <view class="info_left font32r"> |
| 56 | - 使用限制: | ||
| 57 | - </view> | ||
| 58 | - <view wx:if="{{exp_date.is_none=='1' || exp_date.is_none===true}}" class="info_right text_info font32r" > | ||
| 59 | - 无限制 | ||
| 60 | - </view> | ||
| 61 | - <view wx:if="{{exp_date.is_week=='1' || exp_date.is_week===true}}" class="info_right text_info font32r" > | ||
| 62 | - 每周指定日期可用 | ||
| 63 | - </view> | ||
| 64 | - <view wx:if="{{exp_date.is_birthday=='1' || exp_date.is_birthday===true}}" class="info_right text_info font32r" > | ||
| 65 | - 会员生日当天 | ||
| 66 | - </view> | 59 | + {{(detail.is_type == '1' || detail.is_type == '2' || exp_date.week_show=='无') ? '使用限制:' : '不可用日期:'}} |
| 60 | + </view> | ||
| 61 | + <block wx:if="{{detail.is_type == '1' || detail.is_type == '2'}}"> | ||
| 62 | + <view wx:if="{{exp_date.is_none=='1' || exp_date.is_none===true}}" class="info_right text_info font32r" > | ||
| 63 | + 无限制 | ||
| 64 | + </view> | ||
| 65 | + <view wx:if="{{exp_date.is_week=='1' || exp_date.is_week===true}}" class="info_right text_info font32r" > | ||
| 66 | + 每周指定日期可用 | ||
| 67 | + </view> | ||
| 68 | + <text wx:if="{{exp_date.is_week=='1' || exp_date.is_week===true}}" class="info info_right text_info font32r text_info1" > | ||
| 69 | + {{exp_date.week_show?exp_date.week_show:''}} | ||
| 70 | + </text> | ||
| 71 | + <view wx:if="{{exp_date.is_birthday=='1' || exp_date.is_birthday===true}}" class="info_right text_info font32r" > | ||
| 72 | + 会员生日当天 | ||
| 73 | + </view> | ||
| 74 | + </block> | ||
| 75 | + <block wx:if="{{detail.is_type == '3' || detail.is_type == '4'}}"> | ||
| 76 | + <text wx:if="{{exp_date.week_show}}" class="info_right text_info font32r" >{{exp_date.week_show!='无'?exp_date.week_show:'无使用时间限制'}}</text> | ||
| 77 | + </block> | ||
| 67 | </view> | 78 | </view> |
| 68 | - <text wx:if="{{exp_date.is_week=='1' || exp_date.is_week===true}}" class="info info_right text_info font32r text_info1" > | ||
| 69 | - {{exp_date.week_show?exp_date.week_show:''}} | ||
| 70 | - </text> | ||
| 71 | <!-- is_type 1店铺优惠券 需要判断优惠券剩余数量 2个人优惠券不需要判断数量 --> | 79 | <!-- is_type 1店铺优惠券 需要判断优惠券剩余数量 2个人优惠券不需要判断数量 --> |
| 72 | <view class="info" wx:if="{{detail.grant_last && detail.grant_last>0 && detail.is_type=='1'}}"> | 80 | <view class="info" wx:if="{{detail.grant_last && detail.grant_last>0 && detail.is_type=='1'}}"> |
| 73 | <view class="info_left font32r"> | 81 | <view class="info_left font32r"> |
| 1 | +// pack-activity/pack/receiveCoupon.js | ||
| 2 | +import util from '../../utils/util'; | ||
| 3 | +import App from '../../utils/api'; | ||
| 4 | +Page({ | ||
| 5 | + | ||
| 6 | + /** | ||
| 7 | + * 页面的初始数据 | ||
| 8 | + */ | ||
| 9 | + data: { | ||
| 10 | + opt: {}, | ||
| 11 | + dataStr: Date.now() * 1 / 1000, | ||
| 12 | + detail: {}, | ||
| 13 | + exp_date: {}, | ||
| 14 | + resultCoupon: '', //0未领取 1已领取 | ||
| 15 | + }, | ||
| 16 | + /** | ||
| 17 | + * 生命周期函数--监听页面加载 | ||
| 18 | + */ | ||
| 19 | + onLoad(options) { | ||
| 20 | + console.log('options', options); | ||
| 21 | + var obj = {}; | ||
| 22 | + if (options.scene) { | ||
| 23 | + let scene = decodeURIComponent(options.scene); | ||
| 24 | + console.log('scene', scene); | ||
| 25 | + for (var i = 0; i < scene.split('&').length; i++) { | ||
| 26 | + var arr = scene.split('&')[i].split('='); | ||
| 27 | + obj[arr[0]] = arr[1]; | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + console.log('obj', { | ||
| 31 | + ...obj | ||
| 32 | + }); | ||
| 33 | + this.setData({ | ||
| 34 | + opt: { | ||
| 35 | + id: options.id || obj.id, | ||
| 36 | + sid: options.sid || obj.sid, | ||
| 37 | + oid: options.oid, | ||
| 38 | + types: options.types || obj.types, //1是邀请函过来的(邀请函的券或者点击意见反馈买券) 2是提前点餐 3是商家APP分享的或者短信的链接 | ||
| 39 | + rid: options.rid ? options.rid : '', | ||
| 40 | + } | ||
| 41 | + }) | ||
| 42 | + console.log('opt', { | ||
| 43 | + ...this.data.opt | ||
| 44 | + }); | ||
| 45 | + }, | ||
| 46 | + // 购买完成券之后关注公众号 | ||
| 47 | + wananchi() { | ||
| 48 | + wx.navigateTo({ | ||
| 49 | + url: '/pages/me/wananchi' | ||
| 50 | + }) | ||
| 51 | + }, | ||
| 52 | + // 提交订单 | ||
| 53 | + submitOrder: util.throttle(function () { | ||
| 54 | + if (this.data.dataStr > (this.data.detail.etime * 1)) { | ||
| 55 | + return wx.showToast({ | ||
| 56 | + title: '优惠券已过期,不可购买!', | ||
| 57 | + duration: 2000, | ||
| 58 | + mask: true, | ||
| 59 | + icon: 'none' | ||
| 60 | + }) | ||
| 61 | + } | ||
| 62 | + // is_type 1店铺优惠券 需要判断优惠券剩余数量 2个人优惠券不需要判断数量 3免费券 4付费券 | ||
| 63 | + if (this.data.detail.grant_last == '0' && this.data.detail.is_type == '3') { | ||
| 64 | + return wx.showToast({ | ||
| 65 | + title: '您来晚了,当前优惠券已经售罄,请与商家联系!', | ||
| 66 | + duration: 2000, | ||
| 67 | + mask: true, | ||
| 68 | + icon: 'none' | ||
| 69 | + }) | ||
| 70 | + } | ||
| 71 | + let detail = this.data.detail | ||
| 72 | + detail.name = this.data.sellername; | ||
| 73 | + detail.oid = this.data.opt.oid; | ||
| 74 | + App.Activity.SetActivityAsReserve({ | ||
| 75 | + aid: this.data.opt.id, | ||
| 76 | + rid: this.data.opt.oid, | ||
| 77 | + }).then((json) => { | ||
| 78 | + if (json.ret == 200) { | ||
| 79 | + util.toast('领取成功', 'none'); | ||
| 80 | + } else { | ||
| 81 | + wx.showToast({ | ||
| 82 | + title: res.msg, | ||
| 83 | + duration: 2000, | ||
| 84 | + mask: true | ||
| 85 | + }) | ||
| 86 | + } | ||
| 87 | + }) | ||
| 88 | + }, 3000), | ||
| 89 | + // 获取券信息 | ||
| 90 | + getDetail() { | ||
| 91 | + App.Activity.GetActivityById({ | ||
| 92 | + id: this.data.opt.id | ||
| 93 | + }).then(res => { | ||
| 94 | + if (res.data.length > 0) { | ||
| 95 | + let detail = res.data[0]; | ||
| 96 | + let exp_date = util.determine(detail.exp_date); | ||
| 97 | + detail.arule = detail.arule ? util.determine(detail.arule) : ''; | ||
| 98 | + if (exp_date && exp_date.week_data) { | ||
| 99 | + let noon = this.hasConsecutiveSelect(exp_date.week_data, '1').rArr.join('、') | ||
| 100 | + let nig = this.hasConsecutiveSelect(exp_date.week_data, '2').rArr.join('、') | ||
| 101 | + if (noon) noon = '午餐:' + noon | ||
| 102 | + if (nig) nig = '晚餐:' + nig | ||
| 103 | + detail.noonText = noon; | ||
| 104 | + detail.nigText = nig; | ||
| 105 | + } | ||
| 106 | + if (detail.arule && detail.arule.is_share_lose == '0') { | ||
| 107 | + wx.hideShareMenu() | ||
| 108 | + } | ||
| 109 | + this.setData({ | ||
| 110 | + detail, | ||
| 111 | + exp_date, | ||
| 112 | + }) | ||
| 113 | + } | ||
| 114 | + }) | ||
| 115 | + }, | ||
| 116 | + // 获取店铺名称 | ||
| 117 | + getSellerDetail() { | ||
| 118 | + App.Customer.GetSellerDetail({ | ||
| 119 | + sid: this.data.opt.sid | ||
| 120 | + }).then(res => { | ||
| 121 | + this.setData({ | ||
| 122 | + sellername: res.data.sellername | ||
| 123 | + }) | ||
| 124 | + }) | ||
| 125 | + }, | ||
| 126 | + // 处理优惠券不可用日期数据 | ||
| 127 | + hasConsecutiveSelect(arr, type) { | ||
| 128 | + let firstTitle = null; | ||
| 129 | + let lastTitle = null; | ||
| 130 | + let rArr = [] | ||
| 131 | + let num = 0 | ||
| 132 | + for (let i = 0; i < arr.length; i++) { | ||
| 133 | + let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig | ||
| 134 | + if (str) { | ||
| 135 | + rArr.push(arr[i].title) | ||
| 136 | + num++ | ||
| 137 | + if (num == 1) { | ||
| 138 | + firstTitle = arr[i].title | ||
| 139 | + } | ||
| 140 | + if (num >= 5) { | ||
| 141 | + lastTitle = arr[i].title | ||
| 142 | + } | ||
| 143 | + if (num >= 5 && i >= (arr.length - 1)) { | ||
| 144 | + let fi = rArr.findIndex((item) => { | ||
| 145 | + return item == firstTitle | ||
| 146 | + }) | ||
| 147 | + rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 148 | + num = 0 | ||
| 149 | + } | ||
| 150 | + } else { | ||
| 151 | + if (num < 5) { | ||
| 152 | + num = 0 | ||
| 153 | + firstTitle = null; | ||
| 154 | + lastTitle = null; | ||
| 155 | + } else { | ||
| 156 | + let fi = rArr.findIndex((item) => { | ||
| 157 | + return item == firstTitle | ||
| 158 | + }) | ||
| 159 | + rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 160 | + num = 0 | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | + return { | ||
| 165 | + rArr, | ||
| 166 | + lastTitle, | ||
| 167 | + firstTitle | ||
| 168 | + }; | ||
| 169 | + }, | ||
| 170 | + sharesetting() { | ||
| 171 | + let data = this.data.opt; | ||
| 172 | + let detail = this.data.detail; | ||
| 173 | + return { | ||
| 174 | + title: `送你${this.data.sellername}${detail.price}元代金券,点击查看详情,领取到卡包吧!`, | ||
| 175 | + path: `/pack-activity/pack/receiveCoupon?id=${data.id}&oid=${data.oid}&rid=${data.rid}&sid=${data.sid}&types=${data.types}`, | ||
| 176 | + imageUrl: 'https://nosqn.colorcun.com/share_money.png', | ||
| 177 | + } | ||
| 178 | + }, | ||
| 179 | + // 是否已领取 | ||
| 180 | + getCoupon() { | ||
| 181 | + App.Activity.ActivityListByOpenid({ | ||
| 182 | + aid: this.data.opt.id | ||
| 183 | + }).then(res => { | ||
| 184 | + if (res.ret === 200) { | ||
| 185 | + this.setData({ | ||
| 186 | + resultCoupon: res.data.length > 0 ? '1' : '0', | ||
| 187 | + }) | ||
| 188 | + } | ||
| 189 | + }) | ||
| 190 | + }, | ||
| 191 | + /** | ||
| 192 | + * 生命周期函数--监听页面初次渲染完成 | ||
| 193 | + */ | ||
| 194 | + onReady() { | ||
| 195 | + this.getDetail(); | ||
| 196 | + this.getSellerDetail(); | ||
| 197 | + this.getCoupon() | ||
| 198 | + }, | ||
| 199 | + | ||
| 200 | + /** | ||
| 201 | + * 生命周期函数--监听页面显示 | ||
| 202 | + */ | ||
| 203 | + onShow() { | ||
| 204 | + | ||
| 205 | + }, | ||
| 206 | + | ||
| 207 | + /** | ||
| 208 | + * 生命周期函数--监听页面隐藏 | ||
| 209 | + */ | ||
| 210 | + onHide() { | ||
| 211 | + | ||
| 212 | + }, | ||
| 213 | + | ||
| 214 | + /** | ||
| 215 | + * 生命周期函数--监听页面卸载 | ||
| 216 | + */ | ||
| 217 | + onUnload() { | ||
| 218 | + | ||
| 219 | + }, | ||
| 220 | + | ||
| 221 | + /** | ||
| 222 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
| 223 | + */ | ||
| 224 | + onPullDownRefresh() { | ||
| 225 | + | ||
| 226 | + }, | ||
| 227 | + | ||
| 228 | + /** | ||
| 229 | + * 页面上拉触底事件的处理函数 | ||
| 230 | + */ | ||
| 231 | + onReachBottom() { | ||
| 232 | + | ||
| 233 | + }, | ||
| 234 | + | ||
| 235 | + /** | ||
| 236 | + * 用户点击右上角分享 | ||
| 237 | + */ | ||
| 238 | + onShareAppMessage() { | ||
| 239 | + return this.sharesetting(); | ||
| 240 | + } | ||
| 241 | +}) |
| 1 | +<!--pack-activity/pack/receiveCoupon.wxml--> | ||
| 2 | +<wxs src="../../utils/util.wxs" module="util" /> | ||
| 3 | +<nav>代金券详情</nav> | ||
| 4 | +<view class="top_box"> | ||
| 5 | + <image src="https://qn.colorcun.com/voucherIcon1.png" mode="" /> | ||
| 6 | + <view class="texts"> | ||
| 7 | + <view class="font36r textName">{{detail.aname}}</view> | ||
| 8 | + <view class="font24r threshold">¥<text class="priceText">{{detail.price}}</text><text class="font24r" wx:if="{{detail.desc!='0'}}">满{{detail.desc}}元可用</text></view> | ||
| 9 | + </view> | ||
| 10 | + <view class="font24r receive" wx:if="{{resultCoupon == '1'}}">已领取</view> | ||
| 11 | +</view> | ||
| 12 | +<view class="center_box"> | ||
| 13 | + <view class="centerMain"> | ||
| 14 | + <view class="title"> | ||
| 15 | + <image src="https://qn.colorcun.com/voucherUnion_1.png" mode="" /> | ||
| 16 | + <text class="font28r">有效期</text> | ||
| 17 | + </view> | ||
| 18 | + <view class="info font24r">{{util.unixtoTime(detail.stime,'YYYY-MM-DD')}}<text>至</text>{{util.unixtoTime(detail.etime,'YYYY-MM-DD')}}</view> | ||
| 19 | + </view> | ||
| 20 | + <view class="centerMain"> | ||
| 21 | + <view class="title"> | ||
| 22 | + <image src="https://qn.colorcun.com/voucherUnion_2.png" mode="" /> | ||
| 23 | + <text class="font28r">不可用日期</text> | ||
| 24 | + </view> | ||
| 25 | + <view wx:if="{{detail.noonText}}" class="info font24r">{{detail.noonText}}</view> | ||
| 26 | + <view wx:if="{{detail.nigText}}" class="info font24r">{{detail.nigText}}</view> | ||
| 27 | + <view wx:if="{{!detail.noonText && !detail.nigText}}" class="info font24r">无限制</view> | ||
| 28 | + </view> | ||
| 29 | + <view class="centerMain centerMain3" wx:if="{{detail.aexpiration}}"> | ||
| 30 | + <view class="title"> | ||
| 31 | + <image src="https://qn.colorcun.com/voucherUnion_3.png" mode="" /> | ||
| 32 | + <text class="font28r">使用规则</text> | ||
| 33 | + </view> | ||
| 34 | + <view class="info font24r"> | ||
| 35 | + <view class="drop"></view>{{detail.is_same_day == '1' ? '领取当日可用' : '领取当日不可用'}} | ||
| 36 | + </view> | ||
| 37 | + <view class="info font24r"> | ||
| 38 | + <view class="drop"></view>{{detail.is_accumulation == '1' ? '可以叠加使用其他优惠券' : '不可以叠加使用其他优惠券'}} | ||
| 39 | + </view> | ||
| 40 | + <view class="info font24r"> | ||
| 41 | + <view class="drop"></view>{{detail.is_compartment == '1' ? '可用于包间消费' : '不可用于包间消费'}} | ||
| 42 | + </view> | ||
| 43 | + <view class="info font24r"> | ||
| 44 | + <view class="drop"></view>{{detail.is_eatin == '1' ? '堂食可用' : '不可用于堂食消费'}} | ||
| 45 | + </view> | ||
| 46 | + <view class="info font24r"> | ||
| 47 | + <view class="drop"></view>{{detail.is_takeout == '1' ? '外带可用' : '不可用于外带'}} | ||
| 48 | + </view> | ||
| 49 | + <view class="info font24r"> | ||
| 50 | + <view class="drop"></view>{{detail.is_appointment == '1' ? '需要提前预约' : '不需要提前预约'}} | ||
| 51 | + </view> | ||
| 52 | + </view> | ||
| 53 | + <view class="centerMain"> | ||
| 54 | + <view class="title"> | ||
| 55 | + <image src="https://qn.colorcun.com/voucherUnion_4.png" mode="" /> | ||
| 56 | + <text class="font28r">分享规则</text> | ||
| 57 | + </view> | ||
| 58 | + <view class="info font24r"> | ||
| 59 | + <view class="drop"></view>{{detail.arule.is_share_lose == '1'? '可以分享给好友' : '不能分享给好友'}} | ||
| 60 | + </view> | ||
| 61 | + <view class="info font24r"> | ||
| 62 | + <view class="drop"></view>{{detail.arule.is_share_have == '1'? '分享给好友后继续拥有此券' : '分享给好友后不再拥有此券'}} | ||
| 63 | + </view> | ||
| 64 | + <view class="info font24r" wx:if="{{detail.arule.commission != '0'}}"> | ||
| 65 | + <view class="drop"></view>分享给好友领券核销后,获得实际消费{{detail.arule.commission}}%佣金 | ||
| 66 | + </view> | ||
| 67 | + </view> | ||
| 68 | + <view class="centerMain" wx:if="{{detail.explain}}"> | ||
| 69 | + <view class="title"> | ||
| 70 | + <image src="https://qn.colorcun.com/voucherUnion_5.png" mode="" /> | ||
| 71 | + <text class="font28r">其他说明</text> | ||
| 72 | + </view> | ||
| 73 | + <view class="info font24r">{{detail.explain}}</view> | ||
| 74 | + </view> | ||
| 75 | +</view> | ||
| 76 | +<view class="bottom_box_wrap"> | ||
| 77 | + <view class="bottom_box"> | ||
| 78 | + <view class="font24r">温馨提示:</view> | ||
| 79 | + <view class="font24r">到店消费时,请您扫描商家二维码付款时,可以直接识别并使用优惠券</view> | ||
| 80 | + <view class="font24r">2、从<text class="bold_box">周到安排</text>微信小程序,<text class="bold_box">“我的-卡券”</text>中,可以找到您的卡券。</view> | ||
| 81 | + <view class="font24r">3、您也可以关注<text class="bold_box">周到安排</text>公众号,获取更多优惠券信息</view> | ||
| 82 | + <view class="font28r publicity" bindtap="wananchi">关注<text class="bold_box">周到安排</text>公众号,及时获取更多优惠券动态<view class="more" style="margin-left: 20rpx;"></view> | ||
| 83 | + </view> | ||
| 84 | + </view> | ||
| 85 | +</view> | ||
| 86 | +<view class="sharewidth" wx:if="{{resultCoupon == '0' || detail.arule.is_share_lose == '1'}}"> | ||
| 87 | + <button wx:if="{{detail.arule.is_share_lose == '1'}}" class="shareBtn" open-type="share"> | ||
| 88 | + <image src="https://qn.colorcun.com/voucherIcon2.png" mode="" /> | ||
| 89 | + <text class="font24r">分享</text> | ||
| 90 | + </button> | ||
| 91 | + <view class="btns"> | ||
| 92 | + <view wx:if="{{resultCoupon == '0'}}" class="btn font36r" bindtap="submitOrder">领取到卡包</view> | ||
| 93 | + </view> | ||
| 94 | +</view> |
| 1 | +/* pack-activity/pack/receiveCoupon.wxss */ | ||
| 2 | +page { | ||
| 3 | + background: #F5F5F5; | ||
| 4 | +} | ||
| 5 | + | ||
| 6 | +.top_box { | ||
| 7 | + background: #fff; | ||
| 8 | + display: flex; | ||
| 9 | + padding: 20rpx 40rpx; | ||
| 10 | + margin-bottom: 2rpx; | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | +.top_box image { | ||
| 14 | + width: 120rpx; | ||
| 15 | + height: 120rpx; | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +.textName { | ||
| 19 | + font-weight: 600; | ||
| 20 | + margin-bottom: 26rpx; | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +.threshold .priceText { | ||
| 24 | + font-size: 56rpx; | ||
| 25 | + font-weight: 600; | ||
| 26 | + margin-right: 12rpx; | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +.top_box .texts { | ||
| 30 | + flex: 1; | ||
| 31 | + margin-left: 32rpx; | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +.threshold { | ||
| 35 | + color: #FD4D59; | ||
| 36 | + font-weight: 400; | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +.receive { | ||
| 40 | + display: flex; | ||
| 41 | + align-items: flex-end; | ||
| 42 | + color: #999999; | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +.center_box { | ||
| 46 | + border-radius: 20rpx; | ||
| 47 | + background: #ffffff; | ||
| 48 | + padding: 40rpx; | ||
| 49 | + margin: 20rpx; | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +.title { | ||
| 53 | + display: flex; | ||
| 54 | + align-items: center; | ||
| 55 | + margin-bottom: 16rpx; | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +.title text { | ||
| 59 | + letter-spacing: 2rpx; | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +.title image { | ||
| 63 | + width: 26rpx; | ||
| 64 | + height: 26rpx; | ||
| 65 | + margin-right: 14rpx; | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +.centerMain3 image { | ||
| 69 | + width: 22rpx; | ||
| 70 | +} | ||
| 71 | + | ||
| 72 | +.centerMain { | ||
| 73 | + margin-bottom: 40rpx; | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | +.centerMain .drop { | ||
| 77 | + width: 8rpx; | ||
| 78 | + height: 8rpx; | ||
| 79 | + background: #575757; | ||
| 80 | + border-radius: 50%; | ||
| 81 | + position: absolute; | ||
| 82 | + left: -23rpx; | ||
| 83 | + top: 45%; | ||
| 84 | +} | ||
| 85 | + | ||
| 86 | +.centerMain:nth-last-of-type(1) { | ||
| 87 | + margin-bottom: 0; | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +.title text { | ||
| 91 | + font-weight: 600; | ||
| 92 | +} | ||
| 93 | + | ||
| 94 | +.info { | ||
| 95 | + margin-left: 44rpx; | ||
| 96 | + color: #575757; | ||
| 97 | + letter-spacing: 2rpx; | ||
| 98 | + position: relative; | ||
| 99 | + line-height: 40rpx; | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | +.bottom_box { | ||
| 103 | + border-radius: 16rpx; | ||
| 104 | + background: #fff; | ||
| 105 | + padding: 40rpx 40rpx 36rpx 40rpx; | ||
| 106 | + box-sizing: border-box; | ||
| 107 | + margin: 0 20rpx; | ||
| 108 | +} | ||
| 109 | + | ||
| 110 | +.bottom_box_wrap { | ||
| 111 | + padding-bottom: 180rpx; | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +.bottom_box view { | ||
| 115 | + color: #515151; | ||
| 116 | + font-family: PingFang SC; | ||
| 117 | + line-height: 40rpx; | ||
| 118 | +} | ||
| 119 | + | ||
| 120 | +.bold_box { | ||
| 121 | + font-size: 28rpx; | ||
| 122 | + font-weight: bold; | ||
| 123 | + color: #000; | ||
| 124 | +} | ||
| 125 | + | ||
| 126 | +.publicity { | ||
| 127 | + margin-top: 14rpx; | ||
| 128 | + display: flex; | ||
| 129 | + align-items: center; | ||
| 130 | + padding: 20rpx 0; | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | +.sharewidth { | ||
| 134 | + position: fixed; | ||
| 135 | + left: 0; | ||
| 136 | + bottom: 0; | ||
| 137 | + height: 160rpx; | ||
| 138 | + padding: 40rpx 32rpx; | ||
| 139 | + background: #fff; | ||
| 140 | + box-sizing: border-box; | ||
| 141 | + z-index: 100; | ||
| 142 | + width: 100%; | ||
| 143 | + display: flex; | ||
| 144 | +} | ||
| 145 | + | ||
| 146 | +.btns { | ||
| 147 | + flex: 1; | ||
| 148 | + display: flex; | ||
| 149 | + justify-content: flex-end; | ||
| 150 | +} | ||
| 151 | + | ||
| 152 | +.shareBtn { | ||
| 153 | + display: flex; | ||
| 154 | + flex-direction: column; | ||
| 155 | + font-weight: 600; | ||
| 156 | + margin-left: 40rpx; | ||
| 157 | + background: transparent; | ||
| 158 | +} | ||
| 159 | + | ||
| 160 | +.shareBtn image { | ||
| 161 | + width: 40rpx; | ||
| 162 | + height: 40rpx; | ||
| 163 | +} | ||
| 164 | + | ||
| 165 | +.btn { | ||
| 166 | + color: #fff; | ||
| 167 | + padding: 0 60rpx; | ||
| 168 | + height: 80rpx; | ||
| 169 | + line-height: 80rpx; | ||
| 170 | + border-radius: 40rpx; | ||
| 171 | + background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%); | ||
| 172 | +} |
| @@ -116,54 +116,43 @@ Page({ | @@ -116,54 +116,43 @@ Page({ | ||
| 116 | let data = res.data | 116 | let data = res.data |
| 117 | console.log('data', data); | 117 | console.log('data', data); |
| 118 | let couponList = [] | 118 | let couponList = [] |
| 119 | - let StyleType, marketing, coupon, is_comments; | 119 | + let StyleType, marketing, coupon, coupon_data_pay, coupon_data_free, is_comments; |
| 120 | marketing = util.determine(data.marketing); | 120 | marketing = util.determine(data.marketing); |
| 121 | StyleType = data.type; | 121 | StyleType = data.type; |
| 122 | if (marketing) { | 122 | if (marketing) { |
| 123 | is_comments = marketing.is_comments ? marketing.is_comments : ''; | 123 | is_comments = marketing.is_comments ? marketing.is_comments : ''; |
| 124 | - coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : ''; | 124 | + coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : ''; |
| 125 | + coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : ''; | ||
| 126 | + marketing.coupon_data_payList = coupon_data_pay | ||
| 127 | + coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : ''; | ||
| 128 | + marketing.coupon_data_freeList = coupon_data_free | ||
| 125 | let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : ''; | 129 | let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : ''; |
| 126 | let couponDataId = info && info.length > 0 ? info[0].id : {} | 130 | let couponDataId = info && info.length > 0 ? info[0].id : {} |
| 127 | // 根据券ID获取评价赠送的券详情 | 131 | // 根据券ID获取评价赠送的券详情 |
| 128 | if(couponDataId) this.getEvaluateFun(couponDataId) | 132 | if(couponDataId) this.getEvaluateFun(couponDataId) |
| 129 | } | 133 | } |
| 130 | // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 | 134 | // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 |
| 131 | - if (coupon && util.getType(coupon) == 'object') { | ||
| 132 | - couponList.push({ | ||
| 133 | - id: coupon.id | ||
| 134 | - }); | ||
| 135 | - } | ||
| 136 | - if (coupon && util.getType(coupon) == 'array') { | ||
| 137 | - if (coupon.length > 0) { | ||
| 138 | - coupon.forEach(item => { | ||
| 139 | - couponList.push({ | ||
| 140 | - id: item.id | ||
| 141 | - }) | ||
| 142 | - }) | ||
| 143 | - } | 135 | + // 获取全部的优惠券(商家券、个人券、免费券、付费券) |
| 136 | + couponList = this.addCoupons(coupon,couponList); | ||
| 137 | + couponList = this.addCoupons(coupon_data_pay,couponList); | ||
| 138 | + couponList = this.addCoupons(coupon_data_free,couponList); | ||
| 139 | + // 根据券ID获取券详情 | ||
| 140 | + this.getActivityByIdFun(couponList) | ||
| 141 | + // 根据充值ID获取充值详情 | ||
| 142 | + if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) { | ||
| 143 | + this.getRechargeDetail(marketing.recharge_data.id) | ||
| 144 | } | 144 | } |
| 145 | let obj = { | 145 | let obj = { |
| 146 | marketing, | 146 | marketing, |
| 147 | coupon, | 147 | coupon, |
| 148 | - couponList, | ||
| 149 | is_comments, | 148 | is_comments, |
| 150 | StyleType, | 149 | StyleType, |
| 151 | } | 150 | } |
| 152 | console.log('获取数据', { | 151 | console.log('获取数据', { |
| 153 | ...obj | 152 | ...obj |
| 154 | }); | 153 | }); |
| 155 | - // 根据券ID获取券详情 | ||
| 156 | - this.getActivityByIdFun(couponList, couponList.length) | ||
| 157 | - // 根据充值ID获取充值详情 | ||
| 158 | - if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) { | ||
| 159 | - this.getRechargeDetail(marketing.recharge_data.id) | ||
| 160 | - } | ||
| 161 | this.setData({ | 154 | this.setData({ |
| 162 | - marketing, | ||
| 163 | - coupon, | ||
| 164 | - is_comments, | ||
| 165 | - couponList, | ||
| 166 | - StyleType, | 155 | + ...obj |
| 167 | }) | 156 | }) |
| 168 | }).catch(res => { | 157 | }).catch(res => { |
| 169 | console.log('GetSellerTemplateConf请求失败'); | 158 | console.log('GetSellerTemplateConf请求失败'); |
| @@ -217,14 +206,15 @@ Page({ | @@ -217,14 +206,15 @@ Page({ | ||
| 217 | }) | 206 | }) |
| 218 | }, | 207 | }, |
| 219 | // 根据券ID获取券详情 | 208 | // 根据券ID获取券详情 |
| 220 | - getActivityByIdFun(ids, length) { | ||
| 221 | - let coupon_dataList = []; | ||
| 222 | - ids.forEach(i => { | ||
| 223 | - App.Activity.GetActivityById({ | ||
| 224 | - id: i.id | ||
| 225 | - }).then(res => { | ||
| 226 | - if (res.data.length > 0) { | ||
| 227 | - let detail = res.data[0]; | 209 | + getActivityByIdFun(obj) { |
| 210 | + App.Activity.GetActivityById({ | ||
| 211 | + id: obj.map(item => item.id).join(','), | ||
| 212 | + }).then(res => { | ||
| 213 | + if (res.data.length > 0) { | ||
| 214 | + let list = res.data.filter(item => { | ||
| 215 | + return this.data.dataStr < (item.etime * 1) && item.is_open == '1' | ||
| 216 | + }) | ||
| 217 | + list.forEach(detail => { | ||
| 228 | detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : ''; | 218 | detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : ''; |
| 229 | detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : ''; | 219 | detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : ''; |
| 230 | detail.use = detail.use ? util.determine(detail.use) : ''; | 220 | detail.use = detail.use ? util.determine(detail.use) : ''; |
| @@ -233,18 +223,97 @@ Page({ | @@ -233,18 +223,97 @@ Page({ | ||
| 233 | let price = detail.price * 1; | 223 | let price = detail.price * 1; |
| 234 | detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : ''; | 224 | detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : ''; |
| 235 | } | 225 | } |
| 236 | - coupon_dataList.push(detail); | ||
| 237 | - if (length === coupon_dataList.length) { | ||
| 238 | - coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'}) | ||
| 239 | - console.log('邀请函--------------------优惠券',coupon_dataList); | ||
| 240 | - this.setData({ | ||
| 241 | - coupon_dataList, | ||
| 242 | - }) | ||
| 243 | - } | ||
| 244 | - } | ||
| 245 | - }) | 226 | + let num = detail.receiveNum; |
| 227 | + if (num > 0) { | ||
| 228 | + detail.receiveNumText = '' | ||
| 229 | + if (num >= 0 && num <= 100) { | ||
| 230 | + detail.receiveNumText = num.toString(); | ||
| 231 | + } else if (num >= 101 && num <= 199) { | ||
| 232 | + detail.receiveNumText = '100+'; | ||
| 233 | + } else if (num >= 200 && num <= 299) { | ||
| 234 | + detail.receiveNumText = '200+'; | ||
| 235 | + } else { | ||
| 236 | + detail.receiveNumText = Math.floor(num / 100) * 100 + '+'; | ||
| 237 | + } | ||
| 238 | + } | ||
| 239 | + if (detail.exp_date && detail.exp_date.week_data) { | ||
| 240 | + let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、') | ||
| 241 | + let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、') | ||
| 242 | + if (noon) noon = '午餐:' + noon | ||
| 243 | + if (nig) nig = '晚餐:' + nig | ||
| 244 | + detail.noonText = noon; | ||
| 245 | + detail.nigText = nig; | ||
| 246 | + } | ||
| 247 | + }) | ||
| 248 | + console.log('邀请函--------------------优惠券', list); | ||
| 249 | + this.setData({ | ||
| 250 | + coupon_dataList: list, | ||
| 251 | + }) | ||
| 252 | + } | ||
| 246 | }) | 253 | }) |
| 247 | }, | 254 | }, |
| 255 | + // 获取所有的券并且展示 | ||
| 256 | + addCoupons(coupons, couponList) { | ||
| 257 | + if (coupons && util.getType(coupons) == 'object') { | ||
| 258 | + couponList.push({ | ||
| 259 | + id: coupon.id, | ||
| 260 | + number: coupon.number | ||
| 261 | + }); | ||
| 262 | + } | ||
| 263 | + if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) { | ||
| 264 | + coupons.forEach(item => { | ||
| 265 | + couponList.push({ | ||
| 266 | + id: item.id, | ||
| 267 | + number: item.number | ||
| 268 | + }); | ||
| 269 | + }); | ||
| 270 | + } | ||
| 271 | + return couponList | ||
| 272 | + }, | ||
| 273 | + // 处理优惠券不可用日期数据 | ||
| 274 | + hasConsecutiveSelect(arr, type) { | ||
| 275 | + let firstTitle = null; | ||
| 276 | + let lastTitle = null; | ||
| 277 | + let rArr = [] | ||
| 278 | + let num = 0 | ||
| 279 | + for (let i = 0; i < arr.length; i++) { | ||
| 280 | + let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig | ||
| 281 | + if (str) { | ||
| 282 | + rArr.push(arr[i].title) | ||
| 283 | + num++ | ||
| 284 | + if (num == 1) { | ||
| 285 | + firstTitle = arr[i].title | ||
| 286 | + } | ||
| 287 | + if (num >= 5) { | ||
| 288 | + lastTitle = arr[i].title | ||
| 289 | + } | ||
| 290 | + if (num >= 5 && i >= (arr.length - 1)) { | ||
| 291 | + let fi = rArr.findIndex((item) => { | ||
| 292 | + return item == firstTitle | ||
| 293 | + }) | ||
| 294 | + rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 295 | + num = 0 | ||
| 296 | + } | ||
| 297 | + } else { | ||
| 298 | + if (num < 5) { | ||
| 299 | + num = 0 | ||
| 300 | + firstTitle = null; | ||
| 301 | + lastTitle = null; | ||
| 302 | + } else { | ||
| 303 | + let fi = rArr.findIndex((item) => { | ||
| 304 | + return item == firstTitle | ||
| 305 | + }) | ||
| 306 | + rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 307 | + num = 0 | ||
| 308 | + } | ||
| 309 | + } | ||
| 310 | + } | ||
| 311 | + return { | ||
| 312 | + rArr, | ||
| 313 | + lastTitle, | ||
| 314 | + firstTitle | ||
| 315 | + }; | ||
| 316 | + }, | ||
| 248 | /** | 317 | /** |
| 249 | * 生命周期函数--监听页面隐藏 | 318 | * 生命周期函数--监听页面隐藏 |
| 250 | */ | 319 | */ |
| 1 | <!--pages/reserve/sellerGift.wxml--> | 1 | <!--pages/reserve/sellerGift.wxml--> |
| 2 | <import src="../tpl/invitation"></import> | 2 | <import src="../tpl/invitation"></import> |
| 3 | <nav id='nav'>商家有礼</nav> | 3 | <nav id='nav'>商家有礼</nav> |
| 4 | -<view class="box" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}"> | ||
| 5 | - <view class="title"> | 4 | +<view class="box" wx:if="{{hasValueCertificate && coupon_dataList.length>0}}"> |
| 5 | + <view class="title" wx:if="{{options.form == '1'}}"> | ||
| 6 | <view class="sign"></view><text class="font32r">专属优惠券</text> | 6 | <view class="sign"></view><text class="font32r">专属优惠券</text> |
| 7 | </view> | 7 | </view> |
| 8 | <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> | 8 | <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> |
| 9 | - <navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{options.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover"> | ||
| 10 | - <view class="preferentialItems"> | ||
| 11 | - <view class="itemLeft"> | ||
| 12 | - <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> | ||
| 13 | - <text wx:if="{{item.use.is_dish=='1'}}" class="discountText font24r">特惠菜品</text> | ||
| 14 | - <text wx:if="{{item.use.is_discount=='1'}}" class="discountText font24r">超值折扣</text> | ||
| 15 | - <view class="priceText" wx:if="{{item.price}}"> | ||
| 16 | - <text class="icons font40r">¥</text><text>{{item.price}}</text> | ||
| 17 | - </view> | ||
| 18 | - </view> | ||
| 19 | - <view class="itemRight"> | ||
| 20 | - <view class="btns"> | ||
| 21 | - <text class="font40r">{{item.aname}}</text> | ||
| 22 | - <view class="font24r orderingFood"> | ||
| 23 | - 抢购 | 9 | + <navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{options.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover"> |
| 10 | + <view class="couponWrap"> | ||
| 11 | + <view class="itemLeft"> | ||
| 12 | + <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> | ||
| 13 | + <view class="priceText" wx:if="{{item.price}}"> | ||
| 14 | + <view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text> | ||
| 24 | </view> | 15 | </view> |
| 16 | + <view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view> | ||
| 25 | </view> | 17 | </view> |
| 26 | - <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> | ||
| 27 | - <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r"> | ||
| 28 | - 无限制{{item.desc?','+item.desc+'。':'。'}} | ||
| 29 | - </view> | ||
| 30 | - <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r"> | ||
| 31 | - 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}} | 18 | + <view class="couponLine"></view> |
| 19 | + <view class="itemRight"> | ||
| 20 | + <view class="btns"> | ||
| 21 | + <text class="font40r">{{item.aname}}</text> | ||
| 22 | + <block wx:if="{{item.is_type == '1' || item.is_type == '2'}}"> | ||
| 23 | + <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> | ||
| 24 | + <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r"> | ||
| 25 | + 无限制{{item.desc?','+item.desc+'。':'。'}} | ||
| 26 | + </view> | ||
| 27 | + <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r"> | ||
| 28 | + 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}} | ||
| 29 | + </view> | ||
| 30 | + </block> | ||
| 31 | + <block wx:if="{{item.is_type == '3' || item.is_type == '4'}}"> | ||
| 32 | + <view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view> | ||
| 33 | + <view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view> | ||
| 34 | + <view wx:if="{{item.noonText}}" class="bottom font24r">{{item.noonText}}</view> | ||
| 35 | + <view wx:if="{{item.nigText}}" class="bottom font24r">{{item.nigText}}</view> | ||
| 36 | + <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view> | ||
| 37 | + <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view> | ||
| 38 | + </block> | ||
| 39 | + </view> | ||
| 40 | + <view class="btnBox" wx:if="{{item.is_type == '3'}}" > | ||
| 41 | + <view class="font24r orderingFood orderingFood1">已领取</view> | ||
| 42 | + <view class="grantNum" wx:if="{{item.receiveNumText}}"> | ||
| 43 | + <view class="font24r">已被领取</view> | ||
| 44 | + <view class="font24r"><text>{{item.receiveNumText}}</text>张</view> | ||
| 45 | + </view> | ||
| 46 | + </view> | ||
| 47 | + <view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood"> | ||
| 48 | + 立即抢购 | ||
| 49 | + </view> | ||
| 32 | </view> | 50 | </view> |
| 33 | </view> | 51 | </view> |
| 34 | - </view> | ||
| 35 | </navigator> | 52 | </navigator> |
| 36 | </block> | 53 | </block> |
| 37 | </view> | 54 | </view> |
| 38 | -<view class="box" wx:if="{{hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data}}"> | 55 | +<view class="box" wx:if="{{options.form == '1' && hasValueRecharge && recharge_data}}"> |
| 39 | <view class="title"> | 56 | <view class="title"> |
| 40 | <view class="sign"></view><text class="font32r">会员充值优惠</text> | 57 | <view class="sign"></view><text class="font32r">会员充值优惠</text> |
| 41 | </view> | 58 | </view> |
| @@ -62,7 +79,7 @@ | @@ -62,7 +79,7 @@ | ||
| 62 | </navigator> | 79 | </navigator> |
| 63 | </view> | 80 | </view> |
| 64 | <!-- 启用评价 && 是否评价过 && 评价赠送优惠券 && 赠送的优惠券有数据--> | 81 | <!-- 启用评价 && 是否评价过 && 评价赠送优惠券 && 赠送的优惠券有数据--> |
| 65 | -<view class="box" wx:if="{{is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1'}}"> | 82 | +<view class="box" wx:if="{{options.form == '1' && is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1'}}"> |
| 66 | <view class="title"> | 83 | <view class="title"> |
| 67 | <view class="sign"></view><text class="font32r">反馈有礼</text> | 84 | <view class="sign"></view><text class="font32r">反馈有礼</text> |
| 68 | </view> | 85 | </view> |
| @@ -39,6 +39,120 @@ page { | @@ -39,6 +39,120 @@ page { | ||
| 39 | background: #F8F9FD; | 39 | background: #F8F9FD; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | +.couponWrap { | ||
| 43 | + display: flex; | ||
| 44 | + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%); | ||
| 45 | + margin-bottom: 20rpx; | ||
| 46 | + min-height: 160rpx; | ||
| 47 | + padding-bottom: 10rpx; | ||
| 48 | + border-radius: 20rpx; | ||
| 49 | + border: 2rpx solid #ff7e06; | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | + | ||
| 53 | +.couponWrap .itemRight { | ||
| 54 | + width: 74%; | ||
| 55 | + display: flex; | ||
| 56 | + align-items: center; | ||
| 57 | + flex-direction:row; | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +.couponWrap .bottom { | ||
| 61 | + margin-top: 10rpx; | ||
| 62 | + width: 100%; | ||
| 63 | + color: #C36607; | ||
| 64 | + font-family: PingFang SC; | ||
| 65 | + font-weight: 500; | ||
| 66 | + display: -webkit-box; | ||
| 67 | + word-break: break-all; | ||
| 68 | + word-wrap: break-word; | ||
| 69 | + overflow: hidden; | ||
| 70 | + text-align: left; | ||
| 71 | +} | ||
| 72 | + | ||
| 73 | +.couponWrap .itemLeft { | ||
| 74 | + width: 26%; | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +.couponWrap .couponLine{ | ||
| 78 | + margin: 24rpx 0; | ||
| 79 | + border-right: 2rpx dashed #f6231b; | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +.couponWrap .orderingFood { | ||
| 83 | + padding: 0 20rpx; | ||
| 84 | + color: #fff !important; | ||
| 85 | + border: none !important; | ||
| 86 | + text-align: center; | ||
| 87 | + border-radius: 20rpx; | ||
| 88 | + line-height: 44rpx; | ||
| 89 | + height: 44rpx; | ||
| 90 | + width: max-content; | ||
| 91 | + flex-shrink: 0; | ||
| 92 | + background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%); | ||
| 93 | +} | ||
| 94 | +.couponWrap .icons { | ||
| 95 | + color: #F6231B !important; | ||
| 96 | + text-align: center; | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +.couponWrap .priceText { | ||
| 100 | + display: flex; | ||
| 101 | + align-items: baseline; | ||
| 102 | + justify-content: center; | ||
| 103 | + font-family: PingFang SC; | ||
| 104 | + color: #F6231B; | ||
| 105 | + font-weight: 600; | ||
| 106 | + font-size: 48rpx; | ||
| 107 | + margin-top: 6rpx; | ||
| 108 | +} | ||
| 109 | + | ||
| 110 | +.couponWrap .priceText text { | ||
| 111 | + font-size: 48rpx; | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +.couponWrap .btns { | ||
| 115 | + flex: 1; | ||
| 116 | + margin: 24rpx 20rpx 0 0; | ||
| 117 | + display: flex; | ||
| 118 | + justify-content: space-between; | ||
| 119 | + align-items: baseline; | ||
| 120 | + flex-direction: column; | ||
| 121 | +} | ||
| 122 | +.couponWrap .btnBox { | ||
| 123 | + display: flex; | ||
| 124 | + flex-direction: column; | ||
| 125 | +} | ||
| 126 | + | ||
| 127 | +.couponWrap .grantNum { | ||
| 128 | + display: flex; | ||
| 129 | + flex-direction: column; | ||
| 130 | + align-items: center; | ||
| 131 | + color: #C36607; | ||
| 132 | + margin-top: 10rpx; | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +.couponWrap .grantNum text { | ||
| 136 | + color: #F6231B; | ||
| 137 | + margin-right: 10rpx; | ||
| 138 | +} | ||
| 139 | + | ||
| 140 | +.couponWrap .btns text { | ||
| 141 | + font-weight: 600; | ||
| 142 | +} | ||
| 143 | + | ||
| 144 | +.couponWrap .orderingFood1 { | ||
| 145 | + border: 2rpx solid #fa4b20 !important; | ||
| 146 | + background: transparent !important; | ||
| 147 | + color: #fa4b20 !important; | ||
| 148 | +} | ||
| 149 | +.couponWrap .itemLeft { | ||
| 150 | + background: transparent; | ||
| 151 | +} | ||
| 152 | +.couponWrap .discountText { | ||
| 153 | + background: #F6231B; | ||
| 154 | +} | ||
| 155 | + | ||
| 42 | .itemLeft { | 156 | .itemLeft { |
| 43 | width: 30%; | 157 | width: 30%; |
| 44 | display: flex; | 158 | display: flex; |
| @@ -35,8 +35,9 @@ Page({ | @@ -35,8 +35,9 @@ Page({ | ||
| 35 | coupon_dataList:[], | 35 | coupon_dataList:[], |
| 36 | dataStr: Date.now() * 1 / 1000, | 36 | dataStr: Date.now() * 1 / 1000, |
| 37 | StyleType:'', | 37 | StyleType:'', |
| 38 | + couponArr: [],//待领取的优惠券列表 | ||
| 38 | }, | 39 | }, |
| 39 | - | 40 | + couponModal: '', |
| 40 | /** | 41 | /** |
| 41 | * 生命周期函数--监听页面加载 | 42 | * 生命周期函数--监听页面加载 |
| 42 | */ | 43 | */ |
| @@ -51,6 +52,12 @@ Page({ | @@ -51,6 +52,12 @@ Page({ | ||
| 51 | this.getIsCollectionSellerFun(sid) | 52 | this.getIsCollectionSellerFun(sid) |
| 52 | this.getSellerVersionFun(sid) | 53 | this.getSellerVersionFun(sid) |
| 53 | } | 54 | } |
| 55 | + this.couponModal = this.selectComponent("#couponModal"); | ||
| 56 | + this.couponModal.showModal() | ||
| 57 | + }, | ||
| 58 | + // 关闭优惠券弹框 | ||
| 59 | + closeCouponModal() { | ||
| 60 | + this.couponModal.closeModal() | ||
| 54 | }, | 61 | }, |
| 55 | // 获取商家是否收藏状态 | 62 | // 获取商家是否收藏状态 |
| 56 | getIsCollectionSellerFun(sid) { | 63 | getIsCollectionSellerFun(sid) { |
| @@ -150,7 +157,7 @@ Page({ | @@ -150,7 +157,7 @@ Page({ | ||
| 150 | let data = res.data | 157 | let data = res.data |
| 151 | console.log('data', data); | 158 | console.log('data', data); |
| 152 | let couponList = [] | 159 | let couponList = [] |
| 153 | - let titleType, home, chef, signboard, store, marketing, coupon, reserve, StyleType; | 160 | + let titleType, home, chef, signboard, store, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, StyleType; |
| 154 | chef = util.determine(data.chef); | 161 | chef = util.determine(data.chef); |
| 155 | reserve = util.determine(data.reserve); | 162 | reserve = util.determine(data.reserve); |
| 156 | signboard = util.determine(data.signboard); | 163 | signboard = util.determine(data.signboard); |
| @@ -158,30 +165,27 @@ Page({ | @@ -158,30 +165,27 @@ Page({ | ||
| 158 | home = util.determine(data.home); | 165 | home = util.determine(data.home); |
| 159 | marketing = util.determine(data.marketing); | 166 | marketing = util.determine(data.marketing); |
| 160 | titleType = data.title_class || '1'; | 167 | titleType = data.title_class || '1'; |
| 161 | - StyleType = data.type;if (store) store.content = (store.is_introduce_all == '1' && store.content) ? util.determine(store.content) : ''; | 168 | + StyleType = data.type; |
| 169 | + if (store) store.content = (store.is_introduce_all == '1' && store.content) ? util.determine(store.content) : ''; | ||
| 162 | if (chef) chef.content = (chef.is_introduce_all == '1' && chef.content) ? util.determine(chef.content) : ''; | 170 | if (chef) chef.content = (chef.is_introduce_all == '1' && chef.content) ? util.determine(chef.content) : ''; |
| 163 | if (signboard) signboard.content = (signboard.is_introduce_all == '1' && signboard.content) ? util.determine(signboard.content) : ''; | 171 | if (signboard) signboard.content = (signboard.is_introduce_all == '1' && signboard.content) ? util.determine(signboard.content) : ''; |
| 164 | if (reserve) reserve.content = (reserve.is_introduce_all == '1' && reserve.content) ? util.determine(reserve.content) : ''; | 172 | if (reserve) reserve.content = (reserve.is_introduce_all == '1' && reserve.content) ? util.determine(reserve.content) : ''; |
| 165 | if (home) home.image = (home && home.image && (!home.id_first_image || home.id_first_image!='0')) ? home.image : ''; | 173 | if (home) home.image = (home && home.image && (!home.id_first_image || home.id_first_image!='0')) ? home.image : ''; |
| 166 | if (marketing) { | 174 | if (marketing) { |
| 167 | marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : ''; | 175 | marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : ''; |
| 168 | - coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : ''; | 176 | + coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : ''; |
| 177 | + coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : ''; | ||
| 178 | + marketing.coupon_data_payList = coupon_data_pay | ||
| 179 | + coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : ''; | ||
| 180 | + marketing.coupon_data_freeList = coupon_data_free | ||
| 169 | } | 181 | } |
| 170 | // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 | 182 | // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 |
| 171 | - if (coupon && util.getType(coupon) == 'object') { | ||
| 172 | - couponList.push({ | ||
| 173 | - id: coupon.id | ||
| 174 | - }); | ||
| 175 | - } | ||
| 176 | - if (coupon && util.getType(coupon) == 'array') { | ||
| 177 | - if (coupon.length > 0) { | ||
| 178 | - coupon.forEach(item => { | ||
| 179 | - couponList.push({ | ||
| 180 | - id: item.id | ||
| 181 | - }) | ||
| 182 | - }) | ||
| 183 | - } | ||
| 184 | - } | 183 | + // 获取全部的优惠券(商家券、个人券、免费券、付费券) |
| 184 | + couponList = this.addCoupons(coupon,couponList); | ||
| 185 | + couponList = this.addCoupons(coupon_data_pay,couponList); | ||
| 186 | + couponList = this.addCoupons(coupon_data_free,couponList); | ||
| 187 | + // 根据券ID获取券详情 | ||
| 188 | + this.getActivityByIdFun(couponList) | ||
| 185 | if (store && store.images && store.images.length > 0) store.images = util.determine(store.images); | 189 | if (store && store.images && store.images.length > 0) store.images = util.determine(store.images); |
| 186 | if (reserve && reserve.park_info_images && reserve.park_info_images.length > 0) reserve.park_info_images = util.determine(reserve.park_info_images); | 190 | if (reserve && reserve.park_info_images && reserve.park_info_images.length > 0) reserve.park_info_images = util.determine(reserve.park_info_images); |
| 187 | if (signboard && signboard.images) signboard.images = util.determine(signboard.images); | 191 | if (signboard && signboard.images) signboard.images = util.determine(signboard.images); |
| @@ -201,8 +205,6 @@ Page({ | @@ -201,8 +205,6 @@ Page({ | ||
| 201 | console.log('获取数据', { | 205 | console.log('获取数据', { |
| 202 | ...obj | 206 | ...obj |
| 203 | }); | 207 | }); |
| 204 | - // 根据券ID获取券详情 | ||
| 205 | - this.getActivityByIdFun(couponList, couponList.length) | ||
| 206 | // 根据充值ID获取充值详情 | 208 | // 根据充值ID获取充值详情 |
| 207 | if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) { | 209 | if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) { |
| 208 | this.getRechargeDetail(marketing.recharge_data.id) | 210 | this.getRechargeDetail(marketing.recharge_data.id) |
| @@ -245,35 +247,172 @@ Page({ | @@ -245,35 +247,172 @@ Page({ | ||
| 245 | }) | 247 | }) |
| 246 | }) | 248 | }) |
| 247 | }, | 249 | }, |
| 248 | - // 根据券ID获取券详情 | ||
| 249 | - getActivityByIdFun(ids, length) { | ||
| 250 | - let coupon_dataList = []; | ||
| 251 | - ids.forEach(i => { | ||
| 252 | - App.Activity.GetActivityById({ | ||
| 253 | - id: i.id | ||
| 254 | - }).then(res => { | ||
| 255 | - if (res.data.length > 0) { | ||
| 256 | - let detail = res.data[0]; | ||
| 257 | - detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : ''; | ||
| 258 | - detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : ''; | ||
| 259 | - detail.use = detail.use ? util.determine(detail.use) : ''; | ||
| 260 | - if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) { | ||
| 261 | - let cash = detail.use.cash * 1; | ||
| 262 | - let price = detail.price * 1; | ||
| 263 | - detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : ''; | ||
| 264 | - } | ||
| 265 | - coupon_dataList.push(detail); | ||
| 266 | - if (length === coupon_dataList.length) { | ||
| 267 | - coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'}) | ||
| 268 | - console.log('商家详情--------------------优惠券',coupon_dataList); | ||
| 269 | - this.setData({ | ||
| 270 | - coupon_dataList, | ||
| 271 | - }) | ||
| 272 | - } | ||
| 273 | - } | ||
| 274 | - }) | ||
| 275 | - }) | ||
| 276 | - }, | 250 | + // 根据券ID获取券详情 |
| 251 | + getActivityByIdFun(obj) { | ||
| 252 | + App.Activity.GetActivityById({ | ||
| 253 | + id: obj.map(item => item.id).join(','), | ||
| 254 | + }).then(res => { | ||
| 255 | + if (res.data.length > 0) { | ||
| 256 | + let list = res.data.filter(item => { | ||
| 257 | + return this.data.dataStr < (item.etime * 1) && item.is_open == '1' | ||
| 258 | + }) | ||
| 259 | + list.forEach(detail => { | ||
| 260 | + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : ''; | ||
| 261 | + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : ''; | ||
| 262 | + detail.use = detail.use ? util.determine(detail.use) : ''; | ||
| 263 | + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) { | ||
| 264 | + let cash = detail.use.cash * 1; | ||
| 265 | + let price = detail.price * 1; | ||
| 266 | + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : ''; | ||
| 267 | + } | ||
| 268 | + let num = detail.receiveNum; | ||
| 269 | + if (num > 0) { | ||
| 270 | + detail.receiveNumText = '' | ||
| 271 | + if (num >= 0 && num <= 100) { | ||
| 272 | + detail.receiveNumText = num.toString(); | ||
| 273 | + } else if (num >= 101 && num <= 199) { | ||
| 274 | + detail.receiveNumText = '100+'; | ||
| 275 | + } else if (num >= 200 && num <= 299) { | ||
| 276 | + detail.receiveNumText = '200+'; | ||
| 277 | + } else { | ||
| 278 | + detail.receiveNumText = Math.floor(num / 100) * 100 + '+'; | ||
| 279 | + } | ||
| 280 | + } | ||
| 281 | + if (detail.exp_date && detail.exp_date.week_data) { | ||
| 282 | + let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、') | ||
| 283 | + let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、') | ||
| 284 | + if (noon) noon = '午餐:' + noon | ||
| 285 | + if (nig) nig = '晚餐:' + nig | ||
| 286 | + detail.noonText = noon; | ||
| 287 | + detail.nigText = nig; | ||
| 288 | + } | ||
| 289 | + }) | ||
| 290 | + let freeCoupons = list.filter(item => { | ||
| 291 | + return item.is_type == '3' | ||
| 292 | + }) | ||
| 293 | + // 免费券判断是否领取,弹框领取 | ||
| 294 | + if (freeCoupons.length > 0) { | ||
| 295 | + let length = freeCoupons.length - 1 | ||
| 296 | + freeCoupons.forEach(i => { | ||
| 297 | + this.getCoupon(i, freeCoupons[length].id, obj) | ||
| 298 | + }) | ||
| 299 | + } | ||
| 300 | + console.log('邀请函--------------------优惠券', list); | ||
| 301 | + this.setData({ | ||
| 302 | + coupon_dataList: list, | ||
| 303 | + }) | ||
| 304 | + } | ||
| 305 | + }) | ||
| 306 | + }, | ||
| 307 | + // 获取所有的券并且展示 | ||
| 308 | + addCoupons(coupons, couponList) { | ||
| 309 | + if (coupons && util.getType(coupons) == 'object') { | ||
| 310 | + couponList.push({ | ||
| 311 | + id: coupon.id, | ||
| 312 | + number: coupon.number | ||
| 313 | + }); | ||
| 314 | + } | ||
| 315 | + if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) { | ||
| 316 | + coupons.forEach(item => { | ||
| 317 | + couponList.push({ | ||
| 318 | + id: item.id, | ||
| 319 | + number: item.number | ||
| 320 | + }); | ||
| 321 | + }); | ||
| 322 | + } | ||
| 323 | + return couponList | ||
| 324 | + }, | ||
| 325 | + // 弹框领取免费券 | ||
| 326 | + setcouponFun(arr) { | ||
| 327 | + let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(','); | ||
| 328 | + console.log('弹框领取免费券id', str); | ||
| 329 | + // App.Activity.SetActivityAsReserve({ | ||
| 330 | + // aid: str, | ||
| 331 | + // rid: this.id, | ||
| 332 | + // }).then((json) => { | ||
| 333 | + // if (json.ret != 200) { | ||
| 334 | + // wx.showToast({ | ||
| 335 | + // title: res.msg, | ||
| 336 | + // duration: 2000, | ||
| 337 | + // mask: true | ||
| 338 | + // }) | ||
| 339 | + // } | ||
| 340 | + // }) | ||
| 341 | + }, | ||
| 342 | + // 免费券 0未领取 1已领取 获取未领取的组成数组couponArr | ||
| 343 | + getCoupon(item, id, obj) { | ||
| 344 | + let couponArr = this.data.couponArr; | ||
| 345 | + let totalPrice = this.data.totalPrice; | ||
| 346 | + App.Activity.ActivityListByOpenid({ | ||
| 347 | + aid: item.id | ||
| 348 | + }).then(res => { | ||
| 349 | + if (res.ret == 200) { | ||
| 350 | + if (res.data.length == 0) { | ||
| 351 | + couponArr.push(item) | ||
| 352 | + } | ||
| 353 | + if (item.id == id && couponArr.length > 0) { | ||
| 354 | + couponArr.forEach(item => { | ||
| 355 | + let match = obj.find(b => b.id === item.id); | ||
| 356 | + if (match) { | ||
| 357 | + item.number = match.number; | ||
| 358 | + } | ||
| 359 | + }); | ||
| 360 | + totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0); | ||
| 361 | + this.setcouponFun(couponArr) | ||
| 362 | + this.couponModal.showModal() | ||
| 363 | + } | ||
| 364 | + console.log('未领取的券列表-----------', couponArr); | ||
| 365 | + this.setData({ | ||
| 366 | + couponArr, | ||
| 367 | + totalPrice | ||
| 368 | + }) | ||
| 369 | + } | ||
| 370 | + }) | ||
| 371 | + }, | ||
| 372 | + // 处理优惠券不可用日期数据 | ||
| 373 | + hasConsecutiveSelect(arr, type) { | ||
| 374 | + let firstTitle = null; | ||
| 375 | + let lastTitle = null; | ||
| 376 | + let rArr = [] | ||
| 377 | + let num = 0 | ||
| 378 | + for (let i = 0; i < arr.length; i++) { | ||
| 379 | + let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig | ||
| 380 | + if (str) { | ||
| 381 | + rArr.push(arr[i].title) | ||
| 382 | + num++ | ||
| 383 | + if (num == 1) { | ||
| 384 | + firstTitle = arr[i].title | ||
| 385 | + } | ||
| 386 | + if (num >= 5) { | ||
| 387 | + lastTitle = arr[i].title | ||
| 388 | + } | ||
| 389 | + if (num >= 5 && i >= (arr.length - 1)) { | ||
| 390 | + let fi = rArr.findIndex((item) => { | ||
| 391 | + return item == firstTitle | ||
| 392 | + }) | ||
| 393 | + rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 394 | + num = 0 | ||
| 395 | + } | ||
| 396 | + } else { | ||
| 397 | + if (num < 5) { | ||
| 398 | + num = 0 | ||
| 399 | + firstTitle = null; | ||
| 400 | + lastTitle = null; | ||
| 401 | + } else { | ||
| 402 | + let fi = rArr.findIndex((item) => { | ||
| 403 | + return item == firstTitle | ||
| 404 | + }) | ||
| 405 | + rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 406 | + num = 0 | ||
| 407 | + } | ||
| 408 | + } | ||
| 409 | + } | ||
| 410 | + return { | ||
| 411 | + rArr, | ||
| 412 | + lastTitle, | ||
| 413 | + firstTitle | ||
| 414 | + }; | ||
| 415 | + }, | ||
| 277 | // 导航 | 416 | // 导航 |
| 278 | looklocation: function () { | 417 | looklocation: function () { |
| 279 | wx.reportMonitor('1015', 1) | 418 | wx.reportMonitor('1015', 1) |
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | "navigationBarTitleText": "", | 4 | "navigationBarTitleText": "", |
| 5 | "usingComponents": { | 5 | "usingComponents": { |
| 6 | "nav": "/components/nav/nav", | 6 | "nav": "/components/nav/nav", |
| 7 | - "titleStyle":"/components/titleStyle/titleStyle" | 7 | + "titleStyle":"/components/titleStyle/titleStyle", |
| 8 | + "my-modal": "/components/modal/modal" | ||
| 8 | } | 9 | } |
| 9 | } | 10 | } |
| @@ -19,6 +19,54 @@ | @@ -19,6 +19,54 @@ | ||
| 19 | </view> | 19 | </view> |
| 20 | </view> | 20 | </view> |
| 21 | </view> | 21 | </view> |
| 22 | + <view class="preferential" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}"> | ||
| 23 | + <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> | ||
| 24 | + <navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.sellName}}&use={{item.stringifyUse}}&sid={{sid}}&types=3&StyleType={{StyleType}}" hover-class="navigator-hover"> | ||
| 25 | + <view class="couponWrap"> | ||
| 26 | + <view class="itemLeft"> | ||
| 27 | + <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> | ||
| 28 | + <view class="priceText" wx:if="{{item.price}}"> | ||
| 29 | + <view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text> | ||
| 30 | + </view> | ||
| 31 | + <view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view> | ||
| 32 | + </view> | ||
| 33 | + <view class="couponLine"></view> | ||
| 34 | + <view class="itemRight"> | ||
| 35 | + <view class="btns"> | ||
| 36 | + <text class="font40r">{{item.aname}}</text> | ||
| 37 | + <block wx:if="{{item.is_type == '1' || item.is_type == '2'}}"> | ||
| 38 | + <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> | ||
| 39 | + <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r"> | ||
| 40 | + 无限制{{item.desc?','+item.desc+'。':'。'}} | ||
| 41 | + </view> | ||
| 42 | + <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r"> | ||
| 43 | + 会员生日当天可用{{item.desc?','+item.desc+'。':'。'}} | ||
| 44 | + </view> | ||
| 45 | + </block> | ||
| 46 | + <block wx:if="{{item.is_type == '3' || item.is_type == '4'}}"> | ||
| 47 | + <view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view> | ||
| 48 | + <view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view> | ||
| 49 | + <view wx:if="{{item.noonText}}" class="bottom font24r">{{item.noonText}}</view> | ||
| 50 | + <view wx:if="{{item.nigText}}" class="bottom font24r">{{item.nigText}}</view> | ||
| 51 | + <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view> | ||
| 52 | + <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view> | ||
| 53 | + </block> | ||
| 54 | + </view> | ||
| 55 | + <view class="btnBox" wx:if="{{item.is_type == '3'}}" > | ||
| 56 | + <view class="font24r orderingFood orderingFood1">已领取</view> | ||
| 57 | + <view class="grantNum" wx:if="{{item.receiveNumText}}"> | ||
| 58 | + <view class="font24r">已被领取</view> | ||
| 59 | + <view class="font24r"><text>{{item.receiveNumText}}</text>张</view> | ||
| 60 | + </view> | ||
| 61 | + </view> | ||
| 62 | + <view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood"> | ||
| 63 | + 立即抢购 | ||
| 64 | + </view> | ||
| 65 | + </view> | ||
| 66 | + </view> | ||
| 67 | + </navigator> | ||
| 68 | + </block> | ||
| 69 | + </view> | ||
| 22 | <view class="preferential" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}"> | 70 | <view class="preferential" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}"> |
| 23 | <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> | 71 | <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> |
| 24 | <navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.sellName}}&use={{item.stringifyUse}}&sid={{sid}}&types=3&StyleType={{StyleType}}" hover-class="navigator-hover"> | 72 | <navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.sellName}}&use={{item.stringifyUse}}&sid={{sid}}&types=3&StyleType={{StyleType}}" hover-class="navigator-hover"> |
| @@ -208,4 +256,23 @@ | @@ -208,4 +256,23 @@ | ||
| 208 | <navigator url="/pages/reserve/reserve?id={{sid}}&activeTab=reserve" class="book-item-font second-book-button flex-cc font30r" style="position: relative;">预订包间</navigator> | 256 | <navigator url="/pages/reserve/reserve?id={{sid}}&activeTab=reserve" class="book-item-font second-book-button flex-cc font30r" style="position: relative;">预订包间</navigator> |
| 209 | </block> | 257 | </block> |
| 210 | </view> | 258 | </view> |
| 211 | -</view> | ||
| 259 | +</view> | ||
| 260 | +<my-modal id="couponModal" fadeStyle="slideUp" height="240px"> | ||
| 261 | + <view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}"> | ||
| 262 | + <image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/> | ||
| 263 | + <view class="nameInfo">{{seller.sellName}}</view> | ||
| 264 | + <view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view> | ||
| 265 | + </view> | ||
| 266 | + <view slot="modalContent"> | ||
| 267 | + <view class="couponBox"> | ||
| 268 | + <view wx:for="{{couponArr}}" class="couponItems"> | ||
| 269 | + <view class="couponNum font20r">×{{item.number}}</view> | ||
| 270 | + <view class="font36r couponPrice">¥<text>{{item.price}}</text></view> | ||
| 271 | + <view class="couponLines"></view> | ||
| 272 | + <view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view> | ||
| 273 | + <view class="font28r couponCondition" wx:else>无门槛</view> | ||
| 274 | + </view> | ||
| 275 | + </view> | ||
| 276 | + <view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view> | ||
| 277 | + </view> | ||
| 278 | +</my-modal> |
| @@ -323,4 +323,272 @@ | @@ -323,4 +323,272 @@ | ||
| 323 | .videoBox video{ | 323 | .videoBox video{ |
| 324 | width: 100%; | 324 | width: 100%; |
| 325 | box-sizing: border-box; | 325 | box-sizing: border-box; |
| 326 | +} | ||
| 327 | + | ||
| 328 | +.couponWrap { | ||
| 329 | + display: flex; | ||
| 330 | + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%); | ||
| 331 | + min-height: 160rpx; | ||
| 332 | + padding-bottom: 10rpx; | ||
| 333 | + border-radius: 20rpx; | ||
| 334 | + border: 2rpx solid #ff7e06; | ||
| 335 | + margin: 0 20rpx 20rpx 20rpx; | ||
| 336 | +} | ||
| 337 | + | ||
| 338 | +.couponWrap .itemRight { | ||
| 339 | + width: 74%; | ||
| 340 | + display: flex; | ||
| 341 | + align-items: center; | ||
| 342 | + flex-direction:row; | ||
| 343 | + padding-right: 10rpx; | ||
| 344 | + margin-left: 18rpx; | ||
| 345 | +} | ||
| 346 | + | ||
| 347 | +.couponWrap .bottom { | ||
| 348 | + margin-top: 10rpx; | ||
| 349 | + width: 100%; | ||
| 350 | + color: #C36607; | ||
| 351 | + font-family: PingFang SC; | ||
| 352 | + font-weight: 500; | ||
| 353 | + display: -webkit-box; | ||
| 354 | + word-break: break-all; | ||
| 355 | + word-wrap: break-word; | ||
| 356 | + overflow: hidden; | ||
| 357 | + text-align: left; | ||
| 358 | +} | ||
| 359 | + | ||
| 360 | +.couponWrap .itemLeft { | ||
| 361 | + width: 26%; | ||
| 362 | + display: flex; | ||
| 363 | + flex-direction: column; | ||
| 364 | + justify-content: center; | ||
| 365 | + position: relative; | ||
| 366 | + border-top-left-radius: 20rpx; | ||
| 367 | + border-bottom-left-radius: 20rpx; | ||
| 368 | +} | ||
| 369 | + | ||
| 370 | +.couponWrap .couponLine{ | ||
| 371 | + margin: 24rpx 0; | ||
| 372 | + border-right: 2rpx dashed #f6231b; | ||
| 373 | +} | ||
| 374 | + | ||
| 375 | +.couponWrap .orderingFood { | ||
| 376 | + padding: 0 20rpx; | ||
| 377 | + color: #fff !important; | ||
| 378 | + border: none !important; | ||
| 379 | + text-align: center; | ||
| 380 | + border-radius: 20rpx; | ||
| 381 | + line-height: 44rpx; | ||
| 382 | + height: 44rpx; | ||
| 383 | + width: max-content; | ||
| 384 | + flex-shrink: 0; | ||
| 385 | + background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%); | ||
| 386 | +} | ||
| 387 | +.couponWrap .icons { | ||
| 388 | + color: #F6231B !important; | ||
| 389 | + text-align: center; | ||
| 390 | +} | ||
| 391 | + | ||
| 392 | +.couponWrap .priceText { | ||
| 393 | + display: flex; | ||
| 394 | + align-items: baseline; | ||
| 395 | + justify-content: center; | ||
| 396 | + font-family: PingFang SC; | ||
| 397 | + color: #F6231B; | ||
| 398 | + font-weight: 600; | ||
| 399 | + font-size: 48rpx; | ||
| 400 | + margin-top: 6rpx; | ||
| 401 | +} | ||
| 402 | + | ||
| 403 | +.couponWrap .priceText text { | ||
| 404 | + font-size: 48rpx; | ||
| 405 | +} | ||
| 406 | + | ||
| 407 | +.couponWrap .btns { | ||
| 408 | + flex: 1; | ||
| 409 | + margin: 24rpx 20rpx 0 0; | ||
| 410 | + display: flex; | ||
| 411 | + justify-content: space-between; | ||
| 412 | + align-items: baseline; | ||
| 413 | + flex-direction: column; | ||
| 414 | +} | ||
| 415 | +.couponWrap .btnBox { | ||
| 416 | + display: flex; | ||
| 417 | + flex-direction: column; | ||
| 418 | +} | ||
| 419 | + | ||
| 420 | +.couponWrap .grantNum { | ||
| 421 | + display: flex; | ||
| 422 | + flex-direction: column; | ||
| 423 | + align-items: center; | ||
| 424 | + color: #C36607; | ||
| 425 | + margin-top: 10rpx; | ||
| 426 | +} | ||
| 427 | + | ||
| 428 | +.couponWrap .grantNum text { | ||
| 429 | + color: #F6231B; | ||
| 430 | + margin-right: 10rpx; | ||
| 431 | +} | ||
| 432 | + | ||
| 433 | +.couponWrap .btns text { | ||
| 434 | + font-weight: 600; | ||
| 435 | +} | ||
| 436 | + | ||
| 437 | +.couponWrap .orderingFood1 { | ||
| 438 | + border: 2rpx solid #fa4b20 !important; | ||
| 439 | + background: transparent !important; | ||
| 440 | + color: #fa4b20 !important; | ||
| 441 | +} | ||
| 442 | + | ||
| 443 | +.couponWrap .discountText { | ||
| 444 | + background: #F6231B; | ||
| 445 | + text-align: center; | ||
| 446 | + color: #FFEFC5; | ||
| 447 | + border-radius: 6rpx; | ||
| 448 | + font-family: PingFang SC; | ||
| 449 | + background: #FD4D59; | ||
| 450 | + width: max-content; | ||
| 451 | + padding: 6rpx; | ||
| 452 | + position: absolute; | ||
| 453 | + left: 16rpx; | ||
| 454 | + top: 12rpx; | ||
| 455 | +} | ||
| 456 | + | ||
| 457 | +#couponModal .titleModal { | ||
| 458 | + margin-top: 30%; | ||
| 459 | + position: relative; | ||
| 460 | +} | ||
| 461 | + | ||
| 462 | +#couponModal .titleModal2 { | ||
| 463 | + margin: 80% auto 0 auto; | ||
| 464 | +} | ||
| 465 | + | ||
| 466 | +#couponModal .titleModal3 { | ||
| 467 | + margin-top: 60%; | ||
| 468 | +} | ||
| 469 | + | ||
| 470 | +#couponModal .titleModal4 { | ||
| 471 | + margin-top: 30%; | ||
| 472 | +} | ||
| 473 | + | ||
| 474 | +#couponModal .mymodal { | ||
| 475 | + background: rgba(0, 0, 0, 0.8); | ||
| 476 | + width: 100% !important; | ||
| 477 | + top: 0 !important; | ||
| 478 | + height: auto !important; | ||
| 479 | + z-index: 300; | ||
| 480 | +} | ||
| 481 | + | ||
| 482 | +.nameInfo { | ||
| 483 | + font-family: PingFang SC; | ||
| 484 | + font-weight: 400; | ||
| 485 | + font-size: 52rpx; | ||
| 486 | + line-height: 56rpx; | ||
| 487 | + color: #fff; | ||
| 488 | + margin-bottom: 40rpx; | ||
| 489 | + padding-top: 60rpx; | ||
| 490 | +} | ||
| 491 | + | ||
| 492 | +.couponTotal { | ||
| 493 | + color: #dfdfdf; | ||
| 494 | + font-family: PingFang SC; | ||
| 495 | + font-weight: 400; | ||
| 496 | + font-size: 40rpx; | ||
| 497 | + line-height: 48rpx; | ||
| 498 | + margin-bottom: 40rpx; | ||
| 499 | + display: flex; | ||
| 500 | + align-items: center; | ||
| 501 | + justify-content: center; | ||
| 502 | +} | ||
| 503 | + | ||
| 504 | +.couponTotal text { | ||
| 505 | + color: #ffc806; | ||
| 506 | + font-weight: 600; | ||
| 507 | + font-size: 80rpx; | ||
| 508 | + margin: 0 14rpx; | ||
| 509 | +} | ||
| 510 | + | ||
| 511 | +.couponBox { | ||
| 512 | + width: 80%; | ||
| 513 | + margin: 0 auto; | ||
| 514 | + display: flex; | ||
| 515 | + flex-wrap: wrap; | ||
| 516 | + justify-content: space-evenly; | ||
| 517 | +} | ||
| 518 | + | ||
| 519 | +.couponItems { | ||
| 520 | + width: 46%; | ||
| 521 | + margin-bottom: 24rpx; | ||
| 522 | + padding-bottom: 52rpx; | ||
| 523 | + border-radius: 20rpx; | ||
| 524 | + border: 2rpx solid #ff7e06; | ||
| 525 | + background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%); | ||
| 526 | +} | ||
| 527 | + | ||
| 528 | +.couponNum { | ||
| 529 | + background: #727272; | ||
| 530 | + border-radius: 50%; | ||
| 531 | + color: #fff; | ||
| 532 | + width: 40rpx; | ||
| 533 | + height: 40rpx; | ||
| 534 | + display: flex; | ||
| 535 | + align-items: center; | ||
| 536 | + justify-content: center; | ||
| 537 | + margin: 8rpx 0 0 8rpx; | ||
| 538 | +} | ||
| 539 | + | ||
| 540 | +.couponPrice { | ||
| 541 | + display: flex; | ||
| 542 | + align-items: center; | ||
| 543 | + justify-content: center; | ||
| 544 | + color: #F6231B; | ||
| 545 | + font-weight: 500; | ||
| 546 | +} | ||
| 547 | + | ||
| 548 | +.couponLines{ | ||
| 549 | + width: 80%; | ||
| 550 | + margin: 0 auto; | ||
| 551 | + height: 2rpx; | ||
| 552 | + border-bottom: 2rpx dashed #F6231B; | ||
| 553 | +} | ||
| 554 | + | ||
| 555 | +.couponPrice text { | ||
| 556 | + margin-left: 4rpx; | ||
| 557 | + font-size: 76rpx; | ||
| 558 | + font-weight: 700; | ||
| 559 | +} | ||
| 560 | + | ||
| 561 | +.couponCondition { | ||
| 562 | + color: #C36607; | ||
| 563 | + display: flex; | ||
| 564 | + align-items: center; | ||
| 565 | + justify-content: center; | ||
| 566 | + padding-top: 24rpx; | ||
| 567 | +} | ||
| 568 | + | ||
| 569 | +.couponBtn { | ||
| 570 | + width: 80%; | ||
| 571 | + margin: 0 auto; | ||
| 572 | + border-radius: 42rpx; | ||
| 573 | + background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%); | ||
| 574 | + font-weight: 400; | ||
| 575 | + color: #fff; | ||
| 576 | + text-align: center; | ||
| 577 | + border: 4rpx solid #fff; | ||
| 578 | + padding: 12rpx 0; | ||
| 579 | + margin: 16rpx auto 20rpx auto; | ||
| 580 | +} | ||
| 581 | + | ||
| 582 | +.couponText { | ||
| 583 | + color: #fff; | ||
| 584 | + text-decoration: underline; | ||
| 585 | + text-align: center; | ||
| 586 | +} | ||
| 587 | + | ||
| 588 | +.closeImg { | ||
| 589 | + width: 60rpx; | ||
| 590 | + height: 60rpx; | ||
| 591 | + position: absolute; | ||
| 592 | + right: 0; | ||
| 593 | + top: 0; | ||
| 326 | } | 594 | } |
-
Please register or login to post a comment