...
|
...
|
@@ -341,6 +341,13 @@ export function productListFailure(error) { |
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 筛选
|
|
|
*/
|
|
|
export function setProductFilterFactors(categort, deatil){
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 底部产品列表
|
|
|
*/
|
|
|
export function getProductList(reload=false) {
|
...
|
...
|
@@ -363,17 +370,16 @@ export function getProductList(reload=false) { |
|
|
|
|
|
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];
|
|
|
if (allFilterFactors[pactor] === '') {
|
|
|
delete allFilterFactors[pactor];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
dispatch(productListRequest());
|
|
|
return new BrandStoreService().productList(shopId, channel, order, page, pageSize, bSelectedFilterFactor)
|
|
|
return new BrandStoreService().productList(shopId, channel, order, page, pageSize, allFilterFactors)
|
|
|
.then(json => {
|
|
|
let payload = parseProductList(json);
|
|
|
payload.endReached = payload.currentPage == payload.pageCount;
|
...
|
...
|
@@ -398,10 +404,164 @@ function parseProductList(json) { |
|
|
|
|
|
let filter = json && json.filter ? json.filter : {};
|
|
|
let list = json && json.product_list ? json.product_list : [];
|
|
|
let filterCategoryDetailFilterList = {};
|
|
|
let categoryFilterList = [];
|
|
|
|
|
|
if (filter['gender']) {
|
|
|
categoryFilterList.push({
|
|
|
key: 'gender',
|
|
|
name: '性别',
|
|
|
isSelect: false,
|
|
|
});
|
|
|
let genderList = filter['gender'];
|
|
|
let newGenderList =[];
|
|
|
newGenderList.push({
|
|
|
key:'',
|
|
|
name: '所有性别',
|
|
|
isSelect: true,
|
|
|
});
|
|
|
for (let gender in genderList) {
|
|
|
if (genderList.hasOwnProperty(gender)) {
|
|
|
newGenderList.push({
|
|
|
key: gender,
|
|
|
name: genderList[gender],
|
|
|
isSelect: false,
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
filterCategoryDetailFilterList.gender;
|
|
|
filterCategoryDetailFilterList.gender = newGenderList;
|
|
|
}
|
|
|
|
|
|
if (filter['group_sort']) {
|
|
|
categoryFilterList.push({
|
|
|
key: 'sort',
|
|
|
name: '品类',
|
|
|
isSelect: false,
|
|
|
});
|
|
|
let sortList = filter['group_sort'];
|
|
|
let newSortList = [];
|
|
|
newSortList.push({
|
|
|
key: '',
|
|
|
name: '所有品类',
|
|
|
isSelect: true,
|
|
|
});
|
|
|
sortList.map((item, i) => {
|
|
|
newSortList.push({
|
|
|
key: item.relation_parameter.sort ? item.relation_parameter.sort : '',
|
|
|
name: item.category_name,
|
|
|
isSelect: false,
|
|
|
})
|
|
|
});
|
|
|
filterCategoryDetailFilterList.sort;
|
|
|
filterCategoryDetailFilterList.sort = newSortList;
|
|
|
}
|
|
|
|
|
|
if (filter['color']) {
|
|
|
categoryFilterList.push({
|
|
|
key: 'color',
|
|
|
name: '颜色',
|
|
|
isSelect: false,
|
|
|
});
|
|
|
let colorList = filter['color'];
|
|
|
let newColorList = [];
|
|
|
newColorList.push({
|
|
|
key: '',
|
|
|
name: '所有颜色',
|
|
|
isSelect: true,
|
|
|
});
|
|
|
colorList.map((item, i) => {
|
|
|
newColorList.push({
|
|
|
key: item.color_id,
|
|
|
name: item.color_name,
|
|
|
isSelect: false,
|
|
|
});
|
|
|
});
|
|
|
filterCategoryDetailFilterList.color;
|
|
|
filterCategoryDetailFilterList.color = newColorList;
|
|
|
}
|
|
|
|
|
|
if (filter['size']) {
|
|
|
categoryFilterList.push({
|
|
|
key: 'size',
|
|
|
name: '尺码',
|
|
|
isSelect: false,
|
|
|
});
|
|
|
let sizeList = filter['size'];
|
|
|
let newSizeList = [];
|
|
|
newSizeList.push({
|
|
|
key: '',
|
|
|
name: '所有尺码',
|
|
|
isSelect: true,
|
|
|
});
|
|
|
sizeList.map((item, i) => {
|
|
|
newSizeList.push({
|
|
|
key: item.size_id,
|
|
|
name: item.size_name,
|
|
|
isSelect: false,
|
|
|
});
|
|
|
});
|
|
|
filterCategoryDetailFilterList.size;
|
|
|
filterCategoryDetailFilterList.size = newSizeList;
|
|
|
}
|
|
|
|
|
|
if (filter['priceRange']) {
|
|
|
categoryFilterList.push({
|
|
|
key: 'price',
|
|
|
name: '价格',
|
|
|
isSelect: false,
|
|
|
});
|
|
|
let priceObject = filter['priceRange'];
|
|
|
let newPriceList = [];
|
|
|
newPriceList.push({
|
|
|
key: '',
|
|
|
name: '所有价格',
|
|
|
isSelect: true,
|
|
|
});
|
|
|
for (var price in priceObject) {
|
|
|
if (priceObject.hasOwnProperty(price)) {
|
|
|
newPriceList.push({
|
|
|
key: price,
|
|
|
name: priceObject[price],
|
|
|
isSelect: false,
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
filterCategoryDetailFilterList.price;
|
|
|
filterCategoryDetailFilterList.price = newPriceList;
|
|
|
}
|
|
|
|
|
|
if (filter['discount']) {
|
|
|
categoryFilterList.push({
|
|
|
key: 'p_d',
|
|
|
name: '折扣',
|
|
|
isSelect: false,
|
|
|
});
|
|
|
let p_dObject = filter['discount'];
|
|
|
let newP_dList = [];
|
|
|
newP_dList.push({
|
|
|
key: '',
|
|
|
name: '所有折扣',
|
|
|
isSelect: true,
|
|
|
});
|
|
|
for (var p_d in p_dObject) {
|
|
|
if (p_dObject.hasOwnProperty(p_d)) {
|
|
|
newP_dList.push({
|
|
|
key: p_d,
|
|
|
name: p_dObject[p_d].name,
|
|
|
isSelect: false,
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
filterCategoryDetailFilterList.p_d;
|
|
|
filterCategoryDetailFilterList.p_d = newP_dList;
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
list,
|
|
|
filter,
|
|
|
categoryFilterList,
|
|
|
filterCategoryDetailFilterList,
|
|
|
currentPage,
|
|
|
pageCount,
|
|
|
total,
|
...
|
...
|
|