|
@@ -63,29 +63,53 @@
|
63
|
63
|
:style="[{top:topHeader+'px',height:'calc(100vh - ' + topHeader + 'px)'}]">
|
64
|
64
|
<view class="filter-title">机构筛选</view>
|
65
|
65
|
<view class="btn-check-group padding-lr">
|
66
|
|
- <checkbox-group @change="checkboxChange" class="flex" style="flex-wrap: wrap;" id="agency">
|
|
66
|
+ <!-- <checkbox-group @change="checkboxChange" class="flex" style="flex-wrap: wrap;" id="agency">
|
67
|
67
|
<label class="btn-check-label margin-top-sm padding-lr-xs text-sm text-ellipsis" :class="{'bg-cyan':params.agency.includes(item.id+'')}"
|
68
|
68
|
v-for="item in filters.agency" :key="item.id">
|
69
|
69
|
<checkbox :value="item.id"/>
|
70
|
70
|
{{item.name}}
|
71
|
71
|
</label>
|
72
|
|
- </checkbox-group>
|
|
72
|
+ </checkbox-group> -->
|
|
73
|
+ <radio-group class="flex" style="flex-wrap: wrap;" id="agency">
|
|
74
|
+ <label class="btn-check-label margin-top-sm padding-lr-xs text-sm text-ellipsis" :class="{'bg-cyan':params.agency.includes(item.id)}"
|
|
75
|
+ v-for="item in filters.agency" :key="item.id" @tap="radioChange('agency',item.id)">
|
|
76
|
+ <radio :value="item.id"/>
|
|
77
|
+ {{item.name}}
|
|
78
|
+ </label>
|
|
79
|
+ </radio-group>
|
|
80
|
+ </view>
|
|
81
|
+ <view class="filter-title">分类筛选</view>
|
|
82
|
+ <view class="btn-check-group padding-lr">
|
|
83
|
+ <radio-group class="flex" style="flex-wrap: wrap;" id="category">
|
|
84
|
+ <label class="btn-check-label margin-top-sm padding-lr-xs text-sm text-ellipsis" :class="{'bg-cyan':params.category.includes(item.id)}"
|
|
85
|
+ v-for="item in filters.category" :key="item.id" @tap="radioChange('category',item.id)">
|
|
86
|
+ <radio :value="item.id"/>
|
|
87
|
+ {{item.name}}
|
|
88
|
+ </label>
|
|
89
|
+ </radio-group>
|
73
|
90
|
</view>
|
74
|
91
|
<view class="filter-title">周期筛选</view>
|
75
|
92
|
<view class="btn-check-group padding-lr">
|
76
|
|
- <checkbox-group @change="checkboxChange" class="flex" style="flex-wrap: wrap;" id="day">
|
|
93
|
+ <!-- <checkbox-group @change="checkboxChange" class="flex" style="flex-wrap: wrap;" id="day">
|
77
|
94
|
<label class="btn-check-label margin-top-sm padding-lr-xs text-sm" :class="{'bg-cyan':params.day.includes(index+'')}"
|
78
|
95
|
v-for="(item,index) in filters.week" :key="index">
|
79
|
96
|
<checkbox :value="index"/>
|
80
|
97
|
{{item}}
|
81
|
98
|
</label>
|
82
|
|
- </checkbox-group>
|
|
99
|
+ </checkbox-group> -->
|
|
100
|
+ <radio-group class="flex" style="flex-wrap: wrap;" id="day">
|
|
101
|
+ <label class="btn-check-label margin-top-sm padding-lr-xs text-sm" :class="{'bg-cyan':params.day.includes(index+'')}"
|
|
102
|
+ v-for="(item,index) in filters.week" :key="index" @tap="radioChange('day',index)">
|
|
103
|
+ <radio :value="index"/>
|
|
104
|
+ {{item}}
|
|
105
|
+ </label>
|
|
106
|
+ </radio-group>
|
83
|
107
|
</view>
|
84
|
108
|
<view class="filter-title">价格区间(元)</view>
|
85
|
109
|
<view class="btn-check-group padding-lr">
|
86
|
110
|
<radio-group class="flex" style="flex-wrap: wrap;" id="price">
|
87
|
111
|
<label class="btn-check-label margin-top-sm padding-lr-xs text-sm" :class="{'bg-cyan':params.price===item.name}"
|
88
|
|
- v-for="item in filters.price_list" :key="item.id" @tap="radioChange(item.name)">
|
|
112
|
+ v-for="item in filters.price_list" :key="item.id" @tap="radioChange('price',item.name)">
|
89
|
113
|
<radio :value="item.name"/>
|
90
|
114
|
{{item.name}}
|
91
|
115
|
</label>
|
|
@@ -105,6 +129,7 @@ import course from './components/course.vue'
|
105
|
129
|
import card from './components/card.vue'
|
106
|
130
|
import { _optionCourse, _filter } from '@/api/course'
|
107
|
131
|
import { filterParams } from '@/common/utils/tool'
|
|
132
|
+import { deepClone } from '@/common/utils'
|
108
|
133
|
import { mapGetters } from 'vuex'
|
109
|
134
|
export default {
|
110
|
135
|
components: {
|
|
@@ -160,6 +185,7 @@ export default {
|
160
|
185
|
course_name: '',
|
161
|
186
|
agency: [],
|
162
|
187
|
day: [],
|
|
188
|
+ category: [],
|
163
|
189
|
price: '',
|
164
|
190
|
sort: '',
|
165
|
191
|
list_type: 0// 0 课程,1 餐饮,2活动
|
|
@@ -169,6 +195,7 @@ export default {
|
169
|
195
|
course_name: '',
|
170
|
196
|
agency: [],
|
171
|
197
|
day: [],
|
|
198
|
+ category: [],
|
172
|
199
|
price: '',
|
173
|
200
|
sort: '',
|
174
|
201
|
list_type: 0// 0 课程,1 餐饮,2活动
|
|
@@ -232,11 +259,22 @@ export default {
|
232
|
259
|
hideModal (e) {
|
233
|
260
|
this.modalName = null
|
234
|
261
|
},
|
235
|
|
- radioChange(v) {
|
236
|
|
- if (this.params.price === v) { // 选中取消
|
237
|
|
- this.params.price = null
|
238
|
|
- } else { // 空则赋值
|
239
|
|
- this.params.price = v
|
|
262
|
+ radioChange(type, v) {
|
|
263
|
+ switch (type) {
|
|
264
|
+ case 'agency':
|
|
265
|
+ this.params.agency = this.params.agency[0] === v ? [] : [v]
|
|
266
|
+ break
|
|
267
|
+ case 'day':
|
|
268
|
+ this.params.day = this.params.day[0] === v ? [] : [v]
|
|
269
|
+ break
|
|
270
|
+ case 'category':
|
|
271
|
+ this.params.category = this.params.category[0] === v ? [] : [v]
|
|
272
|
+ break
|
|
273
|
+ case 'price':
|
|
274
|
+ this.params.price = this.params.price === v ? null : v
|
|
275
|
+ break
|
|
276
|
+ default:
|
|
277
|
+ console.log('error')
|
240
|
278
|
}
|
241
|
279
|
},
|
242
|
280
|
checkboxChange(e) {
|
|
@@ -301,13 +339,22 @@ export default {
|
301
|
339
|
this.get_list()
|
302
|
340
|
},
|
303
|
341
|
get_list(init = false) {
|
304
|
|
- let params = Object.assign({}, this.params)
|
|
342
|
+ let params = deepClone(this.params)
|
305
|
343
|
params = filterParams(params)
|
306
|
344
|
if (params.day.length > 0) {
|
307
|
345
|
params.day = JSON.stringify(params.day)
|
|
346
|
+ } else {
|
|
347
|
+ delete params.day
|
308
|
348
|
}
|
309
|
349
|
if (params.agency.length > 0) {
|
310
|
350
|
params.agency = JSON.stringify(params.agency)
|
|
351
|
+ } else {
|
|
352
|
+ delete params.agency
|
|
353
|
+ }
|
|
354
|
+ if (params.category.length > 0) {
|
|
355
|
+ params.category = JSON.stringify(params.category)
|
|
356
|
+ } else {
|
|
357
|
+ delete params.category
|
311
|
358
|
}
|
312
|
359
|
_optionCourse(params).then(res => {
|
313
|
360
|
if (params.page_num > 1) {
|