| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422 |
- function sd(){
- $("#customer_code").val("");
- };
- function ischeckNum() {
- var num = document.getElementById('customer_code').value;//在此处下修改id
- if( num ){
- if( !isNaN( num ) ){
- if(num.length>10){
- sd();
- $("#aaa").css("color","red").html("当前输入的编号大于10位,请输入10位编号");
- }else if(num.length<10 && num.length>0){
- sd();
- $("#aaa").css("color","red").html("当前输入的编号小于10位,请输入10位的编号!");
- }
- return false;
- }else{
- $("#aaa").css("color","red").html("你输入的数据不是数字");
- sd();
- return false;
- }
- }else{
- $("#aaa").css("color","red").html("编号不能为空");
- }
- }
- $("#customer_code").blur(function(){
- ischeckNum();
- })
- // function select(obj){
- // $("#aaa" + obj.value).show().siblings().hide();
- //
- // }
- $("#customer_taxPointDes").change(function(){
-
- if($("#customer_taxPointDes").find("option:selected").text()=="二级商"){
- $("#bbb").show()
- }else{
- $("#bbb").hide()
- }
- // $(this).find("option").each(function(){
- // if ($(this).prop("selected")) {
- // $("#bbb"+$(this).val()).show()
- // } else {
- // $("#bbb"+$(this).val()).hide()
- // }
- // })
- })
- $("#customer_taxPointDes").change(function(){
- if($("#customer_taxPointDes").find("option:selected").text()=="种田大户"){
- $("#ccc").show()
- }else{
- $("#ccc").hide()
- }
-
- })
- $("#customer_feeEx").change(function(){
- if($("#customer_feeEx").find("option:selected").text()=="其他"){
- $("#ddd").show()
- }else{
- $("#ddd").hide()
- }
-
- })
- $("#customer_Qualification").change(function(){
- if($("#customer_Qualification").find("option:selected").text()=="其他"){
- $("#eee").show()
- }else{
- $("#eee").hide()
- }
-
- })
- function addedit() {
- // var mobileNumReg = /^\d{11}$/,
- // if(!mobileNumReg.test($.trim($("#F_MaterialCode").val()))) {
- // layer.confirm('号段长度11位,且必须是数字。', {
- // icon: 2,
- // btn: ['确定'] //按钮
- // });
- // return;
- // }
- $.post(huayi.config.callcenter_url + "CustomerNew/Add", {
- F_CustomerCode: $("#customer_code").val(),//客户编码
- F_CompanyName: $("#customer_companyname").val(),//公司名称
- F_AreaName: $("#customer_comaddress").val(),//大区ID
- F_BranchName: $("#customer_legalName").val(),//分公司ID
- F_Salesman: $("#customer_lehalTel").val(),//业务员
- F_SalesPhone: $("#customer_subtrade").val(),//业务员电话
- F_CustomerNature: $("#customer_taxCategory").val(),//客户性质
- F_Channel: $('#customer_taxPointDes').val(),//渠道类型
- F_Credit: $("#customer_invoiceRange").val(),//信用等级
- F_Legal: $("#customer_layer").val(),//客户姓名
- F_LegalPhone: $("#customer_bedept").val(),//客户电话
- F_AddressProvince: $("#source").val(),//省
- F_AddressCity: $("#type").val(),//市
- F_AddressCountry: $("#keyid").val(),//县
- F_AddressTownship: $("#input_area").val(),//乡
- F_AddressFull: $("#customer_LegalIDCards").val(),//详细地址
- F_Brands: $("#customer_Qualification").val(),//经营品牌
- F_Product: $("#customer_FinancialManager").val(),//产品
- F_FrozenFlag: $("#customer_BusinessOwner").find('input[type="radio"]:checked').val(),//冻结标志
- F_IsOpenAccount: $('#customer_isbankSlips').find('input[type="radio"]:checked').val(),//是否开户
- F_LevelCode: $("#customer_Remark2").val(),//上级客户编码
- F_LevelName: $("#customer_Remark3").val(),//上级客户名称
- F_MnemonicCode: $("#customer_service").val(),//助记码
- F_InvoiceBank: $("#customer_handoverDate").val(),//开票银行名称
- F_InvoiceBankAccount: $("#customer_address").val(),//开票银行账户
- F_TaxRegCode: $("#customer_address1").val(),//纳税人登记号
- F_IsRunXLX: $('#customer').find('input[type="radio"]:checked').val(), //是否经营心连心
- F_AnnualSales: $("#customer_address2").val(),//年销量
- F_Formula : $("#customer_address3").val(),//配方
- F_RaiseCrops: $("#customer_address4").val(),//种植作物
- F_PlantingArea: $("#customer_feeExpires").val(),//种植面积
- F_FertilizerBrand: $("#customer_feeEx").val(),//用肥品牌
- F_FertilizerBrand: $("#customer_feeEx").val(),//用肥品牌
- F_FertilizerBrand: $("#customer_inv").val(),//用肥品牌
- F_Brands: $("#customer").val(),//其他经营品牌
- F_Remark: $("#F_Remark").val(),//备注
- F_Gender: $("#gender").val(),//性别 男 女
- token: $.cookie("token")
- }, function(result) {
- result = $.parseJSON(result);
- if(result.state.toLowerCase() == "success") {
- // debugger
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.$('#cusList').bootstrapTable('refresh');
- parent.layer.msg("添加客户成功");
- top.workcount();
- }
- })
- }
- //三级联动下拉
- $(document).ready(function () {
- var wid = helper.request.queryString("wid");
- LAISHENG($("#source"));
- CHOUDQ($("#customer_comaddress")); //大区
- QDLX($("#customer_taxPointDes"));
- XYDJ($("#customer_invoiceRange"));
- JYPP($("#customer_Qualification"));
- CAPI($("#customer_FinancialManager"));
- YFPP($("#customer_feeEx"));
-
- });
- function YFPP(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
- "token": $.cookie("token"),
- flag:"YFPP",
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
- })
- }
- })
- }
-
- //渠道类型
- function QDLX(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
- "token": $.cookie("token"),
- flag:"QDLX",
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
- })
- }
- })
- }
- //信用等级
- function XYDJ(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
- "token": $.cookie("token"),
- flag:"XYDJ",
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
- })
- }
- })
- }
- //经营品牌
- function JYPP(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
- "token": $.cookie("token"),
- flag:"JYPP",
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
- })
- }
- })
- }
- //产品
- function CAPI(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
- "token": $.cookie("token"),
- flag:"CAPI",
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
- })
- }
- })
- }
- //大区 分公司
- function CHOUDQ(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
- "token": $.cookie("token"),
- F_Layer: 1,
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
- })
- }
- })
- }
- //分公司
- function CHOUFEN(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
- "token": $.cookie("token"),
- F_Layer:2,
- F_DeptName:$("#customer_comaddress").find("option:selected").text(),
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
- })
- }
- })
- }
- $('#customer_comaddress').on('change',function(){
- $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
- "token": $.cookie("token"),
- F_Layer: 2,
- F_DeptName:$("#customer_comaddress").find("option:selected").text(),
-
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
-
- $(content).each(function (i, n) {
- $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo("#customer_legalName");
- })
- CHOUFEN($('#customer_legalName'));
- }
- })
- });
-
- //省是区县乡 省
- function LAISHENG(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
- "token": $.cookie("token"),
- F_Layer: 1,
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
- })
- }
- })
- }
- //市
- function LAISHI(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
- "token": $.cookie("token"),
- F_Layer: 2,
- F_RegionName:$('#source').val()
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
- })
- }
-
- })
- }
- // 区/县
- function LAIQU(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
- "token": $.cookie("token"),
- F_Layer: 3,
- F_RegionName:$('#type').val()
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
- })
- }
- })
- }
- // 乡
- function LAIXIANG(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
- "token": $.cookie("token"),
- F_Layer: 4,
- F_RegionName:$('#keyid').val()
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
- })
- }
- })
- }
-
- $('#source').on('change',function(){
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
- "token": $.cookie("token"),
- F_Layer: 2,
- F_RegionName:$('#source').val(),
-
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#type");
- })
- LAISHI($("#type"));
- }
- })
- });
- $('#type').on('change',function(){
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
- "token": $.cookie("token"),
- F_Layer: 3,
- F_RegionName:$('#type').val()
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#keyid");
- })
- LAIQU($("#keyid"));
- }
- })
- });
- $('#keyid').on('change',function(){
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
- "token": $.cookie("token"),
- F_Layer: 4,
- F_RegionName:$('#keyid').val()
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#input_area");
- })
- LAIXIANG($('#input_area'));
- }
- })
- });
-
- //渠道类型
-
- // $('#customer_taxPointDes').on('change',function(){
- // $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
- // "token": $.cookie("token"),
- // flag:QDLX,
- // F_DeptName:$('#customer_taxPointDes').val(),
- //
- // }, function (data) {
- // if (data.state.toLowerCase() == "success") {
- // var content = data.data;
- //
- // $(content).each(function (i, n) {
- // $("<option value='" + n.F_DeptName + "'>" + n.F_DeptName + "</option>").appendTo("#customer_legalName");
- // })
- //
- // }
- // })
- // });
- //
|