Browse Source

fix:验收单与结算单保留位数修改

jiand 3 months ago
parent
commit
95cd5a5c49

+ 3 - 3
src/views/myTrade/acceptanceManagement/acceptanceAdd.vue

@@ -377,8 +377,8 @@ export default {
           item.acceptanceDate = item.acceptanceDate.split(' ')[0]
         })
 
-        this.countTotal = num ? Math.round(num * 100) / 100 : 0
-        this.priceTotal = price ? Math.round(price * 100) / 100 : 0
+        this.countTotal = num ? num.toFixed(4) : 0
+        this.priceTotal = price ? price.toFixed(2) : 0
       },
       immediate: true,
       deep: true
@@ -702,7 +702,7 @@ export default {
     countGoods() {
       let num = 0
       this.goodsInfoList.forEach(item => {
-        num = parseFloat(num + item.goodsQuantity).toFixed(2)
+        num = parseFloat(num + item.goodsQuantity).toFixed(4)
       })
       let price = 0
       this.goodsInfoList.forEach(item => {

+ 2 - 2
src/views/myTrade/acceptanceManagement/acceptanceViewTemp.vue

@@ -276,8 +276,8 @@ export default {
           item.acceptanceDate = item.acceptanceDate.split(' ')[0]
         })
 
-        this.countTotal = num ? Math.round(num * 100) / 100 : 0
-        this.priceTotal = price ? Math.round(price * 100) / 100 : 0
+        this.countTotal = num ? num.toFixed(4) : 0
+        this.priceTotal = price ? price.toFixed(2) : 0
       },
       immediate: true,
       deep: true

+ 2 - 2
src/views/myTrade/acceptanceManagement/changePrice.vue

@@ -222,8 +222,8 @@ export default {
           item.acceptanceDate = item.acceptanceDate.split(' ')[0]
         })
 
-        this.countTotal = num ? Math.round(num * 100) / 100 : 0
-        this.priceTotal = price ? Math.round(price * 100) / 100 : 0
+        this.countTotal = num ? num.toFixed(4) : 0
+        this.priceTotal = price ? price.toFixed(2) : 0
       },
       immediate: true,
       deep: true

+ 6 - 6
src/views/myTrade/settlementDocumentManagement/add.vue

@@ -258,7 +258,7 @@
 <script>
 import request from '@/utils/request'
 import chooseGoodsVue from './components/chooseGoods.vue'
-import { handleMoney } from '@/utils'
+import { handleMoney, fourMoney } from '@/utils'
 
 export default {
   name: 'AddSettlement',
@@ -524,13 +524,13 @@ export default {
     calculateTotal() {
       let num = 0, price = 0, buyPrice = 0;
       this.ruleForm.goodsList.forEach(item => {
-        num = parseFloat(Number(num) + Number(item.goodsQuantity || 0)).toFixed(2)
-        price = parseFloat(Number(price) + Number(item.salesTotalPrice || 0)).toFixed(2)
+        num = parseFloat(Number(num) + Number(item.goodsQuantity || 0)).toFixed(4)
+        price = parseFloat(Number(price) + (Number(item.goodsQuantity || 0) * Number(item.salesPrice || 0))).toFixed(4)
         buyPrice = parseFloat(Number(buyPrice) + Number(item.purchaseTotalPrice || 0)).toFixed(2)
       })
       this.ruleForm.countTheGoods = num
-      this.ruleForm.settleTotalSalesPrice = price
-      this.ruleForm.settlementAmount = price
+      this.ruleForm.settleTotalSalesPrice = parseFloat(price).toFixed(2)
+      this.ruleForm.settlementAmount = parseFloat(price).toFixed(2)
       this.buyTotalPrice = buyPrice
     },
     confirmRepay() {
@@ -757,7 +757,7 @@ export default {
   },
   computed: {
     changeNum1() {
-      return handleMoney(this.ruleForm.countTheGoods)
+      return fourMoney(this.ruleForm.countTheGoods)
     },
     changeNum2() {
       return handleMoney(this.ruleForm.settleTotalSalesPrice)

+ 1 - 1
src/views/myTrade/settlementDocumentManagement/components/chooseGoods.vue

@@ -65,7 +65,7 @@ export default {
         this.isLoading = false
         this.list = rows ? rows.map(item => {
           item.goodsTotalNum = item.acceptanceGoodInfos.reduce((t, i) => {
-            t = parseFloat(Number(t) + Number(i.goodsQuantity)).toFixed(2)
+            t = parseFloat(Number(t) + Number(i.goodsQuantity)).toFixed(4)
             return t
           }, 0)
           return item

+ 6 - 6
src/views/myTrade/settlementDocumentManagement/editPrice.vue

@@ -153,7 +153,7 @@
 
 <script>
 import request from '@/utils/request'
-import { handleMoney } from '@/utils'
+import { handleMoney, fourMoney } from '@/utils'
 import { exportFile } from '@/utils/index'
 
 export default {
@@ -211,13 +211,13 @@ export default {
     calculateTotal() {
       let num = 0, price = 0, buyPrice = 0;
       this.ruleForm.goodsList.forEach(item => {
-        num = parseFloat(Number(num) + Number(item.goodsQuantity || 0)).toFixed(2)
-        price = parseFloat(Number(price) + Number(item.salesTotalPrice || 0)).toFixed(2)
+        num = parseFloat(Number(num) + Number(item.goodsQuantity || 0)).toFixed(4)
+        price = parseFloat(Number(price) + (Number(item.goodsQuantity || 0) * Number(item.salesPrice || 0))).toFixed(4)
         buyPrice = parseFloat(Number(buyPrice) + Number(item.purchaseTotalPrice || 0)).toFixed(2)
       })
       this.ruleForm.countTheGoods = num
-      this.ruleForm.settleTotalSalesPrice = price
-      this.ruleForm.settlementAmount = price
+      this.ruleForm.settleTotalSalesPrice = parseFloat(price).toFixed(2)
+      this.ruleForm.settlementAmount = parseFloat(price).toFixed(2)
       this.buyTotalPrice = buyPrice
     },
     getBusinessDetail() {
@@ -332,7 +332,7 @@ export default {
   },
   computed: {
     changeNum1() {
-      return handleMoney(this.ruleForm.countTheGoods)
+      return fourMoney(this.ruleForm.countTheGoods)
     },
     changeNum2() {
       return handleMoney(this.ruleForm.settleTotalSalesPrice)