lion 1 year ago
commit f1597cc1fe

@ -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
}
}
// 更新大写金额

Loading…
Cancel
Save