Authored by 徐炜

Merge remote-tracking branch 'origin/feature/installment2a' into feature/installment2a

@@ -46,18 +46,12 @@ var debounceFn = debounce(function(cardNo, formModel) { @@ -46,18 +46,12 @@ var debounceFn = debounce(function(cardNo, formModel) {
46 46
47 var checkCard = function(formModel) { 47 var checkCard = function(formModel) {
48 // 银行卡格式化 48 // 银行卡格式化
49 - $('#cardNo').keyup(function() { 49 + $('#cardNo').on('input', function() {
50 var value = $(this).val(); 50 var value = $(this).val();
51 var cardNo = $(this).val().replace(/\s/g, ''); 51 var cardNo = $(this).val().replace(/\s/g, '');
52 52
53 $(this).val(value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 ')).trigger('change'); 53 $(this).val(value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 ')).trigger('change');
54 54
55 - if (cardNo && cardNo.length < 16) {  
56 - $('#bank-desc').hide();  
57 - }  
58 - }).blur(function() {  
59 - var cardNo = $(this).val().replace(/\s/g, '');  
60 -  
61 if (cardNo && cardNo.length >= 16) { 55 if (cardNo && cardNo.length >= 16) {
62 debounceFn(cardNo, formModel); 56 debounceFn(cardNo, formModel);
63 } else { 57 } else {
@@ -35,14 +35,15 @@ var validateForm = function() { @@ -35,14 +35,15 @@ var validateForm = function() {
35 35
36 checkCard(formData); 36 checkCard(formData);
37 37
38 -// 输入框改变时同时更新模型  
39 -$('input').on('input', function() {  
40 - var name = $(this).attr('name');  
41 -  
42 - formData[name] = $(this).val(); 38 +// 定时更新模型,解决各种浏览器奇葩问题终极办法
  39 +setInterval(function() {
  40 + $('input').each(function() {
  41 + var name = $(this).attr('name');
43 42
  43 + formData[name] = $(this).val();
  44 + });
44 validateForm(); 45 validateForm();
45 -}); 46 +}, 500);
46 47
47 applyButton.on('click', function() { 48 applyButton.on('click', function() {
48 var self = this; 49 var self = this;