fix: 修复选择券死循环问题,修复赠菜nan问题

This commit is contained in:
2025-10-11 11:20:55 +08:00
parent 7ceca3b917
commit 8087d9844b
6 changed files with 635 additions and 346 deletions

View File

@@ -93,19 +93,8 @@
</el-table-column>
<el-table-column label="商品信息">
<template v-slot="scope">
<div v-if="scope.row.type == 2">
<div class="u-flex">
<el-image
:src="scope.row.productImg"
fit="cover"
style="width: 40px; height: 40px"
:preview-src-list="[scope.row.productImg]"
></el-image>
</div>
<div class="u-m-t-10">
<div class="">{{ scope.row.productName }}</div>
<div class="u-m-t-4">x{{ scope.row.num || "" }}</div>
</div>
<div>
{{ scope.row.foods }}
</div>
</template>
</el-table-column>
@@ -408,12 +397,13 @@ watch(
//002-获取订单可用积分及抵扣金额(支付页面使用)
const pointsRes = ref({ usable: true, maxUsablePoints: 0, minDeductionPoints: 0 });
const usePointsNumber = ref(0);
const orderAmountOrderAmount = computed(() => {
return (carts.goodsTotal - checkOrderPay.discountAmount).toFixed(2);
//积分可抵扣最大金额
const scoreMaxMoney = computed(() => {
return carts.orderCostSummary.finalPayAmount - carts.orderCostSummary.pointDeductionAmount;
});
const pointsDiscountAmount = ref(0);
watch(
() => orderAmountOrderAmount.value,
() => scoreMaxMoney.value,
(newval) => {
pointsInit();
}
@@ -426,7 +416,7 @@ function returnPointsDiscountAmount() {
}
async function pointsInit() {
if (!props.user.id || score.sel == -1) {
if (!props.user.id) {
return;
}
const res = await PointsApi.calcOrderUsablePoints({
@@ -435,6 +425,9 @@ async function pointsInit() {
});
pointsRes.value = res;
carts.pointDeductionRule.pointsPerYuan = res.equivalentPoints;
if (score.sel == -1) {
return;
}
usePointsNumber.value = res.usable ? res.maxUsablePoints : 0;
if (res.usable) {