|
-
- var if_com = "";
- var per = $('#allInfos').html();
-
- var company_personal_id = "";
- window.onload = function(){
- //加载省的信息
- reloadProvinceInfo();
- reloadCityInfo(1);
- //加载市的信息
- // reloadCityInfo();
-
- $('#company').css('display','none');
- $('#personal').css('display','none');
- var value = $('#select_company_personal input[name="company_personal"]:checked ').val();
- if(value == 0){
- $('#company').css('display','');
- $('#personal').css('display','');
- $('#company_check').attr('check',true);
- $('#company_show').css('display','');
- $('#personal_show').css('display','none');
- }else{
- $('#company').css('display','');
- $('#personal').css('display','');
- $('#personal_check').attr('check',true);
- $('#personal_show').css('display','');
- $('#company_show').css('display','none');
- }
-
-
- }
-
-
-
- //基本信息
- function basicInfo(){
- $('#user_infos').css('display','none');
- $('#infos').css('display','');
- $('#basic_info_btn').css('background-color','lightgray');
- $('#user_info_btn').css('background-color','white');
- }
-
- //个人信息
- function userInfo(){
- var value = $('#select_company_personal input[name="company_personal"]:checked ').val();
-
- $('#user_infos').css('display','');
- $('#infos').css('display','none');
- $('#basic_info_btn').css('background-color','white');
- $('#user_info_btn').css('background-color','lightgray');
- if(value == 0){
- $('#company_user_info').show();
- $('#personal_user_info').hide();
- }else{
- $('#company_user_info').hide();
- $('#personal_user_info').show();
- }
- }
-
- //个人信息保存
- function basicInfoSave(){
-
- var zzz = $('#select_company_personal input[name="company_personal"]:checked ').val();
-
- // var html1 = ''
- // html1 = per.replace('[select_company]',value);
- // console.log(html1)
- // html = per.replace('[select_company]',value);
- // $('#allInfos').html(html1);
- //value==0 企业
-
- if(zzz == 0){
- var saleStyle = $('#company input[name="saleStyle"]:checked').val();
-
- var channel_name = $('#channel_name').val();
-
- var linkman = $('#linkman').val();
-
- var teamwork = $('#teamwork').val();
-
- var com_tel = $('#com_tel').val();
-
- var channel_admin = $('#channel_admin').val();
-
- var saleStyle_company = $('#company input[name="saleStyle_company"]:checked ').val();
-
- var channel_id = $('#channel_id').val();
-
- var province = $("#province").find("option:selected").val();
-
- var cantonal = $("#cantonal").find("option:selected").val();
- if(!saleStyle){
- alert('未选择销售方式!');
- return;
- }else if(channel_name==""){
- alert('未输入渠道名称!');
- return;
- }else if(linkman==""){
- alert('未输入联系人!');
- return;
- }else if(com_tel==""){
- alert('未输入联系方式');
- return;
- }else if(channel_admin==""){
- alert('未输入渠道管理员');
- return;
- }else if(!saleStyle_company){
- alert('未选择渠道分类');
- return;
- }
- if( $("#basic_info_save_btn").text() == "保存成功" ) {
- return;
- }
- // $("#basic_info_save_btn").removeClass("btn-info");
- $("#basic_info_save_btn").text("保存中...");
- $.ajax({
- url:'./st-xm/control.php', //请求地址
- type: "post", //请求方式
- // data: data, //请求参数
- data:{
- type:"channel_addinfo",
- user_type:0,
- saleStyle:saleStyle,
- channel_name:channel_name,
- teamwork:teamwork,
- linkman:linkman,
- com_tel:com_tel,
- channel_admin:channel_admin,
- saleStyle_company:saleStyle_company,
- channel_id:channel_id,
- province:province,
- cantonal:cantonal
- },
- async:false,
- dataType: "json",
- success: function (date1) {
- if(date1.code == 0){
- alert('成功追加一条企业信息!');
- $("#basic_info_save_btn").text("成功保存");
- $("#basic_info_save_btn").addClass("removeClass");
- $("#personal_check").attr('disabled',true);
- $("#basic_info_save_btn").attr("onclick", "null");
- $("#basic_info_save_btn").removeClass("btn-primary");
- $("#basic_info_save_btn").css('color','white');
- company_personal_id = date1.list.user_id;
- }else{
- alert('添加企业信息失败!');
- }
-
- },
- fail: function (date) {
- }
- });
-
-
-
- // document.info_form_company.submit();
- }else{
- var saleStyle = $('#personal input[name="saleStyle_personal"]:checked ').val();
- var agency_name = $('#agency_name').val();
- var linkman_id = $('#linkman_id').val();
- var tel_personal = $('#tel_personal').val();
- var principal_personal = $('#principal_personal').val();
- var saleStyle_personal = $('#personal input[name="saleStyle_personal_channel"]:checked ').val();
- var com_name = $('#com_name').val();
- var province = $("#provincea").find("option:selected").val();
- var cantonal = $("#cantonala").find("option:selected").val();
- if(!saleStyle){
- alert('未选择销售方式!');
- return;
- }else if(agency_name==""){
- alert('未输入代理人姓名!');
- return;
- }else if(linkman_id==""){
- alert('未输入身份证号!');
- return;
- }else if(tel_personal==""){
- alert('未输入联系电话');
- return;
- }else if(principal_personal==""){
- alert('未输入负责业务人员');
- return;
- }else if(saleStyle_personal==""){
- alert('未输入负责业务人员');
- return;
- }
- // document.info_form_personal.submit();
- if( $("#basic_info_save_btn").text() == "保存成功" ) {
- return;
- }
- // $("#basic_info_save_btn").removeClass("btn-info");
- $("#basic_info_save_btn").text("保存中...");
- $.ajax({
- url:'./st-xm/control.php', //请求地址
- type: "post", //请求方式
- // data: data, //请求参数
- data:{
- type:"channel_addinfo",
- user_type:1,
- saleStyle_personal:saleStyle,
- agency_name:agency_name,
- linkman_id:linkman_id,
- tel_personal:tel_personal,
- principal_personal:principal_personal,
- com_name:com_name,
- saleStyle_personal_channel:saleStyle_personal,
- province:province,
- cantonal:cantonal
- },
- async:false,
- dataType: "json",
- success: function (date1) {
- if(date1.code == 0){
- //这个地方写按钮失效
- alert('成功追加一条个人信息!');
- $("#basic_info_save_btn").text("成功保存");
- $("#basic_info_save_btn").addClass("removeClass");
- $("#personal_check").attr('disabled',true);
- $("#basic_info_save_btn").attr("onclick", "null");
- $("#basic_info_save_btn").removeClass("btn-primary");
- $("#basic_info_save_btn").css('color','white');
- company_personal_id = date1.list.user_id;
- }else{
- alert('添加个人信息失败!');
- }
- },
- fail: function (date) {
- }
- });
- }
-
- }
-
- //账号信息保存
- function userInfoSave(){
- var zzz = $('#select_company_personal input[name="company_personal"]:checked ').val();
- if(zzz == 0){
- if(company_personal_id==""){
- alert('请先完善基本信息');
- }
- var company_login_name = $('#company_login_name').val();
- var company_bound_tel = $('#company_bound_tel').val();
- if(company_login_name==""){
- alert('未输入渠道登录名!');
- }else{
- if( $("#user_info_save_btn").text() == "保存成功" ) {
- return;
- }
- $("#user_info_save_btn").text("保存中...");
-
- $.ajax({
- url:'./st-xm/control.php', //请求地址
- type: "post", //请求方式
- // data: data, //请求参数
- data:{
- type:"channel_updateuser",
- user_type:0,
- bound_tel:company_bound_tel,
- login_name:company_login_name,
- id:company_personal_id
- },
- async:false,
- dataType: "json",
- success: function (date1) {
- if(date1.code == 0){
- //这个地方写按钮失效
- alert('成功添加企业账号!');
- $("#user_info_save_btn").text("成功保存");
- $("#user_info_save_btn").addClass("removeClass");
- // $("#personal_check").attr('disabled',true);
- $("#user_info_save_btn").attr("onclick", "null");
- $("#user_info_save_btn").removeClass("btn-primary");
- $("#user_info_save_btn").css('color','white');
- }else{
- alert('添加企业账号失败!');
- }
- },
- fail: function (date) {
- }
- });
- }
- }else{
- var personal_bound_tel = $('#personal_bound_tel').val();
- var personal_login_name = $('#personal_login_name').val();
- if(company_personal_id==""){
- alert('请先完善基本信息');
- }
- if(personal_bound_tel==""){
- alert('未输入绑定手机号!');
- }else{
- // document.userid_form_personal.submit();
- if( $("#user_info_save_btn").text() == "保存成功" ) {
- return;
- }
- $("#user_info_save_btn").text("保存中...");
- $.ajax({
- url:'./st-xm/control.php', //请求地址
- type: "post", //请求方式
- // data: data, //请求参数
- data:{
- type:"channel_updateuser",
- user_type:1,
- login_name:personal_login_name,
- bound_tel:personal_bound_tel,
- id:company_personal_id
- },
- async:false,
- dataType: "json",
- success: function (date1) {
- if(date1.code == 0){
- //这个地方写按钮失效
- alert('成功添加个人账号!');
- $("#user_info_save_btn").text("成功保存");
- $("#user_info_save_btn").addClass("removeClass");
- // $("#personal_check").attr('disabled',true);
- $("#user_info_save_btn").attr("onclick", "null");
- $("#user_info_save_btn").removeClass("btn-primary");
- $("#user_info_save_btn").css('color','white');
- }else{
- alert('添加个人账号失败!');
- }
- },
- fail: function (date) {
- }
- });
- }
- }
- }
-
- //选中企业
- function selectCompany(){
- reloadProvinceInfo();
- reloadCityInfo(1);
- $('#company').css('display','');
- $('#personal').css('display','');
- $('#company_check').attr('check',true);
- $('#company_show').css('display','');
- $('#personal_show').css('display','none');
-
-
- }
-
- //选中个人
- function selectPersonal(){
- reloadProvinceInfo();
- reloadCityInfo(1);
- $('#company').css('display','');
- $('#personal').css('display','');
- $('#personal_check').attr('check',true);
- $('#personal_show').css('display','');
- $('#company_show').css('display','none');
-
- }
-
- //加载省的信息
- function reloadProvinceInfo(){
- // alert('选择省份');
-
- $.ajax({
- url:'./st-xm/control.php', //请求地址
- type: "post", //请求方式
- // data: data, //请求参数
- data:{
- type:"channel_province",
- },
- async:false,
- dataType: "json",
- success: function (date1) {
- if(date1.code == 0){
- var HTML = "";
- var proList = date1.list;
- for (var i = 0; i<proList.length;i ++) {
- var dict = proList[i];
- var tempHTML = '<option value="0">请选择省</option>';
- tempHTML = tempHTML.replace('请选择省',proList[i]['AREA_NAME']);
- tempHTML = tempHTML.replace('0',proList[i]['ID']);
- HTML += tempHTML;
- }
-
- $('#province').html(HTML);
- $('#provincea').html(HTML);
- // $('#province').attr('size',1);
-
- }else{
- alert('获取省份列表失败');
- }
- },
- fail: function (date) {
- }
- });
- }
-
-
-
- //加载市的信息
- function reloadCityInfo(proid){
-
- $.ajax({
- url:'./st-xm/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"channel_city",
- id:proid
- },
- async:false,
- dataType: "json",
- success: function (date1) {
- if(date1.code == 0){
- var HTML = "";
- var proList = date1.list;
- for (var i = 0; i<proList.length;i ++) {
- var dict = proList[i];
- var tempHTML = '<option value="0">请选择市</option>';
- tempHTML = tempHTML.replace('请选择市',proList[i]['AREA_NAME']);
- tempHTML = tempHTML.replace('0',proList[i]['ID']);
- HTML += tempHTML;
- }
- $('#cantonal').html(HTML);
- $('#cantonala').html(HTML);
- }else{
- alert('获取城市列表失败');
- }
- },
- fail: function (date) {
-
- }
- });
- }
-
-
- function selectOneProvince(selected){
- $("#province").find("option:selected").text();
- reloadCityInfo(selected.value);
- }
|