refund detail translate
Showing
4 changed files
with
181 additions
and
79 deletions
@@ -39,7 +39,20 @@ const refundApply = (req, res, next) => { | @@ -39,7 +39,20 @@ const refundApply = (req, res, next) => { | ||
39 | }).catch(next); | 39 | }).catch(next); |
40 | }; | 40 | }; |
41 | 41 | ||
42 | +/* | ||
43 | + 我的订单-退货申请页 | ||
44 | + */ | ||
45 | +const refundDetail = (req, res, next) => { | ||
46 | + const code = req.query.id; | ||
47 | + const uid = req.user.uid; | ||
48 | + | ||
49 | + returnsModel.getRefundDetail(code, uid).then(result => { | ||
50 | + res.render('returns/returns-detail', result); | ||
51 | + }).catch(next); | ||
52 | +}; | ||
53 | + | ||
42 | module.exports = { | 54 | module.exports = { |
43 | index, | 55 | index, |
44 | - refundApply | 56 | + refundApply, |
57 | + refundDetail | ||
45 | }; | 58 | }; |
@@ -7,6 +7,9 @@ | @@ -7,6 +7,9 @@ | ||
7 | 7 | ||
8 | const api = global.yoho.API; | 8 | const api = global.yoho.API; |
9 | 9 | ||
10 | +/** | ||
11 | + * 获取订单退货信息 | ||
12 | + */ | ||
10 | const getRefundGoodsAsync = (orderCode, uid) => { | 13 | const getRefundGoodsAsync = (orderCode, uid) => { |
11 | return api.get('', { | 14 | return api.get('', { |
12 | method: 'app.refund.goodsList', | 15 | method: 'app.refund.goodsList', |
@@ -15,6 +18,28 @@ const getRefundGoodsAsync = (orderCode, uid) => { | @@ -15,6 +18,28 @@ const getRefundGoodsAsync = (orderCode, uid) => { | ||
15 | }, {code: 200}); | 18 | }, {code: 200}); |
16 | }; | 19 | }; |
17 | 20 | ||
21 | +/** | ||
22 | + * 获取退货订单信息 | ||
23 | + */ | ||
24 | +const getRefundDetailAsync = (id, uid) => { | ||
25 | + return api.get('', { | ||
26 | + method: 'app.refund.detail', | ||
27 | + id: id, | ||
28 | + uid: uid | ||
29 | + }, {code: 200}); | ||
30 | +}; | ||
31 | + | ||
32 | +/** | ||
33 | + * 快递公司列表 | ||
34 | + */ | ||
35 | +const getExpressCompanyAsync = () => { | ||
36 | + return api.get('', { | ||
37 | + method: 'app.express.getExpressCompany' | ||
38 | + }, {code: 200}); | ||
39 | +}; | ||
40 | + | ||
18 | module.exports = { | 41 | module.exports = { |
19 | - getRefundGoodsAsync | 42 | + getRefundGoodsAsync, |
43 | + getRefundDetailAsync, | ||
44 | + getExpressCompanyAsync | ||
20 | }; | 45 | }; |
@@ -26,13 +26,25 @@ const RETURNS_EMPTY = '您没有退/换货订单'; | @@ -26,13 +26,25 @@ const RETURNS_EMPTY = '您没有退/换货订单'; | ||
26 | const REFUND_URI = '/home/returns/refundDetail'; | 26 | const REFUND_URI = '/home/returns/refundDetail'; |
27 | const EXCHANGE_URI = '/home/returns/exchangeDetail'; | 27 | const EXCHANGE_URI = '/home/returns/exchangeDetail'; |
28 | 28 | ||
29 | - | 29 | +// 处理退换货商品链接 |
30 | const getProductUrlBySkc = (pid, gid, cnAlphabet) => { | 30 | const getProductUrlBySkc = (pid, gid, cnAlphabet) => { |
31 | cnAlphabet = cnAlphabet || 'cnalphabet'; | 31 | cnAlphabet = cnAlphabet || 'cnalphabet'; |
32 | 32 | ||
33 | return helpers.urlFormat(`/product/pro_${pid}_${gid}/${cnAlphabet}.html`, | 33 | return helpers.urlFormat(`/product/pro_${pid}_${gid}/${cnAlphabet}.html`, |
34 | {}, 'item'); | 34 | {}, 'item'); |
35 | +}; | ||
35 | 36 | ||
37 | +const setDetailGoods = (list) => { | ||
38 | + let resData = []; | ||
39 | + | ||
40 | + _.forEach(list, value => { | ||
41 | + resData.push({ | ||
42 | + name: value.product_name || '', | ||
43 | + reason: value.reason_name | ||
44 | + }); | ||
45 | + }); | ||
46 | + | ||
47 | + return resData; | ||
36 | }; | 48 | }; |
37 | 49 | ||
38 | // 处理订单商品的数据 | 50 | // 处理订单商品的数据 |
@@ -211,7 +223,63 @@ const getOrderRefund = (orderCode, uid) => { | @@ -211,7 +223,63 @@ const getOrderRefund = (orderCode, uid) => { | ||
211 | return co(process)(); | 223 | return co(process)(); |
212 | }; | 224 | }; |
213 | 225 | ||
226 | +const getRefundDetail = (applyId, uid) => { | ||
227 | + let process = function*() { | ||
228 | + let resData = {}; | ||
229 | + let result = yield Promise.all([ | ||
230 | + returnAPI.getRefundDetailAsync(applyId, uid), | ||
231 | + returnAPI.getExpressCompanyAsync() | ||
232 | + ]); | ||
233 | + | ||
234 | + if (result[0].data) { | ||
235 | + let data = result[0].data; | ||
236 | + let detail = { | ||
237 | + isChange: false, | ||
238 | + returnId: applyId, | ||
239 | + orderNum: data.source_order_code, | ||
240 | + nowStatus: data.status_name, | ||
241 | + applyTime: data.create_time, | ||
242 | + payMode: data.source_payment_type_desc || '', | ||
243 | + backMode: data.return_amount_mode_name || '', | ||
244 | + goods: setDetailGoods(data.goods_list) | ||
245 | + }; | ||
246 | + | ||
247 | + if (+data.status !== 0) { | ||
248 | + detail.express = { | ||
249 | + id: _.get(data, 'notice.express_id', ''), | ||
250 | + company: _.get(data, 'notice.express_company', ''), | ||
251 | + number: _.get(data, 'notice.express_number', '') | ||
252 | + }; | ||
253 | + } | ||
254 | + | ||
255 | + detail.statusList = []; | ||
256 | + _.forEach(data.statusList, value => { | ||
257 | + detail.statusList.push({ | ||
258 | + name: value.name, | ||
259 | + act: value.act === 'Y' | ||
260 | + }); | ||
261 | + }); | ||
262 | + | ||
263 | + if (data.canCancel === 'Y') { | ||
264 | + detail.canCancelUrl = '/home/refund/cancel'; | ||
265 | + } | ||
266 | + | ||
267 | + resData.detail = detail; | ||
268 | + | ||
269 | + } | ||
270 | + | ||
271 | + if (result[1].data && resData.detail) { | ||
272 | + _.set(resData, 'detail.expressList', _.toArray(result[1].data)); | ||
273 | + } | ||
274 | + | ||
275 | + return resData; | ||
276 | + }; | ||
277 | + | ||
278 | + return co(process)(); | ||
279 | +}; | ||
280 | + | ||
214 | module.exports = { | 281 | module.exports = { |
215 | getReturnsList, | 282 | getReturnsList, |
216 | - getOrderRefund | 283 | + getOrderRefund, |
284 | + getRefundDetail | ||
217 | }; | 285 | }; |
1 | -{{> layout/header}} | ||
2 | <div class="detail-me-page me-page yoho-page clearfix"> | 1 | <div class="detail-me-page me-page yoho-page clearfix"> |
3 | - {{# returns}} | ||
4 | - {{> path}} | 2 | + {{> path}} |
5 | 3 | ||
6 | - {{> navigation}} | 4 | + {{> navigation}} |
7 | 5 | ||
8 | - <div class="me-main"> | ||
9 | - <div class="returns-detail block{{#if detail.isChange}} exchange-detail{{/if}}"> | ||
10 | - <h2 class="title"></h2> | ||
11 | - {{# detail}} | ||
12 | - <div class="order-info"> | ||
13 | - 订单编号:{{orderNum}} | ||
14 | - <span>当前状态:{{nowStatus}}</span> | ||
15 | - 申请时间:{{applyTime}} | ||
16 | - </div> | ||
17 | - <div class="visual-return-state"> | ||
18 | - <ul> | ||
19 | - {{# statusList}} | ||
20 | - <li class="{{#if act}}act{{/if}}">{{name}}</li> | ||
21 | - {{/ statusList}} | ||
22 | - </ul> | ||
23 | - </div> | ||
24 | - <div class="detail-container"> | ||
25 | - {{# express}} | ||
26 | - <h2>请填写寄回快递单号,以便我们查询</h2> | ||
27 | - <div class="courier-code{{#unless id}} in-edit{{/unless}}"> | 6 | + <div class="me-main"> |
7 | + <div class="returns-detail block{{#if detail.isChange}} exchange-detail{{/if}}"> | ||
8 | + <h2 class="title"></h2> | ||
9 | + {{# detail}} | ||
10 | + <div class="order-info"> | ||
11 | + 订单编号:{{orderNum}} | ||
12 | + <span>当前状态:{{nowStatus}}</span> | ||
13 | + 申请时间:{{applyTime}} | ||
14 | + </div> | ||
15 | + <div class="visual-return-state"> | ||
16 | + <ul> | ||
17 | + {{# statusList}} | ||
18 | + <li class="{{#if act}}act{{/if}}">{{name}}</li> | ||
19 | + {{/ statusList}} | ||
20 | + </ul> | ||
21 | + </div> | ||
22 | + <div class="detail-container"> | ||
23 | + {{# express}} | ||
24 | + <h2>请填写寄回快递单号,以便我们查询</h2> | ||
25 | + <div class="courier-code{{#unless id}} in-edit{{/unless}}"> | ||
26 | + {{#with detail}} | ||
27 | + <ul style="display: none;"> | ||
28 | + {{# expressList}} | ||
29 | + <li class="company-list" data-id="{{id}}" data-name="{{company_name}}"></li> | ||
30 | + {{/ expressList}} | ||
31 | + </ul> | ||
32 | + {{/with}} | ||
33 | + <p class="express-edit-box"> | ||
34 | + <input type="hidden" id="express-old-id" value="{{id}}"> | ||
28 | {{#with detail}} | 35 | {{#with detail}} |
29 | - <ul style="display: none;"> | 36 | + <select id="express-company"> |
37 | + <option value="0">选择快递公司</option> | ||
30 | {{# expressList}} | 38 | {{# expressList}} |
31 | - <li class="company-list" data-id="{{id}}" data-name="{{company_name}}"></li> | 39 | + <option value="{{id}}" selected="">{{company_name}}</option> |
32 | {{/ expressList}} | 40 | {{/ expressList}} |
33 | - </ul> | 41 | + </select> |
34 | {{/with}} | 42 | {{/with}} |
35 | - <p class="express-edit-box"> | ||
36 | - <input type="hidden" id="express-old-id" value="{{id}}"> | ||
37 | - {{#with detail}} | ||
38 | - <select id="express-company"> | ||
39 | - <option value="0">选择快递公司</option> | ||
40 | - {{# expressList}} | ||
41 | - <option value="{{id}}" selected="">{{company_name}}</option> | ||
42 | - {{/ expressList}} | ||
43 | - </select> | ||
44 | - {{/with}} | ||
45 | - <input type="text" id="express-number" value="{{number}}" placeholder="请填写快递单号"> | ||
46 | - <input type="hidden" id="return-id" value="{{returnId}}"> | ||
47 | - <button type="button" id="submit-btn">确定</button> | ||
48 | - </p> | ||
49 | - <p class="express-view-box"> | ||
50 | - <span>{{company}} 快递单号:{{number}}</span> | ||
51 | - <button type="button" id="modify">修改</button> | ||
52 | - </p> | ||
53 | - </div> | ||
54 | - {{/ express}} | ||
55 | - <h2>详细信息</h2> | ||
56 | - <div class="main-detail"> | ||
57 | - <table> | ||
58 | - {{# goods}} | ||
59 | - <tr> | ||
60 | - <td width="50%">商品名称: {{name}}</td> | ||
61 | - <td> | ||
62 | - <span class="word-t">退</span><span class="word-h">换</span>货原因:{{reason}} | ||
63 | - </td> | ||
64 | - </tr> | ||
65 | - {{/ goods}} | ||
66 | - {{#unless isChange}} | ||
67 | - <tr> | ||
68 | - <td colspan="2">支付方式: {{payMode}}</td> | ||
69 | - </tr> | ||
70 | - <tr> | ||
71 | - <td colspan="2">退款方式: {{backMode}}</td> | ||
72 | - </tr> | ||
73 | - {{/unless}} | ||
74 | - </table> | ||
75 | - <div class="refund-tips"> | ||
76 | - <span>注:请于完成后的2个工作日查询您的退款账户,以确认退款到账</span> | ||
77 | - </div> | 43 | + <input type="text" id="express-number" value="{{number}}" placeholder="请填写快递单号"> |
44 | + <input type="hidden" id="return-id" value="{{returnId}}"> | ||
45 | + <button type="button" id="submit-btn">确定</button> | ||
46 | + </p> | ||
47 | + <p class="express-view-box"> | ||
48 | + <span>{{company}} 快递单号:{{number}}</span> | ||
49 | + <button type="button" id="modify">修改</button> | ||
50 | + </p> | ||
51 | + </div> | ||
52 | + {{/ express}} | ||
53 | + <h2>详细信息</h2> | ||
54 | + <div class="main-detail"> | ||
55 | + <table> | ||
56 | + {{# goods}} | ||
57 | + <tr> | ||
58 | + <td width="50%">商品名称: {{name}}</td> | ||
59 | + <td> | ||
60 | + <span class="word-t">退</span><span class="word-h">换</span>货原因:{{reason}} | ||
61 | + </td> | ||
62 | + </tr> | ||
63 | + {{/ goods}} | ||
64 | + {{#unless isChange}} | ||
65 | + <tr> | ||
66 | + <td colspan="2">支付方式: {{payMode}}</td> | ||
67 | + </tr> | ||
68 | + <tr> | ||
69 | + <td colspan="2">退款方式: {{backMode}}</td> | ||
70 | + </tr> | ||
71 | + {{/unless}} | ||
72 | + </table> | ||
73 | + <div class="refund-tips"> | ||
74 | + <span>注:请于完成后的2个工作日查询您的退款账户,以确认退款到账</span> | ||
78 | </div> | 75 | </div> |
79 | </div> | 76 | </div> |
80 | - {{/ detail}} | ||
81 | - </div> | ||
82 | - {{> help-us}} | 77 | + </div> |
78 | + {{/ detail}} | ||
83 | </div> | 79 | </div> |
84 | - {{/ returns}} | 80 | + {{> help-us}} |
81 | + </div> | ||
85 | </div> | 82 | </div> |
86 | -{{> layout/footer}} |
-
Please register or login to post a comment