Commit 7ef329f57ad25f7f8f35aa4ec073044db395f7ef
1 parent
7231042d
【功能】添加满送包邮功能
Showing
3 changed files
with
8 additions
and
3 deletions
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/bo/TradePriceCalculateRespBO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeDeliveryPriceCalculator.java
| @@ -121,10 +121,12 @@ public class TradeDeliveryPriceCalculator implements TradePriceCalculator { | @@ -121,10 +121,12 @@ public class TradeDeliveryPriceCalculator implements TradePriceCalculator { | ||
| 121 | * @return 是否包邮 | 121 | * @return 是否包邮 |
| 122 | */ | 122 | */ |
| 123 | private boolean isGlobalExpressFree(TradePriceCalculateRespBO result) { | 123 | private boolean isGlobalExpressFree(TradePriceCalculateRespBO result) { |
| 124 | + | ||
| 124 | TradeConfigDO config = tradeConfigService.getTradeConfig(); | 125 | TradeConfigDO config = tradeConfigService.getTradeConfig(); |
| 125 | - return config != null | ||
| 126 | - && Boolean.TRUE.equals(config.getDeliveryExpressFreeEnabled()) // 开启包邮 | ||
| 127 | - && result.getPrice().getPayPrice() >= config.getDeliveryExpressFreePrice(); // 满足包邮的价格 | 126 | + return config == null |
| 127 | + || Boolean.TRUE.equals(config.getDeliveryExpressFreeEnabled()) // 开启包邮 | ||
| 128 | + || result.getFreeDelivery() //满减包邮 | ||
| 129 | + || result.getPrice().getPayPrice() >= config.getDeliveryExpressFreePrice(); // 满足包邮的价格 | ||
| 128 | } | 130 | } |
| 129 | 131 | ||
| 130 | private void calculateDeliveryPrice(List<OrderItem> selectedSkus, | 132 | private void calculateDeliveryPrice(List<OrderItem> selectedSkus, |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeRewardActivityPriceCalculator.java
| @@ -81,6 +81,8 @@ public class TradeRewardActivityPriceCalculator implements TradePriceCalculator | @@ -81,6 +81,8 @@ public class TradeRewardActivityPriceCalculator implements TradePriceCalculator | ||
| 81 | Integer newDiscountPrice = rule.getDiscountPrice(); | 81 | Integer newDiscountPrice = rule.getDiscountPrice(); |
| 82 | // 2.2 计算分摊的优惠金额 | 82 | // 2.2 计算分摊的优惠金额 |
| 83 | List<Integer> divideDiscountPrices = TradePriceCalculatorHelper.dividePrice(orderItems, newDiscountPrice); | 83 | List<Integer> divideDiscountPrices = TradePriceCalculatorHelper.dividePrice(orderItems, newDiscountPrice); |
| 84 | + //计算是否包邮 | ||
| 85 | + result.setFreeDelivery(rule.getFreeDelivery()); | ||
| 84 | 86 | ||
| 85 | // 3.1 记录使用的优惠劵 | 87 | // 3.1 记录使用的优惠劵 |
| 86 | result.setCouponId(param.getCouponId()); | 88 | result.setCouponId(param.getCouponId()); |