|
|
@@ -199,10 +199,11 @@ export default {
|
|
|
useCaseOptions: [],
|
|
|
deliveryOptions: DELIVERY_OPTIONS,
|
|
|
pricePresets: PRICE_PRESETS,
|
|
|
- // 已生效的筛选条件
|
|
|
+ // 已生效的筛选条件;goodsIds 仅由路由 filterType=2 带入,不在筛选弹窗中编辑
|
|
|
filters: {
|
|
|
categoryIds: [],
|
|
|
useCaseIds: [],
|
|
|
+ goodsIds: [],
|
|
|
minPrice: '',
|
|
|
maxPrice: '',
|
|
|
delivery: ''
|
|
|
@@ -217,12 +218,17 @@ export default {
|
|
|
this.loadFilterOptions()
|
|
|
this.loadGoods()
|
|
|
},
|
|
|
- /** 解析金刚区带入的 filterType / filterValue */
|
|
|
+ /**
|
|
|
+ * 解析路由带入的 filterType / filterValue
|
|
|
+ * type=2 商品ID列表、type=3 分类、type=4 场景(首页轮播/金刚区跳转)
|
|
|
+ */
|
|
|
applyRouteFilter() {
|
|
|
const type = parseInt((this.option && this.option.filterType) || 0, 10)
|
|
|
const value = (this.option && this.option.filterValue) ? String(this.option.filterValue) : ''
|
|
|
const ids = value.split(',').map((s) => s.trim()).filter(Boolean)
|
|
|
- if (type === 3 && ids.length) {
|
|
|
+ if (type === 2 && ids.length) {
|
|
|
+ this.filters.goodsIds = ids
|
|
|
+ } else if (type === 3 && ids.length) {
|
|
|
this.filters.categoryIds = ids
|
|
|
} else if (type === 4 && ids.length) {
|
|
|
this.filters.useCaseIds = ids
|
|
|
@@ -255,6 +261,10 @@ export default {
|
|
|
if (this.filters.useCaseIds.length) {
|
|
|
params.useCaseIds = this.filters.useCaseIds.join(',')
|
|
|
}
|
|
|
+ // 轮播等多商品关联:按精确商品ID列表拉取
|
|
|
+ if (this.filters.goodsIds.length) {
|
|
|
+ params.goodsIds = this.filters.goodsIds.join(',')
|
|
|
+ }
|
|
|
if (this.filters.minPrice !== '' && this.filters.minPrice != null) {
|
|
|
params.minPrice = this.filters.minPrice
|
|
|
}
|
|
|
@@ -366,9 +376,11 @@ export default {
|
|
|
maxPrice = preset.max
|
|
|
}
|
|
|
}
|
|
|
+ // goodsIds 不在筛选弹窗编辑,确认时透传以免被清空
|
|
|
this.filters = {
|
|
|
categoryIds: [...this.draft.categoryIds],
|
|
|
useCaseIds: [...this.draft.useCaseIds],
|
|
|
+ goodsIds: [...this.filters.goodsIds],
|
|
|
minPrice,
|
|
|
maxPrice,
|
|
|
delivery: this.draft.delivery
|