qukaidi 3 éve
szülő
commit
815805336a

+ 28 - 11
src/components/finance/financialAccount.vue

@@ -388,14 +388,24 @@ export default {
       })
     },
     async forData() {
-      let sum = 0
-      for (let item in this.data) {
-        sum += this.data[item].amount
-      }
-      let res = await getApplyAmount({ srcBillId: this.srcBillId, billType: "申请" })
-      if (sum <= res.data.data) {
-        return true
+      if (this.addBut) {
+        let amountSum = 0
+        for (let item in this.data) {
+          amountSum += Number(this.data[item].amount)
+        }
+        let res = await getApplyAmount({ srcBillId: this.srcBillId, billType: "申请" })
+        if ((Number(this.form.debitAmount) - Number(res.data.data)) >= amountSum) {
+          return true
+        }
+      } else {
+        for (let item in this.data) {
+          let res = await getApplyAmount({ srcBillId: this.data[item].itemId, billType: "申请" })
+          if ((Number(this.data[item].itemorderAmount) - Number(res.data.data)) >= this.data[item].amount) {
+            return this.data[item].srcOrderno
+          }
+        }
       }
+
     },
     async submit() {
       for (let i = 0; i < this.data.length; i++) {
@@ -421,13 +431,20 @@ export default {
           return this.$message.error(`请输入第${i + 1}行的税率`);
         }
       }
-      if (this.addBut) {
-        let forData = await this.forData()
-        if (forData) {
-          return this.$message.error('货款余额不足')
+      let forData = await this.forData()
+      if (forData) {
+        if (this.addBut) {
+          return this.$message.error('已付费金额大于货款')
+        } else {
+          return this.$message.error('合同号:' + forData + '已付费金额大于货款')
         }
       }
 
+      // if (forData) {
+      //   return this.$message.error('已付费金额大于货款')
+      // }else{
+      //   return this.$message.error('合同号:' + forData + '已付费金额大于货款')
+      // }
       this.submitButton = true
       const itemsList = this.data.map(item => {
         item.corpId = this.corpId;

+ 6 - 4
src/views/businessManagement/purchaseOrder/index.vue

@@ -456,10 +456,10 @@ export default {
           }
         }
       }
-      let forData = await this.forData()
-      if (forData) {
-        return this.$message.error('订单号:' + forData + '货款余额不足')
-      }
+      // let forData = await this.forData()
+      // if (forData) {
+      //   return this.$message.error('订单号:' + forData + '货款余额不足')
+      // }
       let a = []
       this.selection.forEach(item => {
         item.itemsList = item.itemsList ? item.itemsList : [];
@@ -492,6 +492,8 @@ export default {
           price,
           unit: '条',
           remarks: item.orderRemark,
+          itemorderAmount:item.orderAmount,
+          itemId:item.id
         }
         a.push(form)
         // item.itemsList.forEach(e => {