Parcourir la source

订单计算添加优惠券价格 和 支付价格

yuhongqi il y a 1 semaine
Parent
commit
a55720c522

+ 3 - 0
fs-service-system/src/main/java/com/fs/live/service/impl/LiveOrderServiceImpl.java

@@ -1493,6 +1493,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         BigDecimal payPrice = fsStoreProduct.getPrice().multiply(new BigDecimal(param.getTotalNum()));
         totalPrice = totalPrice.add(payPrice);
         BigDecimal payDelivery = BigDecimal.ZERO;
+        BigDecimal deductionPrice = BigDecimal.ZERO;
         if (param.getCityId() != null) {
             payDelivery = handleDeliveryMoney(param.getCityId(), fsStoreProduct, param.getTotalNum());
             payPrice = payPrice.add(payDelivery);
@@ -1503,6 +1504,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
             if(couponUser!=null&&couponUser.getStatus()==0){
                 if(couponUser.getUseMinPrice().compareTo(payPrice)==-1){
                     payPrice=payPrice.subtract(couponUser.getCouponPrice());
+                    deductionPrice = couponUser.getCouponPrice();
                 }
             }
         }
@@ -1510,6 +1512,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 
         return LiveOrderComputeDTO.builder().payPrice(payPrice)
                 .payDelivery(payDelivery)
+                .deductionPrice(deductionPrice)
                 .totalPrice(totalPrice)
                 .build();
     }