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}}
{{> path}}
{{> navigation}}
{{> navigation}}
<div class="me-main">
<div class="returns-detail block{{#if detail.isChange}} exchange-detail{{/if}}">
<h2 class="title"></h2>
{{# detail}}
<div class="order-info">
订单编号:{{orderNum}}
<span>当前状态:{{nowStatus}}</span>
申请时间:{{applyTime}}
</div>
<div class="visual-return-state">
<ul>
{{# statusList}}
<li class="{{#if act}}act{{/if}}">{{name}}</li>
{{/ statusList}}
</ul>
</div>
<div class="detail-container">
{{# express}}
<h2>请填写寄回快递单号,以便我们查询</h2>
<div class="courier-code{{#unless id}} in-edit{{/unless}}">
<div class="me-main">
<div class="returns-detail block{{#if detail.isChange}} exchange-detail{{/if}}">
<h2 class="title"></h2>
{{# detail}}
<div class="order-info">
订单编号:{{orderNum}}
<span>当前状态:{{nowStatus}}</span>
申请时间:{{applyTime}}
</div>
<div class="visual-return-state">
<ul>
{{# statusList}}
<li class="{{#if act}}act{{/if}}">{{name}}</li>
{{/ statusList}}
</ul>
</div>
<div class="detail-container">
{{# express}}
<h2>请填写寄回快递单号,以便我们查询</h2>
<div class="courier-code{{#unless id}} in-edit{{/unless}}">
{{#with detail}}
<ul style="display: none;">
{{# expressList}}
<li class="company-list" data-id="{{id}}" data-name="{{company_name}}"></li>
{{/ expressList}}
</ul>
{{/with}}
<p class="express-edit-box">
<input type="hidden" id="express-old-id" value="{{id}}">
{{#with detail}}
<ul style="display: none;">
<select id="express-company">
<option value="0">选择快递公司</option>
{{# expressList}}
<li class="company-list" data-id="{{id}}" data-name="{{company_name}}"></li>
<option value="{{id}}" selected="">{{company_name}}</option>
{{/ expressList}}
</ul>
</select>
{{/with}}
<p class="express-edit-box">
<input type="hidden" id="express-old-id" value="{{id}}">
{{#with detail}}
<select id="express-company">
<option value="0">选择快递公司</option>
{{# expressList}}
<option value="{{id}}" selected="">{{company_name}}</option>
{{/ expressList}}
</select>
{{/with}}
<input type="text" id="express-number" value="{{number}}" placeholder="请填写快递单号">
<input type="hidden" id="return-id" value="{{returnId}}">
<button type="button" id="submit-btn">确定</button>
</p>
<p class="express-view-box">
<span>{{company}} 快递单号:{{number}}</span>&nbsp;&nbsp;&nbsp;&nbsp;
<button type="button" id="modify">修改</button>
</p>
</div>
{{/ express}}
<h2>详细信息</h2>
<div class="main-detail">
<table>
{{# goods}}
<tr>
<td width="50%">商品名称:&nbsp;&nbsp;&nbsp;&nbsp; {{name}}</td>
<td>
<span class="word-t">退</span><span class="word-h">换</span>货原因:{{reason}}
</td>
</tr>
{{/ goods}}
{{#unless isChange}}
<tr>
<td colspan="2">支付方式:&nbsp;&nbsp;&nbsp;&nbsp;{{payMode}}</td>
</tr>
<tr>
<td colspan="2">退款方式:&nbsp;&nbsp;&nbsp;&nbsp;{{backMode}}</td>
</tr>
{{/unless}}
</table>
<div class="refund-tips">
<span>注:请于完成后的2个工作日查询您的退款账户,以确认退款到账</span>
</div>
<input type="text" id="express-number" value="{{number}}" placeholder="请填写快递单号">
<input type="hidden" id="return-id" value="{{returnId}}">
<button type="button" id="submit-btn">确定</button>
</p>
<p class="express-view-box">
<span>{{company}} 快递单号:{{number}}</span>&nbsp;&nbsp;&nbsp;&nbsp;
<button type="button" id="modify">修改</button>
</p>
</div>
{{/ express}}
<h2>详细信息</h2>
<div class="main-detail">
<table>
{{# goods}}
<tr>
<td width="50%">商品名称:&nbsp;&nbsp;&nbsp;&nbsp; {{name}}</td>
<td>
<span class="word-t">退</span><span class="word-h"></span>货原因:{{reason}}
</td>
</tr>
{{/ goods}}
{{#unless isChange}}
<tr>
<td colspan="2">支付方式:&nbsp;&nbsp;&nbsp;&nbsp;{{payMode}}</td>
</tr>
<tr>
<td colspan="2">退款方式:&nbsp;&nbsp;&nbsp;&nbsp;{{backMode}}</td>
</tr>
{{/unless}}
</table>
<div class="refund-tips">
<span>注:请于完成后的2个工作日查询您的退款账户,以确认退款到账</span>
</div>
</div>
{{/ detail}}
</div>
{{> help-us}}
</div>
{{/ detail}}
</div>
{{/ returns}}
{{> help-us}}
</div>
</div>
{{> layout/footer}}
... ...