Showing
8 changed files
with
291 additions
and
1 deletions
@@ -253,3 +253,36 @@ exports.consultsubmit = (req, res, next) => { | @@ -253,3 +253,36 @@ exports.consultsubmit = (req, res, next) => { | ||
253 | return res.json(data); | 253 | return res.json(data); |
254 | }).catch(next); | 254 | }).catch(next); |
255 | }; | 255 | }; |
256 | + | ||
257 | + | ||
258 | +/** | ||
259 | + * 限定商品 详情页; | ||
260 | + */ | ||
261 | +exports.limit = (req, res, next) => { | ||
262 | + const uid = req.user.uid; | ||
263 | + const productCode = (req.query.code || '').trim(); | ||
264 | + | ||
265 | + if (!productCode) { | ||
266 | + return next(/* 404 */); | ||
267 | + } | ||
268 | + | ||
269 | + detailModel.getLimitProductData(uid, productCode) | ||
270 | + .then(result => { | ||
271 | + if (_.isEmpty(result)) { | ||
272 | + return next(); | ||
273 | + } | ||
274 | + | ||
275 | + result.appSrc = 'http://www.yohoshow.com/about/index/yohobuyqr/'; | ||
276 | + result.wxshare = { | ||
277 | + shareLink: helpers.urlFormat('/product/detail/limit', {code: productCode}), | ||
278 | + shareImg: result.banner.replace('//', 'http://'), | ||
279 | + shareTitle: result.name, | ||
280 | + shareDesc: '我在Yoho!Buy有货发现了一个限定发售商品', | ||
281 | + }; | ||
282 | + | ||
283 | + res.render('detail/limit', result); | ||
284 | + }) | ||
285 | + .catch(error => { | ||
286 | + next(error); | ||
287 | + }); | ||
288 | +}; |
@@ -689,7 +689,74 @@ let getProductData = (data) => { | @@ -689,7 +689,74 @@ let getProductData = (data) => { | ||
689 | }); | 689 | }); |
690 | }; | 690 | }; |
691 | 691 | ||
692 | +const getLimitProductData = (uid, limitProductCode) => { | ||
693 | + const param = { | ||
694 | + method: 'app.limitProduct.limitProductDetail', | ||
695 | + limitProductCode, | ||
696 | + uid | ||
697 | + }; | ||
698 | + | ||
699 | + return api.get('', param).then(result => { | ||
700 | + if (!(result && result.data)) { | ||
701 | + return Promise.reject(result); | ||
702 | + } | ||
703 | + | ||
704 | + let obj = {}; | ||
705 | + | ||
706 | + // if (!result.data.hasOwnProperty('attachment')) { | ||
707 | + // return | ||
708 | + // } | ||
709 | + | ||
710 | + obj.price = result.data.price; | ||
711 | + obj.name = result.data.productName; | ||
712 | + obj.releaseDate = `${result.data.saleTime}发售`; | ||
713 | + obj.banner = helpers.image(result.data.defaultUrl, 750, ''); | ||
714 | + obj.description = result.data.description; | ||
715 | + obj.attaches = []; | ||
716 | + | ||
717 | + for (let item of result.data.attachment) { | ||
718 | + if (item.isDefault === 1) { // 排除默认图片 | ||
719 | + continue; | ||
720 | + } | ||
721 | + | ||
722 | + let attach = {}; | ||
723 | + | ||
724 | + switch (item.attachType) { | ||
725 | + case 1: | ||
726 | + attach.isImg = true; | ||
727 | + attach.attachUrl = helpers.image(item.attachUrl, 750, ''); | ||
728 | + attach.attachName = item.intro; | ||
729 | + attach.intro = item.intro; | ||
730 | + break; | ||
731 | + case 2: | ||
732 | + attach.isVideo = true; | ||
733 | + attach.attachUrl = item.attachUrl; | ||
734 | + attach.img = helpers.image(item.intro, 750, ''); | ||
735 | + break; | ||
736 | + case 3: | ||
737 | + attach.isText = true; | ||
738 | + attach.intro = item.intro; | ||
739 | + break; | ||
740 | + default: | ||
741 | + break; | ||
742 | + } | ||
743 | + attach.orderBy = item.orderBy; | ||
744 | + | ||
745 | + obj.attaches.push(attach); | ||
746 | + } | ||
747 | + | ||
748 | + if (obj.attaches.length > 1) { | ||
749 | + obj.attaches.sort((v1, v2) => { | ||
750 | + return v1.orderBy - v2.orderBy; | ||
751 | + }); | ||
752 | + } | ||
753 | + | ||
754 | + return obj; | ||
755 | + }); | ||
756 | +}; | ||
757 | + | ||
692 | module.exports = { | 758 | module.exports = { |
693 | getProductData, | 759 | getProductData, |
694 | - getUserProfile: _getUserProfile | 760 | + getUserProfile: _getUserProfile, |
761 | + getLimitProductData | ||
695 | }; | 762 | }; |
@@ -37,6 +37,9 @@ router.get('/detail/consultform', auth, detail.consultform); // 商å“咨询表å | @@ -37,6 +37,9 @@ router.get('/detail/consultform', auth, detail.consultform); // 商å“咨询表å | ||
37 | router.get('/detail/comments', detail.comments); // 商品评价 | 37 | router.get('/detail/comments', detail.comments); // 商品评价 |
38 | router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口 | 38 | router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口 |
39 | 39 | ||
40 | +// 限定商品 | ||
41 | +router.get('/detail/limit', detail.limit); | ||
42 | + | ||
40 | router.post('/detail/consultupvote', detail.consultUpvoteOrUseful); // 商品咨询提交接口 | 43 | router.post('/detail/consultupvote', detail.consultUpvoteOrUseful); // 商品咨询提交接口 |
41 | router.post('/detail/consultuseful', detail.consultUpvoteOrUseful); // 商品咨询提交接口 | 44 | router.post('/detail/consultuseful', detail.consultUpvoteOrUseful); // 商品咨询提交接口 |
42 | 45 |
apps/product/views/action/detail/limit.hbs
0 → 100644
1 | +<div class="limit-good-page yoho-page"> | ||
2 | + <div class="top clearfix"> | ||
3 | + <p>我在Yoho!Buy有货发现了一个限定发售商品</p> | ||
4 | + </div> | ||
5 | + <div class="banner"> | ||
6 | + <img src="{{banner}}" alt=""> | ||
7 | + </div> | ||
8 | + <div class="detail clearfix"> | ||
9 | + <p class="name">{{name}}</p> | ||
10 | + <div class="sale-info"> | ||
11 | + <span class="price">{{price}}</span> | ||
12 | + <span class="date"> | ||
13 | + <span class="iconfont"></span> | ||
14 | + <span class="text">{{releaseDate}}</span> | ||
15 | + </span> | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + | ||
19 | + {{#if attaches}} | ||
20 | + <div class="good-desc"> | ||
21 | + {{# attaches}} | ||
22 | + {{#if isImg}} | ||
23 | + <img src="{{attachUrl}}" alt="{{attachName}}"> | ||
24 | + {{else if isText}} | ||
25 | + <p class="desc">{{intro}}</p> | ||
26 | + {{else}} | ||
27 | + <video poster="{{img}}" controls="controls" controls="controls" preload="metadata" loop="loop" width="100%" name="media"> | ||
28 | + <source src="{{attachUrl}}" type="video/ogg;codecs=" theora,vorbis"" media="screen" /> | ||
29 | + <source src="{{attachUrl}}"/> | ||
30 | + </video> | ||
31 | + {{/if}} | ||
32 | + {{/attaches}} | ||
33 | + </div> | ||
34 | + {{/if}} | ||
35 | + | ||
36 | + <div class="bottom"> | ||
37 | + <div class="logo"></div> | ||
38 | + <div class="left"> | ||
39 | + <a href="{{appSrc}}"> | ||
40 | + <button class="btn"> | ||
41 | + 立即下载 | ||
42 | + </button> | ||
43 | + </a> | ||
44 | + </div> | ||
45 | + <div class="right"> | ||
46 | + <span>下载Yoho!Buy有货APP</span> | ||
47 | + <span>抢购超级限量款</span> | ||
48 | + </div> | ||
49 | + </div> | ||
50 | +{{#wxshare}} | ||
51 | + <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> | ||
52 | + <input id="shareLink" type="hidden" value="{{shareLink}}"> | ||
53 | + <input id="shareImg" type="hidden" value="{{shareImg}}"> | ||
54 | + <input id="shareTitle" type="hidden" value="{{shareTitle}}"> | ||
55 | + <input id="shareDesc" type="hidden" value="{{shareDesc}}"> | ||
56 | +{{/wxshare}} | ||
57 | +</div> |
public/img/product/logo-bottom.png
0 → 100644

5.81 KB
public/img/sprite.product.png
0 → 100644

5.12 KB
public/scss/product/detail/_limit.css
0 → 100644
1 | +.limit-good-page { | ||
2 | + background-color: #f4f4f4; | ||
3 | + color: #444; | ||
4 | + | ||
5 | + .top { | ||
6 | + font-size: 24px; | ||
7 | + height: 80px; | ||
8 | + line-height: 88px; | ||
9 | + margin-bottom: 4px; | ||
10 | + background-color: #fff; | ||
11 | + padding: 8px 0 8px 20px; | ||
12 | + | ||
13 | + div { | ||
14 | + width: 0%; | ||
15 | + display: inline-block; | ||
16 | + | ||
17 | + img { | ||
18 | + width: 60px; | ||
19 | + position: relative; | ||
20 | + top: 10px; | ||
21 | + } | ||
22 | + } | ||
23 | + | ||
24 | + p { | ||
25 | + display: inline-block; | ||
26 | + width: 80%; | ||
27 | + } | ||
28 | + } | ||
29 | + | ||
30 | + .detail { | ||
31 | + background-color: #fff; | ||
32 | + padding: 24px 32px; | ||
33 | + border-bottom: 1PX solid #e6e6e6; | ||
34 | + margin-bottom: 1rem; | ||
35 | + | ||
36 | + .name { | ||
37 | + font-size: 36px; | ||
38 | + margin-bottom: 20px; | ||
39 | + } | ||
40 | + | ||
41 | + .sale-info { | ||
42 | + height: 40px; | ||
43 | + line-height: 40px; | ||
44 | + } | ||
45 | + | ||
46 | + .price { | ||
47 | + font-size: 32px; | ||
48 | + color: #d0021b; | ||
49 | + float: left; | ||
50 | + } | ||
51 | + | ||
52 | + .date { | ||
53 | + font-size: 24px; | ||
54 | + float: right; | ||
55 | + | ||
56 | + .text { | ||
57 | + position: relative; | ||
58 | + top: 3.2px; | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + .iconfont { | ||
63 | + vertical-align: middle; | ||
64 | + } | ||
65 | + } | ||
66 | + | ||
67 | + .good-desc { | ||
68 | + padding: 20px; | ||
69 | + border-top: 1PX solid #e6e6e6; | ||
70 | + background-color: #fff; | ||
71 | + | ||
72 | + p { | ||
73 | + font-size: 24px; | ||
74 | + line-height: 40px; | ||
75 | + text-indent: 2em; | ||
76 | + } | ||
77 | + | ||
78 | + img { | ||
79 | + margin: 12px 0; | ||
80 | + max-width: 100%; | ||
81 | + } | ||
82 | + } | ||
83 | + | ||
84 | + .bottom { | ||
85 | + background-color: #fff; | ||
86 | + padding: 20px 80px 80px; | ||
87 | + margin: 0 auto; | ||
88 | + | ||
89 | + .logo { | ||
90 | + height: 100px; | ||
91 | + background-image: resolve("product/logo-bottom.png"); | ||
92 | + background-size: 100%; | ||
93 | + background-repeat: no-repeat; | ||
94 | + background-position: center; | ||
95 | + } | ||
96 | + | ||
97 | + .btn { | ||
98 | + font-size: 32px; | ||
99 | + background-color: #fff; | ||
100 | + border: 1PX solid #444; | ||
101 | + border-radius: 8px; | ||
102 | + padding: 12px 24px; | ||
103 | + } | ||
104 | + | ||
105 | + .btn:active { | ||
106 | + background-color: #ccc; | ||
107 | + } | ||
108 | + | ||
109 | + .left, | ||
110 | + .right { | ||
111 | + float: left; | ||
112 | + } | ||
113 | + | ||
114 | + .left { | ||
115 | + width: 39%; | ||
116 | + } | ||
117 | + | ||
118 | + .right { | ||
119 | + width: 60%; | ||
120 | + font-size: 26px; | ||
121 | + | ||
122 | + span { | ||
123 | + display: block; | ||
124 | + width: 95%; | ||
125 | + margin: 0 auto; | ||
126 | + } | ||
127 | + } | ||
128 | + } | ||
129 | +} |
-
Please register or login to post a comment