Authored by 王水玲

有货分期

... ... @@ -11,7 +11,7 @@ const _ = require('lodash');
const helpers = global.yoho.helpers;
// 判断是否已经获取到了开通的状态值
const _reviewStatus = (status) => {
const _reviewStatus = (uid, status) => {
if (status === 1) {
return {
review: {
... ... @@ -19,13 +19,13 @@ const _reviewStatus = (status) => {
}
};
} else if (status === 2) {
return installmentModel.getSearchIntallment().then((goods) => {
return Promise.all([installmentModel.getSearchIntallment(), installmentModel.getQueryCreditInfo(uid)]).then((result) => {
return {
success: {
price: '5000',
price: result[1].initCreditLimit,
installmentOnly: {
title: '分期专享',
goods: goods
goods: result[0]
}
}
};
... ... @@ -51,11 +51,7 @@ const _repaymentList = (req, res, next, title, params) => {
module: 'home',
page: 'repayment-list',
title: title,
data: result,
pageHeader: headerModel.setNav({
navTitle: title,
navBtn: false
})
data: result
});
}).catch(next);
};
... ... @@ -72,13 +68,7 @@ const index = (req, res, next) => {
if (openStatus === 0) {
return installmentModel.getResources().then(data => {
return {
bannerTop: {
// data: [{
// src: '', //eslint-disable-line
// url: ''
// }]
data: data
},
bannerTop: data,
notOpen: true,
installmentOnly: {
title: '分期专享',
... ... @@ -112,12 +102,12 @@ const index = (req, res, next) => {
res.redirect('/home/installment/review?status=' + openStatus);
}
}).then((result) => {
result.pageHeader = _.assign({
installmentPage: true
}, headerModel.setNav({
navTitle: '有货分期',
navBtn: false
}));
// result.pageHeader = _.assign({
// installmentPage: true
// }, headerModel.setNav({
// navTitle: '有货分期',
// navBtn: false
// }));
res.render('installment/open-index', _.assign({
module: 'home',
... ... @@ -134,18 +124,14 @@ const review = (req, res, next) => {
let data = {
module: 'home',
page: 'installment',
title: '有货分期',
pageHeader: headerModel.setNav({
navTitle: '有货分期',
navBtn: false
})
title: '有货分期'
};
if (openStatus) {
res.render('installment/open-result', _.assign(data, _reviewStatus(+openStatus)));
res.render('installment/open-result', _.assign(data, _reviewStatus(uid, +openStatus)));
} else {
installmentModel.getStauts(uid).then((status) => {
return _reviewStatus(status);
return _reviewStatus(uid, status);
}).then((params) => {
res.render('installment/open-result', _.assign(data, params));
}).catch(next);
... ... @@ -185,11 +171,7 @@ const repayRecordPage = (req, res) => {
res.render('installment/repay-record', {
module: 'home',
page: 'repay-record',
title: '还款记录',
pageHeader: headerModel.setNav({
navTitle: '还款记录',
navBtn: false
})
title: '还款记录'
});
};
... ... @@ -220,11 +202,7 @@ const account = (req, res, next) => {
res.render('installment/account', {
accountList: result,
title: '账号管理',
repaymentList: result,
pageHeader: headerModel.setNav({
navTitle: '账号管理',
navBtn: false
})
repaymentList: result
});
}).catch(next);
};
... ... @@ -309,6 +287,11 @@ const orderDetail = (req, res) => {
});
};
// 还款详情
const repayDetail = (req, res) => {
res.render('installment/repay-detail');
};
module.exports = {
index,
review,
... ... @@ -325,5 +308,6 @@ module.exports = {
account,
orderIndex,
orderList,
orderDetail
orderDetail,
repayDetail
};
... ...
... ... @@ -44,6 +44,7 @@ const _processAmtList = (list, queryDays) => {
}
data.day = Math.abs(data.unExpireDays);
data.url = `/home/installment/order/${data.billNo}`;
});
... ... @@ -154,7 +155,7 @@ const _processBankCards = (list) => {
* @return {[array]}
*/
const getResources = () => {
return serviceAPI.get('operations/api/v5/resource/get', {
return serviceAPI.get('/operations/api/v5/resource/get', {
content_code: '0876085ff46bed27f1a1eb6ee8b68987'
}, {
cache: true
... ... @@ -228,22 +229,21 @@ const getQueryAmtInfo = (uid) => {
method: 'app.order.queryAmtInfo',
uid: uid
}).then((result) => {
// result = {
// alg: 'SALT_MD5',
// code: 200,
// data: {
// totalAmt: '2000.00',
// monthAmt: '800.00',
// _7daysAmt: '400.00',
// overAmt: '400.00'
// },
// md5: 'c1d725306fb09dcbf504776d276521cb',
// message: 'ok'
// };
result = {
alg: 'SALT_MD5',
code: 200,
data: {
totalAmt: '2000.00',
monthAmt: '800.00',
s_7daysAmt: '400.00',
overAmt: '400.00'
},
md5: 'c1d725306fb09dcbf504776d276521cb',
message: 'ok'
};
console.log(result);
if (result && result.code === 200) {
result.data.dayAmt = result.data._7daysAmt;
result.data.dayAmt = result.data.s_7daysAmt;
return result.data;
} else {
logger.error('get user installment repay info return code is not 200');
... ... @@ -314,8 +314,8 @@ const getQueryAmtList = (params) => {
// 分期专享推荐商品
const getSearchIntallment = () => {
return api.post('', {
// method: 'app.search.instalment',
method: 'app.search.newProduct',
method: 'app.search.instalment',
// method: 'app.search.newProduct',
limit: '50',
order: 's_t_desc'
}, {
... ...
... ... @@ -17,14 +17,13 @@ router.get('/installment/index', installment.index);// 开通分期首页
router.get('/installment/review', installment.review); // 开通分期首页
router.get('/installment/starting-service', installment.startingService); // 分期付款开通
router.get('/installment/starting-service/verify-code', installment.verifyCode);
router.get('/installment/overdue', installment.overdueList); // 逾期未还款列表
router.get('/installment/7daylist', installment.sevenDayList); // 7日待还款列表
// TODO: Use dashed-lower-case only!
router.get('/installment/monthRepayList', installment.monthRepayList); // 本月待还款列表
router.get('/installment/totalRepayList', installment.totalRepayList); // 待还总金额列表
router.get('/installment/repayRecord', installment.repayRecordPage); // 还款记录
router.get('/installment/getRepayRecord', installment.getRepayRecord); // ajax请求还款记录
router.get('/installment/repay/overdue', installment.overdueList); // 逾期未还款列表
router.get('/installment/repay/7daylist', installment.sevenDayList); // 7日待还款列表
router.get('/installment/repay/month', installment.monthRepayList); // 本月待还款列表
router.get('/installment/repay/total', installment.totalRepayList); // 待还总金额列表
router.get('/installment/repay/record', installment.repayRecordPage); // 还款记录
router.get('/installment/repay/get-record', installment.getRepayRecord); // ajax请求还款记录
router.get('/installment/repay/detail', installment.repayDetail); // 还款详情
router.get('/installment/account', installment.account); // 账户管理
router.get('/installment/bank-info', installment.getBankInfo);
... ... @@ -32,4 +31,5 @@ router.post('/installment/activate-service', installment.activateService);
router.get('/installment/order', installment.orderIndex);
router.get('/installment/order.html', installment.orderList);
router.get('/installment/order/:id', installment.orderDetail);
module.exports = router;
... ...
... ... @@ -33,17 +33,17 @@
</div>
<div class="repay installment-cont">
<div class="repay-area detail-bg">
<p class="detail-txt1">近7日代还款</p>
<p class="detail-txt1">¥<span class="detail-txt2">{{round dayAmt}}</span></p>
<p class="detail-txt1">近7日待还款</p>
<p class="detail-txt1">¥<span class="detail-txt2">{{dayAmt}}</span></p>
{{#if isOverdue}}
<p class="detail-txt3">您有¥{{round overAmt}}已逾期,点击<a href="/home/installment/overdue">查看详情</a></p>
<p class="detail-txt3">您有¥{{overAmt}}已逾期,点击<a href="/home/installment/repay/overdue">查看详情</a></p>
{{/if}}
<a href="/home/installment/7daylist" class="see-btn">明细</a>
<a href="/home/installment/repay/7daylist" class="see-btn">明细</a>
</div>
<ul class="group-list">
<li><a href="/home/installment/monthRepayList">本月待还金额:<div class="list-right"><span class="list-r-txt">¥{{monthAmt}}</span><span class="iconfont"> &#xe604;</span></div></a></li>
<li><a href="/home/installment/totalRepayList">待还总金额:<div class="list-right"><span class="list-r-txt">¥{{totalAmt}}</span><span class="iconfont"> &#xe604;</span></div></a></li>
<li><a href="/home/installment/repayRecord">还款记录:<div class="list-right iconfont">&#xe604;</div></a></li>
<li><a href="/home/installment/repay/month">本月待还金额:<div class="list-right"><span class="list-r-txt">¥{{monthAmt}}</span><span class="iconfont"> &#xe604;</span></div></a></li>
<li><a href="/home/installment/repay/total">待还总金额:<div class="list-right"><span class="list-r-txt">¥{{totalAmt}}</span><span class="iconfont"> &#xe604;</span></div></a></li>
<li><a href="/home/installment/repay/record">还款记录:<div class="list-right iconfont">&#xe604;</div></a></li>
<li><a href="/home/installment/order">分期订单:<div class="list-right iconfont">&#xe604;</div></a></li>
</ul>
... ...
<div class="repayment-list-page">
<div class="repay-now">本次还款<span>¥</span></div>
<div class="repay-detail">
<ul class="repay-status">
<li>
<span>付款</span>
<span class="spot"></span>
</li>
<li>
<span>银行处理</span>
<span class="spot"></span>
</li>
<li>
<span>还款结果</span>
<span class="spot"></span>
</li>
</ul>
<p>预计1-2分钟内还款成功,请到还款记录查看还款结果</p>
</div>
<a href="" class="contact-cs">如有问题请联系客服</a>
</div>
\ No newline at end of file
... ...
... ... @@ -17,5 +17,5 @@
<p class="repay-price">待支付:<span>¥<span class="curr-amt">{{round currAmtCount}}</span></span></p>
{{#if isCurrFee}}<p class="serve-price">含服务费¥<span class="curr-fee">{{round currFeeCount}}</span></p>{{/if}}
</label>
<input type="button" value="立即还款" class="repayment-btn">
</div>
<a href="" class="repayment-btn">立即还款</a>
</div>
\ No newline at end of file
... ...
... ... @@ -31,4 +31,13 @@ if ($('.installment-bg').length > 0) {
$('.detail-tab span').on('click', function() {
$(this).addClass('on').siblings().removeClass('on');
$('.installment-cont').hide().eq($(this).index()).show();
if ($(this).index() === 1) {
$('.good-detail-text .name').each(function() {
$this = $(this);
$title = $this.find('a');
$title[0].mlellipsis(2);
});
}
});
... ...
... ... @@ -26,7 +26,7 @@ function getListData(pageData) {
loading.showLoadingMask();
$.ajax({
type: 'GET',
url: '/home/installment/getRepayRecord',
url: '/home/installment/repay/get-record',
data: {
page: pageData
},
... ...
... ... @@ -6,7 +6,9 @@
var $ = require('yoho-jquery');
var $notice = $('.installment-overdue-notice');
var $notice = $('.installment-overdue-notice'),
$currAmt = $('.repayment-bottom').find('.curr-amt'),
$currFee = $('.repayment-bottom').find('.curr-fee');
$('.repay-list .notice').on('click', function() {
$notice.show();
... ... @@ -19,14 +21,12 @@ $('.think-ok, .mask-bg').on('click', function() {
});
$('.repay-list .cont').on('click', function() {
var $currAmt = $('.repayment-bottom').find('.curr-amt');
var $currFee = $('.repayment-bottom').find('.curr-fee');
var $input = $(this).parent().prev();
var currAmt = +$currAmt.html();
var currFee = +$currFee.html();
var amt = +$(this).parents('li').attr('data-curramt');
var fee = +$(this).parents('li').attr('data-currfee');
var count = 1;
var $input = $(this).parent().prev(),
currAmt = +$currAmt.html(),
currFee = +$currFee.html(),
amt = +$(this).parents('li').attr('data-curramt'),
fee = +$(this).parents('li').attr('data-currfee'),
count = 0;
if ($input.is(':checked')) {
$currAmt.html(currAmt - amt);
... ... @@ -35,16 +35,36 @@ $('.repay-list .cont').on('click', function() {
$currAmt.html(amt + currAmt);
$currFee.html(fee + currFee);
}
setTimeout(function(){
count = $('.repay-list input:checked').length;
$('#repayment-total').prop('checked', count === $('.repay-list li').length);
}, 0)
$('.repay-list input').each(function() {
if ($(this).is(':checked')) {
count++;
}
});
});
// 全选||全不选
$('.repayment-bottom label').on('click', function() {
var totalAmt = 0;
var totalFee = 0;
if (count === $('.repay-list li').length) {
$('#repayment-total').click();
if ($(this).prev().is(':checked')) {
$('.repay-list input').prop('checked', false);
$currAmt.html('0');
$currFee.html('0');
} else {
$('#repayment-total').click();
$('.repay-list input').prop('checked', true);
$('.repay-list li').each(function() {
totalAmt += (+$(this).attr('data-curramt'));
totalFee += (+$(this).attr('data-currfee'));
});
$currAmt.html(totalAmt);
$currFee.html(totalFee);
}
});
$('.repayment-btn').on('click', function() {
var path = location.pathname;
$(this).attr('href', path + '?openby:yohobuy={"action":"go.instalmentRepayment","params":{"amount":' + (+$currAmt.html()) + '}}');
});
\ No newline at end of file
... ...
... ... @@ -7,7 +7,6 @@
.cont {
width: 370px;
overflow: hidden;
height: 120px;
float: left;
margin-top: 20px;
... ... @@ -141,6 +140,54 @@
display: block;
}
}
.repay-now {
width: 100%;
background: #fff;
height: 120px;
border-bottom: 1px solid #e0e0e0;
text-align: center;
line-height: 120px;
font-size: 32px;
span {
color: #d0021b;
padding-left: 15px;
}
}
.repay-detail {
border-top: 1px solid #e0e0e0;
margin-top: 30px;
}
.repay-status {
width: 614px;
margin: 35px auto 0;
font-size: 32px;
height: auto;
overflow: hidden;
li {
float: left;
width: 134px;
text-align: center;
margin: 0 30px;
&:before {
}
}
.spot {
width: 19px;
height: 19px;
border-radius: 50%;
background: #b0b0b0;
display: block;
margin: 0 auto;
}
}
}
.installment-overdue-notice {
... ...