exchange.js
1.16 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
/*
* 换货 controller
*/
'use strict';
const exchangeModel = require('../models/exchange');
const exchange = {
exchange(req, res) {
const view = {
module: 'home',
page: 'exchange'
};
res.render('exchange', view);
},
// 订单 可换货商品列表
order(req, res, next) {
const uid = req.user.uid || 8050882;
const orderId = req.query.orderId;
if (!orderId) {
return next();
}
exchangeModel.getOrderData(uid, orderId).then(result => {
res.json(result);
}).catch(next);
},
delivery(req, res, next) {
const uid = req.user.uid || 8050882;
const areaCode = req.query.areaCode;
if (!areaCode) {
return next();
}
exchangeModel.getDelivery(uid, areaCode).then(result => {
res.json(result);
}).catch(next);
},
// 提交 换货
submit(req, res, next) {
const uid = req.user.uid || 8050882;
exchangeModel.submitExchange(uid, req.body).then(result => {
res.json(result);
}).catch(next);
}
};
module.exports = exchange;