Showing
10 changed files
with
234 additions
and
2 deletions
apps/cart/controllers/pay.js
0 → 100644
1 | +/** | ||
2 | + * 支付成功页 | ||
3 | + * @author: jing.li<jing.li@yoho.cn> | ||
4 | + * @date: 2016/10/25 | ||
5 | + */ | ||
6 | + | ||
7 | +'use strict'; | ||
8 | + | ||
9 | +const mRoot = '../models'; | ||
10 | +const payModel = require(`${mRoot}/pay`); | ||
11 | +const headerModel = require('../../../doraemon/models/header'); // 头部model | ||
12 | + | ||
13 | +const payCod = (req, res, next) => { | ||
14 | + let headerData = headerModel.setNav({ | ||
15 | + navTitle: '支付成功' | ||
16 | + }); | ||
17 | + | ||
18 | + let responseData = { | ||
19 | + pageHeader: headerData, | ||
20 | + module: 'cart', | ||
21 | + page: 'pay', | ||
22 | + title: '支付成功' | ||
23 | + }; | ||
24 | + | ||
25 | + let contentCode = '05afedf76886d732573f10f7451a1703'; | ||
26 | + | ||
27 | + payModel.getPayCod(contentCode).then(result => { | ||
28 | + res.render('pay/pay-cod', Object.assign(responseData, result)); | ||
29 | + }).catch(next); | ||
30 | +}; | ||
31 | + | ||
32 | +module.exports = { | ||
33 | + payCod | ||
34 | +}; |
1 | /** | 1 | /** |
2 | - * sub app channel | 2 | + * sub app guang |
3 | * @author: Bi Kai<kai.bi@yoho.cn> | 3 | * @author: Bi Kai<kai.bi@yoho.cn> |
4 | * @date: 2016/05/09 | 4 | * @date: 2016/05/09 |
5 | */ | 5 | */ |
6 | 6 | ||
7 | -var express = require('express'); | 7 | +var express = require('express'), |
8 | + path = require('path'); | ||
8 | 9 | ||
9 | var app = express(); | 10 | var app = express(); |
10 | 11 | ||
12 | +// set view engin | ||
13 | +var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root | ||
14 | + | ||
11 | app.on('mount', function(parent) { | 15 | app.on('mount', function(parent) { |
12 | delete parent.locals.settings; // 不继承父 App 的设置 | 16 | delete parent.locals.settings; // 不继承父 App 的设置 |
13 | Object.assign(app.locals, parent.locals); | 17 | Object.assign(app.locals, parent.locals); |
14 | }); | 18 | }); |
15 | 19 | ||
20 | +app.use(global.yoho.hbs({ | ||
21 | + extname: '.hbs', | ||
22 | + defaultLayout: 'layout', | ||
23 | + layoutsDir: doraemon, | ||
24 | + partialsDir: path.join(__dirname, './views/partial'), | ||
25 | + views: path.join(__dirname, 'views/action'), | ||
26 | + helpers: global.yoho.helpers | ||
27 | +})); | ||
28 | + | ||
16 | // for zookeeper, inject locals | 29 | // for zookeeper, inject locals |
17 | app.use((req, res, next) => { | 30 | app.use((req, res, next) => { |
18 | req.app.locals.wap = app.locals.wap; | 31 | req.app.locals.wap = app.locals.wap; |
apps/cart/models/pay.js
0 → 100644
1 | +/** | ||
2 | + * 支付成功页 | ||
3 | + * @author: jing.li<jing.li@yoho.cn> | ||
4 | + * @date: 2016/10/25 | ||
5 | + */ | ||
6 | + | ||
7 | +'use strict'; | ||
8 | + | ||
9 | +const serviceAPI = global.yoho.ServiceAPI; | ||
10 | + | ||
11 | +// 资源位 | ||
12 | +const getPayCod = (contentCode) => { | ||
13 | + return serviceAPI.get('operations/api/v5/resource/get', { | ||
14 | + content_code: contentCode | ||
15 | + }).then((result) => { | ||
16 | + | ||
17 | + let resu = { | ||
18 | + banner: [] | ||
19 | + }; | ||
20 | + | ||
21 | + if (result && result.code === 200) { | ||
22 | + | ||
23 | + resu.banner = result.data; | ||
24 | + | ||
25 | + } else { | ||
26 | + logger.error('banner is not 200'); | ||
27 | + resu = {}; | ||
28 | + } | ||
29 | + | ||
30 | + return resu; | ||
31 | + }); | ||
32 | +}; | ||
33 | + | ||
34 | +module.exports = { | ||
35 | + getPayCod | ||
36 | +}; |
@@ -10,7 +10,9 @@ const express = require('express'); | @@ -10,7 +10,9 @@ const express = require('express'); | ||
10 | const router = express.Router(); | 10 | const router = express.Router(); |
11 | const cRoot = './controllers'; | 11 | const cRoot = './controllers'; |
12 | const countController = require(`${cRoot}/count`); | 12 | const countController = require(`${cRoot}/count`); |
13 | +const payController = require(`${cRoot}/pay`); | ||
13 | 14 | ||
14 | router.get('/index/count', countController.cartCount); | 15 | router.get('/index/count', countController.cartCount); |
16 | +router.get('/paySuccess/payCod', payController.payCod);// 支付成功,货到付款 | ||
15 | 17 | ||
16 | module.exports = router; | 18 | module.exports = router; |
apps/cart/views/action/pay/pay-cod.hbs
0 → 100644
1 | +<div class="pay-success"> | ||
2 | + <div class="top-tip"> | ||
3 | + <div class="img-c"></div> | ||
4 | + <p class="ok-tip">订单提交成功</p> | ||
5 | + <p class="left-tip">您需要在收货时向售货员支付¥69.00</p> | ||
6 | + </div> | ||
7 | + <div class="info-table-c"> | ||
8 | + <table class="info-table"> | ||
9 | + <tr> | ||
10 | + <td>订单编号</td> | ||
11 | + <td>123456789</td> | ||
12 | + </tr> | ||
13 | + <tr> | ||
14 | + <td>付款金额</td> | ||
15 | + <td>¥69.00</td> | ||
16 | + </tr> | ||
17 | + <tr> | ||
18 | + <td>付款方式</td> | ||
19 | + <td>货到付款</td> | ||
20 | + </tr> | ||
21 | + </table> | ||
22 | + </div> | ||
23 | + <div class="btn-c"> | ||
24 | + <a>随便逛逛</a> | ||
25 | + <a>查看订单</a> | ||
26 | + </div> | ||
27 | + {{# banner}} | ||
28 | + {{#data}} | ||
29 | + <a href="{{url}}" class="ad-pic" alt="{{alt}}"> | ||
30 | + <img src="{{image src 640 200}}" /> | ||
31 | + </a> | ||
32 | + {{/data}} | ||
33 | + {{/banner}} | ||
34 | + {{> home/maybe-like}} | ||
35 | +</div> | ||
36 | + |
public/img/cart/pay-ok.png
0 → 100644
6.22 KB
public/js/cart/pay.page.js
0 → 100644
1 | +var $ = require('yoho-jquery'), | ||
2 | + lazyLoad = require('yoho-jquery-lazyload'); | ||
3 | + | ||
4 | +require('../common'); | ||
5 | + | ||
6 | +lazyLoad($('img.lazy')); | ||
7 | + | ||
8 | +function getGender() { | ||
9 | + return window.cookie('_Channel') || 'boys'; | ||
10 | +} | ||
11 | + | ||
12 | +require('../channel/maybe-like')(getGender()); | ||
13 | + | ||
14 | +if ($('#goods-list').length === 0) { | ||
15 | + $('.maybe-like').hide(); | ||
16 | +} |
public/scss/cart/_pay-success.css
0 → 100644
1 | +.pay-success { | ||
2 | + width: 100%; | ||
3 | + overflow: hidden; | ||
4 | + position: relative; | ||
5 | + background-color: #f0f0f0; | ||
6 | + | ||
7 | + .top-tip { | ||
8 | + width: 100%; | ||
9 | + height: 240px; | ||
10 | + border-bottom: solid 1px #e0e0e0; | ||
11 | + text-align: center; | ||
12 | + background-color: #fff; | ||
13 | + | ||
14 | + .img-c { | ||
15 | + margin-top: 25px; | ||
16 | + width: 102px; | ||
17 | + height:102px; | ||
18 | + background: resolve('cart/pay-ok.png') no-repeat; | ||
19 | + background-size: 100% 100%; | ||
20 | + display: inline-block; | ||
21 | + } | ||
22 | + | ||
23 | + .ok-tip { | ||
24 | + font-size: 24px; | ||
25 | + color: #d0021b; | ||
26 | + line-height: 60px; | ||
27 | + } | ||
28 | + | ||
29 | + .left-tip { | ||
30 | + font-size: 19px; | ||
31 | + color: #b0b0b0; | ||
32 | + } | ||
33 | + } | ||
34 | + | ||
35 | + .info-table-c { | ||
36 | + height: 160px; | ||
37 | + border-bottom: solid 1px #e0e0e0; | ||
38 | + padding: 20px 25px; | ||
39 | + background-color: #fff; | ||
40 | + | ||
41 | + table { | ||
42 | + width: 100%; | ||
43 | + | ||
44 | + tr { | ||
45 | + height: 40px; | ||
46 | + } | ||
47 | + | ||
48 | + td { | ||
49 | + font-size: 24px; | ||
50 | + color: #444444; | ||
51 | + } | ||
52 | + | ||
53 | + td:nth-child(2) { | ||
54 | + text-align: right; | ||
55 | + } | ||
56 | + } | ||
57 | + } | ||
58 | + | ||
59 | + .btn-c { | ||
60 | + width: 100%; | ||
61 | + height: 102px; | ||
62 | + background-color: #fff; | ||
63 | + border-bottom: solid 1px #e0e0e0; | ||
64 | + padding: 0 25px; | ||
65 | + | ||
66 | + a { | ||
67 | + width: 270px; | ||
68 | + height: 53px; | ||
69 | + border: solid 2px #444; | ||
70 | + display: block; | ||
71 | + float: left; | ||
72 | + line-height: 53px; | ||
73 | + text-align: center; | ||
74 | + border-radius: 5px; | ||
75 | + box-sizing:border-box; | ||
76 | + -moz-box-sizing:border-box; | ||
77 | + margin-top: 24px; | ||
78 | + font-size: 24px; | ||
79 | + color: #444; | ||
80 | + } | ||
81 | + | ||
82 | + a:nth-child(2) { | ||
83 | + margin-left: 50px; | ||
84 | + } | ||
85 | + } | ||
86 | + | ||
87 | + .ad-pic { | ||
88 | + width: 100%; | ||
89 | + height: 200px; | ||
90 | + display: block; | ||
91 | + background-color: #fff; | ||
92 | + margin: 25px 0; | ||
93 | + } | ||
94 | +} |
-
Please register or login to post a comment