fix(discover): filter chips use applied state and apply immediately on top-chip tap

- Top chip '推荐' now active only when no active filter (was hardcoded)
- Top chip '丹阳本地' uses applied.region (was tempRegion)
- Top chip '年龄' uses applied age range
- New onTopRegionTap applies region filter immediately and refreshes results
- Panel onRegionTap preserved for filter-panel multi-select flow
This commit is contained in:
Codex
2026-09-14 10:59:43 +08:00
parent 7009ec079c
commit 0f06d82a92
2 changed files with 14 additions and 1 deletions
+13
View File
@@ -134,6 +134,19 @@ Page({
this.setData({ tempRegion: this.data.tempRegion === val ? '' : val });
},
/** 顶部"丹阳本地" chip 专用:立即应用 region 筛选并刷新结果 */
onTopRegionTap(e: WechatMiniprogram.TouchEvent) {
const val = (e.currentTarget.dataset as any).val as string;
const nextRegion = this.data.applied.region === val ? '' : val;
const applied = { ...this.data.applied, region: nextRegion };
this.setData({
tempRegion: nextRegion,
applied,
hasActiveFilter: this._hasActiveFilter(applied),
});
this.fetchDiscover(true);
},
onMinAgeChange(e: any) {
let min = Number((e as any).detail.value);
if (min > this.data.tempAgeMax) min = this.data.tempAgeMax;