霸王餐更改

This commit is contained in:
wwz
2025-03-25 21:58:59 +08:00
parent 1169e300df
commit 3a6fa55234
14 changed files with 130 additions and 100 deletions

View File

@@ -32,7 +32,7 @@ export const useCartStore = defineStore('cart', () => {
};
// 计算购物车商品总价格
const getTotalTotalPrices = (matchedProducts) => computed(() => {
const getTotalTotalPrices = (matchedProducts, bwc = 2) => computed(() => {
if (!matchedProducts || !Array.isArray(matchedProducts)) {
return 0;
}
@@ -42,9 +42,10 @@ 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) {
.isMemberPrice == 1 && bwc == 2) {
// memberPrice会员价
return total + (parseFloat(item.memberPrice) * parseFloat(item.num - item
return total + (parseFloat(item.memberPrice || item.price) * parseFloat(item
.num - item
.returnNum));
} else {
// salePrice销售价
@@ -67,7 +68,7 @@ export const useCartStore = defineStore('cart', () => {
if (uni.cache.get('orderVIP').isVip == 1 && uni.cache.get('ordershopUserInfo')
.isMemberPrice == 1) {
// memberPrice会员价
return total + parseFloat(item.memberPrice)
return total + parseFloat(item.memberPrice || item.price)
} else {
// salePrice销售价
return total + parseFloat(item.price)
@@ -84,8 +85,10 @@ export const useCartStore = defineStore('cart', () => {
let cart = 0
if (uni.cache.get('ordershopUserInfo').isTableFee == 0 && seatNum) {
cart = Math.ceil(parseFloat(seatNum) * parseFloat(
uni.cache.get('ordershopUserInfo').tableFee) * 100) / 100;
cart = parseFloat(seatNum) * parseFloat(uni.cache.get('ordershopUserInfo').tableFee)
// Math.ceil(parseFloat(seatNum) * parseFloat(
// uni.cache.get('ordershopUserInfo').tableFee) * 100) / 100;
}
// 向下取整并保留两位小数
let result = roundUpToTwoDecimals(cart, 'downward')