diff --git a/js/ajax.js b/js/ajax.js index e4ead36..73aff4a 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -1 +1,323 @@ -eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1i.26=j(){z.27=j(){5 a=1i.28||29[0];6(a.P==25){n C}w{6((a.23)&&(a.1j)&&(a.P==1Z)){n C}w{6((a.1j)&&(a.P==1Y)){n C}}}};z.20=j(){n C}};5 21="22";5 k=k||{};k.1k="2a";k.2b=j(c,a){5 b="";5 d={2i:k.1k,J:c};k.Q(t.2j,x.B(d),j(e){u.v("根据J获取W"+x.B(e));6(e.J=="0"){b=e.E;t.2k(b);t.2l("1u");u.v("用户 W "+b);a(b)}})};k.2h=j(b,a){5 c={W:b,2g:"2c-2d-1X-2f-2m"};k.Q(t.1T,x.B(c),j(d){u.v("执行获取F的接口 "+x.B(d));6(d.J==0){u.v("用户 F "+d.E.F);t.1D(d.E.F);t.1G(d.E.1K);a(1)}w{a(0)}})};k.1d=j(){5 a="";6(t.I()&&t.I()!=""){a=t.I()}6(a!=""){6(a=="1g"||a=="1J"){6($(".1h")){$(".1h").1H("1g")}}}u.v("执行米 "+a)};k.1d();k.T={L:j(c){6(!c||c.r===0){1e H 1f(\'1l "1m" 1s 1t !\')}5 a=z.1r("1c")[0];5 b=z.1n("1F");b.1I=c;b.1W="1S";b.Y="1o/L";a.1p(b)},1L:j(c){6(!c||c.r===0){1e H 1f(\'1l "1m" 1s 1t !\')}5 b=z.1r("1c")[0];5 a=z.1n("1Q");a.1M=c;a.Y="1o/1N";b.1p(a)}};k.2n=j(b){5 a=t.I();u.v("这里先获取 "+a);6(a){6(a!="1u"){u.v("不是微信微信");6(b){k.T.L(b)}}w{}}w{k.T.L(b)}};k.Q=j(a,b,d,c){b=(b==O||b==""||1a(b)=="17")?{2e:H 12().2y()}:b;$.2U({Y:"2T",E:b,2S:a,2Q:"19",2X:"2R/19;2W=30-8",2Z:j(e){},2Y:j(e){d(e)},2O:j(f){u.v(x.B(f));6(1a(c)!="17"){c(x.B(f))}},2x:j(f){}})};k.2P=j(b){5 a=C;6(b.r==7){5 c=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-1v-9]{4}[A-1v-9挂学警港澳]{1}$/;a=c.G(b)}n a};k.2z=j(b){5 d=j(h,g){5 f=h.14;5 e=g.14;6(fe){n 1}w{n 0}}};b.2u(d);5 c="1b";16(5 a=0;a"+c);c=2q(c);c=c.2r();n c};k.2s=j(d){5 c=p(d);5 e="2A";5 b=e.r;5 g="";16(5 f=0;f-1||a.1q("2F")>-1;5 c=!!a.2H(/\\(i[^;]+;( U;)? 2L.+2J 2p X/);d==11?11:C;5 b="";6(d){b="2t"}w{6(c){b="2v"}}e(b)}k.2w=j(h){5 e=p(h);5 c=0;5 b=0;5 i="";5 f=p(e/(l*l*24));5 g=p(e/(l*l)-f*24);5 a=p(e/l-g*l-f*24*l);5 d=p(e-a*l-g*l*l-f*24*l*l);6(f>0){i+=f+"天"}6(g>0){i+=g+"小时"}6(a>0){i+=a+"分"}6(d>0){i+=d+"秒"}n i};k.2V=j(e){5 d=p(e);5 c=0;5 b=0;6(d>l){c=p(d/l);d=p(d%l);6(c>l){b=p(c/l);c=p(c%l)}}5 a="";6(c>0){a=""+p(c)+"分"+a}6(b>0){a=""+p(b)+"小时"+a}n a};12.1z.1P=j(b){5 c={"M+":o.V()+1,"d+":o.1x(),"h+":o.1w(),"m+":o.1C(),"s+":o.1y(),"q+":K.1A((o.V()+3)/3),S:o.1R()};6(/(y+)/.G(b)){b=b.13(D.$1,(o.1B()+"").N(4-D.$1.r))}16(5 a 1V c){6(H D("("+a+")").G(b)){b=b.13(D.$1,D.$1.r==1?c[a]:("1U"+c[a]).N((""+c[a]).r))}}n b};12.1z.1E=j(){5 b=o.1y();5 a=o.1C();6(b>=0&&b<=9){b="0"+b}6(a>=0&&a<=9){a="0"+a}n o.1B()+"/"+(o.V()+1)+"/"+o.1x()+" "+o.1w()+":"+a+":"+b};',62,187,'|||||var|if|||||||||||||function|jsajax|60||return|this|parseInt||length||mUrl|console|log|else|JSON||document||stringify|false|RegExp|data|token|test|new|getApporWX|code|Math|css||substr|null|keyCode|defaultReq|toString||dynamicLoading||getMonth|openid||type|||true|Date|replace|keyname|value|for|undefined|navigator|json|typeof|ny1u72b6k374sg379z0kqjgfxe2ycnpw|head|setstyle|throw|Error|iosapp|qihuan|window|shiftKey|appID|argument|path|createElement|text|appendChild|indexOf|getElementsByTagName|is|required|wx|Z0|getHours|getDate|getSeconds|prototype|floor|getFullYear|getMinutes|SetToken|toLocaleString|link|SetPhone|addClass|href|andriodapp|phoneNum|js|src|javascript|Android|format|script|getMilliseconds|stylesheet|tcgettoken|00|in|rel|4B51|121|73|oncontextmenu|_app_id|ud8yq5tv0inxupc05xfeau39jywlqoj2|ctrlKey||123|onload|onkeydown|event|arguments|wx2af2bab90d433c86|getopenid|BC0703A4|AFB0|date|9089|deviceInfo|gett|appId|tcgetopenid|SetOpenid|setApporWX|9B7487C0CC6E|setcss|strmd5|OS|md5|toUpperCase|salt|android|sort|ios|formatSeconds|complete|getTime|getsign|ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678|charAt|isAndroidorios|while|userAgent|Linux|appVersion|match|round|Mac|random|CPU|fenToYuan|isNaN|error|isVehicleNumber|dataType|application|url|post|ajax|fStohours|charset|contentType|success|beforeSend|utf'.split('|'),0,{})) +window.onload = function () { + document.onkeydown = function () { + var e = window.event || arguments[0]; + //屏蔽F12 + if (e.keyCode == 123) { + + return false; + //屏蔽Ctrl+Shift+I + } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)) { + + return false; + //屏蔽Shift+F10 + } else if ((e.shiftKey) && (e.keyCode == 121)) { + return false; + } + }; + //屏蔽右键单击 + document.oncontextmenu = function () { + return false; + } +} + +var _app_id = 'ud8yq5tv0inxupc05xfeau39jywlqoj2' + +var jsajax = jsajax || {}; +//任你停赤峰 + + +jsajax.appID = 'wx2af2bab90d433c86'; +//获取openid +jsajax.getopenid = function (code,fn) { + var openid = ''; + var jsondata = { + appId:jsajax.appID, + code:code + }; + jsajax.defaultReq( + mUrl.tcgetopenid, + JSON.stringify(jsondata), + function(data){ + console.log("根据code获取openid"+JSON.stringify(data)); + if(data.code=='0'){ + openid = data.data; + mUrl.SetOpenid(openid); + mUrl.setApporWX('wx'); + console.log("用户 openid "+openid); + fn(openid); + } + } + ); +} +//获取token +jsajax.gett = function (openid,fn) { + var jsondata = { + openid:openid, + deviceInfo:"BC0703A4-AFB0-4B51-9089-9B7487C0CC6E" + } + jsajax.defaultReq( + mUrl.tcgettoken, + JSON.stringify(jsondata), + function (data) { + console.log('执行获取token的接口 '+JSON.stringify(data)); + if(data.code==0){ + console.log("用户 token "+data.data.token); + mUrl.SetToken(data.data.token); + mUrl.SetPhone(data.data.phoneNum); + fn(1); + }else{ + fn(0); + //location.href = mUrl.Uri+'/WEB-INF/pages/elsepages/common_pages/paybind.html; + } + } + ); +} +/*获取设备 start*/ + +jsajax.setstyle = function(){ + + var pt = ''; + if(mUrl.getApporWX()&&mUrl.getApporWX()!=''){ + pt = mUrl.getApporWX(); + } + // alert('clapntemp_获取到用户openid'+mUrl.getApporWX()); + + if(pt!=''){ + if(pt=='iosapp'||pt=='andriodapp'){ + if($('.qihuan')){ + $('.qihuan').addClass('iosapp'); + } + + } + } + console.log('执行米 '+pt); +} +jsajax.setstyle(); + + + +/*根据不同的类型加载不同的文件 start*/ +jsajax.dynamicLoading = { + css: function(path){ + if(!path || path.length === 0){ + throw new Error('argument "path" is required !'); + } + var head = document.getElementsByTagName('head')[0]; + var link = document.createElement('link'); + link.href = path; + link.rel = 'stylesheet'; + link.type = 'text/css'; + head.appendChild(link); + }, + js: function(path){ + if(!path || path.length === 0){ + throw new Error('argument "path" is required !'); + } + var head = document.getElementsByTagName('head')[0]; + var script = document.createElement('script'); + script.src = path; + script.type = 'text/javascript'; + head.appendChild(script); + } +} + +jsajax.setcss = function(strpath){ + var wxorapp = mUrl.getApporWX(); + console.log('这里先获取 '+wxorapp); + if(wxorapp){ + if(wxorapp!='wx'){ + console.log('不是微信微信'); + if(strpath){ + jsajax.dynamicLoading.css(strpath); + } + + }else{ + //jsajax.dynamicLoading.css("n1.css"); + //console.log('dengyu微信'); + } + }else{ + jsajax.dynamicLoading.css(strpath); + } +}; + +/* 默认请求*/ +jsajax.defaultReq=function(url, data, successfn,errorfn) { + data = (data==null || data=="" || typeof(data)=="undefined")? {"date": new Date().getTime()} : data; + $.ajax({ + type: "post", + data: data, + url: url, + dataType: "json", + contentType:'application/json;charset=utf-8', + beforeSend:function(xhr){}, + success: function(d){ + successfn(d); + }, + error: function(e){ + //alert(JSON.stringify(e)); + console.log(JSON.stringify(e)); + if (typeof (errorfn) != "undefined") { + errorfn(JSON.stringify(e)); + } + }, + complete:function (e) {} + }); +} +/* 车牌号校验.
*/ +jsajax.isVehicleNumber=function(vehicleNumber){ + var result = false; + if (vehicleNumber.length == 7){ + var express = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/; + result = express.test(vehicleNumber); + } + return result; +} + +//获取签名 +jsajax.getsign = function(objb){ + var compare = function (obj1, obj2) { + var val1 = obj1.keyname; + var val2 = obj2.keyname; + if (val1 < val2) { + return -1; + } else if (val1 > val2) { + return 1; + } else { + return 0; + } + } + objb.sort(compare); + var strmd5 = 'ny1u72b6k374sg379z0kqjgfxe2ycnpw'; + for(var i=0;i'+strmd5); + strmd5 = md5(strmd5); + strmd5=strmd5.toUpperCase(); + return strmd5; +} +//获取盐值 +jsajax.salt=function(a){ + var len = parseInt(a); + var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; + var maxPos = $chars.length; + var pwd = ''; + for (var i = 0; i < len; i++) { + pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); + } + console.log(pwd); + return pwd; +} + +//金额转换(分转化成元) +jsajax.fenToYuan=function(fen){ + if( fen == null || fen.length<=0 || isNaN(fen) == true){ + return ""; + } + var yuan = Math.round(fen); + yuan = yuan.toString(); + var before = yuan.substr(0, yuan.length - 2); + + var end = yuan.substr(yuan.length - 2, 2); + before = before.toString(); + end = end.toString(); + if(before==''){ + before = '0'; + } + if(fen<10){ + end = '0'+end; + } + yuan = before + "." + end; + var re = /(-?\d+)(\d{3})/; + while (re.test(yuan)) { + yuan = yuan.replace(re, "$1,$2") + } + return yuan; +} +function isAndroidorios(fn){ + var u = navigator.userAgent, app = navigator.appVersion; + var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器 + var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 + isAndroid==true?true:false; + var jixing = ''; + if(isAndroid){jixing = 'android';}else if(isiOS){ + jixing = 'ios'; + } + fn(jixing); +} +//时间转化 秒转分 +jsajax.formatSeconds = function (value) { + var theTime = parseInt(value);// 秒 + var theTime1 = 0;// 分 + var theTime2 = 0;// 小时 + var result = ''; + var day = parseInt(theTime/(60*60*24)); + var hours = parseInt(theTime/(60*60) - day*24); + var fen = parseInt(theTime/60 -hours*60 - day*24*60); + var senc = parseInt(theTime -fen*60 -hours*60*60 - day*24*60*60); + if(day>0){result +=day+'天';} + if(hours>0){result +=hours+'小时';} + if(fen>0){result +=fen+'分';} + if(senc>0){result +=senc+'秒';} + return result; +} + +jsajax.fStohours = function (value) { + var theTime = parseInt(value);// 秒 + var theTime1 = 0;// 分 + var theTime2 = 0;// 小时 + if(theTime > 60) { + theTime1 = parseInt(theTime/60); + theTime = parseInt(theTime%60); + if(theTime1 > 60) { + theTime2 = parseInt(theTime1/60); + theTime1 = parseInt(theTime1%60); + } + } + var result = "";//+parseInt(theTime)+"秒"; + if(theTime1 > 0) { + result = ""+parseInt(theTime1)+"分"+result; + } + if(theTime2 > 0) { + result = ""+parseInt(theTime2)+"小时"+result; + } + return result; +} +//为Date类型拓展一个format方法,用于格式化日期 +Date.prototype.format = function (format) //author: meizz +{ + var o = { + "M+": this.getMonth() + 1, //month + "d+": this.getDate(), //day + "h+": this.getHours(), //hour + "m+": this.getMinutes(), //minute + "s+": this.getSeconds(), //second + "q+": Math.floor((this.getMonth() + 3) / 3), //quarter + "S": this.getMilliseconds() //millisecond + }; + if (/(y+)/.test(format)) + format = format.replace(RegExp.$1, + (this.getFullYear() + "").substr(4 - RegExp.$1.length)); + for (var k in o) + if (new RegExp("(" + k + ")").test(format)) + format = format.replace(RegExp.$1, + RegExp.$1.length == 1 ? o[k] : + ("00" + o[k]).substr(("" + o[k]).length)); + return format; +}; + +//时间格式的返回 +Date.prototype.toLocaleString = function() { + var se = this.getSeconds(); + var fz = this.getMinutes(); + if(se>=0&&se<=9){ + se = '0'+se; + } + if(fz>=0&&fz<=9){ + fz = '0'+fz; + } + return this.getFullYear() + "/" + (this.getMonth() + 1) + "/" + this.getDate() + " " + this.getHours() + ":" + fz + ":" + se; +}; diff --git a/js/monPay.js b/js/monPay.js index 7fd63cd..87377ca 100644 --- a/js/monPay.js +++ b/js/monPay.js @@ -7,7 +7,8 @@ var webAppParams = null; var $btnObj = null; var $btnLoad = null; var flag = 0; -var appWxID = 'wx2af2bab90d433c86'; +var appWxID = getQueryString(window.location).appId; + // var appWxID = 'wx945eccc8163fd75b' var webAppCode = null;//如果是微信,先获取微信code //var $btnLoad = document.getElementById("loading"); diff --git a/js/paybacknew.js b/js/paybacknew.js index bcd2c90..cd2cb54 100644 --- a/js/paybacknew.js +++ b/js/paybacknew.js @@ -1,3 +1,18 @@ +var code = getUrlParam('code'); +var local = window.location.href; +if (code == null || code === '') { + window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + jsajax.appID + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect' + +} else { + +} + +function getUrlParam(name) { + var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); + var r = window.location.search.substr(1).match(reg) + if (r != null) return unescape(r[2]) + return null +} var fun = { dateFormat: function (msd) { @@ -55,8 +70,6 @@ var fun = { }, //查询单个待支付单费用 getOneorder: function (carNumber, parkCode, orderId, parkCode) { - // var salt = jsajax.salt(32); - // var token = mUrl.GetToken(); var salt = jsajax.salt(32); var token = mUrl.GetToken(); @@ -70,7 +83,7 @@ var fun = { sign: fun.getMd5sign(), sign_type: "md5", token: token, - + payType: 4, appId: jsajax.appID, orderId: orderId, terminalSource: '7', @@ -79,7 +92,6 @@ var fun = { } - // console.log('查询单个的入参 ' + JSON.stringify(jsondata) + " 请求的接口" + mUrl.oneCardorder); jsajax.defaultReq( mUrl.oneCardorder, JSON.stringify(jsondata), @@ -90,7 +102,6 @@ var fun = { setTimeout(function () { var datas = data.data console.log(datas) - var due = datas.due;//总计费用 var unpaid = datas.unpaid;//待支付 @@ -115,14 +126,13 @@ var fun = { + "&num=" + _num // + "&paid=" + paid // + "&no=" + no + + '&appId=' + datas.appId + "&disfee=" + discountFee + "&disdesc=" + discountDesc + "&orderId=" + orderId + "&parkCode=" + parkCode + "&paySrcType=" + _paySrcType - - console.log(src) window.location.assign(encodeURI(src)) }, 100); } @@ -163,7 +173,6 @@ var fun = { console.log('获取单个待支付订单 ' + JSON.stringify(data)); var datas = data.data.carArrearages[0] console.log(datas) - setTimeout(function () { var discountFee = datas.arrearageDiscFee;//已优惠 var discountDesc = datas.discDesc;//已优惠 @@ -182,7 +191,6 @@ var fun = { } var _num = datas.arrearageNum var _paySrcType = 103 - //查询到车牌号订单信息 var src = 'monPay.html?carnum=' + carNumber @@ -191,13 +199,13 @@ var fun = { + "&paid=" + paid + "&num=" + _num // + "&no=" + no + + '&appId=' + datas.appId + "&disfee=" + discountFee + "&disdesc=" + discountDesc + "&orderId=" + orderlist // + '&discountType=' + discountType + '&parkCode=' + codes + "&paySrcType=" + _paySrcType - console.log(src) window.location.assign(encodeURI(src)) }, 100); @@ -357,7 +365,7 @@ var fun = { sign_type: "md5", token: '8957e613280b46f7ae8aaea71ed17353', pageNum: 1, - pageSize: 10, + pageSize: 1000, parkState: 10, terminalSource: 7, carNumber: _carNumber, diff --git a/monPay.html b/monPay.html index b8327af..fe8dcce 100644 --- a/monPay.html +++ b/monPay.html @@ -115,7 +115,7 @@ - + diff --git a/paybacknew.html b/paybacknew.html index e44dff1..7df375f 100644 --- a/paybacknew.html +++ b/paybacknew.html @@ -234,6 +234,6 @@ } })(); - +