【功能修复】MALL:优惠劵的折扣计算不正确

This commit is contained in:
YunaiV 2024-07-28 20:01:54 +08:00
parent ad22a9d516
commit 3d9ec1966f

View File

@ -90,7 +90,7 @@ public class TradeCouponPriceCalculator implements TradePriceCalculator {
if (PromotionDiscountTypeEnum.PRICE.getType().equals(coupon.getDiscountType())) { // 减价
return coupon.getDiscountPrice();
} else if (PromotionDiscountTypeEnum.PERCENT.getType().equals(coupon.getDiscountType())) { // 打折
int couponPrice = totalPayPrice * coupon.getDiscountPercent() / 100;
int couponPrice = totalPayPrice - (totalPayPrice * coupon.getDiscountPercent() / 100);
return coupon.getDiscountLimitPrice() == null ? couponPrice
: Math.min(couponPrice, coupon.getDiscountLimitPrice()); // 优惠上限
}