...
|
...
|
@@ -12,10 +12,10 @@ const orderModel = require('../models/order'); |
|
|
/**
|
|
|
* 我的订单
|
|
|
*/
|
|
|
const index = (req, res, next) => {
|
|
|
const index = (req, res) => {
|
|
|
const type = req.query.type;
|
|
|
const page = req.query.page;
|
|
|
const uid = global.yoho.uid || '7394907';
|
|
|
const uid = req.user.uid || '13549567';
|
|
|
|
|
|
orderModel.getOrderData(uid, type, page).then(result => {
|
|
|
res.display('index', {
|
...
|
...
|
@@ -27,12 +27,12 @@ const index = (req, res, next) => { |
|
|
banner: 'http://placehold.it/{width}x{height}'
|
|
|
}, result)
|
|
|
});
|
|
|
}).catch(next);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const detail = (req, res, next) => {
|
|
|
const detail = (req, res) => {
|
|
|
const code = req.query.code;
|
|
|
const uid = global.yoho.uid || '7394907';
|
|
|
const uid = req.user.uid || '7394907';
|
|
|
|
|
|
orderModel.getOrderDetail(uid, code).then(result => {
|
|
|
res.display('index', {
|
...
|
...
|
@@ -44,13 +44,13 @@ const detail = (req, res, next) => { |
|
|
banner: 'http://placehold.it/{width}x{height}'
|
|
|
}, result)
|
|
|
});
|
|
|
}).catch(next);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getOrderList = (req, res, next) => {
|
|
|
const getOrderList = (req, res) => {
|
|
|
const type = req.query.type;
|
|
|
const page = req.query.page;
|
|
|
const uid = global.yoho.uid || '7394907';
|
|
|
const uid = req.user.uid || '7394907';
|
|
|
|
|
|
orderModel.getOrderData(uid, type, page).then(result => {
|
|
|
res.display('order-table', {
|
...
|
...
|
@@ -58,16 +58,14 @@ const getOrderList = (req, res, next) => { |
|
|
page: 'order',
|
|
|
isMe: true,
|
|
|
orderList: result.order.orderList,
|
|
|
paginationOpts: result.order.paginationOpts,
|
|
|
emptyMsg: result.order.emptyMsg,
|
|
|
showEmptyEn: result.order.showEmptyEn
|
|
|
paginationOpts: result.order.paginationOpts
|
|
|
});
|
|
|
}).catch(next);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getOrderTotal = (req, res, next) => {
|
|
|
const getOrderTotal = (req, res) => {
|
|
|
const type = req.query.type;
|
|
|
const uid = global.yoho.uid || '7394907';
|
|
|
const uid = req.user.uid || '7394907';
|
|
|
|
|
|
|
|
|
orderModel.getOrderData(uid, type).then(result => {
|
...
|
...
|
@@ -76,44 +74,44 @@ const getOrderTotal = (req, res, next) => { |
|
|
total: result.order.total,
|
|
|
type: result.order.type
|
|
|
});
|
|
|
}).catch(next);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const cancelOrder = (req, res, next) => {
|
|
|
const uid = global.yoho.uid || '7394907';
|
|
|
const data = req.query;
|
|
|
const cancelOrder = (req, res) => {
|
|
|
const uid = req.user.uid || '7394907';
|
|
|
const code = req.query.orderCode;
|
|
|
|
|
|
orderModel.cancelOrder(uid, data).then(result => {
|
|
|
orderModel.cancelOrder(uid, code).then(result => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const deleteOrder = (req, res, next) => {
|
|
|
const uid = global.yoho.uid || '7394907';
|
|
|
const deleteOrder = (req, res) => {
|
|
|
const uid = req.user.uid || '7394907';
|
|
|
const code = req.query.orderCode;
|
|
|
|
|
|
orderModel.deleteOrder(uid, code).then(result => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getExpressInfo = (req, res, next) => {
|
|
|
const uid = global.yoho.uid || '7394907';
|
|
|
const getExpressInfo = (req, res) => {
|
|
|
const uid = req.user.uid || '7394907';
|
|
|
const code = req.query.orderCode;
|
|
|
|
|
|
orderModel.getExpressInfo(uid, code).then(result => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getCancelOrderReason = (req, res, next) => {
|
|
|
const getCancelOrderReason = (req, res) => {
|
|
|
orderModel.getCancelOrderReason().then(result => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const editOrder = (req, res) => {
|
|
|
const uid = global.yoho.uid || '7394907';
|
|
|
const uid = req.user.uid || '7394907';
|
|
|
const query = req.query;
|
|
|
|
|
|
query.uid = uid;
|
...
|
...
|
@@ -123,16 +121,6 @@ const editOrder = (req, res) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
const reAddCart = (req, res) => {
|
|
|
const uid = global.yoho.uid || '7394907';
|
|
|
const code = req.query.orderCode;
|
|
|
|
|
|
orderModel.reAddCart(uid, code).then(result => {
|
|
|
res.json(result);
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
index: index,
|
|
|
detail: detail,
|
...
|
...
|
@@ -142,6 +130,5 @@ module.exports = { |
|
|
deleteOrder: deleteOrder,
|
|
|
editOrder: editOrder,
|
|
|
getExpressInfo: getExpressInfo,
|
|
|
getCancelOrderReason: getCancelOrderReason,
|
|
|
reAddCart: reAddCart
|
|
|
getCancelOrderReason: getCancelOrderReason
|
|
|
}; |
...
|
...
|
|