Authored by yyq

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

... ... @@ -5,8 +5,27 @@
*/
'use strict';
const _ = require('lodash');
const mcHandler = require('../models/menu-crumb-handler');
const returns = require('../models/returns');
const _ = require('lodash');
const index = (req, res, next) => {
const uid = global.yoho.uid || '8050560';
const page = req.query.page;
returns.getUserReturn(uid, page).then(result => {
res.display('index', {
page: 'return-list',
isMe: true,
content: Object.assign({
nav: mcHandler.getMeCrumb('我的退/换货'),
navigation: mcHandler.getSideMenu('我的退/换货'),
banner: 'http://placehold.it/{width}x{height}'
}, result)
});
}).catch(next);
};
const detail = (req, res, next) => {
next();
... ... @@ -56,6 +75,7 @@ const exchange = (req, res, next) => {
};
module.exports = {
index,
detail,
refund,
refundApply,
... ...
/**
* 商品基本信息
* 退换货
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2016/7/19
*/
'use strict';
const api = global.yoho.API;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
const mcHandler = require('./menu-crumb-handler');
const returnsAPI = require('./returns-api');
const helpers = global.yoho.helpers;
const pageSize = 10;
const getUserReturn = (uid, page) => {
return api.get('', {
method: 'app.refund.getList',
uid: uid,
page: page || 1,
limit: 10
}).then(result => {
const basicData = {
title: '我的退/换货'
};
const refundStr = {
1: '退货',
2: '换货'
};
const data = camelCase(result.data);
const paginationOpts = data.total > pageSize ? {
paginationOpts: {
total: data.total,
page: data.page,
limit: pageSize
}
} : false;
data.list.forEach(item => {
item.orderGoods = item.goods;
item.createTime = item.orderCreateTime;
item.hidePrice = true;
item.showStatus = true;
item.refundStr = refundStr[item.refundType];
item.orderGoods.forEach(it => {
it.hidePrice = true;
});
});
return {
returnsList: Object.assign(data, paginationOpts, basicData)
};
});
};
const _setSideMenu = (type) => {
return {
nav: mcHandler.getMeCrumb(type),
... ... @@ -84,6 +134,7 @@ const saveRefund = (orderCode, uid, goods, payment) => {
};
module.exports = {
getUserReturn,
getRefundGoodsData,
saveRefund
};
... ...
... ... @@ -27,7 +27,7 @@ router.get('/getExpressInfo', order.getExpressInfo);
router.get('/editOrder', order.editOrder);
// 退换货
// router.get('/return', return.index);
router.get('/return', returns.index);
router.get('/return/refund/:orderCode', returns.refund);
router.get('/return/exchange/:orderCode', returns.exchange);
router.get('/return/:returnId', returns.detail);
... ...
... ... @@ -36,6 +36,11 @@
{{> returns}}
{{/if}}
{{!-- 我的退换货列表 --}}
{{#if returnsList}}
{{> returns-list}}
{{/if}}
{{!-- 我的收藏 --}}
{{#if collection}}
{{> collection}}
... ...
<div class="goods-container special-border">
<div class="goods-container special-border {{#if hidePrice}}no-price{{/if}}">
{{#orderGoods}}
<div class="good-info {{#if @last}}last{{/if}}">
<img src="{{image goodsImage 65 90}}">
... ... @@ -9,12 +9,13 @@
<span class="bold">{{sizeName}}</span>
</span>
<p class="bold buy-number">{{> icon/error-round}}{{buyNumber}}</p>
</div>
</div>
{{#unless hidePrice}}
<div class="sub-column right-border bold">
<p class="{{#if @last}}last{{/if}}">¥{{goodsPrice}}</p>
</div>
{{/unless}}
<div class="sub-column right-border special-column bold">
<p class="bold">{{buyNumber}}</p>
</div>
... ...
<div class="order-nav">
<div class="table order-nav">
<ul class="tabs clearfix">
{{#tabs}}
<li class="{{#if isActive}}active{{/if}}" data-type="{{typeStr}}"><span class="badge"></span>{{text}}</li>
... ...
<ul class="header">
<li class="content">下单时间:{{createTime}}</li>
<li class="content">订单编号:{{orderCode}}</li>
{{#if showMobile}}
<li class="content">手机订单</li>
{{/if}}
</ul>
... ...
... ... @@ -2,13 +2,7 @@
{{#if orderList}}
{{#orderList}}
<div class="order" data-code="{{orderCode}}">
<ul class="header">
<li class="content">下单时间:{{createTime}}</li>
<li class="content">订单编号:{{orderCode}}</li>
{{#if showMobile}}
<li class="content">手机订单</li>
{{/if}}
</ul>
{{> order/order-header}}
<div class="table-body">
{{> order/goods-box}}
<div class="common-column special-border">
... ...
<div class="return-wrap user-order">
<div class="order">
{{# returnsList}}
{{> common/subtitle}}
<div class="table">
<ul class="header">
<li class="info">商品信息</li>
<li class="st">状态</li>
<li class="op">操作</li>
</ul>
</div>
{{#list}}
<div class="table">
{{> order/order-header}}
<div class="table-body">
{{> order/goods-box}}
<div class="common-column special-border">
<p class="refund-status">{{statusName}}</p>
<p class="subtext badge refund-type">{{refundStr}}</p>
</div>
<div class="common-column special-border operation">
<p class="subtext">取消申请</p>
<p class="subtext">查看详情</p>
</div>
</div>
</div>
{{/list}}
{{#if paginationOpts}}
{{{ pagination paginationOpts }}}
{{/if}}
{{/ returnsList}}
</div>
</div>
... ...
... ... @@ -74,4 +74,5 @@
<div id="apply-btn" class="btn disable">提交申请</div>
</div>
{{/ returns}}
</div>
\ No newline at end of file
</div>
</div>
... ...
... ... @@ -103,5 +103,6 @@
@import "address";
@import "order/index";
@import "return/index";
@import "currency";
@import "returns";
... ...
... ... @@ -9,20 +9,6 @@
border-bottom: 1px solid $liBorderColor;
z-index: 0;
.badge {
min-width: 16px;
line-height: 16px;
display: inline-block;
padding: 0 5px;
position: absolute;
top: 0;
right: 14px;
background-color: $skyBlue;
color: #fff;
border-radius: 9px;
font-size: 12px;
}
.tabs {
display: inline-block;
height: $liHeight;
... ...
... ... @@ -14,6 +14,20 @@
margin: $space 0;
}
.badge {
min-width: 16px;
line-height: 16px;
display: inline-block;
padding: 0 5px;
position: absolute;
top: 0;
right: 14px;
background-color: $skyBlue;
color: #fff;
border-radius: 9px;
font-size: 12px;
}
.header {
height: $headerHeight;
line-height: $headerHeight;
... ...
@import "list"
... ...
.return-wrap {
.table {
width: 100%;
.header {
.info {
width: 496px;
text-align: left;
}
.st,
.op {
width: 206px;
}
}
.goods-container {
.for-return {
display: block;
}
}
.no-price {
.good-info {
border-right: none;
}
.good-info {
.detail {
width: 408px;
}
}
}
.common-column {
width: 208px;
.refund-status {
margin-bottom: 10px;
}
.refund-type {
position: static;
}
}
}
.blk-pagination {
text-align: center;
}
}
... ...