|
@@ -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;
|