Authored by 王水玲

分期3

@@ -606,10 +606,50 @@ const bankCard = (req, res) => { @@ -606,10 +606,50 @@ const bankCard = (req, res) => {
606 606
607 // 银行卡详情 607 // 银行卡详情
608 const cardDetail = (req, res) => { 608 const cardDetail = (req, res) => {
609 - res.render('installment/card-detail', {  
610 - title: '银行卡详情',  
611 - isInstallmentPage: true,  
612 - width750: true 609 +
  610 + installmentModel.getCardDetail(req.cookies.installmentUid, req.query.cardIdNo).then(result => {
  611 + res.render('installment/card-detail', {
  612 + module: 'home',
  613 + page: 'card-detail',
  614 + title: '银行卡详情',
  615 + isInstallmentPage: true,
  616 + width750: true,
  617 + cardDetail: result
  618 + });
  619 + });
  620 +};
  621 +
  622 +// 删除绑定
  623 +const delBankCard = (req, res) => {
  624 + let params = {
  625 + uid: req.cookies.installmentUid,
  626 + cardIdNo: req.query.cardIdNo
  627 + };
  628 +
  629 + installmentModel.delBankCard(params).then((result) => {
  630 + res.json(result);
  631 + }).catch(() => {
  632 + _serverCrash(res, {
  633 + url: req.originalUrl,
  634 + title: '银行卡详情'
  635 + });
  636 + });
  637 +};
  638 +
  639 +// 切换银行卡绑定
  640 +const setMasterCard = (req, res) => {
  641 + let params = {
  642 + uid: req.cookies.installmentUid,
  643 + cardIdNo: req.query.cardIdNo
  644 + };
  645 +
  646 + installmentModel.setMasterCard(params).then((result) => {
  647 + res.json(result);
  648 + }).catch(() => {
  649 + _serverCrash(res, {
  650 + url: req.originalUrl,
  651 + title: '银行卡详情'
  652 + });
613 }); 653 });
614 }; 654 };
615 655
@@ -640,5 +680,7 @@ module.exports = { @@ -640,5 +680,7 @@ module.exports = {
640 serverCrash, 680 serverCrash,
641 bankCard, 681 bankCard,
642 postAccount, 682 postAccount,
643 - cardDetail 683 + cardDetail,
  684 + delBankCard,
  685 + setMasterCard
644 }; 686 };
@@ -169,6 +169,21 @@ const _processBankCards = (list) => { @@ -169,6 +169,21 @@ const _processBankCards = (list) => {
169 return list; 169 return list;
170 }; 170 };
171 171
  172 +// 银行卡详情数据处理
  173 +const _processCardDetail = (list, cardIdNo) => {
  174 + list = list || [];
  175 +
  176 + _.forEach(list, (item) => {
  177 + if (item.cardIdNo === cardIdNo) {
  178 + item.isMaster = item.masterType || 1;
  179 +
  180 + return item;
  181 + } else {
  182 + return {};
  183 + }
  184 + });
  185 +};
  186 +
172 /** 187 /**
173 * 获取资源位数据 188 * 获取资源位数据
174 * @return {[array]} 189 * @return {[array]}
@@ -481,6 +496,41 @@ const postAccount = (params) => { @@ -481,6 +496,41 @@ const postAccount = (params) => {
481 }); 496 });
482 }; 497 };
483 498
  499 +// 获取银行卡详情
  500 +const getCardDetail = (uid, cardIdNo) => {
  501 + return api.get('', {
  502 + method: 'user.instalment.getBankCards',
  503 + uid: uid
  504 + }, {
  505 + timeout: API_TIMEOUT
  506 + }).then((result) => {
  507 + if (result && result.code === 200) {
  508 + return _processCardDetail(result.data, cardIdNo);
  509 + } else {
  510 + logger.error('get getBankCards data return code is not 200');
  511 + return '';
  512 + }
  513 + });
  514 +};
  515 +
  516 +// 解除银行卡绑定
  517 +const delBankCard = (params) => {
  518 + return api.get('', _.assign({
  519 + method: 'user.instalment.unbindCard'
  520 + }, params)).then((res) => {
  521 + return res;
  522 + });
  523 +};
  524 +
  525 +// 切换银行卡主卡
  526 +const setMasterCard = (params) => {
  527 + return api.get('', _.assign({
  528 + method: 'user.instalment.toggleCard'
  529 + }, params)).then((res) => {
  530 + return res;
  531 + });
  532 +};
  533 +
484 module.exports = { 534 module.exports = {
485 getStauts, 535 getStauts,
486 getQueryCreditInfo, 536 getQueryCreditInfo,
@@ -497,5 +547,8 @@ module.exports = { @@ -497,5 +547,8 @@ module.exports = {
497 getInstallmentOrderDetail, 547 getInstallmentOrderDetail,
498 totalAmount, 548 totalAmount,
499 checkVerifyCode, 549 checkVerifyCode,
500 - postAccount 550 + postAccount,
  551 + getCardDetail,
  552 + delBankCard,
  553 + setMasterCard
501 }; 554 };
@@ -132,6 +132,8 @@ router.get('/installment/agreement', installment.agreement);// æœåŠ¡åè®®é™æ€ @@ -132,6 +132,8 @@ router.get('/installment/agreement', installment.agreement);// æœåŠ¡åè®®é™æ€
132 router.get('/installment/server-crash', installment.serverCrash); // 服务器崩溃 132 router.get('/installment/server-crash', installment.serverCrash); // 服务器崩溃
133 router.get('/installment/bank-card', installment.bankCard); // 银行卡列表 133 router.get('/installment/bank-card', installment.bankCard); // 银行卡列表
134 router.get('/installment/card-detail', installment.cardDetail); // 银行卡详情 134 router.get('/installment/card-detail', installment.cardDetail); // 银行卡详情
  135 +router.get('/installment/delBankCard', installment.delBankCard); // 删除绑定
  136 +router.get('/installment/setMasterCard', installment.setMasterCard); // 切换主卡
135 137
136 router.get('/recommend-for-you/userCenter', recommendForYou.userCenter);// 为你优选 138 router.get('/recommend-for-you/userCenter', recommendForYou.userCenter);// 为你优选
137 139
1 <div class="card-detail-page yoho-page"> 1 <div class="card-detail-page yoho-page">
2 - <div class="card-detail">  
3 - <div class="card-icon-abc"></div>  
4 - <div class="card-right">  
5 - <p class="bank-name">{{bankName}}</p>  
6 - <p class="card-no">储蓄卡 | 尾号{{cardNo}}</p> 2 + {{#cardDetail}}
  3 + <div class="card-detail" data-card-id="{{cardIdNo}}">
  4 + <div class="card-icon card-icon-{{lowerCase bankCode}}"></div>
  5 + <div class="card-right">
  6 + <p class="bank-name">{{bankName}}</p>
  7 + <p class="card-no">储蓄卡 | 尾号{{cardNo}}</p>
  8 + </div>
7 </div> 9 </div>
8 - </div> 10 + <ul class="card-info">
  11 + <li><span class="txt-label">持卡人</span><span class="info-right card-user">{{userName}}</span></li>
  12 + <li><span class="txt-label">预留手机号</span><span class="info-right card-mobile">{{mobile}}</span></li>
  13 + <li>
  14 + <span class="txt-label">分期银行</span>
  15 + <span class="info-right card-bank">
  16 + {{#if isMaster}}
  17 + 主卡,用于支付验证和还款验证。
  18 + {{else}}
  19 + 副卡,仅用于还款验证。
  20 + {{/if}}
  21 + </span>
  22 + </li>
  23 + </ul>
  24 + <div class="tip-cont">
  25 + {{#if isMaster}}
  26 + <p>如果您更换银行预留手机号,请先新增其他还款银行卡,并将新增银行卡切换为主卡,并解除绑定此卡,再次重新绑定即可。</p>
  27 + {{else}}
  28 + <p>如果您更换银行预留手机号,请先将银行卡解除绑定,再次重新绑定即可。</p>
  29 +
  30 + <div class="card-btn">
  31 + <span class="relieve-btn">解除绑定</span>
  32 + <span class="change-btn">切换为主卡</span>
  33 + </div>
  34 + {{/if}}
  35 + </div>
  36 + {{/cardDetail}}
9 </div> 37 </div>
@@ -22,10 +22,10 @@ module.exports = { @@ -22,10 +22,10 @@ module.exports = {
22 // liveApi: 'http://api.live.yoho.cn/', 22 // liveApi: 'http://api.live.yoho.cn/',
23 // singleApi: 'http://single.yoho.cn/' 23 // singleApi: 'http://single.yoho.cn/'
24 24
25 - api: 'http://api-test1.yohops.com:9999/',  
26 - service: 'http://service-test1.yohops.com:9999/', 25 + api: 'http://api-test3.yohops.com:9999/',
  26 + service: 'http://service-test3.yohops.com:9999/',
27 liveApi: 'http://testapi.live.yohops.com:9999/', 27 liveApi: 'http://testapi.live.yohops.com:9999/',
28 - singleApi: 'http://api-test1.yohops.com:9999/' 28 + singleApi: 'http://api-test3.yohops.com:9999/'
29 29
30 // api: 'http://api.yoho.yohoops.org/', 30 // api: 'http://api.yoho.yohoops.org/',
31 // service: 'http://service.yoho.yohoops.org/', 31 // service: 'http://service.yoho.yohoops.org/',

18.5 KB | W: | H:

55.2 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
  1 +/**
  2 + * 银行卡详情
  3 + * @author: wsl<shuiling.wang@yoho.cn>
  4 + * @date: 2016/10/25
  5 + */
  6 +
  7 +var $ = require('yoho-jquery');
  8 +var tip = require('../plugin/tip');
  9 +var dialog = require('../plugin/dialog');
  10 +var cardDetail = {
  11 + init: function() {
  12 + var self = this,
  13 + $relieveBtn = $('.relieve-btn'),
  14 + $changeBtn = $('.change-btn');
  15 +
  16 + self.cardIdNo = $('.card-detail').data('cardId');
  17 +
  18 + if (window.queryString.setMaster) {
  19 + tip.show('切换成功!');
  20 + }
  21 +
  22 + $relieveBtn.on('click', function() {
  23 + self.dialogAction({
  24 + text: '你确定要解除绑定此卡吗?解除绑定后该银行卡将不出现在还款银行卡列表中。',
  25 + url: '/home/installment/delBankCard',
  26 + errorText: '解除失败',
  27 + successAction: function() {
  28 + tip.show('解除成功!');
  29 + window.location.href = '/home/installment/bank-card';
  30 + }
  31 + });
  32 + });
  33 +
  34 + $changeBtn.on('click', function() {
  35 + self.dialogAction({
  36 + text: '你确定要设置该银行卡为主卡吗?确定设置后原主卡将自动修改为副卡。',
  37 + url: '/home/installment/setMasterCard',
  38 + errorText: '切换失败',
  39 + successAction: function() {
  40 + window.location.href = '/home/installment/card-detail?setMaster=true';
  41 + }
  42 + });
  43 + });
  44 + },
  45 + dialogAction: function(params) {
  46 + var self = this;
  47 +
  48 + dialog.showDialog({
  49 + dialogText: params.text,
  50 + hasFooter: {
  51 + leftBtnText: '取消',
  52 + rightBtnText: '确定'
  53 + }
  54 + }, function() {
  55 + $.ajax({
  56 + type: 'GET',
  57 + url: params.url,
  58 + data: {
  59 + cardIdNo: self.cardIdNo
  60 + },
  61 + success: function(data) {
  62 + dialog.hideDialog();
  63 + if (data.code === 200) {
  64 + params.successAction();
  65 + } else {
  66 + tip.show(params.errorText);
  67 + }
  68 + self.flag = false;
  69 + },
  70 + error: function() {
  71 + tip.show(params.errorText);
  72 + self.flag = false;
  73 + }
  74 + });
  75 + });
  76 + }
  77 +};
  78 +
  79 +require('../common');
  80 +
  81 +$(function() {
  82 + cardDetail.init();
  83 +});
1 .card-detail-page { 1 .card-detail-page {
2 .card-detail { 2 .card-detail {
  3 + font-family: "黑体";
3 width: 100%; 4 width: 100%;
4 height: 120px; 5 height: 120px;
5 background: #ff575c; 6 background: #ff575c;
6 color: #fff; 7 color: #fff;
7 } 8 }
  9 +
  10 + .card-icon {
  11 + width: 80px;
  12 + height: 80px;
  13 + float: left;
  14 + margin: 20px 0 0 30px;
  15 + }
  16 +
  17 + .card-icon-abc {
  18 + background: url("/home/bank-icons/b-ABC.png") no-repeat;
  19 + }
  20 +
  21 + .card-icon-boc {
  22 + background: url("/home/bank-icons/b-BOC.png") no-repeat;
  23 + }
  24 +
  25 + .card-icon-ccb {
  26 + background: url("/home/bank-icons/b-CCB.png") no-repeat;
  27 + }
  28 +
  29 + .card-icon-ceb {
  30 + background: url("/home/bank-icons/b-CEB.png") no-repeat;
  31 + }
  32 +
  33 + .card-icon-cgb {
  34 + background: url("/home/bank-icons/b-CGB.png") no-repeat;
  35 + }
  36 +
  37 + .card-icon-cib {
  38 + background: url("/home/bank-icons/b-CIB.png") no-repeat;
  39 + }
  40 +
  41 + .card-icon-citic {
  42 + background: url("/home/bank-icons/b-CITIC.png") no-repeat;
  43 + }
  44 +
  45 + .card-icon-cmbc {
  46 + background: url("/home/bank-icons/b-CMBC.png") no-repeat;
  47 + }
  48 +
  49 + .card-icon-icbc {
  50 + background: url("/home/bank-icons/b-ICBC.png") no-repeat;
  51 + }
  52 +
  53 + .card-icon-payh {
  54 + background: url("/home/bank-icons/b-PAYH.png") no-repeat;
  55 + }
  56 +
  57 + .card-icon-psbc {
  58 + background: url("/home/bank-icons/b-PSBC.png") no-repeat;
  59 + }
  60 +
  61 + .card-right {
  62 + float: left;
  63 + margin-left: 10px;
  64 +
  65 + .bank-name {
  66 + font-size: 30px;
  67 + margin-top: 20px;
  68 + }
  69 +
  70 + .card-no {
  71 + font-size: 26px;
  72 + font-style: normal;
  73 + }
  74 + }
  75 +
  76 + .card-info {
  77 + background: #fff;
  78 + border-bottom: 1px solid #e0e0e0;
  79 + width: 100%;
  80 + height: auto;
  81 + overflow: hidden;
  82 + padding-left: 30px;
  83 + box-sizing: border-box;
  84 +
  85 + li {
  86 + height: 88px;
  87 + border-bottom: 1px solid #e0e0e0;
  88 + line-height: 88px;
  89 +
  90 + .txt-label {
  91 + width: 220px;
  92 + text-align: left;
  93 + font-size: 34px;
  94 + color: #444;
  95 + float: left;
  96 + }
  97 +
  98 + .info-right {
  99 + float: left;
  100 + color: #444;
  101 + font-size: 28px;
  102 + }
  103 + }
  104 +
  105 + li:last-child {
  106 + border-bottom: none;
  107 + }
  108 + }
  109 +
  110 + .tip-cont {
  111 + p {
  112 + color: #b0b0b0;
  113 + font-size: 22px;
  114 + line-height: 30px;
  115 + padding: 25px 25px 0;
  116 + }
  117 +
  118 + .card-btn {
  119 + width: 656px;
  120 + margin: 94px auto 0;
  121 + font-size: 28px;
  122 + line-height: 88px;
  123 + }
  124 +
  125 + span {
  126 + float: left;
  127 + width: 312px;
  128 + height: 88px;
  129 + border-radius: 10px;
  130 + text-align: center;
  131 + cursor: pointer;
  132 + }
  133 +
  134 + .relieve-btn {
  135 + background: #fff;
  136 + border: 1px solid #444;
  137 + color: #444;
  138 + margin-right: 30px;
  139 + }
  140 +
  141 + .change-btn {
  142 + background: #444;
  143 + color: #fff;
  144 + }
  145 + }
8 } 146 }