网站
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

510 行
18 KiB

  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.doPost(depositListPub, data,module.depositList);
  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.depositList = function (data) {
  111. var content = data.data;
  112. module.data.bankAddress = content;
  113. var bankAddressData = template('bankAddressData', module.data);
  114. $("#bankAddress").html(bankAddressData);
  115. if (content.length>0){
  116. changeBankAddress();
  117. }else{
  118. document.getElementById('payeePaymentLines').value = '';
  119. }
  120. }
  121. //底部友情链接
  122. module.bottomFriendsLinks = function (data) {
  123. if (data.code == 200) {
  124. var content = data.data;
  125. console.log(content)
  126. module.data.friendsLinksList = content;
  127. var friendsLinksData = template('friendsLinksData', module.data);
  128. $("#friendsLinksContent").html(friendsLinksData);
  129. }
  130. }
  131. //获取地址栏参数
  132. function getQueryVariable(variable){
  133. var query = window.location.search.substring(1);
  134. var vars = query.split("&");
  135. for (var i=0;i<vars.length;i++) {
  136. var pair = vars[i].split("=");
  137. if(pair[0] == variable){return pair[1];}
  138. }
  139. return(false);
  140. }
  141. //经济类型
  142. module.economicTypeDictionaries = function (data) {
  143. if (data.code == 200) {
  144. var content = data.data;
  145. console.log(content)
  146. module.data.outProjectInformationDetail = content;
  147. var outProjectInformationData = template('outProjectInformationData', module.data);
  148. $("#economicType").html(outProjectInformationData);
  149. }
  150. }
  151. module.getType = function(){
  152. var type = getQueryVariable("type");
  153. if (type == 1){
  154. document.getElementById("userBtn").className = "active";
  155. document.getElementById("companyBtn").className = "";
  156. tabCheck('user');
  157. module.data.type = type;
  158. }else if(type == 2){
  159. document.getElementById("userBtn").className = "";
  160. document.getElementById("companyBtn").className = "active";
  161. tabCheck('company');
  162. module.data.type = type;
  163. }
  164. }
  165. tabCheck = function(type,typeNum){
  166. document.getElementById("userBtn").className = "";
  167. document.getElementById("companyBtn").className = "";
  168. document.getElementById("userTable").style.display = "none";
  169. document.getElementById("companyTable").style.display = "none";
  170. module.data.type = typeNum;
  171. document.getElementById(type+'Btn').className = 'active';
  172. document.getElementById(type+'Table').style.display = 'block';
  173. }
  174. //图形验证码
  175. module.verificationCode = function () {
  176. tools.doGet(captchaImage_get, {}, module.verificationAjax, true)
  177. }
  178. module.verificationAjax = function (data) {
  179. if (data.code == 200) {
  180. $('#graphicImg').attr('src', 'data:image/gif;base64,' + data.img)
  181. module.uuid = data.uuid;
  182. }
  183. }
  184. module.upLoadOverInfo1 = function(data){
  185. if (data.code == 200)
  186. module.data.sfz = data.fileName;
  187. }
  188. module.upLoadOverInfo2 = function(data){
  189. if (data.code == 200)
  190. module.data.yhk = data.fileName;
  191. }
  192. module.upLoadOverInfo5 = function(data){
  193. if (data.code == 200)
  194. module.data.khzm = data.fileName;
  195. }
  196. module.upLoadOverInfo6 = function(data){
  197. if (data.code == 200)
  198. module.data.frzjz = data.fileName;
  199. }
  200. module.upLoadOverInfo7 = function(data){
  201. if (data.code == 200)
  202. module.data.companyLicense = data.fileName;
  203. }
  204. module.submitInfo = function(type){
  205. if(module.data.type == '1'){
  206. $('#cupload-3').find('input').each(function() {
  207. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  208. module.data.upType1 = true;
  209. tools.doPostImg(base64Upload2, {file:$(this).val()}, module.upLoadOverInfo1);
  210. }
  211. })
  212. $('#cupload-4').find('input').each(function() {
  213. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  214. module.data.upType2 = true;
  215. tools.doPostImg(base64Upload2, {file:$(this).val()}, module.upLoadOverInfo2);
  216. }
  217. })
  218. setTimeout(module.register,1000);
  219. }else{
  220. $('#cupload-5').find('input').each(function() {
  221. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  222. module.data.upType5 = true;
  223. tools.doPostImg(base64Upload2, {file:$(this).val()}, module.upLoadOverInfo5);
  224. }
  225. })
  226. $('#cupload-6').find('input').each(function() {
  227. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  228. module.data.upType6 = true;
  229. tools.doPostImg(base64Upload2, {file:$(this).val()}, module.upLoadOverInfo6);
  230. }
  231. })
  232. $('#cupload-7').find('input').each(function() {
  233. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  234. module.data.upType67 = true;
  235. tools.doPostImg(base64Upload2, {file:$(this).val()}, module.upLoadOverInfo7);
  236. }
  237. })
  238. setTimeout(module.register,1000);
  239. }
  240. //memberType 1个人 2单位
  241. }
  242. //用户注册
  243. module.register = function (data) {
  244. var data = {};
  245. if(module.check()){
  246. if (module.data.type == 1){
  247. var phone = $('#phone').val();
  248. var passwordVal = $('#password').val();
  249. var codeVal = $('#code').val();
  250. var realName = $('#realName').val();
  251. var idCardNum = $('#idCardNum').val();
  252. var address = $('#address').val();
  253. var idCardPic = module.data.sfz;
  254. var accountOpenCert = module.data.yhk;
  255. var memberType = 1 ;
  256. data['idCardPic'] = idCardPic;
  257. data['accountOpenCert'] = accountOpenCert;
  258. data['phone'] = phone;
  259. data['password'] = passwordVal;
  260. data['code'] = codeVal;
  261. data['realname'] = realName;
  262. data['idCardNum'] = idCardNum;
  263. data['address'] = address;
  264. data['economicType'] = 1;
  265. data['accountType'] = 2;
  266. }
  267. if (module.data.type == 2){
  268. var phone = $('#phone').val();
  269. var passwordVal = $('#password').val();
  270. var codeVal = $('#code').val();
  271. var companyName = $('#companyName').val();
  272. var realName = $('#companyRealName').val();
  273. var idCardNum = $('#companyIdCardNum').val();
  274. var address = $('#companyAddress').val();
  275. var companyLicense = module.data.companyLicense;
  276. var companyCode = $('#companyCode').val();
  277. var economicType = $('#economicType').val();
  278. var accountOpenCert = module.data.khzm;
  279. var idCardPic = module.data.frzjz;
  280. data['accountOpenCert'] = accountOpenCert;
  281. data['idCardPic'] = idCardPic;
  282. data['phone'] = phone;
  283. data['password'] = passwordVal;
  284. data['code'] = codeVal;
  285. data['realname'] = realName;
  286. data['idCardNum'] = idCardNum;
  287. data['address'] = address;
  288. data['companyName'] = companyName;
  289. data['companyLicense'] = companyLicense;
  290. data['companyCode'] = companyCode;
  291. data['economicType'] = economicType;
  292. data['accountType'] = 1;
  293. }
  294. var bankCardName = $('#bankCardName').val();
  295. var bankCardNum = $('#bankCardNum').val();
  296. var bankAddress = $('#bankAddress').val();
  297. var bankType = $('#bankType').val();
  298. var accountType = $('#accountType').val();
  299. var payeePaymentLines = $('#payeePaymentLines').val();
  300. data['bankCardName'] = bankCardName;
  301. data['bankCardNum'] = bankCardNum;
  302. data['bankAddress'] = bankAddress;
  303. data['bankType'] = bankType;
  304. data['accountType'] = accountType;
  305. data['payeePaymentLines'] = payeePaymentLines;
  306. data['memberType'] = module.data.type;
  307. tools.doPost(userRegister, data, module.registerData, true)
  308. }
  309. }
  310. //注册校验
  311. module.registerData = function (data) {
  312. console.log(data)
  313. if (data.code == 500) {
  314. module.verificationCode()
  315. }
  316. if (data.code == 200){
  317. tools.initError("注册成功");
  318. setTimeout(function(){
  319. tools.skip('login.html')
  320. },2000)
  321. }
  322. }
  323. //手动验证表单
  324. module.check = function () {
  325. var phone = $('#phone').val();
  326. var passwordVal = $('#password').val();
  327. var codeVal = $('#code').val();
  328. var realName = $('#realName').val();
  329. var idCardNum = $('#idCardNum').val();
  330. var companyRealName = $('#companyRealName').val();
  331. var companyIdCardNum = $('#companyIdCardNum').val();
  332. /* 手机号 */
  333. if (phone == '') {
  334. $('#phone')[0].focus()
  335. tools.initTips('请输入手机号', 'right', $('#phone')[0], 2000)
  336. return false;
  337. }
  338. if (module.data.type == 1) {
  339. /* 姓名 */
  340. if (realName == '') {
  341. $('#realName')[0].focus()
  342. tools.initTips('请输入姓名', 'right', $('#realName')[0], 2000)
  343. return false;
  344. }
  345. /* 身份证号 */
  346. if (idCardNum == '') {
  347. $('#idCardNum')[0].focus()
  348. tools.initTips('请输入身份证号', 'right', $('#idCardNum')[0], 2000)
  349. return false;
  350. }
  351. /* 地址 */
  352. if (address == '') {
  353. $('#address')[0].focus()
  354. tools.initTips('请输入地址', 'right', $('#address')[0], 2000)
  355. return false;
  356. }
  357. /* 身份证 */
  358. if (module.data.sfz == '') {
  359. $('#cupload-3')[0].focus()
  360. tools.initTips('请上传身份证', 'right', $('#cupload-3')[0], 2000)
  361. return false;
  362. }
  363. /* 银行卡 */
  364. if (module.data.yhk == '') {
  365. $('#cupload-4')[0].focus()
  366. tools.initTips('请上传银行卡', 'right', $('#cupload-4')[0], 2000)
  367. return false;
  368. }
  369. }
  370. if (module.data.type == 2){
  371. /* 姓名 */
  372. if (companyRealName == '') {
  373. $('#companyRealName')[0].focus()
  374. tools.initTips('请输入姓名', 'right', $('#companyRealName')[0], 2000)
  375. return false;
  376. }
  377. /* 身份证号 */
  378. if (companyIdCardNum == '') {
  379. $('#companyIdCardNum')[0].focus()
  380. tools.initTips('请输入身份证号', 'right', $('#companyIdCardNum')[0], 2000)
  381. return false;
  382. }
  383. /* 地址 */
  384. if (companyAddress == '') {
  385. $('#companyAddress')[0].focus()
  386. tools.initTips('请输入地址', 'right', $('#companyAddress')[0], 2000)
  387. return false;
  388. }
  389. /* 法人证件照 */
  390. if (module.data.frzjz == '') {
  391. $('#cupload-6')[0].focus()
  392. tools.initTips('请上传法人证件照', 'right', $('#cupload-6')[0], 2000)
  393. return false;
  394. }
  395. /* 上传附件 */
  396. if (module.data.companyLicense == '') {
  397. $('#cupload-7')[0].focus()
  398. tools.initTips('请上传营业执照', 'right', $('#cupload-7')[0], 2000)
  399. return false;
  400. }
  401. /* 上传附件 */
  402. if (module.data.khzm == '') {
  403. $('#cupload-5')[0].focus()
  404. tools.initTips('请上传开户证明', 'right', $('#cupload-5')[0], 2000)
  405. return false;
  406. }
  407. }
  408. /* 密码 */
  409. if (passwordVal == '') {
  410. $('#password')[0].focus()
  411. tools.initTips('请输入密码', 'right', $('#password')[0], 2000)
  412. return false;
  413. } else if (parseInt(passwordVal.length) < 6 || parseInt(passwordVal.length) > 18) {
  414. $('#password')[0].focus()
  415. tools.initTips('请输入正确格式密码', 'right', $('#password')[0], 2000)
  416. return false;
  417. }else if($('#password').val() != $('#passwordAgain').val()){
  418. $('#password')[0].focus()
  419. tools.initTips('两次密码输入不一致', 'right', $('#password')[0], 2000)
  420. return false;
  421. }
  422. /*图形验证码*/
  423. if (module.uuid == '' || codeVal == '') {
  424. $('#code')[0].focus()
  425. tools.initTips('请输入图形验证码', 'right', $('#code')[0], 2000)
  426. return false;
  427. }
  428. var bankCardName = $('#bankCardName').val();
  429. var bankCardNum = $('#bankCardNum').val();
  430. var bankAddress = $('#bankAddress').val();
  431. var bankType = $('#bankType').val();
  432. var accountType = $('#accountType').val();
  433. var payeePaymentLines = $('#payeePaymentLines').val();
  434. if (bankCardName == ''||bankCardName == null) {
  435. $('#bankCardName')[0].focus()
  436. tools.initTips('请输入开户姓名', 'right', $('#bankCardName')[0], 2000)
  437. return false;
  438. }
  439. if (bankCardNum == ''||bankCardNum == null) {
  440. $('#bankCardNum')[0].focus()
  441. tools.initTips('请输入开户账号', 'right', $('#bankCardNum')[0], 2000)
  442. return false;
  443. }
  444. if (bankType == ''||bankCardNum == null) {
  445. $('#bankType')[0].focus()
  446. tools.initTips('请选择所属银行', 'right', $('#bankType')[0], 2000)
  447. return false;
  448. }
  449. if (bankAddress == ''||bankAddress == null) {
  450. $('#bankAddress')[0].focus()
  451. tools.initTips('请选择开户银行', 'right', $('#bankAddress')[0], 2000)
  452. return false;
  453. }
  454. if (payeePaymentLines == ''||payeePaymentLines == null) {
  455. $('#payeePaymentLines')[0].focus()
  456. tools.initTips('请输入联行号', 'right', $('#payeePaymentLines')[0], 2000)
  457. return false;
  458. }
  459. console.log($('#iAgree:checked').val())
  460. if ($('#iAgree:checked').val() == undefined){
  461. tools.initTips('请选择我已同意', 'right', $('#iAgree')[0], 2000)
  462. return false;
  463. }
  464. return true;
  465. }
  466. return module;
  467. });