Showing
21 changed files
with
415 additions
and
23 deletions
@@ -14,7 +14,9 @@ | @@ -14,7 +14,9 @@ | ||
14 | {{/announcement}} --}} | 14 | {{/announcement}} --}} |
15 | {{! 中间banner}} | 15 | {{! 中间banner}} |
16 | {{#if singleImage}} | 16 | {{#if singleImage}} |
17 | + <div data-id="{{template_id}}"> | ||
17 | {{> resources/banner}} | 18 | {{> resources/banner}} |
19 | + </div> | ||
18 | {{/if}} | 20 | {{/if}} |
19 | {{! 两个小图}} | 21 | {{! 两个小图}} |
20 | {{#if smallPic}} | 22 | {{#if smallPic}} |
@@ -222,7 +222,8 @@ const category = (req, res) => { | @@ -222,7 +222,8 @@ const category = (req, res) => { | ||
222 | }), | 222 | }), |
223 | goodList: params, | 223 | goodList: params, |
224 | showDownloadApp: true, | 224 | showDownloadApp: true, |
225 | - pageFooter: true | 225 | + pageFooter: true, |
226 | + category: true | ||
226 | }); | 227 | }); |
227 | }; | 228 | }; |
228 | 229 |
@@ -45,10 +45,15 @@ const selectNewSale = (req, res, next) => { | @@ -45,10 +45,15 @@ const selectNewSale = (req, res, next) => { | ||
45 | let params = _.assign({}, req.query); | 45 | let params = _.assign({}, req.query); |
46 | 46 | ||
47 | newModel.getSearchData(params).then((result) => { | 47 | newModel.getSearchData(params).then((result) => { |
48 | - res.render('search/page', { | ||
49 | - layout: false, | ||
50 | - new: result | ||
51 | - }); | 48 | + if (result.list.length > 0) { |
49 | + res.render('search/page', { | ||
50 | + layout: false, | ||
51 | + new: result.list, | ||
52 | + total: result.total | ||
53 | + }); | ||
54 | + } else { | ||
55 | + res.json(result); | ||
56 | + } | ||
52 | }).catch(next); | 57 | }).catch(next); |
53 | }; | 58 | }; |
54 | 59 |
@@ -182,10 +182,16 @@ const search = (req, res, next) => { | @@ -182,10 +182,16 @@ const search = (req, res, next) => { | ||
182 | 182 | ||
183 | params.isApp = req.yoho.isApp; | 183 | params.isApp = req.yoho.isApp; |
184 | searchModel.getSearchData(params).then((result) => { | 184 | searchModel.getSearchData(params).then((result) => { |
185 | - res.render('search/page', { | ||
186 | - layout: false, | ||
187 | - new: result | ||
188 | - }); | 185 | + if (result.list.length > 0) { |
186 | + res.render('search/page', { | ||
187 | + layout: false, | ||
188 | + new: result.list, | ||
189 | + total: result.total | ||
190 | + }); | ||
191 | + } else { | ||
192 | + res.json(result); | ||
193 | + } | ||
194 | + | ||
189 | }).catch(next); | 195 | }).catch(next); |
190 | }; | 196 | }; |
191 | 197 |
@@ -71,7 +71,15 @@ const getNewFocus = (channel) => { | @@ -71,7 +71,15 @@ const getNewFocus = (channel) => { | ||
71 | const getSearchData = (params) => { | 71 | const getSearchData = (params) => { |
72 | return _searchGoods(params).then((result) => { | 72 | return _searchGoods(params).then((result) => { |
73 | if (result && result.code === 200) { | 73 | if (result && result.code === 200) { |
74 | - return productProcess.processProductList(result.data.product_list || [], {showTags: false}); | 74 | + let newList = {}; |
75 | + | ||
76 | + newList.list = productProcess.processProductList(result.data.product_list || [], {showTags: false}); | ||
77 | + | ||
78 | + if (parseInt(params.page) === 1) { | ||
79 | + newList.total = result.data.total; | ||
80 | + } | ||
81 | + | ||
82 | + return newList; | ||
75 | } else { | 83 | } else { |
76 | logger.error('get product search api return code is not 200'); | 84 | logger.error('get product search api return code is not 200'); |
77 | return []; | 85 | return []; |
@@ -147,10 +147,18 @@ const _searchGoods = (params) => { | @@ -147,10 +147,18 @@ const _searchGoods = (params) => { | ||
147 | const getSearchData = (params) => { | 147 | const getSearchData = (params) => { |
148 | return _searchGoods(params).then((result) => { | 148 | return _searchGoods(params).then((result) => { |
149 | if (result && result.code === 200) { | 149 | if (result && result.code === 200) { |
150 | - return productProcess.processProductList(result.data.product_list || [], { | 150 | + let newList = {}; |
151 | + | ||
152 | + newList.list = productProcess.processProductList(result.data.product_list || [], { | ||
151 | isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'), | 153 | isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'), |
152 | gender: _coverChannel[params.coverChannel] | 154 | gender: _coverChannel[params.coverChannel] |
153 | }); | 155 | }); |
156 | + | ||
157 | + if (parseInt(params.page) === 1) { | ||
158 | + newList.total = result.data.total; | ||
159 | + } | ||
160 | + | ||
161 | + return newList; | ||
154 | } else { | 162 | } else { |
155 | logger.error('get product search api return code is not 200'); | 163 | logger.error('get product search api return code is not 200'); |
156 | return []; | 164 | return []; |
@@ -84,7 +84,7 @@ module.exports = { | @@ -84,7 +84,7 @@ module.exports = { | ||
84 | port: '4444' // influxdb port | 84 | port: '4444' // influxdb port |
85 | }, | 85 | }, |
86 | console: { | 86 | console: { |
87 | - level: 'error', | 87 | + level: 'debug', |
88 | colorize: 'all', | 88 | colorize: 'all', |
89 | prettyPrint: true | 89 | prettyPrint: true |
90 | } | 90 | } |
@@ -155,7 +155,7 @@ var page = { | @@ -155,7 +155,7 @@ var page = { | ||
155 | // 埋点 | 155 | // 埋点 |
156 | tracking: function() { | 156 | tracking: function() { |
157 | var C_ID = this.getChannel(), | 157 | var C_ID = this.getChannel(), |
158 | - UDID = window.queryString.udid || '', | 158 | + UDID = window.queryString.udid || window.queryString.anbiudid || '', |
159 | SID = window.queryString.session_id || ''; | 159 | SID = window.queryString.session_id || ''; |
160 | 160 | ||
161 | // 刚进页面埋点 | 161 | // 刚进页面埋点 |
@@ -22,7 +22,7 @@ var getChannel = function() { | @@ -22,7 +22,7 @@ var getChannel = function() { | ||
22 | // 抽奖埋点 | 22 | // 抽奖埋点 |
23 | var tracking = function() { | 23 | var tracking = function() { |
24 | var C_ID = getChannel(), | 24 | var C_ID = getChannel(), |
25 | - UDID = window.queryString.udid || '', | 25 | + UDID = window.queryString.udid || window.queryString.anbiudid || '', |
26 | SID = window.queryString.session_id || ''; | 26 | SID = window.queryString.session_id || ''; |
27 | 27 | ||
28 | setTimeout(function() { | 28 | setTimeout(function() { |
@@ -18,6 +18,9 @@ var $mobileWrap = $('.mobile-wrap'), | @@ -18,6 +18,9 @@ var $mobileWrap = $('.mobile-wrap'), | ||
18 | swiperClass, | 18 | swiperClass, |
19 | isen = true; | 19 | isen = true; |
20 | 20 | ||
21 | +var getChannel, | ||
22 | + C_ID; | ||
23 | + | ||
21 | require('../common'); | 24 | require('../common'); |
22 | fastclick.attach(document.body); | 25 | fastclick.attach(document.body); |
23 | 26 | ||
@@ -228,3 +231,27 @@ window.setCookie('_Channel', $mobileWrap.data('channel'), { | @@ -228,3 +231,27 @@ window.setCookie('_Channel', $mobileWrap.data('channel'), { | ||
228 | }); | 231 | }); |
229 | 232 | ||
230 | require('./maybe-like')(); | 233 | require('./maybe-like')(); |
234 | + | ||
235 | +getChannel = function functionName() { | ||
236 | + var name = window.cookie('_Channel'); | ||
237 | + | ||
238 | + return { | ||
239 | + boys: 1, | ||
240 | + girls: 2, | ||
241 | + kids: 3, | ||
242 | + lifestyle: 4 | ||
243 | + }[name] || 1; | ||
244 | +}; | ||
245 | + | ||
246 | +C_ID = getChannel(); | ||
247 | + | ||
248 | +$('.search-btn').click(function() { | ||
249 | + if (window._yas && window._yas.sendCustomInfo) { | ||
250 | + window._yas.sendCustomInfo({ | ||
251 | + op: 'YB_HOME_SEARCH_C', | ||
252 | + param: JSON.stringify({ | ||
253 | + C_ID: C_ID, | ||
254 | + }) | ||
255 | + }, true); | ||
256 | + } | ||
257 | +}); |
@@ -299,7 +299,7 @@ $(function() { | @@ -299,7 +299,7 @@ $(function() { | ||
299 | 299 | ||
300 | if (isApp) { | 300 | if (isApp) { |
301 | speckParamApp = { | 301 | speckParamApp = { |
302 | - udid: window.queryString.udid || '', | 302 | + udid: window.queryString.udid || window.queryString.anbiudid || '', |
303 | apt: window.queryString.client_type || '', | 303 | apt: window.queryString.client_type || '', |
304 | sid: window.queryString.session_id || '', | 304 | sid: window.queryString.session_id || '', |
305 | }; | 305 | }; |
@@ -14,18 +14,58 @@ var productId = $('#productId').val(); | @@ -14,18 +14,58 @@ var productId = $('#productId').val(); | ||
14 | var skn = $('#productSkn').val(), | 14 | var skn = $('#productSkn').val(), |
15 | productCode = $('#limitProductCode').val(); | 15 | productCode = $('#limitProductCode').val(); |
16 | 16 | ||
17 | +var getChannel, | ||
18 | + C_ID, | ||
19 | + PRD_ID; | ||
20 | + | ||
21 | +getChannel = function functionName() { | ||
22 | + var name = window.cookie('_Channel'); | ||
23 | + | ||
24 | + return { | ||
25 | + boys: 1, | ||
26 | + girls: 2, | ||
27 | + kids: 3, | ||
28 | + lifestyle: 4 | ||
29 | + }[name] || 1; | ||
30 | +}; | ||
31 | + | ||
17 | $('#likeBtn').on('touchstart', function() { | 32 | $('#likeBtn').on('touchstart', function() { |
18 | var opt, | 33 | var opt, |
19 | favorite; | 34 | favorite; |
20 | 35 | ||
21 | var $this = $(this); | 36 | var $this = $(this); |
22 | 37 | ||
38 | + PRD_ID = productId; | ||
39 | + C_ID = getChannel(); | ||
40 | + | ||
23 | if ($this.hasClass('liked')) { | 41 | if ($this.hasClass('liked')) { |
24 | opt = 'cancel'; | 42 | opt = 'cancel'; |
25 | favorite = 0; | 43 | favorite = 0; |
44 | + | ||
45 | + if (window._yas && window._yas.sendCustomInfo) { | ||
46 | + window._yas.sendCustomInfo({ | ||
47 | + op: 'YB_COLLECTION_C', | ||
48 | + param: JSON.stringify({ | ||
49 | + C_ID: C_ID, | ||
50 | + PRD_ID: PRD_ID, | ||
51 | + COL_TYPE: 2 | ||
52 | + }) | ||
53 | + }, true); | ||
54 | + } | ||
26 | } else { | 55 | } else { |
27 | opt = 'ok'; | 56 | opt = 'ok'; |
28 | favorite = 1; | 57 | favorite = 1; |
58 | + | ||
59 | + if (window._yas && window._yas.sendCustomInfo) { | ||
60 | + window._yas.sendCustomInfo({ | ||
61 | + op: 'YB_COLLECTION_C', | ||
62 | + param: JSON.stringify({ | ||
63 | + C_ID: C_ID, | ||
64 | + PRD_ID: PRD_ID, | ||
65 | + COL_TYPE: 1 | ||
66 | + }) | ||
67 | + }, true); | ||
68 | + } | ||
29 | } | 69 | } |
30 | 70 | ||
31 | $.ajax({ | 71 | $.ajax({ |
@@ -33,6 +33,8 @@ var now = new Date(), | @@ -33,6 +33,8 @@ var now = new Date(), | ||
33 | month = now.getMonth() + 1, | 33 | month = now.getMonth() + 1, |
34 | date = now.getDate(); | 34 | date = now.getDate(); |
35 | 35 | ||
36 | +var getChannel, C_ID, argument; | ||
37 | + | ||
36 | require('../../common/footer'); | 38 | require('../../common/footer'); |
37 | 39 | ||
38 | var $listNav = $('#list-nav'), | 40 | var $listNav = $('#list-nav'), |
@@ -77,6 +79,19 @@ if ($('.swiper-container .swiper-slide').length > 1) { | @@ -77,6 +79,19 @@ if ($('.swiper-container .swiper-slide').length > 1) { | ||
77 | }); | 79 | }); |
78 | } | 80 | } |
79 | 81 | ||
82 | +getChannel = function functionName() { | ||
83 | + var name = window.cookie('_Channel'); | ||
84 | + | ||
85 | + return { | ||
86 | + boys: 1, | ||
87 | + girls: 2, | ||
88 | + kids: 3, | ||
89 | + lifestyle: 4 | ||
90 | + }[name] || 1; | ||
91 | +}; | ||
92 | + | ||
93 | +C_ID = getChannel(); | ||
94 | + | ||
80 | /** | 95 | /** |
81 | * 筛选注册的回调,筛选子项点击后逻辑 | 96 | * 筛选注册的回调,筛选子项点击后逻辑 |
82 | * 需要执行search的场景:1.点选筛选项;2.relaod为true时切换导航;3.下拉加载 | 97 | * 需要执行search的场景:1.点选筛选项;2.relaod为true时切换导航;3.下拉加载 |
@@ -201,13 +216,18 @@ function search(opt) { | @@ -201,13 +216,18 @@ function search(opt) { | ||
201 | searching = true; | 216 | searching = true; |
202 | loading.showLoadingMask(); | 217 | loading.showLoadingMask(); |
203 | 218 | ||
219 | + argument = setting; | ||
220 | + | ||
204 | $.ajax({ | 221 | $.ajax({ |
205 | type: 'GET', | 222 | type: 'GET', |
206 | url: '/product/new/selectNewSale', | 223 | url: '/product/new/selectNewSale', |
207 | data: setting, | 224 | data: setting, |
208 | success: function(data) { | 225 | success: function(data) { |
209 | var $container, | 226 | var $container, |
210 | - num; | 227 | + num, |
228 | + yasparm, | ||
229 | + goodid, | ||
230 | + goodIds = []; | ||
211 | 231 | ||
212 | switch (navType) { | 232 | switch (navType) { |
213 | case 'today': | 233 | case 'today': |
@@ -223,21 +243,68 @@ function search(opt) { | @@ -223,21 +243,68 @@ function search(opt) { | ||
223 | break; | 243 | break; |
224 | } | 244 | } |
225 | 245 | ||
226 | - if (data === ' ' || data === '') { | 246 | + if (data === ' ' || data === '' || data.list) { |
227 | nav.end = true; | 247 | nav.end = true; |
228 | if (nav.reload) { | 248 | if (nav.reload) { |
229 | $container.html(noResult); | 249 | $container.html(noResult); |
230 | } | 250 | } |
231 | } else { | 251 | } else { |
252 | + yasparm = { | ||
253 | + C_ID: C_ID, | ||
254 | + PAGE_NUM: setting.page, | ||
255 | + FILTER_VALUE: JSON.stringify(setting).replace(/\{|\}|\"/g, ''), | ||
256 | + SORT_TYPE: setting.dayLimit | ||
257 | + }; | ||
258 | + | ||
232 | if (nav.reload) { | 259 | if (nav.reload) { |
233 | $container.html(data); | 260 | $container.html(data); |
234 | lazyLoad($container.find('.lazy')); | 261 | lazyLoad($container.find('.lazy')); |
262 | + | ||
263 | + $container.find('.good-info').each(function() { | ||
264 | + goodid = $(this).data('good-id'); | ||
265 | + | ||
266 | + if (goodid) { | ||
267 | + goodIds.push(goodid); | ||
268 | + } | ||
269 | + }); | ||
270 | + | ||
271 | + if (window._yas && window._yas.sendCustomInfo) { | ||
272 | + window._yas.sendCustomInfo({ | ||
273 | + op: 'YB_NEW_GOODS_LIST_L', | ||
274 | + param: JSON.stringify(Object.assign(yasparm, { | ||
275 | + RES_QTY: $container.find('.total').data('id'), | ||
276 | + PRD_LIST: goodIds | ||
277 | + })) | ||
278 | + }, true); | ||
279 | + } | ||
235 | } else { | 280 | } else { |
236 | num = $container.find('.good-info').length; | 281 | num = $container.find('.good-info').length; |
237 | $container.append(data); | 282 | $container.append(data); |
238 | 283 | ||
284 | + if ($container.find('.total')[1]) { | ||
285 | + $container.find('.total')[1].remove(); | ||
286 | + } | ||
287 | + | ||
239 | // lazy good-infos who append in | 288 | // lazy good-infos who append in |
240 | lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy')); | 289 | lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy')); |
290 | + | ||
291 | + $container.find('.good-info:gt(' + (num - 1) + ')').each(function() { | ||
292 | + goodid = $(this).data('good-id'); | ||
293 | + | ||
294 | + if (goodid) { | ||
295 | + goodIds.push(goodid); | ||
296 | + } | ||
297 | + }); | ||
298 | + | ||
299 | + if (window._yas && window._yas.sendCustomInfo) { | ||
300 | + window._yas.sendCustomInfo({ | ||
301 | + op: 'YB_NEW_GOODS_LIST_L', | ||
302 | + param: JSON.stringify(Object.assign(yasparm, { | ||
303 | + RES_QTY: $container.find('.total').data('id'), | ||
304 | + PRD_LIST: goodIds | ||
305 | + })) | ||
306 | + }, true); | ||
307 | + } | ||
241 | } | 308 | } |
242 | 309 | ||
243 | } | 310 | } |
@@ -404,3 +471,27 @@ $listNav.on('touchstart', 'li', function() { | @@ -404,3 +471,27 @@ $listNav.on('touchstart', 'li', function() { | ||
404 | }).on('touchend touchcancel', function() { | 471 | }).on('touchend touchcancel', function() { |
405 | $listNav.find('li').removeClass('bytouch'); | 472 | $listNav.find('li').removeClass('bytouch'); |
406 | }); | 473 | }); |
474 | + | ||
475 | +$('#goods-container').on('click', '.good-info', function() { | ||
476 | + var PRD_ID = $(this).data('good-id'), | ||
477 | + PRD_NUM = $(this).index(), | ||
478 | + FILTER_VALUE = JSON.stringify(argument).replace(/\{|\}|\"/g, ''); | ||
479 | + | ||
480 | + // event.preventDefault(); | ||
481 | + | ||
482 | + if (window._yas && window._yas.sendCustomInfo) { | ||
483 | + window._yas.sendCustomInfo({ | ||
484 | + op: 'YB_NEW_GOODS_LIST_C', | ||
485 | + param: JSON.stringify({ | ||
486 | + C_ID: C_ID, | ||
487 | + PRD_ID: PRD_ID, | ||
488 | + PRD_NUM: PRD_NUM, | ||
489 | + PAGE_NUM: argument.page, | ||
490 | + FILTER_VALUE: FILTER_VALUE || '', | ||
491 | + SORT_TYPE: argument.dayLimit | ||
492 | + }) | ||
493 | + }, true); | ||
494 | + } | ||
495 | + | ||
496 | + // return false; | ||
497 | +}); |
@@ -31,6 +31,8 @@ var historyval = writeSearch.getHistoryval(); | @@ -31,6 +31,8 @@ var historyval = writeSearch.getHistoryval(); | ||
31 | 31 | ||
32 | var chHammer, cHammer; | 32 | var chHammer, cHammer; |
33 | 33 | ||
34 | +var getChannel, C_ID, POS_ID, FLR_INDEX; | ||
35 | + | ||
34 | require('../../common'); | 36 | require('../../common'); |
35 | 37 | ||
36 | chHammer = new Hammer($clearHistory[0]); | 38 | chHammer = new Hammer($clearHistory[0]); |
@@ -123,6 +125,19 @@ function inputAction() { | @@ -123,6 +125,19 @@ function inputAction() { | ||
123 | }); | 125 | }); |
124 | } | 126 | } |
125 | 127 | ||
128 | +getChannel = function functionName() { | ||
129 | + var name = window.cookie('_Channel'); | ||
130 | + | ||
131 | + return { | ||
132 | + boys: 1, | ||
133 | + girls: 2, | ||
134 | + kids: 3, | ||
135 | + lifestyle: 4 | ||
136 | + }[name] || 1; | ||
137 | +}; | ||
138 | + | ||
139 | +C_ID = getChannel(); | ||
140 | + | ||
126 | // 热门搜索、最近搜索事件 | 141 | // 热门搜索、最近搜索事件 |
127 | $('.search-items .search-group').on('click', 'li', function(event) { | 142 | $('.search-items .search-group').on('click', 'li', function(event) { |
128 | var query = ''; | 143 | var query = ''; |
@@ -135,6 +150,26 @@ $('.search-items .search-group').on('click', 'li', function(event) { | @@ -135,6 +150,26 @@ $('.search-items .search-group').on('click', 'li', function(event) { | ||
135 | query = $(event.target).find('a').html(); | 150 | query = $(event.target).find('a').html(); |
136 | } | 151 | } |
137 | 152 | ||
153 | + if ($(this).parents('.search-group').hasClass('history-search')) { | ||
154 | + POS_ID = 1; | ||
155 | + FLR_INDEX = 1; | ||
156 | + } else { | ||
157 | + POS_ID = 2; | ||
158 | + FLR_INDEX = 2; | ||
159 | + } | ||
160 | + | ||
161 | + if (window._yas && window._yas.sendCustomInfo) { | ||
162 | + window._yas.sendCustomInfo({ | ||
163 | + op: 'YB_KEYWORD_SEARCH_C', | ||
164 | + param: JSON.stringify({ | ||
165 | + C_ID: C_ID, | ||
166 | + KEYWORD: query, | ||
167 | + POS_ID: POS_ID, | ||
168 | + FLR_INDEX: FLR_INDEX | ||
169 | + }) | ||
170 | + }, true); | ||
171 | + } | ||
172 | + | ||
138 | goSearch(query); | 173 | goSearch(query); |
139 | }); | 174 | }); |
140 | 175 | ||
@@ -159,6 +194,18 @@ $search.on('touchend', function() { | @@ -159,6 +194,18 @@ $search.on('touchend', function() { | ||
159 | return false; | 194 | return false; |
160 | } | 195 | } |
161 | 196 | ||
197 | + if (window._yas && window._yas.sendCustomInfo) { | ||
198 | + window._yas.sendCustomInfo({ | ||
199 | + op: 'YB_KEYWORD_SEARCH_C', | ||
200 | + param: JSON.stringify({ | ||
201 | + C_ID: C_ID, | ||
202 | + KEYWORD: $buriedpoint.val(), | ||
203 | + POS_ID: 0, | ||
204 | + FLR_INDEX: 0 | ||
205 | + }) | ||
206 | + }, true); | ||
207 | + } | ||
208 | + | ||
162 | $(this).closest('form').submit(); | 209 | $(this).closest('form').submit(); |
163 | return false; | 210 | return false; |
164 | }); | 211 | }); |
@@ -84,6 +84,10 @@ var $listNav = $('#list-nav'), | @@ -84,6 +84,10 @@ var $listNav = $('#list-nav'), | ||
84 | introHammer, | 84 | introHammer, |
85 | brandColHammer; | 85 | brandColHammer; |
86 | 86 | ||
87 | +var getChannel, C_ID, RES_QTY, argument, optype; | ||
88 | + | ||
89 | +var category = $('#category-point').val(); | ||
90 | + | ||
87 | require('../../common'); | 91 | require('../../common'); |
88 | 92 | ||
89 | ellipsis.init(); | 93 | ellipsis.init(); |
@@ -229,6 +233,19 @@ specialoffer = getQueryString('specialoffer'); | @@ -229,6 +233,19 @@ specialoffer = getQueryString('specialoffer'); | ||
229 | specialsale_id = getQueryString('specialsale_id'); | 233 | specialsale_id = getQueryString('specialsale_id'); |
230 | promotion = getQueryString('promotion'); | 234 | promotion = getQueryString('promotion'); |
231 | 235 | ||
236 | +getChannel = function functionName() { | ||
237 | + var name = window.cookie('_Channel'); | ||
238 | + | ||
239 | + return { | ||
240 | + boys: 1, | ||
241 | + girls: 2, | ||
242 | + kids: 3, | ||
243 | + lifestyle: 4 | ||
244 | + }[name] || 1; | ||
245 | +}; | ||
246 | + | ||
247 | +C_ID = getChannel(); | ||
248 | + | ||
232 | /** | 249 | /** |
233 | * 筛选注册的回调,筛选子项点击后逻辑 | 250 | * 筛选注册的回调,筛选子项点击后逻辑 |
234 | * 需要执行search的场景:1.点选筛选项;2.relaod为true时切换导航;3.下拉加载 | 251 | * 需要执行search的场景:1.点选筛选项;2.relaod为true时切换导航;3.下拉加载 |
@@ -445,6 +462,8 @@ function search(opt) { | @@ -445,6 +462,8 @@ function search(opt) { | ||
445 | searching = true; | 462 | searching = true; |
446 | loading.showLoadingMask(); | 463 | loading.showLoadingMask(); |
447 | 464 | ||
465 | + argument = setting; | ||
466 | + | ||
448 | $.ajax({ | 467 | $.ajax({ |
449 | type: 'GET', | 468 | type: 'GET', |
450 | url: location.protocol + '//m.yohobuy.com/product/search/search', | 469 | url: location.protocol + '//m.yohobuy.com/product/search/search', |
@@ -452,7 +471,11 @@ function search(opt) { | @@ -452,7 +471,11 @@ function search(opt) { | ||
452 | success: function(data) { | 471 | success: function(data) { |
453 | var noResult = '<p class="no-result">未找到相关搜索结果</p>', | 472 | var noResult = '<p class="no-result">未找到相关搜索结果</p>', |
454 | num, | 473 | num, |
455 | - $container; | 474 | + $container, |
475 | + goodIds = [], | ||
476 | + FILTER_VALUE, | ||
477 | + yasparm, | ||
478 | + PRD_LIST; | ||
456 | 479 | ||
457 | switch (navType) { | 480 | switch (navType) { |
458 | case 'new': | 481 | case 'new': |
@@ -474,24 +497,106 @@ function search(opt) { | @@ -474,24 +497,106 @@ function search(opt) { | ||
474 | break; | 497 | break; |
475 | } | 498 | } |
476 | 499 | ||
477 | - if (data === '') { | 500 | + // console.log(data) |
501 | + | ||
502 | + if (data === '' || data.list) { | ||
478 | nav.end = true; | 503 | nav.end = true; |
479 | 504 | ||
480 | if (nav.reload) { | 505 | if (nav.reload) { |
481 | $container.html(noResult); | 506 | $container.html(noResult); |
482 | } | 507 | } |
483 | } else { | 508 | } else { |
509 | + | ||
510 | + yasparm = { | ||
511 | + C_ID: C_ID, | ||
512 | + PAGE_NUM: setting.page, | ||
513 | + FILTER_VALUE: FILTER_VALUE, | ||
514 | + SORT_TYPE: setting.type | ||
515 | + }; | ||
516 | + | ||
517 | + if (category) { | ||
518 | + optype = 'YB_CATEGORY_GOODS_LIST_L', | ||
519 | + yasparm = Object.assign(yasparm, { | ||
520 | + CATEGORY_ID: window.queryString.title || '', | ||
521 | + }); | ||
522 | + } else if ($brandHeader.length > 0) { | ||
523 | + optype = 'YB_BRAND_GOODS_LIST_L', | ||
524 | + yasparm = Object.assign(yasparm, { | ||
525 | + BRAND_ID: $brandHeader.data('id') | ||
526 | + }); | ||
527 | + } else { | ||
528 | + optype = 'YB_KEYWORD_GOOS_LIST_L', | ||
529 | + yasparm = Object.assign(yasparm, { | ||
530 | + KEYWORD: setting.query || '' | ||
531 | + }); | ||
532 | + } | ||
533 | + | ||
484 | if (nav.reload) { | 534 | if (nav.reload) { |
485 | $container.html(data); | 535 | $container.html(data); |
486 | lazyLoad($container.find('.lazy')); | 536 | lazyLoad($container.find('.lazy')); |
537 | + | ||
538 | + RES_QTY = $container.find('.total').data('id'); | ||
539 | + FILTER_VALUE = JSON.stringify(setting).replace(/\{|\}|\"/g, ''); | ||
540 | + | ||
541 | + $container.find('.good-info').each(function() { | ||
542 | + var goodid = $(this).data('good-id'); | ||
543 | + | ||
544 | + if (goodid) { | ||
545 | + goodIds.push(goodid); | ||
546 | + } | ||
547 | + }); | ||
548 | + | ||
549 | + PRD_LIST = JSON.stringify(goodIds).replace(/\[|\]/g, ''); | ||
550 | + | ||
551 | + yasparm = Object.assign(yasparm, { | ||
552 | + PRD_LIST: PRD_LIST, | ||
553 | + RES_QTY: RES_QTY, | ||
554 | + FILTER_VALUE: FILTER_VALUE | ||
555 | + }); | ||
556 | + | ||
557 | + if (window._yas && window._yas.sendCustomInfo) { | ||
558 | + window._yas.sendCustomInfo({ | ||
559 | + op: optype, | ||
560 | + param: JSON.stringify(yasparm) | ||
561 | + }, true); | ||
562 | + } | ||
487 | } else { | 563 | } else { |
488 | num = $container.find('.good-info').length; | 564 | num = $container.find('.good-info').length; |
489 | $container.append(data); | 565 | $container.append(data); |
490 | 566 | ||
567 | + if ($container.find('.total')[1]) { | ||
568 | + $container.find('.total')[1].remove(); | ||
569 | + } | ||
570 | + | ||
571 | + RES_QTY = $container.find('.total').data('id'); | ||
572 | + FILTER_VALUE = JSON.stringify(setting).replace(/\{|\}|\"/g, ''); | ||
573 | + | ||
574 | + $container.find('.good-info:gt(' + (num - 1) + ')').each(function() { | ||
575 | + var goodid = $(this).data('good-id'); | ||
576 | + | ||
577 | + if (goodid) { | ||
578 | + goodIds.push(goodid); | ||
579 | + } | ||
580 | + }); | ||
581 | + | ||
582 | + PRD_LIST = JSON.stringify(goodIds).replace(/\[|\]/g, ''); | ||
583 | + | ||
584 | + yasparm = Object.assign(yasparm, { | ||
585 | + PRD_LIST: PRD_LIST, | ||
586 | + RES_QTY: RES_QTY, | ||
587 | + FILTER_VALUE: FILTER_VALUE | ||
588 | + }); | ||
589 | + | ||
590 | + if (window._yas && window._yas.sendCustomInfo) { | ||
591 | + window._yas.sendCustomInfo({ | ||
592 | + op: optype, | ||
593 | + param: JSON.stringify(yasparm) | ||
594 | + }, true); | ||
595 | + } | ||
596 | + | ||
491 | // lazy good-infos who append in | 597 | // lazy good-infos who append in |
492 | lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy')); | 598 | lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy')); |
493 | } | 599 | } |
494 | - | ||
495 | } | 600 | } |
496 | 601 | ||
497 | nav.reload = false; | 602 | nav.reload = false; |
@@ -536,9 +641,10 @@ function search(opt) { | @@ -536,9 +641,10 @@ function search(opt) { | ||
536 | break; | 641 | break; |
537 | } | 642 | } |
538 | } | 643 | } |
644 | + | ||
645 | + | ||
539 | } | 646 | } |
540 | }); | 647 | }); |
541 | - | ||
542 | } | 648 | } |
543 | 649 | ||
544 | require('../../common/suspend-cart'); // 悬浮购物车 | 650 | require('../../common/suspend-cart'); // 悬浮购物车 |
@@ -954,3 +1060,47 @@ $listNav.on('touchstart', 'li', function() { | @@ -954,3 +1060,47 @@ $listNav.on('touchstart', 'li', function() { | ||
954 | }).on('touchend touchcancel', 'li', function() { | 1060 | }).on('touchend touchcancel', 'li', function() { |
955 | $listNav.find('li').removeClass('bytouch'); | 1061 | $listNav.find('li').removeClass('bytouch'); |
956 | }); | 1062 | }); |
1063 | + | ||
1064 | +$('#goods-container').on('click', '.good-info', function(event) { | ||
1065 | + var PRD_ID = $(this).data('good-id'), | ||
1066 | + PRD_NUM = $(this).index(), | ||
1067 | + FILTER_VALUE = JSON.stringify(argument).replace(/\{|\}|\"/g, ''), | ||
1068 | + yasparms; | ||
1069 | + | ||
1070 | + // event.preventDefault(); | ||
1071 | + | ||
1072 | + yasparms = { | ||
1073 | + C_ID: C_ID, | ||
1074 | + PRD_ID: PRD_ID, | ||
1075 | + PRD_NUM: PRD_NUM, | ||
1076 | + PAGE_NUM: argument.page, | ||
1077 | + FILTER_VALUE: FILTER_VALUE, | ||
1078 | + SORT_TYPE: argument.type | ||
1079 | + }; | ||
1080 | + | ||
1081 | + if (category) { | ||
1082 | + optype = 'YB_CATEGORY_GOODS_LIST_C', | ||
1083 | + yasparms = Object.assign(yasparms, { | ||
1084 | + CATEGORY_ID: window.queryString.title || '', | ||
1085 | + }); | ||
1086 | + } else if ($brandHeader.length > 0) { | ||
1087 | + optype = 'YB_BRAND_GOODS_LIST_C', | ||
1088 | + yasparms = Object.assign(yasparms, { | ||
1089 | + BRAND_ID: $brandHeader.data('id') | ||
1090 | + }); | ||
1091 | + } else { | ||
1092 | + optype = 'YB_KEYWORD_GOOS_LIST_C', | ||
1093 | + yasparms = Object.assign(yasparms, { | ||
1094 | + KEYWORD: argument.query || '' | ||
1095 | + }); | ||
1096 | + } | ||
1097 | + | ||
1098 | + if (window._yas && window._yas.sendCustomInfo) { | ||
1099 | + window._yas.sendCustomInfo({ | ||
1100 | + op: optype, | ||
1101 | + param: JSON.stringify(yasparms) | ||
1102 | + }, true); | ||
1103 | + } | ||
1104 | + | ||
1105 | + // return false; | ||
1106 | +}); |
@@ -242,6 +242,7 @@ seckillObj = { | @@ -242,6 +242,7 @@ seckillObj = { | ||
242 | data = $.extend(data, {isApp: yoho.isApp}); | 242 | data = $.extend(data, {isApp: yoho.isApp}); |
243 | $('.product-list').html(self.listTemplate(data)); | 243 | $('.product-list').html(self.listTemplate(data)); |
244 | lazyload('img.lazy'); | 244 | lazyload('img.lazy'); |
245 | + window.scrollTo(0, 0); | ||
245 | window.rePosFooter(); | 246 | window.rePosFooter(); |
246 | }, | 247 | }, |
247 | error: function(data) { | 248 | error: function(data) { |
@@ -16,7 +16,7 @@ search.start(); | @@ -16,7 +16,7 @@ search.start(); | ||
16 | 16 | ||
17 | $('.goods-container').on('click', '.good-info', function() { | 17 | $('.goods-container').on('click', '.good-info', function() { |
18 | var C_ID = getChannel(), | 18 | var C_ID = getChannel(), |
19 | - UDID = window.queryString.udid || '', | 19 | + UDID = window.queryString.udid || window.queryString.anbiudid || '', |
20 | SID = window.queryString.session_id || '', | 20 | SID = window.queryString.session_id || '', |
21 | skn = $(this).attr('data-id'); | 21 | skn = $(this).attr('data-id'); |
22 | 22 |
-
Please register or login to post a comment