Authored by 徐炜

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

... ... @@ -46,18 +46,12 @@ var debounceFn = debounce(function(cardNo, formModel) {
var checkCard = function(formModel) {
// 银行卡格式化
$('#cardNo').keyup(function() {
$('#cardNo').on('input', function() {
var value = $(this).val();
var cardNo = $(this).val().replace(/\s/g, '');
$(this).val(value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 ')).trigger('change');
if (cardNo && cardNo.length < 16) {
$('#bank-desc').hide();
}
}).blur(function() {
var cardNo = $(this).val().replace(/\s/g, '');
if (cardNo && cardNo.length >= 16) {
debounceFn(cardNo, formModel);
} else {
... ...
... ... @@ -35,14 +35,15 @@ var validateForm = function() {
checkCard(formData);
// 输入框改变时同时更新模型
$('input').on('input', function() {
var name = $(this).attr('name');
formData[name] = $(this).val();
// 定时更新模型,解决各种浏览器奇葩问题终极办法
setInterval(function() {
$('input').each(function() {
var name = $(this).attr('name');
formData[name] = $(this).val();
});
validateForm();
});
}, 500);
applyButton.on('click', function() {
var self = this;
... ...