|
|
@@ -87,7 +87,7 @@
|
|
|
v-for="(item, index) in priceOptions"
|
|
|
:key="index"
|
|
|
class="filter-option"
|
|
|
- :class="{ 'active': selectedPrice === item.value }"
|
|
|
+ :class="{ 'active': priceType == item.value }"
|
|
|
@click="selectPrice(item.value)"
|
|
|
>
|
|
|
{{ item.label }}
|
|
|
@@ -103,7 +103,7 @@
|
|
|
v-for="(item, index) in stockOptions"
|
|
|
:key="index"
|
|
|
class="filter-option"
|
|
|
- :class="{ 'active': selectedStock === item.value }"
|
|
|
+ :class="{ 'active': hasStock === item.value }"
|
|
|
@click="selectStock(item.value)"
|
|
|
>
|
|
|
{{ item.label }}
|
|
|
@@ -119,7 +119,7 @@
|
|
|
v-for="(item, index) in flowerNumOptions"
|
|
|
:key="index"
|
|
|
class="filter-option"
|
|
|
- :class="{ 'active': selectedFlowerNum === item.value }"
|
|
|
+ :class="{ 'active': flowerNum === item.value }"
|
|
|
@click="selectFlowerNum(item.value)"
|
|
|
>
|
|
|
{{ item.label }}
|
|
|
@@ -164,9 +164,6 @@ export default {
|
|
|
priceType:-1, // 0 没价格,1 有价格
|
|
|
// 新增筛选相关数据
|
|
|
showFilterPanel: false,
|
|
|
- selectedPrice: null, // 选中的价格筛选
|
|
|
- selectedStock: null, // 选中的库存筛选
|
|
|
- selectedFlowerNum: null, // 选中的支数筛选
|
|
|
// 筛选选项配置
|
|
|
priceOptions: [
|
|
|
{ label: '有价格', value: 1 },
|
|
|
@@ -192,7 +189,7 @@ export default {
|
|
|
computed: {
|
|
|
// 检查是否有活跃的筛选条件
|
|
|
hasActiveFilters() {
|
|
|
- return this.selectedPrice !== null || this.selectedStock !== null || this.selectedFlowerNum !== null;
|
|
|
+ return this.priceType != -1 || this.flowerNum != 0 || this.hasStock!=-1
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -227,24 +224,17 @@ export default {
|
|
|
closeFilterPanel() {
|
|
|
this.showFilterPanel = false;
|
|
|
},
|
|
|
-
|
|
|
selectPrice(value) {
|
|
|
- this.selectedPrice = this.selectedPrice === value ? null : value;
|
|
|
+ this.priceType = value
|
|
|
},
|
|
|
-
|
|
|
selectStock(value) {
|
|
|
- this.selectedStock = this.selectedStock === value ? null : value;
|
|
|
+ this.hasStock = value
|
|
|
},
|
|
|
-
|
|
|
selectFlowerNum(value) {
|
|
|
- this.selectedFlowerNum = this.selectedFlowerNum === value ? null : value;
|
|
|
+ this.flowerNum = value
|
|
|
},
|
|
|
-
|
|
|
clearFilters() {
|
|
|
- this.selectedPrice = null;
|
|
|
- this.selectedStock = null;
|
|
|
- this.selectedFlowerNum = null;
|
|
|
-
|
|
|
+
|
|
|
// 清空后立即更新筛选变量
|
|
|
this.priceType = -1;
|
|
|
this.hasStock = -1;
|
|
|
@@ -257,16 +247,9 @@ export default {
|
|
|
this.resetList();
|
|
|
this.getGoodsList();
|
|
|
},
|
|
|
-
|
|
|
confirmFilters() {
|
|
|
- // 更新原有的筛选变量以保持兼容性
|
|
|
- this.priceType = this.selectedPrice || -1;
|
|
|
- this.hasStock = this.selectedStock || -1;
|
|
|
- this.flowerNum = this.selectedFlowerNum || 0;
|
|
|
-
|
|
|
// 关闭筛选面板
|
|
|
this.closeFilterPanel();
|
|
|
-
|
|
|
// 重新加载数据
|
|
|
this.resetList();
|
|
|
this.getGoodsList();
|