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

296 行
11 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('bankCardName').value = tools.getCookie('bankCardName');
  23. document.getElementById('idCard').value = tools.getCookie('idCardNum');
  24. document.getElementById('payeePaymentLines').value = tools.getCookie('payeePaymentLines');
  25. document.getElementById('accountType').value = tools.getCookie('accountType');
  26. document.getElementById('bankType').value = tools.getCookie('bankType');
  27. tools.doGet(webDeptType+"/bank_account_type", {}, module.accountType, true);
  28. tools.doGet(webDeptType+"/bank_type_all", {}, module.bankType, true);
  29. //项目基本信息
  30. tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);
  31. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  32. tools.getWebConfig();
  33. tools.doGet(webConfig, {}, module.webConfig, true)
  34. };
  35. //底部友情链接
  36. module.webConfig = function (data) {
  37. if (data.code == 200) {
  38. $("#fwxyConfig").html(data.data[15].configValue);
  39. $("#cnsConfig").html(data.data[16].configValue);
  40. }
  41. }
  42. //底部友情链接
  43. module.bankType = function (data) {
  44. if (data.code == 200) {
  45. var content = data.data;
  46. var bankType = ''
  47. if(tools.getCookie('bankType') != undefined && tools.getCookie('bankType') != 'null' && tools.getCookie('bankType') != ''){
  48. bankType = content.filter(function (e) { return e.dictValue == tools.getCookie('bankType'); })[0].dictLabel;
  49. document.getElementById('bankTypeText').value = bankType;
  50. }
  51. }
  52. }
  53. //底部友情链接
  54. module.accountType = function (data) {
  55. if (data.code == 200) {
  56. var content = data.data;
  57. if(tools.getCookie('accountType') != undefined){
  58. var accountType = content.filter(function (e) { return e.dictValue == tools.getCookie('accountType'); })[0].dictLabel;
  59. document.getElementById('accountTypeText').value = accountType;
  60. }
  61. }
  62. }
  63. //焦点图数据
  64. module.focusNewsTop = function (data) {
  65. if (data.code == 200) {
  66. let focusArray = [];
  67. if(data.data.length<1){
  68. focusArray.push({
  69. picUrl:'../../../static/images/banner1.png'
  70. },{
  71. picUrl:'../../../static/images/banner2.png'
  72. },{
  73. picUrl:'../../../static/images/banner3.png'
  74. })
  75. }else{
  76. data.data.forEach(res=>{
  77. focusArray.push({
  78. picUrl:'/api'+res.picUrl
  79. })
  80. })
  81. }
  82. module.data.focusListTop = focusArray;
  83. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  84. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  85. new Swiper('#bannerFocusWrapTop', {
  86. paginationClickable: true,
  87. autoplay : 4000,
  88. loop:true
  89. })
  90. }
  91. }
  92. //底部友情链接
  93. module.bottomFriendsLinks = function (data) {
  94. if (data.code == 200) {
  95. var content = data.data;
  96. console.log(content)
  97. module.data.friendsLinksList = content;
  98. var friendsLinksData = template('friendsLinksData', module.data);
  99. $("#friendsLinksContent").html(friendsLinksData);
  100. }
  101. }
  102. //获取地址栏参数
  103. function getQueryVariable(variable){
  104. var query = window.location.search.substring(1);
  105. var vars = query.split("&");
  106. for (var i=0;i<vars.length;i++) {
  107. var pair = vars[i].split("=");
  108. if(pair[0] == variable){return pair[1];}
  109. }
  110. return(false);
  111. }
  112. //获取上传图片list
  113. module.upLoadAction = function(data){
  114. console.log(data)
  115. if (data.msg != '操作成功'){
  116. tools.initError(data.msg);
  117. return;
  118. }else{
  119. var upLoadList = [];
  120. var dataList = {};
  121. $('#cupload-3').find('input').each(function() {
  122. if($(this).val()!=''){
  123. upLoadList.push($(this).val())
  124. }
  125. });
  126. dataList["files"] = upLoadList;
  127. dataList["tableId"] = data.data;
  128. dataList["fileType"] = '';
  129. dataList["bizPath"] = 'transaction';
  130. dataList["tableName"] = 't_transaction_signup';
  131. console.log(dataList)
  132. tools.doPostImg(base64Upload, dataList, module.upLoadOver);
  133. }
  134. }
  135. module.upLoadOver = function(data){
  136. tools.initError('提交申请,等待审核')
  137. setTimeout(function () {
  138. tools.skip('itemsDetail.html?id='+getQueryVariable('id'))
  139. },2000)
  140. }
  141. module.outProjectInformation = function (data) {
  142. if (data.code == 200) {
  143. console.log(data)
  144. var content = data.data;
  145. $("#projectTitle").html('项目名称:'+content.projectName);
  146. $("#projectNum").html('需缴纳保证新:'+content.deposit+'元');
  147. $("#payAccount").html('保证金缴纳账号:'+content.payAccount);
  148. $("#accountName").html('账户名称:'+content.accountName);
  149. $("#bankName").html('开户银行:'+content.bankName);
  150. var cupload2 = new Cupload ({
  151. ele: '#cupload-3',
  152. num: 5,
  153. });
  154. }
  155. }
  156. submit = function(){
  157. if(module.onCheck()){
  158. var data = {};
  159. var realName = $('#realName').val();
  160. var userNum = $('#userNum').val();
  161. var userBank = $('#userBank').val();
  162. var bankId = $('#bankId').val();
  163. var idCard = $('#idCard').val();
  164. var bankCardName = $('#bankCardName').val();
  165. var payeePaymentLines = $('#payeePaymentLines').val();
  166. var bankType = $('#bankType').val();
  167. var accountType = $('#accountType').val();
  168. data['projectId'] = getQueryVariable('id');
  169. data['memberId'] = tools.getCookie('memberId');
  170. data['realname'] = realName;
  171. data['idCardNum'] = idCard;
  172. data['phone'] = userNum;
  173. data['address'] = tools.getCookie('address');
  174. data['bankAddress'] = userBank;
  175. data['bankCardName'] = bankCardName;
  176. data['bankCardNum'] = bankId;
  177. data['payeePaymentLines'] = payeePaymentLines;
  178. data['bankType'] = bankType;
  179. data['accountType'] = accountType;
  180. data['status'] = 'N';
  181. tools.doPost(signupSubmit, data, module.upLoadAction);
  182. }
  183. }
  184. //验证表单
  185. module.onCheck = function () {
  186. var userNum = $('#userNum').val();
  187. var realName = $('#realName').val();
  188. var userBank = $('#userBank').val();
  189. var bankCardName = $('#bankCardName').val();
  190. var bankId = $('#bankId').val();
  191. var idCard = $('#idCard').val();
  192. var payeePaymentLines = $('#payeePaymentLines').val();
  193. var bankType = $('#bankType').val();
  194. var accountType = $('#accountType').val();
  195. if ($('#checkAgree:checked').val() == undefined ) {
  196. $('#checkAgree')[0].focus()
  197. tools.initTips('请选择我已同意', 'right', $('#checkAgree')[0], 2000)
  198. return false;
  199. }
  200. if (realName == '') {
  201. $('#realName')[0].focus()
  202. tools.initTips('姓名不可为空', 'right', $('#realName')[0], 2000)
  203. return false;
  204. }
  205. if (userNum == '') {
  206. $('#userNum')[0].focus()
  207. tools.initTips('会员账号不可为空', 'right', $('#userNum')[0], 2000)
  208. return false;
  209. }
  210. if (accountType == '') {
  211. $('#accountType')[0].focus()
  212. tools.initTips('账户类型不可为空', 'right', $('#accountType')[0], 2000)
  213. return false;
  214. }
  215. if (bankType == '') {
  216. $('#bankType')[0].focus()
  217. tools.initTips('所属银行不可为空', 'right', $('#bankType')[0], 2000)
  218. return false;
  219. }
  220. if (bankCardName == '') {
  221. $('#bankCardName')[0].focus()
  222. tools.initTips('开户行姓名不可为空', 'right', $('#bankCardName')[0], 2000)
  223. return false;
  224. }
  225. if (userBank == '') {
  226. $('#userBank')[0].focus()
  227. tools.initTips('开户银行不可为空', 'right', $('#userBank')[0], 2000)
  228. return false;
  229. }
  230. if (bankId == '') {
  231. $('#bankId')[0].focus()
  232. tools.initTips('银行卡号不可为空', 'right', $('#bankId')[0], 2000)
  233. return false;
  234. }
  235. if (payeePaymentLines == '') {
  236. $('#payeePaymentLines')[0].focus()
  237. tools.initTips('联行号不可为空', 'right', $('#payeePaymentLines')[0], 2000)
  238. return false;
  239. }
  240. if (idCard == '') {
  241. $('#idCard')[0].focus()
  242. tools.initTips('身份证号不可为空', 'right', $('#idCard')[0], 2000)
  243. return false;
  244. }
  245. if (idCard == '') {
  246. $('#idCard')[0].focus()
  247. tools.initTips('身份证号不可为空', 'right', $('#idCard')[0], 2000)
  248. return false;
  249. }
  250. else{
  251. return true;
  252. }
  253. // let array = []
  254. // $('#cupload-3').find('input').each(function() {
  255. // if($(this).val()!=''){
  256. // array.push($(this).val())
  257. // }
  258. // });
  259. // if(array.length<1){
  260. // $('#cupload-3')[0].focus()
  261. // tools.initTips('请上传相关凭证', 'right', $('#cupload-3')[0], 2000)
  262. // return false;
  263. // }
  264. }
  265. module.toTips = function(data){
  266. console.log(data)
  267. if(data.msg != '操作成功'){
  268. tools.initError(data.msg)
  269. }else{
  270. tools.initError('提交申请,等待审核')
  271. }
  272. }
  273. return module;
  274. });