|
|
@@ -1188,9 +1188,23 @@
|
|
|
|
|
|
invoiceAmountChange(item, sum) {
|
|
|
console.log('item~~~', item, sum);
|
|
|
- const sameKeyItems = this.form.relatedList.filter((d) => d.sourceCode === item.key)
|
|
|
+ const sameKeyItems = this.form.relatedList.filter((d) => d.sourceCode === item.key);
|
|
|
console.log('sameKeyItems~~~', sameKeyItems);
|
|
|
-
|
|
|
+
|
|
|
+ // 从关联物品清单中取该订单的"未开票金额"和"本次开票金额"(per-detail 字段)
|
|
|
+ const tableInfoRef = this.$refs.tableInfoRef;
|
|
|
+ let unInvoiceAmount = 0;
|
|
|
+ let invoiceAmount = 0;
|
|
|
+ if (tableInfoRef && tableInfoRef.tableForm && tableInfoRef.tableForm.detailList) {
|
|
|
+ const matchedDetail = tableInfoRef.tableForm.detailList.find(
|
|
|
+ (d) => d.key === item.key
|
|
|
+ );
|
|
|
+ if (matchedDetail) {
|
|
|
+ unInvoiceAmount = parseFloat(matchedDetail.unInvoiceAmount) || 0;
|
|
|
+ invoiceAmount = parseFloat(matchedDetail.invoiceAmount) || 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
let remainingTotal = sum;
|
|
|
const lastIndex = sameKeyItems.length - 1;
|
|
|
|
|
|
@@ -1208,6 +1222,13 @@
|
|
|
remainingTotal -= allocateAmount;
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ // 来源清单的未开票金额 = 关联物品清单的未开票金额 - 本次开票金额
|
|
|
+ const remainingUnInvoice = (unInvoiceAmount - invoiceAmount).toFixed(2);
|
|
|
+ sameKeyItems.forEach((paymentItem) => {
|
|
|
+ this.$set(paymentItem, 'unInvoiceAmount', remainingUnInvoice);
|
|
|
+ });
|
|
|
+
|
|
|
this.updateInvoiceAmount();
|
|
|
console.log('分配完成后的 sameKeyItems:', sameKeyItems);
|
|
|
},
|