diff --git a/components/paymentMethod.vue b/components/paymentMethod.vue index 00af685..6d26361 100644 --- a/components/paymentMethod.vue +++ b/components/paymentMethod.vue @@ -158,6 +158,9 @@ const groupChanges = (type) => { return; } const item = paymentMethodList.value.find((v) => v.type == type); + console.log("groupChanges", item); + console.log("props.disablePayType", props.disablePayType); + if (item && returnDisabled(item)) { uni.showToast({ title: "当前支付方式不可用", @@ -170,7 +173,7 @@ const groupChanges = (type) => { // } radiovalue.value = type; let name = paymentMethodName.value[type - 1].name; - + console.log('emit:groupChange',paymentMethodName.value[type - 1]); emits("groupChange", paymentMethodName.value[type - 1]); }; diff --git a/pages/order/components/orderInfo.vue b/pages/order/components/orderInfo.vue index ab064d4..5596039 100644 --- a/pages/order/components/orderInfo.vue +++ b/pages/order/components/orderInfo.vue @@ -577,7 +577,7 @@ const goUrl = (item) => { return; } chnageIsUsePoints(); - break; + break; } }; @@ -608,16 +608,25 @@ async function getMaxPointsDiscount() { shopUserId: props.orderVIP.id, orderAmount: maxMoney.value, }); + if(res){ + cartStore.setPointDeductionRule( + res.equivalentPoints, + res.maxDeductionAmount + ); + } Object.assign(pointsRes, res); + maxPointDiscount.value = res.maxDeductionAmount; + console.log("积分可抵扣最大金额", maxPointDiscount.value); + console.log("是否可以用积分", usePoints.value); if (usePoints.value) { + console.log("积分抵扣金额", res.maxDeductionAmount); cartStore.setUserPoints(res.maxUsablePoints || 0); } } watch( () => maxMoney.value, (newval) => { - console.log("maxMoney.value", newval); getMaxPointsDiscount(); } ); @@ -734,6 +743,7 @@ watch( const originalPrice = computed(() => { const originalPrice = cartStore.orderCostSummary.goodsRealAmount + + -cartStore.orderCostSummary.newUserDiscount + cartStore.orderCostSummary.packFee + cartStore.orderCostSummary.seatFee; console.log("originalPrice", originalPrice); @@ -760,14 +770,24 @@ watch( disabledCouponUse.value = true; disabledCouponReason.value = "霸王餐与优惠券不可同时使用"; cartStore.setCoupons([]); + } else { + disabledCouponUse.value = false; + disabledCouponReason.value = ""; } if (!freeDineConfig.withPoints) { disabledPointsUse.value = true; disabledPointsUseReason.value = "霸王餐与积分不可同时使用"; - usePoints.value = false; + usePoints.value = false; cartStore.setUserPoints(0); + } else { + disabledPointsUse.value = false; + disabledPointsUseReason.value = ""; } } else { + disabledPointsUse.value = false; + disabledPointsUseReason.value = ""; + disabledCouponUse.value = false; + disabledCouponReason.value = ""; if (back_discountActivity) { calcDiscountActivity(); } @@ -783,11 +803,18 @@ function calcDiscountActivity() { if (!res.vipPriceShare && user.isVip) { return; } + console.log("calcDiscountActivity:originalPrice", originalPrice.value); + if (res && res.thresholds && res.thresholds.length > 0) { - console.log("calcDiscountActivity", res); - const canUseThresholds = res.thresholds.filter((v) => { - return originalPrice.value >= v.fullAmount; - }); + const canUseThresholds = res.thresholds + .filter((v) => { + return originalPrice.value >= v.fullAmount; + }) + .sort((a, b) => { + return b.discountAmount - a.discountAmount; + }); + console.log("canUseThresholds", canUseThresholds); + if (canUseThresholds.length) { discountActivity.value = canUseThresholds[0]; back_discountActivity = canUseThresholds[0]; @@ -822,8 +849,8 @@ async function getDiscountActivity() { discountActivityRes.value = res; calcDiscountActivity(); } -onMounted(() => { - getConsumeDiscount(); +onMounted(async () => { + await getConsumeDiscount(); getDiscountActivity(); }); diff --git a/pages/order/confirm-order.vue b/pages/order/confirm-order.vue index a2b2bad..d17cc90 100644 --- a/pages/order/confirm-order.vue +++ b/pages/order/confirm-order.vue @@ -100,12 +100,13 @@ + - + { - //原始金额 - const originMoney = BigNumber(cartStore.orderCostSummary.goodsOriginalAmount) - .plus(cartStore.orderCostSummary.packFee) - .plus(cartStore.orderCostSummary.seatFee) - .plus(cartStore.orderCostSummary.additionalFee); - //实付金额=原始金额*倍数 - // const fullAmount=originMoney.times(oorderVIP.value.freeDineConfig.multiple) - - if ( - (listinfo.status == "unpaid" || !listinfo.id) && - orderVIP.value.freeDineConfig.enable && - originMoney >= orderVIP.value.freeDineConfig.rechargeThreshold - ) { - return true; - } -}); +const showFreeDine = ref(false); //订单备注 const orderRemarker = ref(""); @@ -473,6 +463,7 @@ const orderorderInfo = async () => { tableCode: options.tableCode, }); orderRemarker.value = res.remark; + Object.assign(listinfo, res); if (res && res.tableCode) { socketInitPar.table_code = res.tableCode; let tableRes = await getTableInfo({ @@ -655,18 +646,15 @@ const paymentmethod = reactive({ }); const groupChange = async (e) => { + if (e == 5) { + return; + } + console.log("groupChange", e); paymentmethod.radiovalue = e.type; paymentmethod.paymentBtnText = e.name; paymentmethod.payType = e.payType; }; -// * 去充值 -const goRecharge = () => { - uni.pro.navigateTo("/pages/member/index", { - shopId: listinfo.shopId, - }); -}; - // 操作下单时候 const orderInfoAfterRef = ref(null); @@ -799,6 +787,7 @@ function pay_lock() { } function pay_unlock() { + console.log("pay_unlock"); clearInterval(payStatusTimer); cartsSocket.sendMessage({ ...socketInitPar, @@ -818,7 +807,6 @@ async function search_pay_lock() { } let payStatusTimer = null; let orderIsLock = true; -let usePoints = ref(0); function returnPayParams() { const checkOrderPay = { @@ -833,7 +821,7 @@ function returnPayParams() { cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额 otherCouponDiscountAmount: cartStore.orderCostSummary.fullCouponDeduction, //其他优惠券抵扣金额 couponList: cartStore.backendCoupons.map((v) => v.id), //用户使用的卡券 - orderAmount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额 + orderAmount:isBwc.value? cartStore.orderCostSummary.orderOriginFinalPayAmount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额 roundAmount: 0, //抹零金额 减免多少钱 pointsDiscountAmount: cartStore.orderCostSummary.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表) pointsNum: cartStore.orderCostSummary.pointUsed, //(扣除各类折扣 enable_deduction后使用) @@ -844,8 +832,10 @@ function returnPayParams() { : "", remark: orderRemarker.value, //用户备注 discountActAmount: cartStore.orderCostSummary.fullReduction.actualAmount, //满减抵扣金额 + userId: uni.cache.get("userInfo").id || "", // }; return { + isBwc: isBwc.value, checkOrderPay, payType: paymentmethod.payType, buyerRemark: "", @@ -855,6 +845,7 @@ function returnPayParams() { shopUserId: orderVIP.value.id, shopId: orderVIP.value.shopId, pwd: "", + userId: uni.cache.get("userInfo").id || "", // discountActld: cartStore.orderCostSummary.fullReduction.usedActivity ? cartStore.orderCostSummary.fullReduction.usedActivity.id : "", //满减活动id @@ -862,35 +853,39 @@ function returnPayParams() { } const istoricalorders = async () => { + const payParams = returnPayParams(); + + console.log("istoricalorders:payParams", payParams); //先付 if (isPayBefor()) { // 购物车有数据 if (!cartStore.isEmpty) { - usePoints = cartStore.orderCostSummary.pointUsed; const res = await createOrder(); //历史订单数据 const res1 = await APIgetOrderById({ orderId: res.id, }); + Object.assign(listinfo, res1); orderRemarker.value = res1.remark; cartStore.setOldOrder(res1); } - goToPay(); + goToPay(payParams); // goToPay() } else { //后付 // 购物车有数据 if (!cartStore.isEmpty) { - usePoints = cartStore.orderCostSummary.pointUsed; const res = await createOrder(); //历史订单数据 const res1 = await APIgetOrderById({ orderId: res.id, }); + Object.assign(listinfo, res1); + orderRemarker.value = res1.remark; cartStore.setOldOrder(res1); - goToPay(); + goToPay(payParams); return; } // 先调用历史订单 @@ -908,7 +903,7 @@ const istoricalorders = async () => { } // 判断支付之前是是否还有新加订单 if (listinfo.combinedArray.length === combinedArray.length) { - goToPay(); + goToPay(payParams); } else { uni.showToast({ title: "你的订单已更新!", @@ -929,11 +924,11 @@ const istoricalorders = async () => { }; // * 去支付 -const goToPay = async (isCreateOrder = false) => { - const payParams = returnPayParams(); - const { checkOrderPay } = payParams; +const goToPay = async (payParams) => { + console.log("goToPay:payParams", payParams); + // 余额支付 - if (paymentmethod.payType == "accountPay") { + if (payParams.payType == "accountPay") { if (orderVIP.value.payPwd == "") { uni.showModal({ title: "提示", @@ -966,30 +961,50 @@ const goToPay = async (isCreateOrder = false) => { title: "有人正在付款中!", icon: "none", }); + const shopUserInfo = uni.cache.get("shopUserInfo"); + console.log("shopUserInfo", shopUserInfo); + console.log("listinfo", listinfo); + if (shopUserInfo) { + if (shopUserInfo.userId == listinfo.userId) { + pay_unlock(); + } + } return; } + console.log("canPay:goToPay:payParams", payParams); + pay_lock(); payStatusTimer = setInterval(() => { pay_lock(); }, 1000); - - if (orderVIP.value.freeDineConfig.enable && isBwc.value) { - const isPaySuccess = await storeMemberpay.actionspayltPayVip({ - shopId: orderVIP.value.shopId, - shopUserId: orderVIP.value.id, - orderId: listinfo.id, - userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包 - amount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额 - orderAmount: cartStore.orderCostSummary.orderOriginFinalPayAmount, // 最终订单原金额 - originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(不包含打包费+餐位费) - returnUrl: "", //跳转地址 - buyerRemark: "", - seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数 - }); - if (isPaySuccess) { - paySucessCallback(); + console.log("霸王餐前payParams", payParams); + if (payParams.isBwc) { + payParams.checkOrderPay.orderId = listinfo.id; + console.log("霸王餐支付参数:", payParams); + try { + const isPaySuccess = await storeMemberpay.actionspayltPayVip({ + ...payParams, + shopId: orderVIP.value.shopId, + shopUserId: orderVIP.value.id, + orderId: listinfo.id, + userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包 + amount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额 + orderAmount: cartStore.orderCostSummary.orderOriginFinalPayAmount, // 最终订单原金额 + originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(不包含打包费+餐位费) + returnUrl: "", //跳转地址 + buyerRemark: "", + seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数 + }); + if (isPaySuccess) { + paySucessCallback(); + orderorderInfo(); + pay_unlock(); + } + } catch (error) { + console.log("error", error); + pay_unlock(); } - orderorderInfo(); + return false; } else { payParams.checkOrderPay.orderId = listinfo.id; @@ -1026,6 +1041,14 @@ const memberPointscalcUsablePoints = async () => { shopUserId: orderVIP.value.id, orderAmount: listinfo.totalCost, }); + console.log('获取订单可用积分及抵扣金额(支付页面使用)') + if(res){ + cartStore.setPointDeductionRule( + res.equivalentPoints, + res.maxDeductionAmount + ); + } + orderInfoAfterRef.value?.getCalcUsablePoints(res); }; // @@ -1056,6 +1079,43 @@ const accountPayevent = async (pwd) => { } orderorderInfo(); }; +watch( + () => cartStore.orderCostSummary.orderOriginFinalPayAmount, + (newval) => { + console.log("orderOriginFinalPayAmount", newval); + if (newval <= 0) { + disablePayType.value = ["微信支付"]; + paymentMethodref.value.groupChanges(1); + } + if ( + newval <= 0 || + newval < orderVIP.value.freeDineConfig.rechargeThreshold + ) { + isBwc.value = false; + showFreeDine.value = false; + return; + } + disablePayType.value = []; + + if ( + (listinfo.status == "unpaid" || !listinfo.id) && + orderVIP.value.freeDineConfig.enable && + newval >= orderVIP.value.freeDineConfig.rechargeThreshold + ) { + showFreeDine.value = true; + } + }, + { + immediate: true, + } +); + +watch( + () => isBwc.value, + (newval) => { + cartStore.isFreeDine = newval; + } +); onBeforeUnmount(() => { uni.$off("returnData", handleReturnData); @@ -1170,6 +1230,7 @@ async function init(opt) { cartStore.setSeatFeeConfig("personCount", res.seatNum); cartStore.setDinnerType(res.dineMode || "dine-in"); orderRemarker.value = res.remark; + Object.assign(listinfo, res); } } //获取店铺信息 diff --git a/pages/user/member/billDetails.vue b/pages/user/member/billDetails.vue index c2ccedf..cb20610 100644 --- a/pages/user/member/billDetails.vue +++ b/pages/user/member/billDetails.vue @@ -57,6 +57,13 @@ 管理员消费 + + 消费返现 + + + 霸王餐充值 + + {{item.content}} diff --git a/stores/carts.js b/stores/carts.js index f692086..107d027 100644 --- a/stores/carts.js +++ b/stores/carts.js @@ -128,7 +128,7 @@ export const useCartsStore = defineStore("cart", () => { //积分规则 const pointDeductionRule = ref({ - pointsPerYuan: 100, + pointsPerYuan: 0, maxDeductionAmount: Infinity, }); @@ -606,7 +606,7 @@ export const useCartsStore = defineStore("cart", () => { dinnerType.value = "dine-in"; userPoints.value = 0; fullReductionActivities.value = []; - isFreeDine.value = false; + isFreeDine.value = false; } return { @@ -649,8 +649,8 @@ export const useCartsStore = defineStore("cart", () => { //清空配置 clearOrderConfig, //满减活动 - fullReductionActivities, - isFreeDine,//是否使用霸王餐 + fullReductionActivities, + isFreeDine, //是否使用霸王餐 // 商家霸王餐配置 freeDineConfig, }; diff --git a/stores/pay.js b/stores/pay.js index c33a6f8..8ea6f8b 100644 --- a/stores/pay.js +++ b/stores/pay.js @@ -238,7 +238,6 @@ export const Memberpay = defineStore('memberpay', { placeNum: data.placeNum, //当前订单下单次数 waitCall: data.waitCall //是否等叫 0 否 1 等叫 }) - console.log('actionscreateOrder res:'); console.log(res); if (res) { resolve(res) diff --git a/utils/goods.ts b/utils/goods.ts index 086e579..7b1053f 100644 --- a/utils/goods.ts +++ b/utils/goods.ts @@ -288,7 +288,7 @@ export interface OrderCostSummary { actualAmount: number; // 满减实际减免金额(元) }; // 订单原支付金额 - orderOriginFinalPayAmount: number; //订单原金额(包含打包费+餐位费) + orderOriginFinalPayAmount: number; //订单原金额(包含打包费+餐位费) } /** 满减活动阈值(单条满减规则:满X减Y)- 对应 MkDiscountThresholdInsertGroupDefaultGroup */ @@ -414,7 +414,6 @@ export function filterOptimalFullReductionActivity( currentTime: Date = new Date() ): FullReductionActivity | undefined { if (!activities || !activities.length) return undefined; - console.log("原始满减活动列表:", activities); // 第一步:基础筛选(未删除+当前店铺+活动进行中+就餐类型匹配) const baseEligible = activities.filter((activity) => { return ( @@ -425,7 +424,6 @@ export function filterOptimalFullReductionActivity( activity.thresholds?.length // 至少有一个满减阈值 ); }); - console.log("基础筛选结果:", baseEligible); if (!baseEligible.length) return undefined; // 第二步:时间筛选(有效期内+周期内+时段内) @@ -814,10 +812,7 @@ export function selectOptimalThreshold( if (!thresholds.length) return undefined; // 第一步:确定满减门槛基数(根据discountShare规则) - const thresholdBase = - discountShare === 1 - ? new BigNumber(goodsRealAmount) // 与限时折扣同享→用折扣后金额 - : new BigNumber(goodsOriginalAmount); // 不同享→用原价 + const thresholdBase = baseAmount; // 第二步:筛选「满金额≤基数」且「减免金额>0」的有效阈值 const validThresholds = thresholds.filter((threshold) => { @@ -830,21 +825,34 @@ export function selectOptimalThreshold( }); if (!validThresholds.length) return undefined; - // 第三步:选择最优阈值(优先级:1.满金额最小 → 2.减免金额最大) - return validThresholds.sort((a, b) => { - const aFull = new BigNumber(a.fullAmount || 0); - const bFull = new BigNumber(b.fullAmount || 0); - const aDiscount = new BigNumber(a.discountAmount || 0); - const bDiscount = new BigNumber(b.discountAmount || 0); + // const sortValidThresholds = validThresholds.sort((a, b) => { + // const aFull = new BigNumber(a.fullAmount || 0); + // const bFull = new BigNumber(b.fullAmount || 0); + // const aDiscount = new BigNumber(a.discountAmount || 0); + // const bDiscount = new BigNumber(b.discountAmount || 0); - // 先比满金额:越小越优先(满1减10 比 满100减20 更优) - if (!aFull.isEqualTo(bFull)) { - return aFull.comparedTo(bFull) || 0; // Ensure a number is always returned - } - // 再比减免金额:越大越优先 - return bDiscount.comparedTo(aDiscount) || 0; // Ensure a number is always returned - })[0]; + // // 先比满金额:越小越优先(满1减10 比 满100减20 更优) + // if (!aFull.isEqualTo(bFull)) { + // return aFull.comparedTo(bFull) || 0; // Ensure a number is always returned + // } + // // 再比减免金额:越大越优先 + // return bDiscount.comparedTo(aDiscount) || 0; // Ensure a number is always returned + // }) + // 找到抵扣金额最大的门槛项 + const maxDiscountThreshold = validThresholds.reduce( + (maxItem, currentItem) => { + // 处理空值,默认抵扣金额为0 + const maxDiscount = new BigNumber(maxItem?.discountAmount || 0); + const currentDiscount = new BigNumber(currentItem?.discountAmount || 0); + + // 比较当前项和已存最大项的抵扣金额,保留更大的 + return currentDiscount.gt(maxDiscount) ? currentItem : maxItem; + }, + validThresholds[0] || null + ); // 初始值为数组第一项(若数组为空则返回null) + console.log("maxDiscountThreshold", maxDiscountThreshold); + return maxDiscountThreshold; } /** @@ -1016,6 +1024,7 @@ export function calcPointDeduction( deductionAmount: number; usedPoints: number; } { + console.log("calcPointDeduction", userPoints, rule, maxDeductionLimit); if (rule.pointsPerYuan <= 0 || userPoints <= 0) { return { deductionAmount: 0, usedPoints: 0 }; } @@ -1098,12 +1107,21 @@ export function calculateOrderCostSummary( currentTime ); + // 其他费用计算(原有逻辑不变) ------------------------------ + const packFee = calcTotalPackFee(goodsList, dinnerType); // 打包费 + let seatFee = calcSeatFee(config.seatFeeConfig); // 餐位费 + seatFee = dinnerType === "dine-in" ? seatFee : 0; // 外卖不收餐位费 + const additionalFee = Math.max(0, config.additionalFee); // 附加费 + // 2.2 计算满减基数(先扣新客立减) - const baseAfterNewUserDiscount = new BigNumber(goodsRealAmount) + let baseAfterNewUserDiscount = new BigNumber(goodsRealAmount) .minus(newUserDiscount) - .isGreaterThan(0) - ? new BigNumber(goodsRealAmount).minus(newUserDiscount).toNumber() - : 0; + .plus(packFee) + .plus(seatFee) + .plus(additionalFee) + .toNumber(); + baseAfterNewUserDiscount = + baseAfterNewUserDiscount > 0 ? baseAfterNewUserDiscount : 0; // 2.3 选择最优满减阈值(多门槛场景) if (usedFullReductionActivity) { @@ -1122,7 +1140,6 @@ export function calculateOrderCostSummary( usedFullReductionThreshold ); } - // ------------------------------ 3. 优惠券抵扣(适配满减同享规则) ------------------------------ let couponDeductionAmount = 0; let productCouponDeduction = 0; @@ -1144,7 +1161,6 @@ export function calculateOrderCostSummary( currentTime, } ); - console.log("优惠券计算结果", couponResult); couponDeductionAmount = couponResult.deductionAmount; productCouponDeduction = couponResult.productCouponDeduction; fullCouponDeduction = couponResult.fullCouponDeduction; @@ -1153,46 +1169,49 @@ export function calculateOrderCostSummary( // 若满减与优惠券同享(couponShare=1),才计算优惠券;否则优惠券抵扣为0 if (usedFullReductionActivity && !usedFullReductionActivity.couponShare) { - couponDeductionAmount=0; - productCouponDeduction=0; - fullCouponDeduction=0; - usedCoupon=undefined; - excludedProductIds=[]; + couponDeductionAmount = 0; + productCouponDeduction = 0; + fullCouponDeduction = 0; + usedCoupon = undefined; + excludedProductIds = []; } // ------------------------------ 4. 积分抵扣(适配满减同享规则) ------------------------------ let pointDeductionAmount = 0; let usedPoints = 0; - // 计算积分抵扣基数(商品折扣后 - 新客立减 - 满减 - 优惠券) - const maxPointDeductionLimit = new BigNumber(goodsRealAmount) + // 计算积分抵扣基数(商品折扣后 - 新客立减 - 满减 - 优惠券 + 餐位费 + 打包费 + 附加费) + let maxPointDeductionLimit = new BigNumber(goodsRealAmount) .minus(newUserDiscount) .minus(fullReductionAmount) .minus(couponDeductionAmount) - .isGreaterThan(0) - ? new BigNumber(goodsRealAmount) - .minus(newUserDiscount) - .minus(fullReductionAmount) - .minus(couponDeductionAmount) - .toNumber() - : 0; + .plus(seatFee) + .plus(packFee) + .plus(additionalFee) + .toNumber(); + maxPointDeductionLimit = + maxPointDeductionLimit > 0 ? maxPointDeductionLimit : 0; - // 若满减与积分同享(pointsShare=1),才计算积分;否则积分抵扣为0 - if ( - usedFullReductionActivity?.pointsShare === 1 && - maxPointDeductionLimit > 0 - ) { - const pointResult = calcPointDeduction( - config.userPoints, - config.pointDeductionRule, - maxPointDeductionLimit - ); - pointDeductionAmount = pointResult.deductionAmount; - usedPoints = pointResult.usedPoints; + + const pointResult = calcPointDeduction( + config.userPoints, + config.pointDeductionRule, + maxPointDeductionLimit + ); + console.log("积分抵扣结果:", pointResult); + + pointDeductionAmount = pointResult.deductionAmount; + usedPoints = pointResult.usedPoints; + // 若满减与积分不同享(pointsShare=1)积分抵扣为0 + if (usedFullReductionActivity && !usedFullReductionActivity.pointsShare) { + console.log("满减与积分不同享:积分抵扣为0"); + pointDeductionAmount = 0; + usedPoints = 0; } //使用霸王餐 if (isFreeDine && freeDineConfig && freeDineConfig.enable) { + console.log("使用霸王餐"); //不与优惠券同享 if (!freeDineConfig.withCoupon) { couponDeductionAmount = 0; @@ -1208,12 +1227,6 @@ export function calculateOrderCostSummary( } } - // ------------------------------ 5. 其他费用计算(原有逻辑不变) ------------------------------ - const packFee = calcTotalPackFee(goodsList, dinnerType); // 打包费 - let seatFee = calcSeatFee(config.seatFeeConfig); // 餐位费 - seatFee = dinnerType === "dine-in" ? seatFee : 0; // 外卖不收餐位费 - const additionalFee = Math.max(0, config.additionalFee); // 附加费 - // 商家减免计算(原有逻辑不变) const merchantReductionConfig = config.merchantReduction; let merchantReductionActualAmount = 0; @@ -1270,7 +1283,7 @@ export function calculateOrderCostSummary( truncateToTwoDecimals(finalPayAmountBn.toNumber()) ); // ------------------------------ 使用霸王餐计算 ------------------------------ -let orderOriginFinalPayAmount=finalPayAmount; + let orderOriginFinalPayAmount = finalPayAmount; if (isFreeDine && freeDineConfig && freeDineConfig.enable) { finalPayAmount = BigNumber(finalPayAmount) .times(freeDineConfig.rechargeTimes)