function getQueryString(location) { //var url = location.search; //获取url中"?"符后的字串 var url = location.search; var theRequest = new Object(); if (url.indexOf("?") != -1) { var str = url.substr(1); strs = str.split("&"); for (var i = 0; i < strs.length; i++) { theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]); } } else { theRequest = null; } return theRequest; } var func = { openid: '', token: '', unpaid: '', countType: '' }; var color = getQueryString(window.location).carType console.log(color) if(color == 1){ $('.carNum').addClass('carNumYellow') } var _carNumber = getQueryString(window.location).carNumber console.log(_carNumber) $('.carNum').text(_carNumber) /** * @param {} second * @return {} * @desc 秒转化成dd hh:mm:ss */ var salt = jsajax.salt(32); var sortd = [ { keyname: 'app_id', value: '0eca8f5373ca4866aec2f8e9d9367104' }, { keyname: 'deviceInfo', value: 'BC0703A4-AFB0-4B51-9089-9B7487C0CC6E' }, { keyname: 'salt', value: salt }, { keyname: 'sign_type', value: 'md5' }, { keyname: 'token', value: '8957e613280b46f7ae8aaea71ed17353' }, { keyname: 'pageNum', value: 1 }, { keyname: 'pageSize', value: 10 }, { keyname: 'parkState', value: 10 }, { keyname: 'terminalSource', value: 7 }, { keyname: 'carNumber', value: _carNumber } ]; var md5sign = jsajax.getsign(sortd); var jsondata = { app_id: "0eca8f5373ca4866aec2f8e9d9367104", deviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", salt: salt, sign_type: "md5", token: '8957e613280b46f7ae8aaea71ed17353', pageNum: 1, pageSize: 10, parkState: 10, terminalSource: 7, carNumber: _carNumber, sign: md5sign } console.log('停车记录传参 ' + JSON.stringify(jsondata)); jsajax.defaultReq( mUrl.listServer, JSON.stringify(jsondata), function (data) { console.log(data.data.dataList) var data = data.data.dataList; if (data.length == 0) { $('#tip-title').text('您的停车费用为0元,无须缴费,谢谢!') return } var htmls = ''; for (var i = 0; i < data.length; i++) { var orderFreeDuration = Number((data[i].orderFreeDuration)) var parkDuration = Number((data[i].parkDuration)) var num = ((data[i].unPayFee) / 100).toFixed(2); var outflag = data[i].orderStateRemark; if (outflag == '出场缴费') { if (orderFreeDuration > parkDuration) { htmls += '
' + '
' + '
' + '

' + data[i].carNumber + '

' + ' ' + // ' ' + '
' + '
' + '
' + '
' + '
' + '

停车场名称:' + data[i].parkName + '

' + '

进场时间:' + data[i].parkInTime + '

' + '

出场时间:' + data[i].parkOutTime + '

' + '

停车时长:' + dateFormat(data[i].parkDuration) + '

' + '
' + '
' + '

' + num + '

' + '

申请离场' + ' ' + '

' + '
' + '
' + '
'; } else { htmls += '
' + '
' + '
' + '

' + data[i].carNumber + '

' + ' ' + // ' ' + '
' + '
' + '
' + '
' + '
' + '

停车场名称:' + data[i].parkName + '

' + '

进场时间:' + data[i].parkInTime + '

' + '

出场时间:' + data[i].parkOutTime + '

' + '

停车时长:' + dateFormat(data[i].parkDuration) + '

' + '
' + '

' + num + '

' + '

出场缴费' + ' ' + '

' + '
' + '
' + '
'; } } else { htmls += '
' + '
' + '
' + '

' + data[i].carNumber + '

' + ' ' + // ' ' + '
' + '
' + outflag + '
' + '
' + '
' + '
' + '

停车场名称:' + data[i].parkName + '

' + '

进场时间:' + data[i].parkInTime + '

' + '

出场时间:' + data[i].parkOutTime + '

' + '

停车时长:' + dateFormat(data[i].parkDuration) + '

' + '
' + '

' + num + '

' + '

清缴欠费' + ' ' + '

' + '
' + '
' + '
'; } // if(outflag=='出场缴费'){ // outflag = '' // } } $('#pay_listcont').append(htmls); // alert(data.message) }) var dateFormat = function (msd) { var time = msd if (null != time && "" != time) { if (time > 60 && time < 60 * 60) { time = parseInt(time / 60.0) + "分钟" + parseInt((parseFloat(time / 60.0) - parseInt(time / 60.0)) * 60) + "秒"; } else if (time >= 60 * 60 && time < 60 * 60 * 24) { time = parseInt(time / 3600.0) + "小时" + parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) + "分钟" + parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) - parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒"; } else if (time >= 60 * 60 * 24) { time = parseInt(time / 3600.0 / 24) + "天" + parseInt((parseFloat(time / 3600.0 / 24) - parseInt(time / 3600.0 / 24)) * 24) + "小时" + parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) + "分钟" + parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) - parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒"; } else { time = parseInt(time) + "秒"; } } return time; }; $(document).on('click', '.weui-cells', function () { console.log($(this).attr('data-flag')) var flag = $(this).attr('data-flag') if (flag == 0) { } else { var money = $(this).find('.paymoney').text() var carNumber = $(this).find('.carNumber').text() //var parkCode = $(this).find('.parkCode').text() var orderId = $(this).find('.orderId').text() var parkCode = $(this).find('.parkCode').text() // var carNumber = $(this).find('.carNumber').text() var paySrcType = $(this).find('.paySrcType').text() if (paySrcType == '欠费') { paySrcType = 103 } else { paySrcType = 101 } localStorage.setItem('paySrcType', paySrcType) localStorage.setItem('parkCode', parkCode) getOneorder(carNumber, parkCode, orderId, paySrcType) } }) $(document).on('click', '.out-btn', function () { var _this = $(this).parent().parent().parent(); var money = _this.find('.paymoney').text() console.log(money) var _orderId = _this.find('.orderId').text() var carNumber = _this.find('.carNumber').text() //var parkCode = $(this).find('.parkCode').text() // var orderId = _this.find('.orderId').text() var parkCode = _this.find('.parkCode').text() // var carNumber = $(this).find('.carNumber').text() var paySrcType = _this.find('.paySrcType').text() var paySrcType = '101' // if(paySrcType == ''){ // paySrcType = 103 // }else{ // paySrcType = 101 // } // alert(paySrcType) console.log(paySrcType) localStorage.setItem('paySrcType', paySrcType) localStorage.setItem('parkCode', parkCode) var salt = jsajax.salt(32); var token = mUrl.GetToken(); if (token == null) { token = ''; } var jsondata = { app_id: "0eca8f5373ca4866aec2f8e9d9367104", deviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", salt: salt, sign: getMd5sign(), sign_type: "md5", //token : token, //appId:jsajax.appID, orderId: _orderId, payOrderType: '101', terminalSource: '3', //parkCode:parkCode, // carNumber:carNumber, } jsajax.defaultReq( cepath + '/appAccountPay/appApplyParkOut', JSON.stringify(jsondata), function (data) { console.log(data) if (data.code == '5005') { getOneorder(carNumber, parkCode, _orderId) } else { //$('.dialog-out').show() window.location.href = 'zeroout.html?carNumber=' + carNumber } // alert(data.message) }) }) $('.close-btn').on('click', function () { $('.dialog-out').hide() }) //查询单个待支付单费用 function getOneorder(carNumber, parkCode, orderId, _paySrcType) { //alert(_paySrcType) // var salt = jsajax.salt(32); // var token = mUrl.GetToken(); var salt = jsajax.salt(32); var token = mUrl.GetToken(); if (token == null) { token = ''; } var _payType = 0; if (/MicroMessenger/.test(window.navigator.userAgent)) { _payType = 4 } else { _payType = 1 } var jsondata = { app_id: "0eca8f5373ca4866aec2f8e9d9367104", deviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", salt: salt, sign: getMd5sign(), sign_type: "md5", token: token, payType: _payType, paySrcType: _paySrcType, appId: jsajax.appID, orderId: orderId, terminalSource: '7', parkCode: parkCode, carNumber: carNumber, } console.log('查询单个的入参 ' + JSON.stringify(jsondata) + " 请求的接口" + mUrl.oneCardorder); jsajax.defaultReq( mUrl.oneCardorder, JSON.stringify(jsondata), function (data) { console.log(data) console.log('获取单个待支付订单 ' + JSON.stringify(data)); if (data.code == '0') { //setdiv(); setTimeout(function () { var datas = data.data console.log(datas) var discountFee = datas.discountFee;//已优惠 var discountDesc = datas.discountDesc;//已优惠 var parkCode = datas.parkCode; var no = datas.orderId;//.no;//订单id var inparktime = datas.inparktime;//.inparktime;//进场时间 var plateno = datas.plateno;//车牌号 var parkName = datas.parkName;//停车场名称 var staytime = datas.staytime;//停车时长 var due = datas.due;//总计费用 var unpaid = datas.unpaid;//待支付 var paid = datas.paid;//实付 var discountType = datas.discountType; var businessUsedType = datas.businessUsedType //商户信息-是否使用商户券,1-使用,0-未使用 var businessFee = datas.businessFee //商户减扣金额 if (datas.discountFee && datas.discountFee != '' && datas.discountFee != undefined) { discountFee = datas.discountFee;//已优惠 if (datas.discountDesc && datas.discountDesc != '' && datas.discountDesc != undefined) { discountDesc = datas.discountDesc;//已优惠 } } //console.log('-------------------------------'+discountType); //查询到车牌号订单信息 var src = 'home.html?carnum=' + plateno + "&inparktime=" + inparktime + "&parkName=" + parkName + "&staytime=" + staytime + "&due=" + due + "&unpaid=" + unpaid + "&paid=" + paid + "&no=" + no + "&disfee=" + discountFee + "&disdesc=" + discountDesc + '&discountType=' + discountType + '&parkCode=' + parkCode + '&orderId=' + datas.orderId + '&discountFee=' + datas.discountFee + '&parkOutTime=' + datas.outtime + '&orderFee=' + datas.orderFee + '&appOrderTimeout=' + datas.appOrderTimeout + '&appId=' + datas.appId + '&orderId=' + datas.orderId + '&_paySrcType=' + _paySrcType + "&businessUsedType=" + businessUsedType + "&businessFee=" + businessFee console.log(src) window.location.assign(encodeURI(src)) }, 100); } } ) } function getMd5sign() { var salt = jsajax.salt(32); var token = mUrl.GetToken(); if (token == null) { token = ''; } var sortd = [ { keyname: 'app_id', value: '0eca8f5373ca4866aec2f8e9d9367104' }, { keyname: 'deviceInfo', value: 'BC0703A4-AFB0-4B51-9089-9B7487C0CC6E' }, { keyname: 'salt', value: salt }, { keyname: 'sign_type', value: 'md5' }, { keyname: 'token', value: token } ]; var md5sign = jsajax.getsign(sortd); return md5sign; } $('.outBtn').on('click', function () { //window.location.href = 'http://wxgzh.renniting.cn/wechatwuxi/Chifeng/Threewf/stoppayment/select.html' window.location.href = 'out.html' }) $('.hiddenBtn').on('click', function () { $('#strTip').hide() })