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