diff --git a/css/list.css b/css/list.css new file mode 100644 index 0000000..ab29e22 --- /dev/null +++ b/css/list.css @@ -0,0 +1,211 @@ +.all_told, .platen_number { + text-align: center; +} +.all_told { + padding: 30px 0 10px 0; +} +.all_told span { + margin-right: 5px; + font-size: 22px; +} +.discount_money { + color: #fc3817; +} +.discount { + padding: 4px 7px; + background: #fc3817; + border-radius: 2px; + position: relative; + margin-left: 10px; + color: #fff; +} +.discount:before { + position: absolute; + content: ''; + width: 0; + height: 0; + left: -6px; + top: 8px; + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + border-right: 6px solid #fc3817; +} +.youhuid{ + background: #f00; + color: #fff; + font-size: 13px; + padding:2px 5px; + border-radius: 3px; + margin-left: 2px; + display: none; +} +.showTooltips{ + display: none; + /*针对苹果新增手势*/ + cursor: pointer; +} +.weui-cells{ + /*针对苹果新增手势*/ + cursor: pointer; +} +.dialog-out{ + position: absolute; + width: 100%; + height: 100%; + top:0; + right: 0; + left: 0; + bottom: 0; + z-index: 1000; + background: rgba(0,0,0,.3); + display: none; +} +.dia-con{ + width: 305px; + height: 138px; + padding: 10px ; + background:rgba(255,255,255,1); + border-radius:8px; + position: absolute; + left: 50%; + top:50%; + transform: translate(-50%,-50%); +} +.close-btn{ + float: right; + width: 16px; + height: 16px; + background: url("../img/close.png") no-repeat; + background-size: 100% 100%; + cursor: pointer; + overflow: hidden; +} +.dia-main{ + margin-left: 30px; + margin-top: 30px; + height: 52px; + padding-left: 90px; + background: url("../img/out.png") no-repeat; + background-size: 52px 52px; +} +.dia-text{ + padding-top: 20px; + text-align: center; + font-size: 12px; + color: #999; +} +.arrears-btn{ + width: 70px; + height: 25px; + margin-top: 20px; + color: #FFF; + font-size: 12px; + text-align: center; + line-height: 25px; + background: url("../img/arrears-bg.png") no-repeat; + background-size:70px 25px ; +} + +.strTip{ + width: 100%; + height: 100%; + text-align: center; + font-size: 20px; + background: rgba(9,9,9,.5); + position: fixed; + top:0; + left: 0; +} +.strWrap{ + margin: 20px auto 0; + width: 330px; + height: 431px; + background: #FFFFFF; + border-radius: 8px; + overflow: hidden; +} +.strCon{ + text-align: center; + font-size: 20px; + color: #333; + text-align: center; +} +.header-title{ + padding: 15px 0; + font-size: 14px; + font-weight: 600; + border-bottom:1px solid #ccc ; + color: #333; +} +.payCarNum{ + font-size: 16px; + color: #D40202; +} +.btn{ + color: #fff; + font-size: 20px; + + height: 40px; + line-height: 40px; + border-radius: 8px; + cursor: pointer; +} +.hiddenBtn{ + background: #79cbbf; +} +/*.outBtn{*/ +/*background: #509f93;*/ +/*}*/ +.tipTitle{ + /*background: url("img/tipTitle.png") no-repeat 0 center;*/ + margin-top: 20px; + font-size: 14px; + text-align: center; + font-weight: 500; + color: #333333; + line-height: 20px; +} +.carNum{ + width: 270px; + height: 80px; + margin: 20px auto; + font-size: 24px; + font-family: PingFang-SC-Medium, PingFang-SC; + font-weight: 500; + color: #FFFFFF; + text-align: center; + line-height: 80px; + background: url("../img/carNum.png") no-repeat; +} +.carNumYellow{ + background: url("../img/carNumYellow.png") no-repeat; +} + +.toPay{ + width: 270px; + height: 45px; + line-height: 45px; + text-align: center; + margin: 0 auto; + font-size: 16px; + font-family: PingFang-SC-Medium, PingFang-SC; + font-weight: 500; + color: #333333; + background: url("../img/topay.png") no-repeat; + cursor: pointer; +} +.toSelect{ + width: 270px; + margin: 20px auto 0; + text-align: right; + font-size: 12px; + font-family: PingFang-SC-Medium, PingFang-SC; + font-weight: 500; + color: #333333; + cursor: pointer; +} +.swiper-container { + width: 100%; + height: 165px; + +} diff --git a/css/monPay.css b/css/monPay.css new file mode 100644 index 0000000..1db6490 --- /dev/null +++ b/css/monPay.css @@ -0,0 +1,248 @@ +html,body { + margin: 0; + padding: 0; + background:#f0f4f5; + font-size:62.5%; /*1rem=10px*/ + font-family:'Microsoft YaHei'; +} +body { + color:#2a2a2c; +} +#header ,#section,#footer{ + +} +#header { + width:100%; +} +.panelBgColor { + background:#ffffff; +} +.headerBox { + background:#75cbbe;width:100%; + padding:5px 0px 5px 0px; + border-radius:8px; + margin: 10px; + text-align: center; +} +.flexBox { + display: flex; + justify-content: center; + flex-direction:column; + align-items:center; + width:100%; +} +.flexBoxRow { + display: flex; + display: -webkit-flex; + justify-content: left; + flex-direction:row; + align-items:center; + width:100%; +} +.flexBoxRow_column { + display: flex; + display: -webkit-flex; + justify-content: left; + flex-direction:column; + align-items:center; + width:100%; +} +.carNumBox { + font-size:1.4rem; + font-weight:bold; +} +.moneyBox { + color:#ff6f16; + font-size:3rem; +} +.colorGray { + color:#8a8a8a; +} +.payWayTitle { + font-size:16px; +} +.orderTime { + right:1rem;position:absolute; +} + + +.payIcon { + width:32px;height:32px; +} + +.row { + /*background:#ffffff;*/ + padding:10px; + position:relative; +} +.marginTop { + margin-top:1rem; +} +.splitLine { + width:100%; + border: 0; + height: 1px; + border-top: 1px solid #f0f4f5; +} + +.marginLeft { + margin-left:1rem; + font-size:14px; +} + +.btnOK { + background:#75cbbe; + width: 15rem; + height: 40px; + line-height: 40px; + text-align: center; + border-radius: 5px; + color: #ffffff; + font-size: 20px; + cursor: pointer; +} +#footer { + justify-content:center !important; +} + +/*收费明细*/ +#payDetail { + padding:5px 10px 5px 10px;font-size: 1.4rem; + /*height:55px;*/ + transition:height .5s; + -moz-transition:height .5s; /* Firefox 4 */ + -webkit-transition:height .5s; /* Safari and Chrome */ + -o-transition:height .5s; /* Opera */ + overflow-y:auto; +} +#payDetail > div { + padding: 5px 0px 2px 0px; +} +#payDetail >div > span:last-child { + margin-left:5px; +} + +/*折扣描述*/ +/*#discountDesc {*/ +/*color: #ffffff; background-color: red; border-radius: 2px; margin-left: 5px; padding: 0 3px 0 3px;*/ +/*}*/ + +#linkPayDetail { + color:#4395ff;text-decoration:none; + float: right; +} + + + + +/*********************************************/ +.radio{ + display: inline-block; + position: relative; + line-height: 18px; + margin-right: 10px; + cursor: pointer; + position:absolute; + right:1rem; +} +.radio input{ + display: none; +} +.radio .radio-bg{ + display: inline-block; + height: 18px; + width: 18px; + margin-right: 5px; + padding: 0; + background-color: #45bcb8; + border-radius: 100%; + vertical-align: top; + box-shadow: 0 1px 15px rgba(0, 0, 0, 0.1) inset, 0 1px 4px rgba(0, 0, 0, 0.1) inset, 1px -1px 2px rgba(0, 0, 0, 0.1); + cursor: pointer; + transition: all 0.2s ease; +} +.radio .radio-on{ + display: none; +} +.radio input:checked + span.radio-on{ + width: 10px; + height: 10px; + position: absolute; + border-radius: 100%; + background: #FFFFFF; + top: 4px; + left: 4px; + box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.4) inset; + background-image: linear-gradient(#ffffff 0, #e7e7e7 100%); + transform: scale(0, 0); + transition: all 0.2s ease; + transform: scale(1, 1); + display: inline-block; +} + +.headTip { + display:none;text-align: center; + background-color:rgba(253, 201, 11, 0.95); + width: 100%; + line-height:25px; +} +.headTip > span:first-child { + +} +.headTip > span:last-child { + color:red;font-size: 1.6rem; +} + + + + +.discountBox{ + border: 0; + outline: 0; + width: calc(100% - 120px); + height:28px; + line-height: 28px; + padding-left: 10px; + background:rgba(240,244,245,1); + border-radius:4px; + display: inline-block; + float: left; + color: #8a8a8a; + font-size: 14px; +} +.discountBox:focus{ + border: 0; + outline: 0; +} +.discountBtn{ + display: inline-block; + float: right; + border: none; + outline: none; + -webkit-appearance: none; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + border: 1px solid #75CBBE; + border-radius:25px ; + padding: 4px 20px; + font-size: 14px; + color: #75CBBE; + background: #fff; +} +.discount-tip{ + padding-top: 10px; + font-size: 14px; + color: #EB453B; +} +.paySuccess{ + width: 100%; + height: 100%; + text-align: center; + line-height: 100px; + font-size: 20px; + color: #fff; + background: rgba(0,0,0,.7); + position: fixed; + top:0; + left: 0; + display: none; +} diff --git a/css/paybacknew.css b/css/paybacknew.css new file mode 100644 index 0000000..c9aabbe --- /dev/null +++ b/css/paybacknew.css @@ -0,0 +1,158 @@ +.tab-wrap{ + display: flex; + margin-bottom: 4px; + height: 30px; + line-height: 30px; + background: #fff; + text-align: center; +} +.tab-wrap >li{ + flex: 1; +} +.tab-wrap >li span{ + height: 30px; + display: inline-block; + padding: 0 15px; +} +.tab-wrap >li.active span{ + color: #0474D7; + position: relative; + border-bottom: 4px solid #0474D7; +} + +.tab-main{ + margin-bottom: 67px; + overflow-y: auto; +} + +.pay-wrap{ + background: #fff; + padding-left: 15px; + border-top:1px solid #e1e1e1; + cursor: pointer; +} +.pay-header{ + height: 30px; + line-height: 30px; + border-bottom: 1px solid #e1e1e1; + display: flex; + justify-content: space-between; +} +.pay-header span:last-child { + color: #D40202; + margin-right: 15px; +} +.pay-body{ + padding: 10px 0; + position: relative; +} +.pay-money{ + position: absolute; + top:50%; + right: 15px; + transform: translateY(-50%); + color: #333; +} +.arrears-wrap{ + display: none; + +} + +.allMoneyWrap{ + padding-left: 15px; + height: 27px; + background: #FAF6EA; + color: #333; +} +.allMoneyWrap span{ + /*margin-left: 15px;*/ + color: #D40202; +} + +.arrears-list{ + position: fixed; + top: 60px; + left: 0; + bottom: 67px; /*距离底部的距离为底部盒子的高度,自己也可以设置*/ + overflow-y: scroll; + width: 100%; + height: auto; + -webkit-overflow-scrolling: touch; /*这句是为了滑动更顺畅*/ +} +.arrears-list>li{ + padding-left: 40px; + margin-bottom: 11px; + border-top:1px solid #e1e1e1; + background: #fff url("../img/arrearsCheck.png") no-repeat 9px center; + cursor: pointer; +} +.arrears-list>li.active{ + padding-left: 40px; + margin-bottom: 11px; + border-top:1px solid #e1e1e1; + background: #fff url("../img/arrearsChecked.png") no-repeat 9px center; + cursor: pointer; +} +.arrears-header{ + height: 30px; + line-height: 30px; + border-bottom:1px solid #e1e1e1; + display: flex; + justify-content: space-between; +} +.arrears-header span:last-child{ + color: #D40202; + margin-right: 15px; +} +.arrears-body{ + padding: 10px 0; + position: relative; +} +.arrears-money{ + position: absolute; + top:50%; + right: 15px; + transform: translateY(-50%); + color: #333; +} +.arrears-statistics{ + height: 67px; + position: fixed; + left: 0; + bottom: 0; + width: 100%; + background: #efeff4; +} +.statistics-title{ + height: 32px; + line-height: 32px; + padding-left: 15px; + background: #E6FAFA; + color: #333; +} + +.statistics-title span{ + color:#D20000 ; +} +.statistics-opr{ + height: 35px; + line-height: 35px; + display: flex; + justify-content: space-between; +} +.opr-btn{ + padding: 0 10px; + color: #fff; + background: #0260B8; + cursor: pointer; +} +.check-btn{ + padding-left: 40px; + background: url("../img/arrearsCheck.png") no-repeat 9px center; + cursor: pointer; +} +.check-btn.checkedActive{ + background: url("../img/arrearsChecked.png") no-repeat 9px center; +} + + diff --git a/img/arrearsCheck.png b/img/arrearsCheck.png new file mode 100644 index 0000000..9f3236e --- /dev/null +++ b/img/arrearsCheck.png diff --git a/img/arrearsChecked.png b/img/arrearsChecked.png new file mode 100644 index 0000000..d61ad4d --- /dev/null +++ b/img/arrearsChecked.png diff --git a/js/config.js b/js/config.js index 73428af..866909c 100644 --- a/js/config.js +++ b/js/config.js @@ -11,7 +11,7 @@ window.webAppH5 = {}; var webAppRoot = 'http://pay.service.renniting.cn/'; //赤峰 //test 测试环境 -// var webAppRoot = "http://39.98.54.240:8090"; +// var webAppRoot = "http://39.98.58.92:8090"; //微信支付结果回调地址 var webAppPayResult = "http://wxgzh.renniting.cn/wechatwuxi/DEV/Threewf/codepay/page/wxpayResult.html"; diff --git a/js/list.js b/js/list.js index b1b7c26..7586a44 100644 --- a/js/list.js +++ b/js/list.js @@ -31,6 +31,9 @@ var _carNumber = getQueryString(window.location).carNumber console.log(_carNumber) $('.carNum').text(_carNumber) + + + /** * @param {} second * @return {} @@ -74,152 +77,14 @@ jsajax.defaultReq( 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 = '' - // } + }else{ } - $('#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')) @@ -442,7 +307,8 @@ $('.outBtn').on('click', function () { }) $('.hiddenBtn').on('click', function () { - $('#strTip').hide() + // $('#strTip').hide() + window.location.href = 'paybacknew.html?carNumber='+_carNumber }) diff --git a/js/monPay.js b/js/monPay.js new file mode 100644 index 0000000..a0f3fd8 --- /dev/null +++ b/js/monPay.js @@ -0,0 +1,702 @@ +/* +@songcxa +@2018-12-14 +@移动支付 +*/ +var webAppParams = null; +var $btnObj = null; +var $btnLoad = null; +var flag = 0; +var appWxID = 'wxff4cebaedbf4f886'; +// var appWxID = 'wx945eccc8163fd75b' +var webAppCode = null;//如果是微信,先获取微信code +//var $btnLoad = document.getElementById("loading"); +window.onload = function () { + //var root = document.getElementById("root"); + $btnObj = document.getElementById("btnPayOK"); + $btnLoad = document.getElementById("loading"); + + $discountBtn = document.getElementById("discountBtn"); + var webRoot = window.location.href; + //设置当前客户端浏览器模式[微信、支付宝、其他] + webAppClass.clientBrowser(); + //绑定事件 + var ali = document.getElementById("rowAliPay"); + var wx = document.getElementById("rowWxPay"); + ali.onclick = webAppClass.aliClick; + wx.onclick = webAppClass.wxClick; + //$btnObj.onclick = webAppClass.okClick; + + $btnObj.onclick = webAppClass.okPay; + + document.getElementById("payTip").innerHTML = ""; + //参数 + webAppParams = getQueryString(window.location); + if (webAppParams != null) { + console.log(webAppParams.carNumber) + + + //设置UI参数 + webAppClass.setUI(webAppParams); + } else { + alertMsg("暂无订单信息"); + } + + //获取微信code + //webAppClass.getCode(); + var state = clientBrowserEx(); + if (state == "wxPay") { + webAppCode = webAppClass.getCode(); + } + // $discountBtn.onclick = webAppClass.discountClick; +} +/**/ +var webAppClass = { + //优惠券兑换 + codediscountClick: function (tmpObj) { + discountVal = document.getElementById("discountBox").value; + // console.log(discountVal) + // console.log(discountVal.length) + if (discountVal.length > 0) { + $btnObj.style.display = "none"; + $btnLoad.style.display = "block"; + $discountBtn.disabled = true + console.log(webAppParams.orderId) + var url = webAppRoot + window.webAppH5.discountServer; + var discountParams = { + app_id: '1', + salt: '1', + deviceInfo: '1', + sign_type: '1', + sign: '1', + token: '1', + terminalSource: 7, + orderId: webAppParams.orderId, + cardNo: discountVal, + codeType: 0 + } + postRequest(url, discountParams, function (res) { + console.log(res) + if (res.code == 0) { + + document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) + document.getElementById("discountTip").innerHTML = res.data.couponDescribe + document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) + document.getElementById("discountDesc").style.display = "none" + $btnLoad.style.display = "none"; + $btnObj.style.display = "block"; + flag = 1; + webAppClass.okPay(tmpObj);//唤醒支付 + } else { + $btnLoad.style.display = "none"; + $btnObj.style.display = "block"; + $discountBtn.disabled = false; + document.getElementById("discountTip").innerHTML = res.message + } + }) + + } else { + return + } + }, + discountClick: function () { + discountVal = document.getElementById("discountBox").value; + // console.log(discountVal) + // console.log(discountVal.length) + if (discountVal.length > 0) { + $btnObj.style.display = "none"; + $btnLoad.style.display = "block"; + $discountBtn.disabled = true + // console.log(webAppParams.orderId); + if (webAppParams === null || webAppParams === 'null' || webAppParams === undefined) { + document.getElementById("discountTip").innerHTML = '缺少参数'; + $btnLoad.style.display = "none"; + $btnObj.style.display = "block"; + return false; + } + var url = webAppRoot + window.webAppH5.discountServer; + var discountParams = { + app_id: '1', + salt: '1', + deviceInfo: '1', + sign_type: '1', + sign: '1', + token: '1', + terminalSource: 7, + orderId: webAppParams.orderId, + cardNo: discountVal, + codeType: 0 + } + postRequest(url, discountParams, function (res) { + console.log(res) + if (res.code == 0) { + + document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) + document.getElementById("discountTip").innerHTML = res.data.couponDescribe + document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) + document.getElementById("discountDesc").style.display = "none" + $btnLoad.style.display = "none"; + $btnObj.style.display = "block"; + document.getElementById("discountBox").setAttribute('readonly', 'readonly'); + flag = 1 + } else { + $btnLoad.style.display = "none"; + $btnObj.style.display = "block"; + $discountBtn.disabled = false; + document.getElementById("discountTip").innerHTML = res.message + } + }) + + } else { + $btnLoad.style.display = "none"; + $btnObj.style.display = "block"; + return false; + } + }, + //OK + okClick: function (ev) { + document.getElementById("payTip").innerHTML = ""; + if (webAppParams == null) { + alertMsg("暂无订单信息"); + return; + } + //先校验停车费用后缴费提交 + webAppClass.checkParkCost(); + }, + //校验该订单当前支付时的费用(排除扫描订单后不支付时长) + checkParkCost: function () { + $btnObj.style.display = "none"; + $btnLoad.style.display = "block"; + if (typeof (webAppParams.queryOrderInfo) == "undefined") {//没有queryOrderInfo返回第一页 + window.history.back(-1); + } + var tmpParams = JSON.parse(webAppParams.queryOrderInfo); + var url = webAppRoot + window.webAppH5.comServer; + postRequest(url, tmpParams, function (res) { + //btnObj.style.display = "block"; //$btnLoad.style.display = "none"; + //$btnObj.style.display = "block"; + if (res.code == 0) {//进场 + var tmpObj = res.data; + if (tmpObj) { + if (flag == 1) { + webAppClass.codediscountClick(tmpObj); + } else { + webAppClass.setUI(tmpObj); + webAppParams = tmpObj;//重新赋值 + webAppClass.okPay(tmpObj);//唤醒支付 + } + + console.log(tmpObj) + // webAppClass.okPay(tmpObj);//唤醒支付 + } else { + alertMsg("没有找到相应订单"); + } + } else {//其他情况如【该卡号场内已存在】 + $btnLoad.style.display = "none"; + $btnObj.style.display = "block"; + console.log(res.message); + alertMsg(res.message); + } + }, function (err) { + console.log("网络服务超时..." + url); + alertMsg("网络服务超时"); + $btnLoad.style.display = "none"; + $btnObj.style.display = "block"; + //$btnLoad.style.display = "none"; + }); + }, + + //确定支付 + okPay: function (params) { + var _paySrcType = getQueryVariable("paySrcType") + var orderID = webAppParams.orderId;//订单号 + // alert(_paySrcType) + if(_paySrcType==103){ + var code = orderID.slice(0,orderID.length) + var codes = code.split(',') + orderID = [] + console.log(code) + console.log(codes) + for(var i=0;i 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; + }, + checkIN: function (i) { + return i.parkState == 10 + }, + checkOUT: function (i) { + return i.parkState == 20 + }, + //查询单个待支付单费用 + getOneorder: function (carNumber, parkCode, orderId, parkCode) { + // var salt = jsajax.salt(32); + // var token = mUrl.GetToken(); + + 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: fun.getMd5sign(), + sign_type: "md5", + token: token, + + 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) + 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 discountFee; + var discountDesc; + if (datas.discountFee && datas.discountFee != '' && datas.discountFee != undefined) { + discountFee = datas.discountFee;//已优惠 + if (datas.discountDesc && datas.discountDesc != '' && datas.discountDesc != undefined) { + discountDesc = datas.discountDesc;//已优惠 + } + } + var _num = 1 + var _paySrcType = 101 + //console.log('-------------------------------'+discountType); + //查询到车牌号订单信息 + var src = 'monPay.html?carnum=' + carNumber + // + "&inparktime=" + inparktime + // + "&parkName=" + parkName + // + "&staytime=" + staytime + + "&due=" + due + + "&unpaid=" + unpaid + + "&num=" + _num + // + "&paid=" + paid + // + "&no=" + no + + "&disfee=" + discountFee + + "&disdesc=" + discountDesc + + "&orderId=" + orderId + + "&parkCode=" + parkCode + + "&paySrcType=" + _paySrcType + + // + '&discountType=' + discountType + // + '&parkCode=' + parkCode + // + "&"; + console.log(src) + window.location.assign(encodeURI(src)) + }, 100); + } + } + ) + }, + queryArrearageSta: function () { + // var salt = jsajax.salt(32); + // var token = mUrl.GetToken(); + + var salt = jsajax.salt(32); + var token = mUrl.GetToken(); + if (token == null) { + token = ''; + } + var list = "[" + fun.orderIds + "]" + var orderlist = fun.orderIds + var codes = "[" + fun.parkCodes + "]" + var jsondata = { + app_id: "0eca8f5373ca4866aec2f8e9d9367104", + deviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", + salt: salt, + sign: fun.getMd5sign(), + sign_type: "md5", + token: token, + appId: jsajax.appID, + orderIds: list, + terminalSource: '7', + payType: 4, + orgId: '10003', + + } + console.log('查询单个的入参 ' + JSON.stringify(jsondata) + " 请求的接口" + mUrl.oneCardorder); + jsajax.defaultReq( + mUrl.queryArrearageSta, + JSON.stringify(jsondata), + function (data) { + console.log('获取单个待支付订单 ' + JSON.stringify(data)); + var datas = data.data.carArrearages[0] + console.log(datas) + + setTimeout(function () { + var discountFee = datas.arrearageDiscFee;//已优惠 + var discountDesc = datas.discDesc;//已优惠 + var carNumber = datas.carNumber; + // var no = datas.orderId;//.no;//订单id + // var inparktime = datas.inparktime;//.inparktime;//进场时间 + // var plateno = datas.carNumber;//车牌号 + // var parkName = datas.parkName;//停车场名称 + // var staytime = datas.staytime;//停车时长 + var due = datas.arrearageTotalFee;//总计费用 + var unpaid = datas.arrearageActFee;//待支付 + var paid = datas.arrearageActFee;//实付 + var discountType = datas.discountType; + + 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 _num = datas.arrearageNum + var _paySrcType = 103 + + //查询到车牌号订单信息 + var src = 'monPay.html?carnum=' + carNumber + // + "&inparktime=" + inparktime + // + "&parkName=" + parkName + // + "&staytime=" + staytime + + "&due=" + due + + "&unpaid=" + unpaid + + "&paid=" + paid + + "&num=" + _num + // + "&no=" + no + + "&disfee=" + discountFee + + "&disdesc=" + discountDesc + + "&orderId=" + orderlist + // + '&discountType=' + discountType + + '&parkCode=' + codes + + "&paySrcType=" + _paySrcType + console.log(src) + window.location.assign(encodeURI(src)) + }, 100); + + } + ) + }, + getMd5sign: function () { + 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; + + }, + allMoney: 0, + inData: [], //在场 + outData: [], //离场 + listData: [], + selectLen: 0, + orderIds: [], // 选中订单号数组 + orderArr: [], + parkCodes: [], + parkCodeArr: [], + selectedMon: 0,//选中了总金额 + getQueryVariable: function (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 decodeURI(pair[1]); + } + } + return (false); + }, + + init: function () { + console.log(fun.listData) + fun.inData = fun.listData.filter(fun.checkIN) + fun.outData = fun.listData.filter(fun.checkOUT) + console.log(fun.inData) + console.log(fun.outData) + if (fun.inData.length > 0) { + $('#pay-wrap').html('') + // carNumber,parkCode,orderId + $('#pay-wrap').attr('carNumber', fun.inData[0].carNumber) + $('#pay-wrap').attr('parkCode', fun.inData[0].parkCode) + $('#pay-wrap').attr('orderId', fun.inData[0].orderId) + $('#pay-wrap').append('
\n' + + ' ' + fun.inData[0].carNumber + '\n' + + ' 本次费用\n' + + '
\n' + + '
\n' + + '

停车场名称:' + fun.inData[0].parkName + '

\n' + + '

进场时间:' + fun.inData[0].parkInTime + '

\n' + + '

出场时间:' + fun.inData[0].parkOutTime + '

\n' + + '

停车时长:' + fun.dateFormat(fun.inData[0].parkDuration) + '

\n' + + ' ' + ((fun.inData[0].unPayFee) / 100).toFixed(2) + '元\n' + + '
') + } else { + $('#pay-wrap').html('') + $('#pay-wrap').append('

无本次订单费用

') + } + + if (fun.outData.length > 0) { + $('#arrears-list').html('') + for (var i = 0; i < fun.outData.length; i++) { + var num = ((fun.outData[i].unPayFee) / 100).toFixed(2); + console.log(fun.outData[i].unPayFee) + fun.allMoney += Number(fun.outData[i].unPayFee) + fun.orderArr.push(fun.outData[i].orderId) + fun.parkCodeArr.push(fun.outData[i].parkcode) + // console.log(fun.allMoney) + $('#arrears-list').append('
  • \n' + + '
    \n' + + ' ' + fun.outData[i].carNumber + '\n' + + ' 欠费\n' + + '
    \n' + + '
    \n' + + '

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

    \n' + + '

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

    \n' + + '

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

    \n' + + '

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

    \n' + + ' ' + num + '元\n' + + '
    \n' + + '
  • ') + } + $('#allMoneyWrap').text(((fun.allMoney) / 100).toFixed(2)) + } else { + $('#arrears-wrap').html('') + $('#arrears-wrap').append('

    无历史欠费费用

    ') + } + }, + _initData: function () { + + var _carNumber = fun.getQueryVariable('carNumber') + console.log(_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 + } else { + fun.listData = data + fun.init()// 初始化 + } + + }) + + } +} +fun._initData() + +//......................... Tab 切换 +$('#tab-wrap li').on('click', function () { + var _index = $(this).index() + $(this).addClass('active').siblings().removeClass('active') + $('#tab-main>div').eq(_index).show().siblings().hide() +}) + +//......................... 全选 +$('#check-btn').on('click', function () { + if ($(this).hasClass('checkedActive')) { + $('#listLen').text('0') + $('#listMon').text('¥ 0.00') + $('#arrears-list li').removeClass('active') + fun.selectLen = 0 + fun.selectedMon = 0 + fun.orderIds = [] + fun.parkCodes = [] + } else { + $('#listLen').text(fun.outData.length) + $('#listMon').text('¥ ' + ((fun.allMoney) / 100).toFixed(2)) + $('#arrears-list li').addClass('active') + fun.selectLen = fun.outData.length + fun.selectedMon = fun.allMoney + fun.orderIds = fun.orderArr + fun.parkCodes = fun.parkCodeArr + } + $(this).toggleClass('checkedActive') +}) + +//......................... 单个选择操作 +$('#arrears-list').delegate('li','click', function () { + var mon = $(this).attr('data-unpayfee') + var orderid = $(this).attr('data-orderid') + var parkcode = $(this).attr('data-parkcode') + if ($(this).hasClass('active')) { + $('#check-btn').removeClass('checkedActive') //去掉全选 + // 总结现在已经选中了那些 + var _index = fun.orderIds.indexOf(orderid) + fun.orderIds = fun.orderIds.filter(function (i) { + return i !== orderid + }) + + var _index = fun.parkCodes.indexOf(parkcode) + fun.parkCodes = fun.parkCodes.filter(function (i) { + return i !== orderid + }) + fun.selectLen-- + fun.selectedMon = fun.selectedMon - mon + $('#listLen').text(fun.selectLen) + $('#listMon').text('¥ ' + ((fun.selectedMon) / 100).toFixed(2)) + } else { + fun.orderIds.push(orderid) + fun.parkCodes.push(parkcode) + fun.selectLen++ + if (fun.selectLen == fun.outData.length) { + $('#check-btn').addClass('checkedActive') //全选了 + } + fun.selectedMon = Number(fun.selectedMon) + Number(mon) + $('#listLen').text(fun.selectLen) + $('#listMon').text('¥ ' + ((fun.selectedMon) / 100).toFixed(2)) + //总结选择了那些 + + } + $(this).toggleClass('active') +}) + +//......................... 本次费用 +$('#pay-wrap').on('click', function () { + var carNumber = $(this).attr('carNumber') + var parkCode = $(this).attr('parkCode') + var orderId = $(this).attr('orderId') + fun.getOneorder(carNumber, parkCode, orderId, parkCode) +}) + +//......................... 历史欠费 + +$('#opr-btn').on('click', function () { + + if (fun.orderIds.length == 0) { + return + } else { + fun.queryArrearageSta() + } + +}) + + + diff --git a/js/url.js b/js/url.js index c94bb71..1bbdfd1 100644 --- a/js/url.js +++ b/js/url.js @@ -111,6 +111,9 @@ mUrl.tcwxpay = cepath+ '/weixinpay/publicUnifiedOrder';//修改 添加字段 mUrl.SelectCar = cepath +'/user/queryUserCars';//车辆信息查询(查看是否绑定车牌号)无用 mUrl.SelectOrder = cepath +'/query/queryOrderByCarNumbers';//查询订单 (查询待支付订单)//无用 + +mUrl.queryArrearageSta = cepath + '/queryParkOrder/queryArrearageStaForWXPublc';// + /*----------------------支付页面所需接口 end*/ /*----------------------停车场接口 start*/ diff --git a/js/wxpayResult.js b/js/wxpayResult.js new file mode 100644 index 0000000..718b9a2 --- /dev/null +++ b/js/wxpayResult.js @@ -0,0 +1,72 @@ + +window.onload = function () { + var tmpParams = getQueryString(window.location); + if (tmpParams != null) { + console.log(JSON.stringify(tmpParams)); + if (tmpParams.trade_no == "success") { + getResponse("success"); + } else { + getResponse("fail"); + } + //alertMsg("支付返回参数:" + JSON.stringify(tmpParams)); + } else { + console.log("支付返回参数" + tmpParams); + } +} + +//type[fail、sucesss] +function getResponse(type) { + var img = document.getElementById("stateImg"); + var label = document.getElementById("stateLable"); + if (type == "fail") { + img.src = "img/no.png"; + label.innerHTML = "支付失败,尝试重新扫码"; + setTimeout(function () { + alert('1') + + if (navigator.userAgent.indexOf("MSIE") > 0) { + if (navigator.userAgent.indexOf("MSIE 6.0") > 0) { + window.opener = null; + window.close(); + } + else { + window.open('', '_top'); + window.top.close(); + } + } + else if (navigator.userAgent.indexOf("Firefox") > 0) { + window.location.href = 'about:blank '; //火狐默认状态非window.open的页面window.close是无效的 + //window.history.go(-2); + } + else { + window.opener = null; + window.open('', '_self', ''); + window.close(); + } + }, 2000) + } else { + img.src = "img/ok.png"; + label.innerHTML = "订单支付成功"; + setTimeout(function () { + if (navigator.userAgent.indexOf("MSIE") > 0) { + if (navigator.userAgent.indexOf("MSIE 6.0") > 0) { + window.opener = null; + window.close(); + } + else { + window.open('', '_top'); + window.top.close(); + } + } + else if (navigator.userAgent.indexOf("Firefox") > 0) { + window.location.href = 'about:blank '; //火狐默认状态非window.open的页面window.close是无效的 + //window.history.go(-2); + } + else { + window.opener = null; + window.open('', '_self', ''); + window.close(); + } + }, 2000) + } +} diff --git a/list.html b/list.html index 0aeb187..9d53cff 100644 --- a/list.html +++ b/list.html @@ -20,6 +20,7 @@ + @@ -27,217 +28,7 @@ @@ -311,8 +102,8 @@ - - + + + + + + + + + + diff --git a/out.html b/out.html index c8a9685..4215a8a 100644 --- a/out.html +++ b/out.html @@ -15,7 +15,7 @@ - + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + + + + + + +
    + +
    +
    + 总欠费金额:¥0 +
    + +
      + + + + + + + + + + + + + + +
    + +
    +
    + 您已选中0笔待缴订单      + 合计: ¥ 0.00 +
    + +
    + 全选 + 清缴所选欠费 +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + diff --git a/wxpayResult.html b/wxpayResult.html index acbbaf1..ae08309 100644 --- a/wxpayResult.html +++ b/wxpayResult.html @@ -29,8 +29,9 @@ -