总价/书价按钮点击重新调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. - // 2. -
const phpsessid = this.kongfzToken || uni.getStorageSync('kongfz_phpsessid') || '' const phpsessid = this.kongfzToken || uni.getStorageSync('kongfz_phpsessid') || ''
// 7=() 5=
const sortType = this.sortBy === 'book' ? '5' : '7'
// + + // + +
Promise.all([ Promise.all([
searchProducts(keyword, { phpsessid }), searchProducts(keyword, { phpsessid, sortType }),
searchFacet(keyword, { phpsessid, dataType: 0 }), searchFacet(keyword, { phpsessid, dataType: 0 }),
searchFacet(keyword, { phpsessid, dataType: 1 }) searchFacet(keyword, { phpsessid, dataType: 1 })
]).then(([productsData, onSaleFacet, soldFacet]) => { ]).then(([productsData, onSaleFacet, soldFacet]) => {
@ -1225,9 +1227,10 @@ export default {
this.searchISBN() this.searchISBN()
}, },
// - // -
sortProducts(by) { sortProducts(by) {
this.sortBy = 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} * list中每项: {id, title, author, press, priceText, imgBigUrl, shopName, qualityText, pubDateText, postage}
*/ */
export function searchProducts(keyword, options = {}) { export function searchProducts(keyword, options = {}) {
const { phpsessid = '', page = 1 } = options const { phpsessid = '', page = 1, sortType = '' } = options
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ const reqData = {
url: 'https://search.kongfz.com/pc-gw/search-web/client/pc/product/keyword/list',
method: 'GET',
data: {
dataType: 0, dataType: 0,
keyword: keyword, keyword: keyword,
page: page, page: page,
userArea: '13003000000' 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: reqData,
header: { header: {
'Cookie': phpsessid ? `PHPSESSID=${phpsessid}` : '' 'Cookie': phpsessid ? `PHPSESSID=${phpsessid}` : ''
}, },