From 698f808f0b211e396329d660273a6604e18f347d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B3=89=E4=BD=B3?= <1107186916@qq.com> Date: Thu, 29 Oct 2026 02:19:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=93=E7=AE=97=E8=A1=8C=E4=BB=98?= =?UTF-8?q?=E6=AC=BE=E9=87=91=E9=A2=9D=E8=81=94=E5=8A=A8=E5=9B=9E=E5=A1=AB?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E4=BB=98=E6=AC=BE=E9=87=91=E9=A2=9D=E5=B9=B6?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=90=88=E8=AE=A1=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结算信息行改动付款比例或付款金额时,自动把行金额合计回填到上方申请付款金额并重算比例; 保存/提交前校验行金额合计与申请付款金额一致,避免推送金蝶金额与预付建档分摊不一致。 回显加载走默认不同步,避免改写历史单据。 --- .../payment/payment-application-form.vue | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/views/payment/payment-application-form.vue b/src/views/payment/payment-application-form.vue index 21e0711..cb0eca1 100644 --- a/src/views/payment/payment-application-form.vue +++ b/src/views/payment/payment-application-form.vue @@ -3125,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 @@ -3145,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']); @@ -3321,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();