Authored by 毕凯

Merge branch 'feature/installment' into 'release/6.3'

Feature/installment



See merge request !1125
@@ -21,7 +21,7 @@ const _serverCrash = (res, params, err, next) => { @@ -21,7 +21,7 @@ const _serverCrash = (res, params, err, next) => {
21 }; 21 };
22 22
23 const _banksInit = () => { 23 const _banksInit = () => {
24 - const banks = ['农业银行', '中国银行', '工商银行', '建设银行', '光大银行', '兴业银行', '邮储银行', '民生银行', '中信银行', '广发银行']; 24 + const banks = ['农业银行', '中国银行', '工商银行', '建设银行', '光大银行', '兴业银行', '邮储银行', '中信银行', '广发银行'];
25 25
26 if (new Date() >= new Date('2016-10-18 00:00:00')) { 26 if (new Date() >= new Date('2016-10-18 00:00:00')) {
27 // 2016年10月12日至17日 平安银行业务暂停(平安银行期间不支持服务) 27 // 2016年10月12日至17日 平安银行业务暂停(平安银行期间不支持服务)
@@ -676,12 +676,21 @@ const bankCard = (req, res, next) => { @@ -676,12 +676,21 @@ const bankCard = (req, res, next) => {
676 let uid = req.user.uid; 676 let uid = req.user.uid;
677 677
678 installmentModel.getBankCards(uid).then((result) => { 678 installmentModel.getBankCards(uid).then((result) => {
  679 + let noBank = true;
  680 +
  681 + _.forEach(result, (val) => {
  682 + if (val.validStatus === false) {
  683 + noBank = false;
  684 + }
  685 + });
  686 +
679 res.render('installment/bank-card', { 687 res.render('installment/bank-card', {
680 module: 'home', 688 module: 'home',
681 page: 'bank-card', 689 page: 'bank-card',
682 title: '我的银行卡', 690 title: '我的银行卡',
683 isInstallmentPage: true, 691 isInstallmentPage: true,
684 accountList: result, 692 accountList: result,
  693 + noBank: noBank,
685 userName: _.get(result, '[0].userName') 694 userName: _.get(result, '[0].userName')
686 }); 695 });
687 }).catch((err) => { 696 }).catch((err) => {
@@ -153,6 +153,7 @@ const _processBankCards = (list) => { @@ -153,6 +153,7 @@ const _processBankCards = (list) => {
153 153
154 _.forEach(list, (data) => { 154 _.forEach(list, (data) => {
155 data.url = '/home/installment/card-detail?cardIdNo=' + data.cardIdNo; 155 data.url = '/home/installment/card-detail?cardIdNo=' + data.cardIdNo;
  156 + data.validStatus = data.validStatus === '0';
156 157
157 // 正则替换卡号,保留后4位 158 // 正则替换卡号,保留后4位
158 data.cardNo = data.cardNo.replace(/(\d+)(\d{4})$/, function(a, b, c) { 159 data.cardNo = data.cardNo.replace(/(\d+)(\d{4})$/, function(a, b, c) {
1 <div class="bank-card-page"> 1 <div class="bank-card-page">
  2 + {{#if noBank}}
  3 + <div class="card-tips">
  4 + <div class="left">
  5 + <p>您设置的银行卡所属银行已暂停服务,</p>
  6 + <p>为了不影响您的还款,请更换银行卡</p>
  7 + </div>
  8 + <div class="right">
  9 + <a class="iconfont" href="//m.yohobuy.com/home/installment/bind-card">去更换&nbsp;&#xe604;</a>
  10 + </div>
  11 + </div>
  12 + {{/if}}
2 <div class="bank-card-list" data-user="{{userName}}"> 13 <div class="bank-card-list" data-user="{{userName}}">
3 {{#accountList}} 14 {{#accountList}}
4 - <a class="card-bg-{{lowerCase bankCode}} card-nav" href="{{url}}"><span>{{cardNo}}</span></a> 15 + <a class="card-bg-{{lowerCase bankCode}} card-nav" href="{{url}}">
  16 + <span>{{cardNo}}</span>
  17 + {{#if validStatus}}
  18 + <div class="out-of-service">暂停服务</div>
  19 + {{/if}}
  20 + </a>
5 {{/accountList}} 21 {{/accountList}}
6 </div> 22 </div>
7 </div> 23 </div>
@@ -3,6 +3,36 @@ @@ -3,6 +3,36 @@
3 padding: 30px 30px 0; 3 padding: 30px 30px 0;
4 } 4 }
5 5
  6 + .card-tips {
  7 + width: 100%;
  8 + height: 88px;
  9 + background-color: #ff8080;
  10 + font-size: 24px;
  11 + padding: 10px 25px;
  12 +
  13 + .left {
  14 + float: left;
  15 + width: 420px;
  16 + height: 68px;
  17 + line-height: 34px;
  18 + font-size: 24px;
  19 + color: #fff;
  20 + }
  21 +
  22 + .right {
  23 + float: right;
  24 + width: 170px;
  25 + height: 68px;
  26 + line-height: 68px;
  27 + text-align: right;
  28 +
  29 + .iconfont {
  30 + color: #fff;
  31 + font-size: 20px;
  32 + }
  33 + }
  34 + }
  35 +
6 .card-nav { 36 .card-nav {
7 width: 100%; 37 width: 100%;
8 height: 200px; 38 height: 200px;
@@ -20,6 +50,20 @@ @@ -20,6 +50,20 @@
20 color: #fff; 50 color: #fff;
21 font-size: 40px; 51 font-size: 40px;
22 } 52 }
  53 +
  54 + .out-of-service {
  55 + width: 120px;
  56 + height: 40px;
  57 + border-radius: 6px;
  58 + background-color: #fff;
  59 + font-size: 24px;
  60 + color: #ff575c;
  61 + line-height: 40px;
  62 + text-align: center;
  63 + position: absolute;
  64 + top: 20px;
  65 + right: 20px;
  66 + }
23 } 67 }
24 68
25 .card-bg-abc { 69 .card-bg-abc {