From c9ad1f34a86e54b1c690c623ba661cd4131a3d71 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期四, 28 十一月 2024 18:43:32 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/funingyunwei
---
admin/src/views/contract/components/terminateLease.vue | 442 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 442 insertions(+), 0 deletions(-)
diff --git a/admin/src/views/contract/components/terminateLease.vue b/admin/src/views/contract/components/terminateLease.vue
new file mode 100644
index 0000000..ed32531
--- /dev/null
+++ b/admin/src/views/contract/components/terminateLease.vue
@@ -0,0 +1,442 @@
+<template>
+ <GlobalWindow
+ :title="title"
+ width="100%"
+ :visible.sync="visible"
+ :confirm-working="isWorking"
+ @close="close"
+ @confirm="confirm">
+ <div class="main">
+ <div class="main_head">
+ <span>绉熷锛歿{ info.renterName }}</span>
+ <span>鍚堝悓缂栧彿锛歿{ info.code }}</span>
+ </div>
+ <div class="title">閫�绉熶俊鎭�</div>
+ <div class="main_box">
+ <div class="main_box_form">
+ <el-form :inline="true" label-position="top" :model="form" ref="form" :rules="rules" class="demo-form-inline">
+ <el-form-item label="閫�绉熺被鍨�" prop="btType" style="width: 33%;">
+ <el-select v-model="form.btType" placeholder="璇烽�夋嫨">
+ <el-option label="鍒版湡閫�绉�" :value="0"></el-option>
+ <el-option label="鎹㈡埧閫�绉�" :value="1"></el-option>
+ <el-option label="杩濈害閫�绉�" :value="2"></el-option>
+ <el-option label="鍗忓晢閫�绉�" :value="3"></el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="閫�绉熸棩鏈�" prop="btDate" style="width: 33%;">
+ <el-date-picker
+ v-model="form.btDate"
+ type="date"
+ value-format="yyyy-MM-dd"
+ placeholder="璇烽�夋嫨">
+ </el-date-picker>
+ </el-form-item>
+ <el-form-item label="缁忓姙浜�" prop="btUserId" style="width: 30%;">
+ <el-select v-model="form.btUserId" placeholder="璇烽�夋嫨">
+ <el-option v-for="(item, index) in agentList" :key="index" :value="item.id" :label="item.realname"></el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鍗忚绛捐鏃ユ湡" prop="btSignDate" style="width: 33%;">
+ <el-date-picker
+ v-model="form.btSignDate"
+ type="date"
+ value-format="yyyy-MM-dd"
+ placeholder="璇烽�夋嫨">
+ </el-date-picker>
+ </el-form-item>
+ <el-form-item label="閫�绉熷師鍥�" prop="btInfo" style="width: 60%;">
+ <el-input v-model="form.btInfo" placeholder="璇疯緭鍏�"></el-input>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div class="main_box_list">
+ <div class="main_box_list_title">宸查�夋埧婧�</div>
+ <el-table :data="info.roomList" stripe>
+ <el-table-column prop="projectName" label="椤圭洰鍚嶇О" show-overflow-tooltip />
+ <el-table-column label="鎴挎簮鍚嶇О" show-overflow-tooltip>
+ <template slot-scope="{row}">
+ {{row.buildingName}}/{{row.code}}
+ </template>
+ </el-table-column>
+ <el-table-column label="绉熻祦闈㈢Н(銕�)" show-overflow-tooltip>
+ <template slot-scope="{row}">
+ {{row.area}}銕�
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
+ </div>
+ <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>
+ </div>
+ </div>
+ <el-table
+ :data="info.terminateList"
+ border
+ style="width: 100%; margin-bottom: 15px;">
+ <el-table-column
+ prop="code"
+ label="璐﹀崟缂栧彿">
+ </el-table-column>
+ <el-table-column
+ label="璐圭敤绫诲瀷">
+ <template slot-scope="{row}">
+ <span v-if="row.costType === 0">绉熻祦璐�</span>
+ <span v-if="row.costType === 1">鐗╀笟璐�</span>
+ <span v-if="row.costType === 4">姘寸數璐�</span>
+ <span v-if="row.costType === 5">鏉傞」璐�</span>
+ <span v-if="row.costType === 6">鍏朵粬</span>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="璁¤垂鍛ㄦ湡">
+ <template slot-scope="{row}">
+ {{row.startDate}} ~ {{row.endDate}}
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="搴旀敹浠橀噾棰�/鍘熷搴旀敹浠�">
+ <template v-slot="{row}">
+ <div style="display: flex; align-items: center;">
+ <el-input v-model="row.receivableFee" @input="changeReceivableFee($event, row)" placeholder="璇疯緭鍏ュ唴瀹�" style="width: 90px;"></el-input>
+ <span style="margin: 0 10px;">/</span>
+ {{row.receivableFeeCopy}}
+ </div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="actReceivableFee"
+ label="瀹炴敹/浠橀噾棰�">
+ </el-table-column>
+ <el-table-column
+ label="闇�鏀�/浠橀噾棰�">
+ <template slot-scope="{row}">
+ <div style="display: flex; align-items: center;">
+ <el-tag type="success" v-if="row.billType === 0">鏀�</el-tag>
+ <el-tag type="warning" v-if="row.billType === 1">浠�</el-tag>
+ <span style="margin-left: 10px;">{{row.price}}</span>
+ </div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="搴旀敹/浠樻棩鏈�">
+ <template slot-scope="{row}">
+ <el-date-picker v-model="row.planPayDate" value-format="yyyy-MM-dd" type="date" placeholder="閫夋嫨鏃ユ湡"></el-date-picker>
+ </template>
+ </el-table-column>
+ </el-table>
+ <div class="title">鎶奸噾</div>
+ <el-table
+ :data="info.depositList"
+ border
+ style="width: 100%; margin-bottom: 15px;">
+ <el-table-column
+ prop="code"
+ label="璐﹀崟缂栧彿">
+ </el-table-column>
+ <el-table-column
+ label="璐圭敤绫诲瀷">
+ <template slot-scope="{row}">
+ <span v-if="row.costType === 2">绉熻祦鎶奸噾</span>
+ <span v-if="row.costType === 3">鐗╀笟鎶奸噾</span>
+ <span v-if="row.costType === 7">淇濊瘉閲�</span>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="璁¤垂鍛ㄦ湡">
+ <template slot-scope="{row}">
+ {{row.startDate}} ~ {{row.endDate}}
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="receivableFee"
+ label="搴旀敹閲戦">
+ </el-table-column>
+ <el-table-column
+ prop="actReceivableFee"
+ label="瀹炴敹/浠橀噾棰�">
+ </el-table-column>
+ <el-table-column
+ label="搴旈��閲戦">
+ <template slot-scope="{row}">
+ <div style="display: flex; align-items: center;">
+ <el-tag type="success" v-if="row.billType === 0">鏀�</el-tag>
+ <el-tag type="warning" v-if="row.billType === 1">浠�</el-tag>
+ <span style="margin-left: 10px;">{{row.price}}</span>
+ </div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="搴旈��鏃ユ湡">
+ <template slot-scope="{row}">
+ <el-date-picker v-model="row.planPayDate" value-format="yyyy-MM-dd" type="date" placeholder="閫夋嫨鏃ユ湡"></el-date-picker>
+ </template>
+ </el-table-column>
+ </el-table>
+ <div class="footer">
+ 鍚堣搴旀敹锛�<span>{{receivable}}</span>鍏冿紝 鍚堣搴斾粯锛�<span>{{meet}}</span>鍏�
+ </div>
+ </div>
+ <!-- 鍒涘缓鏀舵璐﹀崟 -->
+ <AddCollectionBill ref="addCollectionBill" @getVal="getObjS" />
+ <!-- 鍒涘缓浠樻璐﹀崟 -->
+ <AddPaymentBill ref="AddPaymentBill" @getVal="getObjS" />
+ </GlobalWindow>
+</template>
+
+<script>
+ import GlobalWindow from '@/components/common/GlobalWindow'
+ import BaseOpera from '@/components/base/BaseOpera'
+ import AddCollectionBill from './addCollectionBill'
+ import AddPaymentBill from './addPaymentBill'
+ import { getUserList } from '@/api/system/user'
+ import { backRent } from '@/api/contract'
+ export default {
+ name: "terminateLease",
+ components: {
+ GlobalWindow,
+ AddCollectionBill,
+ AddPaymentBill
+ },
+ extends: BaseOpera,
+ data() {
+ return {
+ info: {},
+ form: {
+ id: null,
+ btType: '',
+ btDate: '',
+ btUserId: '',
+ btSignDate: '',
+ btInfo: ''
+ },
+ rules: {
+ btType: [
+ { required: true, message: '璇烽�夋嫨', trigger: 'blur' }
+ ],
+ btDate: [
+ { required: true, message: '璇烽�夋嫨', trigger: 'blur' }
+ ],
+ btUserId: [
+ { required: true, message: '璇烽�夋嫨', trigger: 'blur' }
+ ],
+ signDate: [
+ { required: true, message: '璇烽�夋嫨', trigger: 'blur' }
+ ],
+ btInfo: [
+ { required: true, message: '璇疯緭鍏�', trigger: 'blur' }
+ ]
+ },
+
+ list: [],
+
+ agentList: [],
+
+ receivable: '',
+ meet: ''
+ }
+ },
+ 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
+ }
+ }
+ },
+ methods: {
+ open (title, info) {
+ this.title = title
+ this.info = info
+ this.form.id = info.id
+ this.info.billList.forEach(item => {
+ this.$set(item, 'receivableFeeCopy', item.receivableFee)
+ if ([2,3,7].includes(item.costType)) {
+ this.$set(item, 'price', item.actReceivableFee)
+ } else {
+ this.$set(item, 'price', item.receivableFee)
+ }
+ })
+ this.info.terminateList = this.info.canBackRentBills.filter(item => {
+ if ([0,1,4,5,6].includes(item.costType)) {
+ item.billTypeCopy = item.billType
+ return item
+ }
+ })
+ this.info.depositList = this.info.canBackRentBills.filter(item => {
+ if ([2,3,7].includes(item.costType)) {
+ item.billTypeCopy = item.billType
+ return item
+ }
+ })
+ this.getUser()
+ this.visible = true
+ },
+ getObjS (obj) {
+ this.info.terminateList.push(obj)
+ this.info.terminateList.forEach(item => {
+ item.receivableFee = Number(item.receivableFee) + 1
+ item.receivableFee = Number(item.receivableFee) - 1
+ })
+ },
+ confirm () {
+ this.$refs.form.validate((valid) => {
+ if (!valid) {
+ return
+ }
+ this.isWorking = true
+ let canBackRentBills = []
+ let addBillList = []
+ this.info.terminateList.forEach(item => {
+ if (item.rowType && item.rowType === 1) {
+ addBillList.push(item)
+ } else {
+ canBackRentBills.push(item)
+ }
+ })
+ backRent({
+ ...this.form,
+ canBackRentBills: [...canBackRentBills, ...this.info.depositList],
+ addBillList
+ })
+ .then(res => {
+ this.visible = false
+ this.$tip.apiSuccess('鎿嶄綔鎴愬姛')
+ this.$emit('success')
+ })
+ .finally(() => {
+ this.isWorking = false
+ })
+ })
+ },
+ getUser () {
+ getUserList({})
+ .then(res => {
+ this.agentList = res
+ })
+ },
+ changeReceivableFee (num, row) {
+ if (Number(num) > row.receivableFeeCopy) {
+ row.receivableFee = ''
+ 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
+ } else {
+ row.billType = 0
+ }
+ } else {
+ if (row.price > 0) {
+ row.billType = 1
+ } else if (row.price < 0) {
+ row.billType = 0
+ } else {
+ row.billType = 1
+ }
+ }
+ // 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)
+ }
+ }
+ }
+ }
+ }
+</script>
+
+<style lang="scss" scoped>
+ @import '@/assets/style/variables.scss';
+ .main {
+ width: 100%;
+ .footer {
+ width: 100%;
+ display: flex;
+ align-items: center;
+ font-size: 14px;
+ color: black;
+ span {
+ font-size: 14px;
+ color: $primary-color;
+ }
+ }
+ .main_head {
+ width: 100%;
+ padding: 10px 5px;
+ box-sizing: border-box;
+ display: flex;
+ flex-direction: column;
+ border-bottom: 1px solid #ececec;
+ margin-bottom: 15px;
+ span {
+ color: black;
+ font-size: 16px;
+ font-weight: 500;
+ margin-bottom: 8px;
+ &:last-child {
+ margin: 0 !important;
+ }
+ }
+ }
+ .title {
+ font-weight: 500;
+ font-size: 16px;
+ color: $primary-color;
+ margin-bottom: 15px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ span {
+ font-weight: 500;
+ font-size: 16px;
+ color: $primary-color;
+ }
+ }
+ .main_box {
+ width: 100%;
+ display: flex;
+ align-items: start;
+ margin-bottom: 15px;
+ justify-content: space-between;
+ .main_box_form {
+ flex: 1;
+ margin-right: 20px;
+ }
+ .main_box_list {
+ width: 500px;
+ flex-shrink: 0;
+ .main_box_list_title {
+ font-size: 16px;
+ font-weight: 500;
+ color: $primary-color;
+ margin-bottom: 15px;
+ }
+ }
+ }
+ }
+</style>
--
Gitblit v1.9.3