Showing
8 changed files
with
59 additions
and
9 deletions
@@ -259,14 +259,14 @@ exports.handleOptsData = (params, total, extra) => { | @@ -259,14 +259,14 @@ exports.handleOptsData = (params, total, extra) => { | ||
259 | 259 | ||
260 | // 上下翻页数据处理 | 260 | // 上下翻页数据处理 |
261 | dest.pageCounts = [{ | 261 | dest.pageCounts = [{ |
262 | - href: handleFilterUrl(params, {limit: 200}), | ||
263 | - count: 200 | 262 | + href: handleFilterUrl(params, {limit: 60}), |
263 | + count: 60 | ||
264 | }, { | 264 | }, { |
265 | href: handleFilterUrl(params, {limit: 100}), | 265 | href: handleFilterUrl(params, {limit: 100}), |
266 | count: 100 | 266 | count: 100 |
267 | }, { | 267 | }, { |
268 | - href: handleFilterUrl(params, {limit: 60}), | ||
269 | - count: 60 | 268 | + href: handleFilterUrl(params, {limit: 200}), |
269 | + count: 200 | ||
270 | }]; | 270 | }]; |
271 | 271 | ||
272 | dest.curPage = _.isEmpty(params.page) ? 1 : params.page; // 当前页码数 | 272 | dest.curPage = _.isEmpty(params.page) ? 1 : params.page; // 当前页码数 |
@@ -577,6 +577,7 @@ exports.handleFilterData = (origin, params) => { | @@ -577,6 +577,7 @@ exports.handleFilterData = (origin, params) => { | ||
577 | 577 | ||
578 | // 处理颜色选中数据 | 578 | // 处理颜色选中数据 |
579 | if (color.checked) { | 579 | if (color.checked) { |
580 | + color['href'] = handleFilterUrl(params, null, {color: value.color_id}); | ||
580 | dest.checkedConditions.conditions.push(color); | 581 | dest.checkedConditions.conditions.push(color); |
581 | } | 582 | } |
582 | 583 | ||
@@ -595,6 +596,7 @@ exports.handleFilterData = (origin, params) => { | @@ -595,6 +596,7 @@ exports.handleFilterData = (origin, params) => { | ||
595 | 596 | ||
596 | // 处理颜色年龄段数据 | 597 | // 处理颜色年龄段数据 |
597 | if (ageLevel.checked) { | 598 | if (ageLevel.checked) { |
599 | + ageLevel['href'] = handleFilterUrl(params, null, {ageLevel: value.id}); | ||
598 | dest.checkedConditions.conditions.push(ageLevel); | 600 | dest.checkedConditions.conditions.push(ageLevel); |
599 | } | 601 | } |
600 | 602 | ||
@@ -1037,3 +1039,22 @@ exports.handleFilterUrl = handleFilterUrl; | @@ -1037,3 +1039,22 @@ exports.handleFilterUrl = handleFilterUrl; | ||
1037 | * @type {[type]} | 1039 | * @type {[type]} |
1038 | */ | 1040 | */ |
1039 | exports.handleCheckedData = handleCheckedData; | 1041 | exports.handleCheckedData = handleCheckedData; |
1042 | + | ||
1043 | +exports.handleNextPage = (params, total) => { | ||
1044 | + | ||
1045 | + let href; | ||
1046 | + let currentPage = parseInt((_.isEmpty(params.page) ? 1 : params.page), 10); // 当前页 | ||
1047 | + let perPageCount = parseInt((_.isEmpty(params.limit) ? 60 : params.limit), 10); // 每页商品数 | ||
1048 | + let totalPage = parseInt(total / perPageCount, 10) + 1; // 总页数 | ||
1049 | + | ||
1050 | + if (currentPage === totalPage) { | ||
1051 | + return null; | ||
1052 | + } else { | ||
1053 | + href = handleFilterUrl(params, {page: currentPage + 1}); | ||
1054 | + } | ||
1055 | + | ||
1056 | + return { | ||
1057 | + href : href, | ||
1058 | + src : '//img10.static.yhbimg.com/product/2014/01/15/11/01fa01614784f6239760f1b749663016f1.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90' | ||
1059 | + } | ||
1060 | +} |
@@ -18,11 +18,13 @@ const searchHandler = require('./search-handler'); | @@ -18,11 +18,13 @@ const searchHandler = require('./search-handler'); | ||
18 | */ | 18 | */ |
19 | exports.getSearchData = (params) => { | 19 | exports.getSearchData = (params) => { |
20 | 20 | ||
21 | + let mlimit = params && params.limit && params.limit > 0 ? params.limit - 1 : 59; | ||
22 | + | ||
21 | // 调用接口 | 23 | // 调用接口 |
22 | let apiMethod = [ | 24 | let apiMethod = [ |
23 | headerModel.requestHeaderData(), | 25 | headerModel.requestHeaderData(), |
24 | searchApi.getSortList(), | 26 | searchApi.getSortList(), |
25 | - searchApi.getProductList(params) | 27 | + searchApi.getProductList(Object.assign({}, params, {limit : mlimit})) |
26 | ]; | 28 | ]; |
27 | 29 | ||
28 | // 搜索店铺 | 30 | // 搜索店铺 |
@@ -54,7 +56,9 @@ exports.getSearchData = (params) => { | @@ -54,7 +56,9 @@ exports.getSearchData = (params) => { | ||
54 | totalCount: result[2].data.total, | 56 | totalCount: result[2].data.total, |
55 | footPager: searchHandler.handlePagerData(result[2].data.total, params), | 57 | footPager: searchHandler.handlePagerData(result[2].data.total, params), |
56 | goods: productProcess.processProductList(result[2].data.product_list, | 58 | goods: productProcess.processProductList(result[2].data.product_list, |
57 | - Object.assign({showDiscount: false}, params)) | 59 | + Object.assign({showDiscount: false}, params)), |
60 | + latestWalk: 7, | ||
61 | + hasNextPage : searchHandler.handleNextPage(params, result[2].data.total) | ||
58 | }); | 62 | }); |
59 | } | 63 | } |
60 | return finalResult; | 64 | return finalResult; |
@@ -19,13 +19,13 @@ module.exports = { | @@ -19,13 +19,13 @@ module.exports = { | ||
19 | 19 | ||
20 | api: 'http://api-test1.yohops.com:9999/', | 20 | api: 'http://api-test1.yohops.com:9999/', |
21 | 21 | ||
22 | - // api: 'http://testapi.yoho.cn:28078/', | 22 | + //api: 'http://testapi.yoho.cn:28078/', |
23 | 23 | ||
24 | service: 'http://service-test1.yohops.com:9999/', | 24 | service: 'http://service-test1.yohops.com:9999/', |
25 | 25 | ||
26 | // service: 'http://service.yoho.yohoops.org/', | 26 | // service: 'http://service.yoho.yohoops.org/', |
27 | 27 | ||
28 | - // service: 'http://testservice.yoho.cn:28077/', | 28 | + //service: 'http://testservice.yoho.cn:28077/', |
29 | search: 'http://192.168.102.216:8080/yohosearch/' | 29 | search: 'http://192.168.102.216:8080/yohosearch/' |
30 | }, | 30 | }, |
31 | subDomains: { | 31 | subDomains: { |
1 | +<script id="latest-walk-tpl" type="text/html"> | ||
2 | + \{{# latestWalk}} | ||
3 | + <div class="good"> | ||
4 | + <a href="\{{href}}" target="_blank"> | ||
5 | + <img class="lazy" data-original="\{{img}}" /> | ||
6 | + </a> | ||
7 | + <a class="name" href="\{{href}}" target="_blank">\{{name}}</a> | ||
8 | + <p class="price"> | ||
9 | + <span class="market-price">\{{marketPrice}}</span> | ||
10 | + <span class="sale-price">\{{salePrice}}</span> | ||
11 | + </p> | ||
12 | + </div> | ||
13 | + \{{/ latestWalk}} | ||
14 | +</script> |
@@ -11,6 +11,7 @@ var product = require('./index/product'); | @@ -11,6 +11,7 @@ var product = require('./index/product'); | ||
11 | require('../common'); | 11 | require('../common'); |
12 | require('../plugins/filter'); | 12 | require('../plugins/filter'); |
13 | require('../plugins/sort-pager'); | 13 | require('../plugins/sort-pager'); |
14 | +require('./detail/latest-walk'); | ||
14 | 15 | ||
15 | product.init(4); | 16 | product.init(4); |
16 | 17 |
-
Please register or login to post a comment