网站
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.
 
 
 

184 lines
6.4 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", 'swiper', 'itemsApi',"cupload"], function ($, template, Tools, swiper) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //焦点图数据
  9. focusListTop: [],
  10. showImgInformationDetail:''
  11. },
  12. };
  13. var tools = new Tools();
  14. module.init = function (page) {//底部友情链接
  15. //获取焦点图信息
  16. tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
  17. tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
  18. document.getElementById('realName').value = tools.getCookie('userName');
  19. document.getElementById('userNum').value = tools.getCookie('phone');
  20. document.getElementById('userBank').value = tools.getCookie('bankAddress');
  21. document.getElementById('bankId').value = tools.getCookie('bankCardNum');
  22. document.getElementById('idCard').value = tools.getCookie('idCardNum');
  23. //项目基本信息
  24. tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);
  25. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  26. tools.getWebConfig();
  27. };
  28. //焦点图数据
  29. module.focusNewsTop = function (data) {
  30. if (data.code == 200) {
  31. module.data.focusListTop = data.data;
  32. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  33. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  34. new Swiper('#bannerFocusWrapTop', {
  35. paginationClickable: true,
  36. autoplay : 4000,
  37. loop:true
  38. })
  39. }
  40. }
  41. //底部友情链接
  42. module.bottomFriendsLinks = function (data) {
  43. if (data.code == 200) {
  44. var content = data.data;
  45. console.log(content)
  46. module.data.friendsLinksList = content;
  47. var friendsLinksData = template('friendsLinksData', module.data);
  48. $("#friendsLinksContent").html(friendsLinksData);
  49. }
  50. }
  51. //获取地址栏参数
  52. function getQueryVariable(variable){
  53. var query = window.location.search.substring(1);
  54. var vars = query.split("&");
  55. for (var i=0;i<vars.length;i++) {
  56. var pair = vars[i].split("=");
  57. if(pair[0] == variable){return pair[1];}
  58. }
  59. return(false);
  60. }
  61. //获取上传图片list
  62. module.upLoadAction = function(data){
  63. console.log(data)
  64. if (data.msg != '操作成功'){
  65. tools.initError(data.msg);
  66. return;
  67. }else{
  68. var upLoadList = [];
  69. var dataList = {};
  70. $('#cupload-3').find('input').each(function() {
  71. if($(this).val()!=''){
  72. upLoadList.push($(this).val())
  73. }
  74. });
  75. dataList["files"] = upLoadList;
  76. dataList["tableId"] = data.data;
  77. dataList["fileType"] = '';
  78. dataList["bizPath"] = 'transaction';
  79. dataList["tableName"] = 't_transaction_signup';
  80. console.log(dataList)
  81. tools.doPostImg(base64Upload, dataList, module.upLoadOver);
  82. }
  83. }
  84. module.upLoadOver = function(data){
  85. tools.initError('提交申请,等待审核')
  86. setTimeout(function () {
  87. tools.skip('itemsDetail.html?id='+getQueryVariable('id'))
  88. },2000)
  89. }
  90. module.outProjectInformation = function (data) {
  91. if (data.code == 200) {
  92. console.log(data)
  93. var content = data.data;
  94. $("#projectTitle").html('项目名称:'+content.projectName);
  95. $("#projectNum").html('需缴纳保证新:'+content.deposit+'元');
  96. var cupload2 = new Cupload ({
  97. ele: '#cupload-3',
  98. num: 5,
  99. });
  100. }
  101. }
  102. submit = function(){
  103. if(module.onCheck()){
  104. var data = {};
  105. var realName = $('#realName').val();
  106. var userNum = $('#userNum').val();
  107. var userBank = $('#userBank').val();
  108. var bankId = $('#bankId').val();
  109. var idCard = $('#idCard').val();
  110. data['projectId'] = getQueryVariable('id');
  111. data['memberId'] = tools.getCookie('memberId');
  112. data['realname'] = realName;
  113. data['idCardNum'] = idCard;
  114. data['phone'] = userNum;
  115. data['address'] = tools.getCookie('address');
  116. data['bankAddress'] = userBank;
  117. data['bankCardName'] = tools.getCookie('userName');
  118. data['bankCardNum'] = bankId;
  119. data['status'] = 'Y';
  120. tools.doPost(signupSubmit, data, module.upLoadAction);
  121. }
  122. }
  123. //验证表单
  124. module.onCheck = function () {
  125. var userNum = $('#userNum').val();
  126. var realName = $('#realName').val();
  127. var userBank = $('#userBank').val();
  128. var bankId = $('#bankId').val();
  129. var idCard = $('#idCard').val();
  130. if ($('#checkAgree:checked').val() == undefined ) {
  131. $('#checkAgree')[0].focus()
  132. tools.initTips('请选择我已同意 ', 'right', $('#checkAgree')[0], 2000)
  133. return false;
  134. }
  135. if (realName == '') {
  136. $('#realName')[0].focus()
  137. tools.initTips('请输入姓名', 'right', $('#realName')[0], 2000)
  138. return false;
  139. }
  140. if (userNum == '') {
  141. $('#userNum')[0].focus()
  142. tools.initTips('请输入会员账号', 'right', $('#userNum')[0], 2000)
  143. return false;
  144. }
  145. if (userBank == '') {
  146. $('#userBank')[0].focus()
  147. tools.initTips('请输入开户银行', 'right', $('#userBank')[0], 2000)
  148. return false;
  149. }
  150. if (bankId == '') {
  151. $('#bankId')[0].focus()
  152. tools.initTips('请输入银行卡号', 'right', $('#bankId')[0], 2000)
  153. return false;
  154. }
  155. if (idCard == '') {
  156. $('#idCard')[0].focus()
  157. tools.initTips('请输入身份证号', 'right', $('#idCard')[0], 2000)
  158. return false;
  159. }
  160. return true;
  161. }
  162. module.toTips = function(data){
  163. console.log(data)
  164. if(data.msg != '操作成功'){
  165. tools.initError(data.msg)
  166. }else{
  167. tools.initError('提交申请,等待审核')
  168. }
  169. }
  170. return module;
  171. });