From 4a0a46b0b476f427c2464a30cb72482c79c577c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Thu, 21 Nov 2024 14:50:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8A=98=E6=89=A3=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E5=90=8C=E6=97=B6=E4=BD=BF=E7=94=A8detail=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E4=B8=8D=E5=87=86=E7=A1=AE=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/pojo/order/TbCashierCart.java | 18 ++++++++++++++++++ .../impl/shopimpl/TbShopTableServiceImpl.java | 2 ++ 2 files changed, 20 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbCashierCart.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbCashierCart.java index 9bbd0a1d..80b0b88b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbCashierCart.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbCashierCart.java @@ -194,6 +194,24 @@ public class TbCashierCart implements Serializable { } } + /** + * 根据是否会员充值价格 + */ + public void resetTotalAmount(BigDecimal discountRadio) { + if ("false".equals(isPack)) { + packFee = BigDecimal.ZERO; + } + if ("true".equals(isGift)) { + totalAmount = packFee; + } else { + if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) { + totalAmount = totalNumber.multiply(memberPrice).add(packFee).multiply(discountRadio); + } else { + totalAmount = totalNumber.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice).add(packFee).multiply(discountRadio); + } + } + } + /** * 获取总价不包含打包费 * diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 5e0386fb..47c4d496 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1372,6 +1372,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { resetCouponList.add(cashierCart); cashierCart.setUserCouponId(null); } + cashierCart.resetTotalAmount(orderInfo.getDiscountRatio()); discountAmount = reduceProCoupon(couponMap, cashierCart, usedCouponMap, discountAmount, balanceCartList, outRecords, memberId); } @@ -2196,6 +2197,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { BigDecimal finalAmount = orderInfo.getOrderAmount().multiply(BigDecimal.valueOf(payDTO.getDiscount())).setScale(2, RoundingMode.HALF_UP); BigDecimal discountAmount = oldAmount.subtract(finalAmount); orderInfo.setDiscountAmount(discountAmount); + orderInfo.setDiscountRatio(BigDecimal.valueOf(payDTO.getDiscount())); orderInfo.setOrderAmount(finalAmount); orderInfo.setAmount(finalAmount); orderInfo.setSettlementAmount(finalAmount);