function FinancialinfosetController($scope, $http, $timeout, $location, $rootScope, $routeParams) {
var tempurl = "/api/v1/FinancialManagement/GetFinancialinfoset";
$http.get(tempurl).success(function (data) {
if (data.has_val) {
$scope.Financialinfosetinfo = data.result;
var bankprovince = $scope.Financialinfosetinfo.bankprovince;
console.log($scope.Financialinfosetinfo);
var province = $("#province option:selected").text($scope.Financialinfosetinfo.bankprovince);
var city = $("#city option:selected").text($scope.Financialinfosetinfo.bankcity);
var bank = $("#bank option:selected").text($scope.Financialinfosetinfo.bank);
var branch = $("#branch option:selected").text($scope.Financialinfosetinfo.bankname);
//$("#province").val($scope.Financialinfosetinfo.pid);
//$("#city").val($scope.Financialinfosetinfo.cid);
//$("#district").val($scope.Financialinfosetinfo.rid);
if ($scope.Financialinfosetinfo.status == -1 || $scope.Financialinfosetinfo.status == 1 || $scope.Financialinfosetinfo.status == 7) {
$("#subaudit").attr("disabled", true);
$("#subaudit").removeClass("btn btn-primary");
$("#person").attr("disabled", true);
$("#enterprise").attr("disabled", true);
}
if ($scope.Financialinfosetinfo.customertype == "PERSON") {
$("#idnumber").show();
$("#business").hide();
$("#person").attr("checked", "checked");
}
else if ($scope.Financialinfosetinfo.customertype == "ENTERPRISE") {
$("#idnumber").hide();
$("#business").show();
$("#enterprise").attr("checked", "checked");
$("#business").style.display = "";
}
else {
$("#idnumber").show();
$("#business").hide();
$("#person").attr("checked", "checked");
}
}
});
var tempurl1 = "/api/v1/FinancialManagement/Getprovinces";
$http.get(tempurl1).success(function (data) {
if (data.has_val) {
$scope.provincesList = data.result;
console.log($scope.provincesList);
}
});
$scope.getcitylist = function (provinceCode) {
var tempurl1 = "/api/v1/FinancialManagement/GetCitys?provinceCode=" + provinceCode;
$http.get(tempurl1).success(function (data) {
if (data.has_val) {
$scope.citysList = data.result;
console.log($scope.citysList);
}
});
}
$("#province").on("change", function () {
$scope.getcitylist($(this).val());
})
$scope.getbanklist = function (cityCode) {
var tempurl1 = "/api/v1/FinancialManagement/GetBanks?cityCode=" + cityCode;
$http.get(tempurl1).success(function (data) {
if (data.has_val) {
$scope.banksList = data.result;
console.log($scope.banksList);
}
});
}
$("#city").on("change", function () {
$scope.getbanklist($(this).val());
})
$scope.getbranchslist = function (cityCode, bankCode) {
var tempurl1 = "/api/v1/FinancialManagement/GetBranch?cityCode=" + cityCode + "&bankCode=" + bankCode;
$http.get(tempurl1).success(function (data) {
if (data.has_val) {
$scope.branchsList = data.result;
console.log($scope.branchsList);
}
});
}
$("#bank").on("change", function () {
$scope.getbranchslist($("#city").val(), $(this).val());
})
$scope.showpersonal = function () {
$("#idnumber").show();
$("#business").hide();
$("#signedname").val('');
$("#businesslicence").val('');
$("#DefaultImgUrl").imgnull='';
$("#legalperson").val('');
}
$scope.company = function () {
$("#idnumber").hide();
$("#business").show();
$("#idcard").val('');
$("#business").css('display', 'block');
}
$scope.reasonshow = function () {
$('#myModal').modal('show');
}
//获取验证码
var click_func = function () {
$("#securitycodeid").css('display', 'block');
var bindmobile = $("#bindmobile").val();
var re = new RegExp(/^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])d{8}$/);
var result = re.test(bindmobile);
if (!result) {
alert("请输入正确的手机号!");
return;
}
$("#div_get_yzm").off("click", click_func);
var url_get_yzm = "/api/v1/Message/SendVCode?mobile=" + bindmobile + "&type=1001";
$http.get(url_get_yzm)
.success(function (data) {
if (data.has_val) {
var _time = 59;
var _timefunc = function () {
$("#div_get_yzm").html(_time + "秒可重新获取");
_time--;
if (_time > 0) {
$timeout(_timefunc, 1000);
} else {
$("#div_get_yzm").on("click", click_func);
$("#div_get_yzm").html("获取验证码");
}
}
$timeout(_timefunc, 1000);
} else {
$("#div_get_yzm").on("click", click_func);
alert("验证码发送失败");
}
}).error(function (data) {
$("#div_get_yzm").on("click", click_func);
$(document).trigger("ajaxStop");
alert(data.errmsg);
})
}
//获取验证码
$("#div_get_yzm").on("click", click_func);
//var securitynum;
$('#securitycode').blur(function () {
var securitycode = $('#securitycode').val();
if (securitycode == "") {
alert('请输入短信验证码!');
return;
}
var bindmobile = $("#bindmobile").val();
var url_ckeckyzm = "/api/v1/Message/TestVCode?mobile=" + bindmobile + "&vcode=" + securitycode + "&type=1001";
$http.get(url_ckeckyzm).success(function (data) {
if (data.has_val && data.result) {
alert("验证码正确!");
}
else {
alert("验证码错误");
return;
}
})
.error(function (e) {
alert("验证码错误");
})
})
$('#bindmobile').blur(function () {
var bindmobile = $("#bindmobile").val();
var re = new RegExp(/^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])d{8}$/);
var result = re.test(bindmobile);
if (!result || bindmobile == "") {
alert("请输入正确的手机号!");
}
});
$('#bankaccountnumber1').blur(function () {
//alert(securitynum);
var bankaccountnumber = $('#bankaccountnumber').val();
var bankaccountnumber1 = $('#bankaccountnumber1').val();
if (bankaccountnumber != bankaccountnumber1) {
alert("两次填写的银行卡号不一致!");
}
});
//提交审核
$scope.saveinfo = function () {
var linkman = $('#linkman').val();
var bindmobile = $('#bindmobile').val();
var securitycode = $('#securitycode').val();
var email = $('#email').val();
var idcard = $('#idcard').val();
var businesslicence = $('#businesslicence').val();
var businesslicense = $('#DefaultImgUrl').attr('imgnull');
var legalperson = $('#legalperson').val();
var accountname = $('#accountname').val();
var cardno = $('#cardno').val();
var bankaccountnumber = $('#bankaccountnumber').val();
var bankaccountnumber1 = $('#bankaccountnumber1').val();
var province = $("#province option:selected").text();
var city = $("#city option:selected").text();
var bank = $("#bank option:selected").text();
var branch = $("#branch option:selected").text();
var customertype = $("input[name='useType']:checked").val();
var signedname;
signedname = $('#signedname').val();
var bankaccounttype;
bankaccounttype = $(".useType").val();
if (linkman == "") {
alert('请输入财务联系人姓名!');
return;
}
var re = new RegExp(/^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])d{8}$/);
var result = re.test(bindmobile);
if (!result || bindmobile == "") {
alert("请输入正确的手机号!");
}
var re1 = new RegExp(/^w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*$/);
var result1 = re1.test(email);
if (email != "") {
if (!result1) {
alert("请输入正确的邮箱!");
return;
}
}
if (securitycode == "") {
alert('请输入短信验证码!');
return;
}
if (customertype == "PERSON") {
var re = new RegExp(/^d{15}|d{18}$/);
var result = re.test(idcard);
if (!result || idcard == "") {
alert("请输入正确的身份证号!");
return;
}
}
var re2 = new RegExp(/^[A-Za-z0-9]{4,40}$/);
var result2 = re2.test(businesslicence);
if (customertype == "ENTERPRISE") {
if (businesslicence == "") {
alert('请输入营业执照号!');
return;
}
if (!result2) {
alert("请输入正确的营业执照号!");
return;
}
if (DefaultImgUrl == "") {
alert("请上传营业执照图片!");
return;
}
if (legalperson == "") {
alert("请输入法人姓名!");
return;
}
if (signedname == '') {
alert("请输入与营业执照上一致的企业名!");
return;
}
}
if (accountname == "") {
alert('请输入银行开户名!');
return;
}
if (province == "" || province == "选择省") {
alert("请选择省!");
return;
}
if (city == "" || city == "选择城市") {
alert("请选择城市!");
return;
}
if (bank == "" || bank == "选择银行") {
alert("请选择银行!");
return;
}
if (branch == "" || branch == "选择支行") {
alert("请选择支行!");
return;
}
if (bankaccountnumber == "") {
alert("请输入银行卡号!");
return;
}
if (bankaccounttype == "PERSON") {
bankaccounttype = "PrivateCash";
}
else if (bankaccounttype == "ENTERPRISE") {
bankaccounttype = "PublicCash";
}
else {
bankaccounttype = "PrivateCash";
}
if (bankaccounttype == "ENTERPRISE") {
signedname = signedname;
}
else {
signedname = accountname;
}
if (bankaccountnumber != bankaccountnumber1) {
alert('两次填写的银行卡号不一致!');
return;
}
var obj = {
bindmobile: bindmobile,
customertype: customertype,
signedname: signedname,
linkman: linkman,
idcard: idcard,
businesslicence: businesslicence,
minsettleamount: 1,
legalperson: legalperson,
bankaccountnumber: bankaccountnumber,
bankname: branch,
accountname: accountname,
bankaccounttype: bankaccounttype,
bankprovince: province,
bankcity: city,
email: email,
type: 0,
bank: bank,
businesslicense: businesslicense,
};
console.log(obj);
var submitconfirm = confirm('您确定提交审核吗?');
if (submitconfirm == true) {
if ($scope.Financialinfosetinfo.status == 10) {
$http.post("/api/v1/FinancialManagement/UpdateYeepay", obj).success(function (data) {
if (data.has_val) {
alert("修改成功,审核时间需要3-5个工作日!");
window.location.reload();
}
});
}
else {
if ($scope.Financialinfosetinfo.linkman != "") {
$http.post("/api/v1/FinancialManagement/UpdateFinancialinfoset", obj).success(function (data) {
if (data.has_val) {
alert("修改成功!");
window.location.reload();
}
});
}
else {
$http.post("/api/v1/FinancialManagement/SaveFinancialinfoset", obj).success(function (data) {
if (data.has_val) {
alert("保存成功!");
window.location.reload();
}
});
}
}
}
}
}