From b4068110a2578e313c6b03c379d97f88feff3f18 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Thu, 02 Nov 2023 22:33:58 +0800
Subject: [PATCH] 首页页面无法显示修改,楼盘表转取逻辑跳转

---
 api/doorplateAddress/doorplateAddress.js |   19 ----
 pages/home/index.vue                     |   40 ++++++---
 subPackage/house/family/index.vue        |   78 ++++++++++++++++---
 subPackage/house/list/index.vue          |   73 ++++++++++++++----
 4 files changed, 151 insertions(+), 59 deletions(-)

diff --git a/api/doorplateAddress/doorplateAddress.js b/api/doorplateAddress/doorplateAddress.js
index d3a4618..72c0cf1 100644
--- a/api/doorplateAddress/doorplateAddress.js
+++ b/api/doorplateAddress/doorplateAddress.js
@@ -24,26 +24,11 @@
 	})
 }
 // 获取社区信息
-export const getHouseList = (type, name) => {
+export const getHouseList = (param) => {
 	return http.request({
 		url: 'blade-doorplateAddress/doorplateAddress/getHousesList',
 		method: 'GET',
-		params: {
-			type,
-			name
-		}
-	})
-}
-
-// 获取当前楼栋信息
-export const getHouseInfoList = (type, code) => {
-	return http.request({
-		url: 'blade-doorplateAddress/doorplateAddress/getHousesList',
-		method: 'GET',
-		params: {
-			type,
-			code
-		}
+		params: param
 	})
 }
 
diff --git a/pages/home/index.vue b/pages/home/index.vue
index 92f6867..cf9b420 100644
--- a/pages/home/index.vue
+++ b/pages/home/index.vue
@@ -12,7 +12,7 @@
 			</view>
 			<view class="" v-if="roleType != 1">
 				<u-grid :border="false" col="4">
-					<u-grid-item v-for="(i,k) in cellList" :key="k">
+					<u-grid-item v-for="(i,k) in cellList" :key="k" @click.native="toPage(i)">
 						<u-icon :name="i.icon" :size="45"></u-icon>
 						<text class="f-26 mt-20">{{i.text}}</text>
 					</u-grid-item>
@@ -81,7 +81,7 @@
 				<u-grid :border="false" col="4">
 					<u-grid-item v-for="(item, index) in jobList" :index="index" :key="index"
 						:customStyle="{paddingTop:20+'rpx'}">
-						<view class="grid-item flex f-d-c a-i-c" :style="{background:item.style.background}">
+						<view class="grid-item flex f-d-c a-i-c" :style="{background:item.background}">
 							<u-icon :name="item.imgUrl" width="60rpx" height="60rpx"></u-icon>
 							<text class="grid-text f-24">{{item.title}}</text>
 						</view>
@@ -171,19 +171,23 @@
 				],
 				cellList: [{
 						icon: "/static/icon/nav-01.png",
-						text: "扫一扫"
+						text: "扫一扫",
+						path:''
 					},
 					{
 						icon: "/static/icon/nav-02.png",
-						text: "报事报修"
+						text: "报事报修",
+						path:''
 					},
 					{
 						icon: "/static/icon/nav-03.png",
-						text: "便民热线"
+						text: "便民热线",
+						path:''
 					},
 					{
 						icon: "/static/icon/nav-04.png",
-						text: "租客上报"
+						text: "租客上报",
+						path:'/subPackage/bs/views/zhsb'
 					}
 				],
 				navList: [{
@@ -376,9 +380,12 @@
 
 
 			// 获取楼盘
-			async getHouseDataList(name) {
-				const res = await getHouseList(1, name)
-				console.log(res);
+			async getHouseDataList(code) {
+				const param = {
+					type: 1,
+					code:code
+				}
+				const res = await getHouseList(param)
 				res.data.forEach(item => {
 					item.title = item.name
 					item.useSlot = true
@@ -411,7 +418,7 @@
 				console.log('confirm', e)
 				this.curSelectSite = e.value[e.value.length - 1]
 				this.selectBoxShow = false
-				this.getHouseDataList(e.value[1].name)
+				this.getHouseDataList(e.value[1].id)
 			},
 			getMenu(menuName, menuList, resultArr) {
 				// console.log(menuList, menuName)
@@ -424,11 +431,8 @@
 						}
 					}
 				}
-			
 				return resultArr
-			
 			},
-			
 			//获取首页菜单
 			getMenuList() {
 				console.log("当前角色菜单", this.menuList)
@@ -496,7 +500,17 @@
 					let url = `/subPackage/house/list/index?id=${id}&title=${title}`
 					this.$u.func.globalNavigator(url, "navTo")
 				}
+			},
+			
+			// 页面跳转
+			toPage({id, title, path }) {
+				let url = `${path}`
+				this.$u.func.globalNavigator(url, "navTo")
+				if (id !== void 0) {
+					
+				}
 			}
+			
 		}
 	}
 </script>
diff --git a/subPackage/house/family/index.vue b/subPackage/house/family/index.vue
index c867726..feb43cd 100644
--- a/subPackage/house/family/index.vue
+++ b/subPackage/house/family/index.vue
@@ -7,7 +7,7 @@
 			</view>
 			<view class="h0 flex-1 build-list-box">
 				<u-collapse :border="false">
-					<u-collapse-item style="border: none;" :title="item.unitName" :name="index"
+					<u-collapse-item v-show="isShowBuild" style="border: none;" :title="item.unitName" :name="index"
 						v-for="(item, index) in buildingList" :key="index">
 						<view class="flex floor-content" v-for="(cItem, cIndex) in item.children"
 							:key="cIndex">
@@ -47,6 +47,17 @@
 							</view>
 						</view>
 					</u-collapse-item>
+					<u-collapse-item v-show="isShowShop" style="border: none;" title="商铺" 
+						>
+						<view class="house-list-box" v-for="(item, index) in shopList" :name="index" :key="index" @click.native="pushShopPage(item)">
+							<view class="l">
+								<u-icon name="home" color="#fff"></u-icon>
+							</view>
+							<view class="r">
+								{{item.floor}}
+							</view>
+						</view>
+					</u-collapse-item>
 				</u-collapse>
 
 				<u-divider text="已经到底了"></u-divider>
@@ -57,42 +68,71 @@
 
 <script>
 	import {
-		getHouseInfoList
+		getHouseList
 	} from "@/api/doorplateAddress/doorplateAddress";
 	export default {
 		components: {},
 
 		data() {
-			return {
+			return {
+				isShowBuild:false,
+				isShowShop:false,
 				currentId: '',
 				housingName: '',
 				buildingName: 0,
-				buildingList: []
+				addressType: 1,
+				// 社区编号
+				neiCode: "",
+				buildingList: [],
+				shopList:[]
 			}
 		},
 		onLoad(e) {
-			const { id, housingName, buildingName } = e
+			const { id, housingName, buildingName,addressType, neiCode} = e
 			this.currentId = id
 			this.housingName = housingName
 			this.buildingName = buildingName
+			this.addressType = addressType
+			this.neiCode = neiCode
 			
 		},
 		onShow() {
 			this.getBuildingList()
 		},
 		methods: {
-			async getBuildingList() {
-				const res = await getHouseInfoList(3, this.currentId)
-				res.data.forEach(item => {
-					item.children && item.children.sort((a, b) => a.floor - b.floor)
-				})
-				console.log(res.data)
-				this.buildingList = res.data || []
+			async getBuildingList() {
+				const param = {
+					type:3,
+					code:this.currentId,
+					name: this.addressType==1?"":this.neiCode,
+					addressType :this.addressType
+				}
+				const res = await getHouseList(param)
+				const aoiList = res.data.aoiList
+				const shopList = res.data.shopList
+				if(aoiList.length>0){
+					this.isShowBuild = true
+					// 正常展示户室数据
+					aoiList.forEach(item => {
+						item.children && item.children.sort((a, b) => a.floor - b.floor)
+					})
+					this.buildingList = aoiList || []
+				}
+				if(shopList.length>0){
+					this.isShowShop = true
+					this.shopList = shopList || []
+				}
 			},
 			pushPage(value) {
 				const { addressCode } = value
 				let url = `/subPackage/house/roomDetails/index?id=${addressCode}`
 				this.$u.func.globalNavigator(url, "navTo")
+			},
+			// 跳转到商铺页面
+			pushShopPage(e){
+				const { addressCode } = value
+				// let url = `?id=${addressCode}`
+				// this.$u.func.globalNavigator(url, "navTo")
 			}
 		}
 	}
@@ -166,6 +206,20 @@
 					}
 				}
 			}
+			
+			.house-list-box {
+				margin: 16rpx;
+				padding: 0 16rpx;
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				width: calc((100% - 96rpx) / 3);
+				height: 68rpx;
+				border-radius: 34rpx;
+				color: #fff;
+				background: linear-gradient(to right, #417BE9, #6D9FFB);
+				box-sizing: border-box;
+			}
 		}
 	}
 </style>
\ No newline at end of file
diff --git a/subPackage/house/list/index.vue b/subPackage/house/list/index.vue
index c8cd711..e829ec1 100644
--- a/subPackage/house/list/index.vue
+++ b/subPackage/house/list/index.vue
@@ -2,12 +2,21 @@
 	<view class="container">
 		<view class="flex f-d-c main">
 			<view class="flex house-container">
-				<view class="house-list-box" v-for="(item, index) in houseList" @click="pushPage(item)">
+				<view class="house-list-box" v-if="isShowAoi" v-for="(item, index) in houseList" @click="pushPage(item)">
 					<view class="l">
 						<u-icon name="home" color="#fff"></u-icon>
 					</view>
 					<view class="r">
 						{{item.title}}栋
+					</view>
+				</view>
+				<!-- 商铺 -->
+				<view class="house-list-box" v-if="isShowShop" v-for="(item, index) in shopList" @click="pushPage(item)">
+					<view class="l">
+						<u-icon name="home" color="#fff"></u-icon>
+					</view>
+					<view class="r">
+						{{item.title}}
 					</view>
 				</view>
 			</view>
@@ -19,18 +28,25 @@
 
 <script>
 	import {
-		getHouseInfoList
+		getHouseList
 	} from "@/api/doorplateAddress/doorplateAddress";
 	export default {
 		components: {},
 
 		data() {
 			return {
+				isShowAoi:false,
+				isShowShop:false,
 				currentId: '',
 				curHouseTitle: '',
 				houseList: [{
 					title: '-'
-				}]
+				}],
+				shopList:[
+					{
+						title: '-'
+					}
+				]
 			}
 		},
 		onLoad(e) {
@@ -45,22 +61,45 @@
 
 		methods: {
 			async getHouseInfo() {
-				const res = await getHouseInfoList(2, this.currentId)
-				// 删除栋字
-				const reg = new RegExp('栋', 'g')
-				res.data.forEach(item => {
-					item.title = item['name'].replace(reg, '')
-					delete item.name
-				})
-				this.houseList = res.data || [{
-					title: '-'
-				}]
+				const param = {
+					type: 2,
+					code:this.currentId
+				}
+				const res = await getHouseList(param)
+				const aoiList = res.data.aoiList
+				const shopList = res.data.shopList
+				if(aoiList.length>0){
+					this.isShowAoi =true
+					// 删除栋字
+					const reg = new RegExp('栋', 'g')
+					aoiList.forEach(item => {
+						item.title = item['name'].replace(reg, '')
+						delete item.name
+					})
+					this.houseList = aoiList || [{
+						title: '-'
+					}]
+				}
+				if(shopList.length>0){
+					this.isShowShop =true
+					shopList.forEach(item => {
+						item.title = item.name
+						delete item.name
+					})
+					this.shopList = shopList
+				}
+				
 			},
 			pushPage(value) {
-				const { id, title } = value
-				if (id !== void 0) {
-					let url = `/subPackage/house/family/index?id=${id}&housingName=${this.curHouseTitle}&buildingName=${title}`
-					this.$u.func.globalNavigator(url, "navTo")
+				const { id, title,addressType } = value
+				if(addressType == 1){
+					if (id !== void 0) {
+						let url = `/subPackage/house/family/index?id=${id}&housingName=${this.curHouseTitle}
+						&buildingName=${title}&addressType=${addressType}&neiCode=${this.currentId}`
+						this.$u.func.globalNavigator(url, "navTo")
+					}
+				}else{
+					// 跳转场所页面
 				}
 			}
 		}

--
Gitblit v1.9.3