js

function chksubmit() {
    var source = $('#source').val(); //来源
    var truename = $('#truename').val(); //姓名
    var mobile = $('#mobile').val(); //手机号码
    var phonecode = '';//手机验证码
    var loanmoney = $('#loanmoney').val(); //申贷金额
    var uid = $('#uid').val(); 
    var loanusertype = $('#loanusertype').val();
    if (loanusertype == 2) {
        alert('亲,您是贷款经理,不需要使用此功能');
        return false;
    }
    var han = /^[\u4e00-\u9fa5]+$/gi;
    var i = /\s/g;
    mobile = mobile.replace(i, '');
    if (truename == "") {
        alert('请输入您的姓名!');
        return;
    }
    if (!han.test(truename)) {
        alert("姓名请输入中文!");
        return;
    }
    if (mobile == "") {
        alert('请输入手机号码');
        return;
    }
    var tel2 = /^1\d{10}$/;//^((13[0-9]{9})|(14[0-9]{9})|(15[0-9]{9})|(18[0-9]{9}))$/;
    if (!tel2.test(mobile)) {
        alert("手机号码格式不正确");
        return;
    }    
    
    if (uid == "") { //游客申请状态         
        phonecode = $('#phonecode').val();//手机验证码
        if (phonecode == "") {
            alert('请输入手机验证码');
            return;
        }
    }

    var isnum = isNaN(loanmoney);
    if (isnum) {
        alert('亲,贷款金额必须为数字');
        return;
    }
    if (loanmoney == 0) {
        alert('请输入大于0的贷款金额');
        return;
    }
    if (loanmoney < 5 || loanmoney > 1000) {
        alert('由于存在限制,目前贷款只支持5万到1000万之间的金额,还请谅解!');
        return false;
    }

    $.post('/tools/submit_ajax.ashx?action=quick_to_apply&validate=1', { 'name': truename, 'mobile': mobile, 'money': loanmoney, 'txtCode': phonecode, 'source': source, 'uid': uid }, function (d) {
        if (d.status == 1) {
            $("#showwindow1").css("display", "block");
            $("#loan_id").val(d.loan_id);
            return;
        }  else {
            alert(d.info);
            if(d.url!=""){
                window.location.href=d.url;
            }
        }
    }, 'json');
}

 

posted @ 2016-04-21 16:22  吖然-jronny  阅读(214)  评论(0编辑  收藏  举报