Ver código fonte

Merge remote-tracking branch 'remotes/origin/developer' into developerA

Aslee 3 anos atrás
pai
commit
73bc2ed6be

+ 6 - 2
src/main/java/com/caimei365/order/service/impl/SubmitServiceImpl.java

@@ -658,7 +658,11 @@ public class SubmitServiceImpl implements SubmitService {
                 // 判断是否选中比例成本价
                 if (null != product.getCostProportional() && 2 == product.getCostCheckFlag() && product.getCostProportional() > 0d) {
                     // 通过售价*比例得到成本价
-                    costPrice = MathUtil.div(MathUtil.mul(product.getPrice(), product.getCostProportional()), 100).doubleValue();
+                    double discountTax = 0d;
+                    if (taxFlag) {
+                        discountTax = MathUtil.div(MathUtil.mul(product.getDiscountPrice(), product.getTaxRate()), 100, 2).doubleValue();
+                    }
+                    costPrice = MathUtil.div(MathUtil.mul(MathUtil.add(product.getDiscountPrice(), discountTax), product.getCostProportional()), 100).doubleValue();
                 }
                 if (null == costPrice) {
                     return ResponseJson.error("订单商品成本异常!", null);
@@ -669,7 +673,7 @@ public class SubmitServiceImpl implements SubmitService {
                     product.setShopTaxRate(product.getTaxRate());
                 }
                 if (taxFlag) {
-                    shopTax = MathUtil.div(MathUtil.mul(costPrice, product.getTaxRate()), 100, 2).doubleValue();
+                    shopTax = MathUtil.div(MathUtil.mul(costPrice, product.getShopTaxRate()), 100, 2).doubleValue();
                 } else if (!Integer.valueOf(1).equals(product.getIncludedTax())) {
                     // 不含税不可开票商品和未知商品,税率置为0
                     product.setShopTaxRate(0d);