From c438e08128b3ab98bcfdf62cbb0b4384bac8cdbd Mon Sep 17 00:00:00 2001 From: linyongLynn <15926056+linyonglynn@user.noreply.gitee.com> Date: Tue, 22 Jul 2025 23:48:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B0=B4=E7=94=B5=E8=B4=B9bu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contract/components/printPaymentForm.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/views/contract/components/printPaymentForm.vue b/src/views/contract/components/printPaymentForm.vue index 04a0b2b..f604e60 100644 --- a/src/views/contract/components/printPaymentForm.vue +++ b/src/views/contract/components/printPaymentForm.vue @@ -354,6 +354,7 @@ export default { // 监听 total 输入框的变化 const totalInput = dom.querySelector('input[data-field="total"]') + console.log('totalInput', totalInput.value) if (totalInput) { totalInput.removeEventListener('input', this.updateUpperCaseFromTotal) totalInput.removeEventListener('change', this.updateUpperCaseFromTotal) @@ -545,11 +546,22 @@ export default { console.log('计算得到的总金额:', total) + + // 更新总金额输入框 const totalInput = dom.querySelector('input[data-field="total"]') if (totalInput) { - totalInput.value = "¥"+total.toFixed(2) - console.log('更新总金额输入框:', totalInput.value) + if (amountInputs.length > 0) { + totalInput.value = "¥"+total.toFixed(2) + console.log('更新总金额输入框:', totalInput.value) + } else { + // 当amountInputs.length为0时,先转换成数字,再添加单位前缀 + const currentValue = parseFloat(totalInput.value.replace(/¥/g, '')) || 0 + totalInput.value = "¥" + currentValue.toFixed(2) + console.log('更新总金额输入框(无amount输入框时):', totalInput.value) + + total = currentValue + } } // 更新大写金额