|
|
|
@@ -2702,7 +2702,8 @@ export default {
|
|
|
|
|
this.referenceParams('formal')
|
|
|
|
|
);
|
|
|
|
|
const data = this.unwrapData(response) || {};
|
|
|
|
|
const records = data.records || [];
|
|
|
|
|
// 已调整的结算单为调整重推后的归档原单,金额已作废,不可再发起付款
|
|
|
|
|
const records = (data.records || []).filter(row => row.adjustStatus !== 'adjusted');
|
|
|
|
|
this.formalRows = await this.fillReferencePayableAmounts(records, 'settlement_payment');
|
|
|
|
|
this.formalPage.total = Number(data.total || 0);
|
|
|
|
|
} finally {
|
|
|
|
@@ -3124,18 +3125,21 @@ export default {
|
|
|
|
|
if (!target) return;
|
|
|
|
|
target.paymentRatio = value;
|
|
|
|
|
this.syncRowPayment(target, 'ratio');
|
|
|
|
|
this.syncHeaderSettlementTotalsFromRows();
|
|
|
|
|
this.syncHeaderSettlementTotalsFromRows(true);
|
|
|
|
|
},
|
|
|
|
|
handleRowAppliedAmountChange(row, value) {
|
|
|
|
|
const target = this.findReferenceRow(row);
|
|
|
|
|
if (!target) return;
|
|
|
|
|
target.appliedAmount = value;
|
|
|
|
|
this.syncRowPayment(target, 'amount');
|
|
|
|
|
this.syncHeaderSettlementTotalsFromRows();
|
|
|
|
|
this.syncHeaderSettlementTotalsFromRows(true);
|
|
|
|
|
},
|
|
|
|
|
/** 多结算单时仅同步结算金额/可付款金额合计,申请付款金额与比例由上方独立维护 */
|
|
|
|
|
syncHeaderSettlementTotalsFromRows() {
|
|
|
|
|
if (this.referenceRows.length <= 1) return;
|
|
|
|
|
/**
|
|
|
|
|
* 结算信息行合计回填付款基本信息。
|
|
|
|
|
* @param {boolean} syncApplied 行内编辑时同步申请付款金额与比例;回显加载时保持原值,避免改写历史单据
|
|
|
|
|
*/
|
|
|
|
|
syncHeaderSettlementTotalsFromRows(syncApplied = false) {
|
|
|
|
|
if (!this.referenceRows.length) return;
|
|
|
|
|
const settlementAmount = this.referenceRows.reduce(
|
|
|
|
|
(total, item) => total + Number(item.settlementAmount || 0),
|
|
|
|
|
0
|
|
|
|
@@ -3144,9 +3148,21 @@ export default {
|
|
|
|
|
(total, item) => total + Number(item.payableAmount || 0),
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
const appliedAmount = this.referenceRows.reduce(
|
|
|
|
|
(total, item) => total + Number(item.appliedAmount || 0),
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
this.amountSyncing = true;
|
|
|
|
|
this.form.settlementAmount = Number(settlementAmount.toFixed(2));
|
|
|
|
|
this.form.payableAmount = Number(payableAmount.toFixed(2));
|
|
|
|
|
if (syncApplied) {
|
|
|
|
|
this.form.appliedAmount = Number(appliedAmount.toFixed(2));
|
|
|
|
|
if (this.paymentAmountBase) {
|
|
|
|
|
this.form.paymentRatio = Number(
|
|
|
|
|
((appliedAmount / this.paymentAmountBase) * 100).toFixed(2)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.amountSyncing = false;
|
|
|
|
|
this.$refs.formRef?.validateField?.(['settlementAmount', 'appliedAmount']);
|
|
|
|
@@ -3320,6 +3336,18 @@ export default {
|
|
|
|
|
ElMessage.warning(`${exceededRow.settlementNo || '结算单'}付款金额不能超过可付款金额`);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
const rowAppliedTotal = this.referenceRows.reduce(
|
|
|
|
|
(total, item) => total + Number(item.appliedAmount || 0),
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
// 金蝶按付款基本信息申请金额推单,行合计不等时预付建档分摊会与金蝶金额不一致
|
|
|
|
|
if (Math.abs(rowAppliedTotal - appliedAmount) > 0.005) {
|
|
|
|
|
this.clearMessages();
|
|
|
|
|
ElMessage.warning(
|
|
|
|
|
`结算行付款金额合计${rowAppliedTotal.toFixed(2)}与申请付款金额${appliedAmount.toFixed(2)}不一致,请调整`
|
|
|
|
|
);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.form.paymentType === 'project_advance' && !this.form.projectId) {
|
|
|
|
|
this.clearMessages();
|
|
|
|
|