Commit 59534b0dc8c24dfbf47a3a8c764e82c9fe06b6ac

Authored by pengye
1 parent 2a2387bb

优惠券增加单次可用几张字段

... ... @@ -118,7 +118,10 @@
"pages/index_new",
"pages/cart_new",
"pages/success_new",
"pages/favourableList"
"pages/favourableList",
"pages/comboList",
"pages/comboDetails",
"pages/comboBuy"
]
},
{
... ...
... ... @@ -736,49 +736,127 @@ Page({
return (this.data.dataStr < (item.useEtime * 1) || item.aexpiration.valid_forever == '1');
})
list.sort((a, b) => {
return (a.etime * 1) - (b.etime * 1)
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
})
}
})
},
// 勾选券
checkboxChange(e) {
console.log('checkbox发生change事件,携带value值为:', e.detail.value)
// 加减号选择券的张数
changeCouponNum(e) {
let type = e.currentTarget.dataset.type;
let aid = e.currentTarget.dataset.aid;
const list = this.data.couponArr
let item = list.find(i => i.aid == aid)
if (!item) return
if (type == 'plus') {
if (item.canAdd != '1') return
item.checkedNum = (item.checkedNum * 1) + 1
}
if (type == 'minus') {
if (item.checkedNum <= 0) return
item.checkedNum = (item.checkedNum * 1) - 1
}
this.refreshCouponState()
},
// 加减号中间输入框:只允许正整数或0,且不能超过当前可用张数
numInputChange(e) {
let aid = e.currentTarget.dataset.aid;
let val = (e.detail.value || '').replace(/[^\d]/g, ''); // 只保留数字
const list = this.data.couponArr
let item = list.find(i => i.aid == aid)
if (!item) return
let maxSelect = this.getMaxSelectNum(item)
let num = val === '' ? 0 : parseInt(val, 10)
if (isNaN(num)) num = 0
if (num > maxSelect) num = maxSelect
item.checkedNum = num
this.refreshCouponState()
},
// 计算某张券当前最多可以选到的张数
getMaxSelectNum(item) {
const list = this.data.couponArr
let inputValue = parseFloat(this.data.inputValue)
let descStr = 0
let val = 0
list.forEach(i => {
if (i.checkedNum > 0 && i.aid != item.aid) {
let d = parseFloat(i.desc) || 0
if (d > 0) descStr += d * i.checkedNum
val += parseFloat(i.price) * i.checkedNum
}
})
let itemDesc = parseFloat(item.desc) || 0
let itemPrice = parseFloat(item.price)
let maxSelect = item.maxNum
if (item.accumulationShow != '1' && maxSelect > 1) maxSelect = 1
if (inputValue > 0) {
if (itemDesc > 0) {
let byDesc = Math.floor((inputValue - descStr) / itemDesc)
if (byDesc < maxSelect) maxSelect = byDesc
} else {
// 无门槛券:满减门槛之和小于输入金额时才能叠加
if (descStr >= inputValue) {
maxSelect = 0
} else {
let byPrice = Math.floor((inputValue - val) / itemPrice)
if (byPrice < maxSelect) maxSelect = byPrice
}
}
}
if (maxSelect < 0) maxSelect = 0
return maxSelect
},
// 根据选择的券张数刷新券的可选状态
refreshCouponState() {
const list = this.data.couponArr
const values = e.detail.value
let arr = []
let currentCoupon = '0'; //没选券 为0 可叠加券1 不可叠加券2
let inputValue = parseFloat(this.data.inputValue)
let val = 0; //勾选的券 优惠金额的和
let descStr = 0; //勾选的券 每满金额的和
for (let i = 0, lenI = list.length; i < lenI; ++i) {
list[i].checked = false;
for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
if (list[i].activity_id === values[j]) {
val += parseFloat(list[i].price)
if (!list[i].desc || list[i].desc == 0) {
descStr += parseFloat(list[i].price)
} else {
descStr += parseFloat(list[i].desc)
}
arr.push({
...list[i]
})
list[i].checked = true
if (list[i].accumulationShow == '1') {
currentCoupon = '1'
break
} else {
currentCoupon = '2'
break
}
list.forEach(item => {
if (item.checkedNum > 0) {
val += parseFloat(item.price) * item.checkedNum
let itemDesc = parseFloat(item.desc) || 0
if (itemDesc > 0) {
descStr += itemDesc * item.checkedNum
}
if (item.accumulationShow != '1') {
currentCoupon = '2'
} else {
currentCoupon = '1'
}
}
}
})
let remaining = inputValue - val; //剩余金额
console.log('没选券为0可叠加券1不可叠加券2', currentCoupon, remaining);
//没选券 所有可选的打开
... ... @@ -792,7 +870,7 @@ Page({
//选的不可叠加券 其他所有的可叠加券都不可选
if (currentCoupon == '2') {
list.map((item) => {
if (item.checked) {
if (item.checkedNum > 0) {
item.showCpupon = '1'
} else {
item.showCpupon = '0'
... ... @@ -802,17 +880,79 @@ Page({
//选的可叠加券 其他所有的不可叠加券都不可选
if (currentCoupon == '1') {
list.forEach(item => {
if (item.checked || (item.accumulationShow == "1" && (inputValue - descStr) >= parseFloat(item.desc) && parseFloat(item.price) <= (inputValue - val))) {
if (item.checkedNum > 0 || (item.accumulationShow == "1" && parseFloat(item.price) <= (inputValue - val) && (((parseFloat(item.desc) || 0) > 0 && (inputValue - descStr) >= parseFloat(item.desc)) || ((parseFloat(item.desc) || 0) === 0 && descStr < inputValue)))) {
item.showCpupon = '1';
} else {
item.showCpupon = '0';
}
})
}
let finalList = list.filter(i=>{return i.checked})
this.setData({
couponArr: list,
finalList
let finalList = []
list.forEach(item => {
if (item.checkedNum > 0) {
for (let k = 0; k < item.checkedNum; k++) {
finalList.push({
...item,
activity_id: item.activityIds[k]
})
}
}
})
this.updateCanAdd()
if (inputValue) {
let discountPrice = 0;
finalList.forEach(i => {
discountPrice += parseFloat(i.price)
})
discountPrice = discountPrice.toFixed(2)
console.log('优惠金额----', discountPrice);
let actualPrice = (inputValue - discountPrice - this.data.consumeDiscount).toFixed(2)
let myBalance = this.data.myBalance * 1;
let balancePay = (this.data.payType == '1' && actualPrice > myBalance) ? myBalance : actualPrice;
let soothPrice = this.data.payType == '1' ? (actualPrice - balancePay).toFixed(2) : actualPrice;
this.setData({
couponArr: list,
finalList,
discountPrice,
actualPrice,
balancePay,
soothPrice,
})
} else {
this.setData({
couponArr: list,
finalList
})
}
},
// 计算每张券还能不能继续加:满减门槛之和不能超过输入金额
updateCanAdd() {
const list = this.data.couponArr
let inputValue = parseFloat(this.data.inputValue)
let descStr = 0
let val = 0
list.forEach(item => {
if (item.checkedNum > 0) {
let itemDesc = parseFloat(item.desc) || 0
let itemPrice = parseFloat(item.price)
if (itemDesc > 0) descStr += itemDesc * item.checkedNum
val += itemPrice * item.checkedNum
}
})
list.forEach(item => {
item.canAdd = '0'
// 不可叠加的券最多只能选一张
let maxSelect = item.accumulationShow == '1' ? item.maxNum : 1
if (item.showCpupon == '1' && item.checkedNum < maxSelect) {
let itemDesc = parseFloat(item.desc) || 0
let itemPrice = parseFloat(item.price)
if (itemDesc > 0) {
if (descStr + itemDesc <= inputValue) item.canAdd = '1'
} else {
// 无门槛券:满减门槛之和小于输入金额时才能叠加
if (descStr < inputValue && val + itemPrice <= inputValue) item.canAdd = '1'
}
}
})
},
// 输入金额
... ... @@ -821,7 +961,7 @@ Page({
let list = this.data.couponArr;
// 所有的券重置
list.forEach(i => {
i.checked = false;
i.checkedNum = 0;
i.showCpupon = '0'
})
this.setData({
... ... @@ -867,11 +1007,11 @@ Page({
if (!inputValue) return
let list = this.data.couponArr;
list = list.filter(i => {
return i.checked
return i.checkedNum > 0
})
let price = 0;
list.forEach(i => {
price += parseFloat(i.price)
price += parseFloat(i.price) * i.checkedNum
})
console.log('优惠金额----', price);
let val = parseFloat(this.data.inputValue);
... ... @@ -1235,9 +1375,7 @@ Page({
let list1 = []; // 可叠加的优惠券组合
let list2 = []; // 最优惠的不可叠加的优惠券
let finalList = []; //最终用的优惠券组合
// 计算可叠加的组合
let remainingPrice = amount; // 剩余金额
let totalDiscount = 0; // 总优惠金额
let selectCount = {}; // 每种券选中的张数
// 1. 优先排序 desc 为空或为 0 的,再根据 price 从大到小排序,再根据满减条件 desc 从大到小排序
stackingCoupons.sort((a, b) => {
if (a.desc === '0' || a.desc === '') return -1; // 优先选择 desc 为空或为 0 的
... ... @@ -1246,35 +1384,82 @@ Page({
return parseFloat(b.desc) - parseFloat(a.desc); // 按满减条件 desc 从大到小
});
console.log('排序后的可叠加券列表',stackingCoupons);
// 2. 从排序后的券中选择
for (let coupon of stackingCoupons) {
let couponDesc = parseFloat(coupon.desc);
let couponPrice = parseFloat(coupon.price);
let kyNum = Math.floor(remainingPrice / couponDesc);// 计算券可用张数
if (couponDesc === 0) {// 如果满减条件为 0,直接选择
list1.push(coupon);
remainingPrice -= couponPrice; // 减去价格
totalDiscount += couponPrice; // 计算优惠金额
continue;
// 2. 可叠加满减券:先选满减门槛最大的券,再叠加其他可用的券(门槛之和不能超过输入金额)
let thresholdDescSum = 0
let maxThresholdValue = 0
let thresholdCoupons = stackingCoupons.filter(coupon => (parseFloat(coupon.desc) || 0) > 0)
// 按满减门槛从大到小排序,门槛相同再按优惠金额从大到小
thresholdCoupons.sort((a, b) => {
if (parseFloat(b.desc) !== parseFloat(a.desc)) return parseFloat(b.desc) - parseFloat(a.desc)
return parseFloat(b.price) - parseFloat(a.price)
})
thresholdCoupons.forEach(coupon => {
let couponDesc = parseFloat(coupon.desc) || 0
let couponPrice = parseFloat(coupon.price)
let maxCopies = Math.floor((amount - thresholdDescSum) / couponDesc)
if (maxCopies > coupon.maxNum) maxCopies = coupon.maxNum
if (maxCopies > 0) {
selectCount[coupon.aid] = maxCopies
thresholdDescSum += couponDesc * maxCopies
maxThresholdValue += couponPrice * maxCopies
}
})
list1 = stackingCoupons.filter(i => (selectCount[i.aid] || 0) > 0)
console.log('可叠加优惠券组合', list1);
// 3. 无门槛可叠加券:满减门槛之和小于输入金额时可以叠加,等于时和满减组合取优惠更大的
// 先算无门槛券单独使用的优惠总额
let noDescValue = 0
let noDescCount = {}
stackingCoupons.forEach(coupon => {
let couponDesc = parseFloat(coupon.desc) || 0
let couponPrice = parseFloat(coupon.price)
if (couponDesc === 0 && couponPrice > 0) {
let num = Math.floor((amount - noDescValue) / couponPrice)
if (num > coupon.maxNum) num = coupon.maxNum
if (num > 0) {
noDescCount[coupon.aid] = num
noDescValue += couponPrice * num
}
}
// 如果剩余金额足够,选择券
if (remainingPrice > couponDesc || remainingPrice == couponDesc) {
// 计算实际使用的张数,不能超过 kyNum
let usedCount = Math.min(kyNum, 1); // 假设每次只使用一张
let potentialDiscount = couponDesc * usedCount; // 计算潜在的优惠金额
if ((totalDiscount + potentialDiscount < amount) || (totalDiscount + potentialDiscount == amount)) {// 检查总优惠金额是否会超过总金额
list1.push(coupon);
remainingPrice -= couponPrice * usedCount; // 减去价格
totalDiscount += potentialDiscount; // 计算优惠金额
})
let maxStackableValue = maxThresholdValue
if (thresholdDescSum < amount) {
// 可以叠加:无门槛券按剩余优惠额度叠加上去
stackingCoupons.forEach(coupon => {
let couponDesc = parseFloat(coupon.desc) || 0
let couponPrice = parseFloat(coupon.price)
if (couponDesc === 0 && couponPrice > 0) {
let num = Math.floor((amount - maxStackableValue) / couponPrice)
if (num > coupon.maxNum) num = coupon.maxNum
if (num > 0) {
selectCount[coupon.aid] = num
maxStackableValue += couponPrice * num
}
}
})
list1 = stackingCoupons.filter(i => (selectCount[i.aid] || 0) > 0)
} else if (noDescValue > maxThresholdValue) {
// 门槛等于输入金额,不能叠加,取无门槛券或满减券中优惠更大的
list1 = stackingCoupons.filter(i => (noDescCount[i.aid] || 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 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) {
list1 = listNoDesc
selectCount = noDescCount
}
// 如果剩余金额已经小于等于 0,停止选择
if (remainingPrice < 0 || remainingPrice == 0) break;
}
let stackList = list1
let stackCount = selectCount
// 遍历有效优惠券,寻找不可叠加的优惠券
let maxNonStackableValue = 0
validCoupons.forEach(coupon => {
if (coupon.accumulationShow === '0') {
if (coupon.accumulationShow != '1') {
const discountAmount = parseFloat(coupon.price);
// 计算实际支付金额
const finalAmount = amount - discountAmount;
... ... @@ -1287,27 +1472,25 @@ Page({
}
}
});
console.log('可叠加优惠券组合', list1);
console.log('不可叠加的优惠券', list2);
// 计算两个列表的最大优惠值
let maxStackableValue = list1.reduce((total, coupon) => total + parseFloat(coupon.price), 0);
console.log('可叠加优惠券组合总金额', maxStackableValue);
console.log('不可叠加的优惠券总金额', maxNonStackableValue);
// 比较两个最大值并输出结果
if (maxStackableValue > maxNonStackableValue) {
finalList = list1
finalList = stackList
} else if (maxStackableValue < maxNonStackableValue) {
finalList = list2
} else {
console.log(`两者的优惠值相同: ${maxStackableValue}`);
let copiedList1 = JSON.parse(JSON.stringify(list1));
let copiedList1 = JSON.parse(JSON.stringify(stackList));
let copiedList2 = JSON.parse(JSON.stringify(list2));
let minList1 = copiedList1.length > 0 ? Math.min(...copiedList1.map(item => item.useEtime)) : Infinity;
let minList2 = copiedList2.length > 0 ? Math.min(...copiedList2.map(item => item.useEtime)) : Infinity;
// 判断最小的 useEtime 是在 list1 还是 list2
if (minList1 <= minList2) {
console.log('最小的在 list1 中', list1);
finalList = list1
console.log('最小的在 list1 中', stackList);
finalList = stackList
} else {
console.log('最小的在 list2 中', list2);
finalList = list2
... ... @@ -1320,19 +1503,32 @@ Page({
let target = arr.findIndex(obj => obj.activity_id === coupon.activity_id);
if (target>-1) {
arr[target].showCpupon = 1;
arr[target].checked = true;
discountPrice += parseFloat(coupon.price); // 使用 parseFloat 确保类型正确
arr[target].checkedNum = stackCount[coupon.aid] || 1;
discountPrice += parseFloat(coupon.price) * (stackCount[coupon.aid] || 1); // 使用 parseFloat 确保类型正确
}
console.log('选中的券', {
...coupon
});
});
// 根据选中的张数展开最终券列表
finalList = []
arr.forEach(item => {
if (item.checkedNum > 0) {
for (let k = 0; k < item.checkedNum; k++) {
finalList.push({
...item,
activity_id: item.activityIds[k]
})
}
}
})
discountPrice = discountPrice.toFixed(2)
console.log('总优惠金额:', discountPrice);
console.log('消费金抵扣:',this.data.consumeDiscount);
this.setData({
discountPrice,
});
this.updateCanAdd()
return {
arr,
discountPrice,
... ... @@ -1425,42 +1621,83 @@ Page({
let obj = this.checkTimeInInterval(currentTime, lunchDis, lunchDinnerList);
//节假日数组
var holidays = [
'2025-1-1', // 元旦
'2025-1-28', // 春节
'2025-1-29', // 春节
'2025-1-30', // 春节
'2025-1-31', // 春节
'2025-2-1', // 春节
'2025-2-2', // 春节
'2025-2-3', // 春节
'2025-2-4', // 春节
'2025-4-4', //清明
'2025-4-5', //清明
'2025-4-6', //清明
'2025-5-1', // 劳动节
'2025-5-2', // 劳动节
'2025-5-3', // 劳动节
'2025-5-4', // 劳动节
'2025-5-5', // 劳动节
'2025-5-31', // 端午节
'2025-6-1', // 端午节
'2025-6-2', // 端午节
'2025-10-1', // 国庆节、中秋节
'2025-10-2', // 国庆节、中秋节
'2025-10-3', // 国庆节、中秋节
'2025-10-4', // 国庆节、中秋节
'2025-10-5', // 国庆节、中秋节
'2025-10-6', // 国庆节、中秋节
'2025-10-7', // 国庆节、中秋节
'2025-10-8', // 国庆节、中秋节
'2026-1-1', // 元旦
'2026-1-2', // 元旦
'2026-1-3', // 元旦
'2026-2-15', // 春节
'2026-2-16', // 春节
'2026-2-17', // 春节
'2026-2-18', // 春节
'2026-2-19', // 春节
'2026-2-20', // 春节
'2026-2-21', // 春节
'2026-2-22', // 春节
'2026-2-23', // 春节
'2026-4-4', //清明
'2026-4-5', //清明
'2026-4-6', //清明
'2026-5-1', // 劳动节
'2026-5-2', // 劳动节
'2026-5-3', // 劳动节
'2026-5-4', // 劳动节
'2026-5-5', // 劳动节
'2026-6-19', // 端午节
'2026-6-20', // 端午节
'2026-6-21', // 端午节
'2026-9-25', // 中秋节
'2026-9-26', // 中秋节
'2026-9-27', // 中秋节
'2026-10-1', // 国庆节
'2026-10-2', // 国庆节
'2026-10-3', // 国庆节
'2026-10-4', // 国庆节
'2026-10-5', // 国庆节
'2026-10-6', // 国庆节
'2026-10-7', // 国庆节
'2027-1-1', // 元旦
'2027-1-2', // 元旦
'2027-1-3', // 元旦
'2027-2-5', // 春节
'2027-2-6', // 春节
'2027-2-7', // 春节
'2027-2-8', // 春节
'2027-2-9', // 春节
'2027-2-10', // 春节
'2027-2-11', // 春节
'2027-2-12', // 春节
'2027-2-13', // 春节
'2027-4-3', //清明
'2027-4-4', //清明
'2027-4-5', //清明
'2027-5-1', // 劳动节
'2027-5-2', // 劳动节
'2027-5-3', // 劳动节
'2027-5-4', // 劳动节
'2027-5-5', // 劳动节
'2027-6-9', // 端午节
'2027-9-15', // 中秋节
'2027-10-1', // 国庆节
'2027-10-2', // 国庆节
'2027-10-3', // 国庆节
'2027-10-4', // 国庆节
'2027-10-5', // 国庆节
'2027-10-6', // 国庆节
'2027-10-7', // 国庆节
];
//周末上班日期数组
var nWeekend = [
'2025-1-26', //春节调整
'2025-2-8', //春节调整
'2025-4-27', //五一调整
'2025-9-28', //国庆调整
'2025-10-11', //国庆调整
'2026-1-4', //元旦调整
'2026-2-14', //春节调整
'2026-2-28', //春节调整
'2026-5-9', //五一调整
'2026-9-20', //国庆调整
'2026-10-10', //国庆调整
'2027-1-31', //春节调整
'2027-2-14', //春节调整
'2027-4-25', //五一调整
'2027-5-8', //五一调整
'2027-9-26', //国庆调整
'2027-10-9', //国庆调整
];
var curdate = new Date();
var year = curdate.getFullYear();
... ... @@ -1644,4 +1881,4 @@ Page({
onShareAppMessage() {
}
})
\ No newline at end of file
})
... ...
... ... @@ -17,7 +17,8 @@
<text>¥</text>
<input type="digit" value="{{inputValue}}" bindchange="bindKeyInput" />
</view>
<view bindtap="showCouponModal" class="couponsBox {{available == '1' ? 'colorOrange':'colorNine'}}">
<view bindtap="showCouponModal" class="couponsBox colorOrange">
<view class="couponLeft">选择优惠券</view>
<view class="couponRight">
<text wx:if="{{discountPrice && discountPrice!='0.00' && couponSwitch}}">-{{discountPrice}}</text>
... ... @@ -151,37 +152,44 @@
<view class="infoBottom font24r">注意:消费金与优惠券{{coexist == '1'?'可':'不可'}}同时使用</view>
</view>
<scroll-view class="couponBox" scroll-y="true">
<checkbox-group bindchange="checkboxChange">
<view wx:for="{{couponArr}}" data-activityId="{{item.activity_id}}" 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>
</view>
<view class="icons font20r" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="icons font20r" wx:if="{{item.desc=='0'}}">无门槛</view>
<view wx:for="{{couponArr}}" data-aid="{{item.aid}}" 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>
</view>
<view class="itemRight">
<view class="anameText">
<text class="font40r">{{item.aname}}</text>
<view class="icons font20r" wx:if="{{item.desc!='0'}}">消费满{{item.desc}}元可用</view>
<view class="icons font20r" wx:if="{{item.desc=='0'}}">无门槛</view>
</view>
<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>
<view wx:if="{{item.endDateStr}}" class="font20r bottomTitle">有效日期:<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>
<view wx:if="{{item.cdateText}}" class="font20r bottom">领取日期:{{item.cdateText}}</view> -->
<view wx:if="{{item.morText || item.noonText || item.nigText}}" class="font20r bottomTitle"><text>不可使用:</text>
<view class="textBox">
<view wx:if="{{item.morText}}" class="bottom font20r">{{item.morText}}</view>
<view wx:if="{{item.noonText}}" class="bottom font20r">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font20r">{{item.nigText}}</view>
</view>
</view>
<view wx:if="{{item.endDateStr}}" class="font20r bottomTitle">有效日期:<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>
<view wx:if="{{item.cdateText}}" class="font20r bottom">领取日期:{{item.cdateText}}</view> -->
<view wx:if="{{item.morText || item.noonText || item.nigText}}" class="font20r bottomTitle"><text>不可使用:</text>
<view class="textBox">
<view wx:if="{{item.morText}}" class="bottom font20r">{{item.morText}}</view>
<view wx:if="{{item.noonText}}" class="bottom font20r">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font20r">{{item.nigText}}</view>
</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font20r">无使用时间限制</view>
</view>
<checkbox disabled="{{item.showCpupon == '0'}}" value="{{item.activity_id}}" checked="{{item.checked}}" />
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font20r">无使用时间限制</view>
</view>
<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>
</view>
</checkbox-group>
</view>
</scroll-view>
</view>
</my-modal>
... ...
... ... @@ -69,10 +69,6 @@ page {
margin-left: 10rpx;
}
.colorNine {
color: #999;
}
.colorOrange {
color: #ED7B2F;
}
... ... @@ -181,14 +177,14 @@ page {
}
.itemLeft {
width: 25%;
min-width: 21%;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
border-right: 2rpx dashed #09BB07;
padding-right: 14rpx;
margin-right: 14rpx;
padding-right: 10rpx;
margin-right: 10rpx;
}
.couponModal1 {
... ... @@ -219,20 +215,25 @@ page {
.anameText {
display: flex;
justify-content: space-between;
}
.anameText {
margin-bottom: 14rpx;
}
.anameText text {
.anameText .names {
font-family: PingFang SC;
font-weight: 600;
line-height: 48rpx;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
display: -webkit-box;
word-break: break-all;
word-wrap: break-word;
overflow: hidden;
text-align: left;
}
.discountText1 {
... ... @@ -242,6 +243,20 @@ page {
margin: 0 20rpx;
}
.anameInfo {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.ownNum {
text-align: center;
color: #fe6d03;
font-family: PingFang SC;
font-weight: 500;
flex-shrink: 0;
}
.textBox {
width: 90%;
display: flex;
... ... @@ -312,6 +327,47 @@ checkbox::before {
content: '' !important;
}
.numBox {
display: flex;
align-items: center;
justify-content: center;
margin: 30rpx 10rpx 0 10rpx;
flex-shrink: 0;
align-self: center;
}
.numBtn {
width: 44rpx;
height: 44rpx;
border-radius: 50%;
background: linear-gradient(90deg, #ff4d11 0%, #fe7600 100%);
color: #ffffff;
font-size: 48rpx;
font-weight: 600;
line-height: 44rpx;
text-align: center;
}
.numBox .numBtn:first-child {
line-height: 40rpx;
}
.numBtnDisabled {
background: #cccccc;
}
.numText {
min-width: 48rpx;
width: 64rpx;
height: 44rpx;
border: 2rpx solid #c8c8c8;
margin: 0 10rpx;
text-align: center;
font-size: 28rpx;
font-weight: 600;
color: #333333;
}
.mymodal .mymodal-content {
height: 80% !important;
}
... ... @@ -324,12 +380,18 @@ checkbox::before {
border-right: 2rpx dashed #999;
}
.couponNo .numText {
border: 2rpx solid #999;
color: #999;
}
.couponNo .priceText,
.couponNo .icons,
.couponNo .priceText,
.couponNo .itemRight,
.couponNo .discountText1,
.couponNo .bottomTitle,
.couponNo .ownNum,
.couponNo .bottom {
color: #999;
}
... ...
... ... @@ -104,6 +104,15 @@
顾客生日当天可用
</view>
</view>
<view class="centerMain" wx:if="{{detail.single_use_limit && ((detail.single_use_limit*1) > 0)}}">
<view class="title">
<image src="https://qn.colorcun.com/restrictionsIcon.png" mode="" />
<text class="font32r">使用限制</text>
</view>
<view class="info font28r">
单次可用{{detail.single_use_limit}}张
</view>
</view>
<view class="centerMain" wx:if="{{detail.is_type == '3'}}">
<view class="title">
<image src="https://qn.colorcun.com/voucherUnion_4.png" mode="" />
... ...
... ... @@ -1055,6 +1055,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...
... ... @@ -1085,6 +1085,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...
... ... @@ -1083,6 +1083,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...
... ... @@ -907,6 +907,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...
... ... @@ -1135,6 +1135,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...
... ... @@ -1042,6 +1042,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...
... ... @@ -1042,6 +1042,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...
... ... @@ -1041,6 +1041,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...
... ... @@ -999,6 +999,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...
... ... @@ -1042,6 +1042,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...
... ... @@ -1041,6 +1041,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...
... ... @@ -1086,6 +1086,9 @@ Page({
if (!content) {
return;
}
this.setData({
isPlay: '1',
})
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('');
... ...