|
- /**
- * Created by Administrator on 2021/4/5.
- */
- define(['jquery', "template", "Tools", 'swiper', 'itemsApi',"cupload"], function ($, template, Tools, swiper) {
- //数据存储
- var module = {
- data: {
- //焦点图数据
- focusListTop: [],
- showImgInformationDetail:''
- },
- };
- var tools = new Tools();
-
- module.init = function (page) {//底部友情链接
- //获取焦点图信息
- tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
- tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
- document.getElementById('realName').value = tools.getCookie('userName');
- document.getElementById('userNum').value = tools.getCookie('phone');
- document.getElementById('userBank').value = tools.getCookie('bankAddress');
- document.getElementById('bankId').value = tools.getCookie('bankCardNum');
- document.getElementById('bankCardName').value = tools.getCookie('bankCardName');
- document.getElementById('idCard').value = tools.getCookie('idCardNum');
- document.getElementById('payeePaymentLines').value = tools.getCookie('payeePaymentLines');
- tools.doGet(webDeptType+"/bank_account_type", {}, module.accountType, true);
- tools.doGet(webDeptType+"/bank_type_all", {}, module.bankType, true);
- //项目基本信息
- tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);
- //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
- tools.getWebConfig();
- };
-
- //底部友情链接
- module.bankType = function (data) {
- if (data.code == 200) {
- var content = data.data;
- if(tools.getCookie('bankType') != undefined){
- var bankType = content.filter(function (e) { return e.dictValue == tools.getCookie('bankType'); })[0].dictLabel;
- document.getElementById('bankType').value = bankType;
- }
- }
- }
-
- //底部友情链接
- module.accountType = function (data) {
- if (data.code == 200) {
- var content = data.data;
- if(tools.getCookie('accountType') != undefined){
- var accountType = content.filter(function (e) { return e.dictValue == tools.getCookie('accountType'); })[0].dictLabel;
- document.getElementById('accountType').value = accountType;
- }
- }
- }
-
- //焦点图数据
- module.focusNewsTop = function (data) {
- if (data.code == 200) {
-
- let focusArray = [];
-
- if(data.data.length<1){
- focusArray.push({
- picUrl:'../../../static/images/banner1.png'
- },{
- picUrl:'../../../static/images/banner2.png'
- },{
- picUrl:'../../../static/images/banner3.png'
- })
- }else{
- data.data.forEach(res=>{
- focusArray.push({
- picUrl:'/api'+res.picUrl
- })
- })
- }
-
- module.data.focusListTop = focusArray;
- var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
- $("#bannerFocusTopContent").html(bannerFocusDataTop);
-
- new Swiper('#bannerFocusWrapTop', {
- paginationClickable: true,
- autoplay : 4000,
- loop:true
- })
-
- }
- }
-
- //底部友情链接
- module.bottomFriendsLinks = function (data) {
- if (data.code == 200) {
- var content = data.data;
- console.log(content)
- module.data.friendsLinksList = content;
- var friendsLinksData = template('friendsLinksData', module.data);
- $("#friendsLinksContent").html(friendsLinksData);
- }
- }
-
- //获取地址栏参数
- function getQueryVariable(variable){
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i=0;i<vars.length;i++) {
- var pair = vars[i].split("=");
- if(pair[0] == variable){return pair[1];}
- }
- return(false);
- }
-
- //获取上传图片list
- module.upLoadAction = function(data){
- console.log(data)
- if (data.msg != '操作成功'){
- tools.initError(data.msg);
- return;
- }else{
- var upLoadList = [];
- var dataList = {};
- $('#cupload-3').find('input').each(function() {
- if($(this).val()!=''){
- upLoadList.push($(this).val())
- }
- });
- dataList["files"] = upLoadList;
- dataList["tableId"] = data.data;
- dataList["fileType"] = '';
- dataList["bizPath"] = 'transaction';
- dataList["tableName"] = 't_transaction_signup';
- console.log(dataList)
- tools.doPostImg(base64Upload, dataList, module.upLoadOver);
- }
- }
-
- module.upLoadOver = function(data){
- tools.initError('提交申请,等待审核')
- setTimeout(function () {
- tools.skip('itemsDetail.html?id='+getQueryVariable('id'))
- },2000)
- }
-
- module.outProjectInformation = function (data) {
- if (data.code == 200) {
- console.log(data)
- var content = data.data;
- $("#projectTitle").html('项目名称:'+content.projectName);
- $("#projectNum").html('需缴纳保证新:'+content.deposit+'元');
- var cupload2 = new Cupload ({
- ele: '#cupload-3',
- num: 5,
- });
- }
- }
-
- submit = function(){
- if(module.onCheck()){
- var data = {};
- var realName = $('#realName').val();
- var userNum = $('#userNum').val();
- var userBank = $('#userBank').val();
- var bankId = $('#bankId').val();
- var idCard = $('#idCard').val();
- var bankCardName = $('#bankCardName').val();
- var payeePaymentLines = $('#payeePaymentLines').val();
- var bankType = $('#bankType').val();
- var accountType = $('#accountType').val();
-
- data['projectId'] = getQueryVariable('id');
- data['memberId'] = tools.getCookie('memberId');
- data['realname'] = realName;
- data['idCardNum'] = idCard;
- data['phone'] = userNum;
- data['address'] = tools.getCookie('address');
- data['bankAddress'] = userBank;
- data['bankCardName'] = bankCardName;
- data['bankCardNum'] = bankId;
- data['payeePaymentLines'] = payeePaymentLines;
- data['bankType'] = bankType;
- data['accountType'] = accountType;
- data['status'] = 'Y';
-
- tools.doPost(signupSubmit, data, module.upLoadAction);
- }
- }
- //验证表单
- module.onCheck = function () {
- var userNum = $('#userNum').val();
- var realName = $('#realName').val();
- var userBank = $('#userBank').val();
- var bankCardName = $('#bankCardName').val();
- var bankId = $('#bankId').val();
- var idCard = $('#idCard').val();
- var payeePaymentLines = $('#payeePaymentLines').val();
- var bankType = $('#bankType').val();
- var accountType = $('#accountType').val();
-
- if ($('#checkAgree:checked').val() == undefined ) {
- $('#checkAgree')[0].focus()
- tools.initTips('请选择我已同意', 'right', $('#checkAgree')[0], 2000)
- return false;
- }
- if (realName == '') {
- $('#realName')[0].focus()
- tools.initTips('姓名不可为空', 'right', $('#realName')[0], 2000)
- return false;
- }
- if (userNum == '') {
- $('#userNum')[0].focus()
- tools.initTips('会员账号不可为空', 'right', $('#userNum')[0], 2000)
- return false;
- }
- if (accountType == '') {
- $('#accountType')[0].focus()
- tools.initTips('账户类型不可为空', 'right', $('#accountType')[0], 2000)
- return false;
- }
- if (bankType == '') {
- $('#bankType')[0].focus()
- tools.initTips('所属银行不可为空', 'right', $('#bankType')[0], 2000)
- return false;
- }
- if (bankCardName == '') {
- $('#bankCardName')[0].focus()
- tools.initTips('开户行姓名不可为空', 'right', $('#bankCardName')[0], 2000)
- return false;
- }
- if (userBank == '') {
- $('#userBank')[0].focus()
- tools.initTips('开户银行不可为空', 'right', $('#userBank')[0], 2000)
- return false;
- }
- if (bankId == '') {
- $('#bankId')[0].focus()
- tools.initTips('银行卡号不可为空', 'right', $('#bankId')[0], 2000)
- return false;
- }
- if (payeePaymentLines == '') {
- $('#payeePaymentLines')[0].focus()
- tools.initTips('联行号不可为空', 'right', $('#payeePaymentLines')[0], 2000)
- return false;
- }
- if (idCard == '') {
- $('#idCard')[0].focus()
- tools.initTips('身份证号不可为空', 'right', $('#idCard')[0], 2000)
- return false;
- }
-
- return true;
- }
- module.toTips = function(data){
- console.log(data)
- if(data.msg != '操作成功'){
- tools.initError(data.msg)
- }else{
- tools.initError('提交申请,等待审核')
- }
- }
- return module;
- });
|