|
...
|
...
|
@@ -808,8 +808,10 @@ Page({ |
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
let finalList = list.filter(i=>{return i.checked})
|
|
|
|
this.setData({
|
|
|
|
couponArr: list
|
|
|
|
couponArr: list,
|
|
|
|
finalList
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 输入金额
|
|
...
|
...
|
@@ -947,12 +949,14 @@ Page({ |
|
|
|
sellerid: this.data.seller.sid,
|
|
|
|
price: this.data.inputValue,
|
|
|
|
phone: this.data.purePhoneNumber,
|
|
|
|
recharge_balance: this.data.balancePay * 1,
|
|
|
|
}
|
|
|
|
if (str) {
|
|
|
|
obj.activity_id = str;
|
|
|
|
}
|
|
|
|
let consumeDiscount = this.data.consumeDiscount * 1
|
|
|
|
if (this.data.balancePay * 1 > 0) {
|
|
|
|
obj.recharge_balance = this.data.balancePay;
|
|
|
|
}
|
|
|
|
if (consumeDiscount > 0) {
|
|
|
|
obj.consume = this.data.consumeDiscount;
|
|
|
|
}
|
|
...
|
...
|
@@ -976,6 +980,9 @@ Page({ |
|
|
|
return false
|
|
|
|
}
|
|
|
|
// 微信支付
|
|
|
|
if (this.data.balancePay) {
|
|
|
|
params.recharge_balance = this.data.balancePay;
|
|
|
|
}
|
|
|
|
App.PayOnline.CombineTransactionsByNewActivity(params).then(res => {
|
|
|
|
console.log('付款信息', res.data);
|
|
|
|
if (res.ret != '200') {
|
|
...
|
...
|
@@ -1080,7 +1087,7 @@ Page({ |
|
|
|
priceSum = parseFloat(priceSum)
|
|
|
|
// 按百分比 is_ratio 1按比例 0按阶梯 ladder_data
|
|
|
|
if (data.is_ratio == '1' && data.ratio_data) {
|
|
|
|
totalConsumePrice = priceSum * (data.ratio_data / 100).toFixed(2);
|
|
|
|
totalConsumePrice = priceSum * (data.ratio_data / 100).toFixed(1);
|
|
|
|
console.log('送消费金百分比----', totalConsumePrice);
|
|
|
|
}
|
|
|
|
// 阶梯
|
|
...
|
...
|
@@ -1090,7 +1097,7 @@ Page({ |
|
|
|
}
|
|
|
|
if (totalConsumePrice > 0) this.getConsumeFun(totalConsumePrice)
|
|
|
|
this.setData({
|
|
|
|
totalConsumePrice: (totalConsumePrice * 1).toFixed(2)
|
|
|
|
totalConsumePrice: (totalConsumePrice * 1).toFixed(1)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
...
|
...
|
@@ -1250,18 +1257,18 @@ Page({ |
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// 如果剩余金额足够,选择券
|
|
|
|
if (remainingPrice >= couponDesc) {
|
|
|
|
if (remainingPrice > couponDesc || remainingPrice == couponDesc) {
|
|
|
|
// 计算实际使用的张数,不能超过 kyNum
|
|
|
|
let usedCount = Math.min(kyNum, 1); // 假设每次只使用一张
|
|
|
|
let potentialDiscount = couponDesc * usedCount; // 计算潜在的优惠金额
|
|
|
|
if (totalDiscount + potentialDiscount <= amount) {// 检查总优惠金额是否会超过总金额
|
|
|
|
if ((totalDiscount + potentialDiscount < amount) || (totalDiscount + potentialDiscount == amount)) {// 检查总优惠金额是否会超过总金额
|
|
|
|
list1.push(coupon);
|
|
|
|
remainingPrice -= couponPrice * usedCount; // 减去价格
|
|
|
|
totalDiscount += potentialDiscount; // 计算优惠金额
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 如果剩余金额已经小于等于 0,停止选择
|
|
|
|
if (remainingPrice <= 0) break;
|
|
|
|
if (remainingPrice < 0 || remainingPrice == 0) break;
|
|
|
|
}
|
|
|
|
// 遍历有效优惠券,寻找不可叠加的优惠券
|
|
|
|
let maxNonStackableValue = 0
|
|
...
|
...
|
@@ -1271,7 +1278,7 @@ Page({ |
|
|
|
// 计算实际支付金额
|
|
|
|
const finalAmount = amount - discountAmount;
|
|
|
|
// 确保实际支付金额不小于0,并且是最优惠的
|
|
|
|
if (finalAmount >= 0) {
|
|
|
|
if (finalAmount > 0 || finalAmount == 0) {
|
|
|
|
if (maxNonStackableValue<discountAmount) {
|
|
|
|
maxNonStackableValue = discountAmount
|
|
|
|
list2=[{...coupon}]
|
...
|
...
|
|