Authored by 王水玲

分期3

@@ -108,22 +108,35 @@ const index = (req, res) => { @@ -108,22 +108,35 @@ const index = (req, res) => {
108 }; 108 };
109 109
110 if (openStatus === '0') { 110 if (openStatus === '0') {
111 - return installmentModel.getResources().then(data => {  
112 - if (data[0] && data[0].data[0]) {  
113 - data[0].data[0].url = 'javascript:void(0)'; //eslint-disable-line 111 + return installmentModel.getResources('0876085ff46bed27f1a1eb6ee8b68987').then(data => {
  112 + //if (data[0] && data[0].data[0]) {
  113 + // data[0].data[0].url = 'javascript:void(0)'; //eslint-disable-line
  114 + //}
  115 +
  116 + console.log(data);
  117 +
  118 + _.forEach(data, (item) => {
  119 + if (item.singleOne) {
  120 + item.data[0].url = 'javascript:void(0)'; //eslint-disable-line
114 } 121 }
  122 + });
115 123
116 return { 124 return {
117 - bannerTop: data, 125 + content: data,
118 notOpen: true, 126 notOpen: true,
119 installmentOnly: installmentOnly 127 installmentOnly: installmentOnly
120 }; 128 };
121 }); 129 });
122 } else if (openStatus === '2') { 130 } else if (openStatus === '2') {
123 - return Promise.all([installmentModel.getQueryCreditInfo(uid), installmentModel.getQueryAmtInfo(uid)]).then((data) => { //eslint-disable-line 131 + return Promise.all([
  132 + installmentModel.getQueryCreditInfo(uid),
  133 + installmentModel.getQueryAmtInfo(uid),
  134 + installmentModel.getResources('0876085ff46bed27f1a1eb6ee8b68987')
  135 + ]).then((data) => {
124 let params = _.assign({ 136 let params = _.assign({
125 isOverdue: false, 137 isOverdue: false,
126 - installmentOnly: installmentOnly 138 + installmentOnly: installmentOnly,
  139 + content: data[2]
127 }, data[0], data[1]); 140 }, data[0], data[1]);
128 141
129 // status: 1 正常 2 逾期 3 不可用 4 未开通 142 // status: 1 正常 2 逾期 3 不可用 4 未开通
@@ -608,6 +621,7 @@ const bankCard = (req, res) => { @@ -608,6 +621,7 @@ const bankCard = (req, res) => {
608 const cardDetail = (req, res) => { 621 const cardDetail = (req, res) => {
609 622
610 installmentModel.getCardDetail(req.cookies.installmentUid, req.query.cardIdNo).then(result => { 623 installmentModel.getCardDetail(req.cookies.installmentUid, req.query.cardIdNo).then(result => {
  624 + console.log(result);
611 res.render('installment/card-detail', { 625 res.render('installment/card-detail', {
612 module: 'home', 626 module: 'home',
613 page: 'card-detail', 627 page: 'card-detail',
@@ -171,30 +171,74 @@ const _processBankCards = (list) => { @@ -171,30 +171,74 @@ const _processBankCards = (list) => {
171 171
172 // 银行卡详情数据处理 172 // 银行卡详情数据处理
173 const _processCardDetail = (list, cardIdNo) => { 173 const _processCardDetail = (list, cardIdNo) => {
  174 + let res = {};
  175 +
174 list = list || []; 176 list = list || [];
175 177
176 _.forEach(list, (item) => { 178 _.forEach(list, (item) => {
177 if (item.cardIdNo === cardIdNo) { 179 if (item.cardIdNo === cardIdNo) {
178 item.isMaster = item.masterType || 1; 180 item.isMaster = item.masterType || 1;
179 -  
180 - return item;  
181 - } else {  
182 - return {}; 181 + res = item;
183 } 182 }
184 }); 183 });
  184 +
  185 + return res;
185 }; 186 };
186 187
187 /** 188 /**
188 * 获取资源位数据 189 * 获取资源位数据
189 * @return {[array]} 190 * @return {[array]}
190 */ 191 */
191 -const getResources = () => { 192 +const getResources = (code) => {
192 return serviceAPI.get('/operations/api/v5/resource/get', { 193 return serviceAPI.get('/operations/api/v5/resource/get', {
193 - content_code: '0876085ff46bed27f1a1eb6ee8b68987' 194 + content_code: code
194 }, { 195 }, {
195 cache: true 196 cache: true
196 }).then((result) => { 197 }).then((result) => {
197 if (result && result.code === 200) { 198 if (result && result.code === 200) {
  199 + result.data = [
  200 + {
  201 + data: [
  202 + {
  203 + alt: "",
  204 + src: "http://img11.static.yhbimg.com/yhb-img01/2016/08/18/14/01064654393c04d83721d16b36f3a0d896.jpg?imageView2/{mode}/w/{width}/h/{height}",
  205 + title: "",
  206 + url: "http://www.yohobuy.com"
  207 + }
  208 + ],
  209 + template_id: '11272',
  210 + template_intro: '一张图片',
  211 + template_name: 'single_image',
  212 + singleImage: true,
  213 + singleOne: true
  214 + },
  215 + {
  216 + data: [
  217 + {
  218 + url: "#",
  219 + title: "部分银行服务时间调整通知"
  220 + },
  221 + {
  222 + url: "#",
  223 + title: "aaa"
  224 + },
  225 + {
  226 + url: "#",
  227 + title: "bbb"
  228 + },
  229 + {
  230 + url: "#",
  231 + title: "ccc"
  232 + }
  233 + ],
  234 + template_id: '11272',
  235 + template_intro: '公告',
  236 + template_name: 'notice',
  237 + time: 3,
  238 + announcement: true
  239 + }
  240 + ];
  241 +
198 return resourcesProcess(result.data); 242 return resourcesProcess(result.data);
199 } else { 243 } else {
200 logger.error('get resources data return code is not 200'); 244 logger.error('get resources data return code is not 200');
@@ -504,6 +548,24 @@ const getCardDetail = (uid, cardIdNo) => { @@ -504,6 +548,24 @@ const getCardDetail = (uid, cardIdNo) => {
504 }, { 548 }, {
505 timeout: API_TIMEOUT 549 timeout: API_TIMEOUT
506 }).then((result) => { 550 }).then((result) => {
  551 + result = {
  552 + alg: "SALT_MD5",
  553 + code: 200,
  554 + data: [
  555 + {
  556 + id: "1",
  557 + userName: "*三",
  558 + cardNo: "0000",
  559 + bankCode: "ABC",
  560 + bankName: "农业银行",
  561 + mobile: "18021200000",
  562 + cardIdNo: "BK201610204789114",
  563 + masterType: "1"
  564 + }
  565 + ],
  566 + md5: "6d729d4b35f10fc73531210bd7ecff91",
  567 + message: "success"
  568 + };
507 if (result && result.code === 200) { 569 if (result && result.code === 200) {
508 return _processCardDetail(result.data, cardIdNo); 570 return _processCardDetail(result.data, cardIdNo);
509 } else { 571 } else {
1 <div class="installment-page installment-bg yoho-page"> 1 <div class="installment-page installment-bg yoho-page">
  2 + <div class="loading-tip">下拉刷新</div>
  3 + <div class="installment-main">
  4 + <div class="main-content">
2 {{#if notOpen}} 5 {{#if notOpen}}
3 <input type="hidden" value="false" class="is-open"> 6 <input type="hidden" value="false" class="is-open">
4 - {{# bannerTop}}  
5 - {{> resources/banner-top}}  
6 - {{/ bannerTop}} 7 + {{# content}}
  8 + {{#if singleImage}}
  9 + {{> resources/banner}}
  10 + {{/if}}
  11 + {{#announcement}}
  12 + {{> installment/installment-notice}}
  13 + {{/announcement}}
  14 + {{/ content}}
7 <div class="open-index"> 15 <div class="open-index">
8 <ul class="open-info"> 16 <ul class="open-info">
9 <li> 17 <li>
@@ -41,6 +49,11 @@ @@ -41,6 +49,11 @@
41 {{/if}} 49 {{/if}}
42 <a href="/home/installment/repay/7daylist" class="see-btn nav-bit" data-id="2">明细</a> 50 <a href="/home/installment/repay/7daylist" class="see-btn nav-bit" data-id="2">明细</a>
43 </div> 51 </div>
  52 + {{# content}}
  53 + {{#announcement}}
  54 + {{> installment/installment-notice}}
  55 + {{/announcement}}
  56 + {{/ content}}
44 <ul class="group-list"> 57 <ul class="group-list">
45 <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> 58 <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>
46 <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> 59 <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>
@@ -51,6 +64,11 @@ @@ -51,6 +64,11 @@
51 <ul class="group-list"> 64 <ul class="group-list">
52 <li><a href="/home/installment/account" class="nav-bit" data-id="7">账户管理:<span class="list-right iconfont">&#xe604;</span></a></li> 65 <li><a href="/home/installment/account" class="nav-bit" data-id="7">账户管理:<span class="list-right iconfont">&#xe604;</span></a></li>
53 </ul> 66 </ul>
  67 + {{# content}}
  68 + {{#if singleImage}}
  69 + {{> installment/installment-banner}}
  70 + {{/if}}
  71 + {{/ content}}
54 </div> 72 </div>
55 <div class="usable installment-cont"> 73 <div class="usable installment-cont">
56 <div class="usable-area detail-bg"> 74 <div class="usable-area detail-bg">
@@ -65,4 +83,6 @@ @@ -65,4 +83,6 @@
65 {{/ installmentOnly}} 83 {{/ installmentOnly}}
66 </div> 84 </div>
67 {{/if}} 85 {{/if}}
  86 + </div>
  87 + </div>
68 </div> 88 </div>
  1 +<div class="banner-center banner-center-swiper">
  2 + {{#if singleOne}}
  3 + {{#data}}
  4 + <div class="banner-list">
  5 + <a href="{{url}}">
  6 + <img src="{{image src 640 210}}" alt="">
  7 + </a>
  8 + </div>
  9 + {{/data}}
  10 + {{else}}
  11 + <ul class="banner-list swiper-wrapper clearfix">
  12 + {{#data}}
  13 + <li class="swiper-slide">
  14 + <a href="{{url}}">
  15 + <img src="{{image src 640 210}}" alt="">
  16 + </a>
  17 + </li>
  18 + {{/data}}
  19 + </ul>
  20 + {{/if}}
  21 + <div class="swiper-pagination">
  22 + <div class="pagination-inner">
  23 + </div>
  24 + </div>
  25 +</div>
  1 +<div class="notice-wrap clearfix">
  2 + <div class="notice" data-time="{{time}}">
  3 + <span class="notice-icon"></span>
  4 + {{#data}}
  5 + <a class="notice-item item-{{@index}}" href="{{url}}">
  6 + {{title}}
  7 + </a>
  8 + {{/data}}
  9 + </div>
  10 +</div>
@@ -2,17 +2,43 @@ var $ = require('yoho-jquery'), @@ -2,17 +2,43 @@ var $ = require('yoho-jquery'),
2 ellipsis = require('yoho-mlellipsis'), 2 ellipsis = require('yoho-mlellipsis'),
3 ListData = require('./installment-goods'), 3 ListData = require('./installment-goods'),
4 bp = require('./burying-point'), 4 bp = require('./burying-point'),
  5 + PullRefresh = require('../plugin/pull-refresh'),
  6 + noticeScroll = require('../plugin/notice-scroll'),
5 uuid = require('uuid'), 7 uuid = require('uuid'),
6 lazyLoad = require('yoho-jquery-lazyload'); 8 lazyLoad = require('yoho-jquery-lazyload');
7 9
8 -var uuidVal = uuid.v4(); 10 +var uuidVal = uuid.v4(),
  11 + $tab = $('.detail-tab span'),
  12 + $isOpen = $('.is-open'),
  13 + $installmentCont = $('.installment-cont');
9 14
10 -require('../common'); 15 +var starIScroll;
11 16
  17 +require('../common');
12 18
  19 +noticeScroll('.notice', $('.notice').data('time') * 1000);
13 lazyLoad($('img.lazy')); 20 lazyLoad($('img.lazy'));
14 ellipsis.init(); 21 ellipsis.init();
15 22
  23 +$(window).on('mousewheel', false);
  24 +
  25 +if ($isOpen.val() === 'true') {
  26 + // 下拉刷新
  27 + starIScroll = new PullRefresh('.installment-main', {
  28 + pullDown: function() {
  29 + if($('.detail-tab .on').index() === 0) {
  30 + location.href = '/home/installment/index?uid=20000184&tab=1';
  31 + } else {
  32 + location.href = '/home/installment/index?uid=20000184&tab=2';
  33 + }
  34 + }
  35 + });
  36 +
  37 + starIScroll.iScroll.on('scroll', function() {
  38 + $(window).trigger('scroll');
  39 + });
  40 +}
  41 +
16 // 商品列表翻页加载数据 42 // 商品列表翻页加载数据
17 new ListData({ 43 new ListData({
18 url: '/home/installment/get-goods', 44 url: '/home/installment/get-goods',
@@ -35,12 +61,18 @@ function setDetailText() { @@ -35,12 +61,18 @@ function setDetailText() {
35 61
36 setDetailText(); 62 setDetailText();
37 63
  64 +if (window.queryString.tab === '2') {
  65 + $tab.eq(1).addClass('on').siblings().removeClass('on');
  66 + $installmentCont.hide().eq(1).show();
  67 + starIScroll.iScroll.refresh();
  68 +}
  69 +
38 // 已开通tab 切换 70 // 已开通tab 切换
39 -$('.detail-tab span').on('click', function() { 71 +$tab.on('click', function() {
40 var labId = 1; 72 var labId = 1;
41 73
42 $(this).addClass('on').siblings().removeClass('on'); 74 $(this).addClass('on').siblings().removeClass('on');
43 - $('.installment-cont').hide().eq($(this).index()).show(); 75 + $installmentCont.hide().eq($(this).index()).show();
44 76
45 if ($(this).index() === 1) { 77 if ($(this).index() === 1) {
46 setDetailText(); 78 setDetailText();
@@ -52,6 +84,8 @@ $('.detail-tab span').on('click', function() { @@ -52,6 +84,8 @@ $('.detail-tab span').on('click', function() {
52 bp.setContYas('YB_INST_OPENED_HOME_CLICK', { 84 bp.setContYas('YB_INST_OPENED_HOME_CLICK', {
53 LAB_ID: labId 85 LAB_ID: labId
54 }); 86 });
  87 +
  88 + starIScroll.iScroll.refresh();
55 }); 89 });
56 90
57 // 统计:开通按钮点击时 91 // 统计:开通按钮点击时
@@ -82,7 +116,7 @@ $(window).load(function() { @@ -82,7 +116,7 @@ $(window).load(function() {
82 if ($('.installment-only').length > 0) { 116 if ($('.installment-only').length > 0) {
83 // 统计:进入页面时 117 // 统计:进入页面时
84 bp.setContYas('YB_INST_HOME', { 118 bp.setContYas('YB_INST_HOME', {
85 - IS_OPEN: $('.is-open').val() 119 + IS_OPEN: $isOpen.val()
86 }); 120 });
87 121
88 // 统计:商品第一页加载时 122 // 统计:商品第一页加载时
@@ -93,7 +127,7 @@ $(window).load(function() { @@ -93,7 +127,7 @@ $(window).load(function() {
93 REC_ID: uuidVal 127 REC_ID: uuidVal
94 }); 128 });
95 129
96 - if ($('.is-open').val() === 'true') { 130 + if ($isOpen.val() === 'true') {
97 131
98 // 统计:待还款金额默认页面加载时 132 // 统计:待还款金额默认页面加载时
99 bp.setContYas('YB_INST_OPENED_HOME_LOAD', { 133 bp.setContYas('YB_INST_OPENED_HOME_LOAD', {
@@ -6,12 +6,11 @@ @@ -6,12 +6,11 @@
6 var $ = require('yoho-jquery'); 6 var $ = require('yoho-jquery');
7 7
8 function noticeScroll(selecter, time) { 8 function noticeScroll(selecter, time) {
9 - var $notice = $(selecter), 9 + var $notice = $(selecter || '.notice'),
10 $noticeItem = $notice.find('.notice-item'), 10 $noticeItem = $notice.find('.notice-item'),
11 count = $noticeItem.length, 11 count = $noticeItem.length,
12 i = 1; 12 i = 1;
13 13
14 - selecter = selecter || '.notice';  
15 time = time || 3000; 14 time = time || 3000;
16 15
17 if (count > 1) { 16 if (count > 1) {
@@ -19,6 +18,7 @@ function noticeScroll(selecter, time) { @@ -19,6 +18,7 @@ function noticeScroll(selecter, time) {
19 if (i >= count) { 18 if (i >= count) {
20 i = 0; 19 i = 0;
21 } 20 }
  21 +
22 $noticeItem.fadeOut(); 22 $noticeItem.fadeOut();
23 $notice.find('.item-' + i).fadeIn(); 23 $notice.find('.item-' + i).fadeIn();
24 i++; 24 i++;
@@ -43,8 +43,8 @@ @@ -43,8 +43,8 @@
43 .notice-icon { 43 .notice-icon {
44 display: inline-block; 44 display: inline-block;
45 margin-right: 10px; 45 margin-right: 10px;
46 - width: 28px;  
47 - height: 28px; 46 + width: 23px;
  47 + height: 22px;
48 background: url("/channel/volume.png"); 48 background: url("/channel/volume.png");
49 vertical-align: middle; 49 vertical-align: middle;
50 } 50 }
1 .installment-page { 1 .installment-page {
2 font-weight: 300; 2 font-weight: 300;
  3 + position: relative;
3 4
4 .banner-swiper { 5 .banner-swiper {
5 height: 200px; 6 height: 200px;
@@ -10,6 +11,54 @@ @@ -10,6 +11,54 @@
10 max-height: 200px; 11 max-height: 200px;
11 } 12 }
12 13
  14 + .banner-center {
  15 + margin-top: 0;
  16 + }
  17 +
  18 + .installment-main {
  19 + position: absolute;
  20 + left: 0;
  21 + top: 0;
  22 + width: 100%;
  23 + height: 100%;
  24 + height: calc(100vh);
  25 + }
  26 +
  27 + .loading-tip {
  28 + position: absolute;
  29 + width: 100%;
  30 + top: 20px;
  31 + left: 50%;
  32 + transform: translate(-50%, 0);
  33 + padding: 30px 0;
  34 + text-align: center;
  35 + color: #ccc;
  36 + font-size: 18px;
  37 + }
  38 +
  39 + .notice {
  40 + width: 100%;
  41 + height: 69px;
  42 + border-bottom: 1px solid #efefef;
  43 +
  44 + .notice-item {
  45 + width: 540px;
  46 + line-height: 69px;
  47 + float: left;
  48 + }
  49 +
  50 + .notice-icon {
  51 + float: left;
  52 + margin-right: 10px;
  53 + width: 23px;
  54 + height: 22px;
  55 + background: resolve("channel/volume.png") no-repeat;
  56 + background-size: contain;
  57 + position: relative;
  58 + top: 22px;
  59 + }
  60 + }
  61 +
13 .open-index { 62 .open-index {
14 background: #fff; 63 background: #fff;
15 height: auto; 64 height: auto;
@@ -276,6 +325,8 @@ @@ -276,6 +325,8 @@
276 325
277 .detail-txt2 { 326 .detail-txt2 {
278 font-size: 60px; 327 font-size: 60px;
  328 + margin-top: 10px;
  329 + display: inline-block;
279 } 330 }
280 331
281 .detail-txt3 { 332 .detail-txt3 {
@@ -336,8 +387,23 @@ @@ -336,8 +387,23 @@
336 } 387 }
337 } 388 }
338 389
  390 + .repay {
  391 + .banner-center {
  392 + margin-top: 30px;
  393 + height: 210px;
  394 +
  395 + .banner-list {
  396 + height: 210px;
  397 + }
  398 + }
  399 +
  400 + .notice {
  401 + border-bottom: 1px solid #e1e1e1;
  402 + }
  403 + }
  404 +
339 .repay-area { 405 .repay-area {
340 - height: 345px; 406 + height: 325px;
341 } 407 }
342 408
343 .usable { 409 .usable {
@@ -346,11 +412,7 @@ @@ -346,11 +412,7 @@
346 412
347 .usable-area { 413 .usable-area {
348 position: relative; 414 position: relative;
349 - height: 510px;  
350 -  
351 - .detail-txt1 {  
352 - margin-top: 15px;  
353 - } 415 + height: 330px;
354 416
355 .replay-status { 417 .replay-status {
356 position: absolute; 418 position: absolute;
@@ -367,7 +429,7 @@ @@ -367,7 +429,7 @@
367 429
368 .terms { 430 .terms {
369 display: block; 431 display: block;
370 - margin: 155px auto 0; 432 + margin: 30px auto 0;
371 color: #fff; 433 color: #fff;
372 text-decoration: underline; 434 text-decoration: underline;
373 } 435 }