Răsfoiți Sursa

报价单、销售合同页面修改合同金额为 4 位小数

lxf 1 an în urmă
părinte
comite
1a47138106

+ 34 - 25
src/components/process/Contract.vue

@@ -148,7 +148,7 @@
               </template>
             </el-table-column>
             <el-table-column prop="unit" label="单位" width="100" :formatter="(row) => dictValueLabel(row.unit, productUnit)" />
-            <el-table-column label="数量" width="150">
+            <el-table-column label="数量" width="160">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   <el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
@@ -159,7 +159,11 @@
                       style="width: 100%"
                       :controls="false"
                       :min="0"
-                      @change="calculationAmount" />
+                      @change="
+                        () => {
+                          return calculationAmount('contractProductList', $index, 'quantity');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -175,7 +179,11 @@
                       style="width: 100%"
                       :controls="false"
                       :min="0"
-                      @change="calculationAmount" />
+                      @change="
+                        () => {
+                          return calculationAmount('contractProductList', $index, 'price');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -212,10 +220,13 @@
                       v-model="row.amount"
                       placeholder="请输入金额"
                       style="width: 100%"
-                      :precision="2"
                       :controls="false"
                       :min="0"
-                      @change="totalAmount()" />
+                      @change="
+                        () => {
+                          return totalAmount('contractProjectList', $index, 'amount');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -252,18 +263,6 @@
                 <el-input v-model="formData.data.amount" placeholder="合同总金额" disabled />
               </el-form-item>
             </el-col>
-            <!-- <el-col :span="4">
-              <el-form-item label="报价有效期 (天)" prop="effective">
-                <el-input-number onmousewheel="return false;"
-                  v-model="formData.data.effective"
-                  placeholder="请输入有效期"
-                  style="width: 100%"
-                  :precision="0"
-                  :controls="false"
-                  :min="0"
-                />
-              </el-form-item>
-            </el-col> -->
           </el-row>
           <el-row style="margin-top: 20px; width: 100%">
             <el-col :span="7">
@@ -373,7 +372,6 @@
           <el-row style="margin-top: 20px; width: 100%">
             <el-col :span="7">
               <el-form-item label="交货期限 (天)" prop="deliveryTime">
-                <!-- <el-date-picker v-model="formData.data.deliveryTime" type="date" placeholder="请选择交货期限" value-format="YYYY-MM-DD" /> -->
                 <el-input-number
                   onmousewheel="return false;"
                   v-model="formData.data.deliveryTime"
@@ -424,7 +422,11 @@
                       style="width: 100%"
                       :controls="false"
                       :min="0"
-                      @change="calculationAmount" />
+                      @change="
+                        () => {
+                          return calculationAmount('contractShipmentList', $index, 'quantity');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -1112,14 +1114,18 @@ const handleRemove = async (index, row) => {
   totalAmount();
   getDecisionAids();
 };
-const calculationAmount = (val) => {
-  console.log(val, "aaa");
+const calculationAmount = (listLabel, index, label) => {
+  if (formData.data[listLabel][index][label]) {
+    formData.data[listLabel][index][label] = Number(Math.round(Number(formData.data[listLabel][index][label]) * 10000) / 10000);
+  }
   nextTick(() => {
     if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
       for (let i = 0; i < formData.data.contractProductList.length; i++) {
         let money = 0;
         if (formData.data.contractProductList[i].quantity && formData.data.contractProductList[i].price) {
-          money = parseFloat(Number(formData.data.contractProductList[i].quantity) * Number(formData.data.contractProductList[i].price)).toFixed(4);
+          money = Number(
+            Math.round(Number(formData.data.contractProductList[i].quantity) * Number(formData.data.contractProductList[i].price) * 10000) / 10000
+          );
         }
         formData.data.contractProductList[i].amount = money;
       }
@@ -1129,19 +1135,22 @@ const calculationAmount = (val) => {
     });
   });
 };
-const totalAmount = () => {
+const totalAmount = (listLabel, index, label) => {
+  if (listLabel && formData.data[listLabel][index][label]) {
+    formData.data[listLabel][index][label] = Number(Math.round(Number(formData.data[listLabel][index][label]) * 10000) / 10000);
+  }
   let money = 0;
   if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
     for (let i = 0; i < formData.data.contractProductList.length; i++) {
       if (formData.data.contractProductList[i].amount) {
-        money = parseFloat(Number(money) + Number(formData.data.contractProductList[i].amount)).toFixed(4);
+        money = Number(Math.round((Number(money) + Number(formData.data.contractProductList[i].amount)) * 10000) / 10000);
       }
     }
   }
   if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
     for (let i = 0; i < formData.data.contractProjectList.length; i++) {
       if (formData.data.contractProjectList[i].amount) {
-        money = parseFloat(Number(money) + Number(formData.data.contractProjectList[i].amount)).toFixed(4);
+        money = Number(Math.round((Number(money) + Number(formData.data.contractProjectList[i].amount)) * 10000) / 10000);
       }
     }
   }

+ 34 - 27
src/components/process/ContractAlteration.vue

@@ -148,7 +148,7 @@
               </template>
             </el-table-column>
             <el-table-column label="单位" width="100" :formatter="(row) => dictValueLabel(row.productUnit, productUnit)" />
-            <el-table-column label="数量" width="150">
+            <el-table-column label="数量" width="160">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   <el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
@@ -157,10 +157,13 @@
                       v-model="row.quantity"
                       placeholder="请输入数量"
                       style="width: 100%"
-                      :precision="4"
                       :controls="false"
                       :min="0"
-                      @change="calculationAmount()" />
+                      @change="
+                        () => {
+                          return calculationAmount('contractProductList', $index, 'quantity');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -174,10 +177,13 @@
                       v-model="row.price"
                       placeholder="请输入单价"
                       style="width: 100%"
-                      :precision="2"
                       :controls="false"
                       :min="0"
-                      @change="calculationAmount()" />
+                      @change="
+                        () => {
+                          return calculationAmount('contractProductList', $index, 'price');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -214,10 +220,13 @@
                       v-model="row.amount"
                       placeholder="请输入金额"
                       style="width: 100%"
-                      :precision="2"
                       :controls="false"
                       :min="0"
-                      @change="totalAmount()" />
+                      @change="
+                        () => {
+                          return totalAmount('contractProjectList', $index, 'amount');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -254,18 +263,6 @@
                 <el-input v-model="formData.data.amount" placeholder="合同总金额" disabled />
               </el-form-item>
             </el-col>
-            <!-- <el-col :span="4">
-                <el-form-item label="报价有效期 (天)" prop="effective">
-                  <el-input-number onmousewheel="return false;"
-                    v-model="formData.data.effective"
-                    placeholder="请输入有效期"
-                    style="width: 100%"
-                    :precision="0"
-                    :controls="false"
-                    :min="0"
-                  />
-                </el-form-item>
-              </el-col> -->
           </el-row>
           <el-row style="margin-top: 20px; width: 100%">
             <el-col :span="7">
@@ -375,7 +372,6 @@
           <el-row style="margin-top: 20px; width: 100%">
             <el-col :span="7">
               <el-form-item label="交货期限 (天)" prop="deliveryTime">
-                <!-- <el-date-picker v-model="formData.data.deliveryTime" type="date" placeholder="请选择交货期限" value-format="YYYY-MM-DD" /> -->
                 <el-input-number
                   onmousewheel="return false;"
                   v-model="formData.data.deliveryTime"
@@ -424,10 +420,13 @@
                       v-model="row.quantity"
                       placeholder="请输入数量"
                       style="width: 100%"
-                      :precision="4"
                       :controls="false"
                       :min="0"
-                      @change="calculationAmount()" />
+                      @change="
+                        () => {
+                          return calculationAmount('contractShipmentList', $index, 'quantity');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -1075,13 +1074,18 @@ const handleRemove = async (index, row) => {
   totalAmount();
   getDecisionAids();
 };
-const calculationAmount = () => {
+const calculationAmount = (listLabel, index, label) => {
+  if (formData.data[listLabel][index][label]) {
+    formData.data[listLabel][index][label] = Number(Math.round(Number(formData.data[listLabel][index][label]) * 10000) / 10000);
+  }
   nextTick(() => {
     if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
       for (let i = 0; i < formData.data.contractProductList.length; i++) {
         let money = 0;
         if (formData.data.contractProductList[i].quantity && formData.data.contractProductList[i].price) {
-          money = parseFloat(Number(formData.data.contractProductList[i].quantity) * Number(formData.data.contractProductList[i].price)).toFixed(2);
+          money = Number(
+            Math.round(Number(formData.data.contractProductList[i].quantity) * Number(formData.data.contractProductList[i].price) * 10000) / 10000
+          );
         }
         formData.data.contractProductList[i].amount = money;
       }
@@ -1091,19 +1095,22 @@ const calculationAmount = () => {
     });
   });
 };
-const totalAmount = () => {
+const totalAmount = (listLabel, index, label) => {
+  if (listLabel && formData.data[listLabel][index][label]) {
+    formData.data[listLabel][index][label] = Number(Math.round(Number(formData.data[listLabel][index][label]) * 10000) / 10000);
+  }
   let money = 0;
   if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
     for (let i = 0; i < formData.data.contractProductList.length; i++) {
       if (formData.data.contractProductList[i].amount) {
-        money = parseFloat(Number(money) + Number(formData.data.contractProductList[i].amount)).toFixed(2);
+        money = Number(Math.round((Number(money) + Number(formData.data.contractProductList[i].amount)) * 10000) / 10000);
       }
     }
   }
   if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
     for (let i = 0; i < formData.data.contractProjectList.length; i++) {
       if (formData.data.contractProjectList[i].amount) {
-        money = parseFloat(Number(money) + Number(formData.data.contractProjectList[i].amount)).toFixed(2);
+        money = Number(Math.round((Number(money) + Number(formData.data.contractProjectList[i].amount)) * 10000) / 10000);
       }
     }
   }

+ 30 - 13
src/components/process/PriceSheet.vue

@@ -156,10 +156,13 @@
                       v-model="row.quantity"
                       placeholder="请输入数量"
                       style="width: 100%"
-                      :precision="4"
                       :controls="false"
                       :min="0"
-                      @change="calculationAmount()" />
+                      @change="
+                        () => {
+                          return calculationAmount('quotationProductList', $index, 'quantity');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -173,10 +176,13 @@
                       v-model="row.price"
                       placeholder="请输入单价"
                       style="width: 100%"
-                      :precision="2"
                       :controls="false"
                       :min="0"
-                      @change="calculationAmount()" />
+                      @change="
+                        () => {
+                          return calculationAmount('quotationProductList', $index, 'price');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -212,10 +218,13 @@
                       v-model="row.amount"
                       placeholder="请输入金额"
                       style="width: 100%"
-                      :precision="2"
                       :controls="false"
                       :min="0"
-                      @change="totalAmount()" />
+                      @change="
+                        () => {
+                          return totalAmount('quotationPayList', $index, 'amount');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -386,7 +395,7 @@ const judgeStatus = () => {
     }
   }
   return false;
-};;
+};
 const formOption = reactive({
   inline: true,
   labelWidth: 100,
@@ -715,13 +724,18 @@ const handleRemove = async (index) => {
   await formData.data.quotationProductList.splice(index, 1);
   totalAmount();
 };
-const calculationAmount = () => {
+const calculationAmount = (listLabel, index, label) => {
+  if (formData.data[listLabel][index][label]) {
+    formData.data[listLabel][index][label] = Number(Math.round(Number(formData.data[listLabel][index][label]) * 10000) / 10000);
+  }
   nextTick(() => {
     if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
       for (let i = 0; i < formData.data.quotationProductList.length; i++) {
         let money = 0;
         if (formData.data.quotationProductList[i].quantity && formData.data.quotationProductList[i].price) {
-          money = parseFloat(Number(formData.data.quotationProductList[i].quantity) * Number(formData.data.quotationProductList[i].price)).toFixed(2);
+          money = Number(
+            Math.round(Number(formData.data.quotationProductList[i].quantity) * Number(formData.data.quotationProductList[i].price) * 10000) / 10000
+          );
         }
         formData.data.quotationProductList[i].amount = money;
       }
@@ -731,19 +745,22 @@ const calculationAmount = () => {
     });
   });
 };
-const totalAmount = () => {
+const totalAmount = (listLabel, index, label) => {
+  if (listLabel && formData.data[listLabel][index][label]) {
+    formData.data[listLabel][index][label] = Number(Math.round(Number(formData.data[listLabel][index][label]) * 10000) / 10000);
+  }
   let money = 0;
   if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
     for (let i = 0; i < formData.data.quotationProductList.length; i++) {
       if (formData.data.quotationProductList[i].amount) {
-        money = parseFloat(Number(money) + Number(formData.data.quotationProductList[i].amount)).toFixed(2);
+        money = Number(Math.round((Number(money) + Number(formData.data.quotationProductList[i].amount)) * 10000) / 10000);
       }
     }
   }
   if (formData.data.quotationPayList && formData.data.quotationPayList.length > 0) {
     for (let i = 0; i < formData.data.quotationPayList.length; i++) {
       if (formData.data.quotationPayList[i].amount) {
-        money = parseFloat(Number(money) + Number(formData.data.quotationPayList[i].amount)).toFixed(2);
+        money = Number(Math.round((Number(money) + Number(formData.data.quotationPayList[i].amount)) * 10000) / 10000);
       }
     }
   }
@@ -838,7 +855,7 @@ watch(
   }
 );
 onMounted(() => {
-  if(!route.query.processType || route.query.processType == 30) {
+  if (!route.query.processType || route.query.processType == 30) {
     proxy.post("/customer/privateSeaPage", { pageNum: 1, pageSize: 999 }).then((res) => {
       customerList.value = res.rows.map((item) => {
         return {

+ 28 - 13
src/components/process/ServiceContract.vue

@@ -164,10 +164,13 @@
                       v-model="row.quantity"
                       placeholder="请输入数量"
                       style="width: 100%"
-                      :precision="4"
                       :controls="false"
                       :min="0"
-                      @change="calculationAmount()" />
+                      @change="
+                        () => {
+                          return calculationAmount('serviceContractProductList', $index, 'quantity');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -181,10 +184,13 @@
                       v-model="row.price"
                       placeholder="请输入单价"
                       style="width: 100%"
-                      :precision="2"
                       :controls="false"
                       :min="0"
-                      @change="calculationAmount()" />
+                      @change="
+                        () => {
+                          return calculationAmount('serviceContractProductList', $index, 'price');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -221,10 +227,13 @@
                       v-model="row.amount"
                       placeholder="请输入金额"
                       style="width: 100%"
-                      :precision="2"
                       :controls="false"
                       :min="0"
-                      @change="totalAmount()" />
+                      @change="
+                        () => {
+                          return totalAmount('serviceContractPayList', $index, 'amount');
+                        }
+                      " />
                   </el-form-item>
                 </div>
               </template>
@@ -374,7 +383,7 @@ const judgeStatus = () => {
     }
   }
   return false;
-};;
+};
 const formOption = reactive({
   inline: true,
   labelWidth: 100,
@@ -814,14 +823,17 @@ const handleRemove = async (index) => {
   await formData.data.serviceContractProductList.splice(index, 1);
   totalAmount();
 };
-const calculationAmount = () => {
+const calculationAmount = (listLabel, index, label) => {
+  if (formData.data[listLabel][index][label]) {
+    formData.data[listLabel][index][label] = Number(Math.round(Number(formData.data[listLabel][index][label]) * 10000) / 10000);
+  }
   nextTick(() => {
     if (formData.data.serviceContractProductList && formData.data.serviceContractProductList.length > 0) {
       for (let i = 0; i < formData.data.serviceContractProductList.length; i++) {
         let money = 0;
         if (formData.data.serviceContractProductList[i].quantity && formData.data.serviceContractProductList[i].price) {
-          money = parseFloat(Number(formData.data.serviceContractProductList[i].quantity) * Number(formData.data.serviceContractProductList[i].price)).toFixed(
-            2
+          money = Number(
+            Math.round(Number(formData.data.serviceContractProductList[i].quantity) * Number(formData.data.serviceContractProductList[i].price) * 10000) / 10000
           );
         }
         formData.data.serviceContractProductList[i].amount = money;
@@ -832,19 +844,22 @@ const calculationAmount = () => {
     });
   });
 };
-const totalAmount = () => {
+const totalAmount = (listLabel, index, label) => {
+  if (listLabel && formData.data[listLabel][index][label]) {
+    formData.data[listLabel][index][label] = Number(Math.round(Number(formData.data[listLabel][index][label]) * 10000) / 10000);
+  }
   let money = 0;
   if (formData.data.serviceContractProductList && formData.data.serviceContractProductList.length > 0) {
     for (let i = 0; i < formData.data.serviceContractProductList.length; i++) {
       if (formData.data.serviceContractProductList[i].amount) {
-        money = parseFloat(Number(money) + Number(formData.data.serviceContractProductList[i].amount)).toFixed(2);
+        money = Number(Math.round((Number(money) + Number(formData.data.serviceContractProductList[i].amount)) * 10000) / 10000);
       }
     }
   }
   if (formData.data.serviceContractPayList && formData.data.serviceContractPayList.length > 0) {
     for (let i = 0; i < formData.data.serviceContractPayList.length; i++) {
       if (formData.data.serviceContractPayList[i].amount) {
-        money = parseFloat(Number(money) + Number(formData.data.serviceContractPayList[i].amount)).toFixed(2);
+        money = Number(Math.round((Number(money) + Number(formData.data.serviceContractPayList[i].amount)) * 10000) / 10000);
       }
     }
   }