Authored by baoss

Merge branch 'feature/group-buy' of git.yoho.cn:fe/yohobuywap-node into feature/group-buy

... ... @@ -112,7 +112,7 @@ class GroupService extends global.yoho.BaseModel {
});
return {
recommend
...recommend
};
} catch (e) {
... ...
<div class="product-item" data-product-skn="{{productSkn}}" data-activity-id="{{activityId}}">
<img src="{{image2 defaultImages w=200 h=282 q=80}}" alt="商品图片" class="prd-item-img">
<div class="prd-info">
<div class="prd-name">{{#ifcond @root.data.joinLimit '==' 1}}<span class="tag"></span>{{/ifcond
}}{{productName}}</div>
<div class="price">
<span class="cprice">¥{{collagePrice}}</span>
<span class="mprice">¥{{marketPrice}}</span>
</div>
{{#ifcond joinPeopleNum '>' 0}}
<span class="joined">{{joinPeopleNum}} 人已參加</span>
{{/ifcond}}
<div class="buy-btn">
<span class="num">{{peopleNum}}人成团</span>
<span class="immediate">立即购买</span>
</div>
</div>
</div>
... ...
... ... @@ -8,6 +8,7 @@ import dialog from 'js/plugin/dialog';
import lazyLoad from 'yoho-jquery-lazyload';
import yoSdk from 'yoho-activity-sdk';
let yoho = require('js/yoho-app');
let recItem = require('hbs/activity/group/progress-rec-item.hbs');
class GroupProgress extends Page {
constructor() {
... ... @@ -30,6 +31,7 @@ class GroupProgress extends Page {
groupPrice: '',
shareImgUrl: ''
};
this.page = 2;
this.loading = false;
this.loadedAll = false;
... ... @@ -50,7 +52,6 @@ class GroupProgress extends Page {
let self = this;
window.onscroll = function() {
if (timeout !== null) {
clearTimeout(timeout);
}
... ... @@ -82,7 +83,7 @@ class GroupProgress extends Page {
}
bindEvents() {
this.selector.$productItem.on('click', this.goDetail.bind(this));
$(document).on('click', '.product-item', this.goDetail.bind(this));
this.selector.$goJoin.on('click', this.goJoin.bind(this));
this.selector.$joinGroup.on('click', this.joinGroup.bind(this));
this.selector.$inviteJoin.on('click', this.inviteJoin.bind(this));
... ... @@ -326,7 +327,7 @@ class GroupProgress extends Page {
}
loadMoreData() {
if (this.loading && !this.loadedAll) {
if (this.loading || this.loadedAll) {
return;
}
... ... @@ -334,15 +335,35 @@ class GroupProgress extends Page {
this.ajax({
url: '/activity/group/groupResultRec',
data: {
page: 2,
limit: 2
page: this.page,
limit: 4
}
}).then(result => {
if (!result.collageProductVoList) {
this.loading = false;
this.loadedAll = true;
return;
}
}).then(() => {
this.page = this.page + 1;
this.renderMoreData(result.collageProductVoList);
this.loading = false;
}).catch(() => {
this.loading = false;
});
}
renderMoreData(list) {
console.log('render data');
let appendHtml = '';
list.forEach(item => {
appendHtml += recItem(item);
});
$('.recommend').append(appendHtml);
}
}
$(() => {
... ...