本期扣款金额自动填充

master
lynn 12 months ago
parent 9694459ac8
commit 64d9df58a4

@ -466,7 +466,9 @@ export default {
zoomedDialogVisible: false, // zoomedDialogVisible: false, //
hasPostPaymentForm: false, // hasPostPaymentForm: false, //
contract_category: {}, contract_category: {},
templateContextData: null // templateContextData: null, //
total: 0,
otherTotal: 0
} }
}, },
computed: { computed: {
@ -482,7 +484,9 @@ export default {
this.getBudgets() this.getBudgets()
this.currentStep = 1 // this.currentStep = 1 //
this.paymentRegistrationForm = this.getDefaultPaymentRegistrationForm() // this.paymentRegistrationForm = this.getDefaultPaymentRegistrationForm() //
// this.forms = null // <---HTML
this.contract = {} // <---
this.contractTemplate = null // <---
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs.paymentRegistration && this.$refs.paymentRegistration.$refs.elForm) { if (this.$refs.paymentRegistration && this.$refs.paymentRegistration.$refs.elForm) {
this.$refs.paymentRegistration.$refs.elForm.resetFields() this.$refs.paymentRegistration.$refs.elForm.resetFields()
@ -605,6 +609,7 @@ export default {
if (this.contract_category && this.contract_category.default_remark !== undefined) { if (this.contract_category && this.contract_category.default_remark !== undefined) {
this.paymentRegistrationForm.remark = this.contract_category.default_remark this.paymentRegistrationForm.remark = this.contract_category.default_remark
} }
// rules // rules
this.paymentRegistrationRules = { this.paymentRegistrationRules = {
applyMoney: [ applyMoney: [
@ -669,7 +674,7 @@ export default {
this.hasPostPaymentForm = true this.hasPostPaymentForm = true
this.currentStep = 1 this.currentStep = 1
this.contractTemplate = this.contract.contract_template.template this.contractTemplate = this.contract.contract_template.template
this.forms = this.contract.forms this.forms = this.contractTemplate
if (!this.contract.contract_template.contract_template_fields) { if (!this.contract.contract_template.contract_template_fields) {
this.contract.contract_template.contract_template_fields = this.contract.other_data || [] this.contract.contract_template.contract_template_fields = this.contract.other_data || []
} }
@ -910,6 +915,27 @@ export default {
}, },
nextStep() { nextStep() {
try { 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 // currentStep=2
if (this.hasPostPaymentForm) { if (this.hasPostPaymentForm) {
// HTML openZoomedTable // HTML openZoomedTable
@ -983,6 +1009,7 @@ export default {
// 使setTimeoutDOM // 使setTimeoutDOM
setTimeout(() => { setTimeout(() => {
const sdateAmountInputs = dom.querySelectorAll('input[data-field^="sdate"]') const sdateAmountInputs = dom.querySelectorAll('input[data-field^="sdate"]')
// //
sdateAmountInputs.forEach(input => { sdateAmountInputs.forEach(input => {
@ -1275,26 +1302,20 @@ export default {
fenInput.value = fenTotal===0?'':fenTotal 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 // amount
const amountInputs = dom.querySelectorAll('input[data-field^="amount"]') const amountInputs = dom.querySelectorAll('input[data-field^="amount"]')
console.log('计算总金额,找到输入框数量:', amountInputs.length, dom)
amountInputs.forEach(input => { amountInputs.forEach(input => {
const value = parseFloat(input.value) || 0 const value = parseFloat(input.value) || 0
console.log('输入框值:', input.getAttribute('data-field'), value) this.total += value
total += value
}) })
console.log('计算得到的总金额:', total)
// //
const totalInput = dom.querySelector('input[data-field="total"]') const totalInput = dom.querySelector('input[data-field="total"]')
if (totalInput) { if (totalInput) {
totalInput.value = total.toFixed(2) totalInput.value = this.total.toFixed(2)
console.log('更新总金额输入框:', totalInput.value)
// total // total
totalInput.removeEventListener('input', (e) => this.updateUpperCaseFromTotal(e, dom)) totalInput.removeEventListener('input', (e) => this.updateUpperCaseFromTotal(e, dom))
@ -1309,14 +1330,13 @@ export default {
// //
const upperCaseInput = dom.querySelector('input[data-field="upperCaseAmount"]') const upperCaseInput = dom.querySelector('input[data-field="upperCaseAmount"]')
if (upperCaseInput) { if (upperCaseInput) {
if (total !== 0) { if (this.total !== 0) {
upperCaseInput.value = numberToChinese(total) upperCaseInput.value = numberToChinese(this.total)
} }
if (otherTotal !== 0) { if (this.otherTotal !== 0) {
upperCaseInput.value = numberToChinese(otherTotal) upperCaseInput.value = numberToChinese(this.otherTotal)
} }
console.log('更新大写金额:', upperCaseInput.value)
} }
}, },
@ -1329,7 +1349,6 @@ export default {
if (totalInput && upperCaseInput) { if (totalInput && upperCaseInput) {
const total = parseFloat(totalInput.value) || 0 const total = parseFloat(totalInput.value) || 0
upperCaseInput.value = numberToChinese(total) upperCaseInput.value = numberToChinese(total)
console.log('从总金额更新大写金额:', total, upperCaseInput.value)
} }
let wanTotal = 0 let wanTotal = 0

@ -3395,7 +3395,6 @@ export default {
// //
const res = await detailContract({ id: row.id }) const res = await detailContract({ id: row.id })
if (res) { if (res) {
console.log('detail', res)
this.$refs['paymentRegistration'].getContract(row) this.$refs['paymentRegistration'].getContract(row)
this.$refs['paymentRegistration'].isShowPaymentRegistration = true this.$refs['paymentRegistration'].isShowPaymentRegistration = true
} else { } else {

Loading…
Cancel
Save