require(['../config'],function(){
require(['jquery','common'],function($,common){
var print_show_list = {
init: function(){
common.headerMenu();
common.dropdown();
common.txtfous();
this.initDom();
this.uploadImgsInit(); //身份证正面
this.uploadImgsInit1(); //身份证反面
this.uploadImgsInit2(); //企业营业执照
this.uploadImgsInit3(); //企业组织机构代码证
this.uploadImgsInit4(); //企业身份证正面
this.uploadImgsInit5(); //企业身份证反面
},
type:0,
getsuffix: function(name){
var dindex = name.lastIndexOf(".");
return name.substring(dindex,name.length);
},
initDom: function(){
var self = this;
//类型tab切换
$('.certify-tab>a').each(function(index,element){
$(this).on('click',function(){
//var validate = $(this).parent().data('validate');
//if(validate >= 0)
// return false;
$(this).addClass('active').siblings('a').removeClass('active');
$('.certify-con').hide();
$('.certify-con').eq(index).show();
self.type = index;
});
});
var reset_type = $('.J_type').data('type');
if(reset_type==2){
$('.certify-tab a').eq(1).click();
}
$('.select-downmenu a').click(function(){
var areaid = $(this).data("areaid");
$(this).parents('.select-downmenu').hide();
$(this).parents('.select-downmenu').siblings('.select-link').find('.select-wz')
.css('color','#000').html($(this).html());
if(areaid!=undefined){
Lizard.ajax({
url:'/index/getcity?pid='+areaid,
type:'get',
success:function(data){
if(data.code==0){
var isActive = $('.certify-tab a').eq(0).hasClass('active');
var objDiv = '.applyperson';
if(!isActive)
objDiv = '.applybusiness';
$(objDiv + " .select-wz").eq(1).html("请选择");
$(objDiv+" .select-downmenu").eq(1).html(data.value);
setTimeout(function(){
$(objDiv + " .select-downmenu").eq(1).find("a").click(function(){
$(this).parents('.select-downmenu').hide();
$(objDiv + ' .now_areaid').val($(this).data("areaid"));
$(this).parents('.select-downmenu').siblings('.select-link').find('.select-wz')
.css('color','#000').html($(this).html());
});
},800);
}
}
});
}
});
//验证码发送
$('.identify-yzm').click(function(){
var phone = $(this).parent().parent().prev().find('.common-txt').val();
var self = $(this);
if(!(/^1[34578]\d{9}$/.test(phone))){
self.parent().parent().prev().find('.common-txt').focus();
self.parent().parent().prev().find('.certify-notice').show();
return false;
}
Lizard.ajax({
url:"/Center/sendCode/"+phone,
type:"get",
success:function(data){
if(data.code == 0){
Lizard.countTime($('.identify-yzm'),'identify-yzm-again');
}else{
$('.certify-notice').hide();
Lizard.showToast(data.message)
}
}
});
return true;
});
// 保存
$('.certify-confirm a').click(function(){
$('.certify-notice').hide();
var data = {};
if(self.type==0){ //个人
data.name = $('.applyperson .common-txt').eq(0).val();
data.idcard = $('.applyperson .common-txt').eq(1).val();
data.now_areaid = $('.applyperson .now_areaid').val();
data.now_address = $('.applyperson .common-txt').eq(2).val();
data.idcardthumb = $('.applyperson .idcardthumb').val();
data.idcardthumb1 = $('.applyperson .idcardthumb1').val();
data.telphone = $('.applyperson .common-txt').eq(3).val();
data.code = $('.applyperson .common-txt').eq(4).val();
if(!data.name){
$('.applyperson .certify-notice').eq(0).show();
$('.applyperson .common-txt').eq(0).focus();
return false;
}
if(!Lizard.isRealName(data.name)){
$('.applyperson .certify-notice').eq(0).html('*请填写正确的姓名').show();
$('.applyperson .common-txt').eq(0).focus();
return false;
}
if(!data.idcard){
$('.applyperson .certify-notice').eq(1).show();
$('.applyperson .common-txt').eq(1).focus();
return false;
}
if(!Lizard.isIdCard(data.idcard)){
$('.applyperson .certify-notice').eq(1).html('*请填写正确的身份证号码').show();
$('.applyperson .common-txt').eq(1).focus();
return false;
}
if(!data.now_areaid || parseInt(data.now_areaid) == 0){
$('.applyperson .common-txt').eq(2).focus();
$('.applyperson .certify-notice').eq(2).html('*请选择城市').show();
return false;
}
if(!data.now_address ){
$('.applyperson .common-txt').eq(2).focus();
$('.applyperson .certify-notice').eq(2).html('*请填全现居住地址').show();
return false;
}
if(!data.idcardthumb || !data.idcardthumb1){
$('.applyperson .certify-notice').eq(3).show();
return false;
}
if(!data.telphone){
$('.applyperson .common-txt').eq(3).focus();
$('.applyperson .certify-notice').eq(4).show();
return false;
}
if(!Lizard.isMobile(data.telphone)){
$('.applyperson .common-txt').eq(3).focus();
$('.applyperson .certify-notice').eq(4).html('*请填写正确的手机号').show();
return false;
}
if(!data.code){
$('.applyperson .common-txt').eq(4).focus();
$('.applyperson .certify-notice').eq(5).show();
return false;
}
Lizard.ajax({
url:"/Center/opinion",
type:"post",
dataType:"json",
data:data,
success:function(rs){
if(rs.code==0){
Lizard.showToast(rs.message + ',等待审核!');
setTimeout(function(){
window.location.reload();
},1000)
}else{
Lizard.showToast(rs.message);
}
}
});
}else{
data.companyname = $('.applybusiness .common-txt').eq(0).val();
data.companylicense = $('.applybusiness .common-txt').eq(1).val();
data.corporation = $('.applybusiness .common-txt').eq(2).val();
data.scope = $('.applybusiness .common-txt').eq(3).val();
data.now_areaid = $('.applybusiness .now_areaid').val();
data.now_address = $('.applybusiness .common-txt').eq(4).val();
data.comanythumb1 = $('.applybusiness .comanythumb1').val();
data.comanythumb3 = $('.applybusiness .comanythumb3').val();
data.name = $('.applybusiness .common-txt').eq(5).val();
data.idcard = $('.applybusiness .common-txt').eq(6).val();
data.idcardthumb = $('.applybusiness .idcardthumb').val();
data.idcardthumb1 = $('.applybusiness .idcardthumb1').val();
data.telphone = $('.applybusiness .common-txt').eq(7).val();
data.code = $('.applybusiness .common-txt').eq(8).val();
if(!data.companyname){
$('.applybusiness .certify-notice').eq(0).show();
$('.applybusiness .common-txt').eq(0).focus();
return false;
}
if(!data.companylicense){
$('.applybusiness .certify-notice').eq(1).show();
$('.applybusiness .common-txt').eq(1).focus();
return false;
}
if(!data.corporation){
$('.applybusiness .certify-notice').eq(2).show();
$('.applybusiness .common-txt').eq(2).focus();
return false;
}
if(!data.scope){
$('.applybusiness .certify-notice').eq(3).show();
$('.applybusiness .common-txt').eq(3).focus();
return false;
}
if(!data.now_areaid || parseInt(data.now_areaid) == 0){
$('.applybusiness .certify-notice').eq(4).html('*请选择城市').show();
return false;
}
if(!data.now_address ){
$('.applybusiness .common-txt').eq(4).focus();
$('.applybusiness .certify-notice').eq(4).html('*请填全现居住地址').show();
return false;
}
if(!data.comanythumb1 ){
$('.applybusiness .certify-notice').eq(5).show();
return false;
}
if(!data.comanythumb3 ){
$('.applybusiness .certify-notice').eq(6).show();
return false;
}
if(!data.name ){
$('.applybusiness .common-txt').eq(5).focus();
$('.applybusiness .certify-notice').eq(7).show();
return false;
}
if(!Lizard.isRealName(data.name)){
$('.applybusiness .common-txt').eq(5).focus();
$('.applybusiness .certify-notice').eq(7).html('*请填写正确的姓名').show();
return false;
}
if(!data.idcard){
$('.applybusiness .common-txt').eq(6).focus();
$('.applybusiness .certify-notice').eq(8).show();
return false;
}
if(!Lizard.isIdCard(data.idcard)){
$('.applybusiness .common-txt').eq(6).focus();
$('.applybusiness .certify-notice').eq(8).html('*请填写正确的身份证号码').show();
return false;
}
if(!data.idcardthumb){
$('.applybusiness .certify-notice').eq(9).show();
return false;
}
if(!data.idcardthumb1){
$('.applybusiness .certify-notice').eq(10).show();
return false;
}
if(!data.telphone){
$('.applybusiness .common-txt').eq(7).focus();
$('.applybusiness .certify-notice').eq(11).show();
return false;
}
if(!Lizard.isMobile(data.telphone)){
$('.applybusiness .common-txt').eq(7).focus();
$('.applybusiness .certify-notice').eq(11).html('*请填写正确的手机号').show();
return false;
}
if(!data.code){
$('.applybusiness .common-txt').eq(8).focus();
$('.applybusiness .certify-notice').eq(12).show();
return false;
}
Lizard.ajax({
url:"/Center/firm",
type:"post",
dataType:"json",
data:data,
success:function(rs){
if(rs.code==0){
Lizard.showToast(rs.message + ',等待审核!');
setTimeout(function(){
window.location.reload();
},1000)
}else{
Lizard.showToast(rs.message);
}
}
});
}
});
//图片
$('.upfile-btn').click(function(e){
$(this).next().find('input').click();
});
},
// 图片上传
uploadImgsInit:function(){
var self = this;
var index = 0;
$('#up_img').change(function(e){
var target = e.target;
if(target == null || target == undefined){ //IE6,7,8
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
if( target.files == null || target.files == undefined){ //IE9
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
var filename = target.files[0].name;
var filesize = target.files[0].size;
var fsuffix = self.getsuffix(filename).toLowerCase();
if(fsuffix!='.png' && fsuffix!='.jpg' && fsuffix!='.jpeg' && fsuffix!='.gif'){
Lizard.showToast(filename+"文件格式不正确!");
return false;
}
if(filesize > 200000000){
Lizard.showToast(filename+"文件太大!");
return false;
}
filesize = Math.ceil(filesize / 1024 / 1024);
var fd = new FormData($('#uploadImgForm')[0]);
var url = Lizard.url;
$.ajax({
type: 'POST',
cache: false,
contentType: false,
processData: false,
dataType: 'json',
url: url + '/file/u',
data:fd,
xhr: function() { //用以显示上传进度
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
//xhr.upload.addEventListener('progress', function(ev) {
// $('#'+htmlId).css('width',parseInt(ev.loaded/ev.total * 100) +'%');
//
//}, false);
}
return xhr;
},
success:function(data){
if (data.code == 0) {
var data = data.value.file;
$('.applyperson .idcardthumb').val(data.path);
$('.up_img').show().append('');
index ++;
} else {
Lizard.showToast(data.message);
}
},
error: function(){
Lizard.showToast('网络服务器错误');
}
})
})
},
uploadImgsInit1:function(){
var self = this;
var index = 0;
$('#up_img1').change(function(e){
var target = e.target;
if(target == null || target == undefined){ //IE6,7,8
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
if( target.files == null || target.files == undefined){ //IE9
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
var filename = target.files[0].name;
var filesize = target.files[0].size;
var fsuffix = self.getsuffix(filename).toLowerCase();
if(fsuffix!='.png' && fsuffix!='.jpg' && fsuffix!='.jpeg' && fsuffix!='.gif'){
Lizard.showToast(filename+"文件格式不正确!");
return false;
}
if(filesize > 200000000){
Lizard.showToast(filename+"文件太大!");
return false;
}
filesize = Math.ceil(filesize / 1024 / 1024);
var fd = new FormData($('#uploadImgForm1')[0]);
var url = Lizard.url;
$.ajax({
type: 'POST',
cache: false,
contentType: false,
processData: false,
dataType: 'json',
url: url + '/file/u',
data:fd,
xhr: function() { //用以显示上传进度
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
//xhr.upload.addEventListener('progress', function(ev) {
// $('#'+htmlId).css('width',parseInt(ev.loaded/ev.total * 100) +'%');
//
//}, false);
}
return xhr;
},
success:function(data){
if (data.code == 0) {
var data = data.value.file;
$('.applyperson .idcardthumb1').val(data.path);
$('.up_img1').show().append('');
index ++;
} else {
Lizard.showToast(data.message);
}
},
error: function(){
Lizard.showToast('网络服务器错误');
}
})
})
},
uploadImgsInit2:function(){
var self = this;
var index = 0;
$('#up_img2').change(function(e){
var target = e.target;
if(target == null || target == undefined){ //IE6,7,8
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
if( target.files == null || target.files == undefined){ //IE9
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
var filename = target.files[0].name;
var filesize = target.files[0].size;
var fsuffix = self.getsuffix(filename).toLowerCase();
if(fsuffix!='.png' && fsuffix!='.jpg' && fsuffix!='.jpeg' && fsuffix!='.gif'){
Lizard.showToast(filename+"文件格式不正确!");
return false;
}
if(filesize > 200000000){
Lizard.showToast(filename+"文件太大!");
return false;
}
filesize = Math.ceil(filesize / 1024 / 1024);
var fd = new FormData($('#uploadImgForm2')[0]);
var url = Lizard.url;
$.ajax({
type: 'POST',
cache: false,
contentType: false,
processData: false,
dataType: 'json',
url: url + '/file/u',
data:fd,
xhr: function() { //用以显示上传进度
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
//xhr.upload.addEventListener('progress', function(ev) {
// $('#'+htmlId).css('width',parseInt(ev.loaded/ev.total * 100) +'%');
//
//}, false);
}
return xhr;
},
success:function(data){
if (data.code == 0) {
var data = data.value.file;
$('.applybusiness .comanythumb1').val(data.path);
$('.up_img2').show().append('');
index ++;
} else {
Lizard.showToast(data.message);
}
},
error: function(){
Lizard.showToast('网络服务器错误');
}
})
})
},
uploadImgsInit3:function(){
var self = this;
var index = 0;
$('#up_img3').change(function(e){
var target = e.target;
if(target == null || target == undefined){ //IE6,7,8
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
if( target.files == null || target.files == undefined){ //IE9
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
var filename = target.files[0].name;
var filesize = target.files[0].size;
var fsuffix = self.getsuffix(filename).toLowerCase();
if(fsuffix!='.png' && fsuffix!='.jpg' && fsuffix!='.jpeg' && fsuffix!='.gif'){
Lizard.showToast(filename+"文件格式不正确!");
return false;
}
if(filesize > 200000000){
Lizard.showToast(filename+"文件太大!");
return false;
}
filesize = Math.ceil(filesize / 1024 / 1024);
var fd = new FormData($('#uploadImgForm3')[0]);
var url = Lizard.url;
$.ajax({
type: 'POST',
cache: false,
contentType: false,
processData: false,
dataType: 'json',
url: url + '/file/u',
data:fd,
xhr: function() { //用以显示上传进度
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
//xhr.upload.addEventListener('progress', function(ev) {
// $('#'+htmlId).css('width',parseInt(ev.loaded/ev.total * 100) +'%');
//
//}, false);
}
return xhr;
},
success:function(data){
if (data.code == 0) {
var data = data.value.file;
$('.applybusiness .comanythumb3').val(data.path);
$('.up_img3').show().append('');
index ++;
} else {
Lizard.showToast(data.message);
}
},
error: function(){
Lizard.showToast('网络服务器错误');
}
})
})
},
uploadImgsInit4:function(){
var self = this;
var index = 0;
$('#up_img4').change(function(e){
var target = e.target;
if(target == null || target == undefined){ //IE6,7,8
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
if( target.files == null || target.files == undefined){ //IE9
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
var filename = target.files[0].name;
var filesize = target.files[0].size;
var fsuffix = self.getsuffix(filename).toLowerCase();
if(fsuffix!='.png' && fsuffix!='.jpg' && fsuffix!='.jpeg' && fsuffix!='.gif'){
Lizard.showToast(filename+"文件格式不正确!");
return false;
}
if(filesize > 200000000){
Lizard.showToast(filename+"文件太大!");
return false;
}
filesize = Math.ceil(filesize / 1024 / 1024);
var fd = new FormData($('#uploadImgForm4')[0]);
var url = Lizard.url;
$.ajax({
type: 'POST',
cache: false,
contentType: false,
processData: false,
dataType: 'json',
url: url + '/file/u',
data:fd,
xhr: function() { //用以显示上传进度
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
//xhr.upload.addEventListener('progress', function(ev) {
// $('#'+htmlId).css('width',parseInt(ev.loaded/ev.total * 100) +'%');
//
//}, false);
}
return xhr;
},
success:function(data){
if (data.code == 0) {
var data = data.value.file;
$('.applybusiness .idcardthumb').val(data.path);
$('.up_img4').show().append('');
index ++;
} else {
Lizard.showToast(data.message);
}
},
error: function(){
Lizard.showToast('网络服务器错误');
}
})
})
},
uploadImgsInit5:function(){
var self = this;
var index = 0;
$('#up_img5').change(function(e){
var target = e.target;
if(target == null || target == undefined){ //IE6,7,8
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
if( target.files == null || target.files == undefined){ //IE9
Lizard.showToast("您的浏览器版本过低,请使用IE10及以上版本浏览器,或谷歌、火狐等浏览器,若您正在使用的是360、搜狗等国产浏览器,请切换至极速模式浏览!");
return false;
}
var filename = target.files[0].name;
var filesize = target.files[0].size;
var fsuffix = self.getsuffix(filename).toLowerCase();
if(fsuffix!='.png' && fsuffix!='.jpg' && fsuffix!='.jpeg' && fsuffix!='.gif'){
Lizard.showToast(filename+"文件格式不正确!");
return false;
}
if(filesize > 200000000){
Lizard.showToast(filename+"文件太大!");
return false;
}
filesize = Math.ceil(filesize / 1024 / 1024);
var fd = new FormData($('#uploadImgForm5')[0]);
var url = Lizard.url;
$.ajax({
type: 'POST',
cache: false,
contentType: false,
processData: false,
dataType: 'json',
url: url + '/file/u',
data:fd,
xhr: function() { //用以显示上传进度
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
//xhr.upload.addEventListener('progress', function(ev) {
// $('#'+htmlId).css('width',parseInt(ev.loaded/ev.total * 100) +'%');
//
//}, false);
}
return xhr;
},
success:function(data){
if (data.code == 0) {
var data = data.value.file;
$('.applybusiness .idcardthumb1').val(data.path);
$('.up_img5').show().append('');
index ++;
} else {
Lizard.showToast(data.message);
}
},
error: function(){
Lizard.showToast('网络服务器错误');
}
})
})
}
}
print_show_list.init();
})
})