Sfoglia il codice sorgente

change: indent计价.表单3格式化两位小数.

peter 1 settimana fa
parent
commit
25a587ccaa
1 ha cambiato i file con 29 aggiunte e 14 eliminazioni
  1. 29 14
      src/pages/indent-manage/indent/components/calcPrice/index.vue

+ 29 - 14
src/pages/indent-manage/indent/components/calcPrice/index.vue

@@ -260,10 +260,10 @@
                 <div class="flex items-center tr">
                   <div class="td column-label">运费总成本(AUD)</div>
                   <div class="td">
-                    {{ form.freight_cost.toFixed(2) }}
+                    {{ Number(form.freight_cost).toFixed(2) }}
                   </div>
                   <div class="td">
-                    {{ (form.freight_cost / form.number).toFixed(2) }}
+                    {{ (Number(form.freight_cost) / form.number).toFixed(2) }}
                   </div>
                 </div>
 
@@ -300,10 +300,10 @@
                 <div class="flex items-center tr">
                   <div class="td column-label">总成本(AUD)</div>
                   <div class="td">
-                    {{ form.total_cost.toFixed(2) }}
+                    {{ Number(form.total_cost).toFixed(2) }}
                   </div>
                   <div class="td">
-                    {{ (form.total_cost / form.number).toFixed(2) }}
+                    {{ (Number(form.total_cost) / form.number).toFixed(2) }}
                   </div>
                 </div>
               </div>
@@ -1119,9 +1119,11 @@ let generateStep3Form = (withOldData = false) => {
         })
 
         if (n <= 2) {
-          temp.cn_freight_cost = savePrecision(i[`cn_price_${n}`])
-          temp.local_freight_cost = savePrecision(i[`city_price_${n}`])
-          temp.add_freight_cost = savePrecision(i[`city_price_${n}`])
+          temp.cn_freight_cost = savePrecision(i[`cn_price_${n}`]).toFixed(2)
+          temp.local_freight_cost = savePrecision(i[`city_price_${n}`]).toFixed(
+            2,
+          )
+          temp.add_freight_cost = savePrecision(i[`city_price_${n}`]).toFixed(2)
           // 记录中途运费, 用在step3表单项变更后的重复计算
           temp.midway_price = i[`midway_price_${n}`]
           temp.freight_cost = mathjs
@@ -1134,6 +1136,7 @@ let generateStep3Form = (withOldData = false) => {
                 .done(),
             )
             .done()
+            .toFixed(2)
           // 用demo默认值是重新计算的数据. 如果是初始化时需要用保存到数据库的数据覆盖掉这个.
           temp.total_cost = mathjs
             .chain(i.product_cost)
@@ -1155,6 +1158,7 @@ let generateStep3Form = (withOldData = false) => {
                 : step3FormDemo.value.review_cost,
             )
             .done()
+            .toFixed(2)
         } else if (n === 3) {
           temp.local_freight_cost = 0
           temp.add_freight_cost = 0
@@ -1163,6 +1167,7 @@ let generateStep3Form = (withOldData = false) => {
             .chain(i[`freight_cost_${n}`])
             .add(i[`city_price_${n}`])
             .done()
+            .toFixed(2)
           temp.freight_cost = mathjs
             .chain(temp.midway_price)
             .add(
@@ -1172,6 +1177,7 @@ let generateStep3Form = (withOldData = false) => {
                 .done(),
             )
             .done()
+            .toFixed(2)
 
           temp.total_cost = mathjs
             .chain(i.product_cost)
@@ -1199,6 +1205,7 @@ let generateStep3Form = (withOldData = false) => {
                 : step3FormDemo.value.review_cost,
             )
             .done()
+            .toFixed(2)
 
           temp[`cn_price_${n}`] = 0 // 国内运费. 后两种配送方式默认是0
         } else if (n === 4) {
@@ -1211,6 +1218,7 @@ let generateStep3Form = (withOldData = false) => {
             .chain(i[`freight_cost_${n}`])
             .add(i[`city_price_${n}`])
             .done()
+            .toFixed(2)
           temp.freight_cost = mathjs
             .chain(temp.midway_price)
             .add(
@@ -1220,6 +1228,7 @@ let generateStep3Form = (withOldData = false) => {
                 .done(),
             )
             .done()
+            .toFixed(2)
           // total_lcl 运费总成本
           // price 国内总运费
           temp.total_cost = mathjs
@@ -1248,6 +1257,7 @@ let generateStep3Form = (withOldData = false) => {
                 : step3FormDemo.value.review_cost,
             )
             .done()
+            .toFixed(2)
 
           temp[`cn_price_${n}`] = 0 // 国内运费. 后两种配送方式默认是0
         }
@@ -1263,7 +1273,7 @@ let generateStep3Form = (withOldData = false) => {
             .divide(100)
             .multiply(temp.total_cost)
             .done(),
-        )
+        ).toFixed(2)
         temp.sold_price = savePrecision(
           mathjs
             .chain(temp.total_cost)
@@ -1279,7 +1289,7 @@ let generateStep3Form = (withOldData = false) => {
                 .done(),
             )
             .done(),
-        )
+        ).toFixed(2)
         temp.sold_unit = mathjs
           .chain(
             Math.ceil(
@@ -1300,6 +1310,7 @@ let generateStep3Form = (withOldData = false) => {
           )
           .divide(100)
           .done()
+          .toFixed(2)
 
         exportForm.value[`zdy_date_${n}_${i.number}`] = ''
         exportForm.value[`cycle_name_${n}_${i.number}`] = 'weeks'
@@ -1484,17 +1495,17 @@ let changeCOO = (form: any, value: any) => {
 let calcTaxFee = (form: any) => {
   form.tax_fee = savePrecision(
     mathjs.chain(form.product_cost).multiply(form.tax).divide(100).done(),
-  )
+  ).toFixed(2)
 }
 let calcProfit = (form: any) => {
   form.profit = savePrecision(
     mathjs.chain(form.sold_price).subtract(form.total_cost).done(),
-  )
+  ).toFixed(2)
 }
 let calcProfitMargin = (form: any) => {
   form.profit_margin = savePrecision(
     mathjs.chain(form.profit).divide(form.total_cost).multiply(100).done(),
-  )
+  ).toFixed(2)
 }
 let calcTotalCost = (form: any) => {
   form.total_cost = mathjs
@@ -1511,6 +1522,7 @@ let calcTotalCost = (form: any) => {
     .add(form.gatt_tax_fee)
     .add(form.review_cost)
     .done()
+    .toFixed(2)
 }
 /**
  * 用利润率计算售价总价
@@ -1521,7 +1533,7 @@ let calcSoldPriceByProfitMargin = (form: any) => {
       .chain(form.total_cost)
       .multiply(mathjs.chain(form.profit_margin).add(100).divide(100).done())
       .done(),
-  )
+  ).toFixed(2)
 }
 /**
  * 用单价计算售价总价. 单价*数量 + setup cost + add freight cost
@@ -1534,7 +1546,7 @@ let calcSoldPriceBySoldUnit = (form: any) => {
       .add(form.setup_cost)
       .add(form.add_freight_cost)
       .done(),
-  )
+  ).toFixed(2)
 }
 let onForm3ItemChange = (form: any, key: string) => {
   let dotFlag = false
@@ -1573,6 +1585,7 @@ let onForm3ItemChange = (form: any, key: string) => {
             .done(),
         )
         .done()
+        .toFixed(2)
       calcTotalCost(form)
       calcProfit(form)
       calcProfitMargin(form)
@@ -1590,6 +1603,7 @@ let onForm3ItemChange = (form: any, key: string) => {
             .done(),
         )
         .done()
+        .toFixed(2)
       calcTotalCost(form)
       calcProfitMargin(form)
       calcSoldPriceByProfitMargin(form)
@@ -1628,6 +1642,7 @@ let onForm3ItemChange = (form: any, key: string) => {
         )
         .divide(100)
         .done()
+        .toFixed(2)
       break
     case 'gatt_tax_fee':
       calcTotalCost(form)