| | |
| | | //一级子订单:售价=商品售价*购买数量*折扣 |
| | | BigDecimal actualTotal = consumables.getPrice().multiply(vo.getDiscount().divide(new BigDecimal(100))); |
| | | |
| | | //总订单:订单优惠金额=商品售价*购买数量 减去 一级子订单售价 |
| | | discountTotal=discountTotal.add(consumables.getPrice().multiply(buyNum).subtract(actualTotal.multiply(buyNum))); |
| | | if(vo.getDiscountAlgorithm() == OrderItemConstants.DISCOUNT_ALGORITHM_TOTAL){ |
| | | actualTotal = consumables.getPrice(); |
| | | }else{ |
| | | actualTotal = consumables.getPrice().multiply(vo.getDiscount().divide(new BigDecimal(100),15,RoundingMode.HALF_UP)).setScale(2,RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //一级子订单金额信息设值 |
| | | //设置原价,原价=商品的销售价格 |
| | |
| | | vo.setProPrice(consumables.getPrice()); |
| | | //设置售价, 售价=项目的销售价格*购买数量*折扣 |
| | | 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); |
| | | //优惠福利总金额 |