Authored by yyq

高级选项调整

... ... @@ -85,6 +85,7 @@ exports.brand = (req, res, next) => {
if (req.shopId) {
return shop(req.shopId, req, res, next);
}
// let brandDomain = 'colormad';
let brandDomain = req.brandDomain || 'shop$15';
... ...
... ... @@ -75,6 +75,7 @@ exports.getListData = (params) => {
goods: productProcess.processProductList(result[2].data.product_list,
Object.assign({showDiscount: false}, params))
});
// 获取高级筛选条件
if (finalResult.list && finalResult.list.filters) {
Object.assign(finalResult.list.filters, searchHandler.handleSeniorFilterData({
... ... @@ -479,7 +480,7 @@ exports.getShopListData = (params) => {
goods: productProcess.processProductList(_.get(result[2], 'data.product_list', [])),
footPager: {tip: tip}
});
// 获取高级筛选条件
if (finalResult.list && finalResult.list.filters) {
Object.assign(finalResult.list.filters, searchHandler.handleSeniorFilterData({
... ...
... ... @@ -31,6 +31,7 @@ const relateArticleUrl = 'guang/service/v2/article/getArticleByBrand';
const getProductList = (params) => {
let finalParams = {
method: 'web.search.search',
// method: 'app.search.li',
order: 's_n_desc',
limit: 60
... ...
... ... @@ -24,7 +24,7 @@ const checksName = {
* @returns {string}
*/
const handleFilterUrl = (originParam, newParam, delParam) => {
let dest = '';
let dest = '?';
let tempOriginParam = {};
delParam = delParam || {};
... ... @@ -38,9 +38,7 @@ const handleFilterUrl = (originParam, newParam, delParam) => {
}
});
dest = dest ? _.trim(`?${dest}`, '&') : '';
return dest;
return _.trim(dest, '&');
};
/**
... ... @@ -637,26 +635,37 @@ exports.handleFilterData = (origin, params) => {
* @returns {{}}
*/
exports.handleSeniorFilterData = (data, params) => {
let resData = {
checkedConditions: {
conditions: []
}
};
let resData = {};
if (data) {
let chose = [];
let conditions = [];
if (!_.isEmpty(data.style)) {
let sub = [];
let sub = [],
conName = [];
let styles = _.split(_.get(params, 'style', ''), ',');
_.forEach(data.style, value => {
let ched = styles.indexOf(`${value.style_id}`) >= 0;
if (ched && conName.length < 2) {
conName.push(value.style_name);
}
sub.push({
id: value.style_id,
checked: parseInt(params.style, 10) === parseInt(value.style_id, 10),
checked: ched,
href: handleFilterUrl(params, {style: value.style_id}),
name: value.style_name
});
});
if (conName.length) {
conditions.push({
name: _.join(conName, '、'),
href: handleFilterUrl(params, {}, {style: true})
});
}
chose.push({
name: '风格',
showMulti: true,
... ... @@ -668,32 +677,46 @@ exports.handleSeniorFilterData = (data, params) => {
if (!_.isEmpty(data.standard)) {
_.forEach(data.standard, value => {
let sub = [];
let parKey = `parameter_${value.standard_id}`;
_.forEach(value.sub, subValue => {
let standard = {};
let ched = parseInt(params[parKey], 10) === parseInt(subValue.standard_id, 10);
standard[parKey] = subValue.standard_id;
if (ched) {
conditions.push({
name: subValue.standard_name,
href: handleFilterUrl(params, {}, standard),
});
}
sub.push({
id: value.standard_id,
checked: parseInt(params.standard_val, 10) === parseInt(subValue.standard_id, 10),
href: handleFilterUrl(params, {
standard_id: value.standard_id,
standard_val: subValue.standard_id
}),
checked: ched,
href: handleFilterUrl(params, standard),
name: subValue.standard_name
});
})
});
});
chose.push({
name: value.standard_name,
sub: sub
});
})
});
}
if (!_.isEmpty(chose)) {
resData.seniorChose = chose;
}
if (!_.isEmpty(conditions)) {
_.set(resData, 'checkedConditions.conditions', conditions);
}
}
return resData;
}
};
/**
* 根据页面设置面包屑导航
... ...
... ... @@ -14,13 +14,13 @@ module.exports = {
port: 6002,
siteUrl: 'http://www.yohobuy.com',
domains: {
api: 'http://api.yoho.yohoops.org',
// api: 'http://api.yoho.yohoops.org',
// api: 'http://devapi.yoho.cn:58078/',
api: 'http://api-test1.yohops.com:9999/',
// api: 'http://testapi.yoho.cn:28078/',
// service: 'http://devservice.yoho.cn:58077/',
service: 'http://service.yoho.yohoops.org/',
service: 'http://service-test1.yohops.com:9999/',
// service: 'http://service.yoho.yohoops.org/',
// service: 'http://testservice.yoho.cn:28077/',
search: 'http://192.168.102.216:8080/yohosearch/'
... ...
... ... @@ -25,6 +25,7 @@ require('../plugins/filter');
require('../plugins/sort-pager');
require('../plugins/slider');
// require('../product/list');
product.init(4);
... ...