mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-18 20:21:52 +08:00
【功能优化】商城:价格计算时,增加“该优惠劵无法使用,原因:优惠金额超过订单金额”提示
This commit is contained in:
@@ -268,11 +268,6 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 校验分佣模式:仅可后台手动设置推广员
|
||||
// if (BrokerageEnabledConditionEnum.ADMIN.getCondition().equals(tradeConfig.getBrokerageEnabledCondition())) {
|
||||
// throw exception(BROKERAGE_BIND_CONDITION_ADMIN);
|
||||
// }
|
||||
|
||||
// 校验分销关系绑定模式
|
||||
if (BrokerageBindModeEnum.REGISTER.getMode().equals(tradeConfig.getBrokerageBindMode())) {
|
||||
// 判断是否为新用户:注册时间在 30 秒内的,都算新用户
|
||||
|
@@ -25,6 +25,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.COUPON_NO_MATCH_MIN_PRICE;
|
||||
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.COUPON_NO_MATCH_SPU;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.PRICE_CALCULATE_COUPON_NOT_MATCH_NORMAL_ORDER;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.PRICE_CALCULATE_COUPON_PRICE_TOO_MUCH;
|
||||
|
||||
/**
|
||||
* 优惠劵的 {@link TradePriceCalculator} 实现类
|
||||
@@ -65,8 +66,9 @@ public class TradeCouponPriceCalculator implements TradePriceCalculator {
|
||||
|
||||
// 3.1 计算可以优惠的金额
|
||||
Integer couponPrice = getCouponPrice(coupon, totalPayPrice);
|
||||
Assert.isTrue(couponPrice < totalPayPrice,
|
||||
"优惠劵({}) 的优惠金额({}),不能大于订单总金额({})", coupon.getId(), couponPrice, totalPayPrice);
|
||||
if (couponPrice <= totalPayPrice) {
|
||||
throw exception(PRICE_CALCULATE_COUPON_PRICE_TOO_MUCH);
|
||||
}
|
||||
// 3.2 计算分摊的优惠金额
|
||||
List<Integer> divideCouponPrices = TradePriceCalculatorHelper.dividePrice(orderItems, couponPrice);
|
||||
|
||||
|
Reference in New Issue
Block a user