returns.js
1.28 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
/**
* 个人中心 退换货
* @author 陈轩 <xuan.chen@yoho.cn>
*/
'use strict';
const cookie = global.yoho.cookie;
const returnsModel = require('../models/returns');
/*
我的退换货-列表页
*/
const index = (req, res, next) => {
const uid = cookie.getUid(req);
const page = req.query.page;
returnsModel.getReturnsList(uid, page /* ,limit=10*/)
.then(data => {
const viewData = Object.assign({
module: 'home',
page: 'returns',
meReturnsPage: true
}, data);
res.render('returns/returns', viewData);
})
.catch(next);
};
/*
我的订单-退货申请页
*/
const refundApply = (req, res, next) => {
const orderCode = req.query.orderCode;
const uid = req.user.uid;
returnsModel.getOrderRefund(orderCode, uid).then(result => {
res.render('returns/returns-apply', result);
}).catch(next);
};
/*
我的订单-退货申请页
*/
const refundDetail = (req, res, next) => {
const code = req.query.id;
const uid = req.user.uid;
returnsModel.getRefundDetail(code, uid).then(result => {
res.render('returns/returns-detail', result);
}).catch(next);
};
module.exports = {
index,
refundApply,
refundDetail
};