国家标注,价格筛选

This commit is contained in:
2026-08-31 14:26:05 +08:00
parent 3bd58e05c5
commit 502d8def61
3 changed files with 174 additions and 8 deletions
+19 -2
View File
@@ -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)