Authored by yyq

限制商品总数量

... ... @@ -793,6 +793,7 @@ module.exports = class extends global.yoho.BaseModel {
*/
getTogetherProduct(params) {
const cartApi = new CartApi(this.ctx);
const maxNum = 100;
let page = parseInt(`0${params.page}`, 10) || 1,
limit = parseInt(`0${params.limit}`, 10) || 8;
... ... @@ -805,7 +806,21 @@ module.exports = class extends global.yoho.BaseModel {
}
let price = params.price || _.get(tabs, '[0].price', '0,300');
let productInfo = yield cartApi.getTogetherProductListAsync(price, page, limit);
let productInfo = yield cartApi.getTogetherProductListAsync(price, page, limit).then(result => {
let total = _.get(result, 'data.total', 0);
// 接口不限制总数量,需要前端限制商品总数量
if (total > maxNum) {
_.set(result, 'data.total', maxNum);
_.set(result, 'data.page_total', _.ceil(maxNum / limit));
if (page * limit > maxNum && _.has(result, 'data.product_list')) {
result.data.product_list.length = 100 - (page - 1) * limit;
}
}
return result;
});
if (productInfo.code === 200) {
let footPager = pager(_.get(productInfo, 'data.page_total'), {page: page});
... ...
... ... @@ -832,7 +832,7 @@
float: left;
min-width: 80px;
height: 20px;
line-height: 20px;
line-height: 18px;
padding: 0 10px;
margin-right: 30px;
margin-bottom: 10px;
... ...
... ... @@ -341,6 +341,7 @@
.ord-sell-title > .order-pay-link {
float: right;
margin-right: 30px;
cursor: pointer;
i {
font-size: 12px;
... ...