霸王餐更改
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user