完善小程序

This commit is contained in:
wwz
2025-03-18 18:29:34 +08:00
parent fc957feb72
commit 9da31e2faa
19 changed files with 594 additions and 352 deletions

View File

@@ -44,7 +44,8 @@ export const useCartStore = defineStore('cart', () => {
if (uni.cache.get('orderVIP').isVip == 1 && uni.cache.get('ordershopUserInfo')
.isMemberPrice == 1) {
// memberPrice会员价
return total + (parseFloat(item.memberPrice) * parseFloat(item.num - item.returnNum));
return total + (parseFloat(item.memberPrice) * parseFloat(item.num - item
.returnNum));
} else {
// salePrice销售价
return total + (parseFloat(item.price) * parseFloat(item.num - item.returnNum));
@@ -94,9 +95,13 @@ export const useCartStore = defineStore('cart', () => {
// 计算购物车总打包费用(向下取整并保留两位小数)
const getTotalPackFee = (cartList) => computed(() => {
const total = cartList.reduce((sum, item) => {
return sum + (item.packAmount * (item.packNumber || (item.num - item.returnNum)));
return sum + (parseFloat(item.packAmount) * (parseFloat(item.packNumber) || (
parseFloat(item.num) - parseFloat(item.returnNum))));
}, 0);
return Math.floor(total * 100) / 100;
// 向下取整并保留两位小数
let result = roundUpToTwoDecimals(total, 'downward')
return result;
// return Math.floor(total * 100) / 100;
});
return {