Browse Source

fix:三种支付方式来回切换 订单总金额变化

ct 1 week ago
parent
commit
43461eeea7

+ 9 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java

@@ -4666,13 +4666,22 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                 String config=configService.selectConfigByKey("his.store");
                 com.fs.store.config.StoreConfig storeConfig= JSONUtil.toBean(config, com.fs.store.config.StoreConfig.class);
                 if(param.getPayType().equals(1)){
+                    if (order.getPayPostage() != null && order.getPayPostage().compareTo(BigDecimal.ZERO) > 0) {
+                        order.setPayPrice(order.getPayPrice().subtract(order.getPayPostage()));
+                        order.setPayPostage(BigDecimal.ZERO);
+                    }
                     order.setPayType("1");
                     order.setPayMoney(order.getPayPrice());
                     order.setPayDelivery(BigDecimal.ZERO);
+
                 }
                 else if(param.getPayType().equals(2)){
                     // 物流代收
                     order.setPayType("2");
+                    if (order.getPayPostage() != null && order.getPayPostage().compareTo(BigDecimal.ZERO) > 0) {
+                        order.setPayPrice(order.getPayPrice().subtract(order.getPayPostage()));
+                        order.setPayPostage(BigDecimal.ZERO);
+                    }
                     BigDecimal payMoney=order.getPayPrice().multiply(new BigDecimal(storeConfig.getPayRate())).divide(new BigDecimal(100));
                     payMoney=new BigDecimal(payMoney.setScale(0, BigDecimal.ROUND_HALF_UP).longValue());
                     order.setPayDelivery(order.getPayPrice().subtract(payMoney));