From 8dcbe3d898f6c60ef3226095d994ca8953bf5f6d Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期二, 03 十二月 2024 18:18:37 +0800 Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/funingyunwei --- admin/src/views/contract/components/terminateLease.vue | 192 ++++++++++++++++++++++++++++++++++------------- 1 files changed, 138 insertions(+), 54 deletions(-) diff --git a/admin/src/views/contract/components/terminateLease.vue b/admin/src/views/contract/components/terminateLease.vue index ed32531..6bb8929 100644 --- a/admin/src/views/contract/components/terminateLease.vue +++ b/admin/src/views/contract/components/terminateLease.vue @@ -27,6 +27,7 @@ <el-date-picker v-model="form.btDate" type="date" + @change="changeBtDate" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨"> </el-date-picker> @@ -69,13 +70,14 @@ <div class="title"> <span>閫�绉熶俊鎭�</span> <div style="display: flex; align-items: center;"> - <el-button type="primary" @click="$refs.addCollectionBill.open('鍒涘缓鏀舵璐﹀崟', { contractCode: info.code, contractId: info.id, renterName: info.renterName, renterId: info.renterId, billType: 0, billTypeCopy: 0, feeType: 0 })">娣诲姞鏀舵</el-button> - <el-button type="primary" @click="$refs.AddPaymentBill.open('鍒涘缓浠樻璐﹀崟', { contractCode: info.code, contractId: info.id, renterName: info.renterName, renterId: info.renterId, billType: 1, billTypeCopy: 1 })">娣诲姞浠樻</el-button> + <el-button type="primary" @click="addZD">娣诲姞鏀舵</el-button> + <el-button type="primary" @click="addFK">娣诲姞浠樻</el-button> </div> </div> <el-table :data="info.terminateList" border + v-loading="loading" style="width: 100%; margin-bottom: 15px;"> <el-table-column prop="code" @@ -193,13 +195,17 @@ import AddCollectionBill from './addCollectionBill' import AddPaymentBill from './addPaymentBill' import { getUserList } from '@/api/system/user' - import { backRent } from '@/api/contract' + import { backRent, getCanBackBill } from '@/api/contract' + import { mapState } from 'vuex' export default { name: "terminateLease", components: { GlobalWindow, AddCollectionBill, AddPaymentBill + }, + computed: { + ...mapState(['userInfo']) }, extends: BaseOpera, data() { @@ -236,63 +242,142 @@ agentList: [], receivable: '', - meet: '' + meet: '', + + loading: false } }, watch: { - info: { - deep: true, - immediate: true, - handler(news, olds) { - const arr = [...this.info.terminateList, ...this.info.depositList] - let total1 = 0 - let total2 = 0 - arr.forEach(item => { - if (item.billType === 0) { - total1 += Number(item.price) - } else if (item.billType === 1) { - total2 += Number(item.price) - } - }) - this.receivable = total1 - this.meet = total2 - } - } + // info: { + // deep: true, + // immediate: true, + // handler(news, olds) { + // const arr = [...this.info.terminateList, ...this.info.depositList] + // let total1 = 0 + // let total2 = 0 + // arr.forEach(item => { + // if (item.billType === 0) { + // total1 += Number(item.price) + // } else if (item.billType === 1) { + // total2 += Number(item.price) + // } + // }) + // this.receivable = total1 + // this.meet = total2 + // } + // } }, methods: { open (title, info) { this.title = title this.info = info this.form.id = info.id - this.info.billList.forEach(item => { + this.form.btSignDate = this.getDay() + console.log(this.userInfo) + this.form.btUserId = this.userInfo.id + this.$nextTick(() => { + this.$refs.form.resetFields() + }) + this.info.canBackRentBills.forEach(item => { this.$set(item, 'receivableFeeCopy', item.receivableFee) + this.$set(item, 'receivableFee', item.needReceivableFee) if ([2,3,7].includes(item.costType)) { + this.$set(item, 'billType', 1) this.$set(item, 'price', item.actReceivableFee) } else { - this.$set(item, 'price', item.receivableFee) + this.$set(item, 'price', item.needReceivableFee) } }) this.info.terminateList = this.info.canBackRentBills.filter(item => { if ([0,1,4,5,6].includes(item.costType)) { - item.billTypeCopy = item.billType + item.billTypeCopy = JSON.parse(JSON.stringify(item.billType)) return item } }) this.info.depositList = this.info.canBackRentBills.filter(item => { if ([2,3,7].includes(item.costType)) { - item.billTypeCopy = item.billType + item.billTypeCopy = JSON.parse(JSON.stringify(item.billType)) return item } }) + this.countData() this.getUser() this.visible = true }, + countData () { + const arr = [...this.info.terminateList, ...this.info.depositList] + let total1 = 0 + let total2 = 0 + arr.forEach(item => { + if (item.billType === 0) { + total1 += Number(item.price) + } else if (item.billType === 1) { + total2 += Number(item.price) + } + }) + this.receivable = total1 + this.meet = total2 + }, + getDay () { + const today = new Date(); + const year = today.getFullYear(); + const month = today.getMonth() + 1; // 鏈堜唤鏄粠 0 寮�濮嬬殑锛屽洜姝ら渶瑕佸姞 1 + const day = today.getDate(); + return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`; + }, + addZD () { + if (!this.form.btDate) return this.$message.warning('璇烽�夋嫨閫�绉熸棩鏈�') + this.$refs.addCollectionBill.open('鍒涘缓鏀舵璐﹀崟', { + contractCode: this.info.code, + contractId: this.info.id, + renterName: this.info.renterName, + renterId: this.info.renterId, + billType: 0, + billTypeCopy: 0, + feeType: 0 + }, { startDate: this.info.startDate, endDate: this.form.btDate }) + }, + addFK () { + if (!this.form.btDate) return this.$message.warning('璇烽�夋嫨閫�绉熸棩鏈�') + this.$refs.AddPaymentBill.open('鍒涘缓浠樻璐﹀崟', { + contractCode: this.info.code, + contractId: this.info.id, + renterName: this.info.renterName, + renterId: this.info.renterId, + billType: 1, + feeType: 0, + billTypeCopy: 1 + }, { startDate: this.info.startDate, endDate: this.form.btDate }) + }, + changeBtDate (planPayDateEnd) { + this.loading = true + getCanBackBill({ + contractId: this.info.id, + planPayDateEnd + }).then(res => { + res.forEach(item => { + this.$set(item, 'receivableFeeCopy', item.receivableFee) + this.$set(item, 'receivableFee', item.needReceivableFee) + this.$set(item, 'price', item.needReceivableFee) + }) + this.info.terminateList = res.filter(item => { + if ([0,1,4,5,6].includes(item.costType)) { + item.billTypeCopy = JSON.parse(JSON.stringify(item.billType)) + return item + } + }) + this.countData() + }).finally(() => { + this.loading = false + }) + }, getObjS (obj) { this.info.terminateList.push(obj) - this.info.terminateList.forEach(item => { - item.receivableFee = Number(item.receivableFee) + 1 - item.receivableFee = Number(item.receivableFee) - 1 - }) + // this.info.terminateList.forEach(item => { + // item.receivableFee = Number(item.receivableFee) + 1 + // item.receivableFee = Number(item.receivableFee) - 1 + // }) + this.countData() }, confirm () { this.$refs.form.validate((valid) => { @@ -334,36 +419,35 @@ if (Number(num) > row.receivableFeeCopy) { row.receivableFee = '' row.price = 0 + this.countData() this.$message.warning('涓嶈兘澶т簬鍘熷搴旀敹浠橀噾棰�') } else { - row.price = Number(num) - row.actReceivableFee - // 鏀� - if (row.billTypeCopy === 0) { - if (row.price > 0) { - row.billType = 0 - } else if (row.price < 0) { - row.billType = 1 + if (num) { + row.price = Number(num) - row.actReceivableFee + // 鏀� + if (row.billTypeCopy === 0) { + if (row.price > 0) { + row.billType = 0 + } else if (row.price < 0) { + row.billType = 1 + } else { + row.billType = 0 + } } else { - row.billType = 0 + if (row.price > 0) { + row.billType = 1 + } else if (row.price < 0) { + row.billType = 0 + } else { + row.billType = 1 + } } } else { - if (row.price > 0) { - row.billType = 1 - } else if (row.price < 0) { - row.billType = 0 - } else { - row.billType = 1 - } + row.price = 0 + row.billType = row.billTypeCopy } - // if (row.price > 0) { - // row.billType = 0 - // } else if (row.price < 0) { - // row.billType = 1 - // } - row.price = String(row.price) - if (row.price.indexOf('-') > 0) { - row.price = row.price.substring(0, row.price.length) - } + row.price = Math.abs(row.price); + this.countData() } } } -- Gitblit v1.9.3