Authored by 王水玲

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

... ... @@ -255,13 +255,14 @@ const orderIndex = (req, res) => {
module: 'home',
page: 'installment.order',
title: '我的分期订单',
navBtn: false
navBtn: false,
isInstallmentPage: true
});
};
const orderList = (req, res) => {
const orderList = (req, res, next) => {
const params = {
uid: req.user.uid || 8041876, // TODO: fix me
uid: req.cookies.installmentUid || 8041876, // TODO: fix me
type: req.query.type || 1,
page: req.query.page || 1,
limit: req.query.limit || 10
... ... @@ -270,15 +271,16 @@ const orderList = (req, res) => {
installmentModel.getInstallmentOrders(params).then((result)=> {
res.render('installment/order-list', {
title: '我的分期订单',
orders: result.data.orderList,
layout: false
orders: result.data ? result.data.orderList : [],
layout: false,
isInstallmentPage: true
});
});
}).catch(next);
};
const orderDetail = (req, res) => {
const orderDetail = (req, res, next) => {
const params = {
uid: req.user.id || 8041876, // TODO: fix me
uid: req.cookies.installmentUid || 8041876, // TODO: fix me
orderCode: req.params.id
};
... ... @@ -309,7 +311,7 @@ const orderDetail = (req, res) => {
}
}
});
});
}).catch(next);
};
// 还款详情
... ...
{{#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>
{{#if orders}}
{{#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 class="product-name">{{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}}
{{/if}}
<div class="right-box">
<div class="amount">¥{{amount}}</div>
<div class="status">{{installStatus}}</div>
</div>
<div class="clearfix"></div>
</li>
{{/each}}
... ...
<div class="installment-order-page">
<div class="repayment-list-page installment-order-page">
{{> resources/banner-top}}
<ul class="header-tab">
<li class="active">
... ... @@ -15,5 +15,10 @@
<div class="order-list-container">
<ul id="order-list" class="order-list">
</ul>
<div id="no-result" class="no-result" style="display: none;">
<i class="result-icon"></i>
<p class="txt" id="no-result-text">暂无订单</p>
<a href="/product/new" class="guang-btn">去逛逛</a>
</div>
</div>
</div>
... ...
... ... @@ -35,13 +35,13 @@
<div class="field">
<label for="name">手机号:</label>
<input id="name" name="mobile" type="text" placeholder="银行预留手机号码" maxlength="11"/>
<input id="mobile" name="mobile" type="text" placeholder="银行预留手机号码" maxlength="11"/>
<div class="clearfix"></div>
</div>
<div class="field">
<label for="name">验证码:</label>
<input id="name" name="snsCheckCode" type="text" placeholder="请输入验证码" size="14" maxlength="6"/>
<input id="sns-check-code" name="snsCheckCode" type="text" placeholder="请输入验证码" size="14" maxlength="6"/>
<button id="send-sms" class="count-down">获取验证码</button>
<div class="clearfix"></div>
</div>
... ...
... ... @@ -33,6 +33,14 @@ var loadOrderList = function(pageIndex, type) {
$(this).addClass('faded');
}
});
if ($('#order-list li').length === 0) {
$('#no-result').show();
$('#order-list').hide();
} else {
$('#order-list').show();
$('#no-result').hide();
}
});
}
};
... ...
... ... @@ -43,6 +43,11 @@ var validateForm = function() {
return ret;
};
const clearVerifyCode = function() {
formModel.snsCheckCode = '';
$('#sns-check-code').val('');
};
var debounceFn = debounce(function(cardNo) {
// 获取银行信息
$.get('/home/installment/bank-info', {cardNo: cardNo}).then(function(result) {
... ... @@ -183,6 +188,7 @@ setInterval(function() {
validateForm();
}, 500);
/**
* 表单提交
*/
... ... @@ -208,9 +214,13 @@ $('#apply-button').click(function() {
if (result.data.resultMsgType === '1') {
tip.show(result.data.resultMsg);
}
clearVerifyCode();
}
} else {
tip.show(result.message);
clearVerifyCode();
}
});
... ...
... ... @@ -2,3 +2,31 @@
@import "starting-service";
@import "repayment-list";
@import "order";
.no-result {
.result-icon {
width: 153px;
height: 197px;
background: resolve("home/review-img-3.png") no-repeat;
background-size: contain;
margin: 198px auto 36px;
display: block;
}
.txt {
text-align: center;
color: #444;
}
.guang-btn {
width: 472px;
height: 88px;
background: #444;
color: #fff;
text-align: center;
line-height: 88px;
border-radius: 6px;
margin: 110px auto 0;
display: block;
}
}
... ...
... ... @@ -57,8 +57,14 @@
.title-box {
margin-left: 22px;
width: 240px;
overflow: hidden;
width: 320px;
.product-name {
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
.date-box {
... ...
... ... @@ -124,34 +124,6 @@
}
}
.no-result {
.result-icon {
width: 153px;
height: 197px;
background: resolve("home/review-img-3.png") no-repeat;
background-size: contain;
margin: 198px auto 36px;
display: block;
}
.txt {
text-align: center;
color: #444;
}
.guang-btn {
width: 472px;
height: 88px;
background: #444;
color: #fff;
text-align: center;
line-height: 88px;
border-radius: 6px;
margin: 110px auto 0;
display: block;
}
}
.repay-now {
width: 100%;
background: #fff;
... ...