Commit 304c92f2b64e1cb033e93ea146e7186824359fc8

Authored by pengye
1 parent 38e962a7

短信赠送的券、消费金使用(券列表、免费券付款页)

... ... @@ -11,14 +11,28 @@ Component({
this.getuser();
this.getautomenu();
this.getorder();
this.getlist()
this.getCheckUserHavePhone()
},
methods:{
//获取用户未使用优惠券列表数量
getlist() {
App.Activity.GetNewRechargeListByOpenid({
// 检测用户是否绑定手机号
getCheckUserHavePhone() {
App.Wechat.CheckUserHavePhone({
openid: getApp().openid,
}).then((res) => {
}).then((json) => {
if (json.ret == 200) {
let data = json.data;
let phone = (data && data.phone) ? data.phone : '';
this.getlist(phone)
}
})
},
//获取用户未使用优惠券列表数量
getlist(phone) {
let params = {
openid: getApp().openid,
}
if(phone) params.phone = phone
App.Activity.GetNewRechargeListByOpenid({...params}).then((res) => {
if (res.ret == 200) {
let list = res.data;
list = list.filter(item => {
... ...
... ... @@ -53,10 +53,19 @@ Component({
const query = this.createSelectorQuery()
query.select('.number-item').boundingClientRect()
query.exec((res) => {
this.setData({
itemHeight: res[0].height
})
this.startScrollAni()
// 页面里没有数字项(.number-item)时 res[0] 为 null,做保护避免报错
if (res && res[0] && res[0].height) {
this.setData({
itemHeight: res[0].height
})
this.startScrollAni()
} else {
// 重置状态,等待下一次 value 变化时再计算高度
this.setData({
itemHeight: 0,
aniArr: []
})
}
})
},
/** 开始滚动动画 */
... ...
... ... @@ -73,14 +73,19 @@ Page({
this.setData({
purePhoneNumber: data.phone,
})
this.getUserInfo()
this.getUserInfo(data.phone)
this.getUserRechargeInfo(data.phone)
this.getCoupon()
} else {
this.getUserInfo()
this.setData({
purePhoneNumber: '',
})
this.getCoupon()
}
} else {
// 查询手机号失败时,先拉取 openid 维度的券兜底
this.getCoupon()
}
})
},
... ... @@ -192,11 +197,13 @@ Page({
})
},
// 获取用户在商家&所有消费金
getUserInfo() {
App.Activity.GetConsumeBySeller({
getUserInfo(phone) {
let params = {
openid: getApp().openid,
sellerid: this.sid,
}).then((json) => {
}
if(phone) params.phone = phone;
App.Activity.GetConsumeBySeller({...params}).then((json) => {
if (json.ret == 200) {
let data = json.data;
if (data && data.length > 0) {
... ... @@ -477,8 +484,10 @@ Page({
if (!id) {
let price = this.data.actualPrice * 1 * this.data.multiple
if (!price) return false
let str = this.data.finalList.map(item => item.activity_id).join(',');
console.log('核销所勾选的券传参', str);
// isinitial为1的券用activity_id传参,isinitial为0的券用phone_activity_id传参
let activityIdStr = this.data.finalList.filter(item => item.isinitial == '1').map(item => item.activity_id).join(',');
let phoneActivityIdStr = this.data.finalList.filter(item => item.isinitial == '0').map(item => item.phone_activity_id).join(',');
console.log('充值所勾选的券传参', activityIdStr, phoneActivityIdStr);
let params = {
type: '2',
types: '4', // 1邀请函 2提前点餐 3商家端app分享 4支付页充值 5我的页面余额充值
... ... @@ -493,8 +502,11 @@ Page({
if (this.data.consumeDiscount * 1 > 0 && this.data.consumeSwitch) {
params.consume = this.data.consumeDiscount;
}
if (str) {
params.activity_id = str;
if (activityIdStr) {
params.activity_id = activityIdStr;
}
if (phoneActivityIdStr) {
params.phone_activity_id = phoneActivityIdStr;
}
if (this.data.givePrice) {
params.givePrice = this.data.givePrice; //当餐免费送的余额
... ... @@ -533,7 +545,7 @@ Page({
this.setData({
purePhoneNumber: res.data.phone_info.purePhoneNumber,
})
this.getUserInfo()
this.getUserInfo(res.data.phone_info.purePhoneNumber)
this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber)
this.getUserRechargeInfo(res.data.phone_info.purePhoneNumber)
} else {
... ... @@ -675,108 +687,143 @@ Page({
},
// 获取所有优惠券列表
getCoupon() {
let phone = this.data.purePhoneNumber
// 1、先通过 openid 获取已领取的券,标记 isinitial:1
App.Activity.ActivityListByOpenid({
sellerid: this.sid
}).then(res => {
let openidCouponList = []
if (res.ret == 200 && res.data && res.data.length > 0) {
let list = res.data
list.forEach(detail => {
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.expiration_date = detail.expiration_date ? util.determine(detail.expiration_date) : '';
detail.aexpiration = detail.aexpiration ? util.determine(detail.aexpiration) : '';
if (detail.arule) {
detail.accumulationShow = detail.arule.is_accumulation
}
if (detail.exp_date && detail.exp_date.week_data) {
let mor = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '3').rArr.join('、')
if (mor) mor = '早餐:' + mor
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.morText = mor;
detail.noonText = noon;
detail.nigText = nig;
}
detail.checked = false;
detail.showCpupon = '0';
// 获取使用券的有效期
detail.cdate = detail.cdate * 1;
detail.useStime = '';
detail.useEtime = '';
let condition = detail.aexpiration
if (condition.valid_forever === '0' && condition.stime && condition.etime) {
detail.useStime = condition.stime;
detail.useEtime = condition.etime;
}
if (condition.valid_forever === '1') {
detail.foreverText = '永久有效';
}
if (condition.valid_forever === '0' && condition.today) {
let obj = this.setTimeRange(detail.cdate, 0, parseInt(condition.today) - 1);
detail.useStime = obj.useStime;
detail.useEtime = obj.useEtime;
}
if (condition.valid_forever === '0' && condition.tomorrow) {
let obj = this.setTimeRange(detail.cdate, 1, condition.tomorrow * 1);
detail.useStime = obj.useStime;
detail.useEtime = obj.useEtime;
}
if (condition.valid_forever === '0' && condition.sday && condition.eday) {
let obj = this.setTimeRange(detail.cdate, parseInt(condition.sday) - 1, parseInt(condition.eday) - 1);
detail.useStime = obj.useStime;
detail.useEtime = obj.useEtime;
}
if((detail.useStime>0 && detail.useEtime>0) || condition.valid_forever === '1') {
detail.endDateStr = condition.valid_forever == '1' ? '永久有效' : (util.unixtoTime(detail.useStime, 'YYYY-MM-DD') + '至' + util.unixtoTime(detail.useEtime, 'YYYY-MM-DD'));
}
})
list = list.filter(item => {
return (this.data.dataStr < (item.useEtime * 1) || item.aexpiration.valid_forever == '1');
})
list.sort((a, b) => {
if (a.aexpiration.valid_forever == '1' && b.aexpiration.valid_forever != '1') return 1;
if (a.aexpiration.valid_forever != '1' && b.aexpiration.valid_forever == '1') return -1;
return (a.useEtime * 1) - (b.useEtime * 1)
})
let couponArr = list
// 相同aid的券合并成一张,用加减号选择张数
let couponGroup = {}
let couponList = []
couponArr.forEach(item => {
let key = item.aid ? item.aid : item.activity_id
if (couponGroup[key]) {
couponGroup[key].num = (couponGroup[key].num * 1) + 1
couponGroup[key].activityIds.push(item.activity_id)
} else {
item.num = 1
item.checkedNum = 0
item.activityIds = [item.activity_id]
couponGroup[key] = item
couponList.push(item)
}
})
couponArr = couponList
// 单次使用数量限制,0表示不限制,默认0;合并完成后统一计算
couponArr.forEach(item => {
let useLimit = item.single_use_limit ? (item.single_use_limit * 1) : 0
item.maxNum = (useLimit > 0 && useLimit < item.num) ? useLimit : item.num
})
console.log('couponArr----',couponArr);
this.setData({
couponArr
openidCouponList = res.data
openidCouponList.forEach(item => {
item.isinitial = '1'
})
}
// 未授权手机号时,直接用 openid 获取的券
if (!phone) {
this.filterCouponList(openidCouponList)
return
}
// 2、再通过授权手机号获取的券,标记 isinitial:0
App.Activity.GetActivityListByPhone({
sellerid: this.sid,
phone
}).then(res2 => {
let phoneCouponList = []
if (res2 && res2.ret == 200 && res2.data && res2.data.length > 0) {
phoneCouponList = res2.data
phoneCouponList.forEach(item => {
item.isinitial = '0'
})
}
// 3、两个数组 concat 合并成所有券后,统一筛选可用的券
this.filterCouponList(openidCouponList.concat(phoneCouponList))
})
})
},
// 所有券合并后,统一筛选可用的券
filterCouponList(list) {
if (list.length == 0) {
return
}
list.forEach(detail => {
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.arule = detail.arule ? util.determine(detail.arule) : '';
detail.expiration_date = detail.expiration_date ? util.determine(detail.expiration_date) : '';
detail.aexpiration = detail.aexpiration ? util.determine(detail.aexpiration) : '';
if (detail.arule) {
detail.accumulationShow = detail.arule.is_accumulation
}
if (detail.exp_date && detail.exp_date.week_data) {
let mor = this.hasConsecutiveSelect(detail.exp_date.week_data, '1').rArr.join('、')
let noon = this.hasConsecutiveSelect(detail.exp_date.week_data, '2').rArr.join('、')
let nig = this.hasConsecutiveSelect(detail.exp_date.week_data, '3').rArr.join('、')
if (mor) mor = '早餐:' + mor
if (noon) noon = '午餐:' + noon
if (nig) nig = '晚餐:' + nig
detail.morText = mor;
detail.noonText = noon;
detail.nigText = nig;
}
detail.checked = false;
detail.showCpupon = '0';
// 获取使用券的有效期
detail.cdate = detail.cdate * 1;
detail.useStime = '';
detail.useEtime = '';
let condition = detail.aexpiration
if (condition.valid_forever === '0' && condition.stime && condition.etime) {
detail.useStime = condition.stime;
detail.useEtime = condition.etime;
}
if (condition.valid_forever === '1') {
detail.foreverText = '永久有效';
}
if (condition.valid_forever === '0' && condition.today) {
let obj = this.setTimeRange(detail.cdate, 0, parseInt(condition.today) - 1);
detail.useStime = obj.useStime;
detail.useEtime = obj.useEtime;
}
if (condition.valid_forever === '0' && condition.tomorrow) {
let obj = this.setTimeRange(detail.cdate, 1, condition.tomorrow * 1);
detail.useStime = obj.useStime;
detail.useEtime = obj.useEtime;
}
if (condition.valid_forever === '0' && condition.sday && condition.eday) {
let obj = this.setTimeRange(detail.cdate, parseInt(condition.sday) - 1, parseInt(condition.eday) - 1);
detail.useStime = obj.useStime;
detail.useEtime = obj.useEtime;
}
if((detail.useStime>0 && detail.useEtime>0) || condition.valid_forever === '1') {
detail.endDateStr = condition.valid_forever == '1' ? '永久有效' : (util.unixtoTime(detail.useStime, 'YYYY-MM-DD') + '至' + util.unixtoTime(detail.useEtime, 'YYYY-MM-DD'));
}
})
list = list.filter(item => {
return (this.data.dataStr < (item.useEtime * 1) || item.aexpiration.valid_forever == '1');
})
list.sort((a, b) => {
if (a.aexpiration.valid_forever == '1' && b.aexpiration.valid_forever != '1') return 1;
if (a.aexpiration.valid_forever != '1' && b.aexpiration.valid_forever == '1') return -1;
return (a.useEtime * 1) - (b.useEtime * 1)
})
let couponArr = list
// 同来源(openid/phone)且相同aid的券合并成一张,用加减号选择张数;不同来源分开
let couponGroup = {}
let couponList = []
couponArr.forEach(item => {
// openid券与phone券分开合并:同来源且同aid的券合并成一张,用加减号选择张数
let key = (item.isinitial == '0' ? 'p_' : 'o_') + (item.aid ? item.aid : (item.activity_id || item.phone_activity_id))
let id = item.activity_id || item.phone_activity_id
if (couponGroup[key]) {
couponGroup[key].num = (couponGroup[key].num * 1) + 1
couponGroup[key].activityIds.push(id)
} else {
item._key = key
item.num = 1
item.checkedNum = 0
item.activityIds = [id]
couponGroup[key] = item
couponList.push(item)
}
})
couponArr = couponList
// 单次使用数量限制,0表示不限制,默认0;合并完成后统一计算
couponArr.forEach(item => {
let useLimit = item.single_use_limit ? (item.single_use_limit * 1) : 0
item.maxNum = (useLimit > 0 && useLimit < item.num) ? useLimit : item.num
})
console.log('couponArr----',couponArr);
this.setData({
couponArr
})
},
// 加减号选择券的张数
changeCouponNum(e) {
let type = e.currentTarget.dataset.type;
let aid = e.currentTarget.dataset.aid;
let key = e.currentTarget.dataset.key;
const list = this.data.couponArr
let item = list.find(i => i.aid == aid)
let item = list.find(i => i._key == key)
if (!item) return
if (type == 'plus') {
if (item.canAdd != '1') return
... ... @@ -790,10 +837,10 @@ Page({
},
// 加减号中间输入框:只允许正整数或0,且不能超过当前可用张数
numInputChange(e) {
let aid = e.currentTarget.dataset.aid;
let key = e.currentTarget.dataset.key;
let val = (e.detail.value || '').replace(/[^\d]/g, ''); // 只保留数字
const list = this.data.couponArr
let item = list.find(i => i.aid == aid)
let item = list.find(i => i._key == key)
if (!item) return
let maxSelect = this.getMaxSelectNum(item)
let num = val === '' ? 0 : parseInt(val, 10)
... ... @@ -809,7 +856,7 @@ Page({
let descStr = 0
let val = 0
list.forEach(i => {
if (i.checkedNum > 0 && i.aid != item.aid) {
if (i.checkedNum > 0 && i._key != item._key) {
let d = parseFloat(i.desc) || 0
if (d > 0) descStr += d * i.checkedNum
val += parseFloat(i.price) * i.checkedNum
... ... @@ -893,7 +940,8 @@ Page({
for (let k = 0; k < item.checkedNum; k++) {
finalList.push({
...item,
activity_id: item.activityIds[k]
activity_id: item.isinitial == '0' ? '' : item.activityIds[k],
phone_activity_id: item.isinitial == '0' ? item.activityIds[k] : (item.phone_activity_id || ''),
})
}
}
... ... @@ -1070,8 +1118,10 @@ Page({
wx.showLoading({
title: '支付中',
})
let str = this.data.finalList.map(item => item.activity_id).join(',');
console.log('核销所勾选的券传参', str);
// isinitial为1的券用activity_id传参,isinitial为0的券用phone_activity_id传参
let activityIdStr = this.data.finalList.filter(item => item.isinitial == '1').map(item => item.activity_id).join(',');
let phoneActivityIdStr = this.data.finalList.filter(item => item.isinitial == '0').map(item => item.phone_activity_id).join(',');
console.log('核销所勾选的券传参', activityIdStr, phoneActivityIdStr);
let params = {
sellerid: this.data.seller.sid,
price: soothPrice,
... ... @@ -1080,8 +1130,11 @@ Page({
params.consume = this.data.consumeDiscount;
params.phone = this.data.purePhoneNumber;
}
if (str) {
params.activity_id = str;
if (activityIdStr) {
params.activity_id = activityIdStr;
}
if (phoneActivityIdStr) {
params.phone_activity_id = phoneActivityIdStr;
}
// 用余额支付 || 支付金额为0
if (this.data.soothPrice == '0.00') {
... ... @@ -1091,8 +1144,11 @@ Page({
price: this.data.inputValue,
phone: this.data.purePhoneNumber,
}
if (str) {
obj.activity_id = str;
if (activityIdStr) {
obj.activity_id = activityIdStr;
}
if (phoneActivityIdStr) {
obj.phone_activity_id = phoneActivityIdStr;
}
let consumeDiscount = this.data.consumeDiscount * 1
if (this.data.balancePay * 1 > 0) {
... ... @@ -1124,6 +1180,7 @@ Page({
if (this.data.balancePay) {
params.recharge_balance = this.data.balancePay;
}
console.log('params-----',params);
App.PayOnline.CombineTransactionsByNewActivity(params).then(res => {
console.log('付款信息', res.data);
if (res.ret != '200') {
... ... @@ -1204,7 +1261,7 @@ Page({
}
})
},
payFail() {
payFail(isShow) {
this.setData({
inputValue: '',
finalList: [],
... ... @@ -1216,8 +1273,11 @@ Page({
payType:'2',
soothPrice: '',
})
this.getCoupon()
this.getUserInfo()
// onShow触发时不提前拉券,等getCheckUserHavePhone拿到手机号后再拉,避免漏掉手机号维度的券
if (!isShow) {
this.getCoupon()
this.getUserInfo(this.data.purePhoneNumber)
}
},
giftConsumeFun(priceSum, orderid) {
let isReturn = this.data.isReturn;
... ... @@ -1251,7 +1311,7 @@ Page({
sellerid: this.data.seller.sid
}).then(res => {
if(type == '1'){
this.getUserInfo()
this.getUserInfo(this.data.purePhoneNumber)
}
})
},
... ... @@ -1361,11 +1421,13 @@ Page({
let consumeDiscount = this.data.consumeDiscount;
let inputValue = this.data.inputValue;
const amount = parseFloat(inputValue - consumeDiscount);
// 券唯一标识:手机号维度券没有 activity_id,用 phone_activity_id 区分,避免不同券互相误匹配
const couponKey = coupon => (coupon.isinitial == '0' ? 'p_' + coupon.phone_activity_id : 'o_' + coupon.activity_id);
const validCoupons = arr.filter(coupon => (coupon.isOk == '1' && parseFloat(coupon.desc) <= amount) && amount>=parseFloat(coupon.price));
// 排序后,优先选择最大优惠的券
validCoupons.sort((a, b) => parseFloat(b.price) - parseFloat(a.price));
arr.forEach(item => {
const isValid = validCoupons.some(validCoupon => validCoupon.activity_id == item.activity_id);
const isValid = validCoupons.some(validCoupon => couponKey(validCoupon) == couponKey(item));
item.canCheck = isValid ? '1' : '0'; // 如果在 validCoupons 中,设置 canCheck 为 1,否则为 0
});
console.log('可以勾选的券 && 满足付款条件的券', validCoupons);
... ... @@ -1399,12 +1461,12 @@ Page({
let maxCopies = Math.floor((amount - thresholdDescSum) / couponDesc)
if (maxCopies > coupon.maxNum) maxCopies = coupon.maxNum
if (maxCopies > 0) {
selectCount[coupon.aid] = maxCopies
selectCount[coupon._key] = maxCopies
thresholdDescSum += couponDesc * maxCopies
maxThresholdValue += couponPrice * maxCopies
}
})
list1 = stackingCoupons.filter(i => (selectCount[i.aid] || 0) > 0)
list1 = stackingCoupons.filter(i => (selectCount[i._key] || 0) > 0)
console.log('可叠加优惠券组合', list1);
// 3. 无门槛可叠加券:满减门槛之和小于输入金额时可以叠加,等于时和满减组合取优惠更大的
// 先算无门槛券单独使用的优惠总额
... ... @@ -1417,7 +1479,7 @@ Page({
let num = Math.floor((amount - noDescValue) / couponPrice)
if (num > coupon.maxNum) num = coupon.maxNum
if (num > 0) {
noDescCount[coupon.aid] = num
noDescCount[coupon._key] = num
noDescValue += couponPrice * num
}
}
... ... @@ -1432,21 +1494,21 @@ Page({
let num = Math.floor((amount - maxStackableValue) / couponPrice)
if (num > coupon.maxNum) num = coupon.maxNum
if (num > 0) {
selectCount[coupon.aid] = num
selectCount[coupon._key] = num
maxStackableValue += couponPrice * num
}
}
})
list1 = stackingCoupons.filter(i => (selectCount[i.aid] || 0) > 0)
list1 = stackingCoupons.filter(i => (selectCount[i._key] || 0) > 0)
} else if (noDescValue > maxThresholdValue) {
// 门槛等于输入金额,不能叠加,取无门槛券或满减券中优惠更大的
list1 = stackingCoupons.filter(i => (noDescCount[i.aid] || 0) > 0)
list1 = stackingCoupons.filter(i => (noDescCount[i._key] || 0) > 0)
selectCount = noDescCount
maxStackableValue = noDescValue
} else if (noDescValue == maxThresholdValue && noDescValue > 0) {
// 优惠相同取最早到期
let listThreshold = stackingCoupons.filter(i => (selectCount[i.aid] || 0) > 0)
let listNoDesc = stackingCoupons.filter(i => (noDescCount[i.aid] || 0) > 0)
let listThreshold = stackingCoupons.filter(i => (selectCount[i._key] || 0) > 0)
let listNoDesc = stackingCoupons.filter(i => (noDescCount[i._key] || 0) > 0)
let min1 = listThreshold.length > 0 ? Math.min(...listThreshold.map(item => item.useEtime)) : Infinity
let min2 = listNoDesc.length > 0 ? Math.min(...listNoDesc.map(item => item.useEtime)) : Infinity
if (min2 < min1) {
... ... @@ -1500,11 +1562,11 @@ Page({
let discountPrice = 0;
// 更新选中的优惠券
finalList.forEach(coupon => {
let target = arr.findIndex(obj => obj.activity_id === coupon.activity_id);
let target = arr.findIndex(obj => couponKey(obj) === couponKey(coupon));
if (target>-1) {
arr[target].showCpupon = 1;
arr[target].checkedNum = stackCount[coupon.aid] || 1;
discountPrice += parseFloat(coupon.price) * (stackCount[coupon.aid] || 1); // 使用 parseFloat 确保类型正确
arr[target].checkedNum = stackCount[coupon._key] || 1;
discountPrice += parseFloat(coupon.price) * (stackCount[coupon._key] || 1); // 使用 parseFloat 确保类型正确
}
console.log('选中的券', {
...coupon
... ... @@ -1517,7 +1579,8 @@ Page({
for (let k = 0; k < item.checkedNum; k++) {
finalList.push({
...item,
activity_id: item.activityIds[k]
activity_id: item.isinitial == '0' ? '' : item.activityIds[k],
phone_activity_id: item.isinitial == '0' ? item.activityIds[k] : (item.phone_activity_id || ''),
})
}
}
... ... @@ -1842,7 +1905,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
this.payFail()
this.payFail(true)
this.getCheckUserHavePhone()
this.getFreeMealConfigFun()
},
... ...
... ... @@ -17,16 +17,29 @@
<text>¥</text>
<input type="digit" value="{{inputValue}}" bindchange="bindKeyInput" />
</view>
<view bindtap="showCouponModal" class="couponsBox colorOrange">
<block wx:if="{{purePhoneNumber}}">
<view bindtap="showCouponModal" class="couponsBox colorOrange">
<view class="couponLeft">选择优惠券</view>
<view class="couponRight">
<text wx:if="{{discountPrice && discountPrice!='0.00' && couponSwitch}}">-{{discountPrice}}</text>
<text class="noUse font28r" wx:if="{{couponArr.length == '0'}}">暂无可用</text>
<text class="noUse font28r" wx:elif="{{coexist == '0' && !couponSwitch}}">不可用</text>
<view class="more" style="margin-top: 6rpx;"></view>
<view class="couponLeft">选择优惠券</view>
<view class="couponRight">
<text wx:if="{{discountPrice && discountPrice!='0.00' && couponSwitch}}">-{{discountPrice}}</text>
<text class="noUse font28r" wx:if="{{couponArr.length == '0'}}">暂无可用</text>
<text class="noUse font28r" wx:elif="{{coexist == '0' && !couponSwitch}}">不可用</text>
<view class="more" style="margin-top: 6rpx;"></view>
</view>
</view>
</view>
</block>
<block wx:else>
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumberFun" class="couponsBox colorOrange">
<view class="couponLeft font28r">选择优惠券</view>
<view class="couponRight font28r">
<text wx:if="{{discountPrice && discountPrice!='0.00' && couponSwitch}}">-{{discountPrice}}</text>
<text class="noUse font28r" wx:if="{{couponArr.length == '0'}}">暂无可用</text>
<text class="noUse font28r" wx:elif="{{coexist == '0' && !couponSwitch}}">不可用</text>
<view class="more" style="margin-top: 6rpx;"></view>
</view>
</button>
</block>
<block wx:if="{{purePhoneNumber}}">
<view bindtap="showConsumeModal" class="couponsBox colorOrange">
<view class="couponLeft">使用消费金抵扣</view>
... ... @@ -152,7 +165,7 @@
<view class="infoBottom font24r">注意:消费金与优惠券{{coexist == '1'?'可':'不可'}}同时使用</view>
</view>
<scroll-view class="couponBox" scroll-y="true">
<view wx:for="{{couponArr}}" data-aid="{{item.aid}}" class="couponItems {{item.showCpupon == '0' ? 'couponNo' : ''}}">
<view wx:for="{{couponArr}}" data-key="{{item._key}}" class="couponItems {{item.showCpupon == '0' ? 'couponNo' : ''}}">
<view class="itemLeft">
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font24r">¥</view><text class="priceText">{{item.price}}</text>
... ... @@ -163,11 +176,11 @@
<view class="itemRight">
<view class="anameText">
<view class="anameInfo">
<view class="names font40r">{{item.aname}}</view>
<view class="discountText1 font20r">{{item.accumulationShow == '1' ? '可' : '不可'}}叠加</view>
<view class="names font40r">{{item.aname}}<text class="discountText1 font20r">{{item.accumulationShow == '1' ? '可' : '不可'}}叠加</text></view>
</view>
</view>
<view wx:if="{{item.endDateStr}}" class="font20r bottomTitle">有效日期:<view class="bottom font20r">{{item.endDateStr}}</view>
<view wx:if="{{item.endDateStr}}" class="font20r bottomTitle"><text>有效日期:</text><view class="bottom font20r">{{item.endDateStr}}</view>
</view>
<!-- <view class="font20r bottom">{{item.arule.is_same_day=='1'?'领取当日可用':'领取当日不可用'}}</view>
<view wx:if="{{item.aexpiration>0}}" class="font20r bottom">领取后{{item.aexpiration}}天内使用</view>
... ... @@ -184,9 +197,9 @@
<view class="rightBox">
<view class="ownNum font20r">拥有{{item.num}}张</view>
<view class="numBox">
<view class="numBtn {{item.checkedNum == 0 ? 'numBtnDisabled' : ''}}" bindtap="changeCouponNum" data-aid="{{item.aid}}" data-type="minus">-</view>
<input class="numText" type="number" value="{{item.checkedNum}}" data-aid="{{item.aid}}" disabled="{{item.showCpupon == '0'}}" bindinput="numInputChange" />
<view class="numBtn {{item.canAdd != '1' ? 'numBtnDisabled' : ''}}" bindtap="changeCouponNum" data-aid="{{item.aid}}" data-type="plus">+</view>
<view class="numBtn {{item.checkedNum == 0 ? 'numBtnDisabled' : ''}}" bindtap="changeCouponNum" data-key="{{item._key}}" data-type="minus">-</view>
<input class="numText" type="number" value="{{item.checkedNum}}" data-key="{{item._key}}" disabled="{{item.showCpupon == '0'}}" bindinput="numInputChange" />
<view class="numBtn {{item.canAdd != '1' ? 'numBtnDisabled' : ''}}" bindtap="changeCouponNum" data-key="{{item._key}}" data-type="plus">+</view>
</view>
</view>
</view>
... ...
... ... @@ -57,7 +57,7 @@ page {
align-items: center;
justify-content: space-between;
color: #999;
margin: 24rpx 0;
line-height: 70rpx;
padding: 0;
background: transparent;
border: none;
... ... @@ -174,10 +174,13 @@ page {
border-radius: 20rpx;
display: flex;
padding: 20rpx 10rpx;
box-sizing: border-box;
overflow: hidden;
}
.itemLeft {
min-width: 21%;
flex-shrink: 0;
display: flex;
align-items: center;
flex-direction: column;
... ... @@ -270,11 +273,16 @@ page {
}
.bottomTitle text {
width: max-content;
flex-shrink: 0;
white-space: nowrap;
}
.bottom {
font-weight: normal;
width: max-content;
flex-shrink: 0;
white-space: nowrap;
}
.priceText {
... ... @@ -295,12 +303,21 @@ page {
.itemRight {
flex: 1;
min-width: 0;
overflow: hidden;
}
.rightBox {
min-width: 28%;
flex-shrink: 0;
display: flex;
align-items: center;
flex-direction: column;
}
.itemRight view {
display: flex;
line-height: 36rpx;
flex-shrink:0;
}
.nodate {
... ...
... ... @@ -63,6 +63,7 @@ Page({
consume: options.consume, //当餐免费使用的消费金金额
activity_id: options.activity_id, //当餐免费使用的券ID
inputValue: options.inputValue, //当餐免费抵扣前的金额
phone_activity_id: options.phone_activity_id || '',
},
type: options.type,
})
... ... @@ -457,6 +458,9 @@ Page({
if (this.data.opt.activity_id) {
params.activity_id = this.data.opt.activity_id;
}
if (this.data.opt.phone_activity_id) {
params.phone_activity_id = this.data.opt.phone_activity_id;
}
App.Activity.CreateRechargeBalanceOrder({
...params
}).then(res => {
... ...
... ... @@ -44,6 +44,7 @@ Page({
consume:options.consume,
activity_id:options.activity_id,
givePrice:options.givePrice,
phone_activity_id: options.phone_activity_id,
}
})
console.log('onLoad',{...this.data.opt});
... ... @@ -126,6 +127,7 @@ Page({
multiple: this.data.opt.multiple,
consume: this.data.opt.consume,
activity_id: this.data.opt.activity_id,
phone_activity_id: this.data.opt.phone_activity_id,
}, './confirmPayment')
wx.navigateTo({
url
... ...
... ... @@ -15,13 +15,26 @@ Page({
list:[]
})
this.init();
this.getlist();
this.getCheckUserHavePhone();
},
getlist() {
App.Activity.GetNewRechargeListByOpenid({
page:this.page,
size:this.size,
}).then((res) => {
// 检测用户是否绑定手机号
getCheckUserHavePhone() {
App.Wechat.CheckUserHavePhone({
openid: getApp().openid,
}).then((json) => {
if (json.ret == 200) {
let data = json.data;
let phone = (data && data.phone) ? data.phone : '';
this.getlist(phone)
}
})
},
getlist(phone) {
let params = {
openid: getApp().openid,
}
if(phone) params.phone = phone
App.Activity.GetNewRechargeListByOpenid({...params}).then((res) => {
if (res.ret == 200) {
let list=this.data.list;
list=list.concat(res.data)
... ...
... ... @@ -75,11 +75,23 @@ Page({
user:res.data
})
})
this.getlist()
this.getCheckUserHavePhone()
this.GetCollectionSellerList()
this.getInfo()
this.getUserInfo()
},
// 检测用户是否绑定手机号
getCheckUserHavePhone() {
App.Wechat.CheckUserHavePhone({
openid: getApp().openid,
}).then((json) => {
if (json.ret == 200) {
let data = json.data;
let phone = (data && data.phone) ? data.phone : '';
this.getlist(phone)
}
})
},
// 获取用户昵称、头像
getInfo() {
App.Wechat.CheckUserHavePhone({
... ... @@ -129,10 +141,12 @@ Page({
})
},
//获取用户未使用优惠券列表数量
getlist() {
App.Activity.GetNewRechargeListByOpenid({
openid: getApp().openid,
}).then((res) => {
getlist(phone) {
let params = {
openid: getApp().openid,
}
if(phone) params.phone = phone
App.Activity.GetNewRechargeListByOpenid({...params}).then((res) => {
if (res.ret == 200) {
let list = res.data;
list = list.filter(item => {
... ...
... ... @@ -140,6 +140,7 @@ Page({
lat: reserev.lat,
long: reserev.long,
is_online_reserve: reserev.is_online_reserve,
image: reserev.seller_image,
}
})
console.log('sellerseller', {
... ... @@ -654,10 +655,11 @@ Page({
sid: this.data.sid,
fromid: getApp().openid
}
let img = this.data.seller.image.replace(/^http:/, "https:");
return {
title: '向您推荐' + this.data.seller.sellName + ',快来看看吧!',
path: util.http_build_query(parmdata, '/pages/reserve/shopHome'),
imageUrl: this.data.home.image || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
imageUrl: img || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
}
},
// 拨打电话
... ...
... ... @@ -35,7 +35,8 @@
"disableUseStrict": false,
"useCompilerPlugins": false,
"minifyWXML": true,
"compileHotReLoad": true
"compileHotReLoad": true,
"ignoreUploadUnusedFiles": true
},
"editorSetting": {
"tabIndent": "insertSpaces",
... ...
... ... @@ -8,14 +8,189 @@
{
"name": "免费券付费券付款页",
"pathName": "pack-activity/pack/buyFreeCoupon",
"query": "sid=17948",
"query": "sid=4352",
"launchMode": "default",
"scene": null
},
{
"name": "4352-----新邀请函入口页",
"pathName": "pages/customer/detail_owner_invitation_new",
"query": "id=1460829&uid=27201&hasSellerShare=1&paymentId=",
"query": "id=3206045&hasInvitation=1&hasSellerShare=&uid=7035&fromid=oB-xJ5NGdgXHM0Pdsq2kAf7z-n9k",
"launchMode": "default",
"scene": null
},
{
"name": "测试-----新邀请函入口页",
"pathName": "pages/customer/detail_owner_invitation_new",
"query": "id=3163225&hasInvitation=1&hasSellerShare=1&uid=",
"launchMode": "default",
"scene": null
},
{
"name": "免费券详情页",
"pathName": "pack-activity/pack/receiveCoupon",
"query": "id=1450&types=3&name=22&sid=4352&oid=&StyleType=",
"launchMode": "default",
"scene": null
},
{
"name": "预订本",
"pathName": "pack-book/pages/reservation/reservation",
"query": "manager_id=23707&seller_openid=oGefL4sU0895yaX4x8mZsPJYz-UM&seller_id=4352",
"launchMode": "default",
"scene": null
},
{
"name": "pages/customer/detail_invitation",
"pathName": "pages/customer/detail_invitation",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/customer/index",
"pathName": "pages/customer/index",
"query": "id=2820926&fromid=1111&hasInvitation=1",
"launchMode": "default",
"scene": 1044
},
{
"name": "商家详情",
"pathName": "pages/reserve/shopHome",
"query": "sid=17948",
"launchMode": "default",
"scene": null
},
{
"name": "我的页面",
"pathName": "pages/me/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "店铺套餐",
"pathName": "pack-cookbook/pages/comboList",
"query": "sid=4352&uid=7035",
"launchMode": "default",
"scene": null
},
{
"name": "支付成功",
"pathName": "pack-activity/pack/paySuccess",
"query": "totalPrice=0&totalConsumePrice=0",
"launchMode": "default",
"scene": null
},
{
"name": "商家入驻",
"pathName": "pages/customer/joinSeller",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "我的余额页面",
"pathName": "pages/me/myBalance",
"query": "sellerid=17948",
"launchMode": "default",
"scene": null
},
{
"name": "领取消费金",
"pathName": "pack-activity/pack/getConsume",
"query": "sid=4352&price=10.20",
"launchMode": "default",
"scene": null
},
{
"name": "点餐完成页面",
"pathName": "pack-cookbook/pages/success_new",
"query": "type=1&sellerName=长安大排档&rid=2363547&oid=25851&sid=4352&hasSuccess=1",
"launchMode": "default",
"scene": null
},
{
"name": "登陆",
"pathName": "pages/customer/login",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "意见反馈",
"pathName": "pages/pinglun/createOpinion",
"query": "oid=392094&sellid=4352&sellName=14&types=1",
"launchMode": "default",
"scene": null
},
{
"name": "pages/reserve/submit",
"pathName": "pages/reserve/submit",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "运营超时预订",
"pathName": "pages/customer/index",
"query": "act=tobook&seller_id=4352&seller_openid=oGefL4sU0895yaX4x8mZsPJYz-UM&sellerOpenid=oGefL4sU0895yaX4x8mZsPJYz-UM&manager_id=&rid=1877529",
"launchMode": "default",
"scene": null
},
{
"name": "变更预订",
"pathName": "pack-book/pages/reservation/alterReservation",
"query": "id=1864634",
"launchMode": "default",
"scene": null
},
{
"name": "通知页",
"pathName": "pack-book/pages/reservation/noticePage",
"query": "id=1856053&isMany=0",
"launchMode": "default",
"scene": null
},
{
"name": "添加核餐",
"pathName": "pack-book/pages/reservation/addCheckDining",
"query": "id=1849266",
"launchMode": "default",
"scene": null
},
{
"name": "添加订金",
"pathName": "pack-book/pages/reservation/addDeposit",
"query": "id=1849266",
"launchMode": "default",
"scene": null
},
{
"name": "预订详情",
"pathName": "pack-book/pages/reservation/bookDetails",
"query": "id=1849266&date=2025-09-03&date1=%E4%B8%83%E6%9C%88%E5%8D%81%E4%BA%8C&week=%E6%98%9F%E6%9C%9F%E4%B8%89&threeText=%E4%BB%8A%E5%A4%A9",
"launchMode": "default",
"scene": null
},
{
"name": "商家有礼",
"pathName": "pages/reserve/sellerGift",
"query": "id=1824183&form=1",
"launchMode": "default",
"scene": null
},
{
"name": "订座",
"pathName": "pack-book/pages/book/b_addnew",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pack-book/pages/book/b_index",
"pathName": "pack-book/pages/book/b_index",
"query": "seller_id=4352&seller_openid=oGefL4sU0895yaX4x8mZsPJYz-UM&manager_id=24221",
"launchMode": "default",
"scene": null
},
... ... @@ -48,20 +223,6 @@
"scene": null
},
{
"name": "免费券详情页",
"pathName": "pack-activity/pack/receiveCoupon",
"query": "id=1173&types=3&name=22&sid=4352&oid=&StyleType=",
"launchMode": "default",
"scene": null
},
{
"name": "商家详情",
"pathName": "pages/reserve/shopHome",
"query": "sid=4352",
"launchMode": "default",
"scene": null
},
{
"name": "付费券券详情",
"pathName": "pack-activity/pack/buyCoupon",
"query": "id=394&name=14&sid=4352&oid=&types=3",
... ... @@ -69,13 +230,6 @@
"scene": null
},
{
"name": "测试-----新邀请函入口页",
"pathName": "pages/customer/detail_owner_invitation_new",
"query": "id=1438440&onlineReserve=1&hasInvitation=1&paymentId=&tplid=1&hasSellerShare=1&isDeposit=1&bookType=2",
"launchMode": "default",
"scene": null
},
{
"name": "旧首页",
"pathName": "pages/reserve/index",
"query": "a=b&c=d",
... ... @@ -111,13 +265,6 @@
"scene": null
},
{
"name": "点餐完成页面",
"pathName": "pack-cookbook/pages/success_new",
"query": "type=1&sellerName=长安大排档&rid=1342185&oid=16907&sid=4352&hasSuccess=1",
"launchMode": "default",
"scene": null
},
{
"name": "收藏页",
"pathName": "pages/me/follow",
"query": "",
... ... @@ -240,17 +387,6 @@
"query": ""
},
{
"name": "pages/customer/index",
"pathName": "pages/customer/index",
"query": "id=58295&fromid=1111&hasInvitation=1",
"scene": 1044,
"shareInfo": {
"groupName": "测试模拟群1",
"shareName": "8DEbIRpK4pa9mH_QY2vU4ZUKYPuI97WoQ4BQoFej-Q8@cr4dev",
"shareKey": "PZhnqMlY2TnRuHhATyGeSamVmBQUDXXr_WtjRSddeeFK17UAiOP-HNOdhxiEN7PFub5S1DjAeUl0IXOdW-VDqg~~"
}
},
{
"name": "邀请设置页 pages/customer/invite",
"pathName": "pages/customer/invite",
"query": "id=64"
... ... @@ -771,13 +907,6 @@
"scene": null
},
{
"name": "意见反馈",
"pathName": "pages/pinglun/createOpinion",
"query": "oid=392094&sellid=4352&sellName=14&types=1",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/me/wananchi",
"query": "type=1&oid=392864&sid=8",
... ... @@ -793,13 +922,6 @@
},
{
"name": "",
"pathName": "pages/customer/joinSeller",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/customer/collectSeller",
"query": "",
"launchMode": "default",
... ... @@ -825,18 +947,11 @@
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "商家有礼",
"pathName": "pages/reserve/sellerGift",
"query": "id=928221",
"launchMode": "default",
"scene": null
}
]
}
},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "%E5%91%A8%E5%88%B0%E5%AE%89%E6%8E%92",
"libVersion": "3.7.3"
"libVersion": "3.10.2"
}
\ No newline at end of file
... ...
... ... @@ -952,4 +952,11 @@ export default {
'App.Activity.GetBalanceListByOpenid':{
hasDisabledRMT:true,
},
//根据授权手机号获取预发优惠券
'App.Activity.GetActivityListByPhone':{
hasDisabledRMT:true,
},
}
\ No newline at end of file
... ...