Jelajahi Sumber

fix: 修复多项功能问题并优化细节

liujt 14 jam lalu
induk
melakukan
a43d2812ca

+ 8 - 5
src/BIZComponents/paymentCollectionPlan/Index.vue

@@ -148,7 +148,7 @@
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.price'"
           :rules="{
-            required: true,
+            required: false,
             pattern: numberReg,
             message: '请输入正确的金额',
             trigger: 'change'
@@ -289,7 +289,7 @@
             prop: 'issueNumber',
             label: '期数',
             slot: 'issueNumber',
-            headerSlot: 'headerIssueNumber',
+            // headerSlot: 'headerIssueNumber',
             align: 'center'
           },
           {
@@ -322,7 +322,7 @@
             label: this.menu === 'purchase' ? '计划付款金额' : '计划收款金额',
             slot: 'price',
             align: 'center',
-            headerSlot: 'headerPrice',
+            // headerSlot: 'headerPrice',
           },
 
           {
@@ -588,8 +588,8 @@
               item.issueNumber = i + 1;
             } else {
               item.moneyName = '';
-              item.type = '';
-              item.typeName = '';
+              item.type = 2;
+              item.typeName = '交货款';
               item.ratio = '';
               item.key = i + 1;
               item.issueNumber = i + 1;
@@ -703,6 +703,9 @@
           item.deadLine = deadLine;
           // item.ratio = ratio;
 
+          item.type = 2;
+          item.typeName = '交货款';
+
           tempList.push(item);
           // totalRatio += ratio;
         }

+ 2 - 2
src/api/saleManage/saleordersendrecord.js

@@ -31,9 +31,9 @@ export async function getSendSaleOrderrecordDetail(id) {
 /**
  * 获取信息详情
  */
-export async function getSendSaleOrderrecordDetailSplit(id) {
+export async function getSendSaleOrderrecordDetailSplit(id, isEdit=0) {
   const res = await request.get(
-    `/eom/saleordersendrecord/getByIdSplit/${id}`,
+    `/eom/saleordersendrecord/getByIdSplit/${id}?isEdit=${isEdit}`,
     {}
   );
   if (res.data.code == 0) {

+ 1 - 1
src/utils/util.js

@@ -58,7 +58,7 @@ export function getSummaries(param, key, unit) {
 
     if (key.includes(column.property)) {
       const values = data.map((item) => Number(item[column.property]));
-      console.log(values);
+      // console.log(values);
 
       if (!values.every((value) => isNaN(value))) {
         sums[index] = values.reduce((prev, curr) => {

+ 31 - 24
src/views/saleManage/saleOrder/components/addDialogNew.vue

@@ -1035,7 +1035,8 @@
           payAmount: [{ required: true, message: '请输入', trigger: 'blur' }],
           salesmanId: [{ required: this.isDeptAndPerson == 1 ? true : false, message: '请选择业务员', trigger: 'change' }],
           salesDeptId: [{ required: this.isDeptAndPerson == 1 ? true : false, message: '请选择销售部门', trigger: 'change' }],
-          settlementDate: [{ required: true, message: '请选择结算日期', trigger: 'change' }]
+          settlementDate: [{ required: true, message: '请选择结算日期', trigger: 'change' }],
+          receiptDate: [{ required: true, message: '请选择收款日期', trigger: 'change' }]
         };
       }
     },
@@ -1965,34 +1966,40 @@
 
           if(commitData.needProduce != 2 && commitData.needProduce != 4) {
             const ratioSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.ratio, 0);
-            if(+ratioSum != 100){
-              this.$message.error('比例合计必须为100%');
+
+             if(+ratioSum > 100){
+              this.$message.error('比例合计不能超过100%');
               return;
             }
 
+            // if(+ratioSum != 100){
+            //   this.$message.error('比例合计必须为100%');
+            //   return;
+            // }
+
             // 使用万分之一进行计算,避免浮点数精度问题(对应4位小数)
-            let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
-            const payAmount = +commitData.payAmount;
+            // let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
+            // const payAmount = +commitData.payAmount;
             
-            if(+ratioSum == 100) {
-              // 使用万分之一进行计算,避免浮点数精度问题
-              const difference = Math.round((payAmount - receiptPaymentListSum) * 10000) / 10000;
-              console.log('difference~~~', difference);
-              if (Math.abs(difference) >= 0.0001 && commitData.receiptPaymentList.length > 0) {
-                const lastIndex = commitData.receiptPaymentList.length - 1;
-                // 使用万分之一进行计算,避免浮点数精度问题
-                const newPrice = Math.round((+commitData.receiptPaymentList[lastIndex].price + difference) * 10000) / 10000;
-                commitData.receiptPaymentList[lastIndex].price = formatPrice(newPrice);
-                receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
-              }
-            }
-
-            console.log('receiptPaymentListSum~~~', +receiptPaymentListSum, payAmount);
-
-            if(Math.abs(+receiptPaymentListSum - payAmount) > 0.0001){
-              this.$message.error('计划收款金额合计与优惠后金额不一致');
-              return;
-            }
+            // if(+ratioSum == 100) {
+            //   // 使用万分之一进行计算,避免浮点数精度问题
+            //   const difference = Math.round((payAmount - receiptPaymentListSum) * 10000) / 10000;
+            //   console.log('difference~~~', difference);
+            //   if (Math.abs(difference) >= 0.0001 && commitData.receiptPaymentList.length > 0) {
+            //     const lastIndex = commitData.receiptPaymentList.length - 1;
+            //     // 使用万分之一进行计算,避免浮点数精度问题
+            //     const newPrice = Math.round((+commitData.receiptPaymentList[lastIndex].price + difference) * 10000) / 10000;
+            //     commitData.receiptPaymentList[lastIndex].price = formatPrice(newPrice);
+            //     receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
+            //   }
+            // }
+
+            // console.log('receiptPaymentListSum~~~', +receiptPaymentListSum, payAmount);
+
+            // if(Math.abs(+receiptPaymentListSum - payAmount) > 0.0001){
+            //   this.$message.error('计划收款金额合计与优惠后金额不一致');
+            //   return;
+            // }
           }
           
           if (isTemporary.length > 0) {

+ 4 - 3
src/views/saleManage/saleOrder/invoice/components/addInvoiceDialog.vue

@@ -216,11 +216,12 @@
     </el-tabs>
 
     <div slot="footer" class="footer">
-      <el-button type="primary" @click="save" v-click-once>保存</el-button>
+      <el-button type="primary" @click="save" :loading="loading" v-click-once>保存</el-button>
       <el-button
         type="primary"
         v-if="isNeed_process_is_close"
         @click="save('sub')"
+         :loading="loading"
         v-click-once
         >提交</el-button
       >
@@ -633,7 +634,7 @@
         this.businessId = id;
 
         this.loading = true;
-        const data = await getSendSaleOrderrecordDetailSplit(id);
+        const data = await getSendSaleOrderrecordDetailSplit(id, 1);
         // this.partbAddress = data.saleOrder[0].partbAddress;
         // this.saleOrderValue = data.saleOrder;
         if (data.saleOrderList) {
@@ -1052,7 +1053,7 @@
                 this.$emit('done');
               })
               .catch((e) => {
-                //this.loading = false;
+                // this.loading = false;
               });
           }
         } catch (error) {