Authored by 张丽霞

搜索接口,review by 孙凯

... ... @@ -324,7 +324,7 @@ export function productListFailure(error) {
export function getProductList(reload=false) {
return (dispatch, getState) => {
let {app, brandStore} = getState();
let {shopId, productList} = brandStore;
let {shopId, productList, filterFactors} = brandStore;
if (reload) {
... ... @@ -339,8 +339,19 @@ export function getProductList(reload=false) {
let pageSize = productList.pageSize;
let channel = 1;
let bSelectedFilterFactor,allFilterFactors;
allFilterFactors = filterFactors.toJS();
for (var pactor in allFilterFactors) {
if (allFilterFactors.hasOwnProperty(pactor)) {
if (allFilterFactors[pactor]) {
bSelectedFilterFactor.push(pactor);
bSelectedFilterFactor[pactor] = allFilterFactors[pactor];
}
}
}
dispatch(productListRequest());
return new BrandStoreService().productList(shopId, channel, order, page, pageSize)
return new BrandStoreService().productList(shopId, channel, order, page, pageSize, bSelectedFilterFactor)
.then(json => {
let payload = parseProductList(json);
payload.endReached = payload.currentPage == payload.pageCount;
... ...
... ... @@ -61,6 +61,15 @@ let InitialState = Record({
sourceType: 0, // 0 - 默认,1 - 购,全球2 - 奥莱
})),
storeFilter: 0,
filterFactors: new (Record({
gender: null, //性别
color: null, //颜色
price: null, //价格
sizePara: null, //尺码
p_d: null, //折扣
sort: null, //品类
})),
isCollection: false,
hasBuy : false,
touchBrandItem : false,
... ...
... ... @@ -75,11 +75,11 @@ export default class BrandStoreService {
});
}
async productList(shop_id, yh_channel=1, order='s_t_asc', page=1, limit=60, v=7) {
async productList(shop_id, yh_channel=1, order='s_t_asc', page=1, limit=60, filterFactors, v=7) {
return await this.api.get({
url: '',
body: {
method: 'app.search.li',
method: 'app.search.brand',
shop_id,
yh_channel,
order,
... ... @@ -87,6 +87,7 @@ export default class BrandStoreService {
sales: 'Y',
stocknumber: 1,
attribute_not: 2,
...filterFactors,
v,
}
})
... ...