Authored by Aiden Xu

分期订单

1 var $ = require('yoho-jquery'); 1 var $ = require('yoho-jquery');
2 var tip = require('../plugin/tip'); 2 var tip = require('../plugin/tip');
  3 +var debounce = require('lodash/debounce');
3 4
4 var Timer = function() { 5 var Timer = function() {
5 this.counter = 0; 6 this.counter = 0;
@@ -137,19 +138,25 @@ $('#cardNo').keyup(function() { @@ -137,19 +138,25 @@ $('#cardNo').keyup(function() {
137 $(this).val(value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 ')).trigger('change'); 138 $(this).val(value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 ')).trigger('change');
138 139
139 140
140 - // 获取银行信息  
141 - $.get('/home/installment/bank-info', {cardNo: cardNo}).then(function(result) {  
142 - if (result.code === 200) {  
143 - // 设置银行名称  
144 - $('#bank-name').text(result.data.bankName); 141 + if (cardNo && cardNo.length >= 15) {
  142 + debounce(function() {
  143 + // 获取银行信息
  144 + $.get('/home/installment/bank-info', {cardNo: cardNo}).then(function(result) {
  145 + if (result.code === 200) {
  146 + // 设置银行名称
  147 + $('#bank-name').text(result.data.bankName);
145 148
146 - // 设置银行图标  
147 - $('#bank-icon').attr('src', '/img/home/bank-icons/' + result.data.bankCode + '.png');  
148 - $('#bank-desc').show();  
149 - } else {  
150 - $('#bank-desc').hide();  
151 - }  
152 - }); 149 + // 设置银行图标
  150 + $('#bank-icon').attr('src', '/img/home/bank-icons/' + result.data.bankCode + '.png');
  151 + $('#bank-desc').show();
  152 + } else {
  153 + $('#bank-desc').hide();
  154 + }
  155 + });
  156 + }, 1000)();
  157 + } else {
  158 + $('#bank-desc').hide();
  159 + }
153 }); 160 });
154 161
155 162
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 } 35 }
36 36
37 .order-list-container { 37 .order-list-container {
38 - margin-top: 3rem; 38 + padding-top: 3rem;
39 } 39 }
40 40
41 .order-list { 41 .order-list {