Authored by zhangxiaoru

exchange

@@ -108,10 +108,11 @@ const getProductInfo = (req, res, next) => { @@ -108,10 +108,11 @@ const getProductInfo = (req, res, next) => {
108 }).catch(next); 108 }).catch(next);
109 }; 109 };
110 110
111 -const detailExchange = (req, res) => {  
112 - // const uid = global.yoho.uid || '8050560';  
113 - // const page = req.query.page; 111 +const exchangeDeatail = (req, res) => {
  112 + let id = 125946;
  113 + let uid = 8050560;
114 114
  115 + returns.getExchangeDetailData(id, uid).then(result => {
115 res.display('index', { 116 res.display('index', {
116 page: 'exchange-detail', 117 page: 'exchange-detail',
117 isMe: true, 118 isMe: true,
@@ -121,46 +122,24 @@ const detailExchange = (req, res) => { @@ -121,46 +122,24 @@ const detailExchange = (req, res) => {
121 banner: 'http://placehold.it/{width}x{height}', 122 banner: 'http://placehold.it/{width}x{height}',
122 123
123 exchange: { 124 exchange: {
124 - // audit: true,  
125 - // through: false,  
126 - // send: true,  
127 finish: true, 125 finish: true,
128 way: '上门送货', 126 way: '上门送货',
129 - goods: [ 127 + goodsList: [
130 { 128 {
131 - img: '',  
132 - name: 'fdefwfwefwrefverfref',  
133 - color: '',  
134 - size: '', 129 + goodsImage: '',
  130 + productName: 'fdefwfwefwrefverfref',
  131 + colorName: '',
  132 + sizeName: '',
135 num: '', 133 num: '',
136 - reason: '',  
137 - exchangeColor: '蓝色',  
138 - exchangeSize: 'M'  
139 - },  
140 - {  
141 - img: '',  
142 - name: 'fdefwfwefwrefverfref',  
143 - color: '',  
144 - size: '',  
145 - num: '',  
146 - reason: '',  
147 - exchangeColor: '蓝色',  
148 - exchangeSize: 'M'  
149 - }  
150 - ],  
151 - reasonInfo: [  
152 - {  
153 - problem: '太小了',  
154 - img: ''  
155 - },  
156 - {  
157 - problem: '太小了',  
158 - img: '' 134 + reasonName: '',
  135 + newColorName: '蓝色',
  136 + newSizeName: 'M',
159 } 137 }
160 ] 138 ]
161 } 139 }
162 } 140 }
163 }); 141 });
  142 + });
164 }; 143 };
165 144
166 module.exports = { 145 module.exports = {
@@ -171,5 +150,5 @@ module.exports = { @@ -171,5 +150,5 @@ module.exports = {
171 exchange, 150 exchange,
172 getProductInfo, 151 getProductInfo,
173 refundDetail, 152 refundDetail,
174 - detailExchange 153 + exchangeDeatail
175 }; 154 };
1 -/** 1 + /**
2 * 商品基本信息 2 * 商品基本信息
3 * @author: yyq<yanqing.yang@yoho.cn> 3 * @author: yyq<yanqing.yang@yoho.cn>
4 * @date: 2016/7/19 4 * @date: 2016/7/19
@@ -58,12 +58,21 @@ const getProductInfoAsync = (productId, productSkn) => { @@ -58,12 +58,21 @@ const getProductInfoAsync = (productId, productSkn) => {
58 }); 58 });
59 }; 59 };
60 60
  61 +const getExchangeDetail = (id, uid) => {
  62 + return api.get('', {
  63 + method: 'app.change.detail',
  64 + id: id,
  65 + uid: uid
  66 + });
  67 +};
  68 +
61 module.exports = { 69 module.exports = {
62 getOrderInfoAsync, 70 getOrderInfoAsync,
63 getRefundGoodsAsync, 71 getRefundGoodsAsync,
64 getChangeGoodsListAsync, 72 getChangeGoodsListAsync,
65 getProductInfoAsync, 73 getProductInfoAsync,
66 getRefundDetailAsync, 74 getRefundDetailAsync,
67 - refundSubmitAsync 75 + refundSubmitAsync,
  76 + getExchangeDetail
68 }; 77 };
69 78
@@ -11,6 +11,7 @@ const camelCase = global.yoho.camelCase; @@ -11,6 +11,7 @@ const camelCase = global.yoho.camelCase;
11 const _ = require('lodash'); 11 const _ = require('lodash');
12 const mcHandler = require('./menu-crumb-handler'); 12 const mcHandler = require('./menu-crumb-handler');
13 const returnsAPI = require('./returns-api'); 13 const returnsAPI = require('./returns-api');
  14 +const logger = global.yoho.logger;
14 15
15 const helpers = global.yoho.helpers; 16 const helpers = global.yoho.helpers;
16 17
@@ -213,6 +214,32 @@ const _setRefundDetailData = (data) => { @@ -213,6 +214,32 @@ const _setRefundDetailData = (data) => {
213 return resData; 214 return resData;
214 }; 215 };
215 216
  217 +const _setExchangeDetailData = (data) => {
  218 + let list = {};
  219 +
  220 + switch (data.status) {
  221 + case 0:
  222 + list.audit = true;
  223 + break;
  224 + case 10:
  225 + list.through = true;
  226 + break;
  227 + case 50:
  228 + list.send = true;
  229 + list.auditSuccess = true;
  230 + break;
  231 + case 40:
  232 + resData.finish = true;
  233 + list.auditSuccess = true;
  234 + break;
  235 + default:
  236 + resData.audit = true;
  237 + break;
  238 + }
  239 +
  240 + return list;
  241 +};
  242 +
216 const getRefundGoodsData = (orderCode, uid) => { 243 const getRefundGoodsData = (orderCode, uid) => {
217 return returnsAPI.getRefundGoodsAsync(orderCode, uid).then(result => { 244 return returnsAPI.getRefundGoodsAsync(orderCode, uid).then(result => {
218 let resData = {}; 245 let resData = {};
@@ -248,7 +275,7 @@ const getRefundDetailData = (applyId, uid) => { @@ -248,7 +275,7 @@ const getRefundDetailData = (applyId, uid) => {
248 if (result.data) { 275 if (result.data) {
249 // console.log(_setRefundDetailData(result.data)); 276 // console.log(_setRefundDetailData(result.data));
250 277
251 - Object.assign(resData.refundDetail, _setReturnStatus(result.data.statusList)); 278 + Object.assign(resData.refundDetail, _setReturnStatus(result.data.statusList));//头部
252 279
253 Object.assign(resData.refundDetail, _setRefundDetailData(result.data)); 280 Object.assign(resData.refundDetail, _setRefundDetailData(result.data));
254 } 281 }
@@ -319,11 +346,38 @@ const getChangeGoodsList = (orderCode, uid) => { @@ -319,11 +346,38 @@ const getChangeGoodsList = (orderCode, uid) => {
319 }); 346 });
320 }; 347 };
321 348
  349 +const getExchangeDetailData = (id, uid) => {
  350 + return returnsAPI.getExchangeDetail(id, uid).then(result => {
  351 +
  352 + let exchangeData = {};
  353 +
  354 + Object.assign(exchangeData, _setSideMenu('我的退/换货'));
  355 + exchangeData = {
  356 + title: '换货申请',
  357 + exchangeDetail: {}
  358 + };
  359 +
  360 + if (result.data) {
  361 + // console.log(_setRefundDetailData(result.data));
  362 +
  363 + Object.assign(exchangeData.exchangeDetail, _setReturnStatus(result.data.statusList));//头部
  364 +
  365 + Object.assign(exchangeData.exchangeDetail, _setExchangeDetailData(result.data));
  366 +
  367 + // Object.assign(exchangeData.exchangeDetail, camelCase(result.data));
  368 + }
  369 +
  370 + console.log(exchangeData)
  371 + return {returns: exchangeData};
  372 + });
  373 +};
  374 +
322 module.exports = { 375 module.exports = {
323 getUserReturn, 376 getUserReturn,
324 getRefundGoodsData, 377 getRefundGoodsData,
325 getChangeGoodsList, 378 getChangeGoodsList,
326 getProductInfo, 379 getProductInfo,
327 getRefundDetailData, 380 getRefundDetailData,
328 - saveRefund 381 + saveRefund,
  382 + getExchangeDetailData
329 }; 383 };
@@ -30,8 +30,8 @@ router.get('/editOrder', order.editOrder); @@ -30,8 +30,8 @@ router.get('/editOrder', order.editOrder);
30 router.get('/return', returns.index); 30 router.get('/return', returns.index);
31 router.get('/return/refund/:orderCode', returns.refund); 31 router.get('/return/refund/:orderCode', returns.refund);
32 router.get('/return/exchange/:orderCode', returns.exchange); 32 router.get('/return/exchange/:orderCode', returns.exchange);
33 -router.get('/return/refund/detail/:applyId', returns.refundDetail);  
34 -router.get('/return/exchange/detail', returns.detailExchange); 33 +router.get('/return/refund/detail/:id', returns.refundDetail);
  34 +router.get('/return/exchange/detail/:applyId', returns.exchangeDeatail);
35 router.get('/return/:returnId', returns.detail); 35 router.get('/return/:returnId', returns.detail);
36 router.post('/return/refund/apply', returns.refundApply); 36 router.post('/return/refund/apply', returns.refundApply);
37 router.get('/return/getProductInfo', returns.getProductInfo); 37 router.get('/return/getProductInfo', returns.getProductInfo);
1 {{# exchange}} 1 {{# exchange}}
  2 +{{> returns/returns-status}}
  3 +
2 <div class="exchange-detail-page"> 4 <div class="exchange-detail-page">
3 {{#if audit}} 5 {{#if audit}}
4 <p class="state"><span class="iconfont">&#xe618;</span>换货申请审核中</p> 6 <p class="state"><span class="iconfont">&#xe618;</span>换货申请审核中</p>
@@ -21,7 +23,7 @@ @@ -21,7 +23,7 @@
21 {{#if finish}} 23 {{#if finish}}
22 <p class="contact">如有疑问,请联系<span class="iconfont">&#xe61c;</span>在线客服</p> 24 <p class="contact">如有疑问,请联系<span class="iconfont">&#xe61c;</span>在线客服</p>
23 {{else}} 25 {{else}}
24 - <p class="way-title">您已选择{{way}}</p> 26 + <p class="way-title">您已选择{{deliveryTpyeName}}</p>
25 <p>请将商品连同吊牌、包装、发货单(如无发货单,您可找张白纸上注明订单编号,收货人姓名及手机号码)、发票(如有)、赠品(如有)一并保存, 27 <p>请将商品连同吊牌、包装、发货单(如无发货单,您可找张白纸上注明订单编号,收货人姓名及手机号码)、发票(如有)、赠品(如有)一并保存,
26 如有遗漏将影响您的退换货进度,敬请谅解 28 如有遗漏将影响您的退换货进度,敬请谅解
27 </p> 29 </p>
@@ -31,7 +33,7 @@ @@ -31,7 +33,7 @@
31 <p class="cancel">如果您不想换货了,您可以<span class="cancel-btn">取消申请</span></p> 33 <p class="cancel">如果您不想换货了,您可以<span class="cancel-btn">取消申请</span></p>
32 {{/if}} 34 {{/if}}
33 35
34 - {{#if finish}} 36 + {{#if auditSuccess}}
35 <div class="order"> 37 <div class="order">
36 <span class="check">查看</span> 38 <span class="check">查看</span>
37 <span class="exchange-order">换货订单</span> 39 <span class="exchange-order">换货订单</span>
@@ -42,10 +44,10 @@ @@ -42,10 +44,10 @@
42 <div class="adress"> 44 <div class="adress">
43 <p class="adress-title">收货地址<span class="modify-btn">修改</span></p> 45 <p class="adress-title">收货地址<span class="modify-btn">修改</span></p>
44 <div class="adress-detail"> 46 <div class="adress-detail">
45 - <p>所在区域:江苏省 南京市 雨花台区</p>  
46 - <p>收 货 人:赵四</p>  
47 - <p>详细地址:西善桥北路 109 号</p>  
48 - <p>联系电话:17714194699</p> 47 + <p>所在区域:{{city}}{{county}}</p>
  48 + <p>收 货 人:{{consigneeName}}</p>
  49 + <p>详细地址:{{aderss}}</p>
  50 + <p>联系电话:{{mobile}}</p>
49 </div> 51 </div>
50 </div> 52 </div>
51 53
@@ -61,34 +63,32 @@ @@ -61,34 +63,32 @@
61 </div> 63 </div>
62 64
63 <div class="table"> 65 <div class="table">
64 - {{# goods}} 66 + {{# goodsList}}
65 <div class="table-body"> 67 <div class="table-body">
66 <div class="goods-info"> 68 <div class="goods-info">
67 - <img class="lazy" data-original="{{image img 70 90}}"> 69 + <img class="lazy" data-original="{{image goodsImage 70 90}}">
68 <div class="info"> 70 <div class="info">
69 - <p class="good-name">{{name}}</p>  
70 - <p>颜色:{{color}}&nbsp;尺码:{{size}}</p> 71 + <p class="good-name">{{productName}}</p>
  72 + <p>颜色:{{colorName}}&nbsp;尺码:{{sizeName}}</p>
71 <p>×{{num}}</p> 73 <p>×{{num}}</p>
72 </div> 74 </div>
73 </div> 75 </div>
74 <div class="common-column special-border"> 76 <div class="common-column special-border">
75 - <p class="reason">{{reason}}发错货</p> 77 + <p class="reason">{{reasonName}}</p>
76 </div> 78 </div>
77 <div class="common-column special-border operation"> 79 <div class="common-column special-border operation">
78 - <p class="subtext">color: {{exchangeColor}}<br>size: {{exchangeSize}}</p> 80 + <p class="subtext">color: {{newColorName}}蓝色 <br>size: {{newSizeName}}</p>
79 </div> 81 </div>
80 </div> 82 </div>
81 - {{/ goods}}  
82 - {{# reasonInfo}}  
83 <div class="reason-info"> 83 <div class="reason-info">
84 - <span>问题描述:{{problem}}</span> 84 + <span>问题描述:{{reasonName}}</span>
85 <div class="reason-img">照片凭证: 85 <div class="reason-img">照片凭证:
86 <div class="evidence"> 86 <div class="evidence">
87 <img src="{{image img 70 90}}"> 87 <img src="{{image img 70 90}}">
88 </div> 88 </div>
89 </div> 89 </div>
90 </div> 90 </div>
91 - {{/ reasonInfo}} 91 + {{/ goodsList}}
92 </div> 92 </div>
93 </div> 93 </div>
94 </div> 94 </div>
@@ -6,6 +6,6 @@ @@ -6,6 +6,6 @@
6 6
7 {{> refund-detail}} 7 {{> refund-detail}}
8 8
9 - {{> exchange}} 9 + {{> exchange-detail}}
10 {{/ returns}} 10 {{/ returns}}
11 </div> 11 </div>
@@ -208,6 +208,7 @@ @@ -208,6 +208,7 @@
208 } 208 }
209 209
210 .reason-info { 210 .reason-info {
  211 + font-size: 14px;
211 overflow: hidden; 212 overflow: hidden;
212 padding: 25px 0 30px 20px; 213 padding: 25px 0 30px 20px;
213 width: 100%; 214 width: 100%;