feat:选择作者/出版社/分类时联动刷新并重搜在售商品
This commit is contained in:
parent
bb7f104231
commit
88af858483
@ -969,6 +969,7 @@ export default {
|
|||||||
noIsbnCategoryLoading: false,
|
noIsbnCategoryLoading: false,
|
||||||
noIsbnSelectedCategoryValue: '',
|
noIsbnSelectedCategoryValue: '',
|
||||||
_noIsbnCategoryTimer: null,
|
_noIsbnCategoryTimer: null,
|
||||||
|
_reSearchTimer: null,
|
||||||
|
|
||||||
// 无ISBN - 市场竞争/在售
|
// 无ISBN - 市场竞争/在售
|
||||||
noIsbnProductList: [],
|
noIsbnProductList: [],
|
||||||
@ -1960,6 +1961,16 @@ export default {
|
|||||||
this.noIsbnCategoryIndex = index
|
this.noIsbnCategoryIndex = index
|
||||||
var item = this.noIsbnCategoryList[index]
|
var item = this.noIsbnCategoryList[index]
|
||||||
this.noIsbnSelectedCategoryValue = item ? item.value : ''
|
this.noIsbnSelectedCategoryValue = item ? item.value : ''
|
||||||
|
// 选择分类后:重新搜索在售商品
|
||||||
|
this.debouncedReSearch()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 防抖重新搜索在售商品(300ms)
|
||||||
|
debouncedReSearch() {
|
||||||
|
if (this._reSearchTimer) clearTimeout(this._reSearchTimer)
|
||||||
|
this._reSearchTimer = setTimeout(() => {
|
||||||
|
this.searchNoIsbnKongfz()
|
||||||
|
}, 300)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 印刷时间 - 列变化
|
// 印刷时间 - 列变化
|
||||||
@ -3181,7 +3192,10 @@ export default {
|
|||||||
this.noIsbnLoading = true
|
this.noIsbnLoading = true
|
||||||
this.noIsbnProductList = []
|
this.noIsbnProductList = []
|
||||||
const keyword = this.noIsbnBookName
|
const keyword = this.noIsbnBookName
|
||||||
this.kongfzSearchWithRetry(keyword, { sortType: '7', quality: this.noIsbnConditionValue }).then(function(result) {
|
var searchOpts = { sortType: '7', quality: this.noIsbnConditionValue }
|
||||||
|
if (this.noIsbnAuthor) searchOpts.author = this.noIsbnAuthor
|
||||||
|
if (this.noIsbnPublisher) searchOpts.publisher = this.noIsbnPublisher
|
||||||
|
this.kongfzSearchWithRetry(keyword, searchOpts).then(function(result) {
|
||||||
var productsData = result[0]
|
var productsData = result[0]
|
||||||
var onSaleFacet = result[1]
|
var onSaleFacet = result[1]
|
||||||
var soldFacet = result[2]
|
var soldFacet = result[2]
|
||||||
@ -3449,14 +3463,36 @@ export default {
|
|||||||
|
|
||||||
// 无ISBN - 选择作者
|
// 无ISBN - 选择作者
|
||||||
selectNoIsbnAuthor(item) {
|
selectNoIsbnAuthor(item) {
|
||||||
this.noIsbnAuthor = item
|
this.noIsbnAuthor = typeof item === 'string' ? item : (item.showName || '')
|
||||||
this.noIsbnAuthorDropdownVisible = false
|
this.noIsbnAuthorDropdownVisible = false
|
||||||
|
// 选择作者后:重新获取出版社(带作者过滤)+ 重新搜索在售商品
|
||||||
|
this.fetchNoIsbnPressesByAuthor(this.noIsbnAuthor)
|
||||||
|
this.debouncedReSearch()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 选择作者后重新获取出版社(按作者过滤)
|
||||||
|
async fetchNoIsbnPressesByAuthor(author) {
|
||||||
|
var bookName = (this.noIsbnBookName || '').trim()
|
||||||
|
if (!bookName || !author) return
|
||||||
|
try {
|
||||||
|
var pressList = await searchPresses(bookName, {
|
||||||
|
phpsessid: this.kongfzToken || '',
|
||||||
|
author: author
|
||||||
|
})
|
||||||
|
if (pressList.length > 0) {
|
||||||
|
this.noIsbnPublisherOptions = pressList.slice(0, 20)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('按作者获取出版社失败:', e)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 无ISBN - 选择出版社
|
// 无ISBN - 选择出版社
|
||||||
selectNoIsbnPublisher(item) {
|
selectNoIsbnPublisher(item) {
|
||||||
this.noIsbnPublisher = typeof item === 'string' ? item : (item.showName || '')
|
this.noIsbnPublisher = typeof item === 'string' ? item : (item.showName || '')
|
||||||
this.noIsbnPublisherDropdownVisible = false
|
this.noIsbnPublisherDropdownVisible = false
|
||||||
|
// 选择出版社后:重新搜索在售商品
|
||||||
|
this.debouncedReSearch()
|
||||||
},
|
},
|
||||||
|
|
||||||
// 无ISBN - 选择开本
|
// 无ISBN - 选择开本
|
||||||
|
|||||||
@ -310,13 +310,13 @@ export function searchCategories(keyword, options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取孔网出版社列表(根据书名)
|
* 获取孔网出版社列表(根据书名,可选按作者过滤)
|
||||||
* @param {string} keyword 书名
|
* @param {string} keyword 书名
|
||||||
* @param {object} options { phpsessid, userArea }
|
* @param {object} options { phpsessid, userArea, author }
|
||||||
* @returns {Promise<Array<{showName:string, showValue:string}>>} 出版社列表
|
* @returns {Promise<Array<{showName:string, showValue:string}>>} 出版社列表
|
||||||
*/
|
*/
|
||||||
export function searchPresses(keyword, options = {}) {
|
export function searchPresses(keyword, options = {}) {
|
||||||
const { phpsessid = '', userArea = '1006000000' } = options
|
const { phpsessid = '', userArea = '1006000000', author = '' } = options
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
if (!keyword || !keyword.trim()) {
|
if (!keyword || !keyword.trim()) {
|
||||||
resolve([])
|
resolve([])
|
||||||
@ -337,8 +337,14 @@ export function searchPresses(keyword, options = {}) {
|
|||||||
tplParams: '{}',
|
tplParams: '{}',
|
||||||
sortType: 0,
|
sortType: 0,
|
||||||
abGroup: 'B',
|
abGroup: 'B',
|
||||||
filterType: 'press',
|
filterType: 'press'
|
||||||
notSelectSearchMode: 'true'
|
}
|
||||||
|
if (author) {
|
||||||
|
reqData.author = author
|
||||||
|
reqData.actionPath = 'author'
|
||||||
|
reqData.notSelectSearchMode = 'false'
|
||||||
|
} else {
|
||||||
|
reqData.notSelectSearchMode = 'true'
|
||||||
}
|
}
|
||||||
uni.request({
|
uni.request({
|
||||||
url: 'https://search.kongfz.com/pc-gw/search-web/client/pc/product/keyword/more/press/facet',
|
url: 'https://search.kongfz.com/pc-gw/search-web/client/pc/product/keyword/more/press/facet',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user