修复限时折扣会员价下单

This commit is contained in:
gyq
2025-11-12 18:39:58 +08:00
parent bc1d5983bd
commit 2db23c3370
3 changed files with 22 additions and 8 deletions

View File

@@ -76,7 +76,7 @@ export const useCartsStore = defineStore("carts", () => {
is_temporary: !!item.is_temporary,
is_gift: !!item.is_gift,
returnNum: item.returnNum || 0,
memberPrice: item.is_time_discount == 1 ? item.limitDiscountPrice : (item.memberPrice || 0),
memberPrice: item.memberPrice,
discountSaleAmount: item.discount_sale_amount || 0,
packFee: item.packFee || 0,
packNumber: item.pack_number || 0,
@@ -115,12 +115,16 @@ export const useCartsStore = defineStore("carts", () => {
// ------------------------------ 2. Store 内部原有响应式变量 ------------------------------
// 选择用户
const vipUser = ref<{ id?: string | number, isVip?: boolean }>({});
function changeUser(user: any) {
async function changeUser(user: any) {
vipUser.value = {
...user,
isMemberPrice: shopUser.userInfo.isMemberPrice
};
getGoods({})
await getGoods({})
allGoods.value = getAllGoodsList()
console.log('选择用户后刷新所有订单购物车数据====', allGoods.value);
payParamsInit()
}
@@ -392,12 +396,9 @@ export const useCartsStore = defineStore("carts", () => {
coupons.value = cps;
}
// 优惠券列表
const coupons = ref<BackendCoupon[]>([]);
// 商品加入购物车顺序
const cartOrder = ref<Record<string, number>>({});
let allGoods = ref<BaseCartItem[]>([]);
@@ -420,7 +421,6 @@ export const useCartsStore = defineStore("carts", () => {
return costSummary;
});
// 赠菜总价(调用内部的 getAllGoodsList
const giftMoney = computed(() => {
const allGoods = getAllGoodsList();

View File

@@ -4,6 +4,7 @@
:src="item.coverImg + '?x-oss-process=image/resize,m_lfit,w_100,h_100'" fit="cover"></el-image>
<div class="info" @click="itemClick">
<div class="dot" v-if="item.isLimitDiscount">限时折扣</div>
<div class="dot" v-if="cartStore.useVipPrice">会员价</div>
<div class="btm">
<div class="name u-flex u-flex-wrap">
<span class="weight" v-if="item.type == 'weight'">称重</span>
@@ -13,7 +14,15 @@
<span class="o_price">{{ item.lowPrice }}</span>
<span class="sale_price">{{ item.limitDiscountPrice }}</span>
</div>
<div v-else>{{ item.lowPrice }}</div>
<div class="limit_wrap" v-else>
<template v-if="cartStore.useVipPrice">
<span class="o_price">{{ item.lowPrice }}</span>
<span>{{ item.lowMemberPrice }}</span>
</template>
<template>
{{ item.lowPrice }}
</template>
</div>
</div>
</div>
<div class="status" v-if="
@@ -38,6 +47,10 @@
<script setup>
import dayjs from "dayjs";
import { useCartsStore } from '@/store/modules/carts'
const cartStore = useCartsStore()
const props = defineProps({
item: {
type: Object,

View File

@@ -526,6 +526,7 @@ function returnPayParams() {
limitRate: carts.limitDiscountRes,
newCustomerDiscountId: newCustomerDiscount.value !== null ? newCustomerDiscount.value.id : '', // 新客立减Id
newCustomerDiscountAmount: newCustomerDiscount.value !== null ? newCustomerDiscount.value.amount : 0, // 新客立减金额
vipDiscountAmount: carts.orderCostSummary.vipDiscountAmount, // 超级会员折扣
},
};
}