Authored by 郭成尧

'品牌数据筛选'

@@ -80,7 +80,7 @@ const handleFilterUrl = (originParam, newParam) => { @@ -80,7 +80,7 @@ const handleFilterUrl = (originParam, newParam) => {
80 80
81 tempOriginParam = Object.assign(tempOriginParam, originParam, newParam); 81 tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
82 82
83 - _.forEach(tempOriginParam, function (value, key) { 83 + _.forEach(tempOriginParam, function(value, key) {
84 dest = dest + key + '=' + value + '&'; 84 dest = dest + key + '=' + value + '&';
85 }); 85 });
86 86
@@ -160,6 +160,7 @@ const handleBrandCheckedData = (params, origin) => { @@ -160,6 +160,7 @@ const handleBrandCheckedData = (params, origin) => {
160 }); 160 });
161 161
162 let checkedCount = 0; 162 let checkedCount = 0;
  163 +
163 // 遍历品牌数据,如果在参数中,那么加 checked,将此数据加入到 checked 数组中 164 // 遍历品牌数据,如果在参数中,那么加 checked,将此数据加入到 checked 数组中
164 if (!_.isEmpty(origin)) { 165 if (!_.isEmpty(origin)) {
165 _.forEach(origin, (value) => { 166 _.forEach(origin, (value) => {
@@ -199,6 +200,7 @@ const handleBrandCheckedData = (params, origin) => { @@ -199,6 +200,7 @@ const handleBrandCheckedData = (params, origin) => {
199 dest[0].name += '、' + checked.name; 200 dest[0].name += '、' + checked.name;
200 } 201 }
201 checkedCount++; 202 checkedCount++;
  203 +
202 // 建议保留,需要品牌可以单个删除时放开注释即可 204 // 建议保留,需要品牌可以单个删除时放开注释即可
203 // dest.push(checked); 205 // dest.push(checked);
204 } 206 }
@@ -219,8 +221,8 @@ const handleSalebreakingYardsSortData = (origin, params) => { @@ -219,8 +221,8 @@ const handleSalebreakingYardsSortData = (origin, params) => {
219 if (!_.isEmpty(params.sort)) { 221 if (!_.isEmpty(params.sort)) {
220 222
221 // 是否有分类筛选参数,如果有 223 // 是否有分类筛选参数,如果有
222 - _.forEach(params.sort.split(','), function (sortParam) {  
223 - _.forEach(origin, function (value) { 224 + _.forEach(params.sort.split(','), function(sortParam) {
  225 + _.forEach(origin, function(value) {
224 226
225 // 判断是否在这组数据里面 227 // 判断是否在这组数据里面
226 if (!_.isEmpty(_.find(value.sort_id.split(','), o => { 228 if (!_.isEmpty(_.find(value.sort_id.split(','), o => {
@@ -228,7 +230,7 @@ const handleSalebreakingYardsSortData = (origin, params) => { @@ -228,7 +230,7 @@ const handleSalebreakingYardsSortData = (origin, params) => {
228 }))) { 230 }))) {
229 231
230 // 如果在某组数据里面,组合数据退出循环 232 // 如果在某组数据里面,组合数据退出循环
231 - _.forEach(value.sub, function (subValue) { 233 + _.forEach(value.sub, function(subValue) {
232 let size = {}; 234 let size = {};
233 235
234 size.checked = 236 size.checked =
@@ -243,8 +245,8 @@ const handleSalebreakingYardsSortData = (origin, params) => { @@ -243,8 +245,8 @@ const handleSalebreakingYardsSortData = (origin, params) => {
243 }); 245 });
244 }); 246 });
245 } else { // 如果没有筛选参数,返回所有分类 247 } else { // 如果没有筛选参数,返回所有分类
246 - _.forEach(origin, function (value) {  
247 - _.forEach(value.sub, function (subValue) { 248 + _.forEach(origin, function(value) {
  249 + _.forEach(value.sub, function(subValue) {
248 let size = {}; 250 let size = {};
249 251
250 size.checked = parseInt(params.size, 10) === parseInt(subValue.size_id, 10); 252 size.checked = parseInt(params.size, 10) === parseInt(subValue.size_id, 10);
@@ -309,7 +311,7 @@ exports.handleSaleFilterData = (origin, params) => { @@ -309,7 +311,7 @@ exports.handleSaleFilterData = (origin, params) => {
309 if (!_.isEmpty(origin.brand)) { 311 if (!_.isEmpty(origin.brand)) {
310 let count = 0; 312 let count = 0;
311 313
312 - _.forEach(origin.brand, function (value) { 314 + _.forEach(origin.brand, function(value) {
313 let brand = {}; 315 let brand = {};
314 316
315 brand.checked = (parseInt(params.brand, 10) === parseInt(value.id, 10)); 317 brand.checked = (parseInt(params.brand, 10) === parseInt(value.id, 10));
@@ -336,13 +338,13 @@ exports.handleSaleFilterData = (origin, params) => { @@ -336,13 +338,13 @@ exports.handleSaleFilterData = (origin, params) => {
336 } 338 }
337 339
338 // 来排排序 340 // 来排排序
339 - dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, function (o) { 341 + dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, function(o) {
340 return o.index; 342 return o.index;
341 }); 343 });
342 344
343 // 处理 价格 筛选数据 345 // 处理 价格 筛选数据
344 if (!_.isEmpty(origin.priceRange)) { 346 if (!_.isEmpty(origin.priceRange)) {
345 - _.forEach(origin.priceRange, function (value, key) { 347 + _.forEach(origin.priceRange, function(value, key) {
346 let price = { 348 let price = {
347 checked: params.price === key, 349 checked: params.price === key,
348 href: handleFilterUrl(params, {price: key}), 350 href: handleFilterUrl(params, {price: key}),
@@ -416,7 +418,7 @@ exports.handleSaleActivityData = (origin, channel) => { @@ -416,7 +418,7 @@ exports.handleSaleActivityData = (origin, channel) => {
416 418
417 dest.big = []; 419 dest.big = [];
418 dest.normal = []; 420 dest.normal = [];
419 - _.forEach(origin, function (value, key) { 421 + _.forEach(origin, function(value, key) {
420 let activity = { 422 let activity = {
421 link: helpers.urlFormat('/product/sale/discount/detail', {id: value.id, channel: channel}), 423 link: helpers.urlFormat('/product/sale/discount/detail', {id: value.id, channel: channel}),
422 img: value.cover_url, 424 img: value.cover_url,
@@ -463,9 +465,9 @@ exports.handleSaleBannerData = (origin) => { @@ -463,9 +465,9 @@ exports.handleSaleBannerData = (origin) => {
463 var dest = {}; 465 var dest = {};
464 466
465 dest.list = []; 467 dest.list = [];
466 - _.forEach(origin, function (value) { 468 + _.forEach(origin, function(value) {
467 if (value.template_name === 'focus') { 469 if (value.template_name === 'focus') {
468 - _.forEach(value.data, function (subValue) { 470 + _.forEach(value.data, function(subValue) {
469 let banner = {}; 471 let banner = {};
470 472
471 banner.bannerHeight = 450; 473 banner.bannerHeight = 450;
@@ -490,9 +492,9 @@ exports.handleSaleBannerSmallData = (origin) => { @@ -490,9 +492,9 @@ exports.handleSaleBannerSmallData = (origin) => {
490 var dest = []; 492 var dest = [];
491 let count = 0; 493 let count = 0;
492 494
493 - _.forEach(origin, function (value) { 495 + _.forEach(origin, function(value) {
494 if (value.template_name === 'threePicture') { 496 if (value.template_name === 'threePicture') {
495 - _.forEach(value.data, function (picList) { 497 + _.forEach(value.data, function(picList) {
496 if (count++ < 3) { 498 if (count++ < 3) {
497 let smallPic = {}; 499 let smallPic = {};
498 500