网站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1168 line
44 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "user", "paging","cupload","kindeditor", 'swiper'], function ($, template, Tools ) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //焦点图数据
  9. focusListTop: [],
  10. userInformationDetail:[],
  11. userSupplyInformationList:'',
  12. consultingInformationList:'',
  13. biddingInformationList:'',
  14. //页码
  15. pageNum: 1,
  16. //页码集合
  17. pageList: [],
  18. //每页数量
  19. pageSize: 5,
  20. //总页数
  21. pageCount:0,
  22. //用户ID
  23. memberId:0,
  24. //用户资料form
  25. form:{
  26. },
  27. modifyUrl:'',
  28. detailUrl:'',
  29. sheng:[],
  30. shi:[],
  31. sfzList:[],
  32. yhkList:[],
  33. sfz:'',
  34. yhk:'',
  35. khzm:'',
  36. upType1:false,
  37. upType2:false,
  38. upType5:false,
  39. },
  40. };
  41. var tools = new Tools();
  42. module.init = function (page) {
  43. //获取焦点图信息
  44. tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
  45. //底部友情链接
  46. tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
  47. //用户资料
  48. tools.doGet(userData, {}, module.userData);
  49. if(!tools.getCookie('Admin-Token')){
  50. tools.skip('../../index.html')
  51. }
  52. //用户资料
  53. //tools.doPut(userData, {id:}, module.userData,true);
  54. //个人中心选项卡鼠标悬浮
  55. module.userListHover();
  56. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  57. tools.getWebConfig();
  58. //所属银行
  59. tools.doGet(dictionaries+"/bank_type_all", {}, module.bankType, true);
  60. //账户类型
  61. tools.doGet(dictionaries+"/bank_account_type", {}, module.accountType, true);
  62. window.KindEditor.create('#editor_id')
  63. //console.log(tools.getParam('type'))
  64. var type = tools.getParam('type');
  65. module.getType(type);
  66. setTimeout(function(){
  67. //主题图片切换
  68. module.switchTheme();
  69. },2000)
  70. module.data.sheng = options;
  71. module.data.shi = options[0].children;
  72. var shengData = template('shengData', module.data);
  73. $("#sheng").html(shengData);
  74. var shiData = template('shiData', module.data);
  75. $("#shi").html(shiData);
  76. };
  77. getShi = function () {
  78. console.log($('#bankTypeData').val())
  79. // if (!$('#bankTypeData').val()){
  80. // return;
  81. // }
  82. module.data.shi = module.data.sheng.filter(function (e) { return e.label == $('#sheng').val(); })[0].children;
  83. var shiData = template('shiData', module.data);
  84. $("#shi").html(shiData);
  85. // tools.doGet(depositList, {sheng:$('#sheng').val(),shi:$('#shi').val()}, module.depositList, true);
  86. }
  87. getDeposit = function () {
  88. let data = {
  89. sheng:$('#sheng').val(),
  90. shi:$('#shi').val(),
  91. bankType:$('#bankType').val(),
  92. bankDeposit:$('#bankDeposit').val(),
  93. }
  94. console.log(data)
  95. tools.doPost(depositList, data,module.depositList);
  96. }
  97. changeBankAddress = function () {
  98. console.log($('#bankAddress').val())
  99. console.log(module.data.bankAddress.filter(function (e) { return e.bankDeposit == $('#bankAddress').val(); }))
  100. document.getElementById('payeePaymentLines').value =
  101. module.data.bankAddress.filter(function (e) { return e.bankDeposit == $('#bankAddress').val(); })[0].payeePaymentLines;
  102. }
  103. module.depositList = function (data) {
  104. var content = data.data;
  105. module.data.bankAddress = content;
  106. var bankAddressData = template('bankAddressData', module.data);
  107. $("#bankAddress").html(bankAddressData);
  108. if (content.length>0){
  109. // changeBankAddress();
  110. }else{
  111. document.getElementById('payeePaymentLines').value = '';
  112. }
  113. }
  114. //底部友情链接
  115. module.bankType = function (data) {
  116. if (data.code == 200) {
  117. var content = data.data;
  118. module.data.bankTypeOption = content;
  119. var bankTypeData = template('bankTypeData', module.data);
  120. $("#bankType").html(bankTypeData);
  121. }
  122. }
  123. //账户类型
  124. module.accountType = function (data) {
  125. if (data.code == 200) {
  126. var content = data.data;
  127. module.data.accountTypeOption = content;
  128. var accountTypeData = template('accountTypeData', module.data);
  129. $("#accountType").html(accountTypeData);
  130. }
  131. }
  132. //焦点图数据
  133. module.focusNewsTop = function (data) {
  134. if (data.code == 200) {
  135. let focusArray = [];
  136. if(data.data.length<1){
  137. focusArray.push({
  138. picUrl:'../../../static/images/banner1.png'
  139. },{
  140. picUrl:'../../../static/images/banner2.png'
  141. },{
  142. picUrl:'../../../static/images/banner3.png'
  143. })
  144. }else{
  145. data.data.forEach(res=>{
  146. focusArray.push({
  147. picUrl:'/api'+res.picUrl
  148. })
  149. })
  150. }
  151. module.data.focusListTop = focusArray;
  152. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  153. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  154. new Swiper('#bannerFocusWrapTop', {
  155. paginationClickable: true,
  156. autoplay : 4000,
  157. loop:true
  158. })
  159. }
  160. }
  161. //主题图片切换
  162. module.switchTheme = function(){
  163. if(themeColor == 'red'){
  164. module.data.modifyUrl = '../../static/images/modify_red.png';
  165. module.data.detailUrl = '../../static/images/detail_red.png';
  166. }else if(themeColor == 'green'){
  167. module.data.modifyUrl = '../../static/images/modify.png';
  168. module.data.detailUrl = '../../static/images/detail.png';
  169. }
  170. }
  171. //底部友情链接
  172. module.bottomFriendsLinks = function (data) {
  173. if (data.code == 200) {
  174. var content = data.data;
  175. //console.log(content)
  176. module.data.friendsLinksList = content;
  177. var friendsLinksData = template('friendsLinksData', module.data);
  178. $("#friendsLinksContent").html(friendsLinksData);
  179. }
  180. }
  181. //获取类型
  182. module.getType = function(type){
  183. if (type == 'info'){
  184. document.getElementById("icon-list1").click();
  185. }
  186. if (type == 'demand'){
  187. document.getElementById("icon-list2").click();
  188. }
  189. if (type == 'interact'){
  190. document.getElementById("icon-list3").click();
  191. }
  192. if (type == 'bidding'){
  193. document.getElementById("icon-list4").click();
  194. }
  195. if (type == 'goDemand'){
  196. document.getElementById("icon-list2").click();
  197. document.getElementById("goSupply").click();
  198. }
  199. if (type == 'goInteract'){
  200. document.getElementById("icon-list3").click();
  201. document.getElementById("goRelease").click();
  202. }
  203. }
  204. //个人中心用户信息
  205. module.userData = function(data){
  206. if (data.code == 200) {
  207. var content = data.user;
  208. //console.log(content)
  209. module.data.userId = content.userId;
  210. tools.doGet(userMember + '/' + content.userId, {}, module.userMember);//memberType 1个人 2单位
  211. }
  212. }
  213. //个人中心用户资料
  214. module.userMember = function(data){
  215. if (data.code == 200) {
  216. var content = data.data;
  217. //console.log(data)
  218. module.data.userInformationDetail = content;
  219. module.data.memberType = content.memberType;
  220. var bankTypeData = template('bankTypeData', module.data);
  221. $("#bankType").html(bankTypeData);
  222. var bankAddressData = template('bankAddressData', module.data);
  223. $("#bankAddress").html(bankAddressData);
  224. if(content.memberType == '1'){
  225. document.getElementById('companyInformationContent').style.display = 'none';
  226. document.getElementById('userInformationContent').style.display = 'block';
  227. var userInformationData = template('userInformationData', module.data);
  228. $("#userInformationContent").html(userInformationData);
  229. }else{
  230. document.getElementById('companyInformationContent').style.display = 'block';
  231. document.getElementById('userInformationContent').style.display = 'none';
  232. var companyInformationData = template('companyInformationData', module.data);
  233. $("#companyInformationContent").html(companyInformationData);
  234. }
  235. document.getElementById('bankAddress').value = content.bankAddress;
  236. document.getElementById('bankCardName').value = content.bankCardName;
  237. document.getElementById('bankCardNum').value = content.bankCardNum;
  238. document.getElementById('bankType').value = content.bankType;
  239. document.getElementById('accountType').value = content.accountType;
  240. document.getElementById('payeePaymentLines').value = content.payeePaymentLines;
  241. document.getElementById('phone').innerHTML = content.phone;
  242. module.data.memberId = content.id;
  243. //console.log(module.data.userId)
  244. //用户图片
  245. module.showUserImage(content);
  246. //我的供求
  247. tools.doGet(userSupply, {memberId:content.id,pageNum:module.data.pageNum,pageSize:10}, module.userSupply);
  248. //我的咨询
  249. tools.doGet(userConsulting, {memberId:content.id,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.consulting);
  250. //我的竞价
  251. tools.doGet(userBidding, {memberId:content.id,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.bidding);
  252. //个人资料提交
  253. $('#supplyAction').on('click', module.supplyAction)
  254. $('#releaseAction').on('click', module.releaseAction)
  255. //获取附件的值
  256. //$('#upLoadBtn').on('click',module.upLoadAction)
  257. //document.getElementById('userAction').addEventListener('click',module.formAction);
  258. }
  259. }
  260. module.showUserImage = function(data){
  261. console.log(data)
  262. var accountOpenCert = data.accountOpenCert==null||data.accountOpenCert == ''?null:['/api'+data.accountOpenCert];
  263. var idCardPic = data.idCardPic==null||data.idCardPic == ''?null:['/api'+data.idCardPic];
  264. console.log(accountOpenCert)
  265. console.log(idCardPic)
  266. if(module.data.memberType == '1'){
  267. var cupload2 = new Cupload ({
  268. ele: '#cupload-3',
  269. num: 1,
  270. data:idCardPic
  271. });
  272. var cupload4 = new Cupload ({
  273. ele: '#cupload-4',
  274. num: 1,
  275. data:accountOpenCert
  276. });
  277. }else{
  278. var cupload5 = new Cupload ({
  279. ele: '#cupload-5',
  280. num: 1,
  281. data:accountOpenCert
  282. });
  283. var cupload6 = new Cupload ({
  284. ele: '#cupload-6',
  285. num: 1,
  286. data:idCardPic
  287. });
  288. }
  289. }
  290. module.showSupplyImage = function(data){
  291. //console.log(data)
  292. if (data.code == 200) {
  293. var content = data.data;
  294. var fileUrlList = [];
  295. var fileNum = [];
  296. for (var i = 0 ; i < content.length ; i++){
  297. fileUrlList[i] = serverApi + content[i].fileUrl ;
  298. fileNum[i] = content[i].id;
  299. }
  300. if (fileUrlList.length == 0){
  301. fileUrlList = '';
  302. }
  303. //console.log(fileUrlList)
  304. document.getElementById('cupload-1').innerHTML = '';
  305. module.data.fileNum = fileNum;
  306. var cupload1 = new Cupload ({
  307. ele: '#cupload-1',
  308. num: 5,
  309. data:fileUrlList
  310. });
  311. }
  312. }
  313. deleteList = function(){
  314. //console.log(module.data.fileNum[deleteNum])
  315. // tools.doGet(deleteUserImg+'/'+module.data.fileNum[deleteNum], {}, module.Tips);
  316. }
  317. module.getData = function(data){
  318. upLoadAction(data.data)
  319. }
  320. //获取上传图片list
  321. upLoadAction = function(type){
  322. //console.log(type)
  323. var upLoadList = [];
  324. var data = {};
  325. if(type == 'user'||type == 'company'){
  326. if(module.data.memberType == '1'){
  327. $('#cupload-3').find('input').each(function() {
  328. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  329. upLoadList.push($(this).val())
  330. }
  331. })
  332. }else{
  333. $('#cupload-5').find('input').each(function() {
  334. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  335. upLoadList.push($(this).val())
  336. }
  337. })
  338. data["files"] = upLoadList;
  339. }
  340. // tools.doPostImg(base64Upload, data, module.submitInfo());//memberType 1个人 2单位
  341. }else{
  342. $('#cupload-1').find('input').each(function() {
  343. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  344. upLoadList.push($(this).val())
  345. }
  346. })
  347. data["tableName"] = 't_transaction_supply_demand';
  348. data["tableId"] = type?type:module.data.supplyId;
  349. data["files"] = upLoadList;
  350. data["fileType"] = '';
  351. data["bizPath"] = 'transaction';
  352. tools.doPostImg(base64Attach, data, module.upLoadOver);//memberType 1个人 2单位
  353. setTimeout(function(){
  354. tools.doGet(userSupply, {memberId:module.data.memberId,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.userSupply)
  355. document.getElementById('supplyInformation').style.display = "block";
  356. document.getElementById('releaseSupply').style.display = "none";
  357. $('#demandType').val('');
  358. $('#projectName').val('');
  359. $('#location').val('');
  360. $('#projectRealName').val('');
  361. $('#projectPhone').val('');
  362. $('#projectContent').val('');
  363. },2000)
  364. }
  365. // tools.initError('发布成功');
  366. }
  367. module.upLoadOver = function(type){
  368. }
  369. module.upLoadOverInfo1 = function(data){
  370. if (data.code == 200)
  371. module.data.sfz = data.fileName;
  372. }
  373. module.upLoadOverInfo2 = function(data){
  374. if (data.code == 200)
  375. module.data.yhk = data.fileName;
  376. }
  377. module.upLoadOverInfo5 = function(data){
  378. if (data.code == 200)
  379. module.data.khzm = data.fileName;
  380. }
  381. module.upLoadOverInfo6 = function(data){
  382. if (data.code == 200)
  383. module.data.frzjz = data.fileName;
  384. }
  385. submitInfo = function(type){
  386. var upLoadList = [];
  387. var data = {};
  388. if(type == 'user'||type == 'company'){
  389. if(module.data.memberType == '1'){
  390. $('#cupload-3').find('input').each(function() {
  391. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  392. module.data.upType1 = true;
  393. tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo1);
  394. }
  395. })
  396. $('#cupload-4').find('input').each(function() {
  397. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  398. module.data.upType2 = true;
  399. tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo2);
  400. }
  401. })
  402. console.log(type);
  403. setTimeout(function(){
  404. formAction(type)
  405. },1000);
  406. }else{
  407. $('#cupload-5').find('input').each(function() {
  408. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  409. module.data.upType5 = true;
  410. tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo5);
  411. }
  412. })
  413. $('#cupload-6').find('input').each(function() {
  414. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  415. module.data.upType6 = true;
  416. tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo6);
  417. }
  418. })
  419. setTimeout(function(){
  420. formAction(type)
  421. },1000);
  422. }
  423. //memberType 1个人 2单位
  424. }
  425. }
  426. //删除供求
  427. deleteUserSupply = function(ids){
  428. tools.doGet(deleteSupply+'/'+ids, {}, module.Tips);
  429. }
  430. //个人中心我的供求
  431. module.userSupply = function(data){
  432. //console.log(data)
  433. if (data.code == 200) {
  434. var content = data.rows;
  435. //console.log(data)
  436. var pageCount = (data.total/10).toFixed(0);
  437. if (pageCount < 1){
  438. pageCount = 1;
  439. }
  440. if(module.data.userSupplyInformationList == ''){
  441. $('.page_s1').html('');
  442. // 初始化 分页器
  443. var page_s1 = createPage('.page_s1');
  444. // 设置分页
  445. setPage(page_s1, {
  446. pageTotal: data.total, // 数据总条数
  447. pageSize: 10, // 每页显示条数
  448. pageCurrent: 1, // 当前页
  449. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  450. })
  451. $('#page_s1').html('共' + pageCount + '页')
  452. }
  453. module.data.userSupplyInformationList = content;
  454. var userSupplyInformationData = template('userSupplyInformationData', module.data);
  455. $("#userSupplyInformationContent").html(userSupplyInformationData);
  456. }
  457. }
  458. //个人中心我的咨询
  459. module.consulting = function(data){
  460. if (data.code == 200) {
  461. var content = data.rows;
  462. //console.log(data )
  463. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  464. if (pageCount < 1){
  465. pageCount = 1;
  466. }
  467. $('.page_s2').html('');
  468. // 初始化 分页器
  469. var page_s1 = createPage('.page_s2');
  470. // 设置分页
  471. setPage(page_s1, {
  472. pageTotal: data.total, // 数据总条数
  473. pageSize: module.data.pageSize, // 每页显示条数
  474. pageCurrent: 1, // 当前页
  475. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  476. })
  477. module.data.consultingInformationList = content;
  478. $('#page_s2').html('共'+pageCount+'页')
  479. var consultingInformationData = template('consultingInformationData', module.data);
  480. $("#consultingInformationContent").html(consultingInformationData);
  481. }
  482. }
  483. //个人中心我的竞价
  484. module.bidding = function(data){
  485. if (data.code == 200) {
  486. var content = data.rows;
  487. //console.log(content)
  488. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  489. if (pageCount < 1){
  490. pageCount = 1;
  491. }
  492. if(module.data.biddingInformationList == '') {
  493. // 初始化 分页器
  494. var page_s1=createPage('.page_s3');
  495. // 设置分页
  496. setPage(page_s1, {
  497. pageTotal: data.total, // 数据总条数
  498. pageSize: module.data.pageSize, // 每页显示条数
  499. pageCurrent: 1, // 当前页
  500. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  501. })
  502. $('#page_s3').html('共' + pageCount + '页')
  503. }
  504. module.data.biddingInformationList = content;
  505. var biddingInformationData = template('biddingInformationData', module.data);
  506. $("#biddingInformationContent").html(biddingInformationData);
  507. }
  508. }
  509. tabCheck = function(type){
  510. document.getElementById('user').className = '';
  511. document.getElementById('bank').className = '';
  512. document.getElementById('passWord').className = '';
  513. document.getElementById(type).className = 'active';
  514. //console.log(type)
  515. document.getElementById('userInformationContent').style.display = 'none';
  516. document.getElementById('companyInformationContent').style.display = 'none';
  517. document.getElementById('bankInformationContent').style.display = 'none';
  518. document.getElementById('phoneInformationContent').style.display = 'none';
  519. document.getElementById('passWordInformationContent').style.display = 'none';
  520. if (module.data.memberType == '2' && type == 'user'){
  521. document.getElementById('companyInformationContent').style.display = 'block';
  522. }else if (module.data.memberType == '1' && type == 'user'){
  523. document.getElementById('userInformationContent').style.display = 'block';
  524. }else{
  525. document.getElementById(type+'InformationContent').style.display = 'block';
  526. }
  527. }
  528. phoneUpdate = function(type){
  529. document.getElementById(type+'InformationContent').style.display = 'none';
  530. document.getElementById('phoneInformationContent').style.display = 'block';
  531. }
  532. tabLeftCheck = function(type){
  533. for (var i = 1 ; i < 5 ; i++){
  534. document.getElementById('icon-list'+i).className = '';
  535. }
  536. document.getElementById(type).className = 'active';
  537. document.getElementById('userInformation').style.display = 'none';
  538. document.getElementById('supplyInformation').style.display = 'none';
  539. document.getElementById('consultingInformation').style.display = 'none';
  540. document.getElementById('biddingInformation').style.display = 'none';
  541. document.getElementById('releaseSupply').style.display = 'none';
  542. document.getElementById('release').style.display = 'none';
  543. if(type == 'icon-list1'){
  544. document.getElementById('userInformation').style.display = 'block';
  545. }
  546. if(type == 'icon-list2'){
  547. document.getElementById('supplyInformation').style.display = 'block';
  548. module.data.clickType = 'supply';
  549. $('#demandType').val('');
  550. $('#projectName').val('');
  551. $('#location').val('');
  552. $('#projectRealName').val('');
  553. $('#projectPhone').val('');
  554. $('#projectContent').val('');
  555. }
  556. if(type == 'icon-list3'){
  557. document.getElementById('consultingInformation').style.display = 'block';
  558. module.data.clickType = 'consulting';
  559. $('#title').val('');
  560. $('#releaseContent').val('');
  561. $('#releaseRealName').val('');
  562. $('#releasePhone').val('');
  563. }
  564. if(type == 'icon-list4'){
  565. document.getElementById('biddingInformation').style.display = 'block';
  566. module.data.clickType = 'bidding';
  567. }
  568. module.data.pageNum = 1 ;
  569. }
  570. goSupply = function(){
  571. document.getElementById('supplyInformation').style.display = "none";
  572. document.getElementById('releaseSupply').style.display = "block";
  573. document.getElementById('cupload-1').innerHTML = '';
  574. module.data.supplyType = 'add'
  575. var cupload1 = new Cupload ({
  576. ele: '#cupload-1',
  577. num: 5,
  578. });
  579. }
  580. gosupplyTable = function(){
  581. document.getElementById('supplyInformation').style.display = "block";
  582. document.getElementById('releaseSupply').style.display = "none";
  583. $('#demandType').val('');
  584. $('#projectName').val('');
  585. $('#location').val('');
  586. $('#projectRealName').val('');
  587. $('#projectPhone').val('');
  588. $('#projectContent').val('');
  589. }
  590. goRelease = function(){
  591. document.getElementById('consultingInformation').style.display = "none";
  592. document.getElementById('release').style.display = "block";
  593. }
  594. goReleaseTable = function(){
  595. document.getElementById('consultingInformation').style.display = "block";
  596. document.getElementById('release').style.display = "none";
  597. $('#title').val('');
  598. $('#releaseContent').val('');
  599. $('#releaseRealName').val('');
  600. $('#releasePhone').val('');
  601. }
  602. //翻页
  603. turnThePage = function (pageNum) {
  604. module.data.pageNum = pageNum ;
  605. if(module.data.clickType == 'supply'){
  606. tools.doGet(userSupply, {memberId:module.data.memberId,pageNum:pageNum,pageSize:module.data.pageSize}, module.userSupply);
  607. }
  608. if(module.data.clickType == 'consulting'){
  609. tools.doGet(userConsulting, {memberId:module.data.memberId,pageNum:pageNum,pageSize:module.data.pageSize}, module.consulting);
  610. }
  611. if(module.data.clickType == 'bidding'){
  612. tools.doGet(userBidding, {memberId:module.data.memberId,pageNum:pageNum,pageSize:module.data.pageSize}, module.bidding);
  613. }
  614. }
  615. //个人用户资料修改
  616. formAction = function (type){
  617. var data = {};
  618. //var password = $('#password').val();
  619. module.data.userFormType = type ;
  620. if(type == 'company'){
  621. //公司用户信息
  622. var companyName = $('#companyName').val();
  623. var idCardNum = $('#idCardNum').val();
  624. var realname = $('#realname').val();
  625. var companyCode = $('#companyCode').val();
  626. var companyNature = $('#companyNature').val();
  627. var companyScope = $('#companyScope').val();
  628. var companyTimeLimit = $('#companyTimeLimit').val();
  629. var companySetupTime = $('#companySetupTime').val();
  630. var companyCapital = $('#companyCapital').val();
  631. var companyLicense = $('#companyLicense').val();
  632. var address = $('#address').val();
  633. var accountOpenCert = module.data.khzm;
  634. var idCardPic = module.data.frzjz;
  635. if (companyName == '') {
  636. $('#companyName')[0].focus()
  637. tools.initTips('请输入公司名称', 'right', $('#companyName')[0], 2000)
  638. return false;
  639. }
  640. if (idCardNum == '') {
  641. $('#idCardNum')[0].focus()
  642. tools.initTips('请输入身份证号', 'right', $('#idCardNum')[0], 2000)
  643. return false;
  644. }
  645. if (realname == '') {
  646. $('#realname')[0].focus()
  647. tools.initTips('请输入负责人姓名', 'right', $('#realname')[0], 2000)
  648. return false;
  649. }
  650. let array = []
  651. $('#cupload-5').find('input').each(function() {
  652. if($(this).val()!=''){
  653. array.push($(this).val())
  654. }
  655. });
  656. if(array.length<1){
  657. $('#cupload-5')[0].focus()
  658. tools.initTips('请上传相关附件', 'right', $('#cupload-5')[0], 2000)
  659. return false;
  660. }
  661. let array6 = []
  662. $('#cupload-6').find('input').each(function() {
  663. if($(this).val()!=''){
  664. array6.push($(this).val())
  665. }
  666. });
  667. if(array6.length<1){
  668. $('#cupload-6')[0].focus()
  669. tools.initTips('请上传法人证件照', 'right', $('#cupload-6')[0], 2000)
  670. return false;
  671. }
  672. data['accountOpenCert'] = accountOpenCert;
  673. data['companyName'] = companyName;
  674. data['idCardNum'] = idCardNum;
  675. data['realname'] = realname;
  676. data['companyCode'] = companyCode;
  677. data['companyName'] = companyName;
  678. data['companyNature'] = companyNature;
  679. data['companyScope'] = companyScope;
  680. data['companyTimeLimit'] = companyTimeLimit;
  681. data['companySetupTime'] = companySetupTime;
  682. data['companyCapital'] = companyCapital;
  683. data['companyLicense'] = companyLicense;
  684. data['address'] = address;
  685. data['idCardPic'] = idCardPic;
  686. tools.setCookie('userName',realname,24 * 60 * 60)
  687. tools.setCookie('idCardNum',idCardNum,24 * 60 * 60)
  688. tools.setCookie('address',address,24 * 60 * 60)
  689. // upLoadAction('user');
  690. }
  691. if(type == 'user'){
  692. //个人用户信息
  693. var userFormRealName = $('#userFormRealName').val();
  694. var userFormIdCard = $('#userFormIdCard').val();
  695. var userFormAddress = $('#userFormAddress').val();
  696. var idCardPic = module.data.sfz;
  697. var accountOpenCert = module.data.yhk;
  698. if (userFormRealName == '') {
  699. $('#userFormRealName')[0].focus()
  700. tools.initTips('请输入姓名', 'right', $('#userFormRealName')[0], 2000)
  701. return false;
  702. }
  703. if (userFormIdCard == '') {
  704. $('#userFormIdCard')[0].focus()
  705. tools.initTips('请输入身份证号码', 'right', $('#userFormIdCard')[0], 2000)
  706. return false;
  707. }
  708. let array = []
  709. $('#cupload-3').find('input').each(function() {
  710. if($(this).val()!=''){
  711. array.push($(this).val())
  712. }
  713. });
  714. if(array.length<1){
  715. $('#cupload-3')[0].focus()
  716. tools.initTips('请上传身份证', 'right', $('#cupload-3')[0], 2000)
  717. return false;
  718. }
  719. let array2 = []
  720. $('#cupload-4').find('input').each(function() {
  721. if($(this).val()!=''){
  722. array2.push($(this).val())
  723. }
  724. });
  725. if(array2.length<1){
  726. $('#cupload-4')[0].focus()
  727. tools.initTips('请上传银行卡', 'right', $('#cupload-4')[0], 2000)
  728. return false;
  729. }
  730. data['idCardPic'] = idCardPic;
  731. data['accountOpenCert'] = accountOpenCert;
  732. data['idCardNum'] = userFormIdCard;
  733. data['realname'] = userFormRealName;
  734. data['address'] = userFormAddress;
  735. tools.setCookie('userName',userFormRealName,24 * 60 * 60)
  736. tools.setCookie('idCardNum',userFormIdCard,24 * 60 * 60)
  737. tools.setCookie('address',userFormAddress,24 * 60 * 60)
  738. // upLoadAction('user');
  739. }
  740. if(type == 'bank'){
  741. //银行卡信息
  742. var bankCardName = $('#bankCardName').val();
  743. var bankCardNum = $('#bankCardNum').val();
  744. var bankAddress = $('#bankAddress').val();
  745. var bankType = $('#bankType').val();
  746. var accountType = $('#accountType').val();
  747. var payeePaymentLines = $('#payeePaymentLines').val();
  748. if (bankCardName == '') {
  749. $('#bankCardName')[0].focus()
  750. tools.initTips('请输入开户姓名', 'right', $('#bankCardName')[0], 2000)
  751. return false;
  752. }
  753. if (bankCardNum == '') {
  754. $('#bankCardNum')[0].focus()
  755. tools.initTips('请输入开户账号', 'right', $('#bankCardNum')[0], 2000)
  756. return false;
  757. }
  758. if (bankType == '') {
  759. $('#bankType')[0].focus()
  760. tools.initTips('请选择所属银行', 'right', $('#bankType')[0], 2000)
  761. return false;
  762. }
  763. if (bankAddress == '') {
  764. $('#bankAddress')[0].focus()
  765. tools.initTips('请选择开户银行', 'right', $('#bankAddress')[0], 2000)
  766. return false;
  767. }
  768. if (payeePaymentLines == '') {
  769. $('#payeePaymentLines')[0].focus()
  770. tools.initTips('请输入联行号', 'right', $('#payeePaymentLines')[0], 2000)
  771. return false;
  772. }
  773. data['bankCardName'] = bankCardName;
  774. data['bankCardNum'] = bankCardNum;
  775. data['bankAddress'] = bankAddress;
  776. data['bankType'] = bankType;
  777. data['accountType'] = accountType;
  778. data['payeePaymentLines'] = payeePaymentLines;
  779. tools.setCookie('bankCardName',bankCardName,24 * 60 * 60)
  780. tools.setCookie('bankCardNum',bankCardNum,24 * 60 * 60)
  781. tools.setCookie('bankAddress',bankAddress,24 * 60 * 60)
  782. tools.setCookie('bankType',bankType,24 * 60 * 60)
  783. tools.setCookie('accountType',accountType,24 * 60 * 60)
  784. tools.setCookie('payeePaymentLines',payeePaymentLines,24 * 60 * 60)
  785. }
  786. //data['password'] = password;
  787. data['id'] = module.data.memberId;
  788. tools.doPost(userUpdate, data, module.Tips)
  789. }
  790. editPassword = function(){
  791. var data = {};
  792. if(module.passWordCompare()){
  793. var oldPassWord = $('#originalPassWord').val();
  794. var newPassWord = $('#newPassWord').val();
  795. data['oldPassword'] = oldPassWord;
  796. data['newPassword'] = newPassWord;
  797. tools.doPost(updatePwd, data, module.Tips)
  798. }
  799. }
  800. //手动验证密码是否一致
  801. module.passWordCompare = function(){
  802. var newPassword = $('#newPassWord').val();
  803. var determinePassWord = $('#determinePassWord').val();
  804. var originalPassWord = $('#originalPassWord').val();
  805. /*原密码*/
  806. if (originalPassWord == '') {
  807. $('#originalPassWord')[0].focus()
  808. tools.initTips('请输入原密码', 'right', $('#originalPassWord')[0], 2000)
  809. return false;
  810. }
  811. /* 新密码 */
  812. if (newPassword == '') {
  813. $('#newPassWord')[0].focus()
  814. tools.initTips('请输入新密码', 'right', $('#newPassWord')[0], 2000)
  815. return false;
  816. }
  817. /* 确认密码 */
  818. if (determinePassWord == '') {
  819. $('#determinePassWord')[0].focus()
  820. tools.initTips('请确认密码', 'right', $('#determinePassWord')[0], 2000)
  821. return false;
  822. }
  823. return true;
  824. }
  825. //发布供求
  826. module.supplyAction = function (){
  827. var data = {};
  828. if(module.supplyCheck()){
  829. //供求信息
  830. var demandType = $('#demandType').val();
  831. var projectName = $('#projectName').val();
  832. var location = $('#location').val();
  833. var projectRealName = $('#projectRealName').val();
  834. var projectPhone = $('#projectPhone').val();
  835. var projectContent = $('#projectContent').val();
  836. var logintime = tools.getNowFormatDate();
  837. //console.log(demandType);
  838. data['projectName'] = projectName;
  839. data['location'] = location;
  840. data['realname'] = projectRealName;
  841. data['phone'] = projectPhone;
  842. data['projectContent'] = projectContent;
  843. data['logintime'] = logintime;
  844. data['supplyDemandType'] = demandType;
  845. data['deptId'] = 100;
  846. data['memberId'] = module.data.memberId;
  847. if(module.data.supplyType == 'edit'){
  848. data['id'] = module.data.supplyId;
  849. tools.doPost(userEdit, data, module.getData)
  850. }else{
  851. tools.doPost(userDemand, data, module.getData)
  852. }
  853. }
  854. }
  855. //发布咨询
  856. module.releaseAction = function (){
  857. var data = {};
  858. if(module.releaseCheck()){
  859. //供求信息
  860. var title = $('#title').val();
  861. var releaseContent = $('#releaseContent').val();
  862. var releaseRealName = $('#releaseRealName').val();
  863. var releasePhone = $('#releasePhone').val();
  864. var logintime = tools.getNowFormatDate();
  865. data['title'] = title;
  866. data['content'] = releaseContent;
  867. data['realname'] = releaseRealName;
  868. data['phone'] = releasePhone;
  869. data['logintime'] = logintime;
  870. data['deptId'] = 100;
  871. data['memberId'] = module.data.memberId;
  872. tools.doPost(userCommunicate, data, module.releaseActionYes)
  873. }
  874. }
  875. module.releaseActionYes = function(data){
  876. tools.initError(data.msg);
  877. setTimeout(function(){
  878. tools.doGet(userConsulting, {memberId:module.data.memberId,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.consulting);
  879. document.getElementById('consultingInformation').style.display = "block";
  880. document.getElementById('release').style.display = "none";
  881. $('#title').val('');
  882. $('#releaseContent').val('');
  883. $('#releaseRealName').val('');
  884. $('#releasePhone').val('');
  885. },2000)
  886. }
  887. module.Tips = function(data){
  888. tools.initError(data.msg);
  889. }
  890. //手动验证表单
  891. module.check = function () {
  892. var usernameVal = $('#username').val();
  893. var passwordVal = $('#password').val();
  894. var codeVal = $('#code').val();
  895. /* 手机号 */
  896. if (usernameVal == '') {
  897. $('#username')[0].focus()
  898. tools.initTips('请输入用户名', 'right', $('#username')[0], 2000)
  899. return false;
  900. }
  901. /* 密码 */
  902. if (passwordVal == '') {
  903. $('#password')[0].focus()
  904. tools.initTips('请输入密码', 'right', $('#password')[0], 2000)
  905. return false;
  906. } else if (parseInt(passwordVal.length) < 6 || parseInt(passwordVal.length) > 18) {
  907. $('#password')[0].focus()
  908. tools.initTips('请输入正确格式密码', 'right', $('#password')[0], 2000)
  909. return false;
  910. }
  911. /*图形验证码*/
  912. if (module.uuid == '' || codeVal == '') {
  913. $('#code')[0].focus()
  914. tools.initTips('请输入图形验证码', 'right', $('#code')[0], 2000)
  915. return false;
  916. }
  917. return true;
  918. }
  919. module.supplyCheck = function () {
  920. var projectName = $('#projectName').val();
  921. var location = $('#location').val();
  922. var projectRealName = $('#projectRealName').val();
  923. var projectPhone = $('#projectPhone').val();
  924. var projectContent = $('#projectContent').val();
  925. if (projectName == '') {
  926. $('#projectName')[0].focus()
  927. tools.initTips('请输入项目名称', 'right', $('#projectName')[0], 2000)
  928. return false;
  929. }
  930. if (location == '') {
  931. $('#location')[0].focus()
  932. tools.initTips('请输入项目地址', 'right', $('#location')[0], 2000)
  933. return false;
  934. }
  935. if (projectRealName == '') {
  936. $('#projectRealName')[0].focus()
  937. tools.initTips('请输入姓名', 'right', $('#projectRealName')[0], 2000)
  938. return false;
  939. }
  940. if (projectPhone == '') {
  941. $('#projectPhone')[0].focus()
  942. tools.initTips('请输入联系电话', 'right', $('#projectPhone')[0], 2000)
  943. return false;
  944. }
  945. if (projectContent == '') {
  946. $('#projectContent')[0].focus()
  947. tools.initTips('请输入项目详情', 'right', $('#projectContent')[0], 2000)
  948. return false;
  949. }
  950. return true;
  951. }
  952. module.releaseCheck = function () {
  953. var title = $('#title').val();
  954. var releaseContent = $('#releaseContent').val();
  955. var releaseRealName = $('#releaseRealName').val();
  956. var releasePhone = $('#releasePhone').val();
  957. if (title == '') {
  958. $('#title')[0].focus()
  959. tools.initTips('请输入标题', 'right', $('#title')[0], 2000)
  960. return false;
  961. }
  962. if (releaseContent == '') {
  963. $('#releaseContent')[0].focus()
  964. tools.initTips('请输入咨询内容', 'right', $('#releaseContent')[0], 2000)
  965. return false;
  966. }
  967. if (releaseRealName == '') {
  968. $('#releaseRealName')[0].focus()
  969. tools.initTips('请输入姓名', 'right', $('#releaseRealName')[0], 2000)
  970. return false;
  971. }
  972. if (releasePhone == '') {
  973. $('#releasePhone')[0].focus()
  974. tools.initTips('请输入联系电话', 'right', $('#releasePhone')[0], 2000)
  975. return false;
  976. }
  977. return true;
  978. }
  979. //个人中心选项卡鼠标悬浮
  980. module.userListHover = function(){
  981. document.getElementById('icon-list1').onmouseout = function(){
  982. document.getElementById('icon1').src = '../../static/images/user_index_icon1.png'
  983. }
  984. document.getElementById('icon-list1').onmouseover = function(){
  985. if(themeColor == 'red'){
  986. document.getElementById('icon1').src = '../../static/images/user_index_icon5_red.png'
  987. }else if(themeColor == 'green'){
  988. document.getElementById('icon1').src = '../../static/images/user_index_icon5.png'
  989. }
  990. }
  991. document.getElementById('icon-list2').onmouseout = function(){
  992. document.getElementById('icon2').src = '../../static/images/user_index_icon2.png'
  993. }
  994. document.getElementById('icon-list2').onmouseover = function(){
  995. if(themeColor == 'red'){
  996. document.getElementById('icon2').src = '../../static/images/user_index_icon6_red.png'
  997. }else if(themeColor == 'green') {
  998. document.getElementById('icon2').src = '../../static/images/user_index_icon6.png'
  999. }
  1000. }
  1001. document.getElementById('icon-list3').onmouseout = function(){
  1002. document.getElementById('icon3').src = '../../static/images/user_index_icon3.png'
  1003. }
  1004. document.getElementById('icon-list3').onmouseover = function(){
  1005. if(themeColor == 'red'){
  1006. document.getElementById('icon3').src = '../../static/images/user_index_icon7_red.png'
  1007. }else if(themeColor == 'green') {
  1008. document.getElementById('icon3').src = '../../static/images/user_index_icon7.png'
  1009. }
  1010. }
  1011. document.getElementById('icon-list4').onmouseout = function(){
  1012. document.getElementById('icon4').src = '../../static/images/user_index_icon4.png'
  1013. }
  1014. document.getElementById('icon-list4').onmouseover = function(){
  1015. if(themeColor == 'red'){
  1016. document.getElementById('icon4').src = '../../static/images/user_index_icon8_red.png'
  1017. }else if(themeColor == 'green') {
  1018. document.getElementById('icon4').src = '../../static/images/user_index_icon8.png'
  1019. }
  1020. }
  1021. }
  1022. goSearch = function () {
  1023. var searchTitle = $('#searchTitle').val();
  1024. var searchContent = $('#searchContent').val();
  1025. //console.log(searchTitle)
  1026. module.data.searchType = 'YES';
  1027. tools.doGet(userConsulting,{title:searchTitle,content:searchContent,memberId:module.data.memberId,pageNum:module.data.pageNum,pageSize:module.data.pageSize},module.consulting);
  1028. }
  1029. selectUserSupply = function(ids) {
  1030. module.data.supplyType = 'edit';
  1031. module.data.supplyId = ids;
  1032. //console.log('点击修改')
  1033. tools.doGet(selectSupply + '/' + ids, {}, module.selectSupplyDetail);//memberType 1个人 2单位
  1034. }
  1035. module.selectSupplyDetail = function(data){
  1036. console.log('进入修改供求')
  1037. document.getElementById('supplyInformation').style.display = "none";
  1038. document.getElementById('releaseSupply').style.display = "block";
  1039. var content = data.data
  1040. $('#demandType').val(content.supplyDemandType);
  1041. $('#projectName').val(content.projectName);
  1042. $('#location').val(content.location);
  1043. $('#projectRealName').val(content.realname);
  1044. $('#projectPhone').val(content.phone);
  1045. $('#projectContent').val(content.projectContent);
  1046. tools.doGet(supplyDemandImg+'/'+content.id, {}, module.showSupplyImage);
  1047. }
  1048. goProject = function(id){
  1049. tools.skip('../listingItems/itemsDetail.html?id='+id)
  1050. }
  1051. return module;
  1052. });