fix: 增加订单支付各种优惠时的其他优惠重置

This commit is contained in:
YeMingfei666 2025-03-21 17:32:46 +08:00
parent 9609bda23c
commit 6368927de3
2 changed files with 26 additions and 3 deletions

View File

@ -186,7 +186,7 @@
<div class="u-flex u-m-b-10 u-row-between">
<span class="title">整单改价</span>
<span class="u-m-l-10 value">-{{ discountAmount }}</span>
<span class="u-m-l-10 value color-red">-{{ discountAmount }}</span>
</div>
<div class="u-flex u-m-b-10 u-row-between">
<span class="title">积分抵扣</span>
@ -284,6 +284,10 @@ function refCouponConfirm(e, goodsPayPriceMap, goodsList) {
score.sel = -1;
quansSelArr.value = e;
$goodsPayPriceMap = goodsPayPriceMap;
checkOrderPay.discountAmount = 0;
checkOrderPay.discount = 0;
score.sel = -1;
usePointsNumber.value = 0;
}
function delQuan(row) {
const index = quansSelArr.value.findIndex((v) => v.id == row.id);
@ -307,6 +311,9 @@ function discountConfirm(e) {
} else {
checkOrderPay.discount = 0;
}
score.sel = -1;
usePointsNumber.value = 0;
}
function discountShow(e) {
refDiscount.value.open({
@ -356,6 +363,7 @@ watch(
}
}
);
watch(
() => props.orderInfo.id,
(newval) => {

View File

@ -12,6 +12,10 @@ export function returnProductCouponPrice(coup, goodsArr, vipUser) {
if (!item) {
return 0;
}
const discountSaleAmount = item.discountSaleAmount * 1;
if (discountSaleAmount > 0) {
return discountSaleAmount * coup.num;
}
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
const price = item ? (isUseVipPrice(vipUser, item) ? memberPrice : item.price) : 0;
return price * coup.num;
@ -55,8 +59,10 @@ export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
use: false,
};
}
const discountSaleAmount = item.discountSaleAmount * 1;
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
const price = item ? (isUseVipPrice(vipUser, item) ? memberPrice : item.price) : 0;
let price = item ? (isUseVipPrice(vipUser, item) ? memberPrice : item.price) : 0;
price = discountSaleAmount > 0 ? discountSaleAmount : price;
const discountAmount = (price * coup.num).toFixed(2);
// const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
// const canUse=discountAmount>0
@ -83,8 +89,12 @@ export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
}
//返回商品实际支付价格
export function returnProductPayPrice(goods, vipUser) {
const discountSaleAmount = goods.discountSaleAmount * 1;
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
const price = isUseVipPrice(vipUser, goods) ? memberPrice : goods.price;
if (discountSaleAmount) {
return discountSaleAmount;
}
return price;
}
//返回商品券抵扣的商品价格
@ -93,7 +103,11 @@ export function returnProductCoupAllPrice(productPriceArr, startIndex, num = 1,
return productPriceArr.slice(startIndex, startIndex + num).reduce((prve, cur) => {
let curPrice = 0;
if (typeof cur === "object") {
curPrice = isVip ? cur.memberPrice * 1 : cur.price;
if (cur.discountSaleAmount * 1 > 0) {
curPrice = cur.discountSaleAmount * 1;
} else {
curPrice = isVip ? cur.memberPrice * 1 : cur.price;
}
} else {
curPrice = cur * 1;
}
@ -132,6 +146,7 @@ export function returnGoodsPayPriceMap(goodsArr) {
return {
memberPrice: v.memberPrice ? v.memberPrice : v.price,
price: v.price,
discountSaleAmount: v.discountSaleAmount * 1,
};
});
prve[cur.productId].push(...arr);