|  |  | 
 |  |  |                             </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" | 
 |  |  | 
 |  |  |             <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" | 
 |  |  | 
 |  |  |   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' | 
 |  |  |   export default { | 
 |  |  |     name: "terminateLease", | 
 |  |  |     components: { | 
 |  |  | 
 |  |  |         agentList: [], | 
 |  |  |  | 
 |  |  |         receivable: '', | 
 |  |  |         meet: '' | 
 |  |  |         meet: '', | 
 |  |  |          | 
 |  |  |         loading: false | 
 |  |  |       } | 
 |  |  |     }, | 
 |  |  |     watch: { | 
 |  |  | 
 |  |  |         this.title = title | 
 |  |  |         this.info = info | 
 |  |  |         this.form.id = info.id | 
 |  |  |         this.info.billList.forEach(item => { | 
 |  |  |         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.getUser() | 
 |  |  |         this.visible = true | 
 |  |  |       }, | 
 |  |  |       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, | 
 |  |  |           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 | 
 |  |  |             } | 
 |  |  |           }) | 
 |  |  |         }).finally(() => { | 
 |  |  |           this.loading = false | 
 |  |  |         }) | 
 |  |  |       }, | 
 |  |  |       getObjS (obj) { | 
 |  |  |         this.info.terminateList.push(obj) | 
 |  |  | 
 |  |  |           row.price = 0 | 
 |  |  |           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 | 
 |  |  |             console.log('billTypeCopy', 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); | 
 |  |  |         } | 
 |  |  |       } | 
 |  |  |     } |