暫無描述

addOrEditCusInfo.js 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. function sd(){
  2. $("#customer_code").val("");
  3. };
  4. function ischeckNum() {
  5. var num = document.getElementById('customer_code').value;//在此处下修改id
  6. if( num ){
  7. if( !isNaN( num ) ){
  8. if(num.length>10){
  9. sd();
  10. $("#aaa").css("color","red").html("当前输入的编号大于10位,请输入10位编号");
  11. }else if(num.length<10 && num.length>0){
  12. sd();
  13. $("#aaa").css("color","red").html("当前输入的编号小于10位,请输入10位的编号!");
  14. }
  15. return false;
  16. }else{
  17. $("#aaa").css("color","red").html("你输入的数据不是数字");
  18. sd();
  19. return false;
  20. }
  21. }else{
  22. $("#aaa").css("color","red").html("编号不能为空");
  23. }
  24. }
  25. $("#customer_code").blur(function(){
  26. ischeckNum();
  27. })
  28. // function select(obj){
  29. // $("#aaa" + obj.value).show().siblings().hide();
  30. //
  31. // }
  32. $("#customer_taxPointDes").change(function(){
  33. if($("#customer_taxPointDes").find("option:selected").text()=="二级商"){
  34. $("#bbb").show()
  35. }else{
  36. $("#bbb").hide()
  37. }
  38. // $(this).find("option").each(function(){
  39. // if ($(this).prop("selected")) {
  40. // $("#bbb"+$(this).val()).show()
  41. // } else {
  42. // $("#bbb"+$(this).val()).hide()
  43. // }
  44. // })
  45. })
  46. $("#customer_taxPointDes").change(function(){
  47. if($("#customer_taxPointDes").find("option:selected").text()=="种田大户"){
  48. $("#ccc").show()
  49. }else{
  50. $("#ccc").hide()
  51. }
  52. })
  53. $("#customer_feeEx").change(function(){
  54. if($("#customer_feeEx").find("option:selected").text()=="其他"){
  55. $("#ddd").show()
  56. }else{
  57. $("#ddd").hide()
  58. }
  59. })
  60. $("#customer_Qualification").change(function(){
  61. if($("#customer_Qualification").find("option:selected").text()=="其他"){
  62. $("#eee").show()
  63. }else{
  64. $("#eee").hide()
  65. }
  66. })
  67. function addedit() {
  68. // var mobileNumReg = /^\d{11}$/,
  69. // if(!mobileNumReg.test($.trim($("#F_MaterialCode").val()))) {
  70. // layer.confirm('号段长度11位,且必须是数字。', {
  71. // icon: 2,
  72. // btn: ['确定'] //按钮
  73. // });
  74. // return;
  75. // }
  76. $.post(huayi.config.callcenter_url + "CustomerNew/Add", {
  77. F_CustomerCode: $("#customer_code").val(),//客户编码
  78. F_CompanyName: $("#customer_companyname").val(),//公司名称
  79. F_AreaName: $("#customer_comaddress").val(),//大区ID
  80. F_BranchName: $("#customer_legalName").val(),//分公司ID
  81. F_Salesman: $("#customer_lehalTel").val(),//业务员
  82. F_SalesPhone: $("#customer_subtrade").val(),//业务员电话
  83. F_CustomerNature: $("#customer_taxCategory").val(),//客户性质
  84. F_Channel: $('#customer_taxPointDes').val(),//渠道类型
  85. F_Credit: $("#customer_invoiceRange").val(),//信用等级
  86. F_Legal: $("#customer_layer").val(),//客户姓名
  87. F_LegalPhone: $("#customer_bedept").val(),//客户电话
  88. F_AddressProvince: $("#source").val(),//省
  89. F_AddressCity: $("#type").val(),//市
  90. F_AddressCountry: $("#keyid").val(),//县
  91. F_AddressTownship: $("#input_area").val(),//乡
  92. F_AddressFull: $("#customer_LegalIDCards").val(),//详细地址
  93. F_Brands: $("#customer_Qualification").val(),//经营品牌
  94. F_Product: $("#customer_FinancialManager").val(),//产品
  95. F_FrozenFlag: $("#customer_BusinessOwner").find('input[type="radio"]:checked').val(),//冻结标志
  96. F_IsOpenAccount: $('#customer_isbankSlips').find('input[type="radio"]:checked').val(),//是否开户
  97. F_LevelCode: $("#customer_Remark2").val(),//上级客户编码
  98. F_LevelName: $("#customer_Remark3").val(),//上级客户名称
  99. F_MnemonicCode: $("#customer_service").val(),//助记码
  100. F_InvoiceBank: $("#customer_handoverDate").val(),//开票银行名称
  101. F_InvoiceBankAccount: $("#customer_address").val(),//开票银行账户
  102. F_TaxRegCode: $("#customer_address1").val(),//纳税人登记号
  103. F_IsRunXLX: $('#customer').find('input[type="radio"]:checked').val(), //是否经营心连心
  104. F_AnnualSales: $("#customer_address2").val(),//年销量
  105. F_Formula : $("#customer_address3").val(),//配方
  106. F_RaiseCrops: $("#customer_address4").val(),//种植作物
  107. F_PlantingArea: $("#customer_feeExpires").val(),//种植面积
  108. F_FertilizerBrand: $("#customer_feeEx").val(),//用肥品牌
  109. F_FertilizerBrand: $("#customer_feeEx").val(),//用肥品牌
  110. F_FertilizerBrand: $("#customer_inv").val(),//用肥品牌
  111. F_Brands: $("#customer").val(),//其他经营品牌
  112. F_Remark: $("#F_Remark").val(),//备注
  113. F_Gender: $("#gender").val(),//性别 男 女
  114. token: $.cookie("token")
  115. }, function(result) {
  116. result = $.parseJSON(result);
  117. if(result.state.toLowerCase() == "success") {
  118. // debugger
  119. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  120. parent.layer.close(index); //再执行关闭
  121. parent.$('#cusList').bootstrapTable('refresh');
  122. parent.layer.msg("添加客户成功");
  123. top.workcount();
  124. }
  125. })
  126. }
  127. //三级联动下拉
  128. $(document).ready(function () {
  129. var wid = helper.request.queryString("wid");
  130. LAISHENG($("#source"));
  131. CHOUDQ($("#customer_comaddress")); //大区
  132. QDLX($("#customer_taxPointDes"));
  133. XYDJ($("#customer_invoiceRange"));
  134. JYPP($("#customer_Qualification"));
  135. CAPI($("#customer_FinancialManager"));
  136. YFPP($("#customer_feeEx"));
  137. });
  138. function YFPP(obj) {
  139. obj.empty();
  140. obj.append('<option selected="selected" value="">请选择</option>');
  141. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  142. "token": $.cookie("token"),
  143. flag:"YFPP",
  144. }, function (data) {
  145. if (data.state.toLowerCase() == "success") {
  146. var content = data.data;
  147. $(content).each(function (i, n) {
  148. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  149. })
  150. }
  151. })
  152. }
  153. //渠道类型
  154. function QDLX(obj) {
  155. obj.empty();
  156. obj.append('<option selected="selected" value="">请选择</option>');
  157. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  158. "token": $.cookie("token"),
  159. flag:"QDLX",
  160. }, function (data) {
  161. if (data.state.toLowerCase() == "success") {
  162. var content = data.data;
  163. $(content).each(function (i, n) {
  164. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  165. })
  166. }
  167. })
  168. }
  169. //信用等级
  170. function XYDJ(obj) {
  171. obj.empty();
  172. obj.append('<option selected="selected" value="">请选择</option>');
  173. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  174. "token": $.cookie("token"),
  175. flag:"XYDJ",
  176. }, function (data) {
  177. if (data.state.toLowerCase() == "success") {
  178. var content = data.data;
  179. $(content).each(function (i, n) {
  180. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  181. })
  182. }
  183. })
  184. }
  185. //经营品牌
  186. function JYPP(obj) {
  187. obj.empty();
  188. obj.append('<option selected="selected" value="">请选择</option>');
  189. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  190. "token": $.cookie("token"),
  191. flag:"JYPP",
  192. }, function (data) {
  193. if (data.state.toLowerCase() == "success") {
  194. var content = data.data;
  195. $(content).each(function (i, n) {
  196. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  197. })
  198. }
  199. })
  200. }
  201. //产品
  202. function CAPI(obj) {
  203. obj.empty();
  204. obj.append('<option selected="selected" value="">请选择</option>');
  205. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  206. "token": $.cookie("token"),
  207. flag:"CAPI",
  208. }, function (data) {
  209. if (data.state.toLowerCase() == "success") {
  210. var content = data.data;
  211. $(content).each(function (i, n) {
  212. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  213. })
  214. }
  215. })
  216. }
  217. //大区 分公司
  218. function CHOUDQ(obj) {
  219. obj.empty();
  220. obj.append('<option selected="selected" value="">请选择</option>');
  221. $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
  222. "token": $.cookie("token"),
  223. F_Layer: 1,
  224. }, function (data) {
  225. if (data.state.toLowerCase() == "success") {
  226. var content = data.data;
  227. $(content).each(function (i, n) {
  228. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
  229. })
  230. }
  231. })
  232. }
  233. //分公司
  234. function CHOUFEN(obj) {
  235. obj.empty();
  236. obj.append('<option selected="selected" value="">请选择</option>');
  237. $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
  238. "token": $.cookie("token"),
  239. F_Layer:2,
  240. F_DeptName:$("#customer_comaddress").find("option:selected").text(),
  241. }, function (data) {
  242. if (data.state.toLowerCase() == "success") {
  243. var content = data.data;
  244. $(content).each(function (i, n) {
  245. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
  246. })
  247. }
  248. })
  249. }
  250. $('#customer_comaddress').on('change',function(){
  251. $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
  252. "token": $.cookie("token"),
  253. F_Layer: 2,
  254. F_DeptName:$("#customer_comaddress").find("option:selected").text(),
  255. }, function (data) {
  256. if (data.state.toLowerCase() == "success") {
  257. var content = data.data;
  258. $(content).each(function (i, n) {
  259. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo("#customer_legalName");
  260. })
  261. CHOUFEN($('#customer_legalName'));
  262. }
  263. })
  264. });
  265. //省是区县乡 省
  266. function LAISHENG(obj) {
  267. obj.empty();
  268. obj.append('<option selected="selected" value="">请选择</option>');
  269. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  270. "token": $.cookie("token"),
  271. F_Layer: 1,
  272. }, function (data) {
  273. if (data.state.toLowerCase() == "success") {
  274. var content = data.data;
  275. $(content).each(function (i, n) {
  276. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  277. })
  278. }
  279. })
  280. }
  281. //市
  282. function LAISHI(obj) {
  283. obj.empty();
  284. obj.append('<option selected="selected" value="">请选择</option>');
  285. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  286. "token": $.cookie("token"),
  287. F_Layer: 2,
  288. F_RegionName:$('#source').val()
  289. }, function (data) {
  290. if (data.state.toLowerCase() == "success") {
  291. var content = data.data;
  292. $(content).each(function (i, n) {
  293. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  294. })
  295. }
  296. })
  297. }
  298. // 区/县
  299. function LAIQU(obj) {
  300. obj.empty();
  301. obj.append('<option selected="selected" value="">请选择</option>');
  302. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  303. "token": $.cookie("token"),
  304. F_Layer: 3,
  305. F_RegionName:$('#type').val()
  306. }, function (data) {
  307. if (data.state.toLowerCase() == "success") {
  308. var content = data.data;
  309. $(content).each(function (i, n) {
  310. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  311. })
  312. }
  313. })
  314. }
  315. // 乡
  316. function LAIXIANG(obj) {
  317. obj.empty();
  318. obj.append('<option selected="selected" value="">请选择</option>');
  319. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  320. "token": $.cookie("token"),
  321. F_Layer: 4,
  322. F_RegionName:$('#keyid').val()
  323. }, function (data) {
  324. if (data.state.toLowerCase() == "success") {
  325. var content = data.data;
  326. $(content).each(function (i, n) {
  327. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  328. })
  329. }
  330. })
  331. }
  332. $('#source').on('change',function(){
  333. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  334. "token": $.cookie("token"),
  335. F_Layer: 2,
  336. F_RegionName:$('#source').val(),
  337. }, function (data) {
  338. if (data.state.toLowerCase() == "success") {
  339. var content = data.data;
  340. $(content).each(function (i, n) {
  341. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#type");
  342. })
  343. LAISHI($("#type"));
  344. }
  345. })
  346. });
  347. $('#type').on('change',function(){
  348. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  349. "token": $.cookie("token"),
  350. F_Layer: 3,
  351. F_RegionName:$('#type').val()
  352. }, function (data) {
  353. if (data.state.toLowerCase() == "success") {
  354. var content = data.data;
  355. $(content).each(function (i, n) {
  356. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#keyid");
  357. })
  358. LAIQU($("#keyid"));
  359. }
  360. })
  361. });
  362. $('#keyid').on('change',function(){
  363. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  364. "token": $.cookie("token"),
  365. F_Layer: 4,
  366. F_RegionName:$('#keyid').val()
  367. }, function (data) {
  368. if (data.state.toLowerCase() == "success") {
  369. var content = data.data;
  370. $(content).each(function (i, n) {
  371. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#input_area");
  372. })
  373. LAIXIANG($('#input_area'));
  374. }
  375. })
  376. });
  377. //渠道类型
  378. // $('#customer_taxPointDes').on('change',function(){
  379. // $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  380. // "token": $.cookie("token"),
  381. // flag:QDLX,
  382. // F_DeptName:$('#customer_taxPointDes').val(),
  383. //
  384. // }, function (data) {
  385. // if (data.state.toLowerCase() == "success") {
  386. // var content = data.data;
  387. //
  388. // $(content).each(function (i, n) {
  389. // $("<option value='" + n.F_DeptName + "'>" + n.F_DeptName + "</option>").appendTo("#customer_legalName");
  390. // })
  391. //
  392. // }
  393. // })
  394. // });
  395. //