采用最新结算函数优化代客下单

This commit is contained in:
gyq
2025-11-14 18:14:27 +08:00
parent bec6bd6668
commit 7c7fc3ef0f
13 changed files with 369 additions and 17189 deletions

View File

@@ -438,23 +438,30 @@ async function payTypeChange(index, item) {
// 更新支付参数
function upadatePayData() {
// console.log(goodsStore.cartInfo);
payData.value.checkOrderPay = {
vipPrice: store.shopInfo.isMemberPrice ? goodsStore.showVipPrice : 0,
orderId: goodsStore.orderListInfo.id,
vipPrice: store.shopInfo.isMemberPrice ? goodsStore.showVipPrice : 0, // 是否使用会员价
allPack: goodsStore.allSelected, // 是否整单打包
// discountRatio: (checkOrderPay.discount / 100).toFixed(2),
discountRatio: 0,
seatNum: goodsStore.allSelected ? 0 : goodsStore.tableInfo.num,
originAmount: goodsStore.cartInfo.costSummary.goodsRealAmount,
discountAmount: discountRateNumber.value,
productCouponDiscountAmount: goodsStore.cartInfo.costSummary.productCouponDeduction,
otherCouponDiscountAmount: goodsStore.cartInfo.costSummary.fullCouponDeduction,
orderAmount: goodsStore.cartInfo.costSummary.finalPayAmount, // 最终订单金额
roundAmount: 0,
pointsDiscountAmount: goodsStore.cartInfo.costSummary.pointDeductionAmount, //积分抵扣金额
pointsNum: goodsStore.cartInfo.costSummary.pointUsed,
discountActAmount: goodsStore.cartInfo.costSummary.fullReduction.actualAmount, // 满减活动金额
discountActId: goodsStore.cartInfo.costSummary.fullReduction.usedThreshold !== undefined ? goodsStore.cartInfo.costSummary.fullReduction.usedThreshold.activityId : '', // 满减活动id
couponList: couponResList1.value.map(item => item.id),
userId: goodsStore.vipUserInfo.userId || '',
seatNum: goodsStore.allSelected ? 0 : goodsStore.tableInfo.num, // 用餐人数
originAmount: formatDecimal(goodsStore.cartInfo.costSummary.goodsRealAmount), // 订单原金额(包含打包费+餐位费) 不含折扣价格
discountRatio: 1, // 折扣比例(计算时 向上取整保留 两位小数)
discountAmount: discountRateNumber.value, // 手动优惠金额
productCouponDiscountAmount: goodsStore.cartInfo.costSummary.productCouponDeduction, //商品优惠券抵扣金额
otherCouponDiscountAmount: goodsStore.cartInfo.costSummary.fullCouponDeduction, //其他优惠券抵扣金额
couponList: couponResList1.value.map(item => item.id), // 用户使用的卡券
orderAmount: goodsStore.cartInfo.costSummary.finalPayAmount, // 订单金额
roundAmount: 0, // 抹零金额 减免多少钱
pointsDiscountAmount: goodsStore.cartInfo.costSummary.pointDeductionAmount, // 积分抵扣金额(tb_points_basic_setting表)
pointsNum: goodsStore.cartInfo.costSummary.pointUsed, // 使用的积分数量 (扣除各类折扣 enable_deduction后使用)
isPrint: 1
allPack: goodsStore.allSelected,
limitRate: goodsStore.limitDiscountRes,
newCustomerDiscountId: goodsStore.newCustomerDiscount !== null ? goodsStore.newCustomerDiscount.id : '', // 新客立减Id
newCustomerDiscountAmount: goodsStore.newCustomerDiscount !== null ? goodsStore.newCustomerDiscount.amount : 0, // 新客立减金额
vipDiscountAmount: goodsStore.cartInfo.costSummary.vipDiscountAmount, // 超级会员折扣
}
}