总价/书价按钮点击重新调API+传sortType(7/5)
This commit is contained in:
parent
5a88e146fe
commit
9f0aab78a3
@ -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()
|
||||||
},
|
},
|
||||||
|
|
||||||
// 筛选
|
// 筛选
|
||||||
|
|||||||
@ -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}` : ''
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user