优化新客立减不生效的问题

This commit is contained in:
gyq
2025-11-25 16:46:00 +08:00
parent bb06553701
commit c1ee82ee8a
2 changed files with 15 additions and 13 deletions

View File

@@ -15,9 +15,9 @@
<div class="t2">
<span>商品原价:{{ goodsStore.cartInfo.costSummary.goodsRealAmount || 0 }}</span>
<span>餐位费:{{ formatDecimal(goodsStore.cartInfo.costSummary.seatFee || 0)
}}</span>
}}</span>
<span>打包费:{{ formatDecimal(goodsStore.cartInfo.costSummary.packFee || 0)
}}</span>
}}</span>
<span>优惠:{{ formatDecimal(goodsStore.cartInfo.costSummary.totalDiscountAmount || 0) }}</span>
<!-- <span v-if="goodsStore.cartInfo.costSummary.goodsDiscountAmount">
<span>折扣:{{ goodsStore.cartInfo.costSummary.goodsDiscountAmount }}</span>
@@ -123,8 +123,8 @@
:total="Number(buyerTable.total)" v-model:current-page="buyerTable.page" @current-change="getBuyerList" />
</el-dialog>
<el-dialog v-model="showCoupon"
:title="`添加优惠(商品原价:¥${formatDecimal(goodsStore.cartInfo.costSummary.goodsRealAmount || 0)}`" top="5vh" width="80%"
@open="couponDialogOpen">
:title="`添加优惠(商品原价:¥${formatDecimal(goodsStore.cartInfo.costSummary.goodsRealAmount || 0)}`" top="5vh"
width="80%" @open="couponDialogOpen">
<div class="coupom_dialog">
<el-form ref="couponFormRef" :model="couponForm" label-width="100" label-position="left">
<el-form-item label="选择用户">
@@ -463,8 +463,8 @@ function upadatePayData() {
userId: goodsStore.vipUserInfo.userId || '',
allPack: goodsStore.allSelected,
limitRate: goodsStore.limitDiscountRes,
newCustomerDiscountId: goodsStore.newCustomerDiscount !== null ? goodsStore.newCustomerDiscount.id : '', // 新客立减Id
newCustomerDiscountAmount: goodsStore.newCustomerDiscount !== null ? goodsStore.newCustomerDiscount.amount : 0, // 新客立减金额
newCustomerDiscountId: goodsStore.newUserDiscount !== null ? goodsStore.newUserDiscount.id : goodsStore.newUserDiscount !== null ? goodsStore.newUserDiscount.id : '', // 新客立减Id
newCustomerDiscountAmount: goodsStore.newUserDiscount !== null ? goodsStore.newUserDiscount.amount : 0, // 新客立减金额
vipDiscountAmount: goodsStore.cartInfo.costSummary.vipDiscountAmount, // 超级会员折扣
}
}

View File

@@ -82,8 +82,8 @@ export const useGoods = defineStore("goods", {
cartOrderItem: "",
pendingList: useStorage.get("pendingList") || [],
fullReductionActivities: '', // 满减活动配置信息
limitDiscountRes: '', // 限时折扣
newCustomerDiscount: '' // 新客立减
limitDiscountRes: null, // 限时折扣
newUserDiscount: null // 新客立减
}),
actions: {
// 选择会员
@@ -404,7 +404,7 @@ export const useGoods = defineStore("goods", {
// 新客立减
if (this.vipUserInfo.id) {
this.newCustomerDiscount = await getDiscountByUserId({
this.newUserDiscount = await getDiscountByUserId({
shopId: store.shopInfo.id,
shopUserId: this.vipUserInfo.id,
orderId: this.orderListInfo.id || ''
@@ -858,7 +858,7 @@ export const useGoods = defineStore("goods", {
pointsPerYuan: 0, // 积分换算规律
maxDeductionAmount: 0, // 最大抵扣
userPoints: 0, // 使用积分数量
newUserDiscount: 0, // 新客立减
newUserDiscount: this.newUserDiscount, // 新客立减
fixedAmount: 0, // 商家减免
backendCoupons: [], // 已选择的优惠券
};
@@ -929,8 +929,10 @@ export const useGoods = defineStore("goods", {
fixedAmount: options.fixedAmount,
});
//新客立减
const newUserDiscount = ref(options.newUserDiscount);
console.log('this.newUserDiscount', this.newUserDiscount);
// 订单额外配置
const orderExtraConfig = computed(() => ({
// 引用扩展后的商家减免配置
@@ -946,7 +948,7 @@ export const useGoods = defineStore("goods", {
currentDinnerType: dinnerType.value,
limitTimeDiscount: this.limitDiscountRes,
shopUserInfo: this.vipUserInfo,
newUserDiscount: newUserDiscount.value,
newUserDiscount: this.newUserDiscount !== null ? this.newUserDiscount.amount : '', //新客立减
}));
// 营销活动列表