【功能】添加满送包邮功能

This commit is contained in:
痴货 2024-09-14 20:01:34 +08:00
parent 7231042df4
commit 7ef329f57a
3 changed files with 8 additions and 3 deletions

View File

@ -68,6 +68,7 @@ public class TradePriceCalculateRespBO {
*/
private Long bargainActivityId;
/**
* 是否包邮
*/

View File

@ -121,10 +121,12 @@ public class TradeDeliveryPriceCalculator implements TradePriceCalculator {
* @return 是否包邮
*/
private boolean isGlobalExpressFree(TradePriceCalculateRespBO result) {
TradeConfigDO config = tradeConfigService.getTradeConfig();
return config != null
&& Boolean.TRUE.equals(config.getDeliveryExpressFreeEnabled()) // 开启包邮
&& result.getPrice().getPayPrice() >= config.getDeliveryExpressFreePrice(); // 满足包邮的价格
return config == null
|| Boolean.TRUE.equals(config.getDeliveryExpressFreeEnabled()) // 开启包邮
|| result.getFreeDelivery() //满减包邮
|| result.getPrice().getPayPrice() >= config.getDeliveryExpressFreePrice(); // 满足包邮的价格
}
private void calculateDeliveryPrice(List<OrderItem> selectedSkus,

View File

@ -81,6 +81,8 @@ public class TradeRewardActivityPriceCalculator implements TradePriceCalculator
Integer newDiscountPrice = rule.getDiscountPrice();
// 2.2 计算分摊的优惠金额
List<Integer> divideDiscountPrices = TradePriceCalculatorHelper.dividePrice(orderItems, newDiscountPrice);
//计算是否包邮
result.setFreeDelivery(rule.getFreeDelivery());
// 3.1 记录使用的优惠劵
result.setCouponId(param.getCouponId());