Authored by 王水玲

分期3

... ... @@ -108,22 +108,35 @@ const index = (req, res) => {
};
if (openStatus === '0') {
return installmentModel.getResources().then(data => {
if (data[0] && data[0].data[0]) {
data[0].data[0].url = 'javascript:void(0)'; //eslint-disable-line
}
return installmentModel.getResources('0876085ff46bed27f1a1eb6ee8b68987').then(data => {
//if (data[0] && data[0].data[0]) {
// data[0].data[0].url = 'javascript:void(0)'; //eslint-disable-line
//}
console.log(data);
_.forEach(data, (item) => {
if (item.singleOne) {
item.data[0].url = 'javascript:void(0)'; //eslint-disable-line
}
});
return {
bannerTop: data,
content: data,
notOpen: true,
installmentOnly: installmentOnly
};
});
} else if (openStatus === '2') {
return Promise.all([installmentModel.getQueryCreditInfo(uid), installmentModel.getQueryAmtInfo(uid)]).then((data) => { //eslint-disable-line
return Promise.all([
installmentModel.getQueryCreditInfo(uid),
installmentModel.getQueryAmtInfo(uid),
installmentModel.getResources('0876085ff46bed27f1a1eb6ee8b68987')
]).then((data) => {
let params = _.assign({
isOverdue: false,
installmentOnly: installmentOnly
installmentOnly: installmentOnly,
content: data[2]
}, data[0], data[1]);
// status: 1 正常 2 逾期 3 不可用 4 未开通
... ... @@ -608,6 +621,7 @@ const bankCard = (req, res) => {
const cardDetail = (req, res) => {
installmentModel.getCardDetail(req.cookies.installmentUid, req.query.cardIdNo).then(result => {
console.log(result);
res.render('installment/card-detail', {
module: 'home',
page: 'card-detail',
... ...
... ... @@ -171,30 +171,74 @@ const _processBankCards = (list) => {
// 银行卡详情数据处理
const _processCardDetail = (list, cardIdNo) => {
let res = {};
list = list || [];
_.forEach(list, (item) => {
if (item.cardIdNo === cardIdNo) {
item.isMaster = item.masterType || 1;
return item;
} else {
return {};
res = item;
}
});
return res;
};
/**
* 获取资源位数据
* @return {[array]}
*/
const getResources = () => {
const getResources = (code) => {
return serviceAPI.get('/operations/api/v5/resource/get', {
content_code: '0876085ff46bed27f1a1eb6ee8b68987'
content_code: code
}, {
cache: true
}).then((result) => {
if (result && result.code === 200) {
result.data = [
{
data: [
{
alt: "",
src: "http://img11.static.yhbimg.com/yhb-img01/2016/08/18/14/01064654393c04d83721d16b36f3a0d896.jpg?imageView2/{mode}/w/{width}/h/{height}",
title: "",
url: "http://www.yohobuy.com"
}
],
template_id: '11272',
template_intro: '一张图片',
template_name: 'single_image',
singleImage: true,
singleOne: true
},
{
data: [
{
url: "#",
title: "部分银行服务时间调整通知"
},
{
url: "#",
title: "aaa"
},
{
url: "#",
title: "bbb"
},
{
url: "#",
title: "ccc"
}
],
template_id: '11272',
template_intro: '公告',
template_name: 'notice',
time: 3,
announcement: true
}
];
return resourcesProcess(result.data);
} else {
logger.error('get resources data return code is not 200');
... ... @@ -504,6 +548,24 @@ const getCardDetail = (uid, cardIdNo) => {
}, {
timeout: API_TIMEOUT
}).then((result) => {
result = {
alg: "SALT_MD5",
code: 200,
data: [
{
id: "1",
userName: "*三",
cardNo: "0000",
bankCode: "ABC",
bankName: "农业银行",
mobile: "18021200000",
cardIdNo: "BK201610204789114",
masterType: "1"
}
],
md5: "6d729d4b35f10fc73531210bd7ecff91",
message: "success"
};
if (result && result.code === 200) {
return _processCardDetail(result.data, cardIdNo);
} else {
... ...
<div class="installment-page installment-bg yoho-page">
{{#if notOpen}}
<input type="hidden" value="false" class="is-open">
{{# bannerTop}}
{{> resources/banner-top}}
{{/ bannerTop}}
<div class="open-index">
<ul class="open-info">
<li>
<span class="open-icon-1"></span>
<span>先消费<br>后还款</span>
</li>
<li>
<span class="open-icon-2"></span>
<span>30天免息<br>灵活分期</span>
</li>
<li>
<span class="open-icon-3"></span>
<span>指定商品<br>立享优惠</span>
</li>
</ul>
<div class="loading-tip">下拉刷新</div>
<div class="installment-main">
<div class="main-content">
{{#if notOpen}}
<input type="hidden" value="false" class="is-open">
{{# content}}
{{#if singleImage}}
{{> resources/banner}}
{{/if}}
{{#announcement}}
{{> installment/installment-notice}}
{{/announcement}}
{{/ content}}
<div class="open-index">
<ul class="open-info">
<li>
<span class="open-icon-1"></span>
<span>先消费<br>后还款</span>
</li>
<li>
<span class="open-icon-2"></span>
<span>30天免息<br>灵活分期</span>
</li>
<li>
<span class="open-icon-3"></span>
<span>指定商品<br>立享优惠</span>
</li>
</ul>
<a href="/home/installment/starting-service" class="open-btn">立即开通</a>
</div>
<a href="/home/installment/starting-service" class="open-btn">立即开通</a>
</div>
{{# installmentOnly}}
{{> installment/installment-only}}
{{/ installmentOnly}}
{{else}}
<input type="hidden" value="true" class="is-open">
<div class="detail-tab">
<span class="on is-repay">待还款金额</span>
<span class="is-usable">可用额度</span>
</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">{{dayAmt}}</span></p>
{{#if isOverdue}}
<p class="detail-txt3">您有¥{{overAmt}}已逾期,点击<a href="/home/installment/repay/overdue" class="nav-bit" data-id="1">查看详情</a></p>
{{/if}}
<a href="/home/installment/repay/7daylist" class="see-btn nav-bit" data-id="2">明细</a>
</div>
<ul class="group-list">
<li><a href="/home/installment/repay/month" class="nav-bit" data-id="3">本月待还金额:<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" class="nav-bit" data-id="4">待还总金额:<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" class="nav-bit" data-id="5">还款记录:<div class="list-right iconfont">&#xe604;</div></a></li>
<li><a href="/home/installment/order" class="nav-bit" data-id="6">分期订单:<div class="list-right iconfont">&#xe604;</div></a></li>
</ul>
{{# installmentOnly}}
{{> installment/installment-only}}
{{/ installmentOnly}}
{{else}}
<input type="hidden" value="true" class="is-open">
<div class="detail-tab">
<span class="on is-repay">待还款金额</span>
<span class="is-usable">可用额度</span>
</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">{{dayAmt}}</span></p>
{{#if isOverdue}}
<p class="detail-txt3">您有¥{{overAmt}}已逾期,点击<a href="/home/installment/repay/overdue" class="nav-bit" data-id="1">查看详情</a></p>
{{/if}}
<a href="/home/installment/repay/7daylist" class="see-btn nav-bit" data-id="2">明细</a>
</div>
{{# content}}
{{#announcement}}
{{> installment/installment-notice}}
{{/announcement}}
{{/ content}}
<ul class="group-list">
<li><a href="/home/installment/repay/month" class="nav-bit" data-id="3">本月待还金额:<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" class="nav-bit" data-id="4">待还总金额:<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" class="nav-bit" data-id="5">还款记录:<div class="list-right iconfont">&#xe604;</div></a></li>
<li><a href="/home/installment/order" class="nav-bit" data-id="6">分期订单:<div class="list-right iconfont">&#xe604;</div></a></li>
</ul>
<ul class="group-list">
<li><a href="/home/installment/account" class="nav-bit" data-id="7">账户管理:<span class="list-right iconfont">&#xe604;</span></a></li>
</ul>
</div>
<div class="usable installment-cont">
<div class="usable-area detail-bg">
{{#replayStatus}}<div class="replay-status">{{.}}</div>{{/replayStatus}}
<p class="detail-txt1">可用额度</p>
<p class="detail-txt1">¥<span class="detail-txt2">{{currCreditLimit}}</span></p>
<p class="detail-txt1">总额度:¥{{initCreditLimit}}</p>
<a href="/home/installment/agreement" class="terms">服务条款</a>
</div>
{{# installmentOnly}}
{{> installment/installment-only}}
{{/ installmentOnly}}
<ul class="group-list">
<li><a href="/home/installment/account" class="nav-bit" data-id="7">账户管理:<span class="list-right iconfont">&#xe604;</span></a></li>
</ul>
{{# content}}
{{#if singleImage}}
{{> installment/installment-banner}}
{{/if}}
{{/ content}}
</div>
<div class="usable installment-cont">
<div class="usable-area detail-bg">
{{#replayStatus}}<div class="replay-status">{{.}}</div>{{/replayStatus}}
<p class="detail-txt1">可用额度</p>
<p class="detail-txt1">¥<span class="detail-txt2">{{currCreditLimit}}</span></p>
<p class="detail-txt1">总额度:¥{{initCreditLimit}}</p>
<a href="/home/installment/agreement" class="terms">服务条款</a>
</div>
{{# installmentOnly}}
{{> installment/installment-only}}
{{/ installmentOnly}}
</div>
{{/if}}
</div>
{{/if}}
</div>
</div>
... ...
<div class="banner-center banner-center-swiper">
{{#if singleOne}}
{{#data}}
<div class="banner-list">
<a href="{{url}}">
<img src="{{image src 640 210}}" alt="">
</a>
</div>
{{/data}}
{{else}}
<ul class="banner-list swiper-wrapper clearfix">
{{#data}}
<li class="swiper-slide">
<a href="{{url}}">
<img src="{{image src 640 210}}" alt="">
</a>
</li>
{{/data}}
</ul>
{{/if}}
<div class="swiper-pagination">
<div class="pagination-inner">
</div>
</div>
</div>
... ...
<div class="notice-wrap clearfix">
<div class="notice" data-time="{{time}}">
<span class="notice-icon"></span>
{{#data}}
<a class="notice-item item-{{@index}}" href="{{url}}">
{{title}}
</a>
{{/data}}
</div>
</div>
... ...
... ... @@ -44,7 +44,7 @@ var cardDetail = {
},
dialogAction: function(params) {
var self = this;
dialog.showDialog({
dialogText: params.text,
hasFooter: {
... ...
... ... @@ -2,17 +2,43 @@ var $ = require('yoho-jquery'),
ellipsis = require('yoho-mlellipsis'),
ListData = require('./installment-goods'),
bp = require('./burying-point'),
PullRefresh = require('../plugin/pull-refresh'),
noticeScroll = require('../plugin/notice-scroll'),
uuid = require('uuid'),
lazyLoad = require('yoho-jquery-lazyload');
var uuidVal = uuid.v4();
var uuidVal = uuid.v4(),
$tab = $('.detail-tab span'),
$isOpen = $('.is-open'),
$installmentCont = $('.installment-cont');
require('../common');
var starIScroll;
require('../common');
noticeScroll('.notice', $('.notice').data('time') * 1000);
lazyLoad($('img.lazy'));
ellipsis.init();
$(window).on('mousewheel', false);
if ($isOpen.val() === 'true') {
// 下拉刷新
starIScroll = new PullRefresh('.installment-main', {
pullDown: function() {
if($('.detail-tab .on').index() === 0) {
location.href = '/home/installment/index?uid=20000184&tab=1';
} else {
location.href = '/home/installment/index?uid=20000184&tab=2';
}
}
});
starIScroll.iScroll.on('scroll', function() {
$(window).trigger('scroll');
});
}
// 商品列表翻页加载数据
new ListData({
url: '/home/installment/get-goods',
... ... @@ -35,12 +61,18 @@ function setDetailText() {
setDetailText();
if (window.queryString.tab === '2') {
$tab.eq(1).addClass('on').siblings().removeClass('on');
$installmentCont.hide().eq(1).show();
starIScroll.iScroll.refresh();
}
// 已开通tab 切换
$('.detail-tab span').on('click', function() {
$tab.on('click', function() {
var labId = 1;
$(this).addClass('on').siblings().removeClass('on');
$('.installment-cont').hide().eq($(this).index()).show();
$installmentCont.hide().eq($(this).index()).show();
if ($(this).index() === 1) {
setDetailText();
... ... @@ -52,6 +84,8 @@ $('.detail-tab span').on('click', function() {
bp.setContYas('YB_INST_OPENED_HOME_CLICK', {
LAB_ID: labId
});
starIScroll.iScroll.refresh();
});
// 统计:开通按钮点击时
... ... @@ -82,7 +116,7 @@ $(window).load(function() {
if ($('.installment-only').length > 0) {
// 统计:进入页面时
bp.setContYas('YB_INST_HOME', {
IS_OPEN: $('.is-open').val()
IS_OPEN: $isOpen.val()
});
// 统计:商品第一页加载时
... ... @@ -93,7 +127,7 @@ $(window).load(function() {
REC_ID: uuidVal
});
if ($('.is-open').val() === 'true') {
if ($isOpen.val() === 'true') {
// 统计:待还款金额默认页面加载时
bp.setContYas('YB_INST_OPENED_HOME_LOAD', {
... ...
... ... @@ -6,12 +6,11 @@
var $ = require('yoho-jquery');
function noticeScroll(selecter, time) {
var $notice = $(selecter),
var $notice = $(selecter || '.notice'),
$noticeItem = $notice.find('.notice-item'),
count = $noticeItem.length,
i = 1;
selecter = selecter || '.notice';
time = time || 3000;
if (count > 1) {
... ... @@ -19,6 +18,7 @@ function noticeScroll(selecter, time) {
if (i >= count) {
i = 0;
}
$noticeItem.fadeOut();
$notice.find('.item-' + i).fadeIn();
i++;
... ...
... ... @@ -43,8 +43,8 @@
.notice-icon {
display: inline-block;
margin-right: 10px;
width: 28px;
height: 28px;
width: 23px;
height: 22px;
background: url("/channel/volume.png");
vertical-align: middle;
}
... ...
.installment-page {
font-weight: 300;
position: relative;
.banner-swiper {
height: 200px;
... ... @@ -10,6 +11,54 @@
max-height: 200px;
}
.banner-center {
margin-top: 0;
}
.installment-main {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
height: calc(100vh);
}
.loading-tip {
position: absolute;
width: 100%;
top: 20px;
left: 50%;
transform: translate(-50%, 0);
padding: 30px 0;
text-align: center;
color: #ccc;
font-size: 18px;
}
.notice {
width: 100%;
height: 69px;
border-bottom: 1px solid #efefef;
.notice-item {
width: 540px;
line-height: 69px;
float: left;
}
.notice-icon {
float: left;
margin-right: 10px;
width: 23px;
height: 22px;
background: resolve("channel/volume.png") no-repeat;
background-size: contain;
position: relative;
top: 22px;
}
}
.open-index {
background: #fff;
height: auto;
... ... @@ -276,6 +325,8 @@
.detail-txt2 {
font-size: 60px;
margin-top: 10px;
display: inline-block;
}
.detail-txt3 {
... ... @@ -336,8 +387,23 @@
}
}
.repay {
.banner-center {
margin-top: 30px;
height: 210px;
.banner-list {
height: 210px;
}
}
.notice {
border-bottom: 1px solid #e1e1e1;
}
}
.repay-area {
height: 345px;
height: 325px;
}
.usable {
... ... @@ -346,11 +412,7 @@
.usable-area {
position: relative;
height: 510px;
.detail-txt1 {
margin-top: 15px;
}
height: 330px;
.replay-status {
position: absolute;
... ... @@ -367,7 +429,7 @@
.terms {
display: block;
margin: 155px auto 0;
margin: 30px auto 0;
color: #fff;
text-decoration: underline;
}
... ...