Authored by yyq

refund detail translate

... ... @@ -39,7 +39,20 @@ const refundApply = (req, res, next) => {
}).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
refundApply,
refundDetail
};
... ...
... ... @@ -7,6 +7,9 @@
const api = global.yoho.API;
/**
* 获取订单退货信息
*/
const getRefundGoodsAsync = (orderCode, uid) => {
return api.get('', {
method: 'app.refund.goodsList',
... ... @@ -15,6 +18,28 @@ const getRefundGoodsAsync = (orderCode, uid) => {
}, {code: 200});
};
/**
* 获取退货订单信息
*/
const getRefundDetailAsync = (id, uid) => {
return api.get('', {
method: 'app.refund.detail',
id: id,
uid: uid
}, {code: 200});
};
/**
* 快递公司列表
*/
const getExpressCompanyAsync = () => {
return api.get('', {
method: 'app.express.getExpressCompany'
}, {code: 200});
};
module.exports = {
getRefundGoodsAsync
getRefundGoodsAsync,
getRefundDetailAsync,
getExpressCompanyAsync
};
... ...
... ... @@ -26,13 +26,25 @@ const RETURNS_EMPTY = '您没有退/换货订单';
const REFUND_URI = '/home/returns/refundDetail';
const EXCHANGE_URI = '/home/returns/exchangeDetail';
// 处理退换货商品链接
const getProductUrlBySkc = (pid, gid, cnAlphabet) => {
cnAlphabet = cnAlphabet || 'cnalphabet';
return helpers.urlFormat(`/product/pro_${pid}_${gid}/${cnAlphabet}.html`,
{}, 'item');
};
const setDetailGoods = (list) => {
let resData = [];
_.forEach(list, value => {
resData.push({
name: value.product_name || '',
reason: value.reason_name
});
});
return resData;
};
// 处理订单商品的数据
... ... @@ -211,7 +223,63 @@ const getOrderRefund = (orderCode, uid) => {
return co(process)();
};
const getRefundDetail = (applyId, uid) => {
let process = function*() {
let resData = {};
let result = yield Promise.all([
returnAPI.getRefundDetailAsync(applyId, uid),
returnAPI.getExpressCompanyAsync()
]);
if (result[0].data) {
let data = result[0].data;
let detail = {
isChange: false,
returnId: applyId,
orderNum: data.source_order_code,
nowStatus: data.status_name,
applyTime: data.create_time,
payMode: data.source_payment_type_desc || '',
backMode: data.return_amount_mode_name || '',
goods: setDetailGoods(data.goods_list)
};
if (+data.status !== 0) {
detail.express = {
id: _.get(data, 'notice.express_id', ''),
company: _.get(data, 'notice.express_company', ''),
number: _.get(data, 'notice.express_number', '')
};
}
detail.statusList = [];
_.forEach(data.statusList, value => {
detail.statusList.push({
name: value.name,
act: value.act === 'Y'
});
});
if (data.canCancel === 'Y') {
detail.canCancelUrl = '/home/refund/cancel';
}
resData.detail = detail;
}
if (result[1].data && resData.detail) {
_.set(resData, 'detail.expressList', _.toArray(result[1].data));
}
return resData;
};
return co(process)();
};
module.exports = {
getReturnsList,
getOrderRefund
getOrderRefund,
getRefundDetail
};
... ...
{{> layout/header}}
<div class="detail-me-page me-page yoho-page clearfix">
{{# returns}}
{{> path}}
{{> navigation}}
... ... @@ -81,6 +79,4 @@
</div>
{{> help-us}}
</div>
{{/ returns}}
</div>
{{> layout/footer}}
... ...