Authored by 王水玲

Merge branch 'feature/installment' of git.yoho.cn:fe/yohobuywap-node into feature/installment

... ... @@ -265,7 +265,7 @@ const verifyCode = (req, res, next) => {
}).catch(next);
};
const order = (req, res) => {
const orderIndex = (req, res) => {
res.render('installment/order', {
module: 'home',
page: 'installment.order',
... ... @@ -274,12 +274,32 @@ const order = (req, res) => {
});
};
const orderList = (req, res) => {
const params = {
uid: req.user.uid,
type: req.query.type || 1,
page: req.query.page || 1,
limit: req.query.limit || 10
};
installmentModel.getInstallmentOrders(params).then((result)=> {
res.render('installment/order-list', {
orders: result.data.orderList,
layout: false
});
});
};
const orderDetail = (req, res) => {
res.render('installment/order-detail', {
module: 'home',
page: 'installment.order-detail',
navTitle: '分期详情',
navBtn: false
const params = {};
installmentModel.getInstallmentOrders(params).then(()=> {
res.render('installment/order-detail', {
module: 'home',
page: 'installment.order-detail',
navTitle: '分期详情',
navBtn: false
});
});
};
... ... @@ -299,4 +319,7 @@ module.exports = {
order,
orderDetail,
account
orderIndex,
orderList,
orderDetail
};
... ...
... ... @@ -12,7 +12,6 @@ const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const logger = global.yoho.logger;
// const camelCase = global.yoho.camelCase;
// 处理还款列表数据
const _processAmtList = (list, queryDays) => {
... ... @@ -162,6 +161,8 @@ const getResources = () => {
});
};
const response = require('./response.json');
const _DEBUG = true;
// 获取分期开通状态
const getStauts = (uid) => {
... ... @@ -459,11 +460,11 @@ const sendVerifyCode = (uid, mobile) => {
* 开通服务
*
* @param uid 用户id
* @param userName 姓名
* @param userName 姓名
* @param identityCardNo 身份证号码
* @param cardNo 银行卡号码
* @param mobile 手机号码
* @param snsCheckCode 验证码
* @param snsCheckCode 验证码
* @returns {*}
*/
const activateService = (params) => {
... ... @@ -480,8 +481,34 @@ const activateService = (params) => {
*/
const getBankInfo = (cardNo) => {
return api.get('', {
method: 'user.instalment.getBankInfoByCardNo'
}, cardNo);
method: 'user.instalment.getBankInfoByCardNo',
cardNo: cardNo
});
};
/**
* 分期订单列表
*
* uid
* type 订单类型 1:全部订单,2:还款中,3:已还清
* page 页数
* limit
* @returns {*}
*/
const getInstallmentOrders = (params) => {
const method = 'app.SpaceOrders.getInstallment';
if (!_DEBUG) {
return api.get('', {
method: method,
uid: params.uid,
type: params.type || 1,
page: params.page || 1,
limit: params.limit || 10
});
} else {
return Promise.resolve(camelCase(response[method]));
}
};
// 还款记录查询
... ... @@ -585,4 +612,6 @@ module.exports = {
getBankInfo,
getQueryRePayList,
getBankCards
getBankInfo
getInstallmentOrders
};
... ...
{
"app.SpaceOrders.getInstallment": {
"code": 200,
"data": {
"order_list": [
{
"order_code": "1519273880",
"uid": "5772257",
"create_time": "2016/08/01",
"amount": "¥100.00",
"buy_total": 1,
"install_status": "已还清",
"order_goods": [
{
"buy_number": 1,
"goods_image": "http://img10.static.yhbimg.com/goodsimg/2014/06/19/02/0118c2721e4f2219f69539dd389f4bacac.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
"goods_price": "¥1.00",
"goods_amount": "¥1.00",
"product_id": 84230,
"product_name": "004 满版龙纹迷彩七分休闲裤",
"cn_alphabet": "004QiFenBuKu004PA095",
"product_skn": 51055461
}
]
},
{
"order_code": "1519273880",
"uid": "5772257",
"create_time": "2016/08/01",
"amount": "¥100.00",
"buy_total": 1,
"install_status": "已还清",
"order_goods": [
{
"buy_number": 1,
"goods_image": "http://img10.static.yhbimg.com/goodsimg/2014/06/19/02/0118c2721e4f2219f69539dd389f4bacac.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
"goods_price": "¥1.00",
"goods_amount": "¥1.00",
"product_id": 84230,
"product_name": "004 满版龙纹迷彩七分休闲裤",
"cn_alphabet": "004QiFenBuKu004PA095",
"product_skn": 51055461
}
]
},
{
"order_code": "1519273880",
"uid": "5772257",
"create_time": "2016/08/01",
"amount": "¥100.00",
"buy_total": 1,
"install_status": "已还清",
"order_goods": [
{
"buy_number": 1,
"goods_image": "http://img10.static.yhbimg.com/goodsimg/2014/06/19/02/0118c2721e4f2219f69539dd389f4bacac.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
"goods_price": "¥1.00",
"goods_amount": "¥1.00",
"product_id": 84230,
"product_name": "004 满版龙纹迷彩七分休闲裤",
"cn_alphabet": "004QiFenBuKu004PA095",
"product_skn": 51055461
}
]
},
{
"order_code": "1519273880",
"uid": "5772257",
"create_time": "2016/08/01",
"amount": "¥100.00",
"buy_total": 1,
"install_status": "已还清",
"order_goods": [
{
"buy_number": 1,
"goods_image": "http://img10.static.yhbimg.com/goodsimg/2014/06/19/02/0118c2721e4f2219f69539dd389f4bacac.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
"goods_price": "¥1.00",
"goods_amount": "¥1.00",
"product_id": 84230,
"product_name": "004 满版龙纹迷彩七分休闲裤",
"cn_alphabet": "004QiFenBuKu004PA095",
"product_skn": 51055461
}
]
},{
"order_code": "1519273880",
"uid": "5772257",
"create_time": "2016/08/01",
"amount": "¥100.00",
"buy_total": 1,
"install_status": "已还清",
"order_goods": [
{
"buy_number": 1,
"goods_image": "http://img10.static.yhbimg.com/goodsimg/2014/06/19/02/0118c2721e4f2219f69539dd389f4bacac.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
"goods_price": "¥1.00",
"goods_amount": "¥1.00",
"product_id": 84230,
"product_name": "004 满版龙纹迷彩七分休闲裤",
"cn_alphabet": "004QiFenBuKu004PA095",
"product_skn": 51055461
}
]
},{
"order_code": "1519273880",
"uid": "5772257",
"create_time": "2016/08/01",
"amount": "¥100.00",
"buy_total": 1,
"install_status": "已还清",
"order_goods": [
{
"buy_number": 1,
"goods_image": "http://img10.static.yhbimg.com/goodsimg/2014/06/19/02/0118c2721e4f2219f69539dd389f4bacac.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
"goods_price": "¥1.00",
"goods_amount": "¥1.00",
"product_id": 84230,
"product_name": "004 满版龙纹迷彩七分休闲裤",
"cn_alphabet": "004QiFenBuKu004PA095",
"product_skn": 51055461
}
]
},{
"order_code": "1519273880",
"uid": "5772257",
"create_time": "2016/08/01",
"amount": "¥100.00",
"buy_total": 1,
"install_status": "已还清",
"order_goods": [
{
"buy_number": 1,
"goods_image": "http://img10.static.yhbimg.com/goodsimg/2014/06/19/02/0118c2721e4f2219f69539dd389f4bacac.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
"goods_price": "¥1.00",
"goods_amount": "¥1.00",
"product_id": 84230,
"product_name": "004 满版龙纹迷彩七分休闲裤",
"cn_alphabet": "004QiFenBuKu004PA095",
"product_skn": 51055461
}
]
},{
"order_code": "1519273880",
"uid": "5772257",
"create_time": "2016/08/01",
"amount": "¥100.00",
"buy_total": 1,
"install_status": "已还清",
"order_goods": [
{
"buy_number": 1,
"goods_image": "http://img10.static.yhbimg.com/goodsimg/2014/06/19/02/0118c2721e4f2219f69539dd389f4bacac.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
"goods_price": "¥1.00",
"goods_amount": "¥1.00",
"product_id": 84230,
"product_name": "004 满版龙纹迷彩七分休闲裤",
"cn_alphabet": "004QiFenBuKu004PA095",
"product_skn": 51055461
}
]
},{
"order_code": "1519273880",
"uid": "5772257",
"create_time": "2016/08/01",
"amount": "¥100.00",
"buy_total": 1,
"install_status": "已还清",
"order_goods": [
{
"buy_number": 1,
"goods_image": "http://img10.static.yhbimg.com/goodsimg/2014/06/19/02/0118c2721e4f2219f69539dd389f4bacac.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
"goods_price": "¥1.00",
"goods_amount": "¥1.00",
"product_id": 84230,
"product_name": "004 满版龙纹迷彩七分休闲裤",
"cn_alphabet": "004QiFenBuKu004PA095",
"product_skn": 51055461
}
]
},{
"order_code": "1519273880",
"uid": "5772257",
"create_time": "2016/08/01",
"amount": "¥100.00",
"buy_total": 1,
"install_status": "已还清",
"order_goods": [
{
"buy_number": 1,
"goods_image": "http://img10.static.yhbimg.com/goodsimg/2014/06/19/02/0118c2721e4f2219f69539dd389f4bacac.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
"goods_price": "¥1.00",
"goods_amount": "¥1.00",
"product_id": 84230,
"product_name": "004 满版龙纹迷彩七分休闲裤",
"cn_alphabet": "004QiFenBuKu004PA095",
"product_skn": 51055461
}
]
}
],
"page": 1,
"page_total": 27,
"total": 265
},
"message": "ok"
}
}
... ...
... ... @@ -26,6 +26,7 @@ router.get('/installment/getRepayRecord', installment.getRepayRecord); // ajaxè¯
router.get('/installment/account', installment.account); // 账户管理
router.get('/installment/bank-info', installment.getBankInfo);
router.post('/installment/activate-service', installment.activateService);
router.get('/installment/order', installment.order);
router.get('/installment/order', installment.orderIndex);
router.get('/installment/order.html', installment.orderList);
router.get('/installment/order/{:id}', installment.orderDetail);
module.exports = router;
... ...
<ul>
{{#each orders}}
<li>
<a href="/home/installment/order/{{orderCode}}">
{{#orderGoods}}
<div class="image-box">
<img src="{{image goodsImage 90 120}}" alt="{{productName}}">
</div>
<div class="title-box">
<div>{{productName}}</div>
<div class="date-box">{{../createTime}}</div>
</div>
{{/orderGoods}}
</a>
<div class="right-box">
<div class="amount">{{amount}}</div>
<div class="status">{{installStatus}}</div>
</div>
<div class="clearfix"></div>
</li>
{{/each}}
</ul>
... ...
<div class="installment-order-page">
{{> resources/banner-top}}
<ul class="header">
<li>
<a href="">全部</a>
</li>
<li>
<a href="">还款中</a>
</li>
<li>
<a href="">已还清</a>
</li>
</ul>
<ul class="order-list">
<li>
<div class="image-box">
<img src="" alt="">
</div>
<div class="title-box">
<div>adidas original LMXLALSDLALASLDMKLAD</div>
<div class="date-box">2016/06/19</div>
</div>
<div class="right-box">
<div>¥199.00</div>
<div>还款中1/3</div>
</div>
</li>
<li>
<div class="image-box">
<img src="" alt="">
</div>
<div class="title-box">
<div>adidas original LMXLALSDLALASLDMKLAD</div>
<div class="date-box">2016/06/19</div>
</div>
<div class="right-box">
<div>¥199.00</div>
<div>还款中1/3</div>
</div>
</li>
<li>
<div class="image-box">
<img src="" alt="">
</div>
<div class="title-box">
<div>adidas original LMXLALSDLALASLDMKLAD</div>
<div class="date-box">2016/06/19</div>
</div>
<div class="right-box">
<div>¥199.00</div>
<div>还款中1/3</div>
</div>
</li>
<li>
<div class="image-box">
<img src="" alt="">
</div>
<div class="title-box">
<div>adidas original LMXLALSDLALASLDMKLAD</div>
<div class="date-box">2016/06/19</div>
</div>
<div class="right-box">
<div>¥199.00</div>
<div>还款中1/3</div>
</div>
</li>
<li>
<div class="image-box">
<img src="" alt="">
</div>
<div class="title-box">
<div>adidas original LMXLALSDLALASLDMKLAD</div>
<div class="date-box">2016/06/19</div>
</div>
<div class="right-box">
<div>¥199.00</div>
<div>还款中1/3</div>
</div>
</li>
<li>
<div class="image-box">
<img src="" alt="">
</div>
<div class="title-box">
<div>adidas original LMXLALSDLALASLDMKLAD</div>
<div class="date-box">2016/06/19</div>
</div>
<div class="right-box">
<div>¥199.00</div>
<div>还款中1/3</div>
</div>
</li>
<li>
<div class="image-box">
<img src="" alt="">
</div>
<div class="title-box">
<div>adidas original LMXLALSDLALASLDMKLAD</div>
<div class="date-box">2016/06/19</div>
</div>
<div class="right-box">
<div>¥199.00</div>
<div>还款中1/3</div>
</div>
</li>1 ` `12q345678432123-=aZwertc7773231`1`
<li>
<div class="image-box">
<img src="" alt="">
</div>
<div class="title-box">
<div>adidas original LMXLALSDLALASLDMKLAD</div>
<div class="date-box">2016/06/19</div>
</div>
<div class="right-box">
<div>¥199.00</div>
<div>还款中1/3</div>
</div>
</li>
</ul>
<ul class="header-tab">
<li class="active">
<a href="/home/installment/order.html?type=1" data-type="1">全部</a>
</li>
<li>
<a href="/home/installment/order.html?type=2" data-type="2">还款中</a>
</li>
<li>
<a href="/home/installment/order.html?type=3" data-type="3">已还清</a>
</li>
</ul>
<div id="order-list" class="order-list"></div>
</div>
... ...
const $ = require('yoho-jquery');
/**
* 订单状态样式
*/
$('.status').each(function() {
const text = $(this).text();
if (text.indexOf(/已还清|已取消|已退款/)) {
$(this).addClass('faded');
}
});
/**
* 加载订单明细
*
* @param type
*/
const loadOrderList = (type)=> {
if (type) {
$.get('/home/installment/order.html', {
type: type
}).then((result)=> {
$('#order-list').empty().append(result);
});
}
};
/**
* 顶部TAB
*/
$('.header-tab a').click(function() {
$(this).parent().addClass('active');
$(this).parent().siblings().removeClass('active');
loadOrderList($(this).data('type'));
return false;
});
// 默认加载第一页
loadOrderList(1);
... ...
.installment-order-page {
background: #f0f0f0;
.header {
.header-tab {
text-align: center;
height: 90px;
border-bottom: 1px solid #e1e1e1;
... ... @@ -14,6 +14,16 @@
min-width: 120px;
height: 90px;
line-height: 90px;
a {
color: #b1b1b1;
}
&.active {
a {
color: #444;
}
}
}
}
... ... @@ -55,6 +65,12 @@
font-size: 27px;
text-align: right;
}
.status {
&.faded {
color: #b1b1b1;
}
}
}
}
}
... ...