Authored by yyq

高级选项调整

@@ -85,6 +85,7 @@ exports.brand = (req, res, next) => { @@ -85,6 +85,7 @@ exports.brand = (req, res, next) => {
85 if (req.shopId) { 85 if (req.shopId) {
86 return shop(req.shopId, req, res, next); 86 return shop(req.shopId, req, res, next);
87 } 87 }
  88 +
88 // let brandDomain = 'colormad'; 89 // let brandDomain = 'colormad';
89 90
90 let brandDomain = req.brandDomain || 'shop$15'; 91 let brandDomain = req.brandDomain || 'shop$15';
@@ -75,6 +75,7 @@ exports.getListData = (params) => { @@ -75,6 +75,7 @@ exports.getListData = (params) => {
75 goods: productProcess.processProductList(result[2].data.product_list, 75 goods: productProcess.processProductList(result[2].data.product_list,
76 Object.assign({showDiscount: false}, params)) 76 Object.assign({showDiscount: false}, params))
77 }); 77 });
  78 +
78 // 获取高级筛选条件 79 // 获取高级筛选条件
79 if (finalResult.list && finalResult.list.filters) { 80 if (finalResult.list && finalResult.list.filters) {
80 Object.assign(finalResult.list.filters, searchHandler.handleSeniorFilterData({ 81 Object.assign(finalResult.list.filters, searchHandler.handleSeniorFilterData({
@@ -31,6 +31,7 @@ const relateArticleUrl = 'guang/service/v2/article/getArticleByBrand'; @@ -31,6 +31,7 @@ const relateArticleUrl = 'guang/service/v2/article/getArticleByBrand';
31 const getProductList = (params) => { 31 const getProductList = (params) => {
32 let finalParams = { 32 let finalParams = {
33 method: 'web.search.search', 33 method: 'web.search.search',
  34 +
34 // method: 'app.search.li', 35 // method: 'app.search.li',
35 order: 's_n_desc', 36 order: 's_n_desc',
36 limit: 60 37 limit: 60
@@ -24,7 +24,7 @@ const checksName = { @@ -24,7 +24,7 @@ const checksName = {
24 * @returns {string} 24 * @returns {string}
25 */ 25 */
26 const handleFilterUrl = (originParam, newParam, delParam) => { 26 const handleFilterUrl = (originParam, newParam, delParam) => {
27 - let dest = ''; 27 + let dest = '?';
28 let tempOriginParam = {}; 28 let tempOriginParam = {};
29 29
30 delParam = delParam || {}; 30 delParam = delParam || {};
@@ -38,9 +38,7 @@ const handleFilterUrl = (originParam, newParam, delParam) => { @@ -38,9 +38,7 @@ const handleFilterUrl = (originParam, newParam, delParam) => {
38 } 38 }
39 }); 39 });
40 40
41 - dest = dest ? _.trim(`?${dest}`, '&') : '';  
42 -  
43 - return dest; 41 + return _.trim(dest, '&');
44 }; 42 };
45 43
46 /** 44 /**
@@ -637,26 +635,37 @@ exports.handleFilterData = (origin, params) => { @@ -637,26 +635,37 @@ exports.handleFilterData = (origin, params) => {
637 * @returns {{}} 635 * @returns {{}}
638 */ 636 */
639 exports.handleSeniorFilterData = (data, params) => { 637 exports.handleSeniorFilterData = (data, params) => {
640 - let resData = {  
641 - checkedConditions: {  
642 - conditions: []  
643 - }  
644 - }; 638 + let resData = {};
645 639
646 if (data) { 640 if (data) {
647 let chose = []; 641 let chose = [];
  642 + let conditions = [];
648 643
649 if (!_.isEmpty(data.style)) { 644 if (!_.isEmpty(data.style)) {
650 - let sub = []; 645 + let sub = [],
  646 + conName = [];
  647 + let styles = _.split(_.get(params, 'style', ''), ',');
651 648
652 _.forEach(data.style, value => { 649 _.forEach(data.style, value => {
  650 + let ched = styles.indexOf(`${value.style_id}`) >= 0;
  651 +
  652 + if (ched && conName.length < 2) {
  653 + conName.push(value.style_name);
  654 + }
653 sub.push({ 655 sub.push({
654 id: value.style_id, 656 id: value.style_id,
655 - checked: parseInt(params.style, 10) === parseInt(value.style_id, 10), 657 + checked: ched,
656 href: handleFilterUrl(params, {style: value.style_id}), 658 href: handleFilterUrl(params, {style: value.style_id}),
657 name: value.style_name 659 name: value.style_name
658 }); 660 });
659 }); 661 });
  662 +
  663 + if (conName.length) {
  664 + conditions.push({
  665 + name: _.join(conName, '、'),
  666 + href: handleFilterUrl(params, {}, {style: true})
  667 + });
  668 + }
660 chose.push({ 669 chose.push({
661 name: '风格', 670 name: '风格',
662 showMulti: true, 671 showMulti: true,
@@ -668,32 +677,46 @@ exports.handleSeniorFilterData = (data, params) => { @@ -668,32 +677,46 @@ exports.handleSeniorFilterData = (data, params) => {
668 if (!_.isEmpty(data.standard)) { 677 if (!_.isEmpty(data.standard)) {
669 _.forEach(data.standard, value => { 678 _.forEach(data.standard, value => {
670 let sub = []; 679 let sub = [];
  680 + let parKey = `parameter_${value.standard_id}`;
671 681
672 _.forEach(value.sub, subValue => { 682 _.forEach(value.sub, subValue => {
  683 + let standard = {};
  684 + let ched = parseInt(params[parKey], 10) === parseInt(subValue.standard_id, 10);
  685 +
  686 + standard[parKey] = subValue.standard_id;
  687 +
  688 + if (ched) {
  689 + conditions.push({
  690 + name: subValue.standard_name,
  691 + href: handleFilterUrl(params, {}, standard),
  692 + });
  693 + }
  694 +
673 sub.push({ 695 sub.push({
674 id: value.standard_id, 696 id: value.standard_id,
675 - checked: parseInt(params.standard_val, 10) === parseInt(subValue.standard_id, 10),  
676 - href: handleFilterUrl(params, {  
677 - standard_id: value.standard_id,  
678 - standard_val: subValue.standard_id  
679 - }), 697 + checked: ched,
  698 + href: handleFilterUrl(params, standard),
680 name: subValue.standard_name 699 name: subValue.standard_name
681 }); 700 });
682 - }) 701 + });
683 chose.push({ 702 chose.push({
684 name: value.standard_name, 703 name: value.standard_name,
685 sub: sub 704 sub: sub
686 }); 705 });
687 - }) 706 + });
688 } 707 }
689 708
690 if (!_.isEmpty(chose)) { 709 if (!_.isEmpty(chose)) {
691 resData.seniorChose = chose; 710 resData.seniorChose = chose;
692 } 711 }
  712 +
  713 + if (!_.isEmpty(conditions)) {
  714 + _.set(resData, 'checkedConditions.conditions', conditions);
  715 + }
693 } 716 }
694 717
695 return resData; 718 return resData;
696 -} 719 +};
697 720
698 /** 721 /**
699 * 根据页面设置面包屑导航 722 * 根据页面设置面包屑导航
@@ -14,13 +14,13 @@ module.exports = { @@ -14,13 +14,13 @@ module.exports = {
14 port: 6002, 14 port: 6002,
15 siteUrl: 'http://www.yohobuy.com', 15 siteUrl: 'http://www.yohobuy.com',
16 domains: { 16 domains: {
17 - api: 'http://api.yoho.yohoops.org', 17 + // api: 'http://api.yoho.yohoops.org',
18 18
19 - // api: 'http://devapi.yoho.cn:58078/', 19 + api: 'http://api-test1.yohops.com:9999/',
20 // api: 'http://testapi.yoho.cn:28078/', 20 // api: 'http://testapi.yoho.cn:28078/',
21 21
22 - // service: 'http://devservice.yoho.cn:58077/',  
23 - service: 'http://service.yoho.yohoops.org/', 22 + service: 'http://service-test1.yohops.com:9999/',
  23 + // service: 'http://service.yoho.yohoops.org/',
24 24
25 // service: 'http://testservice.yoho.cn:28077/', 25 // service: 'http://testservice.yoho.cn:28077/',
26 search: 'http://192.168.102.216:8080/yohosearch/' 26 search: 'http://192.168.102.216:8080/yohosearch/'
@@ -25,6 +25,7 @@ require('../plugins/filter'); @@ -25,6 +25,7 @@ require('../plugins/filter');
25 require('../plugins/sort-pager'); 25 require('../plugins/sort-pager');
26 26
27 require('../plugins/slider'); 27 require('../plugins/slider');
  28 +
28 // require('../product/list'); 29 // require('../product/list');
29 30
30 product.init(4); 31 product.init(4);