网站
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

registerFrom.js 20 KiB

4 yıl önce
4 yıl önce
2 yıl önce
1 yıl önce
4 yıl önce
2 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
2 yıl önce
2 yıl önce
1 yıl önce
4 yıl önce
4 yıl önce
3 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
2 yıl önce
1 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
1 yıl önce
2 yıl önce
4 yıl önce
2 yıl önce
4 yıl önce
2 yıl önce
4 yıl önce
4 yıl önce
2 yıl önce
4 yıl önce
1 yıl önce
4 yıl önce
4 yıl önce
2 yıl önce
4 yıl önce
2 yıl önce
4 yıl önce
4 yıl önce
2 yıl önce
4 yıl önce
4 yıl önce
2 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
4 yıl önce
1 yıl önce
1 yıl önce
1 yıl önce
4 yıl önce
1 yıl önce
1 yıl önce
1 yıl önce
1 yıl önce
1 yıl önce
4 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "user", "echarts", 'register', 'swiper',"cupload"], function ($, template, Tools, echarts, swiper) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. type: 1,
  9. sfz: '',
  10. yhk: '',
  11. khzm: '',
  12. frzjz: '',
  13. bankTypeOption:[],
  14. accountTypeOption:[],
  15. companyLicense:''
  16. },
  17. };
  18. var tools = new Tools();
  19. module.init = function (page) {
  20. //点击注册
  21. $('#register-submit').on('click', module.submitInfo)
  22. //点击图形验证码
  23. $('#graphicImgBtn').on('click', module.verificationCode)
  24. //图形验证码加载
  25. module.verificationCode()
  26. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  27. tools.getWebConfig();
  28. module.getType();
  29. tools.doGet(Dictionaries+'/economic_type', {}, module.economicTypeDictionaries,true);
  30. //所属银行
  31. tools.doGet(dictionaries+"/bank_type_all", {}, module.bankType, true);
  32. module.data.sheng = options;
  33. module.data.shi = options[0].children;
  34. var shengData = template('shengData', module.data);
  35. $("#sheng").html(shengData);
  36. var shiData = template('shiData', module.data);
  37. $("#shi").html(shiData);
  38. //账户类型
  39. tools.doGet(dictionaries+"/bank_account_type", {}, module.accountType, true);
  40. var cupload2 = new Cupload ({
  41. ele: '#cupload-3',
  42. num: 1,
  43. data:null
  44. });
  45. var cupload4 = new Cupload ({
  46. ele: '#cupload-4',
  47. num: 1,
  48. data:null
  49. });
  50. var cupload5 = new Cupload ({
  51. ele: '#cupload-5',
  52. num: 1,
  53. data:null
  54. });
  55. var cupload6 = new Cupload ({
  56. ele: '#cupload-6',
  57. num: 1,
  58. data:null
  59. });
  60. var cupload7 = new Cupload ({
  61. ele: '#cupload-7',
  62. num: 1,
  63. data:null
  64. });
  65. };
  66. //底部友情链接
  67. module.bankType = function (data) {
  68. if (data.code == 200) {
  69. var content = data.data;
  70. module.data.bankTypeOption = content;
  71. var bankTypeData = template('bankTypeData', module.data);
  72. $("#bankType").html(bankTypeData);
  73. }
  74. }
  75. //账户类型
  76. module.accountType = function (data) {
  77. if (data.code == 200) {
  78. var content = data.data;
  79. module.data.accountTypeOption = content;
  80. var accountTypeData = template('accountTypeData', module.data);
  81. $("#accountType").html(accountTypeData);
  82. }
  83. }
  84. getShi = function () {
  85. console.log($('#bankTypeData').val())
  86. // if (!$('#bankTypeData').val()){
  87. // return;
  88. // }
  89. module.data.shi = module.data.sheng.filter(function (e) { return e.label == $('#sheng').val(); })[0].children;
  90. var shiData = template('shiData', module.data);
  91. $("#shi").html(shiData);
  92. // tools.doGet(depositList, {sheng:$('#sheng').val(),shi:$('#shi').val()}, module.depositList, true);
  93. }
  94. getDeposit = function () {
  95. let data = {
  96. sheng:$('#sheng').val(),
  97. shi:$('#shi').val(),
  98. bankType:$('#bankType').val(),
  99. bankDeposit:$('#bankDeposit').val(),
  100. }
  101. console.log(data)
  102. tools.doGet(depositListYN, data,module.depositListYN);
  103. }
  104. changeBankAddress = function () {
  105. console.log($('#bankAddress').val())
  106. console.log(module.data.bankAddress.filter(function (e) { return e.bankDeposit == $('#bankAddress').val(); }))
  107. document.getElementById('payeePaymentLines').value =
  108. module.data.bankAddress.filter(function (e) { return e.bankDeposit == $('#bankAddress').val(); })[0].payeePaymentLines;
  109. }
  110. module.depositListYN = function (data) {
  111. var content = data.rows;
  112. if (content.length<1){
  113. let dataHtt = {
  114. sheng:$('#sheng').val(),
  115. shi:$('#shi').val(),
  116. bankType:$('#bankType').val(),
  117. bankDeposit:$('#bankDeposit').val(),
  118. }
  119. tools.doPost(depositListPub, dataHtt,module.depositList);
  120. }else{
  121. module.data.bankAddress = content;
  122. var bankAddressData = template('bankAddressData', module.data);
  123. $("#bankAddress").html(bankAddressData);
  124. if (content.length>0){
  125. changeBankAddress();
  126. }else{
  127. document.getElementById('payeePaymentLines').value = '';
  128. }
  129. }
  130. }
  131. module.depositList = function (data) {
  132. var content = data.data;
  133. module.data.bankAddress = content;
  134. var bankAddressData = template('bankAddressData', module.data);
  135. $("#bankAddress").html(bankAddressData);
  136. if (content.length>0){
  137. changeBankAddress();
  138. }else{
  139. document.getElementById('payeePaymentLines').value = '';
  140. }
  141. }
  142. //底部友情链接
  143. module.bottomFriendsLinks = function (data) {
  144. if (data.code == 200) {
  145. var content = data.data;
  146. console.log(content)
  147. module.data.friendsLinksList = content;
  148. var friendsLinksData = template('friendsLinksData', module.data);
  149. $("#friendsLinksContent").html(friendsLinksData);
  150. }
  151. }
  152. //获取地址栏参数
  153. function getQueryVariable(variable){
  154. var query = window.location.search.substring(1);
  155. var vars = query.split("&");
  156. for (var i=0;i<vars.length;i++) {
  157. var pair = vars[i].split("=");
  158. if(pair[0] == variable){return pair[1];}
  159. }
  160. return(false);
  161. }
  162. //经济类型
  163. module.economicTypeDictionaries = function (data) {
  164. if (data.code == 200) {
  165. var content = data.data;
  166. console.log(content)
  167. module.data.outProjectInformationDetail = content;
  168. var outProjectInformationData = template('outProjectInformationData', module.data);
  169. $("#economicType").html(outProjectInformationData);
  170. }
  171. }
  172. module.getType = function(){
  173. var type = getQueryVariable("type");
  174. if (type == 1){
  175. document.getElementById("userBtn").className = "active";
  176. document.getElementById("companyBtn").className = "";
  177. tabCheck('user');
  178. module.data.type = type;
  179. }else if(type == 2){
  180. document.getElementById("userBtn").className = "";
  181. document.getElementById("companyBtn").className = "active";
  182. tabCheck('company');
  183. module.data.type = type;
  184. }
  185. }
  186. tabCheck = function(type,typeNum){
  187. document.getElementById("userBtn").className = "";
  188. document.getElementById("companyBtn").className = "";
  189. document.getElementById("userTable").style.display = "none";
  190. document.getElementById("companyTable").style.display = "none";
  191. module.data.type = typeNum;
  192. document.getElementById(type+'Btn').className = 'active';
  193. document.getElementById(type+'Table').style.display = 'block';
  194. }
  195. //图形验证码
  196. module.verificationCode = function () {
  197. tools.doGet(captchaImage_get, {}, module.verificationAjax, true)
  198. }
  199. module.verificationAjax = function (data) {
  200. if (data.code == 200) {
  201. $('#graphicImg').attr('src', 'data:image/gif;base64,' + data.img)
  202. module.uuid = data.uuid;
  203. }
  204. }
  205. module.upLoadOverInfo1 = function(data){
  206. if (data.code == 200)
  207. module.data.sfz = data.fileName;
  208. }
  209. module.upLoadOverInfo2 = function(data){
  210. if (data.code == 200)
  211. module.data.yhk = data.fileName;
  212. }
  213. module.upLoadOverInfo5 = function(data){
  214. if (data.code == 200)
  215. module.data.khzm = data.fileName;
  216. }
  217. module.upLoadOverInfo6 = function(data){
  218. if (data.code == 200)
  219. module.data.frzjz = data.fileName;
  220. }
  221. module.upLoadOverInfo7 = function(data){
  222. if (data.code == 200)
  223. module.data.companyLicense = data.fileName;
  224. }
  225. module.submitInfo = function(type){
  226. document.getElementById('register-submit').style.display = 'none';
  227. if(module.data.type == '1'){
  228. $('#cupload-3').find('input').each(function() {
  229. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  230. module.data.upType1 = true;
  231. tools.doPostImg(base64Upload2, {file:$(this).val()}, module.upLoadOverInfo1);
  232. }
  233. })
  234. $('#cupload-4').find('input').each(function() {
  235. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  236. module.data.upType2 = true;
  237. tools.doPostImg(base64Upload2, {file:$(this).val()}, module.upLoadOverInfo2);
  238. }
  239. })
  240. setTimeout(module.register,1000);
  241. }else{
  242. $('#cupload-5').find('input').each(function() {
  243. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  244. module.data.upType5 = true;
  245. tools.doPostImg(base64Upload2, {file:$(this).val()}, module.upLoadOverInfo5);
  246. }
  247. })
  248. $('#cupload-6').find('input').each(function() {
  249. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  250. module.data.upType6 = true;
  251. tools.doPostImg(base64Upload2, {file:$(this).val()}, module.upLoadOverInfo6);
  252. }
  253. })
  254. $('#cupload-7').find('input').each(function() {
  255. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  256. module.data.upType67 = true;
  257. tools.doPostImg(base64Upload2, {file:$(this).val()}, module.upLoadOverInfo7);
  258. }
  259. })
  260. setTimeout(module.register,1000);
  261. }
  262. //memberType 1个人 2单位
  263. }
  264. //用户注册
  265. module.register = function (data) {
  266. var data = {};
  267. if(module.check()){
  268. if (module.data.type == 1){
  269. var phone = $('#phone').val();
  270. var passwordVal = $('#password').val();
  271. var codeVal = $('#code').val();
  272. var realName = $('#realName').val();
  273. var idCardNum = $('#idCardNum').val();
  274. var address = $('#address').val();
  275. var idCardPic = module.data.sfz;
  276. var accountOpenCert = module.data.yhk;
  277. var memberType = 1 ;
  278. data['idCardPic'] = idCardPic;
  279. data['accountOpenCert'] = accountOpenCert;
  280. data['phone'] = phone;
  281. data['password'] = passwordVal;
  282. data['code'] = codeVal;
  283. data['realname'] = realName;
  284. data['idCardNum'] = idCardNum;
  285. data['address'] = address;
  286. data['economicType'] = 1;
  287. data['accountType'] = 2;
  288. }
  289. if (module.data.type == 2){
  290. var phone = $('#phone').val();
  291. var passwordVal = $('#password').val();
  292. var codeVal = $('#code').val();
  293. var companyName = $('#companyName').val();
  294. var realName = $('#companyRealName').val();
  295. var idCardNum = $('#companyIdCardNum').val();
  296. var address = $('#companyAddress').val();
  297. var companyLicense = module.data.companyLicense;
  298. var companyCode = $('#companyCode').val();
  299. var economicType = $('#economicType').val();
  300. var accountOpenCert = module.data.khzm;
  301. var idCardPic = module.data.frzjz;
  302. data['accountOpenCert'] = accountOpenCert;
  303. data['idCardPic'] = idCardPic;
  304. data['phone'] = phone;
  305. data['password'] = passwordVal;
  306. data['code'] = codeVal;
  307. data['realname'] = realName;
  308. data['idCardNum'] = idCardNum;
  309. data['address'] = address;
  310. data['companyName'] = companyName;
  311. data['companyLicense'] = companyLicense;
  312. data['companyCode'] = companyCode;
  313. data['economicType'] = economicType;
  314. data['accountType'] = 1;
  315. }
  316. var bankCardName = $('#bankCardName').val();
  317. var bankCardNum = $('#bankCardNum').val();
  318. var bankAddress = $('#bankAddress').val();
  319. var bankType = $('#bankType').val();
  320. var accountType = $('#accountType').val();
  321. var payeePaymentLines = $('#payeePaymentLines').val();
  322. data['bankCardName'] = bankCardName;
  323. data['bankCardNum'] = bankCardNum;
  324. data['bankAddress'] = bankAddress;
  325. data['bankType'] = bankType;
  326. data['accountType'] = accountType;
  327. data['payeePaymentLines'] = payeePaymentLines;
  328. data['memberType'] = module.data.type;
  329. tools.doPost(userRegister, data, module.registerData, true)
  330. }else{
  331. document.getElementById('register-submit').style.display = 'block';
  332. }
  333. }
  334. //注册校验
  335. module.registerData = function (data) {
  336. console.log(data)
  337. if (data.code == 500) {
  338. module.verificationCode()
  339. }
  340. if (data.code == 200){
  341. tools.initError("注册成功");
  342. setTimeout(function(){
  343. tools.skip('login.html')
  344. },2000)
  345. }
  346. }
  347. //手动验证表单
  348. module.check = function () {
  349. var phone = $('#phone').val();
  350. var passwordVal = $('#password').val();
  351. var codeVal = $('#code').val();
  352. var realName = $('#realName').val();
  353. var idCardNum = $('#idCardNum').val();
  354. var companyRealName = $('#companyRealName').val();
  355. var companyIdCardNum = $('#companyIdCardNum').val();
  356. /* 手机号 */
  357. if (phone == '') {
  358. $('#phone')[0].focus()
  359. tools.initTips('请输入手机号', 'right', $('#phone')[0], 2000)
  360. return false;
  361. }
  362. if (module.data.type == 1) {
  363. /* 姓名 */
  364. if (realName == '') {
  365. $('#realName')[0].focus()
  366. tools.initTips('请输入姓名', 'right', $('#realName')[0], 2000)
  367. return false;
  368. }
  369. /* 身份证号 */
  370. if (idCardNum == '') {
  371. $('#idCardNum')[0].focus()
  372. tools.initTips('请输入身份证号', 'right', $('#idCardNum')[0], 2000)
  373. return false;
  374. }
  375. /* 地址 */
  376. if (address == '') {
  377. $('#address')[0].focus()
  378. tools.initTips('请输入地址', 'right', $('#address')[0], 2000)
  379. return false;
  380. }
  381. /* 身份证 */
  382. if (module.data.sfz == '') {
  383. $('#cupload-3')[0].focus()
  384. tools.initTips('请上传身份证', 'right', $('#cupload-3')[0], 2000)
  385. return false;
  386. }
  387. /* 银行卡 */
  388. if (module.data.yhk == '') {
  389. $('#cupload-4')[0].focus()
  390. tools.initTips('请上传银行卡', 'right', $('#cupload-4')[0], 2000)
  391. return false;
  392. }
  393. }
  394. if (module.data.type == 2){
  395. /* 姓名 */
  396. if (companyRealName == '') {
  397. $('#companyRealName')[0].focus()
  398. tools.initTips('请输入姓名', 'right', $('#companyRealName')[0], 2000)
  399. return false;
  400. }
  401. /* 身份证号 */
  402. if (companyIdCardNum == '') {
  403. $('#companyIdCardNum')[0].focus()
  404. tools.initTips('请输入身份证号', 'right', $('#companyIdCardNum')[0], 2000)
  405. return false;
  406. }
  407. /* 地址 */
  408. if (companyAddress == '') {
  409. $('#companyAddress')[0].focus()
  410. tools.initTips('请输入地址', 'right', $('#companyAddress')[0], 2000)
  411. return false;
  412. }
  413. /* 法人证件照 */
  414. if (module.data.frzjz == '') {
  415. $('#cupload-6')[0].focus()
  416. tools.initTips('请上传法人证件照', 'right', $('#cupload-6')[0], 2000)
  417. return false;
  418. }
  419. /* 上传附件 */
  420. if (module.data.companyLicense == '') {
  421. $('#cupload-7')[0].focus()
  422. tools.initTips('请上传营业执照', 'right', $('#cupload-7')[0], 2000)
  423. return false;
  424. }
  425. /* 上传附件 */
  426. if (module.data.khzm == '') {
  427. $('#cupload-5')[0].focus()
  428. tools.initTips('请上传开户证明', 'right', $('#cupload-5')[0], 2000)
  429. return false;
  430. }
  431. }
  432. /* 密码 */
  433. if (passwordVal == '') {
  434. $('#password')[0].focus()
  435. tools.initTips('请输入密码', 'right', $('#password')[0], 2000)
  436. return false;
  437. } else if (parseInt(passwordVal.length) < 6 || parseInt(passwordVal.length) > 18) {
  438. $('#password')[0].focus()
  439. tools.initTips('请输入正确格式密码', 'right', $('#password')[0], 2000)
  440. return false;
  441. }else if($('#password').val() != $('#passwordAgain').val()){
  442. $('#password')[0].focus()
  443. tools.initTips('两次密码输入不一致', 'right', $('#password')[0], 2000)
  444. return false;
  445. }
  446. /*图形验证码*/
  447. if (module.uuid == '' || codeVal == '') {
  448. $('#code')[0].focus()
  449. tools.initTips('请输入图形验证码', 'right', $('#code')[0], 2000)
  450. return false;
  451. }
  452. var bankCardName = $('#bankCardName').val();
  453. var bankCardNum = $('#bankCardNum').val();
  454. var bankAddress = $('#bankAddress').val();
  455. var bankType = $('#bankType').val();
  456. var accountType = $('#accountType').val();
  457. var payeePaymentLines = $('#payeePaymentLines').val();
  458. if (bankCardName == ''||bankCardName == null) {
  459. $('#bankCardName')[0].focus()
  460. tools.initTips('请输入开户姓名', 'right', $('#bankCardName')[0], 2000)
  461. return false;
  462. }
  463. if (bankCardNum == ''||bankCardNum == null) {
  464. $('#bankCardNum')[0].focus()
  465. tools.initTips('请输入开户账号', 'right', $('#bankCardNum')[0], 2000)
  466. return false;
  467. }
  468. if (bankType == ''||bankCardNum == null) {
  469. $('#bankType')[0].focus()
  470. tools.initTips('请选择所属银行', 'right', $('#bankType')[0], 2000)
  471. return false;
  472. }
  473. if (bankAddress == ''||bankAddress == null) {
  474. $('#bankAddress')[0].focus()
  475. tools.initTips('请选择开户银行', 'right', $('#bankAddress')[0], 2000)
  476. return false;
  477. }
  478. if (payeePaymentLines == ''||payeePaymentLines == null) {
  479. $('#payeePaymentLines')[0].focus()
  480. tools.initTips('请输入联行号', 'right', $('#payeePaymentLines')[0], 2000)
  481. return false;
  482. }
  483. console.log($('#iAgree:checked').val())
  484. if ($('#iAgree:checked').val() == undefined){
  485. tools.initTips('请选择我已同意', 'right', $('#iAgree')[0], 2000)
  486. return false;
  487. }
  488. return true;
  489. }
  490. return module;
  491. });