From 38f73a19c428fd5e3adb529588b673c0d2e62e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AF=85?= <1335909236@qq.com> Date: Wed, 30 Jul 2025 15:13:51 +0800 Subject: [PATCH] =?UTF-8?q?feat=20:=20=E5=AE=8C=E6=88=90=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=A1=B5=E9=9D=A2=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/homeServer/searchInfo/index.css | 5 +- packages/homeServer/searchInfo/index.vue | 151 ++++++++++++++++++++++- packages/homeServer/serverInfo/index.vue | 3 +- 3 files changed, 151 insertions(+), 8 deletions(-) diff --git a/packages/homeServer/searchInfo/index.css b/packages/homeServer/searchInfo/index.css index 6bf52000..1f4d6777 100644 --- a/packages/homeServer/searchInfo/index.css +++ b/packages/homeServer/searchInfo/index.css @@ -4,14 +4,15 @@ page { } .container { - display: flex; - flex-direction: column; + display: grid; + grid-template-rows: auto 1fr; height: 100vh; overflow: hidden; } .header { z-index: 9; + overflow-x: auto; } .main { diff --git a/packages/homeServer/searchInfo/index.vue b/packages/homeServer/searchInfo/index.vue index b795dad2..a159a39d 100644 --- a/packages/homeServer/searchInfo/index.vue +++ b/packages/homeServer/searchInfo/index.vue @@ -62,6 +62,13 @@ src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/homeServer_filterMore.png" > + +
+ 地区 + +
@@ -147,12 +154,50 @@
+ + + + + + {{ item.short_name }} + + + {{ item.short_name }} + + + {{ item.short_name }} + + + + + +
-
+
@@ -222,7 +267,7 @@
-
确定
+
@@ -235,6 +280,7 @@ import { menuButtonInfo, } from "../../../utils/index"; import { apiArr } from "../../../api/reservation"; +import { apiArr as apiArr2 } from "../../../api/area"; export default { data() { @@ -246,7 +292,19 @@ export default { show3: false, show4: false, show5: false, + show6: false, isShowDia: false, + id: [0, 0, 0], // 默认选中第一个省、市、区 + + provList: [], // 省 + cityList: [], //市 + distList: [], // 区 + defaultCity: [], // 默认展示的市区数据 + defaultDist: [], // 默认展示的县/区数据 + confirmProv: {}, // 默认选中省 + confirmProv1: {}, + confirmCity: {}, // 默认选中市 + confirmDist: {}, // 默认选中区/县 }; }, methods: { @@ -260,15 +318,97 @@ export default { showDialog(index) { this[`show${index}`] = !this[`show${index}`]; this.logOtherButtons(index); - this.isShowDia = this[`show${index}`] + this.isShowDia = this[`show${index}`]; + }, + close() { + this.show6 = false; + this.isShowDia = false; }, logOtherButtons(excludeIndex) { - for (let i = 1; i <= 5; i++) { + for (let i = 1; i <= 6; i++) { + if (i == 6) { + this.getProvList(); + } if (i !== excludeIndex) { - this[`show${i}`] = false + this[`show${i}`] = false; } } }, + /////////////////////////////////// 省市区方法/////////////////////////////////////////// + // 获取省份信息 + async getProvList() { + const res = await request(apiArr2.getArea, "POST", {}, { silent: false }); + this.provList = res.rows; + this.confirmProv1 = res.rows[0]; + // 加载默认省份的城市数据 + this.getCityList(0); + // 缓存省市区数据 + }, + + // 获取市区信息 + async getCityList(sq = 0, x = 0) { + console.log("11swq", sq); + console.log("获取x", x); + if (!this.sf && this.cityList.length > 0) { + console.log("省份没变,查市跟区", this.cityList); + let newDist = this.cityList[sq]; + console.log("新的市信息", newDist); + if (this.xsq.ad_code !== newDist.ad_code) { + console.log("新市区跟旧市区不一直"); + this.xsq = newDist; + this.getDistList(this.confirmCity, x); + } else { + console.log("新市区跟旧市区一直"); + this.confirmDist = this.defaultDist[x]; + } + return; + } + const res = await request( + apiArr2.getArea, + "POST", + { parent_ad_code: this.confirmProv1.ad_code }, + { silent: false } + ); + this.cityList = res.rows; + let newDist; + + this.defaultCity = res.rows; + this.confirmCity = res.rows[0]; // 拿市的第一条区查区 + this.getDistList(newDist, x); + }, + // 获取 县/区 信息 + async getDistList(xsq, x) { + console.log("页面传递的x", x); + const res = await request( + apiArr2.getArea, + "POST", + { parent_ad_code: xsq ? xsq.ad_code : this.confirmCity.ad_code }, + { silent: false } + ); + this.distList = res.rows; + this.defaultDist = res.rows; + this.confirmDist = res.rows[0]; // 区的第一条信息 + this.id = [0, 0, 0]; // 刷新选择器视图 + }, + + // 切换省市区时联动改变参数值 + bindChange(e) { + console.log("[1231331], e", e); + const { value } = e.detail; + // // 每次切换时,根据当前点击的省过滤出所属市区,并且变化县/区 + let newCrty = this.provList[value[0]]; + console.log("新的省份信息", newCrty); + console.log("旧的省信息", this.confirmProv1); + if (newCrty.ad_code === this.confirmProv1.ad_code) { + console.log("省份信息没变"); + this.sf = false; + } else { + this.sf = true; + } + console.log("this.cityListthis.cityList", this.cityList); + this.confirmProv1 = newCrty; + this.getCityList(value[1], value[2]); + }, }, onReady() {}, @@ -277,6 +417,7 @@ export default { this.top = meun.top; // this.top = meun.height + meun.top; this.localHeight = meun.height; + this.getProvList(); // 初始化加载省份数据 }, onShow() {}, diff --git a/packages/homeServer/serverInfo/index.vue b/packages/homeServer/serverInfo/index.vue index 2b572e68..c4e968b4 100644 --- a/packages/homeServer/serverInfo/index.vue +++ b/packages/homeServer/serverInfo/index.vue @@ -176,7 +176,8 @@ export default { this.rangeValue = e; }, selectVendor() { - NavgateTo("../vendor/index"); + // NavgateTo("../vendor/index"); + NavgateTo("../searchInfo/index"); }, selectMaster() { NavgateTo("../searchInfo/index");