Authored by 郭成尧

'处理用户自主填写价格区间'

@@ -24,7 +24,7 @@ const handleFilterUrl = (originParam, newParam) => { @@ -24,7 +24,7 @@ const handleFilterUrl = (originParam, newParam) => {
24 tempOriginParam = Object.assign(tempOriginParam, originParam, newParam); 24 tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
25 delete tempOriginParam.uid; 25 delete tempOriginParam.uid;
26 26
27 - _.forEach(tempOriginParam, function(value, key) { 27 + _.forEach(tempOriginParam, function (value, key) {
28 dest = dest + key + '=' + value + '&'; 28 dest = dest + key + '=' + value + '&';
29 }); 29 });
30 30
@@ -67,8 +67,8 @@ const handleSalebreakingYardsSortData = (origin, params) => { @@ -67,8 +67,8 @@ const handleSalebreakingYardsSortData = (origin, params) => {
67 67
68 // 判断是否在这组数据里面 68 // 判断是否在这组数据里面
69 if (!_.isEmpty(_.find(value.sort_id.split(','), o => { 69 if (!_.isEmpty(_.find(value.sort_id.split(','), o => {
70 - return o === sortParam;  
71 - }))) { 70 + return o === sortParam;
  71 + }))) {
72 72
73 // 如果在某组数据里面,组合数据退出循环 73 // 如果在某组数据里面,组合数据退出循环
74 _.forEach(value.sub, subValue => { 74 _.forEach(value.sub, subValue => {
@@ -153,8 +153,8 @@ const handleBrandCheckedData = (params, origin) => { @@ -153,8 +153,8 @@ const handleBrandCheckedData = (params, origin) => {
153 if (!_.isEmpty(origin)) { 153 if (!_.isEmpty(origin)) {
154 _.forEach(origin, (value) => { 154 _.forEach(origin, (value) => {
155 if (typeof _.find(intBrands, o => { 155 if (typeof _.find(intBrands, o => {
156 - return _.isEqual(o, value.id);  
157 - }) !== 'undefined') { 156 + return _.isEqual(o, value.id);
  157 + }) !== 'undefined') {
158 158
159 let checked = { 159 let checked = {
160 name: value.name 160 name: value.name
@@ -463,7 +463,7 @@ exports.handleSaleFilterData = (origin, params) => { @@ -463,7 +463,7 @@ exports.handleSaleFilterData = (origin, params) => {
463 if (!_.isEmpty(origin.brand)) { 463 if (!_.isEmpty(origin.brand)) {
464 let count = 0; 464 let count = 0;
465 465
466 - _.forEach(origin.brand, function(value) { 466 + _.forEach(origin.brand, function (value) {
467 let brand = { 467 let brand = {
468 checked: (typeof _.find(intBrands, o => { 468 checked: (typeof _.find(intBrands, o => {
469 return _.isEqual(o, value.id); 469 return _.isEqual(o, value.id);
@@ -496,7 +496,9 @@ exports.handleSaleFilterData = (origin, params) => { @@ -496,7 +496,9 @@ exports.handleSaleFilterData = (origin, params) => {
496 return o.index; 496 return o.index;
497 }); 497 });
498 498
499 - // 处理 价格 筛选数据 499 + // 处理价格筛选数据
  500 + let priceRangechecked = false;
  501 +
500 if (!_.isEmpty(origin.priceRange)) { 502 if (!_.isEmpty(origin.priceRange)) {
501 _.forEach(origin.priceRange, (value, key) => { 503 _.forEach(origin.priceRange, (value, key) => {
502 let price = { 504 let price = {
@@ -509,6 +511,20 @@ exports.handleSaleFilterData = (origin, params) => { @@ -509,6 +511,20 @@ exports.handleSaleFilterData = (origin, params) => {
509 }); 511 });
510 } 512 }
511 513
  514 + // 处理用户自主填写的价格区间
  515 + if (!priceRangechecked && params.price) {
  516 + let customPrice = _.split(params.price, ',');
  517 +
  518 + dest.customPrice = {
  519 + min: customPrice[0],
  520 + max: customPrice[1]
  521 + };
  522 + dest.checkedConditions.conditions.push({
  523 + name: '¥ ' + customPrice[0] + '-' + customPrice[1],
  524 + href: handleFilterUrl(params, {price: ''})
  525 + });
  526 + }
  527 +
512 // 处理性别数据 528 // 处理性别数据
513 dest.gender = [ 529 dest.gender = [
514 { 530 {
@@ -598,7 +614,7 @@ exports.handleBannerData = (origin) => { @@ -598,7 +614,7 @@ exports.handleBannerData = (origin) => {
598 let dest = {}; 614 let dest = {};
599 615
600 dest.list = []; 616 dest.list = [];
601 - _.forEach(origin, function(value) { 617 + _.forEach(origin, function (value) {
602 if (value.template_name === 'focus') { 618 if (value.template_name === 'focus') {
603 _.forEach(value.data, subValue => { 619 _.forEach(value.data, subValue => {
604 620