Authored by biao

update for refund entry

@@ -220,6 +220,7 @@ const _getUserOrder = (uid, type, page) => { @@ -220,6 +220,7 @@ const _getUserOrder = (uid, type, page) => {
220 let total = false; 220 let total = false;
221 let curPage = 1; 221 let curPage = 1;
222 222
  223 +
223 if (result && result.data) { 224 if (result && result.data) {
224 orderList = camelCase(result.data.order_list); 225 orderList = camelCase(result.data.order_list);
225 total = result.data.total; 226 total = result.data.total;
@@ -229,13 +230,30 @@ const _getUserOrder = (uid, type, page) => { @@ -229,13 +230,30 @@ const _getUserOrder = (uid, type, page) => {
229 orderList.forEach(item => { 230 orderList.forEach(item => {
230 const ot = parseInt(item.orderType, 10); 231 const ot = parseInt(item.orderType, 10);
231 const st = parseInt(item.status, 10); 232 const st = parseInt(item.status, 10);
  233 + let hasRefund = false;
  234 + let canRefund = false;
  235 +
232 236
233 item.orderGoods.forEach(good => { 237 item.orderGoods.forEach(good => {
234 let cnAlphabet = good.cnAlphabet ? good.cnAlphabet : ''; 238 let cnAlphabet = good.cnAlphabet ? good.cnAlphabet : '';
235 239
236 good.goodUrl = helpers.urlFormat(`/product/pro_${good.productId}_${good.goodsId}/${cnAlphabet}.html`); 240 good.goodUrl = helpers.urlFormat(`/product/pro_${good.productId}_${good.goodsId}/${cnAlphabet}.html`);
  241 +
  242 + // 判断该订单是否有换货商品
  243 + if (good.refundNum) {
  244 + hasRefund = true;
  245 + good.changed = true;
  246 + good.returnUrl = helpers.urlFormat('/me/return');
  247 +
  248 + // 判断该订单是否可以退换货
  249 + } else if (good.buyNumber !== good.refund) {
  250 + canRefund = true;
  251 + }
237 }); 252 });
238 253
  254 + item.showRefund = hasRefund;
  255 + item.hideChange = !canRefund;
  256 +
239 // 转换订单创建时间 257 // 转换订单创建时间
240 item.createTime = _convertUnixTime(item.createTime); 258 item.createTime = _convertUnixTime(item.createTime);
241 259
@@ -258,6 +276,7 @@ const _getUserOrder = (uid, type, page) => { @@ -258,6 +276,7 @@ const _getUserOrder = (uid, type, page) => {
258 // 在线支付和货到付款有按钮的差异 276 // 在线支付和货到付款有按钮的差异
259 item.isOnlinePaid = parseInt(item.paymentType, 10) === 1; 277 item.isOnlinePaid = parseInt(item.paymentType, 10) === 1;
260 278
  279 + item.isRefundOrder = ot === 7;
261 280
262 if (item.isCancel === 'Y') { 281 if (item.isCancel === 'Y') {
263 item.showBuyBtn = true; 282 item.showBuyBtn = true;
@@ -275,9 +294,9 @@ const _getUserOrder = (uid, type, page) => { @@ -275,9 +294,9 @@ const _getUserOrder = (uid, type, page) => {
275 }); 294 });
276 295
277 return { 296 return {
278 - orderList: orderList,  
279 - total: total,  
280 - curPage: curPage 297 + orderList,
  298 + total,
  299 + curPage
281 }; 300 };
282 }); 301 });
283 }; 302 };
@@ -607,11 +607,13 @@ const getChangeGoodsList = (orderCode, uid) => { @@ -607,11 +607,13 @@ const getChangeGoodsList = (orderCode, uid) => {
607 data.hidePrice = true; 607 data.hidePrice = true;
608 data.orderCode = orderCode; 608 data.orderCode = orderCode;
609 609
610 - data.goodsList.forEach(good => {  
611 - good.showCheckbox = true;  
612 - good.hidePrice = true;  
613 - good.buyNumber = 1;  
614 - }); 610 + if (data.goodsList) {
  611 + data.goodsList.forEach(good => {
  612 + good.showCheckbox = true;
  613 + good.hidePrice = true;
  614 + good.buyNumber = 1;
  615 + });
  616 + }
615 } 617 }
616 618
617 619
@@ -3,7 +3,14 @@ @@ -3,7 +3,14 @@
3 {{> order/good-info}} 3 {{> order/good-info}}
4 {{#unless hidePrice}} 4 {{#unless hidePrice}}
5 <div class="sub-column right-border bold"> 5 <div class="sub-column right-border bold">
6 - <p class="{{#if @last}}last{{/if}}">¥{{goodsPrice}}</p> 6 + <p class="{{#if @last}}last{{/if}}">
  7 + ¥{{goodsPrice}}
  8 + {{#if changed}}
  9 + <a href="{{returnUrl}}">
  10 + <span class="btn white change-tag">已退换</span>
  11 + </a>
  12 + {{/if}}
  13 + </p>
7 </div> 14 </div>
8 <div class="sub-column right-border special-column bold"> 15 <div class="sub-column right-border special-column bold">
9 <p class="bold">{{buyNumber}}</p> 16 <p class="bold">{{buyNumber}}</p>
@@ -8,6 +8,9 @@ @@ -8,6 +8,9 @@
8 <div class="common-column special-border"> 8 <div class="common-column special-border">
9 <p class="bold">¥{{amount}}</p> 9 <p class="bold">¥{{amount}}</p>
10 <p class="subtext">{{paymentTypeStr}}</p> 10 <p class="subtext">{{paymentTypeStr}}</p>
  11 + {{#if isRefundOrder}}
  12 + <p class="subtext refund-tag">换货订单</p>
  13 + {{/if}}
11 </div> 14 </div>
12 <div class="common-column special-border status"> 15 <div class="common-column special-border status">
13 <p class="bold status-str">{{statusStr}}</p> 16 <p class="bold status-str">{{statusStr}}</p>
@@ -29,12 +32,14 @@ @@ -29,12 +32,14 @@
29 {{/if}} 32 {{/if}}
30 {{#if showEditOption}} 33 {{#if showEditOption}}
31 <p class="subtext">评价晒单</p> 34 <p class="subtext">评价晒单</p>
  35 + {{#unless hideChange}}
32 <a href="{{refundUrl}}"> 36 <a href="{{refundUrl}}">
33 <p class="subtext">申请退货</p> 37 <p class="subtext">申请退货</p>
34 </a> 38 </a>
35 <a href="{{exchangeUrl}}"> 39 <a href="{{exchangeUrl}}">
36 <p class="subtext">申请换货</p> 40 <p class="subtext">申请换货</p>
37 </a> 41 </a>
  42 + {{/unless}}
38 <p class="subtext delete">删除订单</p> 43 <p class="subtext delete">删除订单</p>
39 {{/if}} 44 {{/if}}
40 {{#if showGetBtn}} 45 {{#if showGetBtn}}
@@ -14,6 +14,25 @@ @@ -14,6 +14,25 @@
14 margin: $space 0; 14 margin: $space 0;
15 } 15 }
16 16
  17 + .refund-tag {
  18 + width: 55%;
  19 + padding: 5px 0;
  20 + border-radius: 10px;
  21 + margin: 0 auto;
  22 + background-color: orange;
  23 + color: #fff;
  24 + }
  25 +
  26 + .change-tag {
  27 + margin: 10px auto 0;
  28 + color: #1b1b1b;
  29 +
  30 + &:hover {
  31 + background-color: #1b1b1b;
  32 + color: #fff;
  33 + }
  34 + }
  35 +
17 .badge { 36 .badge {
18 min-width: 16px; 37 min-width: 16px;
19 line-height: 16px; 38 line-height: 16px;