霸王餐,满减活动等问题修复
This commit is contained in:
@@ -577,7 +577,7 @@ const goUrl = (item) => {
|
||||
return;
|
||||
}
|
||||
chnageIsUsePoints();
|
||||
break;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -608,16 +608,25 @@ async function getMaxPointsDiscount() {
|
||||
shopUserId: props.orderVIP.id,
|
||||
orderAmount: maxMoney.value,
|
||||
});
|
||||
if(res){
|
||||
cartStore.setPointDeductionRule(
|
||||
res.equivalentPoints,
|
||||
res.maxDeductionAmount
|
||||
);
|
||||
}
|
||||
Object.assign(pointsRes, res);
|
||||
|
||||
maxPointDiscount.value = res.maxDeductionAmount;
|
||||
console.log("积分可抵扣最大金额", maxPointDiscount.value);
|
||||
console.log("是否可以用积分", usePoints.value);
|
||||
if (usePoints.value) {
|
||||
console.log("积分抵扣金额", res.maxDeductionAmount);
|
||||
cartStore.setUserPoints(res.maxUsablePoints || 0);
|
||||
}
|
||||
}
|
||||
watch(
|
||||
() => maxMoney.value,
|
||||
(newval) => {
|
||||
console.log("maxMoney.value", newval);
|
||||
getMaxPointsDiscount();
|
||||
}
|
||||
);
|
||||
@@ -734,6 +743,7 @@ watch(
|
||||
const originalPrice = computed(() => {
|
||||
const originalPrice =
|
||||
cartStore.orderCostSummary.goodsRealAmount +
|
||||
-cartStore.orderCostSummary.newUserDiscount +
|
||||
cartStore.orderCostSummary.packFee +
|
||||
cartStore.orderCostSummary.seatFee;
|
||||
console.log("originalPrice", originalPrice);
|
||||
@@ -760,14 +770,24 @@ watch(
|
||||
disabledCouponUse.value = true;
|
||||
disabledCouponReason.value = "霸王餐与优惠券不可同时使用";
|
||||
cartStore.setCoupons([]);
|
||||
} else {
|
||||
disabledCouponUse.value = false;
|
||||
disabledCouponReason.value = "";
|
||||
}
|
||||
if (!freeDineConfig.withPoints) {
|
||||
disabledPointsUse.value = true;
|
||||
disabledPointsUseReason.value = "霸王餐与积分不可同时使用";
|
||||
usePoints.value = false;
|
||||
usePoints.value = false;
|
||||
cartStore.setUserPoints(0);
|
||||
} else {
|
||||
disabledPointsUse.value = false;
|
||||
disabledPointsUseReason.value = "";
|
||||
}
|
||||
} else {
|
||||
disabledPointsUse.value = false;
|
||||
disabledPointsUseReason.value = "";
|
||||
disabledCouponUse.value = false;
|
||||
disabledCouponReason.value = "";
|
||||
if (back_discountActivity) {
|
||||
calcDiscountActivity();
|
||||
}
|
||||
@@ -783,11 +803,18 @@ function calcDiscountActivity() {
|
||||
if (!res.vipPriceShare && user.isVip) {
|
||||
return;
|
||||
}
|
||||
console.log("calcDiscountActivity:originalPrice", originalPrice.value);
|
||||
|
||||
if (res && res.thresholds && res.thresholds.length > 0) {
|
||||
console.log("calcDiscountActivity", res);
|
||||
const canUseThresholds = res.thresholds.filter((v) => {
|
||||
return originalPrice.value >= v.fullAmount;
|
||||
});
|
||||
const canUseThresholds = res.thresholds
|
||||
.filter((v) => {
|
||||
return originalPrice.value >= v.fullAmount;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return b.discountAmount - a.discountAmount;
|
||||
});
|
||||
console.log("canUseThresholds", canUseThresholds);
|
||||
|
||||
if (canUseThresholds.length) {
|
||||
discountActivity.value = canUseThresholds[0];
|
||||
back_discountActivity = canUseThresholds[0];
|
||||
@@ -822,8 +849,8 @@ async function getDiscountActivity() {
|
||||
discountActivityRes.value = res;
|
||||
calcDiscountActivity();
|
||||
}
|
||||
onMounted(() => {
|
||||
getConsumeDiscount();
|
||||
onMounted(async () => {
|
||||
await getConsumeDiscount();
|
||||
getDiscountActivity();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user