国家标注,价格筛选
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
:loading="loadingMore"
|
||||
:scroll-top-val="scrollTopVal"
|
||||
:scroll-height="productScrollHeight"
|
||||
:show-country-tag="!selectedCountry"
|
||||
@sub-select="selectSubCategory"
|
||||
@product-click="goDetail"
|
||||
@scroll-to-lower="onScrollToLower"
|
||||
@@ -114,6 +115,8 @@ export default {
|
||||
activeFilters: [],
|
||||
showFilter: false,
|
||||
filterGroups: [],
|
||||
minPrice: '',
|
||||
maxPrice: '',
|
||||
pagination: {
|
||||
total: 0,
|
||||
current: 1,
|
||||
@@ -255,7 +258,9 @@ export default {
|
||||
id: item.goodId,
|
||||
name: truncateProductTitle(item.goodName),
|
||||
price: item.price,
|
||||
image: item.image
|
||||
image: item.image,
|
||||
countryName: (item.country && item.country.countryName) || '',
|
||||
countryIcon: (item.country && item.country.countryIcon) ? buildUrl(item.country.countryIcon) : ''
|
||||
}))
|
||||
|
||||
const total = data.total || 0
|
||||
@@ -316,6 +321,13 @@ export default {
|
||||
if (kw) {
|
||||
params.keyword = kw
|
||||
}
|
||||
// 价格区间:两个可单独传,也可同时传
|
||||
if (this.minPrice !== '' && this.minPrice !== null && this.minPrice !== undefined) {
|
||||
params.minPrice = this.minPrice
|
||||
}
|
||||
if (this.maxPrice !== '' && this.maxPrice !== null && this.maxPrice !== undefined) {
|
||||
params.maxPrice = this.maxPrice
|
||||
}
|
||||
const tagsList = (this.filterGroups || [])
|
||||
.filter((g) => g.selected && g.selected.length > 0)
|
||||
.map((g) => ({
|
||||
@@ -514,6 +526,8 @@ export default {
|
||||
async clearAllFilters() {
|
||||
const hasCountry = this.activeFilters.some((f) => f.key === 'country')
|
||||
this.activeFilters = []
|
||||
this.minPrice = ''
|
||||
this.maxPrice = ''
|
||||
if (hasCountry || this.selectedCountry) {
|
||||
this.selectedCountry = ''
|
||||
await this.loadCategoryData('')
|
||||
@@ -532,7 +546,10 @@ export default {
|
||||
this.filterGroups = groups
|
||||
},
|
||||
|
||||
async confirmFilters() {
|
||||
async confirmFilters(payload) {
|
||||
payload = payload || {}
|
||||
this.minPrice = payload.minPrice || ''
|
||||
this.maxPrice = payload.maxPrice || ''
|
||||
var filters = []
|
||||
var countryFilter = this.activeFilters.find(function (f) { return f.key === 'country' })
|
||||
if (countryFilter) filters.push(countryFilter)
|
||||
|
||||
Reference in New Issue
Block a user