修复限时折扣问题

This commit is contained in:
2025-11-12 10:10:04 +08:00
parent 636fa4e033
commit 3274209ee7
3 changed files with 11 additions and 8 deletions

View File

@@ -7,14 +7,14 @@ VITE_APP_BASE_API=/dev-api
# 接口地址
# VITE_APP_API_URL=https://tapi.cashier.sxczgkj.cn/ # 测试
# VITE_APP_API_URL=https://cashier.sxczgkj.com/ # 正式
VITE_APP_API_URL=http://192.168.1.42/ # 本地
VITE_APP_API_URL=https://cashier.sxczgkj.com/ # 正式
# VITE_APP_API_URL=http://192.168.1.42/ # 本地
# WebSocket 端点(不配置则关闭),线上 ws://api.youlai.tech/ws ,本地 ws://localhost:8989/ws
# VITE_APP_WS_ENDPOINT=wss://sockets.sxczgkj.com/wss
# VITE_APP_WS_ENDPOINT=wss://czgeatws.sxczgkj.com/wss # 正式
VITE_APP_WS_ENDPOINT=ws://192.168.1.42:2348 # 本地
VITE_APP_WS_ENDPOINT=wss://czgeatws.sxczgkj.com/wss # 正式
# VITE_APP_WS_ENDPOINT=ws://192.168.1.42:2348 # 本地
# 启用 Mock 服务

View File

@@ -198,8 +198,8 @@ export const useCartsStore = defineStore("carts", () => {
goods.value = res.records.map(item => {
return {
...item,
isLimitDiscount: limitDiscountRes.value !== null && canUseLimitTimeDiscount(item, limitDiscountRes.value, shopInfo, shopUser.userInfo),
limitDiscountPrice: limitDiscountRes.value !== null && returnPrice({ goods: { ...item, memberPrice: item.lowMemberPrice, salePrice: item.lowPrice }, shopInfo: shopInfo, limitTimeDiscountRes: limitDiscountRes.value, shopUserInfo: shopUser.userInfo, idKey: 'id' })
isLimitDiscount: limitDiscountRes.value !== null && canUseLimitTimeDiscount(item, limitDiscountRes.value, shopInfo, vipUser.value),
limitDiscountPrice: limitDiscountRes.value !== null && returnPrice({ goods: { ...item, memberPrice: item.lowMemberPrice, salePrice: item.lowPrice }, shopInfo: shopInfo, limitTimeDiscountRes: limitDiscountRes.value, shopUserInfo: vipUser.value, idKey: 'id' })
}
});
@@ -314,7 +314,7 @@ export const useCartsStore = defineStore("carts", () => {
fullReductionActivities: fullReductionActivities.value,
currentDinnerType: dinnerType.value,
limitTimeDiscount: limitDiscountRes.value,
shopUserInfo: shopUser.userInfo,
shopUserInfo: vipUser.value,
newUserDiscount: newUserDiscount.value
}));

View File

@@ -128,7 +128,7 @@ export function returnIsSeatFee(item) {
/**
* 计算购物车会员优惠价格
*/
export function returnVipDiscountPrice() {}
export function returnVipDiscountPrice() { }
//计算商品券优惠价格
export function returnProductCouponPrice(coup, goodsArr, vipUser) {
@@ -243,6 +243,9 @@ export function returnCartPrice(goods, vipUser) {
// 价格保留两位小数不四舍五入
export function customTruncateToTwoDecimals(number) {
if (!number) {
return 0;
}
let stringNumber = number.toString();
let dotIndex = stringNumber.indexOf(".");
if (dotIndex === -1) {