...
|
...
|
@@ -109,6 +109,13 @@ export function getProductList(reload=false) { |
|
|
saleType: saleType,
|
|
|
productPool: productPool,
|
|
|
};
|
|
|
}else if (type == 'YH_InstalmentView') {
|
|
|
params = {
|
|
|
method: 'app.search.instalment',
|
|
|
}
|
|
|
}else if (type == 'YH_NewUserView') {
|
|
|
dispatch(getNewUserProductList(reload));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let bSelectedFilterFactor,allFilterFactors;
|
...
|
...
|
@@ -160,6 +167,73 @@ export function getProductList(reload=false) { |
|
|
};
|
|
|
}
|
|
|
|
|
|
export function getNewUserProductList(reload=false) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app, productListPool} = getState();
|
|
|
let {productList, filterFactors} = productListPool;
|
|
|
let {originParams} = app;
|
|
|
|
|
|
if (reload) {
|
|
|
|
|
|
} else {
|
|
|
if (productList.isFetching || productList.endReached || productList.error) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
let page = productList.currentPage + 1;
|
|
|
let pageSize = productList.pageSize;
|
|
|
let order = productList.order;
|
|
|
let params = {};
|
|
|
|
|
|
let bSelectedFilterFactor,allFilterFactors;
|
|
|
allFilterFactors = filterFactors.toJS();
|
|
|
|
|
|
for (let prop in allFilterFactors) {
|
|
|
if (allFilterFactors.hasOwnProperty(prop)) {
|
|
|
if (allFilterFactors[prop] === '' || !allFilterFactors[prop]) {
|
|
|
delete allFilterFactors[prop];
|
|
|
}
|
|
|
if (prop == 'sizeKey' && allFilterFactors[prop]) {
|
|
|
allFilterFactors['size'] = allFilterFactors[prop];
|
|
|
delete allFilterFactors[prop];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
let getList = (uid) => {
|
|
|
dispatch(productListRequest());
|
|
|
return new ProductListPoolService(app.serviceHost).newUserProductList(uid, order, page, pageSize, originParams, allFilterFactors, params)
|
|
|
.then(json => {
|
|
|
let payload = Utils.parseProductList(json);
|
|
|
payload.endReached = payload.currentPage == payload.pageCount;
|
|
|
|
|
|
if (payload.currentPage > 1) {
|
|
|
let oldList = productList.list.toJS();
|
|
|
let list = [...oldList, ...payload.list];
|
|
|
payload.list = list;
|
|
|
}
|
|
|
let categoryFilterList = payload.categoryFilterList;
|
|
|
let filterCategoryDetailFilterList = payload.filterCategoryDetailFilterList;
|
|
|
let filters = Utils.parsecategoryFilter({categoryFilterList,filterCategoryDetailFilterList});
|
|
|
ReactNative.NativeModules.YH_ProductListRNViewHelper.setFilterData(filters);
|
|
|
ReactNative.NativeModules.YH_FilterHelper.enableBrandFilter(true);
|
|
|
dispatch(productListSuccess(payload));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
dispatch(productListFailure(error));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
ReactNative.NativeModules.YH_CommonHelper.uid()
|
|
|
.then(uid => {
|
|
|
getList(uid);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
getList('');
|
|
|
});
|
|
|
};
|
|
|
}
|
|
|
|
|
|
export function getBannerListWithContentCodeRequest() {
|
|
|
return {
|
|
|
type: GET_BANNERLIST_REQUEST,
|
...
|
...
|
|