|  |  |  | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="退租日期" prop="btDate" style="width: 33%;"> | 
|---|
|  |  |  | <!--                            @change="changeBtDate"--> | 
|---|
|  |  |  | <el-date-picker | 
|---|
|  |  |  | v-model="form.btDate" | 
|---|
|  |  |  | type="date" | 
|---|
|  |  |  | 
|---|
|  |  |  | </el-table-column> | 
|---|
|  |  |  | </el-table> | 
|---|
|  |  |  | <div class="footer"> | 
|---|
|  |  |  | 合计应收:<span>{{receivable}}</span>元, 合计应付:<span>{{meet}}</span>元 | 
|---|
|  |  |  | 合计应收:<span>{{receivable.toFixed(2)}}</span>元, 合计应付:<span>{{meet.toFixed(2)}}</span>元 | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!--    创建收款账单    --> | 
|---|
|  |  |  | 
|---|
|  |  |  | import AddPaymentBill from './addPaymentBill' | 
|---|
|  |  |  | import { getUserList } from '@/api/system/user' | 
|---|
|  |  |  | import { backRent, getCanBackBill } from '@/api/contract' | 
|---|
|  |  |  | import { mapState } from 'vuex' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: "terminateLease", | 
|---|
|  |  |  | components: { | 
|---|
|  |  |  | GlobalWindow, | 
|---|
|  |  |  | AddCollectionBill, | 
|---|
|  |  |  | AddPaymentBill | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | computed: { | 
|---|
|  |  |  | ...mapState(['userInfo']) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | extends: BaseOpera, | 
|---|
|  |  |  | data() { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 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.form.btSignDate = this.getDay() | 
|---|
|  |  |  | console.log(this.userInfo) | 
|---|
|  |  |  | this.form.btUserId = this.userInfo.id | 
|---|
|  |  |  | this.$nextTick(() => { | 
|---|
|  |  |  | this.$refs.form.resetFields() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | 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('请选择退租日期') | 
|---|
|  |  |  | 
|---|
|  |  |  | renterName: this.info.renterName, | 
|---|
|  |  |  | renterId: this.info.renterId, | 
|---|
|  |  |  | billType: 1, | 
|---|
|  |  |  | feeType: 0, | 
|---|
|  |  |  | billTypeCopy: 1 | 
|---|
|  |  |  | }, { startDate: this.info.startDate, endDate: this.form.btDate }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) => { | 
|---|
|  |  |  | 
|---|
|  |  |  | if (Number(num) > row.receivableFeeCopy) { | 
|---|
|  |  |  | row.receivableFee = '' | 
|---|
|  |  |  | row.price = 0 | 
|---|
|  |  |  | this.countData() | 
|---|
|  |  |  | this.$message.warning('不能大于原始应收付金额') | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (num) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | row.price = 0 | 
|---|
|  |  |  | row.billType = row.billTypeCopy | 
|---|
|  |  |  | console.log('billTypeCopy', row.billTypeCopy) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | row.price = Math.abs(row.price); | 
|---|
|  |  |  | this.countData() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|