网站
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

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