|
@@ -737,10 +737,11 @@ export default {
|
|
|
return Math.round(price * 100) / 100;
|
|
return Math.round(price * 100) / 100;
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
- * 整单互斥优惠前的应付:先按商品+运费包装-红包得到应付,再剔除秒杀额。
|
|
|
|
|
- * 与后端 actionCreateMixOrder 红包后的 modifyPrice,经 capSeckillExcludePrice 后的优惠基数对齐。
|
|
|
|
|
|
|
+ * 整单互斥优惠前的基数(剔秒杀前):商品+运费包装-红包。
|
|
|
|
|
+ * 跑腿费(sendType=2 的 sendCost)不参与会员折/门店满减基数,实付时折后原额加回;
|
|
|
|
|
+ * 红包只抵商品不抵运费。与后端 actionCreateMixOrder 的 wholeDiscountPrice 口径对齐。
|
|
|
*/
|
|
*/
|
|
|
- wholeDiscountBasePrice() {
|
|
|
|
|
|
|
+ wholePriceBeforeSeckill() {
|
|
|
let price = Number(this.mixGoodsPrice) || 0;
|
|
let price = Number(this.mixGoodsPrice) || 0;
|
|
|
|
|
|
|
|
if (this.hasAvailableHb && this.selectedHbId) {
|
|
if (this.hasAvailableHb && this.selectedHbId) {
|
|
@@ -748,21 +749,27 @@ export default {
|
|
|
}
|
|
}
|
|
|
if (price < 0) price = 0;
|
|
if (price < 0) price = 0;
|
|
|
|
|
|
|
|
- const unMeetSend = Number(this.form.unMeetSendCost) || 0;
|
|
|
|
|
- const packCost = Number(this.form.packCost) || 0;
|
|
|
|
|
-
|
|
|
|
|
- if (this.form.sendType == 2) {
|
|
|
|
|
- price = price + Number(this.isFreeDelivery ? 0 : this.form.sendCost || 0) + unMeetSend + packCost;
|
|
|
|
|
- } else if ([0, 3, 4].includes(Number(this.form.sendType))) {
|
|
|
|
|
- price = price + unMeetSend + packCost;
|
|
|
|
|
|
|
+ // 跑腿费不计入折扣基数,各配送方式仅加运费与包装费
|
|
|
|
|
+ if ([0, 2, 3, 4].includes(Number(this.form.sendType))) {
|
|
|
|
|
+ price = price + (Number(this.form.unMeetSendCost) || 0) + (Number(this.form.packCost) || 0);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 秒杀价不参与会员折/门店满减;剔除额不超过当前应付,避免红包已吃进秒杀时把基数打成负数
|
|
|
|
|
|
|
+ return parseFloat(price.toFixed(2));
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 从折扣基数剔除的秒杀额(不超过基数),实付时原额加回。
|
|
|
|
|
+ * 与后端 capSeckillExcludePrice 对齐。
|
|
|
|
|
+ */
|
|
|
|
|
+ seckillExcludePrice() {
|
|
|
let seckillPrice = Number(this.mixSeckillGoodsPrice) || 0;
|
|
let seckillPrice = Number(this.mixSeckillGoodsPrice) || 0;
|
|
|
- if (seckillPrice > price) seckillPrice = price;
|
|
|
|
|
- if (seckillPrice > 0) {
|
|
|
|
|
- price = price - seckillPrice;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const base = Number(this.wholePriceBeforeSeckill) || 0;
|
|
|
|
|
+ if (seckillPrice > base) seckillPrice = base;
|
|
|
|
|
+ return seckillPrice > 0 ? parseFloat(seckillPrice.toFixed(2)) : 0;
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 整单互斥优惠基数:商品+运费包装-红包-秒杀额(不含跑腿费)。
|
|
|
|
|
+ */
|
|
|
|
|
+ wholeDiscountBasePrice() {
|
|
|
|
|
+ let price = (Number(this.wholePriceBeforeSeckill) || 0) - (Number(this.seckillExcludePrice) || 0);
|
|
|
if (price < 0) price = 0;
|
|
if (price < 0) price = 0;
|
|
|
return parseFloat(price.toFixed(2));
|
|
return parseFloat(price.toFixed(2));
|
|
|
},
|
|
},
|
|
@@ -793,6 +800,12 @@ export default {
|
|
|
modifyPrice() {
|
|
modifyPrice() {
|
|
|
let price = Number(this.wholeDiscountBasePrice) || 0;
|
|
let price = Number(this.wholeDiscountBasePrice) || 0;
|
|
|
price = price - (Number(this.wholeDiscountPick.amount) || 0);
|
|
price = price - (Number(this.wholeDiscountPick.amount) || 0);
|
|
|
|
|
+ // 秒杀额不参与折扣但计入实付,原额加回
|
|
|
|
|
+ price = price + (Number(this.seckillExcludePrice) || 0);
|
|
|
|
|
+ // 跑腿费不参与整单折扣,折后原额加回计入实付(免跑腿时 sendCost 已为 0)
|
|
|
|
|
+ if (Number(this.form.sendType) === 2 && !this.isFreeDelivery) {
|
|
|
|
|
+ price = price + (Number(this.form.sendCost) || 0);
|
|
|
|
|
+ }
|
|
|
if (price < 0) price = 0;
|
|
if (price < 0) price = 0;
|
|
|
return parseFloat(price.toFixed(2));
|
|
return parseFloat(price.toFixed(2));
|
|
|
},
|
|
},
|