折扣券 除100

This commit is contained in:
wangw 2025-09-29 10:40:15 +08:00
parent 4f327a4517
commit aebf4abae3
1 changed files with 3 additions and 2 deletions

View File

@ -432,8 +432,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
}
thresholdCalculate(orderDetails, isAllFoods, couponFoodIds, coupon.getFullAmount());
if (type == 3) {
BigDecimal rate = new BigDecimal(record.getDiscountRate());
rateAmount.setPrice(rate.multiply(totalAmount.getPrice().subtract(tempAmount.getPrice()).subtract(prodCouponAmount.getPrice())).setScale(2, RoundingMode.DOWN));
BigDecimal rate = new BigDecimal(100 - record.getDiscountRate());
rateAmount.setPrice(rate.multiply(totalAmount.getPrice().subtract(tempAmount.getPrice()).subtract(prodCouponAmount.getPrice()))
.divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
if (coupon.getMaxDiscountAmount().compareTo(BigDecimal.ZERO) > 0 && rateAmount.getPrice().compareTo(coupon.getMaxDiscountAmount()) > 0) {
rateAmount.setPrice(coupon.getMaxDiscountAmount());
}