Authored by yyq

个人中心订单退换货路由统一

... ... @@ -34,7 +34,7 @@ const index = (req, res) => {
};
const detail = (req, res) => {
const code = req.query.code;
const code = req.query.orderCode;
const uid = req.user.uid;
Promise.all([orderModel.getOrderDetail(uid, code), mcHandler.getMeThumb()]).then(result => {
... ...
... ... @@ -34,7 +34,7 @@ const index = (req, res, next) => {
*/
const refund = (req, res, next) => {
let uid = req.user.uid;
let code = parseInt(req.params.orderCode, 10);
let code = parseInt(req.query.orderCode, 10);
if (!uid || !code) {
return next();
... ... @@ -75,7 +75,7 @@ const refundApply = (req, res, next) => {
* 退货详情页
*/
const refundDetail = (req, res, next) => {
let applyId = parseInt(req.params.applyId, 10),
let applyId = parseInt(req.query.orderCode, 10),
uid = req.user.uid;
if (!uid || !applyId) {
... ... @@ -94,7 +94,7 @@ const refundDetail = (req, res, next) => {
* 换货申请页
*/
const exchange = (req, res, next) => {
const code = req.params.orderCode;
const code = parseInt(req.query.orderCode, 10);
const uid = req.user.uid;
returns.getChangeGoodsList(code, uid).then(result => {
... ... @@ -130,7 +130,7 @@ const getProductInfo = (req, res, next) => {
* 换货详情页
*/
const exchangeDeatail = (req, res) => {
let id = parseInt(req.params.applyId, 10),
let id = parseInt(req.query.orderCode, 10),
uid = req.user.uid;
returns.getExchangeDetailData(id, uid).then(result => {
... ...
... ... @@ -320,10 +320,14 @@ const _getUserOrder = (uid, type, page) => {
code: item.orderCode
});
item.refundUrl = helpers.urlFormat('/me/return/refund/' + item.orderCode);
item.exchangeUrl = helpers.urlFormat('/me/return/exchange/' + item.orderCode);
item.refundUrl = helpers.urlFormat('/me/return/refund/', {
orderCode: item.orderCode
});
item.exchangeUrl = helpers.urlFormat('/me/return/exchange/', {
orderCode: item.orderCode
});
item.detailUrl = helpers.urlFormat('/me/order/detail/', {
code: item.orderCode
orderCode: item.orderCode
});
});
... ...
... ... @@ -80,7 +80,9 @@ const getUserReturn = (uid, page) => {
item.hidePrice = true;
item.showStatus = true;
item.refundStr = refundStr[item.refundType];
item.detailUrl = helpers.urlFormat(urlIndex[item.refundType] + item.id);
item.detailUrl = helpers.urlFormat(urlIndex[item.refundType], {
orderCode: item.id
});
item.type = typeIndex[item.refundType];
item.orderGoods.forEach(good => {
... ... @@ -485,7 +487,7 @@ const saveRefund = (orderCode, uid, goods, payment) => {
return {
code: 200,
data: {
refer: `/me/return/refund/detail/${subRes.data.apply_id}`
refer: `/me/return/refund/detail?orderCode=${subRes.data.apply_id}`
}
};
}
... ...
... ... @@ -35,10 +35,10 @@ router.get('/confirmReceive', order.confirmReceive);
// 退换货
router.get('/return', returns.index);
router.get('/return/refund/:orderCode', returns.refund);
router.get('/return/exchange/:orderCode', returns.exchange);
router.get('/return/refund/detail/:applyId', returns.refundDetail);
router.get('/return/exchange/detail/:applyId', returns.exchangeDeatail);
router.get('/return/refund', returns.refund);
router.get('/return/exchange', returns.exchange);
router.get('/return/refund/detail', returns.refundDetail);
router.get('/return/exchange/detail', returns.exchangeDeatail);
router.post('/return/refund/apply', returns.refundApply);
router.post('/return/cancel', returns.cancelApply);
router.post('/return/setEepress', returns.setEepress);
... ...