Authored by yyq

Merge branch 'feature/return' of git.yoho.cn:fe/yoho-blk into feature/return

@@ -5,8 +5,27 @@ @@ -5,8 +5,27 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 7
8 -const _ = require('lodash'); 8 +const mcHandler = require('../models/menu-crumb-handler');
9 const returns = require('../models/returns'); 9 const returns = require('../models/returns');
  10 +const _ = require('lodash');
  11 +
  12 +
  13 +const index = (req, res, next) => {
  14 + const uid = global.yoho.uid || '8050560';
  15 + const page = req.query.page;
  16 +
  17 + returns.getUserReturn(uid, page).then(result => {
  18 + res.display('index', {
  19 + page: 'return-list',
  20 + isMe: true,
  21 + content: Object.assign({
  22 + nav: mcHandler.getMeCrumb('我的退/换货'),
  23 + navigation: mcHandler.getSideMenu('我的退/换货'),
  24 + banner: 'http://placehold.it/{width}x{height}'
  25 + }, result)
  26 + });
  27 + }).catch(next);
  28 +};
10 29
11 const detail = (req, res, next) => { 30 const detail = (req, res, next) => {
12 next(); 31 next();
@@ -56,6 +75,7 @@ const exchange = (req, res, next) => { @@ -56,6 +75,7 @@ const exchange = (req, res, next) => {
56 }; 75 };
57 76
58 module.exports = { 77 module.exports = {
  78 + index,
59 detail, 79 detail,
60 refund, 80 refund,
61 refundApply, 81 refundApply,
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
5 */ 5 */
6 'use strict'; 6 'use strict';
7 7
  8 +const api = global.yoho.API;
  9 +const camelCase = global.yoho.camelCase;
  10 +
8 const _ = require('lodash'); 11 const _ = require('lodash');
9 const mcHandler = require('./menu-crumb-handler'); 12 const mcHandler = require('./menu-crumb-handler');
10 const returnsAPI = require('./returns-api'); 13 const returnsAPI = require('./returns-api');
11 14
12 const helpers = global.yoho.helpers; 15 const helpers = global.yoho.helpers;
13 16
  17 +const pageSize = 10;
  18 +
  19 +const getUserReturn = (uid, page) => {
  20 +
  21 + return api.get('', {
  22 + method: 'app.refund.getList',
  23 + uid: uid,
  24 + page: page || 1,
  25 + limit: 10
  26 + }).then(result => {
  27 + const basicData = {
  28 + title: '我的退/换货'
  29 + };
  30 +
  31 + const refundStr = {
  32 + 1: '退货',
  33 + 2: '换货'
  34 + };
  35 +
  36 + const data = camelCase(result.data);
  37 +
  38 + const paginationOpts = data.total > pageSize ? {
  39 + paginationOpts: {
  40 + total: data.total,
  41 + page: data.page,
  42 + limit: pageSize
  43 + }
  44 + } : false;
  45 +
  46 + data.list.forEach(item => {
  47 + item.orderGoods = item.goods;
  48 + item.createTime = item.orderCreateTime;
  49 + item.hidePrice = true;
  50 + item.showStatus = true;
  51 + item.refundStr = refundStr[item.refundType];
  52 +
  53 + item.orderGoods.forEach(it => {
  54 + it.hidePrice = true;
  55 + });
  56 + });
  57 +
  58 + return {
  59 + returnsList: Object.assign(data, paginationOpts, basicData)
  60 + };
  61 + });
  62 +};
  63 +
14 const _setSideMenu = (type) => { 64 const _setSideMenu = (type) => {
15 return { 65 return {
16 nav: mcHandler.getMeCrumb(type), 66 nav: mcHandler.getMeCrumb(type),
@@ -84,6 +134,7 @@ const saveRefund = (orderCode, uid, goods, payment) => { @@ -84,6 +134,7 @@ const saveRefund = (orderCode, uid, goods, payment) => {
84 }; 134 };
85 135
86 module.exports = { 136 module.exports = {
  137 + getUserReturn,
87 getRefundGoodsData, 138 getRefundGoodsData,
88 saveRefund 139 saveRefund
89 }; 140 };
@@ -27,7 +27,7 @@ router.get('/getExpressInfo', order.getExpressInfo); @@ -27,7 +27,7 @@ router.get('/getExpressInfo', order.getExpressInfo);
27 router.get('/editOrder', order.editOrder); 27 router.get('/editOrder', order.editOrder);
28 28
29 // 退换货 29 // 退换货
30 -// router.get('/return', return.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/:returnId', returns.detail); 33 router.get('/return/:returnId', returns.detail);
@@ -36,6 +36,11 @@ @@ -36,6 +36,11 @@
36 {{> returns}} 36 {{> returns}}
37 {{/if}} 37 {{/if}}
38 38
  39 + {{!-- 我的退换货列表 --}}
  40 + {{#if returnsList}}
  41 + {{> returns-list}}
  42 + {{/if}}
  43 +
39 {{!-- 我的收藏 --}} 44 {{!-- 我的收藏 --}}
40 {{#if collection}} 45 {{#if collection}}
41 {{> collection}} 46 {{> collection}}
1 -<div class="goods-container special-border"> 1 +<div class="goods-container special-border {{#if hidePrice}}no-price{{/if}}">
2 {{#orderGoods}} 2 {{#orderGoods}}
3 <div class="good-info {{#if @last}}last{{/if}}"> 3 <div class="good-info {{#if @last}}last{{/if}}">
4 <img src="{{image goodsImage 65 90}}"> 4 <img src="{{image goodsImage 65 90}}">
@@ -9,12 +9,13 @@ @@ -9,12 +9,13 @@
9 <span class="bold">{{sizeName}}</span> 9 <span class="bold">{{sizeName}}</span>
10 </span> 10 </span>
11 <p class="bold buy-number">{{> icon/error-round}}{{buyNumber}}</p> 11 <p class="bold buy-number">{{> icon/error-round}}{{buyNumber}}</p>
12 -  
13 </div> 12 </div>
14 </div> 13 </div>
  14 + {{#unless hidePrice}}
15 <div class="sub-column right-border bold"> 15 <div class="sub-column right-border bold">
16 <p class="{{#if @last}}last{{/if}}">¥{{goodsPrice}}</p> 16 <p class="{{#if @last}}last{{/if}}">¥{{goodsPrice}}</p>
17 </div> 17 </div>
  18 + {{/unless}}
18 <div class="sub-column right-border special-column bold"> 19 <div class="sub-column right-border special-column bold">
19 <p class="bold">{{buyNumber}}</p> 20 <p class="bold">{{buyNumber}}</p>
20 </div> 21 </div>
1 -<div class="order-nav"> 1 +<div class="table order-nav">
2 <ul class="tabs clearfix"> 2 <ul class="tabs clearfix">
3 {{#tabs}} 3 {{#tabs}}
4 <li class="{{#if isActive}}active{{/if}}" data-type="{{typeStr}}"><span class="badge"></span>{{text}}</li> 4 <li class="{{#if isActive}}active{{/if}}" data-type="{{typeStr}}"><span class="badge"></span>{{text}}</li>
  1 +<ul class="header">
  2 + <li class="content">下单时间:{{createTime}}</li>
  3 + <li class="content">订单编号:{{orderCode}}</li>
  4 + {{#if showMobile}}
  5 + <li class="content">手机订单</li>
  6 + {{/if}}
  7 +</ul>
@@ -2,13 +2,7 @@ @@ -2,13 +2,7 @@
2 {{#if orderList}} 2 {{#if orderList}}
3 {{#orderList}} 3 {{#orderList}}
4 <div class="order" data-code="{{orderCode}}"> 4 <div class="order" data-code="{{orderCode}}">
5 - <ul class="header">  
6 - <li class="content">下单时间:{{createTime}}</li>  
7 - <li class="content">订单编号:{{orderCode}}</li>  
8 - {{#if showMobile}}  
9 - <li class="content">手机订单</li>  
10 - {{/if}}  
11 - </ul> 5 + {{> order/order-header}}
12 <div class="table-body"> 6 <div class="table-body">
13 {{> order/goods-box}} 7 {{> order/goods-box}}
14 <div class="common-column special-border"> 8 <div class="common-column special-border">
  1 +<div class="return-wrap user-order">
  2 + <div class="order">
  3 + {{# returnsList}}
  4 + {{> common/subtitle}}
  5 + <div class="table">
  6 + <ul class="header">
  7 + <li class="info">商品信息</li>
  8 + <li class="st">状态</li>
  9 + <li class="op">操作</li>
  10 + </ul>
  11 + </div>
  12 + {{#list}}
  13 + <div class="table">
  14 + {{> order/order-header}}
  15 + <div class="table-body">
  16 + {{> order/goods-box}}
  17 + <div class="common-column special-border">
  18 + <p class="refund-status">{{statusName}}</p>
  19 + <p class="subtext badge refund-type">{{refundStr}}</p>
  20 + </div>
  21 + <div class="common-column special-border operation">
  22 + <p class="subtext">取消申请</p>
  23 + <p class="subtext">查看详情</p>
  24 + </div>
  25 + </div>
  26 + </div>
  27 + {{/list}}
  28 + {{#if paginationOpts}}
  29 + {{{ pagination paginationOpts }}}
  30 + {{/if}}
  31 + {{/ returnsList}}
  32 + </div>
  33 +</div>
@@ -74,4 +74,5 @@ @@ -74,4 +74,5 @@
74 <div id="apply-btn" class="btn disable">提交申请</div> 74 <div id="apply-btn" class="btn disable">提交申请</div>
75 </div> 75 </div>
76 {{/ returns}} 76 {{/ returns}}
  77 + </div>
77 </div> 78 </div>
@@ -103,5 +103,6 @@ @@ -103,5 +103,6 @@
103 103
104 @import "address"; 104 @import "address";
105 @import "order/index"; 105 @import "order/index";
  106 +@import "return/index";
106 @import "currency"; 107 @import "currency";
107 @import "returns"; 108 @import "returns";
@@ -9,20 +9,6 @@ @@ -9,20 +9,6 @@
9 border-bottom: 1px solid $liBorderColor; 9 border-bottom: 1px solid $liBorderColor;
10 z-index: 0; 10 z-index: 0;
11 11
12 - .badge {  
13 - min-width: 16px;  
14 - line-height: 16px;  
15 - display: inline-block;  
16 - padding: 0 5px;  
17 - position: absolute;  
18 - top: 0;  
19 - right: 14px;  
20 - background-color: $skyBlue;  
21 - color: #fff;  
22 - border-radius: 9px;  
23 - font-size: 12px;  
24 - }  
25 -  
26 .tabs { 12 .tabs {
27 display: inline-block; 13 display: inline-block;
28 height: $liHeight; 14 height: $liHeight;
@@ -14,6 +14,20 @@ @@ -14,6 +14,20 @@
14 margin: $space 0; 14 margin: $space 0;
15 } 15 }
16 16
  17 + .badge {
  18 + min-width: 16px;
  19 + line-height: 16px;
  20 + display: inline-block;
  21 + padding: 0 5px;
  22 + position: absolute;
  23 + top: 0;
  24 + right: 14px;
  25 + background-color: $skyBlue;
  26 + color: #fff;
  27 + border-radius: 9px;
  28 + font-size: 12px;
  29 + }
  30 +
17 .header { 31 .header {
18 height: $headerHeight; 32 height: $headerHeight;
19 line-height: $headerHeight; 33 line-height: $headerHeight;
  1 +.return-wrap {
  2 + .table {
  3 + width: 100%;
  4 +
  5 + .header {
  6 + .info {
  7 + width: 496px;
  8 + text-align: left;
  9 + }
  10 +
  11 + .st,
  12 + .op {
  13 + width: 206px;
  14 + }
  15 + }
  16 +
  17 + .goods-container {
  18 + .for-return {
  19 + display: block;
  20 + }
  21 + }
  22 +
  23 + .no-price {
  24 + .good-info {
  25 + border-right: none;
  26 + }
  27 +
  28 + .good-info {
  29 + .detail {
  30 + width: 408px;
  31 + }
  32 + }
  33 + }
  34 +
  35 + .common-column {
  36 + width: 208px;
  37 +
  38 + .refund-status {
  39 + margin-bottom: 10px;
  40 + }
  41 + .refund-type {
  42 + position: static;
  43 + }
  44 + }
  45 + }
  46 +
  47 + .blk-pagination {
  48 + text-align: center;
  49 + }
  50 +}