From 50545d42bf8b2c7d4438f5fe605272be726c7b48 Mon Sep 17 00:00:00 2001
From: GULIMMO <2820890765@qq.com>
Date: Thu, 02 Nov 2023 18:13:23 +0800
Subject: [PATCH] 租户上报、新增租赁页面修改

---
 api/doorplateAddress/doorplateAddress.js   |   12 
 subPackage/bs/views/zhsb.vue               |  252 +++++++++---------
 pages.json                                 |   10 
 subPackage/bs/views/rentDetail.vue         |  259 +++++++++++++----
 subPackage/bs/components/list/rentList.vue |  251 +++++++++++------
 api/houseRental/houseRental.js             |   37 ++
 6 files changed, 529 insertions(+), 292 deletions(-)

diff --git a/api/doorplateAddress/doorplateAddress.js b/api/doorplateAddress/doorplateAddress.js
index 28c559c..537702d 100644
--- a/api/doorplateAddress/doorplateAddress.js
+++ b/api/doorplateAddress/doorplateAddress.js
@@ -14,7 +14,7 @@
 // 获取社区信息
 export const getHouseList = (type, name) => {
 	return http.request({
-		url: '/blade-doorplateAddress/doorplateAddress/getHousesList',
+		url: 'blade-doorplateAddress/doorplateAddress/getHousesList',
 		method: 'GET',
 		params: {
 			type,
@@ -26,7 +26,7 @@
 // 获取当前楼栋信息
 export const getHouseInfoList = (type, code) => {
 	return http.request({
-		url: '/blade-doorplateAddress/doorplateAddress/getHousesList',
+		url: 'blade-doorplateAddress/doorplateAddress/getHousesList',
 		method: 'GET',
 		params: {
 			type,
@@ -38,7 +38,7 @@
 // 获取当前房屋出租信息
 export const getHouseRentInfo = (code) => {
 	return http.request({
-		url: '/blade-doorplateAddress/doorplateAddress/getHouseRentInfo',
+		url: 'blade-doorplateAddress/doorplateAddress/getHouseRentInfo',
 		method: 'GET',
 		params: {
 			code
@@ -49,7 +49,7 @@
 // 获取房屋标签信息
 export const getHouseLabelList = () => {
 	return http.request({
-		url: '/blade-label/label/getLabelList',
+		url: 'blade-label/label/getLabelList',
 		method: 'GET',
 		params: {
 			parentId: 1001
@@ -60,7 +60,7 @@
 // 获取房屋详细信息
 export const getHouseDetail = (houseCode) => {
 	return http.request({
-		url: '/blade-house/house/getHouseDetail',
+		url: 'blade-house/house/getHouseDetail',
 		method: 'GET',
 		params: {
 			houseCode
@@ -80,7 +80,7 @@
 
 export const uploadFile = (data) => {
 	return http.request({
-		url: '/blade-resource/oss/endpoint/put-file',
+		url: 'blade-resource/oss/endpoint/put-file',
 		method: 'post',
 		custom: {
 			Authorization: true
diff --git a/api/houseRental/houseRental.js b/api/houseRental/houseRental.js
new file mode 100644
index 0000000..76917c0
--- /dev/null
+++ b/api/houseRental/houseRental.js
@@ -0,0 +1,37 @@
+import http from '@/http/api.js'
+
+//删除
+export const deleteRentalInfo = (id) => {
+	return http.request({
+		url: 'blade-houseRental/houseRental/removeHouseRental',
+		method: 'POST',
+		params: {
+			id
+		}
+	})
+}
+
+// 续租
+export const updateDueTime = (data) => {
+	return http.request({
+		url: 'blade-houseRental/houseRental/update',
+		method: 'POST',
+		custom: {
+			'Authorization': true
+		},
+		data
+	})
+}
+
+// 修改数据
+// 续租
+export const updateRetalInfo = (data) => {
+	return http.request({
+		url: '/blade-houseRental/houseRental/updateHouseRental',
+		method: 'POST',
+		custom: {
+			'Authorization': true
+		},
+		data
+	})
+}
\ No newline at end of file
diff --git a/pages.json b/pages.json
index a15d4b4..1cab088 100644
--- a/pages.json
+++ b/pages.json
@@ -106,9 +106,9 @@
 				{
 					"path": "views/zhsb",
 					"style": {
-						"navigationBarTitleText": "出租管理",
-						"navigationBarBackgroundColor": "#4586fe",
-						"navigationBarTextStyle": "white",
+						"navigationBarTitleText": "租客上报",
+						"navigationBarBackgroundColor": "#fff",
+						"navigationBarTextStyle": "black",
 						"enablePullDownRefresh": false
 					}
 				},
@@ -116,8 +116,8 @@
 					"path": "views/rentDetail",
 					"style": {
 						"navigationBarTitleText": "租户详情",
-						"navigationBarBackgroundColor": "#4586fe",
-						"navigationBarTextStyle": "white",
+						"navigationBarBackgroundColor": "#fff",
+						"navigationBarTextStyle": "black",
 						"enablePullDownRefresh": false
 					}
 				}
diff --git a/subPackage/bs/components/list/rentList.vue b/subPackage/bs/components/list/rentList.vue
index 204c455..775b31a 100644
--- a/subPackage/bs/components/list/rentList.vue
+++ b/subPackage/bs/components/list/rentList.vue
@@ -1,92 +1,161 @@
-<template>
-	<view class="list-container">
-
-		<view class="item" v-for="(item, index) in list" :key="index">
-			<view class="line">
-				<view class="l">租客:{{item.name}} {{`(共${item.num}人)`}}</view>
-				<view class="r">
-					<u-icon name="trash-fill" color="#ff0000" size="18"></u-icon>
-				</view>
-			</view>
-
-			<view class="line">
-				<view class="l">{{item.startTime}} - {{item.endTime}}</view>
-				<view class="r status">
-					{{item.status}}
-				</view>
-			</view>
-
-			<view class="list-btn">
-				<u-button :customStyle="btnCustomStyle" color="#cdf3df" type="primary" text="修改"></u-button>
-			</view>
-
-		</view>
-
-		<view class="tip">
-			<u-divider text="已经到底了"></u-divider>
-		</view>
-	</view>
-</template>
-
-<script>
-	export default {
-		props: {
-			list: {
-				type: Array,
-				default: () => []
-			}
-		},
-		data() {
-			return {
-				btnCustomStyle: {
-					color: "#6dc160",
-					fontWeight: "700"
-				}
-			}
-		},
-		created() {
-
-		},
-		mounted() {
-
-		},
-		onLoad(option) {
-
-		},
-		onShow() {
-
-		},
-		methods: {
-
-		}
-	}
-</script>
-
-<style scoped lang="scss">
-	.list-container {
-
-		.item {
-			background-color: #ffffff;
-			margin: 20rpx 0;
-
-			.line {
-				display: flex;
-				align-items: center;
-				justify-content: space-between;
-				padding: 14rpx;
-
-				.status {
-					color: #6dc160
-				}
-
-			}
-
-			.list-btn {
-				padding: 24rpx;
-			}
-		}
-
-		.tip {}
-
-	}
+<template>
+	<view class="list-container">
+
+		<view class="item" v-for="(item, index) in list" :key="index">
+			<view class="line">
+				<view class="l">租客:{{item.name}} (<text>{{`共${item.num}人`}}</text>)</view>
+				<view class="r">
+					<u-icon name="trash-fill" color="#ff0000" size="18" @click="deleteRental(item)"></u-icon>
+				</view>
+			</view>
+
+			<view class="line">
+				<view class="l">{{item.rentalTime}} - {{item.dueTime}}</view>
+				<view class="r status">
+					{{item.status}}
+				</view>
+			</view>
+
+			<view class="list-btn">
+				<u-button icon="edit-pen" class="btn-item" type="primary" plain text="修改"
+					@click="pushPage(item)"></u-button>
+				<u-button icon="calendar" class="btn-item" type="primary" plain text="续租"
+					@click="xzHandleClick(item)"></u-button>
+				<u-button icon="order" class="btn-item" type="primary" plain text="终止"
+					@click="terminate(item)"></u-button>
+			</view>
+
+		</view>
+
+		<view class="tip">
+			<u-divider text="已经到底了"></u-divider>
+		</view>
+
+		<u-datetime-picker :show="isPickerShow" @cancel="isPickerShow = false" mode="date"
+			@confirm="dueTimeConfirm"></u-datetime-picker>
+		<u-datetime-picker :show="istPickerShow" @cancel="istPickerShow = false" mode="date"
+			@confirm="terminateTimeConfirm"></u-datetime-picker>
+		<u-modal :show="isModelShow" width="auto" :showCancelButton="true" title="提示" content="请确认是否删除当前租户信息"
+			@cancel="isModelShow = false" @confirm="deleteRentalConfirm"></u-modal>
+	</view>
+</template>
+
+<script>
+	import {
+		deleteRentalInfo,
+		updateDueTime
+	} from "@/api/houseRental/houseRental.js";
+	export default {
+		props: {
+			list: {
+				type: Array,
+				default: () => []
+			}
+		},
+		data() {
+			return {
+				isPickerShow: false,
+				istPickerShow: false,
+				currentRentalId: '',
+				isModelShow: false
+			}
+		},
+		methods: {
+			deleteRental(item) {
+				this.currentRentalId = item.housingRentalId
+				this.isModelShow = true
+			},
+			async deleteRentalConfirm() {
+				const {
+					code,
+					data
+				} = await deleteRentalInfo(this.currentRentalId)
+				console.log(code, data)
+				this.isModelShow = false
+			},
+			pushPage(item) {
+				const {
+					houseCode
+				} = this.$route.query
+				const {
+					id
+				} = item
+				this.$u.func.globalNavigator(
+					`/subPackage/bs/views/rentDetail?houseCode=${houseCode}&id=${id}`)
+			},
+			xzHandleClick(item) {
+				this.currentRentalId = item.housingRentalId
+				this.isPickerShow = true
+			},
+			async dueTimeConfirm(e) {
+				const time = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
+				const res = await updateDueTime({
+					id: this.currentRentalId,
+					dueTime: time
+				})
+				this.isPickerShow = false
+			},
+			async terminate(item) {
+				this.currentRentalId = item.housingRentalId
+				this.istPickerShow = true
+			},
+			async terminateTimeConfirm(e) {
+				const time = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
+				const res = await updateDueTime({
+					id: this.currentRentalId,
+					terminationTime: time
+				})
+				this.isPickerShow = false
+			}
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.list-container {
+
+		.item {
+			background-color: #ffffff;
+			margin: 20rpx 0;
+
+			.line {
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+				padding: 20rpx;
+
+				&:nth-child(1) {
+					border: 1rpx solid #F6F6F6;
+				}
+
+				.l {
+					font-weight: 700;
+
+					text {
+						color: #0682EF;
+					}
+				}
+
+				.status {
+					color: #6dc160
+				}
+
+			}
+
+			.list-btn {
+				padding: 24rpx;
+				display: flex;
+
+				.btn-item {
+					margin: 0 10rpx;
+					border: 0;
+					color: #009FFF;
+					font-weight: 700;
+				}
+			}
+		}
+
+		.tip {}
+
+	}
 </style>
\ No newline at end of file
diff --git a/subPackage/bs/views/rentDetail.vue b/subPackage/bs/views/rentDetail.vue
index 738aa9e..5d2a033 100644
--- a/subPackage/bs/views/rentDetail.vue
+++ b/subPackage/bs/views/rentDetail.vue
@@ -1,23 +1,20 @@
 <template>
 	<view class="container">
 		<u-form labelWidth="70" :model="form" :rules="rules" ref="form">
-			<view class="box-title">
-				<box-title title="基础信息"></box-title>
-			</view>
 			<view class="basic-info">
-				<u-form-item @click="showSelectBus(dataList.relation, '租客关系', 'relationName','relation')"
+				<u-form-item @click="showSelectBus(dataList.relation, '租客关系', 'relationName', 'relation')"
 					class="form-item" labelWidth="100" label="租客关系" required prop="type">
 					<u--input border="none" v-model="relationName" disabled disabledColor="#ffffff" placeholder="请选择">
 					</u--input>
 					<u-icon slot="right" name="arrow-right"></u-icon>
 				</u-form-item>
-				<u-form-item @click="showSelectBus(dataList.houseType, '房屋状态', 'houseTypeName','houseType')"
+				<u-form-item @click="showSelectBus(dataList.houseType, '房屋状态', 'houseTypeName', 'houseType')"
 					class="form-item" labelWidth="100" label="房屋状态:" required prop="type">
 					<u--input border="none" v-model="houseTypeName" disabled disabledColor="#ffffff" placeholder="请选择">
 					</u--input>
 					<u-icon slot="right" name="arrow-right"></u-icon>
 				</u-form-item>
-				<u-form-item @click="showSelectBus(dataList.rentalUse, '租房用途', 'rentalUseName','rentalUse')"
+				<u-form-item @click="showSelectBus(dataList.rentalUse, '租房用途', 'rentalUseName', 'rentalUse')"
 					class="form-item" labelWidth="100" label="租房用途:" required prop="type">
 					<u--input border="none" v-model="rentalUseName" disabled disabledColor="#ffffff" placeholder="请选择">
 					</u--input>
@@ -29,28 +26,31 @@
 					</u--input>
 					<u-icon slot="right" name="arrow-right"></u-icon>
 				</u-form-item>
+				<u-form-item @click="dueTimeShow = true" class="form-item" labelWidth="100" label="到期时间:" required
+					prop="type">
+					<u--input border="none" v-model="form.dueTime" disabled disabledColor="#ffffff" placeholder="请选择">
+					</u--input>
+					<u-icon slot="right" name="arrow-right"></u-icon>
+				</u-form-item>
+				<view class="pic">
+					<view class="title">合同上传</view>
+					<u-upload :fileList="imagesList" :previewFullImage="uploadConfig.previewFullImage"
+						:accept="uploadConfig.acceptImg" :multiple="uploadConfig.multiple"
+						:maxCount="uploadConfig.maxCount" :capture="uploadConfig.capture" @afterRead="afterReadImg"
+						@delete="deletePic">
+					</u-upload>
+				</view>
 			</view>
-			<view class="box-title">
-				<box-title title="合同上传"></box-title>
-			</view>
-
-			<view class="pic">
-
-				<u-upload :fileList="imagesList"
-					:previewFullImage="uploadConfig.previewFullImage" :accept="uploadConfig.acceptImg"
-					:multiple="uploadConfig.multiple" :maxCount="uploadConfig.maxCount" :capture="uploadConfig.capture"
-					@afterRead="afterReadImg" @delete="deletePic">
-				</u-upload>
-			</view>
-
 			<view class="rent-info">
-				<view v-for="item in rentFormNum" :key="item">
+				<view v-for="(item, index) in rentFormNum" :key="item" class="rent-box">
 					<view class="box-title">
-						<box-title :title="'租客信息-#'+item">
-							<template #titleMore v-if="item !== 1">
-								<u-icon size="25" name="trash" color='#EF0724'></u-icon>
-							</template>
-						</box-title>
+						<view class="l">
+							<view class="line"></view>
+							<view class="title">{{ '租客信息-#' + item }}</view>
+						</view>
+						<view class="r" v-if="index === 1">
+							<u-icon name="trash-fill" color="#ff0000" size="20" @click="decRentForm"></u-icon>
+						</view>
 					</view>
 					<rentForm ref="rentform" />
 				</view>
@@ -65,17 +65,15 @@
 			:popupTitle="selectBusTitle" :dataLists="selectBusList" @cancel="typeShow = false" @submit="typeSelect">
 		</select-bus>
 		<!--出租时间选择-->
-		<u-datetime-picker :show="rentTimeShow" v-model="form.rentTime" mode="date"
-			@confirm="rentTimeShow = false"></u-datetime-picker>
-
+		<u-datetime-picker :show="rentTimeShow" mode="date" @confirm="rentTimeConfirm"
+			@cancel="rentTimeShow = false"></u-datetime-picker>
+		<u-datetime-picker :show="dueTimeShow" mode="date" @confirm="dueTimeConfirm"
+			@cancel="dueTimeShow = false"></u-datetime-picker>
 
 		<view class="bottom-tools">
-			<u-button plain class="btn-item" type="success" @click="addRentForm">再加一人</u-button>
-			<u-button class="btn-item" type="error" @click="decRentForm">删除</u-button>
-			<u-button class="btn-item" type="primary" @click="save">保存</u-button>
+			<u-button class="btn-item" @click="addRentForm">再加一人</u-button>
+			<u-button class="btn-item" @click="saveOrUpdate">{{ rentId === '' ? "保存" : "确认修改" }}</u-button>
 		</view>
-
-
 	</view>
 </template>
 
@@ -84,9 +82,19 @@
 	import rentForm from '../components/form/rentForm.vue'
 	import uploadMixin from "@/mixin/uploadMixin";
 	import {
-		uploadFile,
-		addHouseRental
+		uploadFile,
+		addHouseRental,
+		getHouseRentInfo,
 	} from "@/api/doorplateAddress/doorplateAddress";
+	import {
+		updateRetalInfo
+	} from '@/api/houseRental/houseRental.js'
+	import {
+		data
+	} from "uview-ui/libs/mixin/mixin";
+	import {
+		update
+	} from "../../../api/system/role";
 	export default {
 		mixins: [uploadMixin],
 		components: {
@@ -98,10 +106,12 @@
 				form: {
 					relation: "",
 					rentTime: "",
+					dueTime: "",
 				},
 				imagesList: [],
 				rules: {},
 				rentTimeShow: false,
+				dueTimeShow: false,
 				rentFormNum: 1,
 				relationName: "",
 				houseTypeName: "",
@@ -148,19 +158,21 @@
 				selectBusModel: '',
 				selectBusKey: '',
 				typeShow: false,
-				houseCode: ''
+				houseCode: '',
+				rentId: ''
 			}
 		},
-		created() {
-
-		},
-		mounted() {
-
-		},
 		onLoad(option) {
-			this.houseCode = option.houseCode
-		},
-		onShow() {
+			const {
+				id,
+				houseCode
+			} = option
+			this.houseCode = houseCode
+			// 使用id来判断是不是修改
+			if (id !== void 0) {
+				this.rentId = id
+				this.getCurrentRentInfo()
+			}
 
 		},
 		methods: {
@@ -177,6 +189,16 @@
 				this.form[this.selectBusKey] = item.value
 				this.typeShow = !this.typeShow
 			},
+			rentTimeConfirm(e) {
+				const time = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
+				this.form.rentTime = time
+				this.rentTimeShow = false
+			},
+			dueTimeConfirm(e) {
+				const time = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
+				this.form.dueTime = time
+				this.dueTimeShow = false
+			},
 			beforeUpload(e) {
 				console.log(e)
 				return false
@@ -187,25 +209,88 @@
 			decRentForm() {
 				this.rentFormNum > 1 && this.rentFormNum--
 			},
+			saveOrUpdate() {
+				if (this.rentId === '') {
+					this.save()
+					return
+				}
+				this.update()
+			},
 			async save() {
 				let houseTenantVOList = []
 				this.$refs.rentform.forEach(item => {
 					houseTenantVOList.push(item.form)
-				})
-				const relationIndex = this.dataList.relation.findIndex(item => item.name === this.relationName)
-				const statusIndex = this.dataList.houseType.findIndex(item => item.name === this.houseTypeName)
+				})
+				const relationIndex = this.dataList.relation.findIndex(item => item.name === this.relationName)
+				const statusIndex = this.dataList.houseType.findIndex(item => item.name === this.houseTypeName)
 				const rentalIndex = this.dataList.rentalUse.findIndex(item => item.name === this.rentalUseName)
 				let params = {
 					houseCode: this.houseCode,
 					tenantRelationship: this.dataList.relation[relationIndex].value,
-					rentalTime: this.form.rentalTime,
+					rentalTime: this.form.rentTime,
+					dueTime: this.form.dueTime,
 					houseStatus: this.dataList.houseType[statusIndex].value,
 					rentalUse: this.dataList.rentalUse[rentalIndex].value,
 					houseTenantVOList
-				}
-				
-				const res = await addHouseRental(params)
-				console.log(res)
+				}
+
+				const res = await addHouseRental(params)
+			},
+			async update() {
+				let houseTenantVOList = []
+				this.$refs.rentform.forEach(item => {
+					houseTenantVOList.push(item.form)
+				})
+				const relationIndex = this.dataList.relation.findIndex(item => item.name === this.relationName)
+				const statusIndex = this.dataList.houseType.findIndex(item => item.name === this.houseTypeName)
+				const rentalIndex = this.dataList.rentalUse.findIndex(item => item.name === this.rentalUseName)
+				let data = {
+					id: this.rentId,
+					houseCode: this.houseCode,
+					tenantRelationship: this.dataList.relation[relationIndex].value,
+					rentalTime: this.form.rentTime,
+					dueTime: this.form.dueTime,
+					houseStatus: this.dataList.houseType[statusIndex].value,
+					rentalUse: this.dataList.rentalUse[rentalIndex].value,
+					houseTenantVOList
+				}
+				const res = await updateRetalInfo(data)
+			},
+			findObjValue(value, obj) {
+				const res = obj.find(item => {
+					return item.value == value
+				})
+				return res.name
+			},
+			async getCurrentRentInfo() {
+				const {
+					code,
+					data: {
+						houseRentalList
+					}
+				} = await getHouseRentInfo(this.houseCode)
+				const {
+					houseStatus,
+					tenantRelationship,
+					rentalUse,
+					rentalTime,
+					dueTime,
+					houseTenantVOList
+				} = houseRentalList.find(item => item.id === this.rentId)
+				this.form = {
+					relation: tenantRelationship,
+					rentTime: rentalTime,
+					dueTime: dueTime,
+				}
+				this.rentalUseName = this.findObjValue(rentalUse, this.dataList.rentalUse)
+				this.relationName = this.findObjValue(tenantRelationship, this.dataList.relation)
+				this.houseTypeName = this.findObjValue(houseStatus, this.dataList.houseType)
+				this.rentFormNum = houseTenantVOList.length
+				this.$nextTick(() => {
+					houseTenantVOList.forEach((item, index) => {
+						this.$refs.rentform[index].form = item
+					})
+				})
 			}
 		}
 	}
@@ -214,30 +299,59 @@
 <style scoped lang="scss">
 	.container {
 		position: relative;
-		width: 100%;
 		display: flex;
 		flex-direction: column;
-		background: #F9F9FA;
+		background: #F8F8F9;
+		padding: 20rpx 30rpx;
 		padding-bottom: 200rpx;
 
-		.box-title {
-			padding: 10px 0;
-		}
-
 		.basic-info {
+			background-color: #ffffff;
+			padding: 20rpx;
 
 			.form-item {
-				background-color: #ffffff;
 				padding: 5rpx 20rpx;
 				border-bottom: 1px solid #eff1f3;
 			}
 
+			.pic {
+
+				// padding: 40rpx 30rpx;
+				.title {
+					font-size: 30rpx;
+					margin: 20rpx 0;
+				}
+			}
 		}
 
-		.pic {
-			background-color: #ffffff;
-			padding: 40rpx 30rpx;
+		.rent-info {
+			.rent-box {
+				padding: 20rpx;
+				background-color: #ffffff;
+				margin-top: 30rpx;
+
+				.box-title {
+					display: flex;
+					justify-content: space-between;
+
+					.l {
+						display: flex;
+
+						.line {
+							width: 8rpx;
+							margin-right: 10rpx;
+							background-color: #2978FF;
+						}
+
+						.title {
+							font-size: 30rpx;
+							font-weight: 700;
+						}
+					}
+				}
+			}
 		}
+
 
 		.btn-group {
 			padding: 30rpx;
@@ -250,17 +364,34 @@
 			}
 		}
 
+
+
 		.bottom-tools {
 			display: flex;
 			background-color: #ffffff;
 			position: fixed;
 			bottom: 0;
+			left: 0;
 			width: 100%;
-			border-top: 1rpx solid #e4e4e4;
+			// border-top: 1rpx solid #e4e4e4;
 			z-index: 999;
 
 			.btn-item {
 				margin: 40rpx;
+				color: #ffffff;
+				font-weight: 700;
+				border: 0;
+
+				&:nth-child(1) {
+					flex: 1;
+					background-color: #2CD5C0;
+				}
+
+				&:nth-child(2) {
+					flex: 3;
+					background: linear-gradient(to right, #06B0FD, #027BFE);
+					margin-left: 0rpx;
+				}
 			}
 		}
 	}
diff --git a/subPackage/bs/views/zhsb.vue b/subPackage/bs/views/zhsb.vue
index c8f8019..a603a03 100644
--- a/subPackage/bs/views/zhsb.vue
+++ b/subPackage/bs/views/zhsb.vue
@@ -2,22 +2,24 @@
 	<view class="container">
 		<view class="content-box">
 			<view class="info">
-				<view class="item location">
-					<u-icon name="map" color="#000000" size="16"></u-icon>
+				<view class="item location">
+					<u-icon name="map" color="#AAAAAA" size="15"></u-icon>
+					<text>当前小区:</text>
 					<view class="location">
-						{{location}}
+						{{ location }}{{ room }}{{ `(共${num}人)` }}
 					</view>
 				</view>
 
-				<view class="item statistics">
-					<view class="room">{{room}}</view>
-					<view class="num">{{`(共${num}人)`}}</view>
-				</view>
+				<!-- <view class="item statistics">
+					<view class="room">{{ room }}</view>
+					<view class="num">{{ `(共${num}人)` }}</view>
+				</view> -->
 			</view>
 
 
 			<view class="box-title">
-				<box-title title="出租管理"></box-title>
+				<view class="line"></view>
+				<view class="title">出租管理</view>
 			</view>
 			<view class="list">
 				<rentList :list="rentList"></rentList>
@@ -34,136 +36,134 @@
 </template>
 
 <script>
-	import rentList from "@/subPackage/bs/components/list/rentList.vue"
-	import {
-		getHouseRentInfo
-	} from "@/api/doorplateAddress/doorplateAddress";
-	import {
-		logAdd
-	} from "../../../api/system/logManage";
-	export default {
-		components: {
-			rentList
-		},
-		data() {
-			return {
-				houseCode: '',
-				location: "万达晶座:11栋楼",
-				room: "一单元303室",
-				num: "1",
+import rentList from "@/subPackage/bs/components/list/rentList.vue"
+import {
+	getHouseRentInfo
+} from "@/api/doorplateAddress/doorplateAddress";
+import {
+	logAdd
+} from "../../../api/system/logManage";
+export default {
+	components: {
+		rentList
+	},
+	data() {
+		return {
+			houseCode: '',
+			location: "",
+			room: "",
+			num: 0,
 
-				//出租列表
-				rentList: [{
-					name: "张三",
-					num: "1",
-					startTime: "2022-01-01",
-					endTime: "2023-12-23",
-					status: "未到期"
-				}]
-			}
-		},
-		created() {
-
-		},
-		mounted() {
-			console.log(this.$store)
-		},
-		onLoad(option) {
+			//出租列表
+			rentList: []
+		}
+	},
+	onLoad(option) {
+		const {
+			houseCode
+		} = option
+		this.houseCode = houseCode
+	},
+	onShow() {
+		this.getHouseRent()
+	},
+	methods: {
+		async getHouseRent() {
+			const res = await getHouseRentInfo(this.houseCode)
 			const {
-				houseCode
-			} = option
-			this.houseCode = houseCode
+				aoiName,
+				buildingName,
+				doorplateName,
+				unitName,
+				houseRentalList
+			} = res.data
+			this.rentList = []
+			this.location = (!!aoiName ? aoiName : '') + buildingName
+			this.room = (!!unitName ? unitName : '') + doorplateName + "室"
+			houseRentalList !== 0 && houseRentalList.forEach(item => {
+				const { houseTenantVOList, dueTime, rentalTime } = item
+				item.num = houseTenantVOList.length
+				this.num += item.num
+				if (item.num !== 0) {
+					item.name = houseTenantVOList[0].name
+				}
+				this.rentList = houseRentalList
+			})
 		},
-		onShow() {
-			this.getHouseRent()
-		},
-		methods: {
-			async getHouseRent() {
-				const res = await getHouseRentInfo(this.houseCode)
-				const {
-					aoiName,
-					buildingName,
-					doorplateName,
-					unitName,
-					houseRentalList: {
-						houseTenantVOList
-					}
-				} = res.data
-				console.log(res.data)
-				this.location = aoiName + buildingName
-				this.room = unitName + doorplateName + "室"
-				this.rentList = houseTenantVOList || []
-				this.rentList.length !== 0 && this.rentList.forEach(item => {
-					if (!item.houseTenantVOList) {
-						num += item.houseTenantVOList.length
-					}
-					// 事件格式处理
-					item.startTime = item.rentalTime.split(' ')[0]
-					item.endTime = item.dueTime.split(' ')[0]
-					item.status === 1 ? '未到期' : '到期'
-					item.num = item.houseTenantVOList.length
-				})
-			},
-			addRent() {
-				this.$u.func.globalNavigator("/subPackage/bs/views/rentDetail?houseCode="+this.houseCode)
-			}
+		addRent() {
+			this.$u.func.globalNavigator("/subPackage/bs/views/rentDetail?houseCode=" + this.houseCode)
 		}
 	}
+}
 </script>
 
 <style scoped lang="scss">
-	.container {
-		position: relative;
-		width: 100%;
-		height: 100%;
+.container {
+	position: relative;
+	width: 100%;
+	height: 100%;
+	display: flex;
+	flex-direction: column;
+	background: #F6F6F6;
+
+	.content-box {
+		height: 0;
+		flex: 1;
+		overflow-y: auto;
+		margin: 20rpx 30rpx;
+	}
+
+	.list {
+		// padding-bottom: 20px;
+	}
+
+	.item {
 		display: flex;
-		flex-direction: column;
-		background: #F9F9FA;
-
-		.content-box {
-			height: 0;
-			flex: 1;
-			overflow-y: auto;
-		}
-
-		.list {
-			// padding-bottom: 20px;
-		}
-
-		.item {
-			display: flex;
-			padding: 30rpx 20rpx;
-			background-color: #ffffff;
-			border-bottom: 1px solid #eff1f3;
-		}
-
-		.location {
-			font-weight: 700;
-		}
-
-		.room {
-			font-weight: 700;
-		}
-
-		.bottom {
-			padding: 20rpx;
-			background-color: #ffffff;
-			display: flex;
-			justify-content: center;
-			align-items: center;
-
-			.btn {
-				// width: calc(100% - 40rpx);
-			}
-		}
-
+		padding: 30rpx 20rpx;
+		background-color: #ffffff;
+		border-bottom: 1px solid #eff1f3;
 	}
 
-	.box-title {
-		padding: 40rpx 0;
+	.location {
+		font-weight: 700;
+		font-size: 27rpx;
+		text {
+			color: #AAAAAA;
+		}
 	}
 
-	view {
-		font-size: 32rpx;
+	.room {
+		font-weight: 700;
 	}
+
+	.bottom {
+		padding: 20rpx;
+		background-color: #ffffff;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+
+		.btn {
+			// width: calc(100% - 40rpx);
+		}
+	}
+
+}
+
+.box-title {
+	margin: 25rpx 0;
+	display: flex;
+	.line {
+		width: 8rpx;
+		margin-right: 10rpx;
+		background-color: #2978FF;
+	}
+	.title {
+		font-weight: 700;
+	}
+}
+
+view {
+	font-size: 32rpx;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3