Commit 3160b78f714e46cbb495c85cfe73f8391698835b

Authored by pengye
1 parent 384f643d

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

Showing 31 changed files with 4888 additions and 1445 deletions
... ... @@ -96,7 +96,8 @@
"pack/examineCertificate",
"pack/subscribeDrawback",
"pack/vipRecharge",
"pack/seeRecharge"
"pack/seeRecharge",
"pack/receiveCoupon"
]
},
{
... ...
... ... @@ -66,6 +66,7 @@ Page({
isMoreBtn:'',//再次预订按钮
isPaymenBtn:'',//支付定金按钮
isShareItem:'',//转发客人按钮
couponArr: [],//待领取的优惠券列表
},
tablestr: '',
urlsValue: [],
... ... @@ -75,6 +76,7 @@ Page({
timers: null, // 动画定时器
n: 0,
modal:'',
couponModal: '',
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -102,6 +104,7 @@ Page({
wx.onUserCaptureScreen((res)=> {
this.showModal()
})
this.couponModal = this.selectComponent("#couponModal");
},
// 打开截屏弹框
showModal() {
... ... @@ -111,6 +114,10 @@ Page({
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框
closeCouponModal() {
this.couponModal.closeModal()
},
// 页面滚动事件
onPageScroll: function (event) {
const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
... ... @@ -456,9 +463,10 @@ Page({
uid
}).then((json) => {
if (json.ret == 200) {
console.log('staffinfostaffinfostaffinfo', json.data)
console.log('客户经理获取基本信息------', json.data)
this.setData({
staffinfo: json.data
staffinfo: json.data,
couponArr:[],
})
this.getSellerTemplateConfFun(sid);
}
... ... @@ -579,7 +587,7 @@ Page({
let data = res.data
console.log('data', data);
let couponList = []
let themeColor, StyleType, titleType, themeSixteen, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
let themeColor, StyleType, titleType, themeSixteen, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -598,29 +606,23 @@ Page({
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
marketing.coupon_data_payList = coupon_data_pay
coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
marketing.coupon_data_freeList = coupon_data_free
let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
let couponDataId = info && info.length > 0 ? info[0].id : {}
// 根据券ID获取评价赠送的券详情
if(couponDataId) this.getEvaluateFun(couponDataId)
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
// 获取全部的优惠券(商家券、个人券、免费券、付费券)
couponList = this.addCoupons(coupon,couponList);
couponList = this.addCoupons(coupon_data_pay,couponList);
couponList = this.addCoupons(coupon_data_free,couponList);
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
this.getActivityByIdFun(couponList)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
... ... @@ -742,13 +744,16 @@ Page({
})
},
// 点击商家有礼
gotoSellerGift(){
let url = util.http_build_query({
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
},
// 再次预订
secondbook() {
... ... @@ -902,34 +907,172 @@ Page({
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === coupon_dataList.length) {
coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})
console.log('邀请函--------------------优惠券',coupon_dataList);
this.setData({
coupon_dataList,
})
}
}
})
})
},
getActivityByIdFun(obj) {
App.Activity.GetActivityById({
id: obj.map(item => item.id).join(','),
}).then(res => {
if (res.data.length > 0) {
let list = res.data.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
let num = detail.receiveNum;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
})
let freeCoupons = list.filter(item => {
return item.is_type == '3'
})
// 免费券判断是否领取,弹框领取
if (freeCoupons.length > 0) {
let length = freeCoupons.length - 1
freeCoupons.forEach(i => {
this.getCoupon(i, freeCoupons[length].id, obj)
})
}
console.log('邀请函--------------------优惠券', list);
this.setData({
coupon_dataList: list,
})
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
let couponArr = this.data.couponArr;
let totalPrice = this.data.totalPrice;
App.Activity.ActivityListByOpenid({
aid: item.id
}).then(res => {
if (res.ret == 200) {
if (res.data.length == 0) {
couponArr.push(item)
}
if (item.id == id && couponArr.length > 0) {
couponArr.forEach(item => {
let match = obj.find(b => b.id === item.id);
if (match) {
item.number = match.number;
}
});
totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
this.setcouponFun(couponArr)
this.couponModal.showModal()
}
console.log('未领取的券列表-----------', couponArr);
this.setData({
couponArr,
totalPrice
})
}
})
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
... ... @@ -11,6 +11,7 @@
/>
<image class="giftImg"
bindtap="gotoSellerGift"
data-form="1"
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)}}"
src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
<image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
... ... @@ -83,29 +84,49 @@
</view>
</view>
</block>
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}">
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="itemLeft">
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
<view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font40r">¥</view>{{item.price}}
<view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
</view>
<view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
</view>
<view class="couponLine"></view>
<view class="itemRight">
<view class="btns">
<text class="font40r">{{item.aname}}</text>
<view class="font24r orderingFood">
抢购
</view>
<block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
</view>
</block>
<block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
<view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
<view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可使用:</view>
<view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
</block>
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
<view class="btnBox" wx:if="{{item.is_type == '3'}}" >
<view class="font24r orderingFood orderingFood1">已领取</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
</view>
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
<view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
立即抢购
</view>
</view>
</view>
... ... @@ -326,4 +347,24 @@
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
<view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
</view>
<view slot="modalContent">
<view class="couponBox">
<view wx:for="{{couponArr}}" class="couponItems">
<view class="couponNum font20r">×{{item.number}}</view>
<view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
<view class="couponLines"></view>
<view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="font28r couponCondition" wx:else>无门槛</view>
</view>
</view>
<view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -271,13 +271,103 @@
flex-shrink: 0;
}
.preferentialCoupon .itemRight {
width: 74%;
display: flex;
align-items: center;
}
.preferentialCoupon .itemLeft {
width: 26%;
}
.preferentialCoupon .couponLine{
margin: 24rpx 0;
border-right: 2rpx dashed #f6231b;
}
.preferentialCoupon .orderingFood {
padding: 0 20rpx;
color: #fff !important;
border: none !important;
text-align: center;
border-radius: 20rpx;
line-height: 44rpx;
height: 44rpx;
width: max-content;
flex-shrink: 0;
background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
}
.preferentialCoupon .icons {
color: #F6231B;
text-align: center;
}
.preferentialCoupon .priceText {
display: flex;
align-items: baseline;
justify-content: center;
font-family: PingFang SC;
color: #F6231B;
font-weight: 600;
font-size: 48rpx;
margin-top: 6rpx;
}
.preferentialCoupon .priceText text {
font-size: 48rpx;
}
.preferentialCoupon .btns {
flex: 1;
}
.preferentialCoupon .btnBox {
display: flex;
flex-direction: column;
}
.preferentialCoupon .grantNum {
display: flex;
flex-direction: column;
align-items: center;
color: #C36607;
margin-top: 10rpx;
}
.preferentialCoupon .grantNum text {
color: #F6231B;
margin-right: 10rpx;
}
.preferentialCoupon .btns text {
font-weight: 600;
}
.preferentialCoupon .orderingFood1 {
border: 2rpx solid #fa4b20 !important;
background: transparent !important;
color: #fa4b20 !important;
}
.preferentialCoupon .btns text {
color: #0B0805 !important;
}
.preferentialCoupon .bottom {
color: #C36607 !important;
}
.preferentialCoupon .nodate{
margin-left: 20rpx;
}
.preferentialItems {
display: flex;
background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat;
background-size: 100% 100%;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
border: 2rpx solid #ff7e06;
}
.rechargeItems {
... ... @@ -290,6 +380,7 @@
height: auto;
padding: 12rpx 0;
margin: 0 20rpx;
border: none;
}
.rechargeItems .orderingFood {
... ... @@ -331,6 +422,20 @@
top: 12rpx;
}
.discountText1{
text-align: center;
color: #FD4D59;
border: 2rpx solid #FD4D59;
border-radius: 6rpx;
font-family: PingFang SC;
background: transparent;
width: max-content;
padding: 0 6rpx;
position: absolute;
left: 16rpx;
top: 12rpx;
}
.famousChefBox .labelBox,
.stopBox .labelBox {
border-bottom: none;
... ... @@ -424,9 +529,7 @@
}
.priceText .icons {
font-family: 'Abel';
color: #FD4D59;
font-size: 40rpx;
}
.itemRight {
... ... @@ -440,6 +543,7 @@
display: flex;
justify-content: space-between;
align-items: baseline;
flex-direction: column;
}
.btns text {
... ... @@ -696,6 +800,145 @@
box-sizing: border-box;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
}
#couponModal .titleModal2 {
margin-top: 80%;
}
#couponModal .titleModal3 {
margin-top: 60%;
}
#couponModal .titleModal4 {
margin-top: 30%;
}
#couponModal .mymodal {
background: rgba(0, 0, 0, 0.8);
width: 100% !important;
top: 0 !important;
height: auto !important;
z-index: 300;
}
.nameInfo {
font-family: PingFang SC;
font-weight: 400;
font-size: 52rpx;
line-height: 56rpx;
color: #fff;
margin-bottom: 40rpx;
padding-top: 60rpx;
}
.couponTotal {
color: #dfdfdf;
font-family: PingFang SC;
font-weight: 400;
font-size: 40rpx;
line-height: 48rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponTotal text {
color: #ffc806;
font-weight: 600;
font-size: 80rpx;
margin: 0 14rpx;
}
.couponBox {
width: 80%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.couponItems {
width: 46%;
margin-bottom: 24rpx;
padding-bottom: 52rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
}
.couponNum {
background: #727272;
border-radius: 50%;
color: #fff;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 8rpx 0 0 8rpx;
}
.couponPrice {
display: flex;
align-items: center;
justify-content: center;
color: #F6231B;
font-weight: 500;
}
.couponLines{
width: 80%;
margin: 0 auto;
height: 2rpx;
border-bottom: 2rpx dashed #F6231B;
}
.couponPrice text {
margin-left: 4rpx;
font-size: 76rpx;
font-weight: 700;
}
.couponCondition {
color: #C36607;
display: flex;
align-items: center;
justify-content: center;
padding-top: 24rpx;
}
.couponBtn {
width: 80%;
margin: 0 auto;
border-radius: 42rpx;
background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
font-weight: 400;
color: #fff;
text-align: center;
border: 4rpx solid #fff;
padding: 12rpx 0;
margin: 16rpx auto 20rpx auto;
}
.couponText {
color: #fff;
text-decoration: underline;
text-align: center;
}
.closeImg {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0;
top: 0;
}
/* 深中国红 */
.crimson,
.crimson .positioningBox {
... ... @@ -987,14 +1230,6 @@
color: #578C69;
}
.pearlWhite .preferentialItems {
background: url(https://nosqn.colorcun.com/certificateWhiteBj1.png) no-repeat;
background-size: 100% 100%;
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
}
.pearlWhite .rechargeItems {
background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat;
background-size: 100% 100%;
... ... @@ -1053,12 +1288,6 @@
color: #578C69;
}
.pearlWhite .discountText {
background: transparent;
border: 2rpx solid #FD4D59;
color: #FD4D59;
}
.toastBox {
width: fit-content;
position: fixed;
... ...
... ... @@ -66,6 +66,7 @@ Page({
isMoreBtn:'',//再次预订按钮
isPaymenBtn:'',//支付定金按钮
isShareItem:'',//转发客人按钮
couponArr: [],//待领取的优惠券列表
},
tablestr: '',
urlsValue: [],
... ... @@ -75,6 +76,7 @@ Page({
timers: null, // 动画定时器
n: 0,
modal:'',
couponModal: '',
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -102,6 +104,7 @@ Page({
wx.onUserCaptureScreen((res)=> {
this.showModal()
})
this.couponModal = this.selectComponent("#couponModal");
},
// 打开截屏弹框
showModal() {
... ... @@ -111,6 +114,10 @@ Page({
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框
closeCouponModal() {
this.couponModal.closeModal()
},
// 页面滚动事件
onPageScroll: function (event) {
const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
... ... @@ -456,9 +463,10 @@ Page({
uid
}).then((json) => {
if (json.ret == 200) {
console.log('staffinfostaffinfostaffinfo', json.data)
console.log('客户经理获取基本信息------', json.data)
this.setData({
staffinfo: json.data
staffinfo: json.data,
couponArr:[],
})
this.getSellerTemplateConfFun(sid);
}
... ... @@ -579,7 +587,7 @@ Page({
let data = res.data
console.log('data', data);
let couponList = []
let themeColor, StyleType, titleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
let themeColor, StyleType, titleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -598,29 +606,23 @@ Page({
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
marketing.coupon_data_payList = coupon_data_pay
coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
marketing.coupon_data_freeList = coupon_data_free
let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
let couponDataId = info && info.length > 0 ? info[0].id : {}
// 根据券ID获取评价赠送的券详情
if(couponDataId) this.getEvaluateFun(couponDataId)
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
// 获取全部的优惠券(商家券、个人券、免费券、付费券)
couponList = this.addCoupons(coupon,couponList);
couponList = this.addCoupons(coupon_data_pay,couponList);
couponList = this.addCoupons(coupon_data_free,couponList);
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
this.getActivityByIdFun(couponList)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
... ... @@ -697,13 +699,16 @@ Page({
})
},
// 点击商家有礼
gotoSellerGift(){
let url = util.http_build_query({
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
},
// 再次预订
secondbook() {
... ... @@ -857,34 +862,172 @@ Page({
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === coupon_dataList.length) {
coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})
console.log('邀请函--------------------优惠券',coupon_dataList);
this.setData({
coupon_dataList,
})
}
}
})
})
},
getActivityByIdFun(obj) {
App.Activity.GetActivityById({
id: obj.map(item => item.id).join(','),
}).then(res => {
if (res.data.length > 0) {
let list = res.data.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
let num = detail.receiveNum;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
})
let freeCoupons = list.filter(item => {
return item.is_type == '3'
})
// 免费券判断是否领取,弹框领取
if (freeCoupons.length > 0) {
let length = freeCoupons.length - 1
freeCoupons.forEach(i => {
this.getCoupon(i, freeCoupons[length].id, obj)
})
}
console.log('邀请函--------------------优惠券', list);
this.setData({
coupon_dataList: list,
})
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
let couponArr = this.data.couponArr;
let totalPrice = this.data.totalPrice;
App.Activity.ActivityListByOpenid({
aid: item.id
}).then(res => {
if (res.ret == 200) {
if (res.data.length == 0) {
couponArr.push(item)
}
if (item.id == id && couponArr.length > 0) {
couponArr.forEach(item => {
let match = obj.find(b => b.id === item.id);
if (match) {
item.number = match.number;
}
});
totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
this.setcouponFun(couponArr)
this.couponModal.showModal()
}
console.log('未领取的券列表-----------', couponArr);
this.setData({
couponArr,
totalPrice
})
}
})
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
... ... @@ -11,6 +11,7 @@
/>
<image class="giftImg"
bindtap="gotoSellerGift"
data-form="1"
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)}}"
src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
<image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
... ... @@ -89,29 +90,49 @@
</button>
</view>
</view>
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}">
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="itemLeft">
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
<view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font40r">¥</view>{{item.price}}
<view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
</view>
<view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
</view>
<view class="couponLine"></view>
<view class="itemRight">
<view class="btns">
<text class="font40r">{{item.aname}}</text>
<view class="font24r orderingFood">
抢购
</view>
<block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
</view>
</block>
<block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
<view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
<view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
<view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
</block>
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
<view class="btnBox" wx:if="{{item.is_type == '3'}}" >
<view class="font24r orderingFood orderingFood1">已领取</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
</view>
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
<view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
立即抢购
</view>
</view>
</view>
... ... @@ -331,4 +352,24 @@
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
<view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
</view>
<view slot="modalContent">
<view class="couponBox">
<view wx:for="{{couponArr}}" class="couponItems">
<view class="couponNum font20r">×{{item.number}}</view>
<view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
<view class="couponLines"></view>
<view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="font28r couponCondition" wx:else>无门槛</view>
</view>
</view>
<view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -298,13 +298,104 @@
flex-shrink: 0;
}
.preferentialCoupon .itemRight {
width: 74%;
display: flex;
align-items: center;
}
.preferentialCoupon .itemLeft {
width: 26%;
}
.preferentialCoupon .couponLine{
margin: 24rpx 0;
border-right: 2rpx dashed #f6231b;
}
.preferentialCoupon .orderingFood {
padding: 0 20rpx;
color: #fff !important;
border: none !important;
text-align: center;
border-radius: 20rpx;
line-height: 44rpx;
height: 44rpx;
width: max-content;
flex-shrink: 0;
background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
}
.preferentialCoupon .icons {
color: #F6231B;
text-align: center;
}
.preferentialCoupon .priceText {
display: flex;
align-items: baseline;
justify-content: center;
font-family: PingFang SC;
color: #F6231B;
font-weight: 600;
font-size: 48rpx;
margin-top: 6rpx;
}
.preferentialCoupon .priceText text {
font-size: 48rpx;
}
.preferentialCoupon .btns {
flex: 1;
}
.preferentialCoupon .btnBox {
display: flex;
flex-direction: column;
}
.preferentialCoupon .grantNum {
display: flex;
flex-direction: column;
align-items: center;
color: #C36607;
margin-top: 10rpx;
}
.preferentialCoupon .grantNum text {
color: #F6231B;
margin-right: 10rpx;
}
.preferentialCoupon .btns text {
font-weight: 600;
}
.preferentialCoupon .orderingFood1 {
border: 2rpx solid #fa4b20 !important;
background: transparent !important;
color: #fa4b20 !important;
}
.preferentialCoupon .btns text {
color: #0B0805 !important;
}
.preferentialCoupon .bottom {
color: #C36607 !important;
}
.preferentialCoupon .nodate{
margin-left: 20rpx;
}
.preferentialItems {
display: flex;
background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat;
background-size: 100% 100%;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
}
.rechargeItems {
... ... @@ -317,6 +408,7 @@
height: auto;
padding: 12rpx 0;
margin: 0 20rpx;
border: none;
}
.rechargeItems .orderingFood {
... ... @@ -358,6 +450,20 @@
top: 12rpx;
}
.discountText1{
text-align: center;
color: #FD4D59;
border: 2rpx solid #FD4D59;
border-radius: 6rpx;
font-family: PingFang SC;
background: transparent;
width: max-content;
padding: 0 6rpx;
position: absolute;
left: 16rpx;
top: 12rpx;
}
.famousChefBox .labelBox,
.stopBox .labelBox {
border-bottom: none;
... ... @@ -451,9 +557,7 @@
}
.priceText .icons {
font-family: 'Abel';
color: #FD4D59;
font-size: 40rpx;
}
.itemRight {
... ... @@ -467,6 +571,7 @@
display: flex;
justify-content: space-between;
align-items: baseline;
flex-direction: column;
}
.btns text {
... ... @@ -727,6 +832,145 @@
box-sizing: border-box;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
}
#couponModal .titleModal2 {
margin-top: 80%;
}
#couponModal .titleModal3 {
margin-top: 60%;
}
#couponModal .titleModal4 {
margin-top: 30%;
}
#couponModal .mymodal {
background: rgba(0, 0, 0, 0.8);
width: 100% !important;
top: 0 !important;
height: auto !important;
z-index: 300;
}
.nameInfo {
font-family: PingFang SC;
font-weight: 400;
font-size: 52rpx;
line-height: 56rpx;
color: #fff;
margin-bottom: 40rpx;
padding-top: 60rpx;
}
.couponTotal {
color: #dfdfdf;
font-family: PingFang SC;
font-weight: 400;
font-size: 40rpx;
line-height: 48rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponTotal text {
color: #ffc806;
font-weight: 600;
font-size: 80rpx;
margin: 0 14rpx;
}
.couponBox {
width: 80%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.couponItems {
width: 46%;
margin-bottom: 24rpx;
padding-bottom: 52rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
}
.couponNum {
background: #727272;
border-radius: 50%;
color: #fff;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 8rpx 0 0 8rpx;
}
.couponPrice {
display: flex;
align-items: center;
justify-content: center;
color: #F6231B;
font-weight: 500;
}
.couponLines{
width: 80%;
margin: 0 auto;
height: 2rpx;
border-bottom: 2rpx dashed #F6231B;
}
.couponPrice text {
margin-left: 4rpx;
font-size: 76rpx;
font-weight: 700;
}
.couponCondition {
color: #C36607;
display: flex;
align-items: center;
justify-content: center;
padding-top: 24rpx;
}
.couponBtn {
width: 80%;
margin: 0 auto;
border-radius: 42rpx;
background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
font-weight: 400;
color: #fff;
text-align: center;
border: 4rpx solid #fff;
padding: 12rpx 0;
margin: 16rpx auto 20rpx auto;
}
.couponText {
color: #fff;
text-decoration: underline;
text-align: center;
}
.closeImg {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0;
top: 0;
}
/* 深中国红 */
.crimson,
.crimson .positioningBox {
... ... @@ -1017,14 +1261,6 @@
color: #578C69;
}
.pearlWhite .preferentialItems {
background: url(https://nosqn.colorcun.com/certificateWhiteBj1.png) no-repeat;
background-size: 100% 100%;
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
}
.pearlWhite .rechargeItems {
background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat;
background-size: 100% 100%;
... ... @@ -1080,12 +1316,6 @@
border: none;
}
.pearlWhite .discountText {
background: transparent;
border: 2rpx solid #FD4D59;
color: #FD4D59;
}
.toastBox {
width: fit-content;
position: fixed;
... ...
... ... @@ -66,6 +66,7 @@ Page({
isMoreBtn:'',//再次预订按钮
isPaymenBtn:'',//支付定金按钮
isShareItem:'',//转发客人按钮
couponArr: [],//待领取的优惠券列表
},
tablestr: '',
urlsValue: [],
... ... @@ -75,6 +76,7 @@ Page({
timers: null, // 动画定时器
n: 0,
modal:'',
couponModal: '',
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -102,6 +104,7 @@ Page({
wx.onUserCaptureScreen((res)=> {
this.showModal()
})
this.couponModal = this.selectComponent("#couponModal");
},
// 打开截屏弹框
showModal() {
... ... @@ -111,6 +114,10 @@ Page({
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框
closeCouponModal() {
this.couponModal.closeModal()
},
// 页面滚动事件
onPageScroll: function (event) {
const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
... ... @@ -456,9 +463,10 @@ Page({
uid
}).then((json) => {
if (json.ret == 200) {
console.log('staffinfostaffinfostaffinfo', json.data)
console.log('客户经理获取基本信息------', json.data)
this.setData({
staffinfo: json.data
staffinfo: json.data,
couponArr:[],
})
this.getSellerTemplateConfFun(sid);
}
... ... @@ -579,7 +587,7 @@ Page({
let data = res.data
console.log('data', data);
let couponList = []
let themeColor, StyleType, titleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
let themeColor, StyleType, titleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -598,29 +606,23 @@ Page({
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
marketing.coupon_data_payList = coupon_data_pay
coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
marketing.coupon_data_freeList = coupon_data_free
let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
let couponDataId = info && info.length > 0 ? info[0].id : {}
// 根据券ID获取评价赠送的券详情
if(couponDataId) this.getEvaluateFun(couponDataId)
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
// 获取全部的优惠券(商家券、个人券、免费券、付费券)
couponList = this.addCoupons(coupon,couponList);
couponList = this.addCoupons(coupon_data_pay,couponList);
couponList = this.addCoupons(coupon_data_free,couponList);
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
this.getActivityByIdFun(couponList)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
... ... @@ -697,13 +699,16 @@ Page({
})
},
// 点击商家有礼
gotoSellerGift(){
let url = util.http_build_query({
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
},
// 再次预订
secondbook() {
... ... @@ -857,34 +862,172 @@ Page({
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === coupon_dataList.length) {
coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})
console.log('邀请函--------------------优惠券',coupon_dataList);
this.setData({
coupon_dataList,
})
}
}
})
})
},
getActivityByIdFun(obj) {
App.Activity.GetActivityById({
id: obj.map(item => item.id).join(','),
}).then(res => {
if (res.data.length > 0) {
let list = res.data.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
let num = detail.receiveNum;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
})
let freeCoupons = list.filter(item => {
return item.is_type == '3'
})
// 免费券判断是否领取,弹框领取
if (freeCoupons.length > 0) {
let length = freeCoupons.length - 1
freeCoupons.forEach(i => {
this.getCoupon(i, freeCoupons[length].id, obj)
})
}
console.log('邀请函--------------------优惠券', list);
this.setData({
coupon_dataList: list,
})
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
let couponArr = this.data.couponArr;
let totalPrice = this.data.totalPrice;
App.Activity.ActivityListByOpenid({
aid: item.id
}).then(res => {
if (res.ret == 200) {
if (res.data.length == 0) {
couponArr.push(item)
}
if (item.id == id && couponArr.length > 0) {
couponArr.forEach(item => {
let match = obj.find(b => b.id === item.id);
if (match) {
item.number = match.number;
}
});
totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
this.setcouponFun(couponArr)
this.couponModal.showModal()
}
console.log('未领取的券列表-----------', couponArr);
this.setData({
couponArr,
totalPrice
})
}
})
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
... ... @@ -10,6 +10,7 @@
/>
<image class="giftImg"
bindtap="gotoSellerGift"
data-form="1"
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)}}"
src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
<image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
... ... @@ -72,29 +73,49 @@
导航到店
</button>
</view>
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}">
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="itemLeft">
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
<view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font40r">¥</view>{{item.price}}
<view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
</view>
<view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
</view>
<view class="couponLine"></view>
<view class="itemRight">
<view class="btns">
<text class="font40r">{{item.aname}}</text>
<view class="font24r orderingFood">
抢购
</view>
<block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
</view>
</block>
<block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
<view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
<view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
<view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
</block>
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
<view class="btnBox" wx:if="{{item.is_type == '3'}}" >
<view class="font24r orderingFood orderingFood1">已领取</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
</view>
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
<view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
立即抢购
</view>
</view>
</view>
... ... @@ -314,4 +335,24 @@
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
<view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
</view>
<view slot="modalContent">
<view class="couponBox">
<view wx:for="{{couponArr}}" class="couponItems">
<view class="couponNum font20r">×{{item.number}}</view>
<view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
<view class="couponLines"></view>
<view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="font28r couponCondition" wx:else>无门槛</view>
</view>
</view>
<view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -288,13 +288,104 @@
flex-shrink: 0;
}
.preferentialCoupon .itemRight {
width: 74%;
display: flex;
align-items: center;
}
.preferentialCoupon .itemLeft {
width: 26%;
}
.preferentialCoupon .couponLine{
margin: 24rpx 0;
border-right: 2rpx dashed #f6231b;
}
.preferentialCoupon .orderingFood {
padding: 0 20rpx;
color: #fff !important;
border: none !important;
text-align: center;
border-radius: 20rpx;
line-height: 44rpx;
height: 44rpx;
width: max-content;
flex-shrink: 0;
background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
}
.preferentialCoupon .icons {
color: #F6231B;
text-align: center;
}
.preferentialCoupon .priceText {
display: flex;
align-items: baseline;
justify-content: center;
font-family: PingFang SC;
color: #F6231B;
font-weight: 600;
font-size: 48rpx;
margin-top: 6rpx;
}
.preferentialCoupon .priceText text {
font-size: 48rpx;
}
.preferentialCoupon .btns {
flex: 1;
}
.preferentialCoupon .btnBox {
display: flex;
flex-direction: column;
}
.preferentialCoupon .grantNum {
display: flex;
flex-direction: column;
align-items: center;
color: #C36607;
margin-top: 10rpx;
}
.preferentialCoupon .grantNum text {
color: #F6231B;
margin-right: 10rpx;
}
.preferentialCoupon .btns text {
font-weight: 600;
}
.preferentialCoupon .orderingFood1 {
border: 2rpx solid #fa4b20 !important;
background: transparent !important;
color: #fa4b20 !important;
}
.preferentialCoupon .btns text {
color: #0B0805 !important;
}
.preferentialCoupon .bottom {
color: #C36607 !important;
}
.preferentialCoupon .nodate{
margin-left: 20rpx;
}
.preferentialItems {
display: flex;
background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat;
background-size: 100% 100%;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
}
.rechargeItems {
... ... @@ -307,6 +398,7 @@
height: auto;
padding: 12rpx 0;
margin: 0 20rpx;
border: none;
}
.rechargeItems .orderingFood {
... ... @@ -348,6 +440,20 @@
top: 12rpx;
}
.discountText1{
text-align: center;
color: #FD4D59;
border: 2rpx solid #FD4D59;
border-radius: 6rpx;
font-family: PingFang SC;
background: transparent;
width: max-content;
padding: 0 6rpx;
position: absolute;
left: 16rpx;
top: 12rpx;
}
.famousChefBox .labelBox,
.stopBox .labelBox {
border-bottom: none;
... ... @@ -441,9 +547,7 @@
}
.priceText .icons {
font-family: 'Abel';
color: #FD4D59;
font-size: 40rpx;
}
.itemRight {
... ... @@ -457,6 +561,7 @@
display: flex;
justify-content: space-between;
align-items: baseline;
flex-direction: column;
}
.btns text {
... ... @@ -717,6 +822,145 @@
box-sizing: border-box;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
}
#couponModal .titleModal2 {
margin-top: 80%;
}
#couponModal .titleModal3 {
margin-top: 60%;
}
#couponModal .titleModal4 {
margin-top: 30%;
}
#couponModal .mymodal {
background: rgba(0, 0, 0, 0.8);
width: 100% !important;
top: 0 !important;
height: auto !important;
z-index: 300;
}
.nameInfo {
font-family: PingFang SC;
font-weight: 400;
font-size: 52rpx;
line-height: 56rpx;
color: #fff;
margin-bottom: 40rpx;
padding-top: 60rpx;
}
.couponTotal {
color: #dfdfdf;
font-family: PingFang SC;
font-weight: 400;
font-size: 40rpx;
line-height: 48rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponTotal text {
color: #ffc806;
font-weight: 600;
font-size: 80rpx;
margin: 0 14rpx;
}
.couponBox {
width: 80%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.couponItems {
width: 46%;
margin-bottom: 24rpx;
padding-bottom: 52rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
}
.couponNum {
background: #727272;
border-radius: 50%;
color: #fff;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 8rpx 0 0 8rpx;
}
.couponPrice {
display: flex;
align-items: center;
justify-content: center;
color: #F6231B;
font-weight: 500;
}
.couponLines{
width: 80%;
margin: 0 auto;
height: 2rpx;
border-bottom: 2rpx dashed #F6231B;
}
.couponPrice text {
margin-left: 4rpx;
font-size: 76rpx;
font-weight: 700;
}
.couponCondition {
color: #C36607;
display: flex;
align-items: center;
justify-content: center;
padding-top: 24rpx;
}
.couponBtn {
width: 80%;
margin: 0 auto;
border-radius: 42rpx;
background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
font-weight: 400;
color: #fff;
text-align: center;
border: 4rpx solid #fff;
padding: 12rpx 0;
margin: 16rpx auto 20rpx auto;
}
.couponText {
color: #fff;
text-decoration: underline;
text-align: center;
}
.closeImg {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0;
top: 0;
}
/* 深中国红 */
.crimson,
.crimson .positioningBox {
... ... @@ -1050,14 +1294,6 @@
color: #578C69;
}
.pearlWhite .preferentialItems {
background: url(https://nosqn.colorcun.com/certificateWhiteBj1.png) no-repeat;
background-size: 100% 100%;
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
}
.pearlWhite .rechargeItems {
background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat;
background-size: 100% 100%;
... ... @@ -1125,12 +1361,6 @@
border: none;
}
.pearlWhite .discountText {
background: transparent;
border: 2rpx solid #FD4D59;
color: #FD4D59;
}
.toastBox {
width: fit-content;
position: fixed;
... ...
... ... @@ -65,6 +65,7 @@ Page({
isMoreBtn:'',//再次预订按钮
isPaymenBtn:'',//支付定金按钮
isShareItem:'',//转发客人按钮
couponArr: [],//待领取的优惠券列表
},
tablestr: '',
urlsValue: [],
... ... @@ -74,6 +75,7 @@ Page({
timers: null, // 动画定时器
n: 0,
modal:'',
couponModal: '',
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -101,6 +103,7 @@ Page({
wx.onUserCaptureScreen((res)=> {
this.showModal()
})
this.couponModal = this.selectComponent("#couponModal");
},
// 打开截屏弹框
showModal() {
... ... @@ -110,6 +113,10 @@ Page({
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框
closeCouponModal() {
this.couponModal.closeModal()
},
// 页面滚动事件
onPageScroll: function (event) {
const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
... ... @@ -455,9 +462,10 @@ Page({
uid
}).then((json) => {
if (json.ret == 200) {
console.log('staffinfostaffinfostaffinfo', json.data)
console.log('客户经理获取基本信息------', json.data)
this.setData({
staffinfo: json.data
staffinfo: json.data,
couponArr:[],
})
this.getSellerTemplateConfFun(sid);
}
... ... @@ -578,7 +586,7 @@ Page({
let data = res.data
console.log('data', data);
let couponList = []
let themeColor, StyleType, titleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
let themeColor, StyleType, titleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -597,29 +605,23 @@ Page({
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
marketing.coupon_data_payList = coupon_data_pay
coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
marketing.coupon_data_freeList = coupon_data_free
let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
let couponDataId = info && info.length > 0 ? info[0].id : {}
// 根据券ID获取评价赠送的券详情
if(couponDataId) this.getEvaluateFun(couponDataId)
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
// 获取全部的优惠券(商家券、个人券、免费券、付费券)
couponList = this.addCoupons(coupon,couponList);
couponList = this.addCoupons(coupon_data_pay,couponList);
couponList = this.addCoupons(coupon_data_free,couponList);
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
this.getActivityByIdFun(couponList)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
... ... @@ -696,13 +698,16 @@ Page({
})
},
// 点击商家有礼
gotoSellerGift(){
let url = util.http_build_query({
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
},
// 再次预订
secondbook() {
... ... @@ -856,34 +861,172 @@ Page({
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === coupon_dataList.length) {
coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})
console.log('邀请函--------------------优惠券',coupon_dataList);
this.setData({
coupon_dataList,
})
}
}
})
})
},
getActivityByIdFun(obj) {
App.Activity.GetActivityById({
id: obj.map(item => item.id).join(','),
}).then(res => {
if (res.data.length > 0) {
let list = res.data.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
let num = detail.receiveNum;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
})
let freeCoupons = list.filter(item => {
return item.is_type == '3'
})
// 免费券判断是否领取,弹框领取
if (freeCoupons.length > 0) {
let length = freeCoupons.length - 1
freeCoupons.forEach(i => {
this.getCoupon(i, freeCoupons[length].id, obj)
})
}
console.log('邀请函--------------------优惠券', list);
this.setData({
coupon_dataList: list,
})
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
let couponArr = this.data.couponArr;
let totalPrice = this.data.totalPrice;
App.Activity.ActivityListByOpenid({
aid: item.id
}).then(res => {
if (res.ret == 200) {
if (res.data.length == 0) {
couponArr.push(item)
}
if (item.id == id && couponArr.length > 0) {
couponArr.forEach(item => {
let match = obj.find(b => b.id === item.id);
if (match) {
item.number = match.number;
}
});
totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
this.setcouponFun(couponArr)
this.couponModal.showModal()
}
console.log('未领取的券列表-----------', couponArr);
this.setData({
couponArr,
totalPrice
})
}
})
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
... ... @@ -10,6 +10,7 @@
/>
<image class="giftImg"
bindtap="gotoSellerGift"
data-form="1"
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)}}"
src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
<image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
... ... @@ -70,29 +71,49 @@
</button>
</view>
</view>
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}">
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="itemLeft">
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
<view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font40r">¥</view>{{item.price}}
<view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
</view>
<view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
</view>
<view class="couponLine"></view>
<view class="itemRight">
<view class="btns">
<text class="font40r">{{item.aname}}</text>
<view class="font24r orderingFood">
抢购
</view>
<block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
</view>
</block>
<block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
<view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
<view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
<view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
</block>
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
<view class="btnBox" wx:if="{{item.is_type == '3'}}" >
<view class="font24r orderingFood orderingFood1">已领取</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
</view>
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
<view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
立即抢购
</view>
</view>
</view>
... ... @@ -313,4 +334,24 @@
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
<view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
</view>
<view slot="modalContent">
<view class="couponBox">
<view wx:for="{{couponArr}}" class="couponItems">
<view class="couponNum font20r">×{{item.number}}</view>
<view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
<view class="couponLines"></view>
<view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="font28r couponCondition" wx:else>无门槛</view>
</view>
</view>
<view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -287,13 +287,104 @@
flex-shrink: 0;
}
.preferentialCoupon .itemRight {
width: 74%;
display: flex;
align-items: center;
}
.preferentialCoupon .itemLeft {
width: 26%;
}
.preferentialCoupon .couponLine{
margin: 24rpx 0;
border-right: 2rpx dashed #f6231b;
}
.preferentialCoupon .orderingFood {
padding: 0 20rpx;
color: #fff !important;
border: none !important;
text-align: center;
border-radius: 20rpx;
line-height: 44rpx;
height: 44rpx;
width: max-content;
flex-shrink: 0;
background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
}
.preferentialCoupon .icons {
color: #F6231B;
text-align: center;
}
.preferentialCoupon .priceText {
display: flex;
align-items: baseline;
justify-content: center;
font-family: PingFang SC;
color: #F6231B;
font-weight: 600;
font-size: 48rpx;
margin-top: 6rpx;
}
.preferentialCoupon .priceText text {
font-size: 48rpx;
}
.preferentialCoupon .btns {
flex: 1;
}
.preferentialCoupon .btnBox {
display: flex;
flex-direction: column;
}
.preferentialCoupon .grantNum {
display: flex;
flex-direction: column;
align-items: center;
color: #C36607;
margin-top: 10rpx;
}
.preferentialCoupon .grantNum text {
color: #F6231B;
margin-right: 10rpx;
}
.preferentialCoupon .btns text {
font-weight: 600;
}
.preferentialCoupon .orderingFood1 {
border: 2rpx solid #fa4b20 !important;
background: transparent !important;
color: #fa4b20 !important;
}
.preferentialCoupon .btns text {
color: #0B0805 !important;
}
.preferentialCoupon .bottom {
color: #C36607 !important;
}
.preferentialCoupon .nodate{
margin-left: 20rpx;
}
.preferentialItems {
display: flex;
background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat;
background-size: 100% 100%;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
}
.rechargeItems {
... ... @@ -306,6 +397,7 @@
height: auto;
padding: 12rpx 0;
margin: 0 20rpx;
border: none;
}
.rechargeItems .orderingFood {
... ... @@ -347,6 +439,20 @@
top: 12rpx;
}
.discountText1{
text-align: center;
color: #FD4D59;
border: 2rpx solid #FD4D59;
border-radius: 6rpx;
font-family: PingFang SC;
background: transparent;
width: max-content;
padding: 0 6rpx;
position: absolute;
left: 16rpx;
top: 12rpx;
}
.famousChefBox .labelBox,
.stopBox .labelBox {
border-bottom: none;
... ... @@ -440,9 +546,7 @@
}
.priceText .icons {
font-family: 'Abel';
color: #FD4D59;
font-size: 40rpx;
}
.itemRight {
... ... @@ -456,6 +560,7 @@
display: flex;
justify-content: space-between;
align-items: baseline;
flex-direction: column;
}
.btns text {
... ... @@ -716,6 +821,145 @@
box-sizing: border-box;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
}
#couponModal .titleModal2 {
margin-top: 80%;
}
#couponModal .titleModal3 {
margin-top: 60%;
}
#couponModal .titleModal4 {
margin-top: 30%;
}
#couponModal .mymodal {
background: rgba(0, 0, 0, 0.8);
width: 100% !important;
top: 0 !important;
height: auto !important;
z-index: 300;
}
.nameInfo {
font-family: PingFang SC;
font-weight: 400;
font-size: 52rpx;
line-height: 56rpx;
color: #fff;
margin-bottom: 40rpx;
padding-top: 60rpx;
}
.couponTotal {
color: #dfdfdf;
font-family: PingFang SC;
font-weight: 400;
font-size: 40rpx;
line-height: 48rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponTotal text {
color: #ffc806;
font-weight: 600;
font-size: 80rpx;
margin: 0 14rpx;
}
.couponBox {
width: 80%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.couponItems {
width: 46%;
margin-bottom: 24rpx;
padding-bottom: 52rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
}
.couponNum {
background: #727272;
border-radius: 50%;
color: #fff;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 8rpx 0 0 8rpx;
}
.couponPrice {
display: flex;
align-items: center;
justify-content: center;
color: #F6231B;
font-weight: 500;
}
.couponLines{
width: 80%;
margin: 0 auto;
height: 2rpx;
border-bottom: 2rpx dashed #F6231B;
}
.couponPrice text {
margin-left: 4rpx;
font-size: 76rpx;
font-weight: 700;
}
.couponCondition {
color: #C36607;
display: flex;
align-items: center;
justify-content: center;
padding-top: 24rpx;
}
.couponBtn {
width: 80%;
margin: 0 auto;
border-radius: 42rpx;
background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
font-weight: 400;
color: #fff;
text-align: center;
border: 4rpx solid #fff;
padding: 12rpx 0;
margin: 16rpx auto 20rpx auto;
}
.couponText {
color: #fff;
text-decoration: underline;
text-align: center;
}
.closeImg {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0;
top: 0;
}
/* 深中国红 */
.crimson,
.crimson .positioningBox {
... ... @@ -1047,14 +1291,6 @@
color: #578C69;
}
.pearlWhite .preferentialItems {
background: url(https://nosqn.colorcun.com/certificateWhiteBj1.png) no-repeat;
background-size: 100% 100%;
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
}
.pearlWhite .rechargeItems {
background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat;
background-size: 100% 100%;
... ... @@ -1122,12 +1358,6 @@
border: none;
}
.pearlWhite .discountText {
background: transparent;
border: 2rpx solid #FD4D59;
color: #FD4D59;
}
.toastBox {
width: fit-content;
position: fixed;
... ...
... ... @@ -67,6 +67,7 @@ Page({
isMoreBtn:'',//再次预订按钮
isPaymenBtn:'',//支付定金按钮
isShareItem:'',//转发客人按钮
couponArr: [],//待领取的优惠券列表
},
screenHeight: '',
attentionAnim: {},
... ... @@ -74,6 +75,7 @@ Page({
timers: null, // 动画定时器
n: 0,
modal:'',
couponModal: '',
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -101,6 +103,7 @@ Page({
wx.onUserCaptureScreen((res)=> {
this.showModal()
})
this.couponModal = this.selectComponent("#couponModal");
},
// 打开截屏弹框
showModal() {
... ... @@ -110,6 +113,10 @@ Page({
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框
closeCouponModal() {
this.couponModal.closeModal()
},
// 页面滚动事件
onPageScroll: function (event) {
const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
... ... @@ -409,9 +416,10 @@ Page({
uid
}).then((json) => {
if (json.ret == 200) {
console.log('staffinfostaffinfostaffinfo', json.data)
console.log('客户经理获取基本信息------', json.data)
this.setData({
staffinfo: json.data
staffinfo: json.data,
couponArr:[],
})
this.getSellerTemplateConfFun(sid);
}
... ... @@ -529,7 +537,7 @@ Page({
let data = res.data
console.log('data', data);
let couponList = []
let themeColor, StyleType, titleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
let themeColor, StyleType, titleType, whiteBj, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -548,29 +556,23 @@ Page({
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
marketing.coupon_data_payList = coupon_data_pay
coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
marketing.coupon_data_freeList = coupon_data_free
let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
let couponDataId = info && info.length > 0 ? info[0].id : {}
// 根据券ID获取评价赠送的券详情
if(couponDataId) this.getEvaluateFun(couponDataId)
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
// 获取全部的优惠券(商家券、个人券、免费券、付费券)
couponList = this.addCoupons(coupon,couponList);
couponList = this.addCoupons(coupon_data_pay,couponList);
couponList = this.addCoupons(coupon_data_free,couponList);
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
this.getActivityByIdFun(couponList)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
... ... @@ -654,8 +656,11 @@ Page({
},
// 点击商家有礼
gotoSellerGift(){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
... ... @@ -812,35 +817,173 @@ Page({
}
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === coupon_dataList.length) {
coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})
console.log('邀请函--------------------优惠券',coupon_dataList);
this.setData({
coupon_dataList,
})
}
}
})
})
},
// 根据券ID获取券详情
getActivityByIdFun(obj) {
App.Activity.GetActivityById({
id: obj.map(item => item.id).join(','),
}).then(res => {
if (res.data.length > 0) {
let list = res.data.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
let num = detail.receiveNum;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
})
let freeCoupons = list.filter(item => {
return item.is_type == '3'
})
// 免费券判断是否领取,弹框领取
if (freeCoupons.length > 0) {
let length = freeCoupons.length - 1
freeCoupons.forEach(i => {
this.getCoupon(i, freeCoupons[length].id, obj)
})
}
console.log('邀请函--------------------优惠券', list);
this.setData({
coupon_dataList: list,
})
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
let couponArr = this.data.couponArr;
let totalPrice = this.data.totalPrice;
App.Activity.ActivityListByOpenid({
aid: item.id
}).then(res => {
if (res.ret == 200) {
if (res.data.length == 0) {
couponArr.push(item)
}
if (item.id == id && couponArr.length > 0) {
couponArr.forEach(item => {
let match = obj.find(b => b.id === item.id);
if (match) {
item.number = match.number;
}
});
totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
this.setcouponFun(couponArr)
this.couponModal.showModal()
}
console.log('未领取的券列表-----------', couponArr);
this.setData({
couponArr,
totalPrice
})
}
})
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
... ... @@ -11,6 +11,7 @@
/>
<image class="giftImg"
bindtap="gotoSellerGift"
data-form="1"
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)}}"
src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
<image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
... ... @@ -92,29 +93,50 @@
</view>
</view>
</view>
<view class="preferential" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}">
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="left">
<view class="top">
<text class="font28r">{{item.aname}}</text>
<view class="price font24r" wx:if="{{item.price}}">
<view class="icons font24r">¥</view>{{item.price}}
</view>
<!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discount font24r">{{item.discount}}折</text>
<view class="itemLeft">
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
<view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
<view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
</view>
<view class="couponLine"></view>
<view class="itemRight">
<view class="btns">
<text class="font40r">{{item.aname}}</text>
<block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
</view>
</block>
<block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
<view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
<view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
<view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
</block>
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
<view class="btnBox" wx:if="{{item.is_type == '3'}}" >
<view class="font24r orderingFood orderingFood1">已领取</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
</view>
</view>
<view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
立即抢购
</view>
</view>
<view class="font24r orderingFood">
去抢购
</view>
</view>
</navigator>
... ... @@ -241,7 +263,7 @@
特别优惠
</view>
<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">
<view class="preferentialItems">
<view class="rechargeItems">
<view class="left">
<view class="top">
<text class="font28r">{{recharge_data.rname}}</text>
... ... @@ -300,4 +322,24 @@
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
<view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
</view>
<view slot="modalContent">
<view class="couponBox">
<view wx:for="{{couponArr}}" class="couponItems">
<view class="couponNum font20r">×{{item.number}}</view>
<view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
<view class="couponLines"></view>
<view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="font28r couponCondition" wx:else>无门槛</view>
</view>
</view>
<view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -22,8 +22,16 @@
font-family: PingFang SC;
font-size: 72rpx;
color: #FFD200;
position: relative;
top: -50rpx;
position: absolute;
top: 40rpx;
left: 0;
right: 0;
overflow: hidden;
word-break: break-all;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
}
... ... @@ -455,14 +463,172 @@
flex-shrink: 0;
}
.preferentialCoupon .nodate{
margin-left: 20rpx;
}
.preferentialItems {
padding: 16rpx 16rpx 16rpx 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
margin: 0 20rpx 20rpx 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
}
.rechargeItems {
background: url('https://qn.colorcun.com/certificateBj.png') no-repeat;
background-size: 100% 100%;
margin-bottom: 20rpx;
min-height: 160rpx;
display: flex;
justify-content: space-between;
align-items: center;
height: auto;
padding: 12rpx 20rpx 12rpx 32rpx;
margin: 0 20rpx;
border: none;
}
.preferentialCoupon .itemRight {
width: 74%;
display: flex;
align-items: center;
}
.preferentialCoupon .itemLeft {
width: 26%;
}
.preferentialCoupon .couponLine{
margin: 24rpx 0;
border-right: 2rpx dashed #f6231b;
}
.preferentialCoupon .orderingFood {
padding: 0 20rpx;
color: #fff !important;
border: none !important;
text-align: center;
border-radius: 20rpx;
line-height: 44rpx;
height: 44rpx;
width: max-content;
flex-shrink: 0;
background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
}
.preferentialCoupon .icons {
color: #F6231B;
text-align: center;
}
.preferentialCoupon .priceText {
display: flex;
align-items: baseline;
justify-content: center;
font-family: PingFang SC;
color: #F6231B;
font-weight: 600;
font-size: 48rpx;
margin-top: 6rpx;
}
.preferentialCoupon .priceText text {
font-size: 48rpx;
}
.preferentialCoupon .btns {
flex: 1;
}
.preferentialCoupon .btnBox {
display: flex;
flex-direction: column;
}
.preferentialCoupon .grantNum {
display: flex;
flex-direction: column;
align-items: center;
color: #C36607;
margin-top: 10rpx;
}
.preferentialCoupon .grantNum text {
color: #F6231B;
margin-right: 10rpx;
}
.preferentialCoupon .btns text {
font-weight: 600;
}
.preferentialCoupon .orderingFood1 {
border: 2rpx solid #fa4b20 !important;
background: transparent !important;
color: #fa4b20 !important;
}
.preferentialItems .priceText .icons {
color: #FD4D59;
}
.preferentialItems .btns {
margin: 24rpx 20rpx 0 0;
display: flex;
justify-content: space-between;
align-items: baseline;
flex-direction: column;
}
.preferentialItems .bottom {
color: #C36607;
}
.preferentialItems .priceText {
display: flex;
align-items: center;
justify-content: center;
}
.preferentialItems .discountText {
text-align: center;
color: #FFEFC5;
border-radius: 6rpx;
font-family: PingFang SC;
background: #FD4D59;
width: max-content;
padding: 6rpx;
position: absolute;
left: 16rpx;
top: 12rpx;
}
.preferentialItems .discountText1{
text-align: center;
color: #FD4D59;
border: 2rpx solid #FD4D59;
border-radius: 6rpx;
font-family: PingFang SC;
background: transparent;
width: max-content;
padding: 0 6rpx;
position: absolute;
left: 16rpx;
top: 12rpx;
}
.preferentialItems .itemRight {
width: 70%;
padding-right: 10rpx;
margin-left: 18rpx;
}
.preferentialItems .itemLeft {
width: 30%;
display: flex;
flex-direction: column;
justify-content: center;
position: relative;
}
.rubric1 {
... ... @@ -806,6 +972,145 @@
box-sizing: border-box;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
}
#couponModal .titleModal2 {
margin-top: 80%;
}
#couponModal .titleModal3 {
margin-top: 60%;
}
#couponModal .titleModal4 {
margin-top: 30%;
}
#couponModal .mymodal {
background: rgba(0, 0, 0, 0.8);
width: 100% !important;
top: 0 !important;
height: auto !important;
z-index: 300;
}
.nameInfo {
font-family: PingFang SC;
font-weight: 400;
font-size: 52rpx;
line-height: 56rpx;
color: #fff;
margin-bottom: 40rpx;
padding-top: 60rpx;
}
.couponTotal {
color: #dfdfdf;
font-family: PingFang SC;
font-weight: 400;
font-size: 40rpx;
line-height: 48rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponTotal text {
color: #ffc806;
font-weight: 600;
font-size: 80rpx;
margin: 0 14rpx;
}
.couponBox {
width: 80%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.couponItems {
width: 46%;
margin-bottom: 24rpx;
padding-bottom: 52rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
}
.couponNum {
background: #727272;
border-radius: 50%;
color: #fff;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 8rpx 0 0 8rpx;
}
.couponPrice {
display: flex;
align-items: center;
justify-content: center;
color: #F6231B;
font-weight: 500;
}
.couponLines{
width: 80%;
margin: 0 auto;
height: 2rpx;
border-bottom: 2rpx dashed #F6231B;
}
.couponPrice text {
margin-left: 4rpx;
font-size: 76rpx;
font-weight: 700;
}
.couponCondition {
color: #C36607;
display: flex;
align-items: center;
justify-content: center;
padding-top: 24rpx;
}
.couponBtn {
width: 80%;
margin: 0 auto;
border-radius: 42rpx;
background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
font-weight: 400;
color: #fff;
text-align: center;
border: 4rpx solid #fff;
padding: 12rpx 0;
margin: 16rpx auto 20rpx auto;
}
.couponText {
color: #fff;
text-decoration: underline;
text-align: center;
}
.closeImg {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0;
top: 0;
}
.arrivalBox{
display: flex;
width: 100%;
... ...
... ... @@ -66,6 +66,7 @@ Page({
isMoreBtn:'',//再次预订按钮
isPaymenBtn:'',//支付定金按钮
isShareItem:'',//转发客人按钮
couponArr: [],//待领取的优惠券列表
},
tablestr: '',
urlsValue: [],
... ... @@ -75,6 +76,7 @@ Page({
timers: null, // 动画定时器
n: 0,
modal:'',
couponModal: '',
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -102,6 +104,7 @@ Page({
wx.onUserCaptureScreen((res)=> {
this.showModal()
})
this.couponModal = this.selectComponent("#couponModal");
},
// 打开截屏弹框
showModal() {
... ... @@ -111,6 +114,10 @@ Page({
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框
closeCouponModal() {
this.couponModal.closeModal()
},
// 页面滚动事件
onPageScroll: function (event) {
const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
... ... @@ -456,9 +463,10 @@ Page({
uid
}).then((json) => {
if (json.ret == 200) {
console.log('staffinfostaffinfostaffinfo', json.data)
console.log('客户经理获取基本信息------', json.data)
this.setData({
staffinfo: json.data
staffinfo: json.data,
couponArr:[],
})
this.getSellerTemplateConfFun(sid);
}
... ... @@ -579,7 +587,7 @@ Page({
let data = res.data
console.log('data', data);
let couponList = []
let themeColor, StyleType, titleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
let themeColor, StyleType, titleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -598,29 +606,23 @@ Page({
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
marketing.coupon_data_payList = coupon_data_pay
coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
marketing.coupon_data_freeList = coupon_data_free
let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
let couponDataId = info && info.length > 0 ? info[0].id : {}
// 根据券ID获取评价赠送的券详情
if(couponDataId) this.getEvaluateFun(couponDataId)
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
// 获取全部的优惠券(商家券、个人券、免费券、付费券)
couponList = this.addCoupons(coupon,couponList);
couponList = this.addCoupons(coupon_data_pay,couponList);
couponList = this.addCoupons(coupon_data_free,couponList);
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
this.getActivityByIdFun(couponList)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
... ... @@ -697,9 +699,12 @@ Page({
})
},
// 点击商家有礼
gotoSellerGift(){
let url = util.http_build_query({
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
... ... @@ -856,35 +861,173 @@ Page({
}
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === coupon_dataList.length) {
coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})
console.log('邀请函--------------------优惠券',coupon_dataList);
this.setData({
coupon_dataList,
})
}
}
})
})
},
// 根据券ID获取券详情
getActivityByIdFun(obj) {
App.Activity.GetActivityById({
id: obj.map(item => item.id).join(','),
}).then(res => {
if (res.data.length > 0) {
let list = res.data.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
let num = detail.receiveNum;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
})
let freeCoupons = list.filter(item => {
return item.is_type == '3'
})
// 免费券判断是否领取,弹框领取
if (freeCoupons.length > 0) {
let length = freeCoupons.length - 1
freeCoupons.forEach(i => {
this.getCoupon(i, freeCoupons[length].id, obj)
})
}
console.log('邀请函--------------------优惠券', list);
this.setData({
coupon_dataList: list,
})
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
let couponArr = this.data.couponArr;
let totalPrice = this.data.totalPrice;
App.Activity.ActivityListByOpenid({
aid: item.id
}).then(res => {
if (res.ret == 200) {
if (res.data.length == 0) {
couponArr.push(item)
}
if (item.id == id && couponArr.length > 0) {
couponArr.forEach(item => {
let match = obj.find(b => b.id === item.id);
if (match) {
item.number = match.number;
}
});
totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
this.setcouponFun(couponArr)
this.couponModal.showModal()
}
console.log('未领取的券列表-----------', couponArr);
this.setData({
couponArr,
totalPrice
})
}
})
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
... ... @@ -11,6 +11,7 @@
/>
<image class="giftImg"
bindtap="gotoSellerGift"
data-form="1"
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)}}"
src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
<image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
... ... @@ -85,29 +86,49 @@
</button>
</view>
</view>
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}">
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="itemLeft">
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
<view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font40r">¥</view>{{item.price}}
<view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
</view>
<view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
</view>
<view class="couponLine"></view>
<view class="itemRight">
<view class="btns">
<text class="font40r">{{item.aname}}</text>
<view class="font24r orderingFood">
抢购
</view>
<block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
</view>
</block>
<block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
<view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
<view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
<view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
</block>
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
<view class="btnBox" wx:if="{{item.is_type == '3'}}" >
<view class="font24r orderingFood orderingFood1">已领取</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
</view>
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
<view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
立即抢购
</view>
</view>
</view>
... ... @@ -326,4 +347,24 @@
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
<view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
</view>
<view slot="modalContent">
<view class="couponBox">
<view wx:for="{{couponArr}}" class="couponItems">
<view class="couponNum font20r">×{{item.number}}</view>
<view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
<view class="couponLines"></view>
<view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="font28r couponCondition" wx:else>无门槛</view>
</view>
</view>
<view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -264,7 +264,7 @@
/* 优惠券开始 */
.preferentialCoupon {
padding: 60rpx 40rpx 0 40rpx;
padding: 40rpx 40rpx 0 40rpx;
}
.orderingFood {
... ... @@ -281,13 +281,114 @@
flex-shrink: 0;
}
.preferentialCoupon .itemRight {
width: 74%;
display: flex;
align-items: center;
}
.preferentialCoupon .itemLeft {
width: 26%;
}
.preferentialCoupon .couponLine{
margin: 24rpx 0;
border-right: 2rpx dashed #f6231b;
}
.preferentialCoupon .orderingFood {
padding: 0 20rpx;
color: #fff !important;
border: none !important;
text-align: center;
border-radius: 20rpx;
line-height: 44rpx;
height: 44rpx;
width: max-content;
flex-shrink: 0;
background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
}
.preferentialCoupon .icons {
color: #F6231B;
text-align: center;
}
.preferentialCoupon .priceText {
display: flex;
align-items: baseline;
justify-content: center;
font-family: PingFang SC;
color: #F6231B;
font-weight: 600;
font-size: 48rpx;
margin-top: 6rpx;
}
.preferentialCoupon .priceText text {
font-size: 48rpx;
}
.preferentialCoupon .btns {
flex: 1;
}
.preferentialCoupon .btnBox {
display: flex;
flex-direction: column;
}
.preferentialCoupon .grantNum {
display: flex;
flex-direction: column;
align-items: center;
color: #C36607;
margin-top: 10rpx;
}
.preferentialCoupon .grantNum text {
color: #F6231B;
margin-right: 10rpx;
}
.preferentialCoupon .btns text {
font-weight: 600;
}
.preferentialCoupon .orderingFood1 {
border: 2rpx solid #fa4b20 !important;
background: transparent !important;
color: #fa4b20 !important;
}
.preferentialCoupon .btns text {
color: #0B0805 !important;
}
.preferentialCoupon .bottom {
margin-top: 4rpx;
width: 100%;
color: #C36607 !important;
font-family: PingFang SC;
font-weight: 500;
display: -webkit-box;
word-break: break-all;
word-wrap: break-word;
overflow: hidden;
text-align: left;
}
.preferentialCoupon .nodate{
margin-left: 20rpx;
}
.preferentialItems {
display: flex;
background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
background-size: 100% 100%;
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
}
.rechargeItems {
... ... @@ -300,6 +401,7 @@
height: auto;
padding: 12rpx 0;
margin: 0 20rpx;
border: none;
}
.rechargeItems .orderingFood {
... ... @@ -341,6 +443,20 @@
top: 12rpx;
}
.discountText1{
text-align: center;
color: #FD4D59;
border: 2rpx solid #FD4D59;
border-radius: 6rpx;
font-family: PingFang SC;
background: transparent;
width: max-content;
padding: 0 6rpx;
position: absolute;
left: 16rpx;
top: 12rpx;
}
.famousChefBox .labelBox,
.stopBox .labelBox {
border-bottom: none;
... ... @@ -433,9 +549,7 @@
}
.priceText .icons {
font-family: 'Abel';
color: #FD4D59;
font-size: 40rpx;
}
.itemRight {
... ... @@ -449,10 +563,7 @@
display: flex;
justify-content: space-between;
align-items: baseline;
}
.btns text {
color: #0B0805;
flex-direction: column;
}
.priceText {
... ... @@ -709,6 +820,145 @@
box-sizing: border-box;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
}
#couponModal .titleModal2 {
margin-top: 80%;
}
#couponModal .titleModal3 {
margin-top: 60%;
}
#couponModal .titleModal4 {
margin-top: 30%;
}
#couponModal .mymodal {
background: rgba(0, 0, 0, 0.8);
width: 100% !important;
top: 0 !important;
height: auto !important;
z-index: 300;
}
.nameInfo {
font-family: PingFang SC;
font-weight: 400;
font-size: 52rpx;
line-height: 56rpx;
color: #fff;
margin-bottom: 40rpx;
padding-top: 60rpx;
}
.couponTotal {
color: #dfdfdf;
font-family: PingFang SC;
font-weight: 400;
font-size: 40rpx;
line-height: 48rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponTotal text {
color: #ffc806;
font-weight: 600;
font-size: 80rpx;
margin: 0 14rpx;
}
.couponBox {
width: 80%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.couponItems {
width: 46%;
margin-bottom: 24rpx;
padding-bottom: 52rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
}
.couponNum {
background: #727272;
border-radius: 50%;
color: #fff;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 8rpx 0 0 8rpx;
}
.couponPrice {
display: flex;
align-items: center;
justify-content: center;
color: #F6231B;
font-weight: 500;
}
.couponLines{
width: 80%;
margin: 0 auto;
height: 2rpx;
border-bottom: 2rpx dashed #F6231B;
}
.couponPrice text {
margin-left: 4rpx;
font-size: 76rpx;
font-weight: 700;
}
.couponCondition {
color: #C36607;
display: flex;
align-items: center;
justify-content: center;
padding-top: 24rpx;
}
.couponBtn {
width: 80%;
margin: 0 auto;
border-radius: 42rpx;
background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
font-weight: 400;
color: #fff;
text-align: center;
border: 4rpx solid #fff;
padding: 12rpx 0;
margin: 16rpx auto 20rpx auto;
}
.couponText {
color: #fff;
text-decoration: underline;
text-align: center;
}
.closeImg {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0;
top: 0;
}
/* 深中国红 */
.crimson,
.crimson .positioningBox {
... ... @@ -1041,14 +1291,6 @@
color: #578C69;
}
.pearlWhite .preferentialItems {
background: url(https://nosqn.colorcun.com/certificateWhiteBj1.png) no-repeat;
background-size: 100% 100%;
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
}
.pearlWhite .rechargeItems {
background: url(https://nosqn.colorcun.com/certificateWhiteBj2.png) no-repeat;
background-size: 100% 100%;
... ... @@ -1117,12 +1359,6 @@
border: none;
}
.pearlWhite .discountText {
background: transparent;
border: 2rpx solid #FD4D59;
color: #FD4D59;
}
.toastBox {
width: fit-content;
position: fixed;
... ...
... ... @@ -66,6 +66,7 @@ Page({
isMoreBtn:'',//再次预订按钮
isPaymenBtn:'',//支付定金按钮
isShareItem:'',//转发客人按钮
couponArr: [],//待领取的优惠券列表
},
tablestr: '',
urlsValue: [],
... ... @@ -75,6 +76,7 @@ Page({
timers: null, // 动画定时器
n: 0,
modal:'',
couponModal: '',
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -102,6 +104,7 @@ Page({
wx.onUserCaptureScreen((res)=> {
this.showModal()
})
this.couponModal = this.selectComponent("#couponModal");
},
// 打开截屏弹框
showModal() {
... ... @@ -111,6 +114,10 @@ Page({
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框
closeCouponModal() {
this.couponModal.closeModal()
},
// 页面滚动事件
onPageScroll: function (event) {
const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
... ... @@ -455,9 +462,10 @@ Page({
uid
}).then((json) => {
if (json.ret == 200) {
console.log('staffinfostaffinfostaffinfo', json.data)
console.log('客户经理获取基本信息------', json.data)
this.setData({
staffinfo: json.data
staffinfo: json.data,
couponArr:[],
})
this.getSellerTemplateConfFun(sid);
}
... ... @@ -578,7 +586,7 @@ Page({
let data = res.data
console.log('data', data);
let couponList = []
let themeColor, StyleType, titleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
let themeColor, StyleType, titleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -597,29 +605,23 @@ Page({
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
marketing.coupon_data_payList = coupon_data_pay
coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
marketing.coupon_data_freeList = coupon_data_free
let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
let couponDataId = info && info.length > 0 ? info[0].id : {}
// 根据券ID获取评价赠送的券详情
if(couponDataId) this.getEvaluateFun(couponDataId)
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
// 获取全部的优惠券(商家券、个人券、免费券、付费券)
couponList = this.addCoupons(coupon,couponList);
couponList = this.addCoupons(coupon_data_pay,couponList);
couponList = this.addCoupons(coupon_data_free,couponList);
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
this.getActivityByIdFun(couponList)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
... ... @@ -696,9 +698,12 @@ Page({
})
},
// 点击商家有礼
gotoSellerGift(){
let url = util.http_build_query({
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
... ... @@ -855,35 +860,173 @@ Page({
}
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === coupon_dataList.length) {
coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})
console.log('邀请函--------------------优惠券',coupon_dataList);
this.setData({
coupon_dataList,
})
}
}
})
})
},
// 根据券ID获取券详情
getActivityByIdFun(obj) {
App.Activity.GetActivityById({
id: obj.map(item => item.id).join(','),
}).then(res => {
if (res.data.length > 0) {
let list = res.data.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
let num = detail.receiveNum;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
})
let freeCoupons = list.filter(item => {
return item.is_type == '3'
})
// 免费券判断是否领取,弹框领取
if (freeCoupons.length > 0) {
let length = freeCoupons.length - 1
freeCoupons.forEach(i => {
this.getCoupon(i, freeCoupons[length].id, obj)
})
}
console.log('邀请函--------------------优惠券', list);
this.setData({
coupon_dataList: list,
})
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
let couponArr = this.data.couponArr;
let totalPrice = this.data.totalPrice;
App.Activity.ActivityListByOpenid({
aid: item.id
}).then(res => {
if (res.ret == 200) {
if (res.data.length == 0) {
couponArr.push(item)
}
if (item.id == id && couponArr.length > 0) {
couponArr.forEach(item => {
let match = obj.find(b => b.id === item.id);
if (match) {
item.number = match.number;
}
});
totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
this.setcouponFun(couponArr)
this.couponModal.showModal()
}
console.log('未领取的券列表-----------', couponArr);
this.setData({
couponArr,
totalPrice
})
}
})
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
... ... @@ -11,6 +11,7 @@
/>
<image class="giftImg"
bindtap="gotoSellerGift"
data-form="1"
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)}}"
src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
<image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
... ... @@ -82,29 +83,49 @@
</button>
</view>
</view>
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}">
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="itemLeft">
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
<view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font40r">¥</view>{{item.price}}
<view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
</view>
<view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
</view>
<view class="couponLine"></view>
<view class="itemRight">
<view class="btns">
<text class="font40r">{{item.aname}}</text>
<view class="font24r orderingFood">
抢购
</view>
<block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
</view>
</block>
<block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
<view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
<view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
<view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
</block>
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
<view class="btnBox" wx:if="{{item.is_type == '3'}}" >
<view class="font24r orderingFood orderingFood1">已领取</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
</view>
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
<view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
立即抢购
</view>
</view>
</view>
... ... @@ -324,4 +345,25 @@
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
<view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
</view>
<view slot="modalContent">
<view class="couponBox">
<view wx:for="{{couponArr}}" class="couponItems">
<view class="couponNum font20r">×{{item.number}}</view>
<view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
<view class="couponLines"></view>
<view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="font28r couponCondition" wx:else>无门槛</view>
</view>
</view>
<view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -289,13 +289,101 @@
flex-shrink: 0;
}
.preferentialCoupon .itemRight {
width: 74%;
display: flex;
align-items: center;
}
.preferentialCoupon .itemLeft {
width: 26%;
}
.preferentialCoupon .couponLine{
margin: 24rpx 0;
border-right: 2rpx dashed #f6231b;
}
.preferentialCoupon .orderingFood {
padding: 0 20rpx;
color: #fff !important;
border: none !important;
text-align: center;
border-radius: 20rpx;
line-height: 44rpx;
height: 44rpx;
width: max-content;
flex-shrink: 0;
background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
}
.preferentialCoupon .icons {
color: #F6231B;
text-align: center;
}
.preferentialCoupon .priceText {
display: flex;
align-items: baseline;
justify-content: center;
font-family: PingFang SC;
color: #F6231B;
font-weight: 600;
font-size: 48rpx;
margin-top: 6rpx;
}
.preferentialCoupon .priceText text {
font-size: 48rpx;
}
.preferentialCoupon .btns {
flex: 1;
}
.preferentialCoupon .btnBox {
display: flex;
flex-direction: column;
}
.preferentialCoupon .grantNum {
display: flex;
flex-direction: column;
align-items: center;
color: #C36607;
margin-top: 10rpx;
}
.preferentialCoupon .grantNum text {
color: #F6231B;
margin-right: 10rpx;
}
.preferentialCoupon .btns text {
font-weight: 600;
}
.preferentialCoupon .orderingFood1 {
border: 2rpx solid #fa4b20 !important;
background: transparent !important;
color: #fa4b20 !important;
}
.preferentialCoupon .bottom {
color: #C36607 !important;
}
.preferentialCoupon .nodate{
margin-left: 20rpx;
}
.preferentialItems {
display: flex;
background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
background-size: 100% 100%;
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
}
.rechargeItems {
... ... @@ -308,6 +396,7 @@
height: auto;
padding: 12rpx 0;
margin: 0 20rpx;
border: none;
}
.rechargeItems .orderingFood {
... ... @@ -349,6 +438,20 @@
top: 12rpx;
}
.discountText1{
text-align: center;
color: #FD4D59;
border: 2rpx solid #FD4D59;
border-radius: 6rpx;
font-family: PingFang SC;
background: transparent;
width: max-content;
padding: 0 6rpx;
position: absolute;
left: 16rpx;
top: 12rpx;
}
.famousChefBox .labelBox,
.stopBox .labelBox {
border-bottom: none;
... ... @@ -442,9 +545,7 @@
}
.priceText .icons {
font-family: 'Abel';
color: #FD4D59;
font-size: 40rpx;
}
.itemRight {
... ... @@ -458,6 +559,7 @@
display: flex;
justify-content: space-between;
align-items: baseline;
flex-direction: column;
}
.btns text {
... ... @@ -718,6 +820,145 @@
box-sizing: border-box;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
}
#couponModal .titleModal2 {
margin-top: 80%;
}
#couponModal .titleModal3 {
margin-top: 60%;
}
#couponModal .titleModal4 {
margin-top: 30%;
}
#couponModal .mymodal {
background: rgba(0, 0, 0, 0.8);
width: 100% !important;
top: 0 !important;
height: auto !important;
z-index: 300;
}
.nameInfo {
font-family: PingFang SC;
font-weight: 400;
font-size: 52rpx;
line-height: 56rpx;
color: #fff;
margin-bottom: 40rpx;
padding-top: 60rpx;
}
.couponTotal {
color: #dfdfdf;
font-family: PingFang SC;
font-weight: 400;
font-size: 40rpx;
line-height: 48rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponTotal text {
color: #ffc806;
font-weight: 600;
font-size: 80rpx;
margin: 0 14rpx;
}
.couponBox {
width: 80%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.couponItems {
width: 46%;
margin-bottom: 24rpx;
padding-bottom: 52rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
}
.couponNum {
background: #727272;
border-radius: 50%;
color: #fff;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 8rpx 0 0 8rpx;
}
.couponPrice {
display: flex;
align-items: center;
justify-content: center;
color: #F6231B;
font-weight: 500;
}
.couponLines{
width: 80%;
margin: 0 auto;
height: 2rpx;
border-bottom: 2rpx dashed #F6231B;
}
.couponPrice text {
margin-left: 4rpx;
font-size: 76rpx;
font-weight: 700;
}
.couponCondition {
color: #C36607;
display: flex;
align-items: center;
justify-content: center;
padding-top: 24rpx;
}
.couponBtn {
width: 80%;
margin: 0 auto;
border-radius: 42rpx;
background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
font-weight: 400;
color: #fff;
text-align: center;
border: 4rpx solid #fff;
padding: 12rpx 0;
margin: 16rpx auto 20rpx auto;
}
.couponText {
color: #fff;
text-decoration: underline;
text-align: center;
}
.closeImg {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0;
top: 0;
}
/* 深中国红 */
.crimson,
.crimson .positioningBox {
... ... @@ -1049,8 +1290,6 @@
}
.pearlWhite .preferentialItems {
background: url(https://nosqn.colorcun.com/certificateWhiteBj1.png) no-repeat;
background-size: 100% 100%;
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
... ... @@ -1071,7 +1310,6 @@
.pearlWhite .positioningName,
.pearlWhite .rubric,
.pearlWhite .contentData,
.pearlWhite .btns text,
.pearlWhite .itemRight .bottom,
.pearlWhite .evaluateBox text,
.pearlWhite .labelBox .texts,
... ... @@ -1134,12 +1372,6 @@
border: none;
}
.pearlWhite .discountText {
background: transparent;
border: 2rpx solid #FD4D59;
color: #FD4D59;
}
.toastBox {
width: fit-content;
position: fixed;
... ...
... ... @@ -7,65 +7,65 @@ import RS from '../../utils/reserveStatus'
var plugin = requirePlugin("WechatSI");
import canvas from "../../pages/customer/canvas"
Page({
/**
* 页面的初始数据
*/
data: {
/**
* 页面的初始数据
*/
data: {
show_white:false,
options: {
tplid: ''
},
tableNum: 0,
detail: {},
staffinfo: {},
chef: {},
marketing: {},
home: {},
reserve: {},
signboard: {},
store: {},
recharge_data: {},
coupon_dataList: [],
current: 0,
seller: {
name: '',
tablesText: '',
date: '',
addr: ''
},
priceInfo: '',
scoreInfo: '',
discount: '',
certificate: '',
dataStr: Date.now() * 1 / 1000,
swich_phone: '0',
is_comments: '0',
is_user_comments: false,
tableinfo: [],
roomimage: [],
StyleType: '',
showMoreTip: true,
settingUrl: '',
inviteImgUrl: '',
themeColor: '',
screenHeight: '',
hasValueOrder: false, //商家是否开通提前点餐功能
hasValueCertificate: false, //商家是否开通优惠券功能
hasValueRecharge: false, //商家是否开通充值功能
hasValueBroadcast: false, //商家是否能播报,只有极速版不能播报
_attentionAnim: {},
isPlay: '1',
titleType: '', //标题样式
num1: [1, 2, 3, 4, 5, 6, 7, 8],
num2: [8, 7, 6, 5, 4, 3, 2, 1],
titleType: '', //标题样式
paymentStatus: '', //定金支付状态 1支付 0未支付
reserveData: {}, //自定义图文数据
toastBool: false, //支付定金提示框
toastText: '', //支付定金提示文字
paymentId: '', //定金id
wxml: null,
imgSrc: '', //canvas图片地址
options: {
tplid: ''
},
tableNum: 0,
detail: {},
staffinfo: {},
chef: {},
marketing: {},
home: {},
reserve: {},
signboard: {},
store: {},
recharge_data: {},
coupon_dataList: [],
current: 0,
seller: {
name: '',
tablesText: '',
date: '',
addr: ''
},
priceInfo: '',
scoreInfo: '',
discount: '',
certificate: '',
dataStr: Date.now() * 1 / 1000,
swich_phone: '0',
is_comments: '0',
is_user_comments: false,
tableinfo: [],
roomimage: [],
StyleType: '',
showMoreTip: true,
settingUrl: '',
inviteImgUrl: '',
themeColor: '',
screenHeight: '',
hasValueOrder: false, //商家是否开通提前点餐功能
hasValueCertificate: false, //商家是否开通优惠券功能
hasValueRecharge: false, //商家是否开通充值功能
hasValueBroadcast: false, //商家是否能播报,只有极速版不能播报
_attentionAnim: {},
isPlay: '1',
titleType: '', //标题样式
num1: [1, 2, 3, 4, 5, 6, 7, 8],
num2: [8, 7, 6, 5, 4, 3, 2, 1],
titleType: '', //标题样式
paymentStatus: '', //定金支付状态 1支付 0未支付
reserveData: {}, //自定义图文数据
toastBool: false, //支付定金提示框
toastText: '', //支付定金提示文字
paymentId: '', //定金id
wxml: null,
imgSrc: '', //canvas图片地址
colors:'',//导航栏颜色
couponData: '', //评价赠送优惠券数据
timeList: [],
... ... @@ -74,42 +74,45 @@ Page({
isMoreBtn:'',//再次预订按钮
isPaymenBtn:'',//支付定金按钮
isShareItem:'',//转发客人按钮
},
tablestr: '',
urlsValue: [],
screenHeight: '',
attentionAnim: {},
audioCtx: '', //播报
timers: null, // 动画定时器
couponArr: [],//待领取的优惠券列表
},
tablestr: '',
urlsValue: [],
screenHeight: '',
attentionAnim: {},
audioCtx: '', //播报
timers: null, // 动画定时器
n: 0,
modal:'',
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.id = options.id
let param = {
options: options,
hasOwner: options.hasSellerShare == 1, //是否为发起人
}
param.tpls = [TP.tpls(options.tplid)]
console.log(param);
console.log(options);
this.setData(param)
mta.Page.init({
"appID": "500667280",
"eventID": "500667287",
"statPullDownFresh": true,
"statShareApp": true,
"statReachBottom": true,
"lauchOpts": options, //渠道分析
});
const systemInfo = wx.getSystemInfoSync();
couponModal: '',
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.id = options.id
let param = {
options: options,
hasOwner: options.hasSellerShare == 1, //是否为发起人
}
param.tpls = [TP.tpls(options.tplid)]
console.log(param);
console.log(options);
this.setData(param)
mta.Page.init({
"appID": "500667280",
"eventID": "500667287",
"statPullDownFresh": true,
"statShareApp": true,
"statReachBottom": true,
"lauchOpts": options, //渠道分析
});
const systemInfo = wx.getSystemInfoSync();
this.screenHeight = systemInfo.windowHeight; // 获取屏幕高度
this.modal = this.selectComponent("#payModal"); //通过给组件所起的id调用组件
wx.onUserCaptureScreen((res)=> {
this.modal.showModal()
})
this.couponModal = this.selectComponent("#couponModal");
},
// 打开截屏弹框
showModal() {
... ... @@ -119,8 +122,12 @@ Page({
closeModal() {
this.modal.closeModal()
},
// 页面滚动事件
onPageScroll: function (event) {
// 关闭优惠券弹框
closeCouponModal() {
this.couponModal.closeModal()
},
// 页面滚动事件
onPageScroll: function (event) {
if(event.scrollTop>150){ //当页面滚动到某个位置时(这里设置为50),将导航栏背景颜色设置为白色
this.setData({
show_white:true
... ... @@ -130,411 +137,412 @@ Page({
show_white:false
})
}
const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
if (scrollTop < this.screenHeight) {
this.setData({
showMoreTip: true
});
} else {
this.setData({
showMoreTip: false
});
}
},
// 点击了解更多会员优惠政策
gotoFavourableList() {
let url = util.http_build_query({
sellerName: this.data.seller.name,
sellerid: this.data.seller.sid,
oid: this.data.detail.id,
types: '1'
}, '/pack-cookbook/pages/favourableList')
wx.navigateTo({
url
})
},
// 去评价
evaluateFun() {
let url = util.http_build_query({
sellerName: this.data.seller.name,
sellerid: this.data.seller.sid,
oid: this.data.detail.id,
types: '1',
previousPage: '1',
}, '/pages/pinglun/createOpinion')
wx.navigateTo({
url
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return this.sharesetting();
},
/**
* 监听用户点击分享到朋友圈按钮的操作
*/
onShareTimeline() {
return this.sharesetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getDetail()
this.getText()
this.getPaymentStatus()
},
// 复制微信号
copyWeChat() {
if (this.data.staffinfo.wechat) {
wx.setClipboardData({
data: this.data.staffinfo.wechat,
success(res) {
wx.getClipboardData({
success(res) {
console.log(res.data) // data
}
})
}
})
} else {
console.log('无微信号')
}
},
// 拨打电话
call(e) {
const phone = e.currentTarget.dataset['phone'];
wx.reportMonitor('1012', 1)
wx.makePhoneCall({
phoneNumber: phone
})
},
// 跳转到商家入驻页
gotoJoinSeller() {
wx.navigateTo({
const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
if (scrollTop < this.screenHeight) {
this.setData({
showMoreTip: true
});
} else {
this.setData({
showMoreTip: false
});
}
},
// 点击了解更多会员优惠政策
gotoFavourableList() {
let url = util.http_build_query({
sellerName: this.data.seller.name,
sellerid: this.data.seller.sid,
oid: this.data.detail.id,
types: '1'
}, '/pack-cookbook/pages/favourableList')
wx.navigateTo({
url
})
},
// 去评价
evaluateFun() {
let url = util.http_build_query({
sellerName: this.data.seller.name,
sellerid: this.data.seller.sid,
oid: this.data.detail.id,
types: '1',
previousPage: '1',
}, '/pages/pinglun/createOpinion')
wx.navigateTo({
url
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return this.sharesetting();
},
/**
* 监听用户点击分享到朋友圈按钮的操作
*/
onShareTimeline() {
return this.sharesetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getDetail()
this.getText()
this.getPaymentStatus()
},
// 复制微信号
copyWeChat() {
if (this.data.staffinfo.wechat) {
wx.setClipboardData({
data: this.data.staffinfo.wechat,
success(res) {
wx.getClipboardData({
success(res) {
console.log(res.data) // data
}
})
}
})
} else {
console.log('无微信号')
}
},
// 拨打电话
call(e) {
const phone = e.currentTarget.dataset['phone'];
wx.reportMonitor('1012', 1)
wx.makePhoneCall({
phoneNumber: phone
})
},
// 跳转到商家入驻页
gotoJoinSeller() {
wx.navigateTo({
url: util.http_build_query({
laiyuan:'邀请函'
}, '/pages/customer/joinSeller')
})
},
// 导航
looklocation: function () {
wx.reportMonitor('1015', 1)
wx.openLocation({
latitude: Number(this.data.seller.lat),
longitude: Number(this.data.seller.long),
scale: 17,
address: this.data.seller.addr,
success: function (res) {
console.log(res)
}
})
},
// 获取包间图片列表
getroomimage(sellerid) {
App.Tables.GetTablesPhoto({
sellerid,
tableids: this.tablestr
}).then((json) => {
if (json.ret == 200) {
this.setData({
roomimage: json.data
})
var urlsArr = [];
json.data.forEach((v, i) => {
urlsArr.push(v.url);
})
this.urlsValue = urlsArr;
console.log('urlsArr', urlsArr)
console.log('roomimage', json.data)
}
})
},
// 预览包间图片
lookroom(e) {
const item = e.currentTarget.dataset['item'];
wx.previewImage({
current: item.url, // 当前显示图片的http链接
urls: this.urlsValue, // 需要预览的图片http链接列表
})
},
// 预览其他图片
lookImgs(e) {
const url = e.currentTarget.dataset['url'];
const imgs = e.currentTarget.dataset['imgs'];
let urls = imgs ? imgs : [url]
wx.previewImage({
current: url,
urls,
})
},
// 获取店铺详情
getDetail() {
App.Reserve.Detail({
openid: getApp().openid,
rid: this.data.options.id
}).then(res => {
let tablesText = '', //桌子信息
deskStr = '',
tableNum = 0;
let tableinfo = util.determine(res.data.tableinfo);
console.log('tableinfo', tableinfo);
res.data.tables.forEach((t, i) => {
tableNum += t.table_pnum * 1
tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
})
let tabaleids = [];
res.data.tables.forEach(t => {
tabaleids.push(t.id);
})
this.tablestr = tabaleids.toString();
let reserev = RS.reserve(res.data)
let dateSmart = util.unixtoTime(reserev.ddate, 'YYYY-MM-DD 星期WW');
let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
let dateStr = util.unixtoTime(reserev.ddate, 'HH点')
let dateStrDivide = util.unixtoTime(reserev.ddate, 'II分')
console.log('dateSmart', dateSmart);
this.setData({
detail: this.formatDatail(reserev, dateSmart),
tableNum,
tableinfo,
is_user_comments: res.data.is_user_comments,
})
},
// 导航
looklocation: function () {
wx.reportMonitor('1015', 1)
wx.openLocation({
latitude: Number(this.data.seller.lat),
longitude: Number(this.data.seller.long),
scale: 17,
address: this.data.seller.addr,
success: function (res) {
console.log(res)
}
})
},
// 获取包间图片列表
getroomimage(sellerid) {
App.Tables.GetTablesPhoto({
sellerid,
tableids: this.tablestr
}).then((json) => {
if (json.ret == 200) {
this.setData({
roomimage: json.data
})
var urlsArr = [];
json.data.forEach((v, i) => {
urlsArr.push(v.url);
})
this.urlsValue = urlsArr;
console.log('urlsArr', urlsArr)
console.log('roomimage', json.data)
}
})
},
// 预览包间图片
lookroom(e) {
const item = e.currentTarget.dataset['item'];
wx.previewImage({
current: item.url, // 当前显示图片的http链接
urls: this.urlsValue, // 需要预览的图片http链接列表
})
},
// 预览其他图片
lookImgs(e) {
const url = e.currentTarget.dataset['url'];
const imgs = e.currentTarget.dataset['imgs'];
let urls = imgs ? imgs : [url]
wx.previewImage({
current: url,
urls,
})
},
// 获取店铺详情
getDetail() {
App.Reserve.Detail({
openid: getApp().openid,
rid: this.data.options.id
}).then(res => {
let tablesText = '', //桌子信息
deskStr = '',
tableNum = 0;
let tableinfo = util.determine(res.data.tableinfo);
console.log('tableinfo', tableinfo);
res.data.tables.forEach((t, i) => {
tableNum += t.table_pnum * 1
tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
})
let tabaleids = [];
res.data.tables.forEach(t => {
tabaleids.push(t.id);
})
this.tablestr = tabaleids.toString();
let reserev = RS.reserve(res.data)
let dateSmart = util.unixtoTime(reserev.ddate, 'YYYY-MM-DD 星期WW');
let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
let dateStr = util.unixtoTime(reserev.ddate, 'HH点')
let dateStrDivide = util.unixtoTime(reserev.ddate, 'II分')
console.log('dateSmart', dateSmart);
this.setData({
detail: this.formatDatail(reserev, dateSmart),
tableNum,
tableinfo,
is_user_comments: res.data.is_user_comments,
temp_ddate:this.data.temp_ddate?this.data.temp_ddate:reserev.temp_ddate?util.unixtoTime(reserev.temp_ddate, 'HH:II'):util.unixtoTime(reserev.ddate, 'HH:II'),
seller: {
seller: {
daily: reserev.seller.daily,
name: reserev.seller.sellername,
sid: reserev.sid,
date: dateSmart,
tablesText,
addr: reserev.seller.real_address || reserev.seller.map_address,
image: reserev.image_url,
hasOwner: true,
type: reserev.type,
is_set_ddate: reserev.is_set_ddate,
hasUpTime: reserev.type == 1 && reserev.hasRunning && reserev.status != 2,
tel: reserev.seller.seller_tel.split(','),
soltName: reserev.soltName,
dateTime: util.unixtoTime(reserev.ddate, 'HH:II'),
time: util.unixtoTime(reserev.ddate, '星期WW HH:II'),
lat: reserev.seller.lat,
long: reserev.seller.long,
yearMonthDay,
yearMonth,
dateStr,
deskStr,
dateStrDivide: dateStrDivide == '00分' ? '' : dateStrDivide,
seller_tel: reserev.seller.seller_tel,
name: reserev.seller.sellername,
sid: reserev.sid,
date: dateSmart,
tablesText,
addr: reserev.seller.real_address || reserev.seller.map_address,
image: reserev.image_url,
hasOwner: true,
type: reserev.type,
is_set_ddate: reserev.is_set_ddate,
hasUpTime: reserev.type == 1 && reserev.hasRunning && reserev.status != 2,
tel: reserev.seller.seller_tel.split(','),
soltName: reserev.soltName,
dateTime: util.unixtoTime(reserev.ddate, 'HH:II'),
time: util.unixtoTime(reserev.ddate, '星期WW HH:II'),
lat: reserev.seller.lat,
long: reserev.seller.long,
yearMonthDay,
yearMonth,
dateStr,
deskStr,
dateStrDivide: dateStrDivide == '00分' ? '' : dateStrDivide,
seller_tel: reserev.seller.seller_tel,
phone:reserev.phone,
}
})
console.log('reserev reserev', reserev);
console.log('seller seller', this.data.seller);
console.log('detail detail', this.data.detail);
setTimeout(() => {
this.getstaffinfo(res.data.uid, reserev.sid);
this.getroomimage(reserev.sid)
this.getSellerVersionFun(reserev.sid);
}, 0);
}).catch(res => {
console.log(res, '详情请求失败');
})
},
// 获取商家版本,不是超能版或者没有开通对应模块,不显示
getSellerVersionFun(sellerid) {
App.SellerVersion.GetSellerVersion({
sellerid
}).then((res) => {
let data = res.data;
console.log('版本列表', data);
if (data && data.length > 0) {
data.sort((a, b) => b.cdate * 1 - a.cdate * 1);
// 获取店铺当前版本 (cdate最大最后一个充入的 && 当前时间有效 && 当前版本)
let obj = data.find(item => item.vtype == 1 || item.vtype == 2 || item.vtype == 4);
console.log('当前版本', {
...obj
});
// 提前点餐功能:超能版 || 有提前点餐模块
const hasValueOrder = obj.vtype == '1' || data.some(item => item.vid == '6');
// 优惠券功能:超能版 || 高级版 || 有优惠券模块
const hasValueCertificate = obj.vtype == '1' || obj.vtype == '4' || data.some(item => item.vid == '8');
// 充值功能:超能版 || 有充值模块
const hasValueRecharge = obj.vtype == '1' || data.some(item => item.vid == '9');
// 播报功能:超能版 || 标准版 || 标准版首年 || 高级版
const hasValueBroadcast = obj.vtype == '1' || obj.vid == '4' || obj.vid == '13' || obj.vtype == '4';
this.setData({
hasValueOrder,
hasValueCertificate,
hasValueRecharge,
hasValueBroadcast,
})
}
})
},
// 通过预订ID查收定金详情
getPaymentStatus() {
App.Reserve.GetReserveDepositByRid({
rid: this.data.options.id
}).then(res => {
if (res.ret == 200 && res.data && res.data.length > 0) {
let data = res.data[0];
}
})
console.log('reserev reserev', reserev);
console.log('seller seller', this.data.seller);
console.log('detail detail', this.data.detail);
setTimeout(() => {
this.getstaffinfo(res.data.uid, reserev.sid);
this.getroomimage(reserev.sid)
this.getSellerVersionFun(reserev.sid);
}, 0);
}).catch(res => {
console.log(res, '详情请求失败');
})
},
// 获取商家版本,不是超能版或者没有开通对应模块,不显示
getSellerVersionFun(sellerid) {
App.SellerVersion.GetSellerVersion({
sellerid
}).then((res) => {
let data = res.data;
console.log('版本列表', data);
if (data && data.length > 0) {
data.sort((a, b) => b.cdate * 1 - a.cdate * 1);
// 获取店铺当前版本 (cdate最大最后一个充入的 && 当前时间有效 && 当前版本)
let obj = data.find(item => item.vtype == 1 || item.vtype == 2 || item.vtype == 4);
console.log('当前版本', {
...obj
});
// 提前点餐功能:超能版 || 有提前点餐模块
const hasValueOrder = obj.vtype == '1' || data.some(item => item.vid == '6');
// 优惠券功能:超能版 || 高级版 || 有优惠券模块
const hasValueCertificate = obj.vtype == '1' || obj.vtype == '4' || data.some(item => item.vid == '8');
// 充值功能:超能版 || 有充值模块
const hasValueRecharge = obj.vtype == '1' || data.some(item => item.vid == '9');
// 播报功能:超能版 || 标准版 || 标准版首年 || 高级版
const hasValueBroadcast = obj.vtype == '1' || obj.vid == '4' || obj.vid == '13' || obj.vtype == '4';
this.setData({
hasValueOrder,
hasValueCertificate,
hasValueRecharge,
hasValueBroadcast,
})
}
})
},
// 通过预订ID查收定金详情
getPaymentStatus() {
App.Reserve.GetReserveDepositByRid({
rid: this.data.options.id
}).then(res => {
if (res.ret == 200 && res.data && res.data.length > 0) {
let data = res.data[0];
let paymentStatus = data.trade_state == 'SUCCESS' ? '1' : '0';
let options = this.data.options
this.setData({
paymentId: data.id,
paymentStatus,
this.setData({
paymentId: data.id,
paymentStatus,
isPaymenBtn:options.isOrder != '1' && data.id && paymentStatus == '0' && options.hasSellerShare == '1' && options.isDeposit == '1',
})
}
})
},
// 获取自定义图文内容
getText() {
App.Reserve.GetReserveImgText({
rid: this.data.options.id
}).then(res => {
if (res.ret == 200 && res.data) {
let data = res.data;
let content = util.determine(data.content)
console.log('contentcontentcontent', content);
this.setData({
reserveData: {
title: data.title || '',
content,
}
})
}
})
},
// 点击支付定金
paymentFun() {
let that = this;
App.PayOnline.CombineTransactionsByDeposit({
id: this.data.paymentId,
openid: getApp().openid,
}).then(res => {
if (res.ret == 200) {
wx.requestPayment({
timeStamp: res.data.timeStamp + '',
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success(ress) {
console.log('微信支付结果', ress);
if (ress.errMsg == 'requestPayment:ok') {
console.log('支付成功', ress);
that.setData({
paymentStatus: '1',
toastBool: true,
toastText: '支付成功'
})
that.hideToast();
return
}
console.log('支付失败1', ress);
that.setData({
toastBool: true,
toastText: '支付失败,请重新支付'
})
that.hideToast();
},
fail(ress) {
console.log('支付失败2', ress);
that.setData({
toastBool: true,
toastText: '支付失败,请重新支付'
})
that.hideToast();
},
})
} else {
wx.showToast({
title: res.msg,
icon: 'none',
})
}
})
},
// 关闭支付失败或者成功弹框
hideToast() {
setTimeout(() => {
this.setData({
toastBool: false
})
}, 1500)
},
// 客户经理获取基本信息
getstaffinfo(uid, sid) {
console.log('sellerid', this.data.detail.seller.id);
App.Activity.GetCustomerActivityBaseinfo({
sellerid: this.data.detail.seller.id,
uid
}).then((json) => {
if (json.ret == 200) {
console.log('staffinfostaffinfostaffinfo', json.data)
this.setData({
staffinfo: json.data
})
this.getSellerTemplateConfFun(sid);
}
})
},
// 提前点餐
cookbook() {
if (this.data.detail.order && this.data.detail.order.cookbooklist.length > 0) {
let data = {
rid: this.id,
oid: this.data.detail.order.id,
sellerName: this.data.seller.name,
sid: this.data.seller.sid,
identity: '1',
hasSuccess: '1',
}
wx.navigateTo({
url: `/pack-cookbook/pages/success_new?hasSuccess=${data.hasSuccess}&identity=${data.identity}&oid=${data.oid}&rid=${data.rid}&sellerName=${data.sellerName}&sid=${data.sid}`,
})
} else {
App.Advance.CreateOrder({
rid: this.id,
openid: getApp().openid,
}).then(res => {
if (res.ret != 200) {
return util.toast(res.msg, 'none')
}
wx.navigateTo({
url: util.http_build_query({
rid: this.id,
oid: res.data.id,
sid: res.data.sellerid,
sellerName: this.data.seller.name,
identity: '1',
}, '/pack-cookbook/pages/index_new')
});
})
}
},
// 生成海报
painterBtn(img, sellerName, date, time) {
img = img.replace(/^http:/, "https:");
this.setData({
wxml: canvas({
imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
sellerName,
date,
time,
})
})
},
onImgOK(e) {
this.setData({
imgSrc: e.detail.path
})
console.log('海报生成成功', this.data.imgSrc);
},
})
}
})
},
// 获取自定义图文内容
getText() {
App.Reserve.GetReserveImgText({
rid: this.data.options.id
}).then(res => {
if (res.ret == 200 && res.data) {
let data = res.data;
let content = util.determine(data.content)
console.log('contentcontentcontent', content);
this.setData({
reserveData: {
title: data.title || '',
content,
}
})
}
})
},
// 点击支付定金
paymentFun() {
let that = this;
App.PayOnline.CombineTransactionsByDeposit({
id: this.data.paymentId,
openid: getApp().openid,
}).then(res => {
if (res.ret == 200) {
wx.requestPayment({
timeStamp: res.data.timeStamp + '',
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success(ress) {
console.log('微信支付结果', ress);
if (ress.errMsg == 'requestPayment:ok') {
console.log('支付成功', ress);
that.setData({
paymentStatus: '1',
toastBool: true,
toastText: '支付成功'
})
that.hideToast();
return
}
console.log('支付失败1', ress);
that.setData({
toastBool: true,
toastText: '支付失败,请重新支付'
})
that.hideToast();
},
fail(ress) {
console.log('支付失败2', ress);
that.setData({
toastBool: true,
toastText: '支付失败,请重新支付'
})
that.hideToast();
},
})
} else {
wx.showToast({
title: res.msg,
icon: 'none',
})
}
})
},
// 关闭支付失败或者成功弹框
hideToast() {
setTimeout(() => {
this.setData({
toastBool: false
})
}, 1500)
},
// 客户经理获取基本信息
getstaffinfo(uid, sid) {
console.log('sellerid', this.data.detail.seller.id);
App.Activity.GetCustomerActivityBaseinfo({
sellerid: this.data.detail.seller.id,
uid
}).then((json) => {
if (json.ret == 200) {
console.log('客户经理获取基本信息------', json.data)
this.setData({
staffinfo: json.data,
couponArr:[],
})
this.getSellerTemplateConfFun(sid);
}
})
},
// 提前点餐
cookbook() {
if (this.data.detail.order && this.data.detail.order.cookbooklist.length > 0) {
let data = {
rid: this.id,
oid: this.data.detail.order.id,
sellerName: this.data.seller.name,
sid: this.data.seller.sid,
identity: '1',
hasSuccess: '1',
}
wx.navigateTo({
url: `/pack-cookbook/pages/success_new?hasSuccess=${data.hasSuccess}&identity=${data.identity}&oid=${data.oid}&rid=${data.rid}&sellerName=${data.sellerName}&sid=${data.sid}`,
})
} else {
App.Advance.CreateOrder({
rid: this.id,
openid: getApp().openid,
}).then(res => {
if (res.ret != 200) {
return util.toast(res.msg, 'none')
}
wx.navigateTo({
url: util.http_build_query({
rid: this.id,
oid: res.data.id,
sid: res.data.sellerid,
sellerName: this.data.seller.name,
identity: '1',
}, '/pack-cookbook/pages/index_new')
});
})
}
},
// 生成海报
painterBtn(img, sellerName, date, time) {
img = img.replace(/^http:/, "https:");
this.setData({
wxml: canvas({
imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
sellerName,
date,
time,
})
})
},
onImgOK(e) {
this.setData({
imgSrc: e.detail.path
})
console.log('海报生成成功', this.data.imgSrc);
},
// 分享
sharesetting() {
wx.reportMonitor('1017', 1)
... ... @@ -564,14 +572,14 @@ Page({
}
}
},
// 修改detail数据
formatDatail(detail, dateSmart) {
detail.rdateStr = dateSmart;
detail.tableFirst = detail.tables[0].name;
if (detail.tables.length > 1) {
detail.tableSubInfo = '等' + (detail.tables.length) + '个' +
(detail.tables[0].tid == 2 ? '包间' : '');
}
// 修改detail数据
formatDatail(detail, dateSmart) {
detail.rdateStr = dateSmart;
detail.tableFirst = detail.tables[0].name;
if (detail.tables.length > 1) {
detail.tableSubInfo = '等' + (detail.tables.length) + '个' +
(detail.tables[0].tid == 2 ? '包间' : '');
}
detail.rname = detail.rname.trim()
if (detail.rname && detail.sex != 3) {
detail.rnameStr = detail.rname + (detail.sex == 1 ? '先生' : detail.sex == 2 ? '女士' : detail.sex == 4 ? '贵宾' : '')
... ... @@ -580,84 +588,78 @@ Page({
} else {
detail.rnameStr = detail.rname
}
detail.eatStr = '邀请您共进晚餐';
let hi = util.unixtoTime(detail.ddate, 'HHII');
if (hi < '10:00') {
detail.eatStr = '邀请您共进早餐';
} else if (hi < '15:00') {
detail.eatStr = '邀请您共进午餐';
}
return detail;
},
// 获取商家设置营销信息
getSellerTemplateConfFun(sid) {
console.log(sid, 'sidsidsidsid');
App.Seller.GetSellerTemplateConf({
sid
}).then(res => {
let data = res.data
console.log('data', data);
let couponList = []
let colors, settingUrl, inviteImgUrl, themeColor, StyleType, titleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
signboard = util.determine(data.signboard);
store = util.determine(data.store);
home = util.determine(data.home);
themeColor = data.lite_class || 'ultramarine';
StyleType = data.type;
if (StyleType == '9' || StyleType == '10' || StyleType == '11' || StyleType == '12') {
inviteImgUrl = 'https://nosqn.colorcun.com/inviteText.png';
} else {
inviteImgUrl = 'https://nosqn.colorcun.com/inviteText1.png';
}
settingUrl = StyleType == '12' ? 'https://nosqn.colorcun.com/template12.jpg' : 'https://nosqn.colorcun.com/template' + StyleType + '.png';
if (StyleType == '9') colors = "#0B0805";
if (StyleType == '10' || StyleType == '17') colors = "#750100";
if (StyleType == '11' || StyleType == '12') colors = "#0B1A67";
if (StyleType == '13' || StyleType == '15') colors = "#0B3133";
if (StyleType == '14' || StyleType == '16') colors = "#1B1A23";
titleType = data.title_class || '1';
swich_phone = reserve && reserve.swich_phone ? reserve.swich_phone : '';
if (store) store.content = (store.is_introduce_all == '1' && store.content) ? util.determine(store.content) : '';
if (chef) chef.content = (chef.is_introduce_all == '1' && chef.content) ? util.determine(chef.content) : '';
if (signboard) signboard.content = (signboard.is_introduce_all == '1' && signboard.content) ? util.determine(signboard.content) : '';
if (reserve) reserve.content = (reserve.is_introduce_all == '1' && reserve.content) ? util.determine(reserve.content) : '';
if (home) home.image = (home && home.image && (!home.id_first_image || home.id_first_image!='0')) ? home.image : '';
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
detail.eatStr = '邀请您共进晚餐';
let hi = util.unixtoTime(detail.ddate, 'HHII');
if (hi < '10:00') {
detail.eatStr = '邀请您共进早餐';
} else if (hi < '15:00') {
detail.eatStr = '邀请您共进午餐';
}
return detail;
},
// 获取商家设置营销信息
getSellerTemplateConfFun(sid) {
console.log(sid, 'sidsidsidsid');
App.Seller.GetSellerTemplateConf({
sid
}).then(res => {
let data = res.data
console.log('data', data);
let couponList = []
let colors, settingUrl, inviteImgUrl, themeColor, StyleType, titleType, home, chef, marketing, coupon, coupon_data_pay, coupon_data_free, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
signboard = util.determine(data.signboard);
store = util.determine(data.store);
home = util.determine(data.home);
themeColor = data.lite_class || 'ultramarine';
StyleType = data.type;
if (StyleType == '9' || StyleType == '10' || StyleType == '11' || StyleType == '12') {
inviteImgUrl = 'https://nosqn.colorcun.com/inviteText.png';
} else {
inviteImgUrl = 'https://nosqn.colorcun.com/inviteText1.png';
}
settingUrl = StyleType == '12' ? 'https://nosqn.colorcun.com/template12.jpg' : 'https://nosqn.colorcun.com/template' + StyleType + '.png';
if (StyleType == '9') colors = "#0B0805";
if (StyleType == '10' || StyleType == '17') colors = "#750100";
if (StyleType == '11' || StyleType == '12') colors = "#0B1A67";
if (StyleType == '13' || StyleType == '15') colors = "#0B3133";
if (StyleType == '14' || StyleType == '16') colors = "#1B1A23";
titleType = data.title_class || '1';
swich_phone = reserve && reserve.swich_phone ? reserve.swich_phone : '';
if (store) store.content = (store.is_introduce_all == '1' && store.content) ? util.determine(store.content) : '';
if (chef) chef.content = (chef.is_introduce_all == '1' && chef.content) ? util.determine(chef.content) : '';
if (signboard) signboard.content = (signboard.is_introduce_all == '1' && signboard.content) ? util.determine(signboard.content) : '';
if (reserve) reserve.content = (reserve.is_introduce_all == '1' && reserve.content) ? util.determine(reserve.content) : '';
if (home) home.image = (home && home.image && (!home.id_first_image || home.id_first_image!='0')) ? home.image : '';
if (marketing) {
marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')) ? marketing.logo : '';
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = (marketing.coupon_data && marketing.is_coupon == '1') ? util.determine(marketing.coupon_data) : '';
coupon_data_pay = (marketing.coupon_data_pay && marketing.is_coupon_pay == '1') ? util.determine(marketing.coupon_data_pay) : '';
marketing.coupon_data_payList = coupon_data_pay
coupon_data_free = (marketing.coupon_data_free && marketing.is_coupon_free == '1') ? util.determine(marketing.coupon_data_free) : '';
marketing.coupon_data_freeList = coupon_data_free
let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
let couponDataId = info && info.length > 0 ? info[0].id : {}
// 根据券ID获取评价赠送的券详情
if(couponDataId) this.getEvaluateFun(couponDataId)
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
// 获取全部的优惠券(商家券、个人券、免费券、付费券)
couponList = this.addCoupons(coupon,couponList);
couponList = this.addCoupons(coupon_data_pay,couponList);
couponList = this.addCoupons(coupon_data_free,couponList);
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
}
if (store && store.images && store.images.length > 0) store.images = util.determine(store.images);
if (reserve && reserve.park_info_images && reserve.park_info_images.length > 0) reserve.park_info_images = util.determine(reserve.park_info_images);
if (signboard && signboard.images && signboard.images.length > 0) signboard.images = util.determine(signboard.images);
this.getActivityByIdFun(couponList)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
}
if (store && store.images && store.images.length > 0) store.images = util.determine(store.images);
if (reserve && reserve.park_info_images && reserve.park_info_images.length > 0) reserve.park_info_images = util.determine(reserve.park_info_images);
if (signboard && signboard.images && signboard.images.length > 0) signboard.images = util.determine(signboard.images);
let solt = this.data.detail.ddate_solt;
let lunchDis = this.data.seller.daily;
let timeList = []
... ... @@ -668,20 +670,20 @@ Page({
var nightStr = lunchDis.night.split("-");
var nightArr = lunchDis.night ? this.computeHour(nightStr[0], nightStr[1], 30) : [];
timeList = solt == '1' ? morningArr : solt == '2' ? noonArr : solt == '3' ? nightArr : []
let obj = {
chef,
marketing,
home,
reserve,
signboard,
store,
swich_phone,
is_comments,
StyleType,
titleType,
themeColor,
settingUrl,
inviteImgUrl,
let obj = {
chef,
marketing,
home,
reserve,
signboard,
store,
swich_phone,
is_comments,
StyleType,
titleType,
themeColor,
settingUrl,
inviteImgUrl,
colors,
lite_style:data.lite_style,
timeList,
... ... @@ -693,185 +695,188 @@ Page({
});
this.setData({
...obj
})
// 开启语音播报
if (reserve && reserve.swich_voice == '1') {
this.setData({
isPlay: '1',
})
this.textToSpeechFun(reserve.voice_info)
}
// 获取转发客人卡片设置
let detailInfo = this.data.detail;
if (data.lite_style == '0') {
this.setData({
imgSrc: detailInfo.seller.seller_image
})
} else {
let d = detailInfo.ddate_solt;
let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
let time2;
})
// 开启语音播报
if (reserve && reserve.swich_voice == '1') {
this.setData({
isPlay: '1',
})
this.textToSpeechFun(reserve.voice_info)
}
// 获取转发客人卡片设置
let detailInfo = this.data.detail;
if (data.lite_style == '0') {
this.setData({
imgSrc: detailInfo.seller.seller_image
})
} else {
let d = detailInfo.ddate_solt;
let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
let time2;
if(this.data.temp_ddate){
time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate
}else{
time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')
}
let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';
this.painterBtn(
detailInfo.seller.seller_image,
detailInfo.seller.sellername,
util.unixtoTime(detailInfo.ddate, 'MM月DD日'),
time
);
}
}).catch(res => {
console.log('GetSellerTemplateConf请求失败');
})
let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';
this.painterBtn(
detailInfo.seller.seller_image,
detailInfo.seller.sellername,
util.unixtoTime(detailInfo.ddate, 'MM月DD日'),
time
);
}
}).catch(res => {
console.log('GetSellerTemplateConf请求失败');
})
},
// 点击商家有礼
gotoSellerGift(){
let url = util.http_build_query({
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
},
// 再次预订
secondbook() {
wx.reportMonitor('1013', 1)
wx.redirectTo({
url: '/pages/reserve/shopHome?id=' + this.data.detail.seller.id
})
},
// 文字转语音的方法
textToSpeechFun(voice_info) {
console.log('voice_info', voice_info);
let that = this;
let data = this.data;
// 再次预订
secondbook() {
wx.reportMonitor('1013', 1)
wx.redirectTo({
url: '/pages/reserve/shopHome?id=' + this.data.detail.seller.id
})
},
// 文字转语音的方法
textToSpeechFun(voice_info) {
console.log('voice_info', voice_info);
let that = this;
let data = this.data;
data.detail.rname = data.detail.rname.trim()
let str = data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 4 ? '贵宾' : '';
let charArray = data.seller.deskStr.split('');
let modifiedArray = charArray.map(char => char + ' ');
let resultString = modifiedArray.join('').slice(0, -1);
const replacements = {
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr + data.seller.dateStrDivide,
"{包间名}": resultString,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
let str = data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 4 ? '贵宾' : '';
let charArray = data.seller.deskStr.split('');
let modifiedArray = charArray.map(char => char + ' ');
let resultString = modifiedArray.join('').slice(0, -1);
const replacements = {
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr + data.seller.dateStrDivide,
"{包间名}": resultString,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
"{客人姓名}": data.detail.rname ? (data.detail.rname + str) : str=='贵宾' ? '贵宾' : '',
"{预订日期}": data.seller.yearMonthDay,
"{桌位}": resultString,
};
let newStr = voice_info.replace(/{预订日期}|{桌位}|{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
return replacements[matched];
});
console.log('newStr', newStr);
plugin.textToSpeech({
lang: "zh_CN",
tts: true,
content: newStr,
success: function (res) {
that.filename = res.filename
that.speech()
},
fail: function (res) {
console.log("fail tts", res)
}
})
},
// 开启语音播报
speech() {
var attentionAnim = wx.createAnimation({
duration: 1000,
timingFunction: 'linear',
})
this.attentionAnim = attentionAnim
this.setData({
_attentionAnim: attentionAnim,
attentionAnim: attentionAnim.export()
})
this.audioCtx = wx.createInnerAudioContext()
this.audioCtx.src = this.filename
this.audioCtx.loop = true
this.audioCtx.play()
this.audioCtx.onPlay((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
this.audioCtx.onPause((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
clearInterval(this.timers)
this.animation()
},
// 持续旋转动画
animation() {
let that = this;
var time = setInterval(function () {
this.n = this.n + 1;
let attentionAnim = that.data._attentionAnim
attentionAnim.rotate(180 * (this.n)).step()
that.setData({
attentionAnim: attentionAnim.export(),
})
}.bind(this), 1000)
this.timers = time;
},
// 暂停/继续播放
stopMusic() {
if (this.data.isPlay == '2') { // 2 暂停状态
console.log("开始");
clearInterval(this.timers)
this.animation()
this.audioCtx.play() //开始
return;
}
if (this.data.isPlay == '1') { // 1 运行状态
console.log('暂停');
if (this.n % 2 != 0) {
this.n = this.n + 1;
let attentionAnim = this.data._attentionAnim;
attentionAnim.rotate(180 * this.n).step();
this.setData({
attentionAnim: attentionAnim.export(),
})
}
clearInterval(this.timers)
this.audioCtx.pause() //暂停
return;
}
},
// 根据充值ID获取充值详情
getRechargeDetail(id) {
App.Activity.GetNewRecharge({
id
}).then(res => {
"{预订日期}": data.seller.yearMonthDay,
"{桌位}": resultString,
};
let newStr = voice_info.replace(/{预订日期}|{桌位}|{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
return replacements[matched];
});
console.log('newStr', newStr);
plugin.textToSpeech({
lang: "zh_CN",
tts: true,
content: newStr,
success: function (res) {
that.filename = res.filename
that.speech()
},
fail: function (res) {
console.log("fail tts", res)
}
})
},
// 开启语音播报
speech() {
var attentionAnim = wx.createAnimation({
duration: 1000,
timingFunction: 'linear',
})
this.attentionAnim = attentionAnim
this.setData({
_attentionAnim: attentionAnim,
attentionAnim: attentionAnim.export()
})
this.audioCtx = wx.createInnerAudioContext()
this.audioCtx.src = this.filename
this.audioCtx.loop = true
this.audioCtx.play()
this.audioCtx.onPlay((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
this.audioCtx.onPause((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
clearInterval(this.timers)
this.animation()
},
// 持续旋转动画
animation() {
let that = this;
var time = setInterval(function () {
this.n = this.n + 1;
let attentionAnim = that.data._attentionAnim
attentionAnim.rotate(180 * (this.n)).step()
that.setData({
attentionAnim: attentionAnim.export(),
})
}.bind(this), 1000)
this.timers = time;
},
// 暂停/继续播放
stopMusic() {
if (this.data.isPlay == '2') { // 2 暂停状态
console.log("开始");
clearInterval(this.timers)
this.animation()
this.audioCtx.play() //开始
return;
}
if (this.data.isPlay == '1') { // 1 运行状态
console.log('暂停');
if (this.n % 2 != 0) {
this.n = this.n + 1;
let attentionAnim = this.data._attentionAnim;
attentionAnim.rotate(180 * this.n).step();
this.setData({
attentionAnim: attentionAnim.export(),
})
}
clearInterval(this.timers)
this.audioCtx.pause() //暂停
return;
}
},
// 根据充值ID获取充值详情
getRechargeDetail(id) {
App.Activity.GetNewRecharge({
id
}).then(res => {
let detail = res.data
let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
let priceInfo, scoreInfo, certificate;
detail.recharge_list = recharge_list;
detail.exp_date = exp_date;
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
let priceInfo, scoreInfo, certificate;
detail.recharge_list = recharge_list;
detail.exp_date = exp_date;
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
let recharge_data = (this.data.dataStr<detail.etime*1 && detail.is_open == '1') ? detail : ''
console.log('邀请函--------------充值',recharge_data);
this.setData({
recharge_data,
scoreInfo,
priceInfo,
certificate
})
})
recharge_data,
scoreInfo,
priceInfo,
certificate
})
})
},
// 获取评价赠送的券最新详情
getEvaluateFun(id){
... ... @@ -889,54 +894,192 @@ Page({
}
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
// 根据券ID获取券详情
getActivityByIdFun(obj) {
App.Activity.GetActivityById({
id: obj.map(item => item.id).join(','),
}).then(res => {
if (res.data.length > 0) {
let list = res.data.filter(item => {
return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
})
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === coupon_dataList.length) {
coupon_dataList = coupon_dataList.filter(item=>{return this.data.dataStr<(item.etime*1) && item.is_open == '1'})
console.log('邀请函--------------------优惠券',coupon_dataList);
this.setData({
coupon_dataList,
})
}
}
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
clearInterval(this.timers)
if (this.audioCtx) {
this.audioCtx.destroy(); // 释放音频资源
}
},
let num = detail.receiveNum;
if (num > 0) {
detail.receiveNumText = ''
if (num >= 0 && num <= 100) {
detail.receiveNumText = num.toString();
} else if (num >= 101 && num <= 199) {
detail.receiveNumText = '100+';
} else if (num >= 200 && num <= 299) {
detail.receiveNumText = '200+';
} else {
detail.receiveNumText = Math.floor(num / 100) * 100 + '+';
}
}
if (detail.exp_date && detail.exp_date.week_data) {
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.noonText = noon;
detail.nigText = nig;
}
})
let freeCoupons = list.filter(item => {
return item.is_type == '3'
})
// 免费券判断是否领取,弹框领取
if (freeCoupons.length > 0) {
let length = freeCoupons.length - 1
freeCoupons.forEach(i => {
this.getCoupon(i, freeCoupons[length].id, obj)
})
}
console.log('邀请函--------------------优惠券', list);
this.setData({
coupon_dataList: list,
})
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
let couponArr = this.data.couponArr;
let totalPrice = this.data.totalPrice;
App.Activity.ActivityListByOpenid({
aid: item.id
}).then(res => {
if (res.ret == 200) {
if (res.data.length == 0) {
couponArr.push(item)
}
if (item.id == id && couponArr.length > 0) {
couponArr.forEach(item => {
let match = obj.find(b => b.id === item.id);
if (match) {
item.number = match.number;
}
});
totalPrice = couponArr.reduce((sum, item) => sum + item.price * item.number, 0);
this.setcouponFun(couponArr)
this.couponModal.showModal()
}
console.log('未领取的券列表-----------', couponArr);
this.setData({
couponArr,
totalPrice
})
}
})
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectNoon : arr[i].selectNig
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
clearInterval(this.timers)
if (this.audioCtx) {
this.audioCtx.destroy(); // 释放音频资源
}
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
clearInterval(this.timers)
if (this.audioCtx) {
this.audioCtx.destroy(); // 释放音频资源
}
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
clearInterval(this.timers)
if (this.audioCtx) {
this.audioCtx.destroy(); // 释放音频资源
}
},
// 设置虚拟到店时间
bindPickerChange: function(e) {
let index = e.detail.value
... ... @@ -985,57 +1128,57 @@ Page({
computeHour (time1, time2, interval) {
//time1 开始时间 time2结束时间 interval间隔时长
function getTimeList (time1, time2, interval) {
var timeList = [];
time1 = time1.split(":");
time2 = time2.split(":");
time1 = new Date(0, 0, 0, time1[0], time1[1], 0);
time2 = new Date(0, 0, 0, time2[0], time2[1], 0);
interval = interval * 60 * 1000;
while (time1 <= time2) {
timeList.push(time1.format("hh:mm"));
time1 = new Date(time1.getTime() + interval);
}
return timeList;
var timeList = [];
time1 = time1.split(":");
time2 = time2.split(":");
time1 = new Date(0, 0, 0, time1[0], time1[1], 0);
time2 = new Date(0, 0, 0, time2[0], time2[1], 0);
interval = interval * 60 * 1000;
while (time1 <= time2) {
timeList.push(time1.format("hh:mm"));
time1 = new Date(time1.getTime() + interval);
}
return timeList;
}
Date.prototype.format = function (format) {
var date = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
S: this.getMilliseconds(),
};
if (/(y+)/.test(format))
format = format.replace(
RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length)
);
for (var k in date)
if (new RegExp("(" + k + ")").test(format))
format = format.replace(
RegExp.$1,
RegExp.$1.length == 1
? date[k]
: ("00" + date[k]).substr(("" + date[k]).length)
);
return format;
var date = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
S: this.getMilliseconds(),
};
if (/(y+)/.test(format))
format = format.replace(
RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length)
);
for (var k in date)
if (new RegExp("(" + k + ")").test(format))
format = format.replace(
RegExp.$1,
RegExp.$1.length == 1
? date[k]
: ("00" + date[k]).substr(("" + date[k]).length)
);
return format;
};
return getTimeList(time1, time2, interval);
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
},
})
\ No newline at end of file
... ...
... ... @@ -5,7 +5,8 @@
<image wx:if="{{hasValueBroadcast && reserve && reserve.swich_voice && reserve.swich_voice=='1'}}" class="musicImg" src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}" bindtap="stopMusic" animation="{{attentionAnim}}" />
<image class="giftImg"
bindtap="gotoSellerGift"
wx:if="{{(hasValueCertificate && marketing && 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)}}"
data-form="1"
wx:if="{{(hasValueCertificate && marketing && 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)}}"
src="https://nosqn.colorcun.com/sellerGift.png" mode=""/>
<image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
<image wx:if="{{options && options.isOrder == '1' && detail.status !='4'}}" class="cannotImg" src="https://qn.colorcun.com/overImg.png" />
... ... @@ -87,29 +88,49 @@
</block>
</view>
</view>
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}">
<view class="preferentialCoupon" wx:if="{{hasValueCertificate && marketing && coupon_dataList.length>0}}">
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<navigator url="/pack-activity/pack/buyCoupon?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<navigator url="/pack-activity/pack/{{item.is_type == '3'?'receiveCoupon':'buyCoupon'}}?id={{item.id}}&name={{seller.name}}&use={{item.stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="itemLeft">
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
<view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font40r">¥</view>{{item.price}}
<view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
</view>
<view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
</view>
<view class="couponLine"></view>
<view class="itemRight">
<view class="btns">
<text class="font40r">{{item.aname}}</text>
<view class="font24r orderingFood">
抢购
</view>
<block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
</view>
</block>
<block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
<view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
<view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
<view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
</block>
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
<view class="btnBox" wx:if="{{item.is_type == '3'}}" >
<view class="font24r orderingFood orderingFood1">已领取</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r"><text>{{item.receiveNumText}}</text>张</view>
</view>
</view>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">
会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}
<view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">
立即抢购
</view>
</view>
</view>
... ... @@ -258,7 +279,7 @@
</view>
</view>
</view>
<view class="introduce {{(marketing.is_online_book=='1' && options.onlineReserve == '1') || (detail.status !='4' && options.isOrder != '1' && paymentId && paymentStatus == '0') || (detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc)?'introduceBottom':''}}">
<view class="introduce rechargeBox {{(marketing.is_online_book=='1' && options.onlineReserve == '1') || (detail.status !='4' && options.isOrder != '1' && paymentId && paymentStatus == '0') || (detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc)?'introduceBottom':''}}">
<block wx:if="{{hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data}}">
<block wx:if="{{titleType}}">
<titleStyle titleStyleType="{{titleType}}" titleText="会员招募"></titleStyle>
... ... @@ -324,4 +345,24 @@
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal {{(couponArr.length == '2' || couponArr.length < '2') ? 'titleModal2 ' : (couponArr.length == '4' || couponArr.length < '4') ? 'titleModal3 ' : (couponArr.length > '4') ? 'titleModal4' : '' }}">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeOutline.png" mode=""/>
<view class="nameInfo">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal">赠送给您<text>{{totalPrice}}元</text>代金券</view>
</view>
<view slot="modalContent">
<view class="couponBox">
<view wx:for="{{couponArr}}" class="couponItems">
<view class="couponNum font20r">×{{item.number}}</view>
<view class="font36r couponPrice">¥<text>{{item.price}}</text></view>
<view class="couponLines"></view>
<view class="font28r couponCondition" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="font28r couponCondition" wx:else>无门槛</view>
</view>
</view>
<view bindtap="closeCouponModal" class="couponBtn font36r">我知道了</view>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -326,13 +326,18 @@
padding: 40rpx 40rpx 0 40rpx;
}
.preferentialCoupon .nodate{
margin-left: 20rpx;
}
.preferentialItems {
display: flex;
background: url('https://qn.colorcun.com/certificateBj1.png') no-repeat;
background-size: 100% 100%;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
margin-bottom: 20rpx;
min-height: 160rpx;
padding-bottom: 10rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
}
.rechargeItems {
... ... @@ -344,7 +349,8 @@
align-items: center;
height: auto;
padding: 12rpx 0;
margin: 0 20rpx;
margin: 0 20rpx;
border: none;
}
.itemLeft {
... ... @@ -373,6 +379,20 @@
top: 12rpx;
}
.discountText1{
text-align: center;
color: #FD4D59;
border: 2rpx solid #FD4D59;
border-radius: 6rpx;
font-family: PingFang SC;
background: transparent;
width: max-content;
padding: 0 6rpx;
position: absolute;
left: 16rpx;
top: 12rpx;
}
.priceText {
font-family: 'Abel';
color: #E34D59;
... ... @@ -382,9 +402,7 @@
}
.priceText .icons {
font-family: 'Abel';
color: #FD4D59;
font-size: 40rpx;
}
.itemRight {
... ... @@ -398,6 +416,7 @@
display: flex;
justify-content: space-between;
align-items: baseline;
flex-direction: column;
}
.orderingFood {
... ... @@ -414,10 +433,88 @@
flex-shrink: 0;
}
.preferentialCoupon .itemRight {
width: 74%;
display: flex;
align-items: center;
}
.preferentialCoupon .itemLeft {
width: 26%;
}
.preferentialCoupon .couponLine{
margin: 24rpx 0;
border-right: 2rpx dashed #f6231b;
}
.preferentialCoupon .orderingFood {
padding: 0 20rpx;
color: #fff !important;
border: none !important;
text-align: center;
border-radius: 20rpx;
line-height: 44rpx;
height: 44rpx;
width: max-content;
flex-shrink: 0;
background: linear-gradient(94.4deg, #f41919 2.72%, #ff7426 122.17%);
}
.preferentialCoupon .icons {
color: #F6231B;
text-align: center;
}
.preferentialCoupon .priceText {
display: flex;
align-items: baseline;
justify-content: center;
font-family: PingFang SC;
color: #F6231B;
font-weight: 600;
font-size: 48rpx;
margin-top: 6rpx;
}
.preferentialCoupon .priceText text {
font-size: 48rpx;
}
.preferentialCoupon .btns {
flex: 1;
}
.preferentialCoupon .btnBox {
display: flex;
flex-direction: column;
}
.preferentialCoupon .grantNum {
display: flex;
flex-direction: column;
align-items: center;
color: #C36607;
margin-top: 10rpx;
}
.preferentialCoupon .grantNum text {
color: #F6231B;
margin-right: 10rpx;
}
.preferentialCoupon .btns text {
font-weight: 600;
}
.preferentialCoupon .orderingFood1 {
border: 2rpx solid #fa4b20 !important;
background: transparent !important;
color: #fa4b20 !important;
}
.bottom {
margin-top: 10rpx;
margin-top: 4rpx;
width: 100%;
color: #0B0805;
color: #C36607;
font-family: PingFang SC;
font-weight: 500;
display: -webkit-box;
... ... @@ -839,6 +936,145 @@
box-sizing: border-box;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
}
#couponModal .titleModal2 {
margin-top: 80%;
}
#couponModal .titleModal3 {
margin-top: 60%;
}
#couponModal .titleModal4 {
margin-top: 30%;
}
#couponModal .mymodal {
background: rgba(0, 0, 0, 0.8);
width: 100% !important;
top: 0 !important;
height: auto !important;
z-index: 300;
}
.nameInfo {
font-family: PingFang SC;
font-weight: 400;
font-size: 52rpx;
line-height: 56rpx;
color: #fff;
margin-bottom: 40rpx;
padding-top: 60rpx;
}
.couponTotal {
color: #dfdfdf;
font-family: PingFang SC;
font-weight: 400;
font-size: 40rpx;
line-height: 48rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.couponTotal text {
color: #ffc806;
font-weight: 600;
font-size: 80rpx;
margin: 0 14rpx;
}
.couponBox {
width: 80%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.couponItems {
width: 46%;
margin-bottom: 24rpx;
padding-bottom: 52rpx;
border-radius: 20rpx;
border: 2rpx solid #ff7e06;
background: linear-gradient(180deg, #ffefd0 0%, #ffdc9b 100%);
}
.couponNum {
background: #727272;
border-radius: 50%;
color: #fff;
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 8rpx 0 0 8rpx;
}
.couponPrice {
display: flex;
align-items: center;
justify-content: center;
color: #F6231B;
font-weight: 500;
}
.couponLines{
width: 80%;
margin: 0 auto;
height: 2rpx;
border-bottom: 2rpx dashed #F6231B;
}
.couponPrice text {
margin-left: 4rpx;
font-size: 76rpx;
font-weight: 700;
}
.couponCondition {
color: #C36607;
display: flex;
align-items: center;
justify-content: center;
padding-top: 24rpx;
}
.couponBtn {
width: 80%;
margin: 0 auto;
border-radius: 42rpx;
background: linear-gradient(90.98deg, #f41919 0.25%, #ff7426 120.07%);
font-weight: 400;
color: #fff;
text-align: center;
border: 4rpx solid #fff;
padding: 12rpx 0;
margin: 16rpx auto 20rpx auto;
}
.couponText {
color: #fff;
text-decoration: underline;
text-align: center;
}
.closeImg {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 0;
top: 0;
}
/* 模板9 */
.viewBox9 {
background: #23201e;
... ... @@ -853,8 +1089,8 @@
background: rgba(11, 8, 5, 0.85);
}
.viewBox9 .btns text,
.viewBox9 .bottom,
.viewBox9 .rechargeBox .btns text,
.viewBox9 .rechargeBox .bottom,
.viewBox9 .itemBottom,
.viewBox9+.sharewidth .shareItem {
color: #0B0805;
... ... @@ -887,12 +1123,12 @@
background: rgba(117, 1, 0, 0.75);
}
.viewBox10 .btns text,
.viewBox10 .bottom,
.viewBox10 .rechargeBox .btns text,
.viewBox10 .rechargeBox .bottom,
.viewBox10 .itemBottom,
.viewBox10+.sharewidth .shareItem,
.viewBox17 .btns text,
.viewBox17 .bottom,
.viewBox17 .rechargeBox .btns text,
.viewBox17 .rechargeBox .bottom,
.viewBox17 .itemBottom,
.viewBox17+.sharewidth .shareItem {
color: #750100;
... ... @@ -927,12 +1163,12 @@
background: rgba(33, 74, 165, 0.7);
}
.viewBox11 .btns text,
.viewBox11 .bottom,
.viewBox11 .rechargeBox .btns text,
.viewBox11 .rechargeBox .bottom,
.viewBox11 .itemBottom,
.viewBox11+.sharewidth .shareItem,
.viewBox12 .btns text,
.viewBox12 .bottom,
.viewBox12 .rechargeBox .btns text,
.viewBox12 .rechargeBox .bottom,
.viewBox12 .itemBottom,
.viewBox12+.sharewidth .shareItem {
color: #0B1A67;
... ... @@ -977,12 +1213,12 @@
background: rgba(33, 89, 96, 0.35);
}
.viewBox13 .btns text,
.viewBox13 .bottom,
.viewBox13 .rechargeBox .btns text,
.viewBox13 .rechargeBox .bottom,
.viewBox13 .itemBottom,
.viewBox13+.sharewidth .shareItem,
.viewBox15 .btns text,
.viewBox15 .bottom,
.viewBox15 .rechargeBox .btns text,
.viewBox15 .rechargeBox .bottom,
.viewBox15 .itemBottom,
.viewBox15+.sharewidth .shareItem {
color: #215960;
... ... @@ -1021,12 +1257,12 @@
background: rgba(11, 8, 5, 0.35);
}
.viewBox14 .btns text,
.viewBox14 .bottom,
.viewBox14 .rechargeBox .btns text,
.viewBox14 .rechargeBox .bottom,
.viewBox14 .itemBottom,
.viewBox14+.sharewidth .shareItem,
.viewBox16 .btns text,
.viewBox16 .bottom,
.viewBox16 .rechargeBox .btns text,
.viewBox16 .rechargeBox .bottom,
.viewBox16 .itemBottom,
.viewBox16+.sharewidth .shareItem {
color: #0B0805;
... ...
... ... @@ -217,6 +217,7 @@ Page({
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
... ...
... ... @@ -10,6 +10,7 @@
<view class="couponWrap">
<view class="itemLeft">
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
<view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
</view>
... ... @@ -31,8 +32,8 @@
<block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
<view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
<view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
<view wx:if="{{item.noonText}}" class="bottom font24r">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r">{{item.nigText}}</view>
<view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
</block>
... ...
... ... @@ -31,6 +31,10 @@ page {
color: #000;
}
.couponWrap .nodate{
margin-left: 20rpx;
}
.preferentialItems {
display: flex;
margin-bottom: 20rpx;
... ... @@ -153,6 +157,20 @@ page {
background: #F6231B;
}
.couponWrap .discountText1{
text-align: center;
color: #FD4D59;
border: 2rpx solid #FD4D59;
border-radius: 6rpx;
font-family: PingFang SC;
background: transparent;
width: max-content;
padding: 0 6rpx;
position: absolute;
left: 16rpx;
top: 12rpx;
}
.itemLeft {
width: 30%;
display: flex;
... ...
... ... @@ -259,6 +259,7 @@ Page({
list.forEach(detail => {
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
... ... @@ -326,18 +327,18 @@ Page({
setcouponFun(arr) {
let str = arr.flatMap(item => Array(item.number).fill(item.id)).join(',');
console.log('弹框领取免费券id', str);
// App.Activity.SetActivityAsReserve({
// aid: str,
// rid: this.id,
// }).then((json) => {
// if (json.ret != 200) {
// wx.showToast({
// title: res.msg,
// duration: 2000,
// mask: true
// })
// }
// })
App.Activity.SetActivityAsReserve({
aid: str,
rid: this.id,
}).then((json) => {
if (json.ret != 200) {
wx.showToast({
title: res.msg,
duration: 2000,
mask: true
})
}
})
},
// 免费券 0未领取 1已领取 获取未领取的组成数组couponArr
getCoupon(item, id, obj) {
... ...
... ... @@ -25,6 +25,7 @@
<view class="couponWrap">
<view class="itemLeft">
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
<view class="discountText1 font20r" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font24r">¥</view><text class="font40r">{{item.price}}</text>
</view>
... ... @@ -46,8 +47,8 @@
<block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
<view wx:if="{{item.is_type == '3' && item.aexpiration}}" class="bottom font24r">领取后{{item.aexpiration}}天有效</view>
<view wx:if="{{item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
<view wx:if="{{item.noonText}}" class="bottom font24r">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r">{{item.nigText}}</view>
<view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
</block>
... ...
... ... @@ -203,6 +203,10 @@
margin-bottom: 20rpx;
}
.couponWrap .nodate{
margin-left: 20rpx;
}
.preferentialItems {
padding: 20rpx 30rpx 20rpx 20rpx;
display: flex;
... ... @@ -454,6 +458,20 @@
top: 12rpx;
}
.couponWrap .discountText1{
text-align: center;
color: #FD4D59;
border: 2rpx solid #FD4D59;
border-radius: 6rpx;
font-family: PingFang SC;
background: transparent;
width: max-content;
padding: 0 6rpx;
position: absolute;
left: 16rpx;
top: 12rpx;
}
#couponModal .titleModal {
margin-top: 30%;
position: relative;
... ...