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

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