|
@@ -618,10 +618,41 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
boolean svipPriceFlag = null != svipProductPo && 1 == svipProductPo.getSvipProductFlag() && orderParamBo.getSvipUserFlag();
|
|
|
// 是否是促销赠品
|
|
|
if (productType == 2) {
|
|
|
+ // 促销赠品计算商品费
|
|
|
+ Double productPrice = product.getPrice();
|
|
|
+ Double discountPrice = product.getPrice();
|
|
|
+ // 商品税费
|
|
|
+ Double productTax = 0d;
|
|
|
+ Double discountTax = 0d;
|
|
|
+ if (taxFlag) {
|
|
|
+ productTax = MathUtil.div(MathUtil.mul(productPrice, product.getTaxRate()), 100, 2).doubleValue();
|
|
|
+ discountTax = MathUtil.div(MathUtil.mul(discountPrice, product.getTaxRate()), 100, 2).doubleValue();
|
|
|
+ } else if (!Integer.valueOf(1).equals(product.getIncludedTax())) {
|
|
|
+ // 不含税不可开票商品和未知商品,税率置为0
|
|
|
+ product.setTaxRate(0d);
|
|
|
+ }
|
|
|
+ log.info("促销赠品计算:productTax===" + productTax);
|
|
|
+ // 商品价格
|
|
|
+ if (Integer.valueOf(0).equals(product.getIncludedTax())) {
|
|
|
+ if (null != product.getTaxRate() && product.getTaxRate() > 0d) {
|
|
|
+ product.setPrice(MathUtil.add(productPrice, MathUtil.mul(productPrice, MathUtil.div(product.getTaxRate(), 100, 2))).doubleValue());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ product.setPrice(productPrice);
|
|
|
+ }
|
|
|
+ // 商品税后价格
|
|
|
+ Double productTaxPrice = MathUtil.add(productPrice, productTax).doubleValue();
|
|
|
+ // 折后税后单价
|
|
|
+ Double discountTaxPrice = MathUtil.add(discountPrice, discountTax).doubleValue();
|
|
|
+ // 单个商品的金额
|
|
|
+ Double productAmount = MathUtil.mul(productTaxPrice, productNum).doubleValue();
|
|
|
+ // 单个商品的金额
|
|
|
+ product.setTotalAmount(productAmount);
|
|
|
+ product.setPrice(productPrice);
|
|
|
+ // 折后单价
|
|
|
+ product.setDiscountPrice(discountTaxPrice);
|
|
|
// 促销赠品数+1
|
|
|
promotionalGiftsCount.incrementAndGet();
|
|
|
- product.setPrice(0d);
|
|
|
- product.setDiscountPrice(0d);
|
|
|
product.setDiscount(0d);
|
|
|
product.setTotalAmount(0d);
|
|
|
product.setTotalFee(0d);
|
|
@@ -873,6 +904,11 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
return ResponseJson.error("订单商品成本异常!", null);
|
|
|
}
|
|
|
product.setCostPrice(costPrice);
|
|
|
+ // 促销赠品 售价归 0
|
|
|
+ if (productType == 2) {
|
|
|
+ product.setPrice(0d);
|
|
|
+ product.setDiscountPrice(0d);
|
|
|
+ }
|
|
|
// 付供应商税费
|
|
|
if (null == product.getShopTaxRate() || product.getShopTaxRate() <= 0) {
|
|
|
product.setShopTaxRate(product.getTaxRate());
|