Authored by 郭成尧

'倒计时'

@@ -113,21 +113,21 @@ const handleFilterUrl = (originParam, newParam) => { @@ -113,21 +113,21 @@ const handleFilterUrl = (originParam, newParam) => {
113 let newParamArray = _.keys(newParam); 113 let newParamArray = _.keys(newParam);
114 114
115 // 判断参数是否已经存在 115 // 判断参数是否已经存在
116 - let isExist = !_.isEmpty(_.find(originParamArray, function(o) { 116 + let isExist = !_.isEmpty(_.find(originParamArray, function (o) {
117 return o === newParamArray[0]; 117 return o === newParamArray[0];
118 })); 118 }));
119 119
120 if (isExist) { 120 if (isExist) {
121 tempOriginParam = Object.assign(tempOriginParam, originParam); 121 tempOriginParam = Object.assign(tempOriginParam, originParam);
122 122
123 - _.forEach(newParam, function(value, key) { 123 + _.forEach(newParam, function (value, key) {
124 tempOriginParam[key] = value; 124 tempOriginParam[key] = value;
125 }); 125 });
126 } else { 126 } else {
127 tempOriginParam = Object.assign(tempOriginParam, originParam, newParam); 127 tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
128 } 128 }
129 129
130 - _.forEach(tempOriginParam, function(value, key) { 130 + _.forEach(tempOriginParam, function (value, key) {
131 dest = dest + key + '=' + value + '&'; 131 dest = dest + key + '=' + value + '&';
132 }); 132 });
133 133
@@ -233,16 +233,16 @@ const handleSalebreakingYardsSortData = (origin, params) => { @@ -233,16 +233,16 @@ const handleSalebreakingYardsSortData = (origin, params) => {
233 if (!_.isEmpty(params.sort)) { 233 if (!_.isEmpty(params.sort)) {
234 234
235 // 是否有分类筛选参数,如果有 235 // 是否有分类筛选参数,如果有
236 - _.forEach(params.sort.split(','), function(sortParam) {  
237 - _.forEach(origin, function(value) { 236 + _.forEach(params.sort.split(','), function (sortParam) {
  237 + _.forEach(origin, function (value) {
238 238
239 // 判断是否在这组数据里面 239 // 判断是否在这组数据里面
240 if (!_.isEmpty(_.find(value.sort_id.split(','), o => { 240 if (!_.isEmpty(_.find(value.sort_id.split(','), o => {
241 - return o === sortParam;  
242 - }))) { 241 + return o === sortParam;
  242 + }))) {
243 243
244 // 如果在某组数据里面,组合数据退出循环 244 // 如果在某组数据里面,组合数据退出循环
245 - _.forEach(value.sub, function(subValue) { 245 + _.forEach(value.sub, function (subValue) {
246 let size = {}; 246 let size = {};
247 247
248 size.checked = 248 size.checked =
@@ -257,8 +257,8 @@ const handleSalebreakingYardsSortData = (origin, params) => { @@ -257,8 +257,8 @@ const handleSalebreakingYardsSortData = (origin, params) => {
257 }); 257 });
258 }); 258 });
259 } else { // 如果没有筛选参数,返回所有分类 259 } else { // 如果没有筛选参数,返回所有分类
260 - _.forEach(origin, function(value) {  
261 - _.forEach(value.sub, function(subValue) { 260 + _.forEach(origin, function (value) {
  261 + _.forEach(value.sub, function (subValue) {
262 let size = {}; 262 let size = {};
263 263
264 size.checked = (parseInt(params.size, 10) === parseInt(subValue.size_id, 10)) ? true : false; 264 size.checked = (parseInt(params.size, 10) === parseInt(subValue.size_id, 10)) ? true : false;
@@ -323,7 +323,7 @@ exports.handleSaleFilterData = (origin, params) => { @@ -323,7 +323,7 @@ exports.handleSaleFilterData = (origin, params) => {
323 if (!_.isEmpty(origin.brand)) { 323 if (!_.isEmpty(origin.brand)) {
324 let count = 0; 324 let count = 0;
325 325
326 - _.forEach(origin.brand, function(value) { 326 + _.forEach(origin.brand, function (value) {
327 let brand = {}; 327 let brand = {};
328 328
329 brand.checked = (parseInt(params.brand, 10) === parseInt(value.id, 10)) ? true : false; 329 brand.checked = (parseInt(params.brand, 10) === parseInt(value.id, 10)) ? true : false;
@@ -350,13 +350,13 @@ exports.handleSaleFilterData = (origin, params) => { @@ -350,13 +350,13 @@ exports.handleSaleFilterData = (origin, params) => {
350 } 350 }
351 351
352 // 来排排序 352 // 来排排序
353 - dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, function(o) { 353 + dest.brand.brandsShow = _.sortBy(dest.brand.brandsShow, function (o) {
354 return o.index; 354 return o.index;
355 }); 355 });
356 356
357 // 处理 价格 筛选数据 357 // 处理 价格 筛选数据
358 if (!_.isEmpty(origin.priceRange)) { 358 if (!_.isEmpty(origin.priceRange)) {
359 - _.forEach(origin.priceRange, function(value, key) { 359 + _.forEach(origin.priceRange, function (value, key) {
360 let price = { 360 let price = {
361 checked: (params.price === key) ? true : false, 361 checked: (params.price === key) ? true : false,
362 href: handleFilterUrl(params, {price: key}), 362 href: handleFilterUrl(params, {price: key}),
@@ -542,7 +542,7 @@ exports.handleSaleOptsData = (params, total, extra) => { @@ -542,7 +542,7 @@ exports.handleSaleOptsData = (params, total, extra) => {
542 542
543 // 上一页下一页 543 // 上一页下一页
544 let preHref = (!_.isEmpty(params.page) && parseInt(params.page, 10) > 1) ? 544 let preHref = (!_.isEmpty(params.page) && parseInt(params.page, 10) > 1) ?
545 - parseInt(params.page, 10) - 1 : 1; 545 + parseInt(params.page, 10) - 1 : 1;
546 let nextHref = (!_.isEmpty(params.page)) ? parseInt(params.page, 10) + 1 : 2; 546 let nextHref = (!_.isEmpty(params.page)) ? parseInt(params.page, 10) + 1 : 2;
547 547
548 if (dest.pageCount > 1 && (parseInt(params.page, 10) !== 1) && 548 if (dest.pageCount > 1 && (parseInt(params.page, 10) !== 1) &&
@@ -582,7 +582,7 @@ exports.handleSaleSortData = (origin, params, extra) => { @@ -582,7 +582,7 @@ exports.handleSaleSortData = (origin, params, extra) => {
582 num: extra 582 num: extra
583 }; 583 };
584 584
585 - _.forEach(origin, function(value) { 585 + _.forEach(origin, function (value) {
586 586
587 let category = {}; 587 let category = {};
588 588
@@ -591,7 +591,7 @@ exports.handleSaleSortData = (origin, params, extra) => { @@ -591,7 +591,7 @@ exports.handleSaleSortData = (origin, params, extra) => {
591 category.childList = []; 591 category.childList = [];
592 category.href = handleFilterUrl(params, {sort: value.relation_parameter.sort}); 592 category.href = handleFilterUrl(params, {sort: value.relation_parameter.sort});
593 category.active = false; 593 category.active = false;
594 - _.forEach(value.sub, function(subValue) { 594 + _.forEach(value.sub, function (subValue) {
595 category.childList.push({ 595 category.childList.push({
596 name: subValue.category_name, 596 name: subValue.category_name,
597 num: subValue.node_count, 597 num: subValue.node_count,
@@ -621,13 +621,13 @@ exports.handleSaleActivityData = (origin, channel) => { @@ -621,13 +621,13 @@ exports.handleSaleActivityData = (origin, channel) => {
621 621
622 dest.big = []; 622 dest.big = [];
623 dest.normal = []; 623 dest.normal = [];
624 - _.forEach(origin, function(value, key) { 624 + _.forEach(origin, function (value, key) {
625 let activity = {}; 625 let activity = {};
626 626
627 activity.link = 627 activity.link =
628 helpers.urlFormat('/product/sale/discount/detail', {id: value.id, channel: channel}); 628 helpers.urlFormat('/product/sale/discount/detail', {id: value.id, channel: channel});
629 activity.img = value.cover_url; 629 activity.img = value.cover_url;
630 - activity.time = processTime(value.left_time); 630 + activity.time = processTime(parseInt(value.left_time, 10) * 1000);
631 activity.brand = value.logo_url; 631 activity.brand = value.logo_url;
632 activity.title = value.title; 632 activity.title = value.title;
633 activity = Object.assign(activity, discountSplit(value.promotion_name)); 633 activity = Object.assign(activity, discountSplit(value.promotion_name));
@@ -653,7 +653,7 @@ exports.handleDiscountTitleData = (origin) => { @@ -653,7 +653,7 @@ exports.handleDiscountTitleData = (origin) => {
653 dest.up = true; 653 dest.up = true;
654 654
655 // dest.time = processTimes(origin.left_time); 655 // dest.time = processTimes(origin.left_time);
656 - dest.time = origin.left_time; 656 + dest.time = parseInt(origin.left_time, 10) * 1000;
657 Object.assign(dest, discountSplit(origin.promotion_name)); 657 Object.assign(dest, discountSplit(origin.promotion_name));
658 658
659 return dest; 659 return dest;
@@ -668,9 +668,9 @@ exports.handleSaleBannerData = (origin) => { @@ -668,9 +668,9 @@ exports.handleSaleBannerData = (origin) => {
668 var dest = {}; 668 var dest = {};
669 669
670 dest.list = []; 670 dest.list = [];
671 - _.forEach(origin, function(value) { 671 + _.forEach(origin, function (value) {
672 if (value.template_name === 'focus') { 672 if (value.template_name === 'focus') {
673 - _.forEach(value.data, function(subValue) { 673 + _.forEach(value.data, function (subValue) {
674 let banner = {}; 674 let banner = {};
675 675
676 banner.bannerHeight = 450; 676 banner.bannerHeight = 450;
@@ -695,9 +695,9 @@ exports.handleSaleBannerSmallData = (origin) => { @@ -695,9 +695,9 @@ exports.handleSaleBannerSmallData = (origin) => {
695 var dest = []; 695 var dest = [];
696 let count = 0; 696 let count = 0;
697 697
698 - _.forEach(origin, function(value) { 698 + _.forEach(origin, function (value) {
699 if (value.template_name === 'threePicture') { 699 if (value.template_name === 'threePicture') {
700 - _.forEach(value.data, function(picList) { 700 + _.forEach(value.data, function (picList) {
701 if (count++ < 3) { 701 if (count++ < 3) {
702 let smallPic = {}; 702 let smallPic = {};
703 703