Showing
5 changed files
with
132 additions
and
30 deletions
@@ -57,16 +57,19 @@ function groupList(req, res, next) { | @@ -57,16 +57,19 @@ function groupList(req, res, next) { | ||
57 | } | 57 | } |
58 | 58 | ||
59 | function progress(req, res, next) { | 59 | function progress(req, res, next) { |
60 | - req.ctx(GroupService).index() | ||
61 | - .then(result => { | 60 | + const uid = req.user.uid; |
61 | + const groupNo = req.query.groupNo; | ||
62 | + const activityId = req.query.activityId; | ||
63 | + | ||
64 | + req.ctx(GroupService).groupResult({groupNo, activityId, uid}) | ||
65 | + .then(renderData => { | ||
62 | return res.render('group/progress', { | 66 | return res.render('group/progress', { |
63 | title: '拼团详情', | 67 | title: '拼团详情', |
64 | page: 'group-progress', | 68 | page: 'group-progress', |
65 | localCss: true, | 69 | localCss: true, |
66 | nodownload: true, | 70 | nodownload: true, |
67 | width750: true, | 71 | width750: true, |
68 | - wechatShare: true, | ||
69 | - floors: result | 72 | + data: renderData |
70 | }); | 73 | }); |
71 | }).catch(next); | 74 | }).catch(next); |
72 | } | 75 | } |
@@ -81,15 +81,17 @@ class GroupApi extends global.yoho.BaseModel { | @@ -81,15 +81,17 @@ class GroupApi extends global.yoho.BaseModel { | ||
81 | 81 | ||
82 | /** | 82 | /** |
83 | * 拼团详情 | 83 | * 拼团详情 |
84 | + * @param uid | ||
84 | * @param groupNo | 85 | * @param groupNo |
85 | * @returns {Promise|Promise<T>} | 86 | * @returns {Promise|Promise<T>} |
86 | */ | 87 | */ |
87 | - groupDetail({groupNo} = {}) { | 88 | + groupDetail({groupNo, uid} = {}) { |
88 | return this.get({ | 89 | return this.get({ |
89 | url: '', | 90 | url: '', |
90 | data: { | 91 | data: { |
91 | - method: 'app.activity.groupDetail', | ||
92 | - groupNo: groupNo | 92 | + uid, |
93 | + groupNo, | ||
94 | + method: 'app.activity.groupDetail' | ||
93 | }, | 95 | }, |
94 | param: {code: 200} | 96 | param: {code: 200} |
95 | }).then((result) => { | 97 | }).then((result) => { |
@@ -102,14 +104,20 @@ class GroupApi extends global.yoho.BaseModel { | @@ -102,14 +104,20 @@ class GroupApi extends global.yoho.BaseModel { | ||
102 | /** | 104 | /** |
103 | * 活动拼团商品推荐 | 105 | * 活动拼团商品推荐 |
104 | * @param activityId | 106 | * @param activityId |
107 | + * @param uid | ||
108 | + * @param limit | ||
109 | + * @param page | ||
105 | * @returns {Promise|Promise<T>} | 110 | * @returns {Promise|Promise<T>} |
106 | */ | 111 | */ |
107 | - activityRecomend({activityId} = {}) { | 112 | + activityRecommend({activityId, uid, limit = 20, page = 1} = {}) { |
108 | return this.get({ | 113 | return this.get({ |
109 | url: '', | 114 | url: '', |
110 | data: { | 115 | data: { |
116 | + uid, | ||
117 | + page, | ||
118 | + limit, | ||
119 | + activityId, | ||
111 | method: 'app.collage.productList.detail', | 120 | method: 'app.collage.productList.detail', |
112 | - activityId: activityId | ||
113 | }, | 121 | }, |
114 | param: {code: 200} | 122 | param: {code: 200} |
115 | }).then((result) => { | 123 | }).then((result) => { |
@@ -19,6 +19,65 @@ class GroupService extends global.yoho.BaseModel { | @@ -19,6 +19,65 @@ class GroupService extends global.yoho.BaseModel { | ||
19 | } | 19 | } |
20 | } | 20 | } |
21 | 21 | ||
22 | + | ||
23 | + async groupResult({groupNo, activityId, uid} = {}) { | ||
24 | + try { | ||
25 | + const [detail, recommend] = await Promise.all([ | ||
26 | + this.api.groupDetail({ | ||
27 | + uid, | ||
28 | + groupNo | ||
29 | + }), | ||
30 | + this.api.activityRecommend({ | ||
31 | + uid, | ||
32 | + activityId | ||
33 | + }) | ||
34 | + ]); | ||
35 | + | ||
36 | + // pageGo状态值: | ||
37 | + // 1. 开团成功--准备邀请好友参团 | ||
38 | + // 2. 尚未加入团--应好友邀请 | ||
39 | + // 3. 已经加入团--应好友邀请 | ||
40 | + // 4. 团已达成--你已加入一起购买成功 | ||
41 | + // 5. 团已达成--你来晚了没能加入 | ||
42 | + // 6. 拼团失败--过期未达成 | ||
43 | + // 7. 拼团失败--过期未达成 | ||
44 | + | ||
45 | + let yourJoinItem = detail.yourJoinItem; | ||
46 | + let membershipItems = detail.membershipItems; | ||
47 | + | ||
48 | + if (!yourJoinItem) { | ||
49 | + detail.yourJoinItem = membershipItems[0]; | ||
50 | + } | ||
51 | + | ||
52 | + return { | ||
53 | + ...detail, | ||
54 | + recommend | ||
55 | + }; | ||
56 | + | ||
57 | + } catch (e) { | ||
58 | + throw new Error('Group result fail to load data.'); | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + async groupResultRec({activityId, uid, page, limit} = {}) { | ||
63 | + try { | ||
64 | + const recommend = await this.api.activityRecommend({ | ||
65 | + uid, | ||
66 | + activityId, | ||
67 | + limit, | ||
68 | + page | ||
69 | + }); | ||
70 | + | ||
71 | + return { | ||
72 | + recommend | ||
73 | + }; | ||
74 | + | ||
75 | + } catch (e) { | ||
76 | + throw new Error('Group index fail to load resources.'); | ||
77 | + } | ||
78 | + } | ||
79 | + | ||
80 | + | ||
22 | async tabData() { | 81 | async tabData() { |
23 | const result = await this.api._getPromoteCount(); | 82 | const result = await this.api._getPromoteCount(); |
24 | let tabsData = {}; | 83 | let tabsData = {}; |
1 | <div class="group-progress"> | 1 | <div class="group-progress"> |
2 | + {{#data}} | ||
2 | <div class="card"> | 3 | <div class="card"> |
3 | <div class="inner-card"> | 4 | <div class="inner-card"> |
4 | - <img | ||
5 | - 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"> | 5 | + <img src="{{image2 yourJoinItem.productIcon w=200 h=282}}" alt="" class="card-pre-img"> |
6 | + </div> | ||
6 | 7 | ||
7 | 8 | ||
8 | - </div> | 9 | + {{#ifcond pageGo '===' 7}} |
10 | + <div class="status-text">拼团失败</div> | ||
11 | + <div class="status-btn">查看更多拼团活动</div> | ||
12 | + {{/ifcond}} | ||
13 | + | ||
14 | + {{#ifcond pageGo '===' 6}} | ||
15 | + <div class="status-text">拼团失败</div> | ||
16 | + {{/ifcond}} | ||
17 | + | ||
18 | + {{#ifcond pageGo '===' 4}} | ||
19 | + <div class="status-text">拼团成功</div> | ||
20 | + {{/ifcond}} | ||
21 | + | ||
22 | + {{#ifcond pageGo '===' 5}} | ||
23 | + <div class="status-text">你来晚了 你的好友拼团已经成功</div> | ||
24 | + {{/ifcond}} | ||
25 | + | ||
9 | <a class="tip" href="http://m.yohobuy.com/activity/group">支付开团-支付参团-凑齐人数发货-凑不齐退款 玩法介绍》</a> | 26 | <a class="tip" href="http://m.yohobuy.com/activity/group">支付开团-支付参团-凑齐人数发货-凑不齐退款 玩法介绍》</a> |
10 | </div> | 27 | </div> |
28 | + {{/data}} | ||
11 | <div class="divide"></div> | 29 | <div class="divide"></div> |
12 | <div class="banner"></div> | 30 | <div class="banner"></div> |
13 | <div class="divide zero-margin"></div> | 31 | <div class="divide zero-margin"></div> |
14 | <div class="recommend"> | 32 | <div class="recommend"> |
15 | <p class="rec-title">看看其他拼团商品</p> | 33 | <p class="rec-title">看看其他拼团商品</p> |
34 | + {{# @root.data.recommend.collageProductVoList}} | ||
16 | <div class="product-item"> | 35 | <div class="product-item"> |
17 | - <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"> | ||
18 | - </div> | ||
19 | - <div class="product-item"> | ||
20 | - <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"> | ||
21 | - </div> | ||
22 | - <div class="product-item"> | ||
23 | - <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"> | ||
24 | - </div> | ||
25 | - <div class="product-item"> | ||
26 | - <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"> | ||
27 | - </div> | ||
28 | - <div class="product-item"> | ||
29 | - <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"> | ||
30 | - </div> | ||
31 | - <div class="product-item"> | ||
32 | - <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"> | 36 | + <img src="{{image2 defaultImages w=200 h=282}}" alt="" class="prd-item-img"> |
33 | </div> | 37 | </div> |
38 | + {{/@root.data.recommend.collageProductVoList}} | ||
34 | </div> | 39 | </div> |
35 | </div> | 40 | </div> |
@@ -7,7 +7,34 @@ | @@ -7,7 +7,34 @@ | ||
7 | height: 690px; | 7 | height: 690px; |
8 | margin: 0 auto; | 8 | margin: 0 auto; |
9 | background: #fff; | 9 | background: #fff; |
10 | - box-shadow: 0 10px 32px -4px rgba(205, 205, 205, 0.5); | 10 | + box-shadow: 0 0 20px rgba(205, 205, 205, 0.5); |
11 | + } | ||
12 | + | ||
13 | + .status-text { | ||
14 | + position: absolute; | ||
15 | + bottom: 250px; | ||
16 | + left: 50%; | ||
17 | + transform: translateX(-50%); | ||
18 | + font-size: 36px; | ||
19 | + color: #444; | ||
20 | + letter-spacing: -1px; | ||
21 | + text-align: center; | ||
22 | + font-weight: bold; | ||
23 | + } | ||
24 | + | ||
25 | + .status-btn { | ||
26 | + position: absolute; | ||
27 | + bottom: 130px; | ||
28 | + left: 50%; | ||
29 | + height: 80px; | ||
30 | + padding: 0 50px; | ||
31 | + font-size: 32px; | ||
32 | + color: #fff; | ||
33 | + text-align: center; | ||
34 | + line-height: 80px; | ||
35 | + border-radius: 40px; | ||
36 | + background-color: #000; | ||
37 | + transform: translateX(-50%); | ||
11 | } | 38 | } |
12 | 39 | ||
13 | .inner-card { | 40 | .inner-card { |
@@ -17,7 +44,7 @@ | @@ -17,7 +44,7 @@ | ||
17 | width: 600px; | 44 | width: 600px; |
18 | height: 282px; | 45 | height: 282px; |
19 | background: #fff; | 46 | background: #fff; |
20 | - box-shadow: 0 10px 20px -4px rgba(0, 0, 0, 0.17); | 47 | + box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); |
21 | } | 48 | } |
22 | 49 | ||
23 | .inner-card .card-pre-img { | 50 | .inner-card .card-pre-img { |
-
Please register or login to post a comment