Authored by 陈轩

fix

@@ -5,8 +5,6 @@ @@ -5,8 +5,6 @@
5 'use strict'; 5 'use strict';
6 6
7 const cookie = global.yoho.cookie; 7 const cookie = global.yoho.cookie;
8 -const logger = global.yoho.logger;  
9 -  
10 const returnsModel = require('../models/returns'); 8 const returnsModel = require('../models/returns');
11 9
12 /* 10 /*
@@ -23,6 +21,7 @@ exports.index = (req, res, next) => { @@ -23,6 +21,7 @@ exports.index = (req, res, next) => {
23 page: 'returns', 21 page: 'returns',
24 meReturnsPage: true 22 meReturnsPage: true
25 }, data); 23 }, data);
  24 +
26 res.render('returns/returns', viewData); 25 res.render('returns/returns', viewData);
27 }) 26 })
28 .catch(next); 27 .catch(next);
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
7 7
8 const path = require('path'); 8 const path = require('path');
9 const Promise = require('bluebird'); 9 const Promise = require('bluebird');
10 -const _ = require('lodash');  
11 10
12 // 使用 product中的分页逻辑 11 // 使用 product中的分页逻辑
13 const pagerPath = path.join(global.appRoot, '/apps/product/models/public-handler.js'); 12 const pagerPath = path.join(global.appRoot, '/apps/product/models/public-handler.js');
@@ -29,7 +28,7 @@ const EXCHANGE_URI = '/home/returns/exchangeDetail'; @@ -29,7 +28,7 @@ const EXCHANGE_URI = '/home/returns/exchangeDetail';
29 function getGoodsData(goods) { 28 function getGoodsData(goods) {
30 const arr = []; 29 const arr = [];
31 30
32 - goods.forEach(good=> { 31 + goods.forEach(good => {
33 const obj = {}; 32 const obj = {};
34 const cnAlphabet = good.cn_alphabet || ''; 33 const cnAlphabet = good.cn_alphabet || '';
35 34
@@ -90,18 +89,22 @@ exports.getReturnsList = co(function*(uid, page, limit) { @@ -90,18 +89,22 @@ exports.getReturnsList = co(function*(uid, page, limit) {
90 switch (item.refund_type) { 89 switch (item.refund_type) {
91 case REFUND: 90 case REFUND:
92 isChange = false; 91 isChange = false;
93 - uri = REFUND_URI; 92 + if (canCancel) {
  93 + uri = REFUND_URI;
  94 + }
94 break; 95 break;
95 case EXCHANGE: 96 case EXCHANGE:
96 isChange = true; 97 isChange = true;
97 - uri = EXCHANGE_URI; 98 + if (canCancel) {
  99 + uri = EXCHANGE_URI;
  100 + }
98 break; 101 break;
99 default: 102 default:
100 } 103 }
101 104
102 t.isChange = isChange; 105 t.isChange = isChange;
103 t.canCancelUrl = helpers.urlFormat(uri); 106 t.canCancelUrl = helpers.urlFormat(uri);
104 - t.moreHref = helpers.urlFormat(uri, {id: item.id}); 107 + t.moreHref = helpers.urlFormat(uri, { id: item.id });
105 t.goods = getGoodsData(item.goods); 108 t.goods = getGoodsData(item.goods);
106 109
107 obj.orders.push(t); 110 obj.orders.push(t);