From 31439fe6cca2faa88aff6126c6d9a1b9b790402f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Mon, 29 Dec 2025 14:01:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A6=96=E9=A1=B5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 44 +++++++++--------- pages/index/index.wxml | 9 ++-- pages/index/index.wxss | 101 +++++++++++++++++++++-------------------- 3 files changed, 79 insertions(+), 75 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index 15b2d23..8088e9b 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -925,34 +925,34 @@ Page({ selectRegion: function(e) { const region = e.currentTarget.dataset.region + // 立即关闭弹窗 + this.setData({ + selectedRegion: region, + showRegionPicker: false + }) + // 重新显示tabBar const app = getApp(); if (app && app.globalData) { app.globalData.showTabBar = true; } - // 应用筛选条件 - this.setData({ - selectedRegion: region, - showRegionPicker: false - }, () => { - // 如果从局部地区切换到全国地区,重新加载所有商品 - if (region === '全国' && this.data.selectedCategory === '全部' && !this.data.searchKeyword) { - // 重新加载商品数据 - this.refreshGoodsList(); - } else { - // 否则仅对本地商品进行筛选 - const filteredGoods = this.applyFilters(this.data.goods, false) - const groupedGoods = this.groupGoodsForStaggeredLayout(filteredGoods) - const { leftColumnGoods, rightColumnGoods } = this.distributeToColumns(filteredGoods) - this.setData({ - filteredGoods: filteredGoods, - groupedGoods: groupedGoods, - leftColumnGoods: leftColumnGoods, - rightColumnGoods: rightColumnGoods - }) - } - }) + // 如果从局部地区切换到全国地区,重新加载所有商品 + if (region === '全国' && this.data.selectedCategory === '全部' && !this.data.searchKeyword) { + // 重新加载商品数据 + this.refreshGoodsList(); + } else { + // 否则仅对本地商品进行筛选 + const filteredGoods = this.applyFilters(this.data.goods, false) + const groupedGoods = this.groupGoodsForStaggeredLayout(filteredGoods) + const { leftColumnGoods, rightColumnGoods } = this.distributeToColumns(filteredGoods) + this.setData({ + filteredGoods: filteredGoods, + groupedGoods: groupedGoods, + leftColumnGoods: leftColumnGoods, + rightColumnGoods: rightColumnGoods + }) + } }, // 阻止事件冒泡 diff --git a/pages/index/index.wxml b/pages/index/index.wxml index b7219fd..49fbb00 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -10,8 +10,7 @@ - {{selectedRegion || '全国'}} - + {{selectedRegion || '全国'}} ▼ 🔍 @@ -29,14 +28,14 @@ - + 选择地区 {{item}} @@ -134,7 +133,7 @@ - +