From 6b74e07e7090af68eb6cec2fb80d885fbabb1b97 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Wed, 7 Oct 2026 16:53:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(listings):=20=E6=8A=BC=E9=87=91=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E9=AB=98=E6=A1=A3=E4=BD=8D=E7=BB=86=E5=88=86=E4=B8=BA?= =?UTF-8?q?=20200-400=20/=20400-600=20/=20600=E4=BB=A5=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 桌面高级筛选「押金」去掉 200以上,改为 200-400 并新增 400-600、600以上 - 移动端押金档位改为复用 depositRangeOptions,两端档位保持一致 - 补充 depositRangeOptions 档位与边界断言 --- .../__tests__/useFilterOptions.spec.ts | 26 +++++++++++++++++++ .../listings/composables/useFilterOptions.ts | 6 +++-- .../listings/views/MobileHomeView.vue | 17 +++++++----- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/frontend/src/features/listings/composables/__tests__/useFilterOptions.spec.ts b/frontend/src/features/listings/composables/__tests__/useFilterOptions.spec.ts index 0fd9c9e..51dcc30 100644 --- a/frontend/src/features/listings/composables/__tests__/useFilterOptions.spec.ts +++ b/frontend/src/features/listings/composables/__tests__/useFilterOptions.spec.ts @@ -1,6 +1,7 @@ import { describe, it, expect } from 'vitest' import { awmRangeOptions, + depositRangeOptions, isRangeSelected, moneyRangeOptions, rangeLabel, @@ -39,4 +40,29 @@ describe('useFilterOptions', () => { expect(moneyRangeOptions.some(option => option.label === '0-50')).toBe(false) expect(ratioRangeOptions.some(option => option.label === '≤30')).toBe(false) }) + + it('押金高档位应该细分为 200-400 / 400-600 / 600以上', () => { + expect(depositRangeOptions.map(option => option.label)).toEqual([ + '全部', + '50-100', + '100-150', + '150-200', + '200-400', + '400-600', + '600以上', + ]) + expect(depositRangeOptions.find(option => option.label === '200以上')).toBeUndefined() + expect(depositRangeOptions.find(option => option.label === '200-400')).toMatchObject({ + min: 200, + max: 400, + }) + expect(depositRangeOptions.find(option => option.label === '400-600')).toMatchObject({ + min: 400, + max: 600, + }) + expect(depositRangeOptions.find(option => option.label === '600以上')).toMatchObject({ + min: 600, + max: undefined, + }) + }) }) diff --git a/frontend/src/features/listings/composables/useFilterOptions.ts b/frontend/src/features/listings/composables/useFilterOptions.ts index f9c3ef9..3a2a51c 100644 --- a/frontend/src/features/listings/composables/useFilterOptions.ts +++ b/frontend/src/features/listings/composables/useFilterOptions.ts @@ -34,13 +34,15 @@ export const moneyRangeOptions = [ { label: '200以上', min: 200, max: undefined }, ] -/** 押金区间:去掉 0-50 */ +/** 押金区间:去掉 0-50;高档位细分为 200-400 / 400-600 / 600以上 */ export const depositRangeOptions = [ { label: '全部', min: undefined, max: undefined }, { label: '50-100', min: 50, max: 100 }, { label: '100-150', min: 100, max: 150 }, { label: '150-200', min: 150, max: 200 }, - { label: '200以上', min: 200, max: undefined }, + { label: '200-400', min: 200, max: 400 }, + { label: '400-600', min: 400, max: 600 }, + { label: '600以上', min: 600, max: undefined }, ] export const totalRangeOptions = [ diff --git a/frontend/src/features/listings/views/MobileHomeView.vue b/frontend/src/features/listings/views/MobileHomeView.vue index e2ebcf7..b23c8ce 100644 --- a/frontend/src/features/listings/views/MobileHomeView.vue +++ b/frontend/src/features/listings/views/MobileHomeView.vue @@ -40,6 +40,7 @@ import { storeHomeQuery, type HomeQueryValue, } from '@/features/listings/composables/useHomeFilterQuery' +import { depositRangeOptions } from '@/features/listings/composables/useFilterOptions' import { getListingChips, getListingDisplayPrice, @@ -138,6 +139,15 @@ const zoneOptions = [ { key: 'highCoin', label: '高币', hint: '100M以上' }, ] +/** 押金档位直接复用首页高级筛选项,保证移动端与桌面端完全一致 */ +const depositPresets = depositRangeOptions + .filter(option => option.label !== '全部') + .map(option => ({ + label: option.label, + min: option.min === undefined ? '' : String(option.min), + max: option.max === undefined ? '' : String(option.max), + })) + const rangePresets: Record> = { price: [ { label: '50-100', min: '50', max: '100' }, @@ -154,12 +164,7 @@ const rangePresets: Record