Эх сурвалжийг харах

采购小数位数限制为3位

lxf 1 жил өмнө
parent
commit
b2e7c68733

+ 13 - 10
src/components/process/purchase.vue

@@ -67,7 +67,7 @@
                     style="width: 100%"
                     :controls="false"
                     :min="0"
-                    :precision="2" />
+                    :precision="3" />
                 </el-form-item>
               </template>
             </el-table-column>
@@ -93,7 +93,7 @@
             </el-table-column>
             <el-table-column label="不含税单价" width="100">
               <template #default="{ row }">
-                <div>{{ moneyFormat(Number(Math.round(((row.unitPrice * 100) / (100 + row.taxRate)) * 100) / 100)) }}</div>
+                <div>{{ moneyFormat(Number(Math.round(((row.unitPrice * 100) / (100 + row.taxRate)) * 1000) / 1000), 3) }}</div>
               </template>
             </el-table-column>
             <el-table-column label="可采购数量" width="100">
@@ -127,14 +127,17 @@
             </el-table-column>
             <el-table-column label="含税小计" align="right" width="120">
               <template #default="{ row }">
-                <div>{{ moneyFormat(Number(Math.round(row.unitPrice * row.purchaseQuantity * 100) / 100)) }}</div>
+                <div>{{ moneyFormat(Number(Math.round(row.unitPrice * row.purchaseQuantity * 1000) / 1000), 3) }}</div>
               </template>
             </el-table-column>
             <el-table-column label="不含税小计" align="right" width="120">
               <template #default="{ row }">
                 <div>
                   {{
-                    moneyFormat(Number(Math.round((Math.round(((row.unitPrice * 100) / (100 + row.taxRate)) * 100) / 100) * row.purchaseQuantity * 100) / 100))
+                    moneyFormat(
+                      Number(Math.round((Math.round(((row.unitPrice * 100) / (100 + row.taxRate)) * 1000) / 1000) * row.purchaseQuantity * 1000) / 1000),
+                      3
+                    )
                   }}
                 </div>
               </template>
@@ -203,9 +206,9 @@
       <template #money>
         <div style="width: 100%">
           <div style="padding: 8px; background-color: #e9f5fb; font-size: 12px; font-weight: 700">
-            <span>含税总金额: {{ moneyFormat(formData.data.totalAmountIncludingTax) }} ({{ formData.data.totalAmountIncludingTaxCn }})</span>
+            <span>含税总金额: {{ moneyFormat(formData.data.totalAmountIncludingTax, 3) }} ({{ formData.data.totalAmountIncludingTaxCn }})</span>
             <span style="margin-left: 32px">
-              不含税总金额: {{ moneyFormat(formData.data.totalAmountExcludingTax) }} ({{ formData.data.totalAmountExcludingTaxCn }})
+              不含税总金额: {{ moneyFormat(formData.data.totalAmountExcludingTax, 3) }} ({{ formData.data.totalAmountExcludingTaxCn }})
             </span>
           </div>
         </div>
@@ -481,15 +484,15 @@ const calculatedTotalAmount = () => {
   if (formData.data.purchaseBomList && formData.data.purchaseBomList.length > 0) {
     for (let i = 0; i < formData.data.purchaseBomList.length; i++) {
       if (formData.data.purchaseBomList[i].unitPrice && formData.data.purchaseBomList[i].purchaseQuantity) {
-        money = Number(Math.round((money + formData.data.purchaseBomList[i].unitPrice * formData.data.purchaseBomList[i].purchaseQuantity) * 100) / 100);
+        money = Number(Math.round((money + formData.data.purchaseBomList[i].unitPrice * formData.data.purchaseBomList[i].purchaseQuantity) * 1000) / 1000);
         if (formData.data.purchaseBomList[i].taxRate) {
           notTaxMoney = Number(
             Math.round(
               (notTaxMoney +
-                (Math.round(((formData.data.purchaseBomList[i].unitPrice * 100) / (100 + formData.data.purchaseBomList[i].taxRate)) * 100) / 100) *
+                (Math.round(((formData.data.purchaseBomList[i].unitPrice * 100) / (100 + formData.data.purchaseBomList[i].taxRate)) * 1000) / 1000) *
                   formData.data.purchaseBomList[i].purchaseQuantity) *
-                100
-            ) / 100
+                1000
+            ) / 1000
           );
         }
       }