Showing
2 changed files
with
8 additions
and
1 deletions
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,6 +138,8 @@ $('#cardNo').keyup(function() { | @@ -137,6 +138,8 @@ $('#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 | ||
141 | + if (cardNo && cardNo.length >= 15) { | ||
142 | + debounce(function() { | ||
140 | // 获取银行信息 | 143 | // 获取银行信息 |
141 | $.get('/home/installment/bank-info', {cardNo: cardNo}).then(function(result) { | 144 | $.get('/home/installment/bank-info', {cardNo: cardNo}).then(function(result) { |
142 | if (result.code === 200) { | 145 | if (result.code === 200) { |
@@ -150,6 +153,10 @@ $('#cardNo').keyup(function() { | @@ -150,6 +153,10 @@ $('#cardNo').keyup(function() { | ||
150 | $('#bank-desc').hide(); | 153 | $('#bank-desc').hide(); |
151 | } | 154 | } |
152 | }); | 155 | }); |
156 | + }, 1000)(); | ||
157 | + } else { | ||
158 | + $('#bank-desc').hide(); | ||
159 | + } | ||
153 | }); | 160 | }); |
154 | 161 | ||
155 | 162 |
-
Please register or login to post a comment