Authored by 姜枫

fix 1353

... ... @@ -78,7 +78,6 @@ const shop = {
queryParams: req.query
};
data.products = DataHelper.handleProductList(ret.productList);
console.log(data);
res.display('shop-index', data);
} else {
shop.list(req, res, next);
... ... @@ -100,7 +99,7 @@ const shop = {
let uid = req.user.uid;
let shopId = req.query.shopId;
let q = req.query;
let hasBrand = !!q.brand;
// let hasBrand = !!q.brand;
q.order = q.order || 's_n_desc';
q.page = parseInt(q.page || 1, 10);
... ... @@ -135,15 +134,14 @@ const shop = {
let ret = camelCase(result.data);
if (ret.filter) {
if (!hasBrand) {
delete q.brand;
}
ret.filter.standard = ret.standard;
ret.filter.groupSort = DataHelper.sortConvert(allSort.data.sort);
ret.filter.singleBrand = true;
data.filter = DataHelper.filterHandle(ret.filter, q);
data.filter.showPrice = ret.total > 10;
data.filter.showInfo = (data.filter.style && data.filter.style.length > 0)
|| (ret.standard && ret.standard.length > 0); //eslint-disable-line
}
data.paginationData = {
... ...
... ... @@ -344,14 +344,19 @@ const helpers = {
}
if (q.brand) {
let brandNames = brands.filter(b => {
let checkedBrands = brands.filter(b => {
return (',' + q.brand + ',').indexOf(',' + b.id + ',') >= 0;
}).map(b => {
});
let brandNames = checkedBrands.map(b => {
b.checked = true;
return b.brandNameEn || b.brandName;
}).join('、');
if (brandNames) {
if (filter.singleBrand) {
brands = checkedBrands;
}
if (brandNames && !filter.singleBrand) {
brandNames = brandNames.length > 10 ? brandNames.substr(0, 10) + '...' : brandNames;
filters.push(this.newFilter('brand', q.brand, brandNames));
}
... ...