Authored by 李奇

拼团结果页修改

... ... @@ -57,16 +57,19 @@ function groupList(req, res, next) {
}
function progress(req, res, next) {
req.ctx(GroupService).index()
.then(result => {
const uid = req.user.uid;
const groupNo = req.query.groupNo;
const activityId = req.query.activityId;
req.ctx(GroupService).groupResult({groupNo, activityId, uid})
.then(renderData => {
return res.render('group/progress', {
title: '拼团详情',
page: 'group-progress',
localCss: true,
nodownload: true,
width750: true,
wechatShare: true,
floors: result
data: renderData
});
}).catch(next);
}
... ...
... ... @@ -81,15 +81,17 @@ class GroupApi extends global.yoho.BaseModel {
/**
* 拼团详情
* @param uid
* @param groupNo
* @returns {Promise|Promise<T>}
*/
groupDetail({groupNo} = {}) {
groupDetail({groupNo, uid} = {}) {
return this.get({
url: '',
data: {
method: 'app.activity.groupDetail',
groupNo: groupNo
uid,
groupNo,
method: 'app.activity.groupDetail'
},
param: {code: 200}
}).then((result) => {
... ... @@ -102,14 +104,20 @@ class GroupApi extends global.yoho.BaseModel {
/**
* 活动拼团商品推荐
* @param activityId
* @param uid
* @param limit
* @param page
* @returns {Promise|Promise<T>}
*/
activityRecomend({activityId} = {}) {
activityRecommend({activityId, uid, limit = 20, page = 1} = {}) {
return this.get({
url: '',
data: {
uid,
page,
limit,
activityId,
method: 'app.collage.productList.detail',
activityId: activityId
},
param: {code: 200}
}).then((result) => {
... ...
... ... @@ -19,6 +19,65 @@ class GroupService extends global.yoho.BaseModel {
}
}
async groupResult({groupNo, activityId, uid} = {}) {
try {
const [detail, recommend] = await Promise.all([
this.api.groupDetail({
uid,
groupNo
}),
this.api.activityRecommend({
uid,
activityId
})
]);
// pageGo状态值:
// 1. 开团成功--准备邀请好友参团
// 2. 尚未加入团--应好友邀请
// 3. 已经加入团--应好友邀请
// 4. 团已达成--你已加入一起购买成功
// 5. 团已达成--你来晚了没能加入
// 6. 拼团失败--过期未达成
// 7. 拼团失败--过期未达成
let yourJoinItem = detail.yourJoinItem;
let membershipItems = detail.membershipItems;
if (!yourJoinItem) {
detail.yourJoinItem = membershipItems[0];
}
return {
...detail,
recommend
};
} catch (e) {
throw new Error('Group result fail to load data.');
}
}
async groupResultRec({activityId, uid, page, limit} = {}) {
try {
const recommend = await this.api.activityRecommend({
uid,
activityId,
limit,
page
});
return {
recommend
};
} catch (e) {
throw new Error('Group index fail to load resources.');
}
}
async tabData() {
const result = await this.api._getPromoteCount();
let tabsData = {};
... ...
<div class="group-progress">
{{#data}}
<div class="card">
<div class="inner-card">
<img
src="http://img13.static.yhbimg.com/goodsimg/2015/08/13/03/0294746e1d4e614c28dc8736dfca66d173.jpg?imageMogr2/thumbnail/200x284/background/d2hpdGU=/position/center/quality/80" alt="" class="card-pre-img">
<img src="{{image2 yourJoinItem.productIcon w=200 h=282}}" alt="" class="card-pre-img">
</div>
</div>
{{#ifcond pageGo '===' 7}}
<div class="status-text">拼团失败</div>
<div class="status-btn">查看更多拼团活动</div>
{{/ifcond}}
{{#ifcond pageGo '===' 6}}
<div class="status-text">拼团失败</div>
{{/ifcond}}
{{#ifcond pageGo '===' 4}}
<div class="status-text">拼团成功</div>
{{/ifcond}}
{{#ifcond pageGo '===' 5}}
<div class="status-text">你来晚了 你的好友拼团已经成功</div>
{{/ifcond}}
<a class="tip" href="http://m.yohobuy.com/activity/group">支付开团-支付参团-凑齐人数发货-凑不齐退款 玩法介绍》</a>
</div>
{{/data}}
<div class="divide"></div>
<div class="banner"></div>
<div class="divide zero-margin"></div>
<div class="recommend">
<p class="rec-title">看看其他拼团商品</p>
{{# @root.data.recommend.collageProductVoList}}
<div class="product-item">
<img src="http://img13.static.yhbimg.com/goodsimg/2015/08/13/03/0294746e1d4e614c28dc8736dfca66d173.jpg?imageMogr2/thumbnail/200x284/background/d2hpdGU=/position/center/quality/80" alt="" class="prd-item-img">
</div>
<div class="product-item">
<img src="http://img13.static.yhbimg.com/goodsimg/2015/08/13/03/0294746e1d4e614c28dc8736dfca66d173.jpg?imageMogr2/thumbnail/200x284/background/d2hpdGU=/position/center/quality/80" alt="" class="prd-item-img">
</div>
<div class="product-item">
<img src="http://img13.static.yhbimg.com/goodsimg/2015/08/13/03/0294746e1d4e614c28dc8736dfca66d173.jpg?imageMogr2/thumbnail/200x284/background/d2hpdGU=/position/center/quality/80" alt="" class="prd-item-img">
</div>
<div class="product-item">
<img src="http://img13.static.yhbimg.com/goodsimg/2015/08/13/03/0294746e1d4e614c28dc8736dfca66d173.jpg?imageMogr2/thumbnail/200x284/background/d2hpdGU=/position/center/quality/80" alt="" class="prd-item-img">
</div>
<div class="product-item">
<img src="http://img13.static.yhbimg.com/goodsimg/2015/08/13/03/0294746e1d4e614c28dc8736dfca66d173.jpg?imageMogr2/thumbnail/200x284/background/d2hpdGU=/position/center/quality/80" alt="" class="prd-item-img">
</div>
<div class="product-item">
<img src="http://img13.static.yhbimg.com/goodsimg/2015/08/13/03/0294746e1d4e614c28dc8736dfca66d173.jpg?imageMogr2/thumbnail/200x284/background/d2hpdGU=/position/center/quality/80" alt="" class="prd-item-img">
<img src="{{image2 defaultImages w=200 h=282}}" alt="" class="prd-item-img">
</div>
{{/@root.data.recommend.collageProductVoList}}
</div>
</div>
... ...
... ... @@ -7,7 +7,34 @@
height: 690px;
margin: 0 auto;
background: #fff;
box-shadow: 0 10px 32px -4px rgba(205, 205, 205, 0.5);
box-shadow: 0 0 20px rgba(205, 205, 205, 0.5);
}
.status-text {
position: absolute;
bottom: 250px;
left: 50%;
transform: translateX(-50%);
font-size: 36px;
color: #444;
letter-spacing: -1px;
text-align: center;
font-weight: bold;
}
.status-btn {
position: absolute;
bottom: 130px;
left: 50%;
height: 80px;
padding: 0 50px;
font-size: 32px;
color: #fff;
text-align: center;
line-height: 80px;
border-radius: 40px;
background-color: #000;
transform: translateX(-50%);
}
.inner-card {
... ... @@ -17,7 +44,7 @@
width: 600px;
height: 282px;
background: #fff;
box-shadow: 0 10px 20px -4px rgba(0, 0, 0, 0.17);
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}
.inner-card .card-pre-img {
... ...