feat(listings): 押金筛选高档位细分为 200-400 / 400-600 / 600以上
- 桌面高级筛选「押金」去掉 200以上,改为 200-400 并新增 400-600、600以上 - 移动端押金档位改为复用 depositRangeOptions,两端档位保持一致 - 补充 depositRangeOptions 档位与边界断言
This commit is contained in:
@@ -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,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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<string, Array<{ label: string; min: string; max: string }>> = {
|
||||
price: [
|
||||
{ label: '50-100', min: '50', max: '100' },
|
||||
@@ -154,12 +164,7 @@ const rangePresets: Record<string, Array<{ label: string; min: string; max: stri
|
||||
{ label: '30-40', min: '30', max: '40' },
|
||||
{ label: '40以上', min: '40', max: '' },
|
||||
],
|
||||
deposit: [
|
||||
{ label: '0-50', min: '0', max: '50' },
|
||||
{ label: '50-100', min: '50', max: '100' },
|
||||
{ label: '100-200', min: '100', max: '200' },
|
||||
{ label: '200以上', min: '200', max: '' },
|
||||
],
|
||||
deposit: depositPresets,
|
||||
total: [
|
||||
{ label: '0-500', min: '0', max: '500' },
|
||||
{ label: '500-1000', min: '500', max: '1000' },
|
||||
|
||||
Reference in New Issue
Block a user