...
|
...
|
@@ -446,6 +446,10 @@ export function getProductList(reload=false) { |
|
|
let list = [...oldList, ...payload.list];
|
|
|
payload.list = list;
|
|
|
}
|
|
|
let categoryFilterList = payload.categoryFilterList;
|
|
|
let filterCategoryDetailFilterList = payload.filterCategoryDetailFilterList;
|
|
|
let filters = parsecategoryFilter({categoryFilterList,filterCategoryDetailFilterList});
|
|
|
ReactNative.NativeModules.YH_ProductListRNViewHelper.setFilterData(filters);
|
|
|
dispatch(productListSuccess(payload));
|
|
|
})
|
|
|
.catch(error => {
|
...
|
...
|
@@ -465,6 +469,48 @@ function randomString(len) { |
|
|
return pwd;
|
|
|
}
|
|
|
|
|
|
function parsecategoryFilter(json) {
|
|
|
let categoryFilterList = json.categoryFilterList;
|
|
|
let filterCategoryDetailFilterList = json.filterCategoryDetailFilterList;
|
|
|
|
|
|
for (var i = 0; i < categoryFilterList.length; i++) {
|
|
|
let key = categoryFilterList[i].key;
|
|
|
let type = 0;
|
|
|
if (key == 'sort') {
|
|
|
type = 0;
|
|
|
}else if (key == 'brand'){
|
|
|
type = 1;
|
|
|
}else if (key == 'color'){
|
|
|
type = 2;
|
|
|
}else if (key == 'sizeKey'){
|
|
|
type = 3;
|
|
|
}else if (key == 'price'){
|
|
|
type = 4;
|
|
|
}else if (key == 'p_d'){
|
|
|
type = 5;
|
|
|
}else if (key == 'gender'){
|
|
|
type = 7;
|
|
|
}else if (key == 'style'){
|
|
|
type = 10;
|
|
|
}
|
|
|
_.forEach(filterCategoryDetailFilterList, (v, k) => {
|
|
|
if (k == key) {
|
|
|
let list = v;
|
|
|
for (var j = 0; j < list.length; j++) {
|
|
|
if (list[j].isSelect) {
|
|
|
categoryFilterList[i].select = list[j];
|
|
|
categoryFilterList[i].subFilter = {list,key,type};
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return{
|
|
|
categoryFilterList,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function parseProductList(json) {
|
|
|
let currentPage = json && json.page ? json.page : 1;
|
|
|
let pageCount = json && json.page_total ? json.page_total : 0;
|
...
|
...
|
@@ -647,6 +693,32 @@ function parseProductList(json) { |
|
|
filterCategoryDetailFilterList.p_d = newP_dList;
|
|
|
}
|
|
|
|
|
|
if (filter['style']) {
|
|
|
categoryFilterList.push({
|
|
|
key: 'style',
|
|
|
name: '风格',
|
|
|
isSelect: false,
|
|
|
});
|
|
|
let p_dObject = filter['style'];
|
|
|
p_dObject = sortListByField(p_dObject, 'style_name'); // 折扣,价格区间,需要排序
|
|
|
let newP_dList = [];
|
|
|
newP_dList.push({
|
|
|
key: '',
|
|
|
name: '所有风格',
|
|
|
isSelect: true,
|
|
|
});
|
|
|
_.forEach(p_dObject, (v, k) => {
|
|
|
newP_dList.push({
|
|
|
key: v._key,
|
|
|
name: v.name,
|
|
|
isSelect: false,
|
|
|
});
|
|
|
});
|
|
|
filterCategoryDetailFilterList.style;
|
|
|
filterCategoryDetailFilterList.style = newP_dList;
|
|
|
}
|
|
|
|
|
|
|
|
|
let recId = randomString(40);
|
|
|
return {
|
|
|
list,
|
...
|
...
|
|