chenjiahe
2024-08-01 e53947d1a6501238febe93f14d4dbe155cb6479b
订单折扣-卡项子单
1个文件已修改
26 ■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/util/api/OrderCreateUtil.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/util/api/OrderCreateUtil.java
@@ -708,7 +708,7 @@
        //计算订单金额信息
        //一级子订单:售价=商品售价*购买数量*折扣
        BigDecimal actualTotal = consumables.getPrice().multiply(vo.getDiscount().divide(new BigDecimal(100)));
        BigDecimal actualTotal;
        if(vo.getDiscountAlgorithm() == OrderItemConstants.DISCOUNT_ALGORITHM_TOTAL){
            actualTotal = consumables.getPrice();
@@ -1069,7 +1069,12 @@
        //计算订单卡项金额信息
        //一级子订单:售价=卡项售价*折扣
        BigDecimal actualTotal = cardItem.getTotal().multiply(vo.getDiscount().divide(new BigDecimal(100))).setScale(2,RoundingMode.HALF_UP);
        BigDecimal actualTotal;
        if(vo.getDiscountAlgorithm() == OrderItemConstants.DISCOUNT_ALGORITHM_TOTAL){
            actualTotal = cardItem.getTotal();
        }else{
            actualTotal = cardItem.getTotal().multiply(vo.getDiscount().divide(new BigDecimal(100),15,RoundingMode.HALF_UP)).setScale(2,RoundingMode.HALF_UP);
        }
        //总订单:订单优惠金额=商品的售价*数量 减去 一级子订单售价*购买数量;
        discountTotal=discountTotal.add(cardItem.getTotal().multiply(buyNum).subtract(actualTotal.multiply(buyNum)));
@@ -1081,8 +1086,21 @@
        vo.setProPrice(cardItem.getTotal());
        //设置一级子订单售价
        vo.setCurPrice(actualTotal);
        //设置一级子订单优惠前小计,优惠前小计=售价* 商品数量
        vo.setTotal(vo.getCurPrice().multiply(buyNum));
        if(vo.getDiscountAlgorithm() == OrderItemConstants.DISCOUNT_ALGORITHM_TOTAL){
            //设置优惠前小计,优惠前小计=售价* 商品数量
            vo.setTotal(vo.getCurPrice().multiply(buyNum));
            vo.setTotal(vo.getTotal().multiply(vo.getDiscount().divide(new BigDecimal(100),15,RoundingMode.HALF_UP)).setScale(2,RoundingMode.HALF_UP));
            vo.setDiscountMoney(vo.getTotal().divide(buyNum,4,RoundingMode.HALF_UP));
        }else{
            //设置优惠前小计,优惠前小计=售价* 商品数量
            vo.setTotal(vo.getCurPrice().multiply(buyNum));
            vo.setDiscountMoney(vo.getCurPrice());
        }
        //计算折扣金额
        vo.setDiscountOrderPrice(vo.getProPrice().multiply(BigDecimal.valueOf(vo.getBuyNum()).setScale(2,RoundingMode.HALF_UP)).subtract(vo.getTotal()));
        //折扣金额汇总
        discountTotal=discountTotal.add(vo.getDiscountOrderPrice()).setScale(2,RoundingMode.HALF_UP);
        //设置一级子订单优惠券抵扣金额,开单不知道是否使用优惠券,默认为0
        vo.setCouponTotal(BigDecimal.ZERO);
        //优惠福利总金额