Authored by 周少峰

Merge branch 'release/5.3' of git.yoho.cn:fe/yohobuy-node into release/5.3

@@ -771,7 +771,8 @@ const getShopListData = (channel, params, uid) => { @@ -771,7 +771,8 @@ const getShopListData = (channel, params, uid) => {
771 headerModel.requestHeaderData(channel), // 头部数据 771 headerModel.requestHeaderData(channel), // 头部数据
772 searchApi.getShopDecorator(shopId), // 店铺装修数据 772 searchApi.getShopDecorator(shopId), // 店铺装修数据
773 searchApi.getShopInfo(shopId, uid), // 店铺介绍 773 searchApi.getShopInfo(shopId, uid), // 店铺介绍
774 - searchApi.getProductList(Object.assign({shop_id: shopId}, params)), // 搜索店铺商品 774 + searchApi.getProductList(Object.assign({shop_id: shopId}, params,
  775 + {limit: (params.limit || 60) - 1})), // 搜索店铺商品
775 searchApi.getSortList({shop_id: shopId}) // 店铺分类 776 searchApi.getSortList({shop_id: shopId}) // 店铺分类
776 ]; 777 ];
777 778
@@ -833,6 +834,7 @@ const getShopListData = (channel, params, uid) => { @@ -833,6 +834,7 @@ const getShopListData = (channel, params, uid) => {
833 gender: _getGender(channel), 834 gender: _getGender(channel),
834 query: params.query 835 query: params.query
835 }), 836 }),
  837 + hasNextPage: searchHandler.handleNextPage(params, totalPage),
836 footPager: searchHandler.handlePagerData(totalPage, params) 838 footPager: searchHandler.handlePagerData(totalPage, params)
837 }); 839 });
838 840
@@ -412,7 +412,7 @@ exports.handleOptsData = (params, total, extra) => { @@ -412,7 +412,7 @@ exports.handleOptsData = (params, total, extra) => {
412 dest.countPerPage = _.isEmpty(params.limit) ? 60 : params.limit; 412 dest.countPerPage = _.isEmpty(params.limit) ? 60 : params.limit;
413 413
414 // 全部页码数量 414 // 全部页码数量
415 - dest.pageCount = parseInt(total / (dest.countPerPage - 1), 10) + 1; 415 + dest.pageCount = _.ceil(total / (dest.countPerPage - 1));
416 416
417 // 每页多少商品 417 // 每页多少商品
418 let paramsLimit = parseInt((_.isEmpty(params.limit) ? 60 : params.limit), 10); 418 let paramsLimit = parseInt((_.isEmpty(params.limit) ? 60 : params.limit), 10);
@@ -1341,9 +1341,9 @@ exports.handleNextPage = (params, total) => { @@ -1341,9 +1341,9 @@ exports.handleNextPage = (params, total) => {
1341 let href; 1341 let href;
1342 let currentPage = parseInt((_.isEmpty(params.page) ? 1 : params.page), 10); // 当前页 1342 let currentPage = parseInt((_.isEmpty(params.page) ? 1 : params.page), 10); // 当前页
1343 let perPageCount = parseInt((_.isEmpty(params.limit) ? 60 : params.limit) - 1, 10); // 每页商品数 1343 let perPageCount = parseInt((_.isEmpty(params.limit) ? 60 : params.limit) - 1, 10); // 每页商品数
1344 - let totalPage = parseInt(total / perPageCount, 10) + 1; // 总页数 1344 + let totalPage = _.ceil(total / perPageCount); // 总页数
1345 1345
1346 - if (currentPage === totalPage) { 1346 + if (currentPage >= totalPage) {
1347 return null; 1347 return null;
1348 } else { 1348 } else {
1349 href = handleFilterUrl(params, {page: currentPage + 1}); 1349 href = handleFilterUrl(params, {page: currentPage + 1});