Преглед на файлове

fix: indent计价逻辑修正.

peter преди 6 дни
родител
ревизия
1d09055928
променени са 1 файла, в които са добавени 19 реда и са изтрити 9 реда
  1. 19 9
      src/pages/indent-manage/indent/components/calcPrice/index.vue

+ 19 - 9
src/pages/indent-manage/indent/components/calcPrice/index.vue

@@ -1139,12 +1139,8 @@ let generateStep3Form = (p = {}) => {
         })
 
         if (n <= 2) {
-          temp.cn_freight_cost = savePrecision(
-            mathjs
-              .chain(i[`cn_price_${n}`])
-              .multiply(setting.value.rate_rmb_aud)
-              .done(),
-          )
+          console.log(i, 'i')
+          temp.cn_freight_cost = savePrecision(i[`cn_price_${n}`]) // 这个是人民币
 
           temp.local_freight_cost = savePrecision(i[`city_price_${n}`]).toFixed(
             2,
@@ -1155,7 +1151,13 @@ let generateStep3Form = (p = {}) => {
           temp.freight_cost = mathjs
             .chain(i[`midway_price_${n}`])
             .add(i[`city_price_${n}`])
-            .add(i[`cn_price_${n}`])
+            .add(
+              mathjs
+                .chain(i[`cn_price_${n}`])
+                .divide(setting.value.rate_rmb_aud)
+                .done(),
+            )
+
             .done()
             .toFixed(2)
           // 用demo默认值是重新计算的数据. 如果是初始化时需要用保存到数据库的数据覆盖掉这个.
@@ -1542,9 +1544,15 @@ let calcTaxFee = (form: any) => {
     mathjs.chain(form.product_cost).multiply(form.tax).divide(100).done(),
   ).toFixed(2)
 }
+// 利润 = 售卖总价 - setup cost - add freight cost - 总成本
 let calcProfit = (form: any) => {
   form.profit = savePrecision(
-    mathjs.chain(form.sold_price).subtract(form.total_cost).done(),
+    mathjs
+      .chain(form.sold_price)
+      .subtract(form.setup_cost)
+      .subtract(form.add_freight_cost)
+      .subtract(form.total_cost)
+      .done(),
   ).toFixed(2)
 }
 let calcProfitMargin = (form: any) => {
@@ -1570,13 +1578,15 @@ let calcTotalCost = (form: any) => {
     .toFixed(2)
 }
 /**
- * 用利润率计算售价总价
+ * 用利润率计算售价总价. 总成本 * (利润率 + 100) / 100 + setup cost + add freight cost
  **/
 let calcSoldPriceByProfitMargin = (form: any) => {
   form.sold_price = savePrecision(
     mathjs
       .chain(form.total_cost)
       .multiply(mathjs.chain(form.profit_margin).add(100).divide(100).done())
+      .add(form.setup_cost)
+      .add(form.add_freight_cost)
       .done(),
   ).toFixed(2)
 }