Merge branch 'feature/my-order' into develop
Showing
7 changed files
with
57 additions
and
103 deletions
@@ -9,12 +9,12 @@ | @@ -9,12 +9,12 @@ | ||
9 | const mcHandler = require('../models/menu-crumb-handler'); | 9 | const mcHandler = require('../models/menu-crumb-handler'); |
10 | const orderModel = require('../models/order'); | 10 | const orderModel = require('../models/order'); |
11 | 11 | ||
12 | +// fakeuid = '10931021', | ||
12 | /** | 13 | /** |
13 | * 订单 | 14 | * 订单 |
14 | */ | 15 | */ |
15 | const index = (req, res) => { | 16 | const index = (req, res) => { |
16 | - const orderData = orderModel.getOrderData(); | ||
17 | - | 17 | + orderModel.getOrderData().then(result => { |
18 | res.render('index', { | 18 | res.render('index', { |
19 | page: 'order', | 19 | page: 'order', |
20 | isMe: true, | 20 | isMe: true, |
@@ -22,7 +22,8 @@ const index = (req, res) => { | @@ -22,7 +22,8 @@ const index = (req, res) => { | ||
22 | nav: mcHandler.getMeCrumb(), | 22 | nav: mcHandler.getMeCrumb(), |
23 | navigation: mcHandler.getSideMenu('我的订单'), | 23 | navigation: mcHandler.getSideMenu('我的订单'), |
24 | banner: 'http://placehold.it/{width}x{height}' | 24 | banner: 'http://placehold.it/{width}x{height}' |
25 | - }, orderData) | 25 | + }, result) |
26 | + }); | ||
26 | }); | 27 | }); |
27 | }; | 28 | }; |
28 | 29 |
1 | +const api = global.yoho.API; | ||
2 | +const camelCase = global.yoho.camelCase; | ||
3 | + | ||
4 | +const _getUserOrder = () => { | ||
5 | + return api.get('', { | ||
6 | + method: 'app.SpaceOrders.get', | ||
7 | + uid: '10931021', | ||
8 | + type: 1, | ||
9 | + page: 1, | ||
10 | + limit: 10 | ||
11 | + }).then(result => { | ||
12 | + const orderList = result && result.data && result.data.order_list || []; | ||
13 | + | ||
14 | + return camelCase(orderList); | ||
15 | + }); | ||
16 | +}; | ||
17 | + | ||
1 | const getOrderData = () => { | 18 | const getOrderData = () => { |
2 | - return { | ||
3 | - order: { | 19 | + return _getUserOrder().then(result => { |
20 | + const fakeData = { | ||
4 | title: '我的订单', | 21 | title: '我的订单', |
5 | tabs: [ | 22 | tabs: [ |
6 | { | 23 | { |
@@ -17,85 +34,17 @@ const getOrderData = () => { | @@ -17,85 +34,17 @@ const getOrderData = () => { | ||
17 | type: 'delivering' | 34 | type: 'delivering' |
18 | } | 35 | } |
19 | ], | 36 | ], |
20 | - showSearch: true, | ||
21 | - orders: [ | ||
22 | - { | ||
23 | - orderTime: '2016-07-10 12:30:11', | ||
24 | - validLeftTime: '1时35分', | ||
25 | - serialNumber: '887625272', | ||
26 | - showMobile: true, | ||
27 | - cost: '1200.00', | ||
28 | - status: '待付款', | ||
29 | - showPayButton: true, | ||
30 | - showEditOption: true, | ||
31 | - payVia: '在线支付', | ||
32 | - goods: [ | ||
33 | - { | ||
34 | - img: '//placehold.it/{width}x{height}', | ||
35 | - name: '一件非常非常潮的衣服,因为刚从洗衣机里拿出来', | ||
36 | - price: '32000.00', | ||
37 | - color: '雪白', | ||
38 | - size: '39码', | ||
39 | - quantity: 5 | ||
40 | - } | ||
41 | - ] | ||
42 | - }, | ||
43 | - { | ||
44 | - orderTime: '2016-07-10 12:30:11', | ||
45 | - serialNumber: '887625272', | ||
46 | - showMobile: true, | ||
47 | - cost: '1200.00', | ||
48 | - status: '交易完成', | ||
49 | - payVia: '在线支付', | ||
50 | - goods: [ | ||
51 | - { | ||
52 | - img: '//placehold.it/{width}x{height}', | ||
53 | - name: '一件非常非常潮的衣服,因为刚从洗衣机里拿出来', | ||
54 | - price: '32000.00', | ||
55 | - color: '雪白', | ||
56 | - size: '39码', | ||
57 | - quantity: 5 | ||
58 | - } | ||
59 | - ] | ||
60 | - }, | ||
61 | - { | ||
62 | - showEditOption: true, | ||
63 | - orderTime: '2016-07-10 12:30:11', | ||
64 | - serialNumber: '887625272', | ||
65 | - showMobile: true, | ||
66 | - cost: '1200.00', | ||
67 | - status: '备货中', | ||
68 | - payVia: '在线支付', | ||
69 | - goods: [ | ||
70 | - { | ||
71 | - img: '//placehold.it/{width}x{height}', | ||
72 | - name: '一件非常非常潮的衣服,因为刚从洗衣机里拿出来', | ||
73 | - price: '32000.00', | ||
74 | - color: '雪白', | ||
75 | - size: '39码', | ||
76 | - quantity: 5 | ||
77 | - }, | ||
78 | - { | ||
79 | - img: '//placehold.it/{width}x{height}', | ||
80 | - name: '一件非常非常潮的衣服,因为刚从洗衣机里拿出来', | ||
81 | - price: '32000.00', | ||
82 | - color: '雪白', | ||
83 | - size: '39码', | ||
84 | - quantity: 5 | ||
85 | - }, | ||
86 | - { | ||
87 | - img: '//placehold.it/{width}x{height}', | ||
88 | - name: '一件非常非常潮的衣服,因为刚从洗衣机里拿出来', | ||
89 | - price: '32000.00', | ||
90 | - color: '雪白', | ||
91 | - size: '39码', | ||
92 | - quantity: 5 | ||
93 | - } | ||
94 | - ] | ||
95 | - } | ||
96 | - ] | ||
97 | - } | 37 | + showSearch: true |
38 | + }; | ||
39 | + | ||
40 | + const order = Object.assign(fakeData, { | ||
41 | + orderList: result | ||
42 | + }); | ||
43 | + | ||
44 | + return { | ||
45 | + order: order | ||
98 | }; | 46 | }; |
47 | + }); | ||
99 | }; | 48 | }; |
100 | 49 | ||
101 | module.exports = { | 50 | module.exports = { |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | {{> common/subtitle}} | 3 | {{> common/subtitle}} |
4 | {{> order/nav}} | 4 | {{> order/nav}} |
5 | {{> order/table-header}} | 5 | {{> order/table-header}} |
6 | - {{#if orders}} | 6 | + {{#if orderList}} |
7 | {{> order/table-body}} | 7 | {{> order/table-body}} |
8 | {{/if}} | 8 | {{/if}} |
9 | {{/order}} | 9 | {{/order}} |
1 | -{{#orders}} | 1 | +{{#orderList}} |
2 | <div class="table"> | 2 | <div class="table"> |
3 | <ul class="header"> | 3 | <ul class="header"> |
4 | - <li class="content">下单时间:{{orderTime}}</li> | ||
5 | - <li class="content">订单编号:{{serialNumber}}</li> | 4 | + <li class="content">下单时间:{{createTime}}</li> |
5 | + <li class="content">订单编号:{{orderCode}}</li> | ||
6 | {{#if showMobile}} | 6 | {{#if showMobile}} |
7 | <li class="content">手机订单</li> | 7 | <li class="content">手机订单</li> |
8 | {{/if}} | 8 | {{/if}} |
9 | </ul> | 9 | </ul> |
10 | <div class="table-body"> | 10 | <div class="table-body"> |
11 | <div class="goods-container special-border"> | 11 | <div class="goods-container special-border"> |
12 | - {{#goods}} | 12 | + {{#orderGoods}} |
13 | <div class="good-info {{#if @last}}last{{/if}}"> | 13 | <div class="good-info {{#if @last}}last{{/if}}"> |
14 | - <img src="{{image img 65 90}}"> | 14 | + <img src="{{image goodsImage 65 90}}"> |
15 | <div class="detail"> | 15 | <div class="detail"> |
16 | - <p class="with-bottom-space">{{name}}</p> | ||
17 | - <span class="with-space">颜色:{{color}}</span> | 16 | + <p class="with-bottom-space">{{productName}}</p> |
17 | + <span class="with-space">颜色:{{colorName}}</span> | ||
18 | <span>尺码: | 18 | <span>尺码: |
19 | - <span class="bold">{{size}}</span> | 19 | + <span class="bold">{{sizeName}}</span> |
20 | </span> | 20 | </span> |
21 | - <p class="bold">{{> icon/error-round}}{{quantity}}</p> | 21 | + <p class="bold">{{> icon/error-round}}{{buyNumber}}</p> |
22 | 22 | ||
23 | </div> | 23 | </div> |
24 | </div> | 24 | </div> |
25 | <div class="price bold"> | 25 | <div class="price bold"> |
26 | - <p>{{price}}</p> | 26 | + <p>{{goodsAmount}}</p> |
27 | </div> | 27 | </div> |
28 | - {{/goods}} | 28 | + {{/orderGoods}} |
29 | </div> | 29 | </div> |
30 | <div class="common-column special-border"> | 30 | <div class="common-column special-border"> |
31 | - <p class="bold">{{cost}}</p> | ||
32 | - <p class="subtext">{{payVia}}</p> | 31 | + <p class="bold">{{amount}}</p> |
32 | + <p class="subtext">{{paymentTypeStr}}</p> | ||
33 | </div> | 33 | </div> |
34 | <div class="common-column special-border"> | 34 | <div class="common-column special-border"> |
35 | - <p>{{status}}</p> | 35 | + <p>{{statusStr}}</p> |
36 | <p class="subtext">查看详情</p> | 36 | <p class="subtext">查看详情</p> |
37 | </div> | 37 | </div> |
38 | <div class="common-column special-border"> | 38 | <div class="common-column special-border"> |
39 | - {{#if validLeftTime}} | ||
40 | - <p class="left-time">剩余{{validLeftTime}}</p> | 39 | + {{#if payLeftTime}} |
40 | + <p class="left-time">剩余{{payLeftTime}}</p> | ||
41 | {{/if}} | 41 | {{/if}} |
42 | {{#if showPayButton}} | 42 | {{#if showPayButton}} |
43 | <button>立即付款</button> | 43 | <button>立即付款</button> |
@@ -51,4 +51,4 @@ | @@ -51,4 +51,4 @@ | ||
51 | </div> | 51 | </div> |
52 | </div> | 52 | </div> |
53 | </div> | 53 | </div> |
54 | -{{/orders}} | 54 | +{{/orderList}} |
@@ -19,7 +19,9 @@ module.exports = { | @@ -19,7 +19,9 @@ module.exports = { | ||
19 | }, | 19 | }, |
20 | cookieDomain: 'yohoblk.com', | 20 | cookieDomain: 'yohoblk.com', |
21 | domains: { | 21 | domains: { |
22 | - api: 'http://api.yoho.yohoops.org/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078 | 22 | + // api: 'http://api.yoho.yohoops.org/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078 |
23 | + // api: 'http://testapi.yoho.cn:28078/', | ||
24 | + api: 'http://api.yoho.yohoops.org/', | ||
23 | service: 'http://devservice.yoho.cn:28077/', // testservice.yoho.cn:28077 devservice.yoho.cn:58077 | 25 | service: 'http://devservice.yoho.cn:28077/', // testservice.yoho.cn:28077 devservice.yoho.cn:58077 |
24 | search: 'http://192.168.102.216:8080/yohosearch/' | 26 | search: 'http://192.168.102.216:8080/yohosearch/' |
25 | }, | 27 | }, |
@@ -24,6 +24,8 @@ order: { | @@ -24,6 +24,8 @@ order: { | ||
24 | cost: '', // 订单花费 | 24 | cost: '', // 订单花费 |
25 | status: '', // 订单状态 | 25 | status: '', // 订单状态 |
26 | payVia: '', // 支付方式 | 26 | payVia: '', // 支付方式 |
27 | + showPayButton: true/false, // 是否显示立即付款按钮 | ||
28 | + showEditOption: true/false // 是否显示编辑项 | ||
27 | 29 | ||
28 | // 订单中的商品 | 30 | // 订单中的商品 |
29 | goods: [ | 31 | goods: [ |
-
Please register or login to post a comment