Browse Source

Merge branch 'master' of wangchaoqun/kmall-haikong into master

王超群 3 years ago
parent
commit
45ad1e9617

+ 5 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/order/OrderController.java

@@ -610,18 +610,22 @@ public class OrderController {
             Map map = new HashMap();
             map.put("orderId", orderEntity.getId());
             List<OrderGoodsEntity> goodsList = orderGoodsService.queryList(map);
+            // 计算订单全部优惠 ,区分积分总抵扣金额 和其他优惠金额
 
+            BigDecimal allDiscountedPrice = new BigDecimal(0);
             for (OrderGoodsEntity orderGoodsEntity : goodsList) {
                 GoodsEntity goodsEntity = goodsService.queryObject(orderGoodsEntity.getGoodsId());
                 BigDecimal goodsTax = CalculateTax.calculateFinalTax(goodsEntity,orderGoodsEntity.getMarketPrice(),goodsService).setScale(3,RoundingMode.HALF_UP);
                 goodsTax = goodsTax.multiply(new BigDecimal(orderGoodsEntity.getNumber())).setScale(2,RoundingMode.HALF_UP);
                 orderGoodsEntity.setTax(goodsTax);
                 tax = tax.add(goodsTax).setScale(2,RoundingMode.HALF_UP);
-
 //                BigDecimal goodsTax = orderGoodsEntity.getMarketPrice().divide(new BigDecimal(1).add(orderGoodsEntity.getGoodsRate()),2,RoundingMode.HALF_DOWN).multiply(orderGoodsEntity.getGoodsRate())
 //                        .multiply(new BigDecimal(orderGoodsEntity.getNumber())).setScale(2,RoundingMode.HALF_DOWN);
 //                tax = tax.add(goodsTax).setScale(2,RoundingMode.HALF_UP);
+                allDiscountedPrice = allDiscountedPrice.add(orderGoodsEntity.getDiscountedPrice());
             }
+            BigDecimal otherDiscountPrice = allDiscountedPrice.subtract(orderEntity.getIntegralMoney());
+            orderEntity.setOtherDiscountedPrice(otherDiscountPrice);
             orderEntity.setTax(tax);
         }
 

+ 10 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/OrderEntity.java

@@ -73,6 +73,8 @@ public class OrderEntity implements Serializable {
     private Integer integral;
     // 积分抵扣金额
     private BigDecimal integralMoney;
+    // 其他优惠金额
+    private BigDecimal otherDiscountedPrice;
     //订单总价
     private BigDecimal orderPrice;
     //商品总价
@@ -219,6 +221,14 @@ public class OrderEntity implements Serializable {
      */
     private String memberCode;
 
+    public BigDecimal getOtherDiscountedPrice() {
+        return otherDiscountedPrice;
+    }
+
+    public void setOtherDiscountedPrice(BigDecimal otherDiscountedPrice) {
+        this.otherDiscountedPrice = otherDiscountedPrice;
+    }
+
     public String getMemberCode() {
         return memberCode;
     }

+ 1 - 0
kmall-admin/src/main/webapp/js/shop/offilineOrderList.js

@@ -136,6 +136,7 @@ $(function () {
                     return value;
                 }},
             {label: '积分抵扣金额', name: 'integralMoney', index: 'integral_money', align: 'center',width: 80},
+            {label: '其他优惠金额', name: 'otherDiscountedPrice', index: 'other_discounted_price', align: 'center',width: 80},
             {label: '实际支付', name: 'actualPrice', index: 'actual_price', align: 'center',width: 80},
             {label: '预计税额', name: 'tax', index: 'tax', align: 'center',width: 80},
             {label: '订单总价', name: 'orderPrice', index: 'order_price',align: 'center', width: 80},