瀏覽代碼

fix:修改发票管理、结算单、验收单金额精度

lazy 3 周之前
父節點
當前提交
11bfbf542e

+ 9 - 9
src/views/mySettlement/invoicesManagement/components/ApplyInvoicingContent.vue

@@ -93,7 +93,7 @@
         <span>
           货物信息
           <span class="statistics">总金额合计: <span>{{ formatMoney(openAmountTotal) }}</span></span>
-          <span class="statistics">本次开票数量合计: <span>{{ fourMoney(openQuantityTotal) }}</span></span>
+          <span class="statistics">本次开票数量合计: <span>{{ formatMoney(openQuantityTotal) }}</span></span>
         </span>
         <template v-if="!disabled" slot="right">
           <div style="float:right" class="iconfont icon-Union-11 iconCharacters" @click="select('selectGoods')">选择已结算货物</div>
@@ -136,14 +136,14 @@
           <el-table-column prop="goodsQuantity" label="数量">
             <template slot-scope="scope">
               <el-tooltip class="item" effect="dark" :content="String(scope.row.goodsQuantity)" placement="top">
-                <span class="one-ellipsis">{{ fourMoney(scope.row.goodsQuantity) }}</span>
+                <span class="one-ellipsis">{{ scope.row.goodsQuantity }}</span>
               </el-tooltip>
             </template>
           </el-table-column>
           <el-table-column prop="salesPrice" label="销售单价">
             <template slot-scope="scope">
               <el-tooltip class="item" effect="dark" :content="String(scope.row.salesPrice)" placement="top">
-                <span class="one-ellipsis">{{ formatMoney(scope.row.salesPrice) }}</span>
+                <span class="one-ellipsis">{{ formatMoney(scope.row.salesPrice, 4) }}</span>
               </el-tooltip>
             </template>
           </el-table-column>
@@ -469,8 +469,8 @@ export default {
       }
     },
     formatMoney() {
-      return (val) => {
-        return formatMoney(val)
+      return (val, reserveNum) => {
+        return formatMoney(val, reserveNum)
       }
     },
     calcMoney() {
@@ -654,11 +654,11 @@ export default {
       this.goodsInfoList.forEach((item, index) => {
         sum += Number(item.openQuantity)
         item.openAmount = Number(item.openQuantity) * Number(item.salesPrice)
-        amount += Number(item.openAmount)
+        amount += item.openAmount
       })
-      this.openQuantityTotal = sum
-      this.openAmountTotal = amount
-      this.ruleForm.openAmount = formatMoney(amount)
+      this.openQuantityTotal = (sum * 10000 / 10000).toFixed(2)
+      this.openAmountTotal = (amount * 10000 / 10000).toFixed(2)
+      this.ruleForm.openAmount = (amount * 10000 / 10000).toFixed(2)
     },
     deleteInfoGoods(row, index) {
       this.goodsInfoList = this.goodsInfoList.filter(item => item.acceptanceGoodsNumber !== row.acceptanceGoodsNumber)

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

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

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

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

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

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

+ 2 - 2
src/views/myTrade/acceptanceManagement/components/historyViewContent/add.vue

@@ -277,8 +277,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 ? (Math.round(num * 10000) / 10000).toFixed(2) : 0
+        this.priceTotal = price ? (Math.round(price * 10000) / 10000).toFixed(2) : 0
       },
       immediate: true,
       deep: true

+ 2 - 2
src/views/myTrade/acceptanceManagement/components/historyViewContent/priceAdjust.vue

@@ -190,8 +190,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 ? (Math.round(num * 10000) / 10000).toFixed(2) : 0
+        this.priceTotal = price ? (Math.round(price * 10000) / 10000).toFixed(2) : 0
       },
       immediate: true,
       deep: true

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

@@ -535,14 +535,14 @@ export default {
     calculateTotal() {
       let num = 0, price = 0, buyPrice = 0;
       this.ruleForm.goodsList.forEach(item => {
-        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)
+        num = Number(num) + Number(item.goodsQuantity || 0)
+        price += Number(item.goodsQuantity || 0) * Number(item.salesPrice || 0)
+        buyPrice = Number(buyPrice) + Number(item.purchaseTotalPrice || 0)
       })
-      this.ruleForm.countTheGoods = num
-      this.ruleForm.settleTotalSalesPrice = parseFloat(price).toFixed(2)
-      this.ruleForm.settlementAmount = parseFloat(price).toFixed(2)
-      this.buyTotalPrice = buyPrice
+      this.ruleForm.countTheGoods = (num * 10000 / 10000).toFixed(2)
+      this.ruleForm.settleTotalSalesPrice = (price * 10000 / 10000).toFixed(2)
+      this.ruleForm.settlementAmount = (price * 10000 / 10000).toFixed(2)
+      this.buyTotalPrice = (buyPrice * 10000 / 10000).toFixed(2)
     },
     confirmRepay() {
       let arr = []

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

@@ -324,13 +324,14 @@ export default {
     calculateTotal() {
       let num = 0, price = 0, buyPrice = 0;
       this.goodsList.forEach(item => {
-        num = parseFloat(Number(num) + Number(item.goodsQuantity || 0)).toFixed(2)
-        price = parseFloat(Number(price) + Number(item.salesTotalPrice || 0)).toFixed(2)
-        buyPrice = parseFloat(Number(buyPrice) + Number(item.purchaseTotalPrice || 0)).toFixed(2)
+        num = Number(num) + Number(item.goodsQuantity || 0)
+        price += Number(item.goodsQuantity) * Number(item.salesPrice)
+        buyPrice +=  Number(item.goodsQuantity) * Number(item.purchasePrice)
       })
-      this.ruleForm.countTheGoods = num
-      this.ruleForm.settleTotalSalesPrice = price
-      this.buyTotalPrice = buyPrice
+
+      this.ruleForm.countTheGoods = (num * 10000 / 10000).toFixed(2)
+      this.ruleForm.settleTotalSalesPrice = (price * 10000 / 10000).toFixed(2)
+      this.buyTotalPrice = (buyPrice * 10000 / 10000).toFixed(2)
     },
     confirmRepay() {
       let arr = []
@@ -404,6 +405,12 @@ export default {
         }
       },
       immediate: true
+    },
+    goodsList: {
+      handler(val) {
+        this.calculateTotal()
+      },
+      immediate: true
     }
   }
 }