diff --git a/fangija-zsyf/js/loan/loanInfo.js b/fangija-zsyf/js/loan/loanInfo.js index 9988883..8e502e3 100644 --- a/fangija-zsyf/js/loan/loanInfo.js +++ b/fangija-zsyf/js/loan/loanInfo.js @@ -1,11 +1,9 @@ -/* - * 全局变量定义 - */ //短信验证类型 var APPLY_LOAN = "applyLoan"; //如果是抵押贷款时候,需要上层页面传入houseId var houseId; +var _params = {}; document.addEventListener('plusready', onPlusReady, false); @@ -73,7 +71,7 @@ timer = { /* 错误提示 */ $("#next_btn").on("click", function () { var city = $("#input_city").val(); - var moblie = $("#input_phoneNumber").val(); + var mobile = $("#input_phoneNumber").val(); var code = $("#input_codeSms").val(); //申请金额(万元) var applyMoney = $("#input_price").val(); @@ -84,7 +82,7 @@ $("#next_btn").on("click", function () { $.toast("请选择城市"); return false; } - if(!checkPhoneNum(moblie)){ + if(!checkPhoneNum(mobile)){ return false; } if(code == ""){ @@ -106,22 +104,24 @@ $("#next_btn").on("click", function () { return false; } } - axios.post(BASE_PATH + "/rest/evaluate/addManagement", - { - id: id, - houseStatus: houseStatus, - liveStatus: liveStatus - }).then(function (response) { - var status = response.data.status; - if(status){ - $.toast(response.data.data); - window.location.reload(); - }else{ - $.toast(response.data.message); - } - }).catch(function (error) { - console.log(error); - }); + if(mortgage == "1"){ + _params = {type: 1, city: city, applyMoney: applyMoney, mortgage: mortgage, hid: houseId, mobile: mobile, smsCode: code}; + }else{ + _params = {type: 1, city: city, applyMoney: applyMoney, mortgage: mortgage, mobile: mobile, smsCode: code}; + } + axios.post(BASE_PATH + "/rest/loan/apply", _params).then(function (response) { + var status = response.data.status; + if(status){ + alert(response.data.data+ '==='); + $.toast(response.data.data); + //直接定位到贷款success页面, 调用back()就只用返回一次 + window.location.href = "../../views/loan/loanSuccess.html"; + }else{ + $.toast(response.data.message); + } + }).catch(function (error) { + console.log(error); + }); }); \ No newline at end of file