|
|
|
|
@ -466,7 +466,9 @@ export default {
|
|
|
|
|
zoomedDialogVisible: false, // 控制放大表格弹窗的显示
|
|
|
|
|
hasPostPaymentForm: false, // 是否有事后支付表格
|
|
|
|
|
contract_category: {},
|
|
|
|
|
templateContextData: null // 合同模板关联数据
|
|
|
|
|
templateContextData: null, // 合同模板关联数据
|
|
|
|
|
total: 0,
|
|
|
|
|
otherTotal: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
@ -482,7 +484,9 @@ export default {
|
|
|
|
|
this.getBudgets()
|
|
|
|
|
this.currentStep = 1 // 重置到第一步
|
|
|
|
|
this.paymentRegistrationForm = this.getDefaultPaymentRegistrationForm() // 每次弹窗打开时重置表单
|
|
|
|
|
// 重置校验状态,避免立刻弹出必填项提示
|
|
|
|
|
this.forms = null // <---清空表单HTML内容
|
|
|
|
|
this.contract = {} // <--- 新增:重置合同对象
|
|
|
|
|
this.contractTemplate = null // <--- 新增:重置模板
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
if (this.$refs.paymentRegistration && this.$refs.paymentRegistration.$refs.elForm) {
|
|
|
|
|
this.$refs.paymentRegistration.$refs.elForm.resetFields()
|
|
|
|
|
@ -605,6 +609,7 @@ export default {
|
|
|
|
|
if (this.contract_category && this.contract_category.default_remark !== undefined) {
|
|
|
|
|
this.paymentRegistrationForm.remark = this.contract_category.default_remark
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 动态生成rules
|
|
|
|
|
this.paymentRegistrationRules = {
|
|
|
|
|
applyMoney: [
|
|
|
|
|
@ -669,7 +674,7 @@ export default {
|
|
|
|
|
this.hasPostPaymentForm = true
|
|
|
|
|
this.currentStep = 1
|
|
|
|
|
this.contractTemplate = this.contract.contract_template.template
|
|
|
|
|
this.forms = this.contract.forms
|
|
|
|
|
this.forms = this.contractTemplate
|
|
|
|
|
if (!this.contract.contract_template.contract_template_fields) {
|
|
|
|
|
this.contract.contract_template.contract_template_fields = this.contract.other_data || []
|
|
|
|
|
}
|
|
|
|
|
@ -910,6 +915,27 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
nextStep() {
|
|
|
|
|
try {
|
|
|
|
|
// 自动填充表格中的填写的支付金额.
|
|
|
|
|
let applyMoney = 0
|
|
|
|
|
if (this.total > 0) {
|
|
|
|
|
applyMoney = this.total
|
|
|
|
|
} else if (this.otherTotal > 0) {
|
|
|
|
|
applyMoney = this.otherTotal
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 从动态表单中获取当前付款金额
|
|
|
|
|
const mainTable = this.$refs.mainTable
|
|
|
|
|
if (mainTable) {
|
|
|
|
|
const currentPaymentInput = mainTable.querySelector('input[data-field="currentDuePayment"]')
|
|
|
|
|
if (currentPaymentInput) {
|
|
|
|
|
const inputValue = currentPaymentInput.value
|
|
|
|
|
if (inputValue && Number(inputValue) > 0) {
|
|
|
|
|
applyMoney = Number(inputValue)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.paymentRegistrationForm.applyMoney = applyMoney
|
|
|
|
|
|
|
|
|
|
// 如果有事后支付表格,下一步不做表单校验,直接切换 currentStep=2
|
|
|
|
|
if (this.hasPostPaymentForm) {
|
|
|
|
|
// 保存事后支付表格HTML数据,参考 openZoomedTable 逻辑
|
|
|
|
|
@ -983,6 +1009,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
// 使用setTimeout确保DOM完全加载
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
|
|
const sdateAmountInputs = dom.querySelectorAll('input[data-field^="sdate"]')
|
|
|
|
|
// 移除旧的监听器
|
|
|
|
|
sdateAmountInputs.forEach(input => {
|
|
|
|
|
@ -1197,7 +1224,7 @@ export default {
|
|
|
|
|
const value = parseFloat(input.value) || 0
|
|
|
|
|
wanTotal += value
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const wanInput = dom.querySelector('input[data-field="wTotal"]')
|
|
|
|
|
if (wanInput) {
|
|
|
|
|
wanInput.value = wanTotal===0?'':wanTotal
|
|
|
|
|
@ -1275,26 +1302,20 @@ export default {
|
|
|
|
|
fenInput.value = fenTotal===0?'':fenTotal
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let otherTotal = wanTotal * 10000 + qianTotal * 1000 + baiTotal * 100 + shiTotal * 10 + yuanTotal + jiaoTotal * 0.1 + fenTotal * 0.01
|
|
|
|
|
this.otherTotal = wanTotal * 10000 + qianTotal * 1000 + baiTotal * 100 + shiTotal * 10 + yuanTotal + jiaoTotal * 0.1 + fenTotal * 0.01
|
|
|
|
|
|
|
|
|
|
let total = 0
|
|
|
|
|
this.total = 0
|
|
|
|
|
// 只计算以 amount 开头的输入框
|
|
|
|
|
const amountInputs = dom.querySelectorAll('input[data-field^="amount"]')
|
|
|
|
|
console.log('计算总金额,找到输入框数量:', amountInputs.length, dom)
|
|
|
|
|
|
|
|
|
|
amountInputs.forEach(input => {
|
|
|
|
|
const value = parseFloat(input.value) || 0
|
|
|
|
|
console.log('输入框值:', input.getAttribute('data-field'), value)
|
|
|
|
|
total += value
|
|
|
|
|
this.total += value
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
console.log('计算得到的总金额:', total)
|
|
|
|
|
|
|
|
|
|
// 更新总金额输入框
|
|
|
|
|
const totalInput = dom.querySelector('input[data-field="total"]')
|
|
|
|
|
if (totalInput) {
|
|
|
|
|
totalInput.value = total.toFixed(2)
|
|
|
|
|
console.log('更新总金额输入框:', totalInput.value)
|
|
|
|
|
totalInput.value = this.total.toFixed(2)
|
|
|
|
|
|
|
|
|
|
// 监听 total 输入框的变化
|
|
|
|
|
totalInput.removeEventListener('input', (e) => this.updateUpperCaseFromTotal(e, dom))
|
|
|
|
|
@ -1309,14 +1330,13 @@ export default {
|
|
|
|
|
// 更新大写金额
|
|
|
|
|
const upperCaseInput = dom.querySelector('input[data-field="upperCaseAmount"]')
|
|
|
|
|
if (upperCaseInput) {
|
|
|
|
|
if (total !== 0) {
|
|
|
|
|
upperCaseInput.value = numberToChinese(total)
|
|
|
|
|
if (this.total !== 0) {
|
|
|
|
|
upperCaseInput.value = numberToChinese(this.total)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (otherTotal !== 0) {
|
|
|
|
|
upperCaseInput.value = numberToChinese(otherTotal)
|
|
|
|
|
if (this.otherTotal !== 0) {
|
|
|
|
|
upperCaseInput.value = numberToChinese(this.otherTotal)
|
|
|
|
|
}
|
|
|
|
|
console.log('更新大写金额:', upperCaseInput.value)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
@ -1329,7 +1349,6 @@ export default {
|
|
|
|
|
if (totalInput && upperCaseInput) {
|
|
|
|
|
const total = parseFloat(totalInput.value) || 0
|
|
|
|
|
upperCaseInput.value = numberToChinese(total)
|
|
|
|
|
console.log('从总金额更新大写金额:', total, upperCaseInput.value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let wanTotal = 0
|
|
|
|
|
|