FilterBar.wxml
3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<view class="filter-bar">
<!-- Search Area -->
<view class="search-box">
<view class="search-input">
<image src="/images/search.png" class="search-icon" />
<input type="text" placeholder="{{searchPlaceholder}}" class="input" value="{{ searchValue }}" placeholder-class="input-placeholder" bindinput="onSearchInput" bindconfirm="onSearch" />
<block wx:if="{{ searchValue }}">
<image src="/images/clear.png" class="search-clear" catchtap="clearSearch" />
</block>
</view>
</view>
<!-- Filter Area -->
<view class="filter-box" wx:if="{{filters.length > 0}}">
<view class="filter-list">
<block wx:for="{{filters}}" wx:key="key">
<!-- Date Range Filter -->
<block wx:if="{{item.type === 'date-range'}}">
<calendar
class="calendar-wrapper"
allowSameDay
shortcut
bindselect="onDateRangeSelect"
calenderColor="#347BFF"
vertical
dateType='range'
minDate="2025-01-01"
maxDate="{{ maxDateForCalendar }}"
isComponents
data-index="{{index}}"
>
<view class="filter-item {{searchObj[item.key] ? 'active' : ''}}">
<text class="filter-text">{{searchObj[item.showKey || item.key] || item.label}}</text>
<image class="filter-icon" src="{{IMG_URL}}{{searchObj[item.key] ? 'expand_icon_blue' : 'expand_icon'}}.png" mode="" />
</view>
</calendar>
</block>
<!-- Other Filters (Month, Select) -->
<block wx:else>
<view class="filter-item {{searchObj[item.key] ? 'active' : ''}}" bindtap="onFilterTagTap" data-index="{{index}}">
<text class="filter-text">{{searchObj[item.showKey || item.key] || item.label}}</text>
<image class="filter-icon" src="{{IMG_URL}}{{searchObj[item.key] ? 'expand_icon_blue' : 'expand_icon'}}.png" mode="" />
</view>
</block>
</block>
</view>
<!-- Reset Button -->
<view class="reset-btn" bindtap="resetFilters">
重置
</view>
</view>
</view>
<!-- Dynamic Popup -->
<TopToolbarPopup show="{{showPopup}}" title="" bind:cancel="closePopup" bind:confirm="confirmPopup" height="{{height}}">
<!-- Content depends on active filter type -->
<block wx:if="{{activeFilterIndex > -1}}">
<!-- Type: Month -->
<block wx:if="{{filters[activeFilterIndex].type === 'month'}}">
<van-datetime-picker
type="{{filters[activeFilterIndex].pickerType || 'year-month'}}"
value="{{pickerViewValue}}"
bind:input="onDatePickChange"
show-toolbar="{{false}}"
min-date="{{minDate}}"
max-date="{{maxDate}}"
/>
</block>
<!-- Type: Select -->
<block wx:elif="{{filters[activeFilterIndex].type === 'select'}}">
<van-picker
columns="{{ currentSelectOptions }}"
value-key="confLabel"
default-index="{{ tempSelectIndex }}"
bind:change="onSelectPickerChange"
show-toolbar="{{false}}"
/>
</block>
</block>
</TopToolbarPopup>