总价/书价按钮点击重新调API+传sortType(7/5)

This commit is contained in:
97694732@qq.com 2026-06-03 16:50:42 +08:00
parent 5a88e146fe
commit 9f0aab78a3
2 changed files with 16 additions and 9 deletions

View File

@ -987,9 +987,11 @@ export default {
// 2. -
const phpsessid = this.kongfzToken || uni.getStorageSync('kongfz_phpsessid') || ''
// 7=() 5=
const sortType = this.sortBy === 'book' ? '5' : '7'
// + +
Promise.all([
searchProducts(keyword, { phpsessid }),
searchProducts(keyword, { phpsessid, sortType }),
searchFacet(keyword, { phpsessid, dataType: 0 }),
searchFacet(keyword, { phpsessid, dataType: 1 })
]).then(([productsData, onSaleFacet, soldFacet]) => {
@ -1225,9 +1227,10 @@ export default {
this.searchISBN()
},
// -
// -
sortProducts(by) {
this.sortBy = by
this.searchISBN()
},
//

View File

@ -190,17 +190,21 @@ export function fetchItems(token, params = {}, onProgress) {
* list中每项: {id, title, author, press, priceText, imgBigUrl, shopName, qualityText, pubDateText, postage}
*/
export function searchProducts(keyword, options = {}) {
const { phpsessid = '', page = 1 } = options
const { phpsessid = '', page = 1, sortType = '' } = options
return new Promise((resolve, reject) => {
const reqData = {
dataType: 0,
keyword: keyword,
page: page,
userArea: '13003000000'
}
if (sortType) {
reqData.sortType = sortType
}
uni.request({
url: 'https://search.kongfz.com/pc-gw/search-web/client/pc/product/keyword/list',
method: 'GET',
data: {
dataType: 0,
keyword: keyword,
page: page,
userArea: '13003000000'
},
data: reqData,
header: {
'Cookie': phpsessid ? `PHPSESSID=${phpsessid}` : ''
},