Showing
10 changed files
with
129 additions
and
86 deletions
@@ -122,7 +122,7 @@ exports.discountDetail = (req, res) => { | @@ -122,7 +122,7 @@ exports.discountDetail = (req, res) => { | ||
122 | let id = req.query.id; | 122 | let id = req.query.id; |
123 | let params = processPublicData(req, '', 'discount-detail'); | 123 | let params = processPublicData(req, '', 'discount-detail'); |
124 | 124 | ||
125 | - saleModel.getDiscountDetailData(id).then((result) => { | 125 | + saleModel.getDiscountDetailData(id, params.channel).then((result) => { |
126 | params.renderData.pageHeader.navTitle = result.title; | 126 | params.renderData.pageHeader.navTitle = result.title; |
127 | res.render('sale/discount-detail', Object.assign(params.renderData, result)); | 127 | res.render('sale/discount-detail', Object.assign(params.renderData, result)); |
128 | }).catch((err) => { | 128 | }).catch((err) => { |
@@ -184,14 +184,14 @@ exports.search = (req, res) => { | @@ -184,14 +184,14 @@ exports.search = (req, res) => { | ||
184 | let vipObj = {}; | 184 | let vipObj = {}; |
185 | 185 | ||
186 | if (req.query.saleType === '2') { | 186 | if (req.query.saleType === '2') { |
187 | - vipObj = Object.assign({ | 187 | + vipObj = { |
188 | saleVip: (req.query.saleType === '2' && (!uid || vipLevel === '0')), | 188 | saleVip: (req.query.saleType === '2' && (!uid || vipLevel === '0')), |
189 | vipLevel: vipLevel, | 189 | vipLevel: vipLevel, |
190 | saleViplogin: vipLevel >= 1 ? true : false, | 190 | saleViplogin: vipLevel >= 1 ? true : false, |
191 | vipPrice1: vipLevel === '1', | 191 | vipPrice1: vipLevel === '1', |
192 | vipPrice2: vipLevel === '2', | 192 | vipPrice2: vipLevel === '2', |
193 | vipPrice3: vipLevel === '3' | 193 | vipPrice3: vipLevel === '3' |
194 | - }, vipObj); | 194 | + }; |
195 | } | 195 | } |
196 | 196 | ||
197 | res.render('sale/product', Object.assign({ | 197 | res.render('sale/product', Object.assign({ |
@@ -28,7 +28,10 @@ const typeCont = { | @@ -28,7 +28,10 @@ const typeCont = { | ||
28 | discount: ['p_d_desc', 'p_d_asc'], | 28 | discount: ['p_d_desc', 'p_d_asc'], |
29 | sale: ['s_n_desc', 's_n_asc'], | 29 | sale: ['s_n_desc', 's_n_asc'], |
30 | newest: ['s_t_desc,s_s_desc', 's_t_asc,s_s_asc'], | 30 | newest: ['s_t_desc,s_s_desc', 's_t_asc,s_s_asc'], |
31 | - stock: ['s_s_desc', 's_s_asc'] | 31 | + |
32 | + // newest: ['s_t_desc', 's_t_asc'], | ||
33 | + stock: ['s_s_desc', 's_s_asc'], | ||
34 | + all: ['d_s_desc', 'd_s_asc'] | ||
32 | }; | 35 | }; |
33 | 36 | ||
34 | const channelType = { | 37 | const channelType = { |
@@ -100,14 +103,14 @@ class Sale { | @@ -100,14 +103,14 @@ class Sale { | ||
100 | * @param {[object]} params | 103 | * @param {[object]} params |
101 | * @return {[array]} | 104 | * @return {[array]} |
102 | */ | 105 | */ |
103 | - static discount(yhChannel) { | ||
104 | - yhChannel = yhChannel || 'boys'; | ||
105 | - return api.get('', sign.apiSign({ | 106 | + static discount(params) { |
107 | + params = params || {}; | ||
108 | + | ||
109 | + return api.get('', sign.apiSign(Object.assign({ | ||
106 | method: 'app.activity.get', | 110 | method: 'app.activity.get', |
107 | sort: 2, | 111 | sort: 2, |
108 | - plateform: 3, | ||
109 | - yh_channel: channelType[yhChannel] || '1' | ||
110 | - })); | 112 | + plateform: 2 |
113 | + }, params))); | ||
111 | } | 114 | } |
112 | 115 | ||
113 | /** | 116 | /** |
@@ -124,16 +127,25 @@ class Sale { | @@ -124,16 +127,25 @@ class Sale { | ||
124 | list = camelCase(list); | 127 | list = camelCase(list); |
125 | 128 | ||
126 | _.forEach(list, (data, index) => { | 129 | _.forEach(list, (data, index) => { |
130 | + const allSub = []; | ||
131 | + | ||
132 | + data.sub.key = index; | ||
133 | + sub.push(data.sub); | ||
134 | + | ||
135 | + _.forEach(data.sub, (dataSub) => { | ||
136 | + allSub.push(dataSub.sizeId); | ||
137 | + }); | ||
138 | + | ||
127 | sort.push({ | 139 | sort.push({ |
128 | sortName: data.sortName, | 140 | sortName: data.sortName, |
129 | - sortId: data.sortId | 141 | + sortId: data.sortId, |
142 | + allSub: allSub | ||
130 | }); | 143 | }); |
131 | - data.sub.key = index; | ||
132 | - sub.push(data.sub); | ||
133 | }); | 144 | }); |
134 | 145 | ||
135 | formatData.sortData = sort; | 146 | formatData.sortData = sort; |
136 | formatData.sub = sub; | 147 | formatData.sub = sub; |
148 | + | ||
137 | return formatData; | 149 | return formatData; |
138 | } | 150 | } |
139 | 151 | ||
@@ -234,7 +246,10 @@ class Sale { | @@ -234,7 +246,10 @@ class Sale { | ||
234 | return Promise.all([ | 246 | return Promise.all([ |
235 | Sale.searchSales(params).then((result) => { | 247 | Sale.searchSales(params).then((result) => { |
236 | if (result && result.code === 200) { | 248 | if (result && result.code === 200) { |
237 | - return productProcess.processProductList(result.data.product_list || []); | 249 | + return productProcess.processProductList(result.data.product_list || [], { |
250 | + yh_channel: params.yh_channel, | ||
251 | + showSale: false | ||
252 | + }); | ||
238 | } else { | 253 | } else { |
239 | logger.error('SALE 商品搜索返回 code 不是 200'); | 254 | logger.error('SALE 商品搜索返回 code 不是 200'); |
240 | return []; | 255 | return []; |
@@ -309,12 +324,14 @@ class Sale { | @@ -309,12 +324,14 @@ class Sale { | ||
309 | * @param {[object]} params | 324 | * @param {[object]} params |
310 | * @return {[object]} | 325 | * @return {[object]} |
311 | */ | 326 | */ |
312 | - static getDiscountData(params) { | 327 | + static getDiscountData(yhChannel) { |
313 | const discountData = {}; | 328 | const discountData = {}; |
314 | 329 | ||
315 | - return Sale.discount(params).then((result) => { | 330 | + return Sale.discount({ |
331 | + yh_channel: channelType[yhChannel] || '1' | ||
332 | + }).then((result) => { | ||
316 | if (result && result.code === 200) { | 333 | if (result && result.code === 200) { |
317 | - discountData.data = Sale.processDiscount(result.data, params); | 334 | + discountData.data = Sale.processDiscount(result.data, yhChannel); |
318 | return discountData; | 335 | return discountData; |
319 | } else { | 336 | } else { |
320 | logger.error('折扣专场专题列表返回 code 不是 200'); | 337 | logger.error('折扣专场专题列表返回 code 不是 200'); |
@@ -328,10 +345,11 @@ class Sale { | @@ -328,10 +345,11 @@ class Sale { | ||
328 | * @param {[string]} id | 345 | * @param {[string]} id |
329 | * @return {[object]} | 346 | * @return {[object]} |
330 | */ | 347 | */ |
331 | - static getDiscountDetailData(id) { | 348 | + static getDiscountDetailData(id, yhChannel) { |
332 | let res = {}; | 349 | let res = {}; |
333 | let param = { | 350 | let param = { |
334 | - id: id | 351 | + id: id, |
352 | + yh_channel: channelType[yhChannel] || '1' | ||
335 | }; | 353 | }; |
336 | 354 | ||
337 | return Sale.discount(param).then((result) => { | 355 | return Sale.discount(param).then((result) => { |
@@ -340,9 +358,9 @@ class Sale { | @@ -340,9 +358,9 @@ class Sale { | ||
340 | 358 | ||
341 | return { | 359 | return { |
342 | title: res[0].title, | 360 | title: res[0].title, |
361 | + productPool: res[0].productPool, | ||
343 | activity: { | 362 | activity: { |
344 | coverUrl: res[0].coverUrl, | 363 | coverUrl: res[0].coverUrl, |
345 | - time: res[0].time, | ||
346 | leftTime: res[0].leftTime | 364 | leftTime: res[0].leftTime |
347 | } | 365 | } |
348 | }; | 366 | }; |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | <ul id="list-nav" class="list-nav clearfix"> | 9 | <ul id="list-nav" class="list-nav clearfix"> |
10 | 10 | ||
11 | {{# sortData}} | 11 | {{# sortData}} |
12 | - <li {{#if @first}} class="active" {{/if}} data-id="{{sortId}}"> | 12 | + <li {{#if @first}} class="active" {{/if}} data-id="{{sortId}}" data-allSub="{{allSub}}"> |
13 | <a href="javascript:void(0);"> | 13 | <a href="javascript:void(0);"> |
14 | <span class="span-test">{{sortName}}</span> | 14 | <span class="span-test">{{sortName}}</span> |
15 | </a> | 15 | </a> |
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | </a> | 23 | </a> |
24 | </li> | 24 | </li> |
25 | </ul> | 25 | </ul> |
26 | - | 26 | + <div class="sub-size"> |
27 | {{# sub}} | 27 | {{# sub}} |
28 | <div class="size-area"> | 28 | <div class="size-area"> |
29 | <div class="swiper-size" id="size-swiper-{{key}}" {{#if @first}}style="display:block"{{/if}}> | 29 | <div class="swiper-size" id="size-swiper-{{key}}" {{#if @first}}style="display:block"{{/if}}> |
@@ -35,6 +35,7 @@ | @@ -35,6 +35,7 @@ | ||
35 | </div> | 35 | </div> |
36 | </div> | 36 | </div> |
37 | {{/ sub}} | 37 | {{/ sub}} |
38 | + </div> | ||
38 | {{/ nav}} | 39 | {{/ nav}} |
39 | 40 | ||
40 | <div id="goods-container" class="goods-container"> | 41 | <div id="goods-container" class="goods-container"> |
1 | -<div class="discount-detail-page goods-page yoho-page"> | ||
2 | - | 1 | +<div class="discount-detail-page goods-page yoho-page" data-product-pool="{{productPool}}"> |
3 | {{> product/sale/banner}} | 2 | {{> product/sale/banner}} |
4 | 3 | ||
5 | <ul id="list-nav" class="list-nav clearfix"> | 4 | <ul id="list-nav" class="list-nav clearfix"> |
@@ -6,8 +6,8 @@ | @@ -6,8 +6,8 @@ | ||
6 | {{/content}} | 6 | {{/content}} |
7 | 7 | ||
8 | {{# activity}} | 8 | {{# activity}} |
9 | - <img src="{{image coverUrl 640 250}}"/> | ||
10 | - <p class="activity-time" data-time-ms="{{leftTime}}"><i class="iconfont time-ico"></i><span>{{time}}</span></p> | 9 | + <img src="{{image coverUrl 640 200}}"/> |
10 | + <p class="activity-time" data-time-ms="{{leftTime}}"><i class="iconfont time-ico"></i><span></span></p> | ||
11 | {{/ activity}} | 11 | {{/ activity}} |
12 | 12 | ||
13 | </div> | 13 | </div> |
@@ -20,7 +20,9 @@ const config = require('../config/common'); | @@ -20,7 +20,9 @@ const config = require('../config/common'); | ||
20 | exports.image = (url, width, height, mode) => { | 20 | exports.image = (url, width, height, mode) => { |
21 | mode = _.isNumber(mode) ? mode : 2; | 21 | mode = _.isNumber(mode) ? mode : 2; |
22 | url = url || ''; | 22 | url = url || ''; |
23 | - return url.replace(/{width}/g, width).replace(/{height}/g, height).replace(/{mode}/g, mode); | 23 | + url = url.replace(/{width}/g, width).replace(/{height}/g, height).replace(/{mode}/g, mode); |
24 | + | ||
25 | + return url.replace('http:', ''); | ||
24 | }; | 26 | }; |
25 | 27 | ||
26 | /** | 28 | /** |
@@ -106,6 +108,14 @@ exports.round = (num, precision) => { | @@ -106,6 +108,14 @@ exports.round = (num, precision) => { | ||
106 | }; | 108 | }; |
107 | 109 | ||
108 | /** | 110 | /** |
111 | + * 链接改成自适应链接 | ||
112 | + * @return {[type]} | ||
113 | + */ | ||
114 | +exports.https = (url) => { | ||
115 | + return url.replace('http:', ''); | ||
116 | +}; | ||
117 | + | ||
118 | +/** | ||
109 | * 时间格式化 | 119 | * 时间格式化 |
110 | * @param format 格式化token @see{http://momentjs.cn/docs/#/displaying/format/} | 120 | * @param format 格式化token @see{http://momentjs.cn/docs/#/displaying/format/} |
111 | * @param date 日期或者数字 | 121 | * @param date 日期或者数字 |
@@ -35,26 +35,22 @@ var $listNav = $('#list-nav'), | @@ -35,26 +35,22 @@ var $listNav = $('#list-nav'), | ||
35 | coat: { | 35 | coat: { |
36 | reload: true, | 36 | reload: true, |
37 | page: 0, | 37 | page: 0, |
38 | - end: false, | ||
39 | - saleType: 1 | 38 | + end: false |
40 | }, | 39 | }, |
41 | trouser: { | 40 | trouser: { |
42 | reload: true, | 41 | reload: true, |
43 | page: 0, | 42 | page: 0, |
44 | - end: false, | ||
45 | - saleType: 1 | 43 | + end: false |
46 | }, | 44 | }, |
47 | shoes: { | 45 | shoes: { |
48 | reload: true, | 46 | reload: true, |
49 | page: 0, | 47 | page: 0, |
50 | - end: false, | ||
51 | - saleType: 1 | 48 | + end: false |
52 | }, | 49 | }, |
53 | other: { | 50 | other: { |
54 | reload: true, | 51 | reload: true, |
55 | page: 0, | 52 | page: 0, |
56 | - end: false, | ||
57 | - saleType: 1 | 53 | + end: false |
58 | } | 54 | } |
59 | }, | 55 | }, |
60 | $pre = $listNav.find('.active'), // 纪录进入筛选前的active项,初始为选中项 | 56 | $pre = $listNav.find('.active'), // 纪录进入筛选前的active项,初始为选中项 |
@@ -85,7 +81,8 @@ function getUrlParam(name) { | @@ -85,7 +81,8 @@ function getUrlParam(name) { | ||
85 | } | 81 | } |
86 | 82 | ||
87 | defaultOpt = $.extend({ | 83 | defaultOpt = $.extend({ |
88 | - yh_channel: getUrlParam('channel') || 'boys' | 84 | + yh_channel: getUrlParam('channel') || 'boys', |
85 | + saleType: 1 | ||
89 | }, defaultOpt); | 86 | }, defaultOpt); |
90 | 87 | ||
91 | storeOpt = $.extend({}, defaultOpt); | 88 | storeOpt = $.extend({}, defaultOpt); |
@@ -202,6 +199,16 @@ function search(opt) { | @@ -202,6 +199,16 @@ function search(opt) { | ||
202 | p_d: opt[i].id | 199 | p_d: opt[i].id |
203 | }; | 200 | }; |
204 | break; | 201 | break; |
202 | + case 'breakSort': | ||
203 | + ext = { | ||
204 | + breakSort: opt[i].id | ||
205 | + }; | ||
206 | + break; | ||
207 | + case 'breakSize': | ||
208 | + ext = { | ||
209 | + breakSize: opt[i].id | ||
210 | + }; | ||
211 | + break; | ||
205 | default: | 212 | default: |
206 | break; | 213 | break; |
207 | } | 214 | } |
@@ -335,7 +342,7 @@ $listNav.bind('contextmenu', function() { | @@ -335,7 +342,7 @@ $listNav.bind('contextmenu', function() { | ||
335 | 342 | ||
336 | $listNav.on('touchend touchcancel', function(e) { | 343 | $listNav.on('touchend touchcancel', function(e) { |
337 | var $this = $(e.target).closest('li'), | 344 | var $this = $(e.target).closest('li'), |
338 | - nav, sortId, navType, $active; | 345 | + nav, sortId, allSub, navType, $active; |
339 | 346 | ||
340 | e.preventDefault(); | 347 | e.preventDefault(); |
341 | if ($this.hasClass('filter')) { | 348 | if ($this.hasClass('filter')) { |
@@ -366,6 +373,11 @@ $listNav.on('touchend touchcancel', function(e) { | @@ -366,6 +373,11 @@ $listNav.on('touchend touchcancel', function(e) { | ||
366 | 373 | ||
367 | $active = $this.siblings('.active'); | 374 | $active = $this.siblings('.active'); |
368 | 375 | ||
376 | + if ($this.attr('class') !== $pre.attr('class')) { | ||
377 | + // 重置筛选项 | ||
378 | + filter.resetFilter(); | ||
379 | + } | ||
380 | + | ||
369 | $pre = $this; // $pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项 | 381 | $pre = $this; // $pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项 |
370 | 382 | ||
371 | if ($active.hasClass('filter')) { | 383 | if ($active.hasClass('filter')) { |
@@ -404,6 +416,7 @@ $listNav.on('touchend touchcancel', function(e) { | @@ -404,6 +416,7 @@ $listNav.on('touchend touchcancel', function(e) { | ||
404 | $active.removeClass('active'); | 416 | $active.removeClass('active'); |
405 | $this.addClass('active'); | 417 | $this.addClass('active'); |
406 | sortId = $this.data('id'); | 418 | sortId = $this.data('id'); |
419 | + allSub = $this.data('allsub'); | ||
407 | $swiperSize.hide(); | 420 | $swiperSize.hide(); |
408 | $('#size-swiper-' + $this.index()).show(); | 421 | $('#size-swiper-' + $this.index()).show(); |
409 | swipers[$this.index()].onResize(); | 422 | swipers[$this.index()].onResize(); |
@@ -411,8 +424,11 @@ $listNav.on('touchend touchcancel', function(e) { | @@ -411,8 +424,11 @@ $listNav.on('touchend touchcancel', function(e) { | ||
411 | 424 | ||
412 | if (nav.reload) { | 425 | if (nav.reload) { |
413 | search([{ | 426 | search([{ |
414 | - type: 'sort', | 427 | + type: 'breakSort', |
415 | id: sortId | 428 | id: sortId |
429 | + }, { | ||
430 | + type: 'breakSize', | ||
431 | + id: allSub | ||
416 | }]); | 432 | }]); |
417 | } | 433 | } |
418 | } | 434 | } |
@@ -423,7 +439,7 @@ $listNav.on('touchend touchcancel', function(e) { | @@ -423,7 +439,7 @@ $listNav.on('touchend touchcancel', function(e) { | ||
423 | // 尺码选择事件 | 439 | // 尺码选择事件 |
424 | $swiperSize.on('click', function(e) { | 440 | $swiperSize.on('click', function(e) { |
425 | var $this = $(e.target).closest('li'), | 441 | var $this = $(e.target).closest('li'), |
426 | - index = $this.parents('.swiper-size').index(), | 442 | + index = $this.parents('.size-area').index(), |
427 | $parentType = $listNav.find('li').eq(index), | 443 | $parentType = $listNav.find('li').eq(index), |
428 | nav, sortId, sizeId, navType, $active; | 444 | nav, sortId, sizeId, navType, $active; |
429 | 445 | ||
@@ -452,10 +468,10 @@ $swiperSize.on('click', function(e) { | @@ -452,10 +468,10 @@ $swiperSize.on('click', function(e) { | ||
452 | 468 | ||
453 | if (nav.reload) { | 469 | if (nav.reload) { |
454 | search([{ | 470 | search([{ |
455 | - type: 'sort', | 471 | + type: 'breakSort', |
456 | id: sortId | 472 | id: sortId |
457 | }, { | 473 | }, { |
458 | - type: 'size', | 474 | + type: 'breakSize', |
459 | id: sizeId | 475 | id: sizeId |
460 | }]); | 476 | }]); |
461 | } | 477 | } |
@@ -480,8 +496,11 @@ $(window).scroll(function() { | @@ -480,8 +496,11 @@ $(window).scroll(function() { | ||
480 | 496 | ||
481 | // 初始请求最新第一页数据 | 497 | // 初始请求最新第一页数据 |
482 | search([{ | 498 | search([{ |
483 | - type: 'sort', | 499 | + type: 'breakSort', |
484 | id: $('.coat').data('id') | 500 | id: $('.coat').data('id') |
501 | +}, { | ||
502 | + type: 'breakSize', | ||
503 | + id: $('.coat').data('allsub') | ||
485 | }]); | 504 | }]); |
486 | 505 | ||
487 | $listNav.on('touchstart', 'li', function() { | 506 | $listNav.on('touchstart', 'li', function() { |
@@ -30,13 +30,13 @@ var $listNav = $('#list-nav'), | @@ -30,13 +30,13 @@ var $listNav = $('#list-nav'), | ||
30 | // 导航数据信息 | 30 | // 导航数据信息 |
31 | navInfo = { | 31 | navInfo = { |
32 | all: { | 32 | all: { |
33 | - order: 1, | 33 | + order: 0, |
34 | reload: true, | 34 | reload: true, |
35 | page: 0, | 35 | page: 0, |
36 | end: false | 36 | end: false |
37 | }, | 37 | }, |
38 | newest: { | 38 | newest: { |
39 | - order: 1, | 39 | + order: 0, |
40 | reload: true, | 40 | reload: true, |
41 | page: 0, | 41 | page: 0, |
42 | end: false | 42 | end: false |
@@ -92,6 +92,13 @@ function getUrlParam(name) { | @@ -92,6 +92,13 @@ function getUrlParam(name) { | ||
92 | return null; // 返回参数值 | 92 | return null; // 返回参数值 |
93 | } | 93 | } |
94 | 94 | ||
95 | +if ($('.sale-vip-page').length > 0) { | ||
96 | + defaultOpt.saleType = 2; | ||
97 | +} else if ($('.discount-detail-page').length > 0) { | ||
98 | + defaultOpt.saleType = 3; | ||
99 | + defaultOpt.productPool = $('.discount-detail-page').data('product-pool') || ''; | ||
100 | +} | ||
101 | + | ||
95 | // 获取频道 | 102 | // 获取频道 |
96 | $.extend(defaultOpt, { | 103 | $.extend(defaultOpt, { |
97 | yh_channel: getUrlParam('channel') || 'all' | 104 | yh_channel: getUrlParam('channel') || 'all' |
@@ -210,12 +217,6 @@ function search(opt, params) { | @@ -210,12 +217,6 @@ function search(opt, params) { | ||
210 | return; | 217 | return; |
211 | } | 218 | } |
212 | 219 | ||
213 | - if ($('.sale-vip-page').length > 0) { | ||
214 | - defaultOpt.saleType = 2; | ||
215 | - } else if ($('.sale-channel-page').length > 0) { | ||
216 | - defaultOpt.saleType = 3; | ||
217 | - } | ||
218 | - | ||
219 | if (params) { | 220 | if (params) { |
220 | defaultParams = params; | 221 | defaultParams = params; |
221 | $.extend(setting, params, { | 222 | $.extend(setting, params, { |
@@ -10,12 +10,12 @@ const helpers = require('../library/helpers'); | @@ -10,12 +10,12 @@ const helpers = require('../library/helpers'); | ||
10 | * 否则优先从cover1 --》 cover2 -- 》 images_url | 10 | * 否则优先从cover1 --》 cover2 -- 》 images_url |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | -const procProductImg = (product, gender) => { | ||
14 | - if (gender === '2,3') { | ||
15 | - return product.cover2 || product.cover1 || product.imagesUrl || ''; | 13 | +const procProductImg = (product, gender, yhChannel) => { |
14 | + if (gender === '2,3' || gender === '2' || gender === '3' && yhChannel === '2') { | ||
15 | + return product.cover2 || product.imagesUrl || product.cover1 || ''; | ||
16 | } | 16 | } |
17 | 17 | ||
18 | - return product.cover1 || product.cover2 || product.imagesUrl || ''; | 18 | + return product.cover1 || product.imagesUrl || product.cover2 || ''; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | 21 | ||
@@ -57,38 +57,17 @@ exports.processProductList = (list, options) => { | @@ -57,38 +57,17 @@ exports.processProductList = (list, options) => { | ||
57 | return; | 57 | return; |
58 | } | 58 | } |
59 | if (goods.isDefault === 'Y') { | 59 | if (goods.isDefault === 'Y') { |
60 | - product.defaultImages = procProductImg(goods); | 60 | + // product.defaultImages = procProductImg(goods); |
61 | + product.defaultImages = product.defaultImages; | ||
61 | flag = true; | 62 | flag = true; |
62 | } | 63 | } |
63 | }); | 64 | }); |
64 | 65 | ||
65 | // 如果还未赋值,则取第一个skc产品的默认图片 | 66 | // 如果还未赋值,则取第一个skc产品的默认图片 |
66 | if (!flag) { | 67 | if (!flag) { |
67 | - product.defaultImages = procProductImg(product.goodsList[0]); | 68 | + product.defaultImages = procProductImg(product.goodsList[0], product.gender, options.yh_channel); |
68 | } | 69 | } |
69 | 70 | ||
70 | - // product = Object.assign(product, { | ||
71 | - // id: product.productSkn, | ||
72 | - // thumb: product.defaultImages | ||
73 | - // }); | ||
74 | - | ||
75 | - // if (options.showPoint) { | ||
76 | - // // product.marketPrice += '.00'; | ||
77 | - // // product.salesPrice += '.00'; | ||
78 | - | ||
79 | - // // if (product.vip1Price) { | ||
80 | - // // product.vip1Price = parseInt(product.vip1Price) + '.00'; | ||
81 | - // // } | ||
82 | - | ||
83 | - // // if (product.vip2Price) { | ||
84 | - // // product.vip2Price = parseInt(product.vip2Price) + '.00'; | ||
85 | - // // } | ||
86 | - | ||
87 | - // // if (product.vip3Price) { | ||
88 | - // // product.vip3Price = parseInt(product.vip3Price) + '.00'; | ||
89 | - // // } | ||
90 | - // } | ||
91 | - | ||
92 | product.isSoonSoldOut = product.isSoonSoldOut === 'Y'; | 71 | product.isSoonSoldOut = product.isSoonSoldOut === 'Y'; |
93 | product.url = helpers.urlFormat(`/product/pro_${product.productId}_${product.goodsList[0].goodsId}/${product.cnAlphabet}.html`); // eslint-disable-line | 72 | product.url = helpers.urlFormat(`/product/pro_${product.productId}_${product.goodsList[0].goodsId}/${product.cnAlphabet}.html`); // eslint-disable-line |
94 | 73 | ||
@@ -147,7 +126,8 @@ exports.processFilter = (list, options) => { | @@ -147,7 +126,8 @@ exports.processFilter = (list, options) => { | ||
147 | dataId: 'id', | 126 | dataId: 'id', |
148 | subsName: 'brandName', | 127 | subsName: 'brandName', |
149 | firstSub: 0, | 128 | firstSub: 0, |
150 | - dataType: 'brand' | 129 | + dataType: 'brand', |
130 | + sortNum: '1' | ||
151 | }, | 131 | }, |
152 | color: { | 132 | color: { |
153 | name: '所有颜色', | 133 | name: '所有颜色', |
@@ -155,7 +135,8 @@ exports.processFilter = (list, options) => { | @@ -155,7 +135,8 @@ exports.processFilter = (list, options) => { | ||
155 | dataId: 'colorId', | 135 | dataId: 'colorId', |
156 | subsName: 'colorName', | 136 | subsName: 'colorName', |
157 | firstSub: 0, | 137 | firstSub: 0, |
158 | - dataType: 'color' | 138 | + dataType: 'color', |
139 | + sortNum: '3' | ||
159 | }, | 140 | }, |
160 | discount: { | 141 | discount: { |
161 | name: '所有商品', | 142 | name: '所有商品', |
@@ -163,7 +144,8 @@ exports.processFilter = (list, options) => { | @@ -163,7 +144,8 @@ exports.processFilter = (list, options) => { | ||
163 | dataId: 'key', | 144 | dataId: 'key', |
164 | subsName: 'name', | 145 | subsName: 'name', |
165 | firstSub: '0.1,0.9', | 146 | firstSub: '0.1,0.9', |
166 | - dataType: 'p_d' | 147 | + dataType: 'p_d', |
148 | + sortNum: '6' | ||
167 | }, | 149 | }, |
168 | gender: { | 150 | gender: { |
169 | name: '所有性别', | 151 | name: '所有性别', |
@@ -171,7 +153,8 @@ exports.processFilter = (list, options) => { | @@ -171,7 +153,8 @@ exports.processFilter = (list, options) => { | ||
171 | dataId: 'key', | 153 | dataId: 'key', |
172 | subsName: 'flag', | 154 | subsName: 'flag', |
173 | firstSub: '1,2,3', | 155 | firstSub: '1,2,3', |
174 | - dataType: 'gender' | 156 | + dataType: 'gender', |
157 | + sortNum: '0' | ||
175 | }, | 158 | }, |
176 | groupSort: { | 159 | groupSort: { |
177 | name: '所有品类', | 160 | name: '所有品类', |
@@ -179,7 +162,8 @@ exports.processFilter = (list, options) => { | @@ -179,7 +162,8 @@ exports.processFilter = (list, options) => { | ||
179 | dataId: 'relationParameter', | 162 | dataId: 'relationParameter', |
180 | subsName: 'categoryName', | 163 | subsName: 'categoryName', |
181 | firstSub: 0, | 164 | firstSub: 0, |
182 | - dataType: 'sort' | 165 | + dataType: 'sort', |
166 | + sortNum: '2' | ||
183 | }, | 167 | }, |
184 | priceRange: { | 168 | priceRange: { |
185 | name: '所有价格', | 169 | name: '所有价格', |
@@ -187,7 +171,8 @@ exports.processFilter = (list, options) => { | @@ -187,7 +171,8 @@ exports.processFilter = (list, options) => { | ||
187 | dataId: 'key', | 171 | dataId: 'key', |
188 | subsName: 'flag', | 172 | subsName: 'flag', |
189 | firstSub: 0, | 173 | firstSub: 0, |
190 | - dataType: 'price' | 174 | + dataType: 'price', |
175 | + sortNum: '5' | ||
191 | }, | 176 | }, |
192 | size: { | 177 | size: { |
193 | name: '所有尺码', | 178 | name: '所有尺码', |
@@ -195,7 +180,8 @@ exports.processFilter = (list, options) => { | @@ -195,7 +180,8 @@ exports.processFilter = (list, options) => { | ||
195 | dataId: 'sizeId', | 180 | dataId: 'sizeId', |
196 | subsName: 'sizeName', | 181 | subsName: 'sizeName', |
197 | firstSub: 0, | 182 | firstSub: 0, |
198 | - dataType: 'size' | 183 | + dataType: 'size', |
184 | + sortNum: '4' | ||
199 | } | 185 | } |
200 | }; | 186 | }; |
201 | 187 | ||
@@ -251,7 +237,7 @@ exports.processFilter = (list, options) => { | @@ -251,7 +237,7 @@ exports.processFilter = (list, options) => { | ||
251 | classify.subs.push(subs); | 237 | classify.subs.push(subs); |
252 | }); | 238 | }); |
253 | 239 | ||
254 | - filters.classify.push(classify); | 240 | + filters.classify[filtersType[key].sortNum] = classify; |
255 | }); | 241 | }); |
256 | 242 | ||
257 | return filters; | 243 | return filters; |
-
Please register or login to post a comment