order.js
1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* [个人中心]首页/我的订单
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2016/07/04
*/
'use strict';
const mcHandler = require('../models/menu-crumb-handler');
const orderModel = require('../models/order');
/**
* 我的订单
*/
const index = (req, res) => {
const type = req.query.type;
const page = req.query.page;
orderModel.getOrderData(type, page).then(result => {
res.render('index', {
page: 'order',
isMe: true,
content: Object.assign({
nav: mcHandler.getMeCrumb(),
navigation: mcHandler.getSideMenu('我的订单'),
banner: 'http://placehold.it/{width}x{height}'
}, result)
});
});
};
const getOrderList = (req, res) => {
const type = req.query.type;
const page = req.query.page;
orderModel.getOrderData(type, page).then(result => {
res.render('order-table', {
layout: false,
page: 'order',
isMe: true,
orderList: result.order.orderList,
paginationOpts: result.order.paginationOpts
});
});
};
const getOrderTotal = (req, res) => {
const type = req.query.type;
orderModel.getOrderData(type).then(result => {
res.json({
total: result.order.total,
type: result.order.type
});
});
};
module.exports = {
index: index,
getOrderList: getOrderList,
getOrderTotal: getOrderTotal
};