增加网络波动加载中,增加会员信息扫码充值

This commit is contained in:
wwz
2025-03-26 17:58:52 +08:00
parent 3a6fa55234
commit 98ce8b5544
18 changed files with 1018 additions and 128 deletions

View File

@@ -32,7 +32,7 @@ export const useCartStore = defineStore('cart', () => {
};
// 计算购物车商品总价格
const getTotalTotalPrices = (matchedProducts, bwc = 2) => computed(() => {
const getTotalTotalPrices = (matchedProducts) => computed(() => {
if (!matchedProducts || !Array.isArray(matchedProducts)) {
return 0;
}
@@ -42,7 +42,7 @@ export const useCartStore = defineStore('cart', () => {
let cart = matchedProducts.reduce((total, item) => {
// 是否启用会员价 0否1是
if (uni.cache.get('orderVIP').isVip == 1 && uni.cache.get('ordershopUserInfo')
.isMemberPrice == 1 && bwc == 2) {
.isMemberPrice == 1) {
// memberPrice会员价
return total + (parseFloat(item.memberPrice || item.price) * parseFloat(item
.num - item
@@ -52,9 +52,10 @@ export const useCartStore = defineStore('cart', () => {
return total + (parseFloat(item.price) * parseFloat(item.num - item.returnNum));
}
}, 0);
cart.toFixed(2)
// 向上取整并保留两位小数
let result = roundUpToTwoDecimals(cart, 'upward')
return result;
// let result = roundUpToTwoDecimals(cart, 'upward')
return cart;
});
// 计算商品卷所选择的总价格