Commit a2551e055e1bdc4d1fb652511b9260c9387e4508
1 parent
f0cfce54
赤峰广告
Showing
10 changed files
with
1240 additions
and
662 deletions
home.html
| @@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
| 33 | <div><span>停车时长:</span><span id="staytime"></span></div> | 33 | <div><span>停车时长:</span><span id="staytime"></span></div> |
| 34 | <div><span>进场时间:</span><span id="inparktime"></span></div> | 34 | <div><span>进场时间:</span><span id="inparktime"></span></div> |
| 35 | <div><span>停车总费用:</span><span id="due"></span></div> | 35 | <div><span>停车总费用:</span><span id="due"></span></div> |
| 36 | - <div id="businessFeeWrap"><span>商户优惠减免:</span><span id="businessFee"></span></div> | 36 | + <!--<div id="businessFeeWrap"><span>商户优惠减免:</span><span id="businessFee"></span></div>--> |
| 37 | <div><span>已支付金额:</span><span id="paid"></span></div> | 37 | <div><span>已支付金额:</span><span id="paid"></span></div> |
| 38 | <div><span>优惠金额:</span><span id="discountFee"></span><span id="discountDesc"></span></div> | 38 | <div><span>优惠金额:</span><span id="discountFee"></span><span id="discountDesc"></span></div> |
| 39 | <div><span>订单编号: </span><span id="orderNum">1234567890</span> </div> | 39 | <div><span>订单编号: </span><span id="orderNum">1234567890</span> </div> |
img/carNum.png
0 → 100644
1.41 KB
img/carNumYellow.png
0 → 100644
1.23 KB
img/tipTitle.png
0 → 100644
383 Bytes
img/topay.png
0 → 100644
630 Bytes
js/config.js
| @@ -7,11 +7,13 @@ window.webAppH5 = {}; | @@ -7,11 +7,13 @@ window.webAppH5 = {}; | ||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | /*服务器地址*/ | 9 | /*服务器地址*/ |
| 10 | - var webAppRoot = "http://pay.service.huangshiparking.com"; | 10 | + // var webAppRoot = "http://pay.service.huangshiparking.com"; |
| 11 | + | ||
| 12 | +var webAppRoot = 'http://pay.service.renniting.cn/'; //赤峰 | ||
| 11 | //test 测试环境 | 13 | //test 测试环境 |
| 12 | // var webAppRoot = "http://39.98.54.240:8090"; | 14 | // var webAppRoot = "http://39.98.54.240:8090"; |
| 13 | //微信支付结果回调地址 | 15 | //微信支付结果回调地址 |
| 14 | -var webAppPayResult = "http://wxgzh.huangshiparking.com/HSwechat/PDA-Payment/wxpayResult.html"; | 16 | +var webAppPayResult = "http://wxgzh.renniting.cn/wechatwuxi/DEV/Threewf/codepay/page/wxpayResult.html"; |
| 15 | 17 | ||
| 16 | /*公共参数*/ | 18 | /*公共参数*/ |
| 17 | webAppH5.comParams = { | 19 | webAppH5.comParams = { |
js/list.js
0 → 100644
| 1 | +function getQueryString(location) { | ||
| 2 | + //var url = location.search; //获取url中"?"符后的字串 | ||
| 3 | + var url = location.search; | ||
| 4 | + var theRequest = new Object(); | ||
| 5 | + if (url.indexOf("?") != -1) { | ||
| 6 | + var str = url.substr(1); | ||
| 7 | + strs = str.split("&"); | ||
| 8 | + for (var i = 0; i < strs.length; i++) { | ||
| 9 | + theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]); | ||
| 10 | + } | ||
| 11 | + } else { | ||
| 12 | + theRequest = null; | ||
| 13 | + } | ||
| 14 | + return theRequest; | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +var func = { | ||
| 18 | + openid: '', | ||
| 19 | + token: '', | ||
| 20 | + unpaid: '', | ||
| 21 | + countType: '' | ||
| 22 | + | ||
| 23 | +}; | ||
| 24 | +var color = getQueryString(window.location).carType | ||
| 25 | +if(color == 1){ | ||
| 26 | + $('.carNum').addClass('carNumYellow') | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +var _carNumber = getQueryString(window.location).carNumber | ||
| 30 | +console.log(_carNumber) | ||
| 31 | +$('.carNum').text(_carNumber) | ||
| 32 | + | ||
| 33 | +/** | ||
| 34 | + * @param {} second | ||
| 35 | + * @return {} | ||
| 36 | + * @desc 秒转化成dd hh:mm:ss | ||
| 37 | + */ | ||
| 38 | +var salt = jsajax.salt(32); | ||
| 39 | +var sortd = [ | ||
| 40 | + { keyname: 'app_id', value: '0eca8f5373ca4866aec2f8e9d9367104' }, | ||
| 41 | + { keyname: 'deviceInfo', value: 'BC0703A4-AFB0-4B51-9089-9B7487C0CC6E' }, | ||
| 42 | + { keyname: 'salt', value: salt }, | ||
| 43 | + { keyname: 'sign_type', value: 'md5' }, | ||
| 44 | + { keyname: 'token', value: '8957e613280b46f7ae8aaea71ed17353' }, | ||
| 45 | + { keyname: 'pageNum', value: 1 }, | ||
| 46 | + { keyname: 'pageSize', value: 10 }, | ||
| 47 | + { keyname: 'parkState', value: 10 }, | ||
| 48 | + { keyname: 'terminalSource', value: 7 }, | ||
| 49 | + { keyname: 'carNumber', value: _carNumber } | ||
| 50 | +]; | ||
| 51 | +var md5sign = jsajax.getsign(sortd); | ||
| 52 | +var jsondata = { | ||
| 53 | + app_id: "0eca8f5373ca4866aec2f8e9d9367104", | ||
| 54 | + deviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", | ||
| 55 | + salt: salt, | ||
| 56 | + sign_type: "md5", | ||
| 57 | + token: '8957e613280b46f7ae8aaea71ed17353', | ||
| 58 | + pageNum: 1, | ||
| 59 | + pageSize: 10, | ||
| 60 | + parkState: 10, | ||
| 61 | + terminalSource: 7, | ||
| 62 | + carNumber: _carNumber, | ||
| 63 | + sign: md5sign | ||
| 64 | +} | ||
| 65 | +console.log('停车记录传参 ' + JSON.stringify(jsondata)); | ||
| 66 | +jsajax.defaultReq( | ||
| 67 | + mUrl.listServer, | ||
| 68 | + JSON.stringify(jsondata), | ||
| 69 | + function (data) { | ||
| 70 | + console.log(data.data.dataList) | ||
| 71 | + | ||
| 72 | + var data = data.data.dataList; | ||
| 73 | + if (data.length == 0) { | ||
| 74 | + $('#tip-title').text('您的停车费用为0元,无须缴费,谢谢!') | ||
| 75 | + return | ||
| 76 | + } | ||
| 77 | + var htmls = ''; | ||
| 78 | + for (var i = 0; i < data.length; i++) { | ||
| 79 | + var orderFreeDuration = Number((data[i].orderFreeDuration)) | ||
| 80 | + var parkDuration = Number((data[i].parkDuration)) | ||
| 81 | + var num = ((data[i].unPayFee) / 100).toFixed(2); | ||
| 82 | + var outflag = data[i].orderStateRemark; | ||
| 83 | + | ||
| 84 | + if (outflag == '出场缴费') { | ||
| 85 | + if (orderFreeDuration > parkDuration) { | ||
| 86 | + htmls += '<div class="weui-cells" data-flag="0">' + | ||
| 87 | + ' <div class="weui-cell">' + | ||
| 88 | + ' <div class="weui-cell__bd">' + | ||
| 89 | + ' <p class="carNumber">' + data[i].carNumber + '</p>' + | ||
| 90 | + ' <p class="parkCode" style="display: none">' + data[i].parkCode + '</p>' + | ||
| 91 | + // ' <p class="orderId" style="display: none">' + data[i].orderId + '</p>' + | ||
| 92 | + | ||
| 93 | + ' </div>' + | ||
| 94 | + ' <div class="weui-cell__ft paySrcType" style="color: #f00"></div>' + | ||
| 95 | + ' </div>' + | ||
| 96 | + ' <div class="weui-cell">' + | ||
| 97 | + ' <div class="weui-cell__bd">' + | ||
| 98 | + ' <p>停车场名称:' + data[i].parkName + '</p>' + | ||
| 99 | + ' <p>进场时间:' + data[i].parkInTime + '</p>' + | ||
| 100 | + ' <p>出场时间:' + data[i].parkOutTime + '</p>' + | ||
| 101 | + ' <p>停车时长:' + dateFormat(data[i].parkDuration) + '</p>' + | ||
| 102 | + ' </div>' + | ||
| 103 | + ' <div class="weui-cell__ft ">' + | ||
| 104 | + '<p><span class="paymoney">' + num + '</span>元</p>' + | ||
| 105 | + '<p class="out-btn arrears-btn">申请离场' + | ||
| 106 | + ' <span class="orderId" style="display: none">' + data[i].orderId + '</span>' + | ||
| 107 | + '</p>' + | ||
| 108 | + '</div>' + | ||
| 109 | + ' </div>' + | ||
| 110 | + ' </div>'; | ||
| 111 | + } else { | ||
| 112 | + htmls += '<div class="weui-cells" data-flag="1">' + | ||
| 113 | + ' <div class="weui-cell">' + | ||
| 114 | + ' <div class="weui-cell__bd">' + | ||
| 115 | + ' <p class="carNumber">' + data[i].carNumber + '</p>' + | ||
| 116 | + ' <p class="parkCode" style="display: none">' + data[i].parkCode + '</p>' + | ||
| 117 | + // ' <p class="orderId" style="display: none">' + data[i].orderId + '</p>' + | ||
| 118 | + | ||
| 119 | + ' </div>' + | ||
| 120 | + ' <div class="weui-cell__ft paySrcType" style="color: #f00"></div>' + | ||
| 121 | + ' </div>' + | ||
| 122 | + ' <div class="weui-cell">' + | ||
| 123 | + ' <div class="weui-cell__bd">' + | ||
| 124 | + ' <p>停车场名称:' + data[i].parkName + '</p>' + | ||
| 125 | + ' <p>进场时间:' + data[i].parkInTime + '</p>' + | ||
| 126 | + ' <p>出场时间:' + data[i].parkOutTime + '</p>' + | ||
| 127 | + ' <p>停车时长:' + dateFormat(data[i].parkDuration) + '</p>' + | ||
| 128 | + ' </div>' + | ||
| 129 | + ' <div class="weui-cell__ft "><p><span class="paymoney">' + num + '</span>元</p>' + | ||
| 130 | + '<p class="arrears-btn">出场缴费' + | ||
| 131 | + ' <span class="orderId" style="display: none">' + data[i].orderId + '</span>' + | ||
| 132 | + '</p>' + | ||
| 133 | + '</div>' + | ||
| 134 | + ' </div>' + | ||
| 135 | + ' </div>'; | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + } else { | ||
| 139 | + htmls += '<div class="weui-cells" data-flag="1">' + | ||
| 140 | + ' <div class="weui-cell">' + | ||
| 141 | + ' <div class="weui-cell__bd">' + | ||
| 142 | + ' <p class="carNumber">' + data[i].carNumber + '</p>' + | ||
| 143 | + ' <p class="parkCode" style="display: none">' + data[i].parkCode + '</p>' + | ||
| 144 | + // ' <p class="orderId" style="display: none">' + data[i].orderId + '</p>' + | ||
| 145 | + | ||
| 146 | + ' </div>' + | ||
| 147 | + ' <div class="weui-cell__ft paySrcType" style="color: #f00">' + outflag + '</div>' + | ||
| 148 | + ' </div>' + | ||
| 149 | + ' <div class="weui-cell">' + | ||
| 150 | + ' <div class="weui-cell__bd">' + | ||
| 151 | + ' <p>停车场名称:' + data[i].parkName + '</p>' + | ||
| 152 | + ' <p>进场时间:' + data[i].parkInTime + '</p>' + | ||
| 153 | + ' <p>出场时间:' + data[i].parkOutTime + '</p>' + | ||
| 154 | + ' <p>停车时长:' + dateFormat(data[i].parkDuration) + '</p>' + | ||
| 155 | + ' </div>' + | ||
| 156 | + ' <div class="weui-cell__ft "><p><span class="paymoney">' + num + '</span>元</p>' + | ||
| 157 | + '<p class="arrears-btn">清缴欠费' + | ||
| 158 | + ' <span class="orderId" style="display: none">' + data[i].orderId + '</span>' + | ||
| 159 | + '</p>' + | ||
| 160 | + '</div>' + | ||
| 161 | + ' </div>' + | ||
| 162 | + ' </div>'; | ||
| 163 | + } | ||
| 164 | + // if(outflag=='出场缴费'){ | ||
| 165 | + // outflag = '' | ||
| 166 | + // } | ||
| 167 | + | ||
| 168 | + } | ||
| 169 | + $('#pay_listcont').append(htmls); | ||
| 170 | + | ||
| 171 | + // alert(data.message) | ||
| 172 | + | ||
| 173 | + }) | ||
| 174 | + | ||
| 175 | +var dateFormat = function (msd) { | ||
| 176 | + var time = msd | ||
| 177 | + | ||
| 178 | + if (null != time && "" != time) { | ||
| 179 | + | ||
| 180 | + if (time > 60 && time < 60 * 60) { | ||
| 181 | + | ||
| 182 | + time = parseInt(time / 60.0) + "分钟" + parseInt((parseFloat(time / 60.0) - | ||
| 183 | + | ||
| 184 | + parseInt(time / 60.0)) * 60) + "秒"; | ||
| 185 | + | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + else if (time >= 60 * 60 && time < 60 * 60 * 24) { | ||
| 189 | + | ||
| 190 | + time = parseInt(time / 3600.0) + "小时" + parseInt((parseFloat(time / 3600.0) - | ||
| 191 | + | ||
| 192 | + parseInt(time / 3600.0)) * 60) + "分钟" + | ||
| 193 | + | ||
| 194 | + parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) - | ||
| 195 | + | ||
| 196 | + parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒"; | ||
| 197 | + | ||
| 198 | + } else if (time >= 60 * 60 * 24) { | ||
| 199 | + | ||
| 200 | + time = parseInt(time / 3600.0 / 24) + "天" + parseInt((parseFloat(time / 3600.0 / 24) - | ||
| 201 | + | ||
| 202 | + parseInt(time / 3600.0 / 24)) * 24) + "小时" + parseInt((parseFloat(time / 3600.0) - | ||
| 203 | + | ||
| 204 | + parseInt(time / 3600.0)) * 60) + "分钟" + | ||
| 205 | + | ||
| 206 | + parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) - | ||
| 207 | + | ||
| 208 | + parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒"; | ||
| 209 | + | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + else { | ||
| 213 | + | ||
| 214 | + time = parseInt(time) + "秒"; | ||
| 215 | + | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + return time; | ||
| 221 | +}; | ||
| 222 | + | ||
| 223 | +$(document).on('click', '.weui-cells', function () { | ||
| 224 | + console.log($(this).attr('data-flag')) | ||
| 225 | + var flag = $(this).attr('data-flag') | ||
| 226 | + if (flag == 0) { | ||
| 227 | + | ||
| 228 | + } else { | ||
| 229 | + var money = $(this).find('.paymoney').text() | ||
| 230 | + | ||
| 231 | + var carNumber = $(this).find('.carNumber').text() | ||
| 232 | + //var parkCode = $(this).find('.parkCode').text() | ||
| 233 | + var orderId = $(this).find('.orderId').text() | ||
| 234 | + var parkCode = $(this).find('.parkCode').text() | ||
| 235 | + // var carNumber = $(this).find('.carNumber').text() | ||
| 236 | + var paySrcType = $(this).find('.paySrcType').text() | ||
| 237 | + if (paySrcType == '欠费') { | ||
| 238 | + paySrcType = 103 | ||
| 239 | + } else { | ||
| 240 | + paySrcType = 101 | ||
| 241 | + } | ||
| 242 | + localStorage.setItem('paySrcType', paySrcType) | ||
| 243 | + localStorage.setItem('parkCode', parkCode) | ||
| 244 | + | ||
| 245 | + getOneorder(carNumber, parkCode, orderId, paySrcType) | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | +}) | ||
| 249 | + | ||
| 250 | +$(document).on('click', '.out-btn', function () { | ||
| 251 | + var _this = $(this).parent().parent().parent(); | ||
| 252 | + | ||
| 253 | + var money = _this.find('.paymoney').text() | ||
| 254 | + console.log(money) | ||
| 255 | + var _orderId = _this.find('.orderId').text() | ||
| 256 | + | ||
| 257 | + var carNumber = _this.find('.carNumber').text() | ||
| 258 | + //var parkCode = $(this).find('.parkCode').text() | ||
| 259 | + // var orderId = _this.find('.orderId').text() | ||
| 260 | + var parkCode = _this.find('.parkCode').text() | ||
| 261 | + // var carNumber = $(this).find('.carNumber').text() | ||
| 262 | + | ||
| 263 | + var paySrcType = _this.find('.paySrcType').text() | ||
| 264 | + var paySrcType = '101' | ||
| 265 | + | ||
| 266 | + // if(paySrcType == ''){ | ||
| 267 | + // paySrcType = 103 | ||
| 268 | + // }else{ | ||
| 269 | + // paySrcType = 101 | ||
| 270 | + // } | ||
| 271 | + // alert(paySrcType) | ||
| 272 | + console.log(paySrcType) | ||
| 273 | + localStorage.setItem('paySrcType', paySrcType) | ||
| 274 | + localStorage.setItem('parkCode', parkCode) | ||
| 275 | + | ||
| 276 | + var salt = jsajax.salt(32); | ||
| 277 | + var token = mUrl.GetToken(); | ||
| 278 | + if (token == null) { | ||
| 279 | + token = ''; | ||
| 280 | + } | ||
| 281 | + var jsondata = { | ||
| 282 | + app_id: "0eca8f5373ca4866aec2f8e9d9367104", | ||
| 283 | + deviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", | ||
| 284 | + salt: salt, | ||
| 285 | + sign: getMd5sign(), | ||
| 286 | + sign_type: "md5", | ||
| 287 | + //token : token, | ||
| 288 | + | ||
| 289 | + //appId:jsajax.appID, | ||
| 290 | + orderId: _orderId, | ||
| 291 | + payOrderType: '101', | ||
| 292 | + terminalSource: '3', | ||
| 293 | + //parkCode:parkCode, | ||
| 294 | + // carNumber:carNumber, | ||
| 295 | + | ||
| 296 | + } | ||
| 297 | + jsajax.defaultReq( | ||
| 298 | + cepath + '/appAccountPay/appApplyParkOut', | ||
| 299 | + JSON.stringify(jsondata), | ||
| 300 | + function (data) { | ||
| 301 | + console.log(data) | ||
| 302 | + | ||
| 303 | + if (data.code == '5005') { | ||
| 304 | + getOneorder(carNumber, parkCode, _orderId) | ||
| 305 | + | ||
| 306 | + } else { | ||
| 307 | + //$('.dialog-out').show() | ||
| 308 | + window.location.href = 'zeroout.html?carNumber=' + carNumber | ||
| 309 | + } | ||
| 310 | + // alert(data.message) | ||
| 311 | + | ||
| 312 | + }) | ||
| 313 | + | ||
| 314 | +}) | ||
| 315 | +$('.close-btn').on('click', function () { | ||
| 316 | + $('.dialog-out').hide() | ||
| 317 | +}) | ||
| 318 | + | ||
| 319 | +//查询单个待支付单费用 | ||
| 320 | +function getOneorder(carNumber, parkCode, orderId, _paySrcType) { | ||
| 321 | + //alert(_paySrcType) | ||
| 322 | + // var salt = jsajax.salt(32); | ||
| 323 | + // var token = mUrl.GetToken(); | ||
| 324 | + | ||
| 325 | + var salt = jsajax.salt(32); | ||
| 326 | + var token = mUrl.GetToken(); | ||
| 327 | + if (token == null) { | ||
| 328 | + token = ''; | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + var _payType = 0; | ||
| 332 | + | ||
| 333 | + if (/MicroMessenger/.test(window.navigator.userAgent)) { | ||
| 334 | + _payType = 4 | ||
| 335 | + } else { | ||
| 336 | + _payType = 1 | ||
| 337 | + } | ||
| 338 | + var jsondata = { | ||
| 339 | + app_id: "0eca8f5373ca4866aec2f8e9d9367104", | ||
| 340 | + deviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", | ||
| 341 | + salt: salt, | ||
| 342 | + sign: getMd5sign(), | ||
| 343 | + sign_type: "md5", | ||
| 344 | + token: token, | ||
| 345 | + payType: _payType, | ||
| 346 | + paySrcType: _paySrcType, | ||
| 347 | + appId: jsajax.appID, | ||
| 348 | + orderId: orderId, | ||
| 349 | + terminalSource: '7', | ||
| 350 | + parkCode: parkCode, | ||
| 351 | + carNumber: carNumber, | ||
| 352 | + | ||
| 353 | + } | ||
| 354 | + console.log('查询单个的入参 ' + JSON.stringify(jsondata) + " 请求的接口" + mUrl.oneCardorder); | ||
| 355 | + jsajax.defaultReq( | ||
| 356 | + mUrl.oneCardorder, | ||
| 357 | + JSON.stringify(jsondata), | ||
| 358 | + function (data) { | ||
| 359 | + console.log(data) | ||
| 360 | + console.log('获取单个待支付订单 ' + JSON.stringify(data)); | ||
| 361 | + if (data.code == '0') { | ||
| 362 | + //setdiv(); | ||
| 363 | + setTimeout(function () { | ||
| 364 | + var datas = data.data | ||
| 365 | + console.log(datas) | ||
| 366 | + var discountFee = datas.discountFee;//已优惠 | ||
| 367 | + var discountDesc = datas.discountDesc;//已优惠 | ||
| 368 | + var parkCode = datas.parkCode; | ||
| 369 | + var no = datas.orderId;//.no;//订单id | ||
| 370 | + var inparktime = datas.inparktime;//.inparktime;//进场时间 | ||
| 371 | + var plateno = datas.plateno;//车牌号 | ||
| 372 | + var parkName = datas.parkName;//停车场名称 | ||
| 373 | + var staytime = datas.staytime;//停车时长 | ||
| 374 | + var due = datas.due;//总计费用 | ||
| 375 | + var unpaid = datas.unpaid;//待支付 | ||
| 376 | + var paid = datas.paid;//实付 | ||
| 377 | + var discountType = datas.discountType; | ||
| 378 | + var businessUsedType = datas.businessUsedType //商户信息-是否使用商户券,1-使用,0-未使用 | ||
| 379 | + var businessFee = datas.businessFee //商户减扣金额 | ||
| 380 | + | ||
| 381 | + if (datas.discountFee && datas.discountFee != '' && datas.discountFee != undefined) { | ||
| 382 | + discountFee = datas.discountFee;//已优惠 | ||
| 383 | + if (datas.discountDesc && datas.discountDesc != '' && datas.discountDesc != undefined) { | ||
| 384 | + discountDesc = datas.discountDesc;//已优惠 | ||
| 385 | + } | ||
| 386 | + } | ||
| 387 | + | ||
| 388 | + //console.log('-------------------------------'+discountType); | ||
| 389 | + //查询到车牌号订单信息 | ||
| 390 | + var src = 'home.html?carnum=' + plateno | ||
| 391 | + + "&inparktime=" + inparktime | ||
| 392 | + + "&parkName=" + parkName | ||
| 393 | + + "&staytime=" + staytime | ||
| 394 | + + "&due=" + due | ||
| 395 | + + "&unpaid=" + unpaid | ||
| 396 | + + "&paid=" + paid | ||
| 397 | + + "&no=" + no | ||
| 398 | + + "&disfee=" + discountFee | ||
| 399 | + + "&disdesc=" + discountDesc | ||
| 400 | + + '&discountType=' + discountType | ||
| 401 | + + '&parkCode=' + parkCode | ||
| 402 | + + '&orderId=' + datas.orderId | ||
| 403 | + + '&discountFee=' + datas.discountFee | ||
| 404 | + + '&parkOutTime=' + datas.outtime | ||
| 405 | + + '&orderFee=' + datas.orderFee | ||
| 406 | + + '&appOrderTimeout=' + datas.appOrderTimeout | ||
| 407 | + + '&appId=' + datas.appId | ||
| 408 | + + '&orderId=' + datas.orderId | ||
| 409 | + + '&_paySrcType=' + _paySrcType | ||
| 410 | + + "&businessUsedType=" + businessUsedType | ||
| 411 | + + "&businessFee=" + businessFee | ||
| 412 | + console.log(src) | ||
| 413 | + window.location.assign(encodeURI(src)) | ||
| 414 | + }, 100); | ||
| 415 | + } | ||
| 416 | + } | ||
| 417 | + ) | ||
| 418 | +} | ||
| 419 | + | ||
| 420 | +function getMd5sign() { | ||
| 421 | + var salt = jsajax.salt(32); | ||
| 422 | + var token = mUrl.GetToken(); | ||
| 423 | + if (token == null) { | ||
| 424 | + token = ''; | ||
| 425 | + } | ||
| 426 | + var sortd = [ | ||
| 427 | + { keyname: 'app_id', value: '0eca8f5373ca4866aec2f8e9d9367104' }, | ||
| 428 | + { keyname: 'deviceInfo', value: 'BC0703A4-AFB0-4B51-9089-9B7487C0CC6E' }, | ||
| 429 | + { keyname: 'salt', value: salt }, | ||
| 430 | + { keyname: 'sign_type', value: 'md5' }, | ||
| 431 | + { keyname: 'token', value: token } | ||
| 432 | + ]; | ||
| 433 | + var md5sign = jsajax.getsign(sortd); | ||
| 434 | + return md5sign; | ||
| 435 | + | ||
| 436 | +} | ||
| 437 | + | ||
| 438 | +$('.outBtn').on('click', function () { | ||
| 439 | + //window.location.href = 'http://wxgzh.renniting.cn/wechatwuxi/Chifeng/Threewf/stoppayment/select.html' | ||
| 440 | + window.location.href = 'out.html' | ||
| 441 | + | ||
| 442 | +}) | ||
| 443 | +$('.hiddenBtn').on('click', function () { | ||
| 444 | + $('#strTip').hide() | ||
| 445 | +}) | ||
| 446 | + | ||
| 447 | + |
js/pay.js
| @@ -12,665 +12,664 @@ var appWxID = getQueryString(window.location).appId; | @@ -12,665 +12,664 @@ var appWxID = getQueryString(window.location).appId; | ||
| 12 | var webAppCode = null;//如果是微信,先获取微信code | 12 | var webAppCode = null;//如果是微信,先获取微信code |
| 13 | //var $btnLoad = document.getElementById("loading"); | 13 | //var $btnLoad = document.getElementById("loading"); |
| 14 | window.onload = function () { | 14 | window.onload = function () { |
| 15 | - //var root = document.getElementById("root"); | ||
| 16 | - $btnObj = document.getElementById("btnPayOK"); | ||
| 17 | - $btnLoad = document.getElementById("loading"); | ||
| 18 | - | ||
| 19 | - $discountBtn = document.getElementById("discountBtn"); | ||
| 20 | - var webRoot = window.location.href; | ||
| 21 | - //设置当前客户端浏览器模式[微信、支付宝、其他] | ||
| 22 | - webAppClass.clientBrowser(); | ||
| 23 | - //绑定事件 | ||
| 24 | - var ali = document.getElementById("rowAliPay"); | ||
| 25 | - var wx = document.getElementById("rowWxPay"); | ||
| 26 | - ali.onclick = webAppClass.aliClick; | ||
| 27 | - wx.onclick = webAppClass.wxClick; | ||
| 28 | - //$btnObj.onclick = webAppClass.okClick; | ||
| 29 | - | ||
| 30 | - $btnObj.onclick = webAppClass.okPay; | ||
| 31 | - | ||
| 32 | - document.getElementById("payTip").innerHTML = ""; | ||
| 33 | - //参数 | ||
| 34 | - webAppParams = getQueryString(window.location); | ||
| 35 | - if (webAppParams != null) { | ||
| 36 | - console.log(webAppParams.carNumber) | ||
| 37 | - | ||
| 38 | - //设置UI参数 | ||
| 39 | - webAppClass.setUI(webAppParams); | ||
| 40 | - } else { | ||
| 41 | - alertMsg("暂无订单信息"); | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - //获取微信code | ||
| 45 | - //webAppClass.getCode(); | ||
| 46 | - var state = clientBrowserEx(); | ||
| 47 | - if (state == "wxPay") { | ||
| 48 | - webAppCode = webAppClass.getCode(); | ||
| 49 | - } | ||
| 50 | - // $discountBtn.onclick = webAppClass.discountClick; | 15 | + //var root = document.getElementById("root"); |
| 16 | + $btnObj = document.getElementById("btnPayOK"); | ||
| 17 | + $btnLoad = document.getElementById("loading"); | ||
| 18 | + | ||
| 19 | + $discountBtn = document.getElementById("discountBtn"); | ||
| 20 | + var webRoot = window.location.href; | ||
| 21 | + //设置当前客户端浏览器模式[微信、支付宝、其他] | ||
| 22 | + webAppClass.clientBrowser(); | ||
| 23 | + //绑定事件 | ||
| 24 | + var ali = document.getElementById("rowAliPay"); | ||
| 25 | + var wx = document.getElementById("rowWxPay"); | ||
| 26 | + ali.onclick = webAppClass.aliClick; | ||
| 27 | + wx.onclick = webAppClass.wxClick; | ||
| 28 | + //$btnObj.onclick = webAppClass.okClick; | ||
| 29 | + | ||
| 30 | + $btnObj.onclick = webAppClass.okPay; | ||
| 31 | + | ||
| 32 | + document.getElementById("payTip").innerHTML = ""; | ||
| 33 | + //参数 | ||
| 34 | + webAppParams = getQueryString(window.location); | ||
| 35 | + if (webAppParams != null) { | ||
| 36 | + console.log(webAppParams.carNumber) | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + //设置UI参数 | ||
| 40 | + webAppClass.setUI(webAppParams); | ||
| 41 | + } else { | ||
| 42 | + alertMsg("暂无订单信息"); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + //获取微信code | ||
| 46 | + //webAppClass.getCode(); | ||
| 47 | + var state = clientBrowserEx(); | ||
| 48 | + if (state == "wxPay") { | ||
| 49 | + webAppCode = webAppClass.getCode(); | ||
| 50 | + } | ||
| 51 | + // $discountBtn.onclick = webAppClass.discountClick; | ||
| 51 | } | 52 | } |
| 52 | /**/ | 53 | /**/ |
| 53 | var webAppClass = { | 54 | var webAppClass = { |
| 54 | - //优惠券兑换 | ||
| 55 | - codediscountClick: function (tmpObj) { | ||
| 56 | - discountVal = document.getElementById("discountBox").value; | ||
| 57 | - // console.log(discountVal) | ||
| 58 | - // console.log(discountVal.length) | ||
| 59 | - if (discountVal.length > 0) { | ||
| 60 | - $btnObj.style.display = "none"; | ||
| 61 | - $btnLoad.style.display = "block"; | ||
| 62 | - $discountBtn.disabled = true | ||
| 63 | - console.log(webAppParams.orderId) | ||
| 64 | - var url = webAppRoot + window.webAppH5.discountServer; | ||
| 65 | - var discountParams = { | ||
| 66 | - app_id: '1', | ||
| 67 | - salt: '1', | ||
| 68 | - deviceInfo: '1', | ||
| 69 | - sign_type: '1', | ||
| 70 | - sign: '1', | ||
| 71 | - token: '1', | ||
| 72 | - terminalSource: 7, | ||
| 73 | - orderId: webAppParams.orderId, | ||
| 74 | - cardNo: discountVal, | ||
| 75 | - codeType: 0 | ||
| 76 | - } | ||
| 77 | - postRequest(url, discountParams, function (res) { | ||
| 78 | - console.log(res) | ||
| 79 | - if (res.code == 0) { | ||
| 80 | - | ||
| 81 | - document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) | ||
| 82 | - document.getElementById("discountTip").innerHTML = res.data.couponDescribe | ||
| 83 | - document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) | ||
| 84 | - document.getElementById("discountDesc").style.display = "none" | ||
| 85 | - $btnLoad.style.display = "none"; | ||
| 86 | - $btnObj.style.display = "block"; | ||
| 87 | - flag = 1; | ||
| 88 | - webAppClass.okPay(tmpObj);//唤醒支付 | 55 | + //优惠券兑换 |
| 56 | + codediscountClick: function (tmpObj) { | ||
| 57 | + discountVal = document.getElementById("discountBox").value; | ||
| 58 | + // console.log(discountVal) | ||
| 59 | + // console.log(discountVal.length) | ||
| 60 | + if (discountVal.length > 0) { | ||
| 61 | + $btnObj.style.display = "none"; | ||
| 62 | + $btnLoad.style.display = "block"; | ||
| 63 | + $discountBtn.disabled = true | ||
| 64 | + console.log(webAppParams.orderId) | ||
| 65 | + var url = webAppRoot + window.webAppH5.discountServer; | ||
| 66 | + var discountParams = { | ||
| 67 | + app_id: '1', | ||
| 68 | + salt: '1', | ||
| 69 | + deviceInfo: '1', | ||
| 70 | + sign_type: '1', | ||
| 71 | + sign: '1', | ||
| 72 | + token: '1', | ||
| 73 | + terminalSource: 7, | ||
| 74 | + orderId: webAppParams.orderId, | ||
| 75 | + cardNo: discountVal, | ||
| 76 | + codeType: 0 | ||
| 77 | + } | ||
| 78 | + postRequest(url, discountParams, function (res) { | ||
| 79 | + console.log(res) | ||
| 80 | + if (res.code == 0) { | ||
| 81 | + | ||
| 82 | + document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) | ||
| 83 | + document.getElementById("discountTip").innerHTML = res.data.couponDescribe | ||
| 84 | + document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) | ||
| 85 | + document.getElementById("discountDesc").style.display = "none" | ||
| 86 | + $btnLoad.style.display = "none"; | ||
| 87 | + $btnObj.style.display = "block"; | ||
| 88 | + flag = 1; | ||
| 89 | + webAppClass.okPay(tmpObj);//唤醒支付 | ||
| 90 | + } else { | ||
| 91 | + $btnLoad.style.display = "none"; | ||
| 92 | + $btnObj.style.display = "block"; | ||
| 93 | + $discountBtn.disabled = false; | ||
| 94 | + document.getElementById("discountTip").innerHTML = res.message | ||
| 95 | + } | ||
| 96 | + }) | ||
| 97 | + | ||
| 89 | } else { | 98 | } else { |
| 90 | - $btnLoad.style.display = "none"; | ||
| 91 | - $btnObj.style.display = "block"; | ||
| 92 | - $discountBtn.disabled = false; | ||
| 93 | - document.getElementById("discountTip").innerHTML = res.message | 99 | + return |
| 94 | } | 100 | } |
| 95 | - }) | 101 | + }, |
| 102 | + discountClick: function () { | ||
| 103 | + discountVal = document.getElementById("discountBox").value; | ||
| 104 | + // console.log(discountVal) | ||
| 105 | + // console.log(discountVal.length) | ||
| 106 | + if (discountVal.length > 0) { | ||
| 107 | + $btnObj.style.display = "none"; | ||
| 108 | + $btnLoad.style.display = "block"; | ||
| 109 | + $discountBtn.disabled = true | ||
| 110 | + // console.log(webAppParams.orderId); | ||
| 111 | + if (webAppParams === null || webAppParams === 'null' || webAppParams === undefined) { | ||
| 112 | + document.getElementById("discountTip").innerHTML = '缺少参数'; | ||
| 113 | + $btnLoad.style.display = "none"; | ||
| 114 | + $btnObj.style.display = "block"; | ||
| 115 | + return false; | ||
| 116 | + } | ||
| 117 | + var url = webAppRoot + window.webAppH5.discountServer; | ||
| 118 | + var discountParams = { | ||
| 119 | + app_id: '1', | ||
| 120 | + salt: '1', | ||
| 121 | + deviceInfo: '1', | ||
| 122 | + sign_type: '1', | ||
| 123 | + sign: '1', | ||
| 124 | + token: '1', | ||
| 125 | + terminalSource: 7, | ||
| 126 | + orderId: webAppParams.orderId, | ||
| 127 | + cardNo: discountVal, | ||
| 128 | + codeType: 0 | ||
| 129 | + } | ||
| 130 | + postRequest(url, discountParams, function (res) { | ||
| 131 | + console.log(res) | ||
| 132 | + if (res.code == 0) { | ||
| 133 | + | ||
| 134 | + document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) | ||
| 135 | + document.getElementById("discountTip").innerHTML = res.data.couponDescribe | ||
| 136 | + document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) | ||
| 137 | + document.getElementById("discountDesc").style.display = "none" | ||
| 138 | + $btnLoad.style.display = "none"; | ||
| 139 | + $btnObj.style.display = "block"; | ||
| 140 | + document.getElementById("discountBox").setAttribute('readonly', 'readonly'); | ||
| 141 | + flag = 1 | ||
| 142 | + } else { | ||
| 143 | + $btnLoad.style.display = "none"; | ||
| 144 | + $btnObj.style.display = "block"; | ||
| 145 | + $discountBtn.disabled = false; | ||
| 146 | + document.getElementById("discountTip").innerHTML = res.message | ||
| 147 | + } | ||
| 148 | + }) | ||
| 96 | 149 | ||
| 97 | - } else { | ||
| 98 | - return | ||
| 99 | - } | ||
| 100 | - }, | ||
| 101 | - discountClick: function () { | ||
| 102 | - discountVal = document.getElementById("discountBox").value; | ||
| 103 | - // console.log(discountVal) | ||
| 104 | - // console.log(discountVal.length) | ||
| 105 | - if (discountVal.length > 0) { | ||
| 106 | - $btnObj.style.display = "none"; | ||
| 107 | - $btnLoad.style.display = "block"; | ||
| 108 | - $discountBtn.disabled = true | ||
| 109 | - // console.log(webAppParams.orderId); | ||
| 110 | - if (webAppParams === null || webAppParams === 'null' || webAppParams === undefined) { | ||
| 111 | - document.getElementById("discountTip").innerHTML = '缺少参数'; | ||
| 112 | - $btnLoad.style.display = "none"; | ||
| 113 | - $btnObj.style.display = "block"; | ||
| 114 | - return false; | ||
| 115 | - } | ||
| 116 | - var url = webAppRoot + window.webAppH5.discountServer; | ||
| 117 | - var discountParams = { | ||
| 118 | - app_id: '1', | ||
| 119 | - salt: '1', | ||
| 120 | - deviceInfo: '1', | ||
| 121 | - sign_type: '1', | ||
| 122 | - sign: '1', | ||
| 123 | - token: '1', | ||
| 124 | - terminalSource: 7, | ||
| 125 | - orderId: webAppParams.orderId, | ||
| 126 | - cardNo: discountVal, | ||
| 127 | - codeType: 0 | ||
| 128 | - } | ||
| 129 | - postRequest(url, discountParams, function (res) { | ||
| 130 | - console.log(res) | ||
| 131 | - if (res.code == 0) { | ||
| 132 | - | ||
| 133 | - document.getElementById("sumMoney").innerHTML = (res.data.orderFee / 100) | ||
| 134 | - document.getElementById("discountTip").innerHTML = res.data.couponDescribe | ||
| 135 | - document.getElementById("discountFee").innerHTML = (res.data.discountFee / 100) | ||
| 136 | - document.getElementById("discountDesc").style.display = "none" | ||
| 137 | - $btnLoad.style.display = "none"; | ||
| 138 | - $btnObj.style.display = "block"; | ||
| 139 | - document.getElementById("discountBox").setAttribute('readonly', 'readonly'); | ||
| 140 | - flag = 1 | ||
| 141 | } else { | 150 | } else { |
| 142 | - $btnLoad.style.display = "none"; | ||
| 143 | - $btnObj.style.display = "block"; | ||
| 144 | - $discountBtn.disabled = false; | ||
| 145 | - document.getElementById("discountTip").innerHTML = res.message | 151 | + $btnLoad.style.display = "none"; |
| 152 | + $btnObj.style.display = "block"; | ||
| 153 | + return false; | ||
| 154 | + } | ||
| 155 | + }, | ||
| 156 | + //OK | ||
| 157 | + okClick: function (ev) { | ||
| 158 | + document.getElementById("payTip").innerHTML = ""; | ||
| 159 | + if (webAppParams == null) { | ||
| 160 | + alertMsg("暂无订单信息"); | ||
| 161 | + return; | ||
| 162 | + } | ||
| 163 | + //先校验停车费用后缴费提交 | ||
| 164 | + webAppClass.checkParkCost(); | ||
| 165 | + }, | ||
| 166 | + //校验该订单当前支付时的费用(排除扫描订单后不支付时长) | ||
| 167 | + checkParkCost: function () { | ||
| 168 | + $btnObj.style.display = "none"; | ||
| 169 | + $btnLoad.style.display = "block"; | ||
| 170 | + if (typeof (webAppParams.queryOrderInfo) == "undefined") {//没有queryOrderInfo返回第一页 | ||
| 171 | + window.history.back(-1); | ||
| 172 | + } | ||
| 173 | + var tmpParams = JSON.parse(webAppParams.queryOrderInfo); | ||
| 174 | + var url = webAppRoot + window.webAppH5.comServer; | ||
| 175 | + postRequest(url, tmpParams, function (res) { | ||
| 176 | + //btnObj.style.display = "block"; //$btnLoad.style.display = "none"; | ||
| 177 | + //$btnObj.style.display = "block"; | ||
| 178 | + if (res.code == 0) {//进场 | ||
| 179 | + var tmpObj = res.data; | ||
| 180 | + if (tmpObj) { | ||
| 181 | + if (flag == 1) { | ||
| 182 | + webAppClass.codediscountClick(tmpObj); | ||
| 183 | + } else { | ||
| 184 | + webAppClass.setUI(tmpObj); | ||
| 185 | + webAppParams = tmpObj;//重新赋值 | ||
| 186 | + webAppClass.okPay(tmpObj);//唤醒支付 | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + console.log(tmpObj) | ||
| 190 | + // webAppClass.okPay(tmpObj);//唤醒支付 | ||
| 191 | + } else { | ||
| 192 | + alertMsg("没有找到相应订单"); | ||
| 193 | + } | ||
| 194 | + } else {//其他情况如【该卡号场内已存在】 | ||
| 195 | + $btnLoad.style.display = "none"; | ||
| 196 | + $btnObj.style.display = "block"; | ||
| 197 | + console.log(res.message); | ||
| 198 | + alertMsg(res.message); | ||
| 199 | + } | ||
| 200 | + }, function (err) { | ||
| 201 | + console.log("网络服务超时..." + url); | ||
| 202 | + alertMsg("网络服务超时"); | ||
| 203 | + $btnLoad.style.display = "none"; | ||
| 204 | + $btnObj.style.display = "block"; | ||
| 205 | + //$btnLoad.style.display = "none"; | ||
| 206 | + }); | ||
| 207 | + }, | ||
| 208 | + | ||
| 209 | + //确定支付 | ||
| 210 | + okPay: function (params) { | ||
| 211 | + var orderID = webAppParams.orderId;//订单号 | ||
| 212 | + // alert(orderID) | ||
| 213 | + //var moneyID = document.getElementById("sumMoney").innerHTML = webAppParams.orderId;//订单号 | ||
| 214 | + var val = document.getElementById("sumMoney").innerText; | ||
| 215 | + //var couponPersonId = document.getElementById("discountBox").value; | ||
| 216 | + var url = webAppRoot + window.webAppH5.zeroPayServer; | ||
| 217 | + var _paySrcType = getQueryString(window.location)._paySrcType | ||
| 218 | + var _mon = document.getElementById("sumMoney").innerText | ||
| 219 | + | ||
| 220 | + var discountParams = { | ||
| 221 | + payOrderType: _paySrcType, | ||
| 222 | + recordArreaInfos: JSON.stringify([{ | ||
| 223 | + "orderId": webAppParams.orderId, | ||
| 224 | + "orderNotPayFee": _mon * 100, | ||
| 225 | + "parkId": getQueryString(window.location).parkCode | ||
| 226 | + }]), | ||
| 227 | + terminalSource: 7, | ||
| 228 | + orderId: webAppParams.orderId, | ||
| 229 | + //couponPersonId:couponPersonId, | ||
| 230 | + app_id: '123', | ||
| 231 | + sign_type: '123', | ||
| 232 | + salt: '123', | ||
| 233 | + deviceInfo: '123', | ||
| 234 | + sign: '123', | ||
| 235 | + } | ||
| 236 | + if (val == '0.00' || val == '0') { | ||
| 237 | + postRequest(url, discountParams, function (res) { | ||
| 238 | + console.log(res) | ||
| 239 | + if (res.code == 0) { | ||
| 240 | + document.getElementById("paySuccess").style.display = 'block' | ||
| 241 | + // | ||
| 242 | + // document.getElementById("sumMoney").innerHTML = (res.data.orderFee/100) | ||
| 243 | + // document.getElementById("discountTip").innerHTML = res.data.couponDescribe | ||
| 244 | + // document.getElementById("discountFee").innerHTML = (res.data.discountFee/100) | ||
| 245 | + // document.getElementById("discountDesc").style.display="none" | ||
| 246 | + // $btnLoad.style.display = "none"; | ||
| 247 | + // $btnObj.style.display = "block"; | ||
| 248 | + // document.getElementById("discountBox").setAttribute('readonly','readonly'); | ||
| 249 | + // flag = 1 | ||
| 250 | + } else { | ||
| 251 | + alert(res.message) | ||
| 252 | + // $discountBtn.disabled = false | ||
| 253 | + // document.getElementById("discountTip").innerHTML = res.message | ||
| 254 | + } | ||
| 255 | + }) | ||
| 256 | + } else { | ||
| 257 | + var root = webAppRoot; | ||
| 258 | + //第一首先判断当前哪种浏览器方式[微信内置、支付宝内置、第三方浏览器] | ||
| 259 | + var clientType = clientBrowserEx(); | ||
| 260 | + //alert(clientType); | ||
| 261 | + switch (clientType) { | ||
| 262 | + case "wxPay"://微信[内置浏览器] | ||
| 263 | + //var wxPay = webAppH5.wxPayServer; | ||
| 264 | + //var wxParams = webAppH5.comParams; | ||
| 265 | + //wxParams.orderId = orderID; | ||
| 266 | + //wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 267 | + //wxParams.terminalSource = 3;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 268 | + //debugger; | ||
| 269 | + | ||
| 270 | + | ||
| 271 | + // //新增start | ||
| 272 | + // | ||
| 273 | + // var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; | ||
| 274 | + // //window.location.href = url; | ||
| 275 | + // var wxPay = webAppH5.wxPayServer; | ||
| 276 | + // var wxParams = webAppH5.comParams; | ||
| 277 | + // wxParams.carNumber = getQueryString(window.location).carnum; | ||
| 278 | + // wxParams.orderId = orderID; | ||
| 279 | + // wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 280 | + // wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 281 | + // | ||
| 282 | + // wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 283 | + // | ||
| 284 | + // wxParams.recordArreaInfos= JSON.stringify([{"orderId":webAppParams.orderId,"orderNotPayFee":_mon*100,"parkId":getQueryString(window.location).parkCode}]); | ||
| 285 | + // | ||
| 286 | + // //新增end | ||
| 287 | + | ||
| 288 | + // if (webAppCode == null || webAppCode == "") {//code检测 | ||
| 289 | + // alertMsg(appState.codeNullTip); | ||
| 290 | + // $btnObj.style.display = "block"; | ||
| 291 | + // $btnLoad.style.display = "none"; | ||
| 292 | + // return; | ||
| 293 | + // } | ||
| 294 | + webAppClass.payAjaxJDK(orderID); | ||
| 295 | + console.log("wxPay");//微信支付 | ||
| 296 | + break; | ||
| 297 | + case "aliPay"://支付宝 | ||
| 298 | + console.log("aliPay"); | ||
| 299 | + //订单号 | ||
| 300 | + var obj = {}; | ||
| 301 | + //this.payAjax(url, { orderId: "11111", price: 0.01 }); | ||
| 302 | + var aliPay = webAppH5.aliPayServer; | ||
| 303 | + var aliParams = webAppH5.comParams; | ||
| 304 | + aliParams.orderId = orderID; | ||
| 305 | + aliParams.carNumber = getQueryString(window.location).carnum; | ||
| 306 | + aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 307 | + aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 308 | + aliParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 309 | + | ||
| 310 | + aliParams.recordArreaInfos = JSON.stringify([{ | ||
| 311 | + "orderId": webAppParams.orderId, | ||
| 312 | + "orderNotPayFee": _mon * 100, | ||
| 313 | + "parkId": getQueryString(window.location).parkCode | ||
| 314 | + }]); | ||
| 315 | + webAppClass.payAliAjax(root + aliPay, aliParams); | ||
| 316 | + break; | ||
| 317 | + default://第三方浏览器other | ||
| 318 | + //默认支付宝 | ||
| 319 | + if (document.getElementById("aliPay").checked) { | ||
| 320 | + console.log("aliPay"); | ||
| 321 | + //订单号 | ||
| 322 | + var obj = {}; | ||
| 323 | + //this.payAjax(url, { orderId: "11111", price: 0.01 }); | ||
| 324 | + var aliPay = webAppH5.aliPayServer; | ||
| 325 | + var aliParams = webAppH5.comParams; | ||
| 326 | + aliParams.orderId = orderID; | ||
| 327 | + aliParams.carNumber = getQueryString(window.location).carnum; | ||
| 328 | + aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 329 | + aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 330 | + aliParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 331 | + | ||
| 332 | + aliParams.recordArreaInfos = JSON.stringify([{ | ||
| 333 | + "orderId": webAppParams.orderId, | ||
| 334 | + "orderNotPayFee": _mon * 100, | ||
| 335 | + "parkId": getQueryString(window.location).parkCode | ||
| 336 | + }]); | ||
| 337 | + | ||
| 338 | + webAppClass.payAliAjax(root + aliPay, aliParams); | ||
| 339 | + } else {//微信页面支付 | ||
| 340 | + var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; | ||
| 341 | + //window.location.href = url; | ||
| 342 | + var wxPay = webAppH5.wxPayServer; | ||
| 343 | + var wxParams = webAppH5.comParams; | ||
| 344 | + wxParams.carNumber = getQueryString(window.location).carnum; | ||
| 345 | + wxParams.orderId = orderID; | ||
| 346 | + wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 347 | + wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 348 | + | ||
| 349 | + wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 350 | + | ||
| 351 | + wxParams.recordArreaInfos = JSON.stringify([{ | ||
| 352 | + "orderId": webAppParams.orderId, | ||
| 353 | + "orderNotPayFee": _mon * 100, | ||
| 354 | + "parkId": getQueryString(window.location).parkCode | ||
| 355 | + }]); | ||
| 356 | + webAppClass.payAjax(root + wxPay, wxParams); | ||
| 357 | + console.log("wxPay"); | ||
| 358 | + } | ||
| 359 | + break; | ||
| 360 | + } | ||
| 146 | } | 361 | } |
| 147 | - }) | ||
| 148 | 362 | ||
| 149 | - } else { | ||
| 150 | - $btnLoad.style.display = "none"; | ||
| 151 | - $btnObj.style.display = "block"; | ||
| 152 | - return false; | ||
| 153 | - } | ||
| 154 | - }, | ||
| 155 | - //OK | ||
| 156 | - okClick: function (ev) { | ||
| 157 | - document.getElementById("payTip").innerHTML = ""; | ||
| 158 | - if (webAppParams == null) { | ||
| 159 | - alertMsg("暂无订单信息"); | ||
| 160 | - return; | ||
| 161 | - } | ||
| 162 | - //先校验停车费用后缴费提交 | ||
| 163 | - webAppClass.checkParkCost(); | ||
| 164 | - }, | ||
| 165 | - //校验该订单当前支付时的费用(排除扫描订单后不支付时长) | ||
| 166 | - checkParkCost: function () { | ||
| 167 | - $btnObj.style.display = "none"; | ||
| 168 | - $btnLoad.style.display = "block"; | ||
| 169 | - if (typeof (webAppParams.queryOrderInfo) == "undefined") {//没有queryOrderInfo返回第一页 | ||
| 170 | - window.history.back(-1); | ||
| 171 | - } | ||
| 172 | - var tmpParams = JSON.parse(webAppParams.queryOrderInfo); | ||
| 173 | - var url = webAppRoot + window.webAppH5.comServer; | ||
| 174 | - postRequest(url, tmpParams, function (res) { | ||
| 175 | - //btnObj.style.display = "block"; //$btnLoad.style.display = "none"; | ||
| 176 | - //$btnObj.style.display = "block"; | ||
| 177 | - if (res.code == 0) {//进场 | ||
| 178 | - var tmpObj = res.data; | ||
| 179 | - if (tmpObj) { | ||
| 180 | - if (flag == 1) { | ||
| 181 | - webAppClass.codediscountClick(tmpObj); | ||
| 182 | - } else { | ||
| 183 | - webAppClass.setUI(tmpObj); | ||
| 184 | - webAppParams = tmpObj;//重新赋值 | ||
| 185 | - webAppClass.okPay(tmpObj);//唤醒支付 | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - console.log(tmpObj) | ||
| 189 | - // webAppClass.okPay(tmpObj);//唤醒支付 | 363 | + }, |
| 364 | + | ||
| 365 | + getCode: function () { | ||
| 366 | + var appID = appWxID; | ||
| 367 | + var code = getUrlParam('code'); | ||
| 368 | + var local = window.location.href; | ||
| 369 | + //alert("local:" + local); | ||
| 370 | + if (code == null || code === '') { | ||
| 371 | + //alert(code); | ||
| 372 | + window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appID + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect' | ||
| 373 | + //window.event.returnValue = false; | ||
| 374 | + //window.open('https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appID + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect'); | ||
| 375 | + //alert("22"); | ||
| 190 | } else { | 376 | } else { |
| 191 | - alertMsg("没有找到相应订单"); | 377 | + //getOpenId(code); //把code传给后台获取用户信息 |
| 378 | + //alert(code); | ||
| 379 | + //webAppCode = code; | ||
| 380 | + return code; | ||
| 192 | } | 381 | } |
| 193 | - } else {//其他情况如【该卡号场内已存在】 | ||
| 194 | - $btnLoad.style.display = "none"; | ||
| 195 | - $btnObj.style.display = "block"; | ||
| 196 | - console.log(res.message); | ||
| 197 | - alertMsg(res.message); | ||
| 198 | - } | ||
| 199 | - }, function (err) { | ||
| 200 | - console.log("网络服务超时..." + url); | ||
| 201 | - alertMsg("网络服务超时"); | ||
| 202 | - $btnLoad.style.display = "none"; | ||
| 203 | - $btnObj.style.display = "block"; | ||
| 204 | - //$btnLoad.style.display = "none"; | ||
| 205 | - }); | ||
| 206 | - }, | ||
| 207 | - | ||
| 208 | - //确定支付 | ||
| 209 | - okPay: function (params) { | ||
| 210 | - var orderID = webAppParams.orderId;//订单号 | ||
| 211 | - // alert(orderID) | ||
| 212 | - //var moneyID = document.getElementById("sumMoney").innerHTML = webAppParams.orderId;//订单号 | ||
| 213 | - var val = document.getElementById("sumMoney").innerText; | ||
| 214 | - //var couponPersonId = document.getElementById("discountBox").value; | ||
| 215 | - var url = webAppRoot + window.webAppH5.zeroPayServer; | ||
| 216 | - var _paySrcType = getQueryString(window.location)._paySrcType | ||
| 217 | - var _mon = document.getElementById("sumMoney").innerText | ||
| 218 | - | ||
| 219 | - var discountParams = { | ||
| 220 | - payOrderType: _paySrcType, | ||
| 221 | - recordArreaInfos: JSON.stringify([{ | ||
| 222 | - "orderId": webAppParams.orderId, | ||
| 223 | - "orderNotPayFee": _mon * 100, | ||
| 224 | - "parkId": getQueryString(window.location).parkCode | ||
| 225 | - }]), | ||
| 226 | - terminalSource: 7, | ||
| 227 | - orderId: webAppParams.orderId, | ||
| 228 | - //couponPersonId:couponPersonId, | ||
| 229 | - app_id: '123', | ||
| 230 | - sign_type: '123', | ||
| 231 | - salt: '123', | ||
| 232 | - deviceInfo: '123', | ||
| 233 | - sign: '123', | ||
| 234 | - } | ||
| 235 | - if (val == '0.00' || val == '0') { | ||
| 236 | - postRequest(url, discountParams, function (res) { | ||
| 237 | - console.log(res) | ||
| 238 | - if (res.code == 0) { | ||
| 239 | - document.getElementById("paySuccess").style.display = 'block' | ||
| 240 | - // | ||
| 241 | - // document.getElementById("sumMoney").innerHTML = (res.data.orderFee/100) | ||
| 242 | - // document.getElementById("discountTip").innerHTML = res.data.couponDescribe | ||
| 243 | - // document.getElementById("discountFee").innerHTML = (res.data.discountFee/100) | ||
| 244 | - // document.getElementById("discountDesc").style.display="none" | ||
| 245 | - // $btnLoad.style.display = "none"; | ||
| 246 | - // $btnObj.style.display = "block"; | ||
| 247 | - // document.getElementById("discountBox").setAttribute('readonly','readonly'); | ||
| 248 | - // flag = 1 | 382 | + |
| 383 | + function getUrlParam(name) { | ||
| 384 | + var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); | ||
| 385 | + var r = window.location.search.substr(1).match(reg) | ||
| 386 | + if (r != null) return unescape(r[2]) | ||
| 387 | + return null | ||
| 388 | + } | ||
| 389 | + }, | ||
| 390 | + //Ali | ||
| 391 | + aliClick: function (ev) { | ||
| 392 | + console.log("AliClick"); | ||
| 393 | + document.getElementById("aliPay").checked = true; | ||
| 394 | + ev.preventDefault(); | ||
| 395 | + }, | ||
| 396 | + //Wx | ||
| 397 | + wxClick: function (ev) { | ||
| 398 | + console.log("wxClick"); | ||
| 399 | + document.getElementById("wxPay").checked = true; | ||
| 400 | + ev.preventDefault(); | ||
| 401 | + }, | ||
| 402 | + //浏览器 | ||
| 403 | + clientBrowser: function () { | ||
| 404 | + if (/MicroMessenger/.test(window.navigator.userAgent)) { | ||
| 405 | + console.log("微信客户端"); | ||
| 406 | + this.switchShow("wxPay"); | ||
| 407 | + } else if (/AlipayClient/.test(window.navigator.userAgent)) { | ||
| 408 | + console.log("支付宝客户端"); | ||
| 409 | + this.switchShow("aliPay"); | ||
| 249 | } else { | 410 | } else { |
| 250 | - alert(res.message) | ||
| 251 | - // $discountBtn.disabled = false | ||
| 252 | - // document.getElementById("discountTip").innerHTML = res.message | 411 | + console.log("其他浏览器"); |
| 412 | + this.switchShow("other"); | ||
| 253 | } | 413 | } |
| 254 | - }) | ||
| 255 | - } else { | ||
| 256 | - var root = webAppRoot; | ||
| 257 | - //第一首先判断当前哪种浏览器方式[微信内置、支付宝内置、第三方浏览器] | ||
| 258 | - var clientType = clientBrowserEx(); | ||
| 259 | - //alert(clientType); | ||
| 260 | - switch (clientType) { | ||
| 261 | - case "wxPay"://微信[内置浏览器] | ||
| 262 | - //var wxPay = webAppH5.wxPayServer; | ||
| 263 | - //var wxParams = webAppH5.comParams; | ||
| 264 | - //wxParams.orderId = orderID; | ||
| 265 | - //wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 266 | - //wxParams.terminalSource = 3;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 267 | - //debugger; | ||
| 268 | - | ||
| 269 | - // //新增start | ||
| 270 | - // | ||
| 271 | - // var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; | ||
| 272 | - // //window.location.href = url; | ||
| 273 | - // var wxPay = webAppH5.wxPayServer; | ||
| 274 | - // var wxParams = webAppH5.comParams; | ||
| 275 | - // wxParams.carNumber = getQueryString(window.location).carnum; | ||
| 276 | - // wxParams.orderId = orderID; | ||
| 277 | - // wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 278 | - // wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 279 | - // | ||
| 280 | - // wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 281 | - // | ||
| 282 | - // wxParams.recordArreaInfos= JSON.stringify([{"orderId":webAppParams.orderId,"orderNotPayFee":_mon*100,"parkId":getQueryString(window.location).parkCode}]); | ||
| 283 | - // | ||
| 284 | - // //新增end | ||
| 285 | - | ||
| 286 | - // if (webAppCode == null || webAppCode == "") {//code检测 | ||
| 287 | - // alertMsg(appState.codeNullTip); | ||
| 288 | - // $btnObj.style.display = "block"; | ||
| 289 | - // $btnLoad.style.display = "none"; | ||
| 290 | - // return; | ||
| 291 | - // } | ||
| 292 | - webAppClass.payAjaxJDK(orderID); | ||
| 293 | - console.log("wxPay");//微信支付 | ||
| 294 | - break; | ||
| 295 | - case "aliPay"://支付宝 | ||
| 296 | - console.log("aliPay"); | ||
| 297 | - //订单号 | ||
| 298 | - var obj = {}; | ||
| 299 | - //this.payAjax(url, { orderId: "11111", price: 0.01 }); | ||
| 300 | - var aliPay = webAppH5.aliPayServer; | ||
| 301 | - var aliParams = webAppH5.comParams; | ||
| 302 | - aliParams.orderId = orderID; | ||
| 303 | - aliParams.carNumber = getQueryString(window.location).carnum; | ||
| 304 | - aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 305 | - aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 306 | - aliParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 307 | - | ||
| 308 | - aliParams.recordArreaInfos = JSON.stringify([{ | 414 | + }, |
| 415 | + //根据浏览器显示内容[aliPay、wxPay、other] | ||
| 416 | + switchShow: function (type) { | ||
| 417 | + var aliObj = document.getElementById("rowAliPay"); | ||
| 418 | + var wxObj = document.getElementById("rowWxPay"); | ||
| 419 | + var lineObj = document.getElementById("splitLine"); | ||
| 420 | + switch (type) { | ||
| 421 | + case "aliPay": | ||
| 422 | + lineObj.style.display = "none"; | ||
| 423 | + wxObj.style.display = "none"; | ||
| 424 | + document.getElementById("aliPay").checked = true; | ||
| 425 | + break; | ||
| 426 | + case "wxPay": | ||
| 427 | + lineObj.style.display = "none"; | ||
| 428 | + aliObj.style.display = "none"; | ||
| 429 | + document.getElementById("wxPay").checked = true; | ||
| 430 | + break; | ||
| 431 | + default://其他浏览器[浏览器暂时屏蔽微信] | ||
| 432 | + lineObj.style.display = "none"; | ||
| 433 | + wxObj.style.display = "none"; | ||
| 434 | + document.getElementById("aliPay").checked = true; | ||
| 435 | + break; | ||
| 436 | + } | ||
| 437 | + }, | ||
| 438 | + | ||
| 439 | + //异步请求-微信H5页面 | ||
| 440 | + payAjax: function (url, params) { | ||
| 441 | + var btnOBj = $btnObj; | ||
| 442 | + postRequest(url, params, function (res) { | ||
| 443 | + btnOBj.style.display = "block"; | ||
| 444 | + $btnLoad.style.display = "none"; | ||
| 445 | + //debugger; | ||
| 446 | + if (res.code == 0) {//进场 | ||
| 447 | + //alertMsg("出场成功"); | ||
| 448 | + if (res.data) { | ||
| 449 | + var tmpObj = res.data; | ||
| 450 | + if (typeof (tmpObj.mwebUrl) != "undefined") { | ||
| 451 | + window.location.href = tmpObj.mwebUrl + "&redirect_url=" + webAppPayResult; | ||
| 452 | + } else { | ||
| 453 | + alertMsg("没有返回支付地址mwebUrl"); | ||
| 454 | + } | ||
| 455 | + console.log(JSON.stringify(tmpObj)); | ||
| 456 | + } else { | ||
| 457 | + alertMsg("没有找到返回值"); | ||
| 458 | + } | ||
| 459 | + } else {//其他情况如【该卡号场内已存在】 | ||
| 460 | + console.log(res.message); | ||
| 461 | + alertMsg(res.message); | ||
| 462 | + } | ||
| 463 | + }, function (err) { | ||
| 464 | + console.log("网络地址出错..."); | ||
| 465 | + alertMsg("网络地址出错..."); | ||
| 466 | + $btnLoad.style.display = "none"; | ||
| 467 | + btnOBj.style.display = "block"; | ||
| 468 | + }); | ||
| 469 | + }, | ||
| 470 | + //异步请求-微信JDK调用 | ||
| 471 | + payAjaxJDK: function (orderID) { | ||
| 472 | + var btnOBj = $btnObj; | ||
| 473 | + //0:页面初始化获取code[webAppCode] | ||
| 474 | + var codeParams = {code: webAppCode, appId: appWxID}; | ||
| 475 | + var openIdUrl = webAppRoot + window.webAppH5.wxGetOpenIdServer; | ||
| 476 | + | ||
| 477 | + //1:有code获取OpenId | ||
| 478 | + postRequest(openIdUrl, codeParams, function (res) { | ||
| 479 | + //alert(JSON.stringify(res)); | ||
| 480 | + if (res.code == 0) { | ||
| 481 | + //alert(res.data); | ||
| 482 | + webAppClass.getPayParams(res.data, orderID); | ||
| 483 | + } else if (res.code == 40163) {//code been used, hints[重复code问题] | ||
| 484 | + | ||
| 485 | + alertMsg(appState.codeNullTip); | ||
| 486 | + console.log(res.message); | ||
| 487 | + $btnObj.style.display = "block"; | ||
| 488 | + $btnLoad.style.display = "none"; | ||
| 489 | + } else { | ||
| 490 | + alertMsg(res.message); | ||
| 491 | + $btnObj.style.display = "block"; | ||
| 492 | + $btnLoad.style.display = "none"; | ||
| 493 | + } | ||
| 494 | + }, function (err) { | ||
| 495 | + console.log("网络地址出错..." + openIdUrl); | ||
| 496 | + $btnObj.style.display = "block"; | ||
| 497 | + $btnLoad.style.display = "none"; | ||
| 498 | + }); | ||
| 499 | + //2:获取支付参数 | ||
| 500 | + //function getPayParams(openId) { | ||
| 501 | + | ||
| 502 | + //} | ||
| 503 | + }, | ||
| 504 | + getPayParams: function (openId, orderID) { | ||
| 505 | + var wxPay = window.webAppH5.wxPayServer; | ||
| 506 | + var wxParams = window.webAppH5.comParams; | ||
| 507 | + var _mon = document.getElementById("sumMoney").innerHTML | ||
| 508 | + wxParams.orderId = orderID; | ||
| 509 | + wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 510 | + wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 511 | + //webAppClass.payAjax(root + wxPay, wxParams); | ||
| 512 | + | ||
| 513 | + | ||
| 514 | + //新增start | ||
| 515 | + | ||
| 516 | + | ||
| 517 | + wxParams.carNumber = getQueryString(window.location).carnum; | ||
| 518 | + | ||
| 519 | + wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 520 | + | ||
| 521 | + wxParams.recordArreaInfos = JSON.stringify([{ | ||
| 309 | "orderId": webAppParams.orderId, | 522 | "orderId": webAppParams.orderId, |
| 310 | "orderNotPayFee": _mon * 100, | 523 | "orderNotPayFee": _mon * 100, |
| 311 | "parkId": getQueryString(window.location).parkCode | 524 | "parkId": getQueryString(window.location).parkCode |
| 312 | - }]); | ||
| 313 | - webAppClass.payAliAjax(root + aliPay, aliParams); | ||
| 314 | - break; | ||
| 315 | - default://第三方浏览器other | ||
| 316 | - //默认支付宝 | ||
| 317 | - if (document.getElementById("aliPay").checked) { | ||
| 318 | - console.log("aliPay"); | ||
| 319 | - //订单号 | ||
| 320 | - var obj = {}; | ||
| 321 | - //this.payAjax(url, { orderId: "11111", price: 0.01 }); | ||
| 322 | - var aliPay = webAppH5.aliPayServer; | ||
| 323 | - var aliParams = webAppH5.comParams; | ||
| 324 | - aliParams.orderId = orderID; | ||
| 325 | - aliParams.carNumber = getQueryString(window.location).carnum; | ||
| 326 | - aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 327 | - aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 328 | - aliParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 329 | - | ||
| 330 | - aliParams.recordArreaInfos = JSON.stringify([{ | ||
| 331 | - "orderId": webAppParams.orderId, | ||
| 332 | - "orderNotPayFee": _mon * 100, | ||
| 333 | - "parkId": getQueryString(window.location).parkCode | ||
| 334 | - }]); | ||
| 335 | - | ||
| 336 | - webAppClass.payAliAjax(root + aliPay, aliParams); | ||
| 337 | - } else {//微信页面支付 | ||
| 338 | - var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; | ||
| 339 | - //window.location.href = url; | ||
| 340 | - var wxPay = webAppH5.wxPayServer; | ||
| 341 | - var wxParams = webAppH5.comParams; | ||
| 342 | - wxParams.carNumber = getQueryString(window.location).carnum; | ||
| 343 | - wxParams.orderId = orderID; | ||
| 344 | - wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 345 | - wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 346 | - | ||
| 347 | - wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 348 | - | ||
| 349 | - wxParams.recordArreaInfos = JSON.stringify([{ | ||
| 350 | - "orderId": webAppParams.orderId, | ||
| 351 | - "orderNotPayFee": _mon * 100, | ||
| 352 | - "parkId": getQueryString(window.location).parkCode | ||
| 353 | - }]); | ||
| 354 | - webAppClass.payAjax(root + wxPay, wxParams); | ||
| 355 | - console.log("wxPay"); | ||
| 356 | - } | ||
| 357 | - break; | ||
| 358 | - } | ||
| 359 | - } | ||
| 360 | - | ||
| 361 | - }, | ||
| 362 | - | ||
| 363 | - getCode: function () { | ||
| 364 | - var appID = appWxID; | ||
| 365 | - var code = getUrlParam('code'); | ||
| 366 | - var local = window.location.href; | ||
| 367 | - //alert("local:" + local); | ||
| 368 | - if (code == null || code === '') { | ||
| 369 | - //alert(code); | ||
| 370 | - window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appID + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect' | ||
| 371 | - //window.event.returnValue = false; | ||
| 372 | - //window.open('https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appID + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect'); | ||
| 373 | - //alert("22"); | ||
| 374 | - } else { | ||
| 375 | - //getOpenId(code); //把code传给后台获取用户信息 | ||
| 376 | - //alert(code); | ||
| 377 | - //webAppCode = code; | ||
| 378 | - return code; | ||
| 379 | - } | 525 | + }]); |
| 526 | + | ||
| 527 | + //新增end | ||
| 528 | + | ||
| 529 | + | ||
| 530 | + wxParams.openId = openId; | ||
| 531 | + wxParams.appId = appWxID; | ||
| 532 | + var payParamsUrl = webAppRoot + window.webAppH5.wxPayServer; | ||
| 533 | + //alert(payParamsUrl);alert(orderID); | ||
| 534 | + postRequest(payParamsUrl, wxParams, function (res) { | ||
| 535 | + $btnObj.style.display = "block"; | ||
| 536 | + $btnLoad.style.display = "none"; | ||
| 537 | + //debugger; | ||
| 538 | + if (res.code == 0) {//进场 | ||
| 539 | + //alertMsg("出场成功"); | ||
| 540 | + if (res.data) { | ||
| 541 | + var tmpObj = res.data; | ||
| 542 | + webAppClass.weixinJSBridge(res.data); | ||
| 543 | + console.log(JSON.stringify(tmpObj)); | ||
| 544 | + //alert(JSON.stringify(tmpObj)); | ||
| 545 | + } else { | ||
| 546 | + alertMsg("没有找到返回值"); | ||
| 547 | + } | ||
| 548 | + } else { | ||
| 549 | + $btnLoad.style.display = "none"; | ||
| 550 | + $btnObj.style.display = "block"; | ||
| 551 | + console.log(res.message); | ||
| 552 | + alertMsg(res.message); | ||
| 553 | + } | ||
| 554 | + }, function (err) { | ||
| 555 | + console.log("网络地址出错..."); | ||
| 556 | + alertMsg("网络地址出错..." + payParamsUrl); | ||
| 557 | + $btnLoad.style.display = "none"; | ||
| 558 | + $btnObj.style.display = "block"; | ||
| 559 | + }); | ||
| 560 | + }, | ||
| 561 | + | ||
| 562 | + //调用微信内置WeixinJSBridge对象发起支付 | ||
| 563 | + weixinJSBridge: function (params) { | ||
| 564 | + function onBridgeReady() { | ||
| 565 | + WeixinJSBridge.invoke( | ||
| 566 | + 'getBrandWCPayRequest', params, | ||
| 567 | + //'getBrandWCPayRequest', { | ||
| 568 | + // "appId": appWxID, //公众号名称,由商户传入 | ||
| 569 | + // "timeStamp": "1395712654", //时间戳,自1970年以来的秒数 | ||
| 570 | + // "nonceStr": "e61463f8efa94090b1f366cccfbbb444", //随机串 | ||
| 571 | + // "package": "prepay_id=u802345jgfjsdfgsdg888", | ||
| 572 | + // "signType": "MD5", //微信签名方式: | ||
| 573 | + // "paySign": "70EA570631E4BB79628FBCA90534C63FF7FADD89" //微信签名 | ||
| 574 | + //}, | ||
| 575 | + function (res) { | ||
| 576 | + //alert(res.err_msg); | ||
| 577 | + if (res.err_msg == "get_brand_wcpay_request:ok") { | ||
| 578 | + // 使用以上方式判断前端返回,微信团队郑重提示: | ||
| 579 | + //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 | ||
| 580 | + | ||
| 581 | + | ||
| 582 | + | ||
| 583 | + //window.location.href = webAppPayResult + "?trade_no=" + "success"; | ||
| 584 | + window.history.go(-2); | ||
| 585 | + setTimeout(function(){ | ||
| 586 | + window.history.go(-2); | ||
| 587 | + //var src = mUrl.Uri+'/WEB-INF/pages/select.html?openid='+func.openid+'&token='+func.token+"&";//mUrl.myParkCardView; | ||
| 588 | + //window.location.href = src; | ||
| 589 | + },3000); | ||
| 590 | + | ||
| 591 | + | ||
| 592 | + } else if (res.err_msg == 'get_brand_wcpay_request:cancel') { | ||
| 593 | + window.location.href = webAppPayResult + "?trade_no=" + "fail"; | ||
| 594 | + } else { | ||
| 595 | + alertMsg(JSON.stringify(res)); | ||
| 596 | + //alert(res.err_msg); | ||
| 597 | + } | ||
| 598 | + }); | ||
| 599 | + } | ||
| 380 | 600 | ||
| 381 | - function getUrlParam(name) { | ||
| 382 | - var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); | ||
| 383 | - var r = window.location.search.substr(1).match(reg) | ||
| 384 | - if (r != null) return unescape(r[2]) | ||
| 385 | - return null | ||
| 386 | - } | ||
| 387 | - }, | ||
| 388 | - //Ali | ||
| 389 | - aliClick: function (ev) { | ||
| 390 | - console.log("AliClick"); | ||
| 391 | - document.getElementById("aliPay").checked = true; | ||
| 392 | - ev.preventDefault(); | ||
| 393 | - }, | ||
| 394 | - //Wx | ||
| 395 | - wxClick: function (ev) { | ||
| 396 | - console.log("wxClick"); | ||
| 397 | - document.getElementById("wxPay").checked = true; | ||
| 398 | - ev.preventDefault(); | ||
| 399 | - }, | ||
| 400 | - //浏览器 | ||
| 401 | - clientBrowser: function () { | ||
| 402 | - if (/MicroMessenger/.test(window.navigator.userAgent)) { | ||
| 403 | - console.log("微信客户端"); | ||
| 404 | - this.switchShow("wxPay"); | ||
| 405 | - } else if (/AlipayClient/.test(window.navigator.userAgent)) { | ||
| 406 | - console.log("支付宝客户端"); | ||
| 407 | - this.switchShow("aliPay"); | ||
| 408 | - } else { | ||
| 409 | - console.log("其他浏览器"); | ||
| 410 | - this.switchShow("other"); | ||
| 411 | - } | ||
| 412 | - }, | ||
| 413 | - //根据浏览器显示内容[aliPay、wxPay、other] | ||
| 414 | - switchShow: function (type) { | ||
| 415 | - var aliObj = document.getElementById("rowAliPay"); | ||
| 416 | - var wxObj = document.getElementById("rowWxPay"); | ||
| 417 | - var lineObj = document.getElementById("splitLine"); | ||
| 418 | - switch (type) { | ||
| 419 | - case "aliPay": | ||
| 420 | - lineObj.style.display = "none"; | ||
| 421 | - wxObj.style.display = "none"; | ||
| 422 | - document.getElementById("aliPay").checked = true; | ||
| 423 | - break; | ||
| 424 | - case "wxPay": | ||
| 425 | - lineObj.style.display = "none"; | ||
| 426 | - aliObj.style.display = "none"; | ||
| 427 | - document.getElementById("wxPay").checked = true; | ||
| 428 | - break; | ||
| 429 | - default://其他浏览器[浏览器暂时屏蔽微信] | ||
| 430 | - lineObj.style.display = "none"; | ||
| 431 | - wxObj.style.display = "none"; | ||
| 432 | - document.getElementById("aliPay").checked = true; | ||
| 433 | - break; | ||
| 434 | - } | ||
| 435 | - }, | ||
| 436 | - | ||
| 437 | - //异步请求-微信H5页面 | ||
| 438 | - payAjax: function (url, params) { | ||
| 439 | - var btnOBj = $btnObj; | ||
| 440 | - postRequest(url, params, function (res) { | ||
| 441 | - btnOBj.style.display = "block"; | ||
| 442 | - $btnLoad.style.display = "none"; | ||
| 443 | - //debugger; | ||
| 444 | - if (res.code == 0) {//进场 | ||
| 445 | - //alertMsg("出场成功"); | ||
| 446 | - if (res.data) { | ||
| 447 | - var tmpObj = res.data; | ||
| 448 | - if (typeof (tmpObj.mwebUrl) != "undefined") { | ||
| 449 | - window.location.href = tmpObj.mwebUrl + "&redirect_url=" + webAppPayResult; | ||
| 450 | - } else { | ||
| 451 | - alertMsg("没有返回支付地址mwebUrl"); | ||
| 452 | - } | ||
| 453 | - console.log(JSON.stringify(tmpObj)); | 601 | + if (typeof WeixinJSBridge == "undefined") { |
| 602 | + if (document.addEventListener) { | ||
| 603 | + document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false); | ||
| 604 | + } else if (document.attachEvent) { | ||
| 605 | + document.attachEvent('WeixinJSBridgeReady', onBridgeReady); | ||
| 606 | + document.attachEvent('onWeixinJSBridgeReady', onBridgeReady); | ||
| 607 | + } | ||
| 454 | } else { | 608 | } else { |
| 455 | - alertMsg("没有找到返回值"); | 609 | + onBridgeReady(); |
| 456 | } | 610 | } |
| 457 | - } else {//其他情况如【该卡号场内已存在】 | ||
| 458 | - console.log(res.message); | ||
| 459 | - alertMsg(res.message); | ||
| 460 | - } | ||
| 461 | - }, function (err) { | ||
| 462 | - console.log("网络地址出错..."); | ||
| 463 | - alertMsg("网络地址出错..."); | ||
| 464 | - $btnLoad.style.display = "none"; | ||
| 465 | - btnOBj.style.display = "block"; | ||
| 466 | - }); | ||
| 467 | - }, | ||
| 468 | - //异步请求-微信JDK调用 | ||
| 469 | - payAjaxJDK: function (orderID) { | ||
| 470 | - var btnOBj = $btnObj; | ||
| 471 | - //0:页面初始化获取code[webAppCode] | ||
| 472 | - var codeParams = { code: webAppCode, appId: appWxID }; | ||
| 473 | - var openIdUrl = webAppRoot + window.webAppH5.wxGetOpenIdServer; | ||
| 474 | - | ||
| 475 | - //1:有code获取OpenId | ||
| 476 | - postRequest(openIdUrl, codeParams, function (res) { | ||
| 477 | - //alert(JSON.stringify(res)); | ||
| 478 | - if (res.code == 0) { | ||
| 479 | - //alert(res.data); | ||
| 480 | - webAppClass.getPayParams(res.data, orderID); | ||
| 481 | - } else if (res.code == 40163) {//code been used, hints[重复code问题] | ||
| 482 | - | ||
| 483 | - alertMsg(appState.codeNullTip); | ||
| 484 | - console.log(res.message); | ||
| 485 | - $btnObj.style.display = "block"; | ||
| 486 | - $btnLoad.style.display = "none"; | ||
| 487 | - } else { | ||
| 488 | - alertMsg(res.message); | ||
| 489 | - $btnObj.style.display = "block"; | ||
| 490 | - $btnLoad.style.display = "none"; | ||
| 491 | - } | ||
| 492 | - }, function (err) { | ||
| 493 | - console.log("网络地址出错..." + openIdUrl); | ||
| 494 | - $btnObj.style.display = "block"; | ||
| 495 | - $btnLoad.style.display = "none"; | ||
| 496 | - }); | ||
| 497 | - //2:获取支付参数 | ||
| 498 | - //function getPayParams(openId) { | ||
| 499 | - | ||
| 500 | - //} | ||
| 501 | - }, | ||
| 502 | - getPayParams: function (openId, orderID) { | ||
| 503 | - var wxPay = window.webAppH5.wxPayServer; | ||
| 504 | - var wxParams = window.webAppH5.comParams; | ||
| 505 | - var _mon = document.getElementById("sumMoney").innerHTML | ||
| 506 | - wxParams.orderId = orderID; | ||
| 507 | - wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 508 | - wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 509 | - //webAppClass.payAjax(root + wxPay, wxParams); | ||
| 510 | - | ||
| 511 | - //新增start | ||
| 512 | - | ||
| 513 | - wxParams.carNumber = getQueryString(window.location).carnum; | ||
| 514 | - | ||
| 515 | - wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 516 | - | ||
| 517 | - wxParams.recordArreaInfos = JSON.stringify([{ | ||
| 518 | - "orderId": webAppParams.orderId, | ||
| 519 | - "orderNotPayFee": _mon * 100, | ||
| 520 | - "parkId": getQueryString(window.location).parkCode | ||
| 521 | - }]); | ||
| 522 | - | ||
| 523 | - //新增end | ||
| 524 | - | ||
| 525 | - wxParams.openId = openId; | ||
| 526 | - wxParams.appId = appWxID; | ||
| 527 | - var payParamsUrl = webAppRoot + window.webAppH5.wxPayServer; | ||
| 528 | - //alert(payParamsUrl);alert(orderID); | ||
| 529 | - postRequest(payParamsUrl, wxParams, function (res) { | ||
| 530 | - $btnObj.style.display = "block"; | ||
| 531 | - $btnLoad.style.display = "none"; | ||
| 532 | - //debugger; | ||
| 533 | - if (res.code == 0) {//进场 | ||
| 534 | - //alertMsg("出场成功"); | ||
| 535 | - if (res.data) { | ||
| 536 | - var tmpObj = res.data; | ||
| 537 | - webAppClass.weixinJSBridge(res.data); | ||
| 538 | - console.log(JSON.stringify(tmpObj)); | ||
| 539 | - //alert(JSON.stringify(tmpObj)); | 611 | + }, |
| 612 | + | ||
| 613 | + //异步请求-支付宝 | ||
| 614 | + payAliAjax: function (url, params) { | ||
| 615 | + var btnOBj = $btnObj; | ||
| 616 | + postRequest(url, params, function (res) { | ||
| 617 | + btnOBj.style.display = "block"; | ||
| 618 | + $btnLoad.style.display = "none"; | ||
| 619 | + if (res.code == 0) {//进场 | ||
| 620 | + document.write(res.data);//打开支付表单 | ||
| 621 | + } else {//其他情况如【该卡号场内已存在】 | ||
| 622 | + console.log(res.message); | ||
| 623 | + alertMsg(res.message); | ||
| 624 | + } | ||
| 625 | + }, function (err) { | ||
| 626 | + console.log("网络地址出错..."); | ||
| 627 | + alertMsg("网络地址出错..."); | ||
| 628 | + $btnLoad.style.display = "none"; | ||
| 629 | + btnOBj.style.display = "block"; | ||
| 630 | + }); | ||
| 631 | + }, | ||
| 632 | + | ||
| 633 | + //设置UI | ||
| 634 | + setUI: function (params) { | ||
| 635 | + console.log('ui') | ||
| 636 | + var $carNum = getObjectByID("carNum"),//车牌号 | ||
| 637 | + $orderNum = getObjectByID("orderNum"),//订单号 | ||
| 638 | + $sumMoney = getObjectByID("sumMoney"),//实际应付金额 | ||
| 639 | + $outtime = getObjectByID("outtime"),//实际出场时间 | ||
| 640 | + $payTip = getObjectByID("payTip"),//支付提示 | ||
| 641 | + | ||
| 642 | + $parkName = getObjectByID("parkName"),//车场名称 | ||
| 643 | + $inparktime = getObjectByID("inparktime"),//进场时间 | ||
| 644 | + $staytime = getObjectByID("staytime"),//停车时长 | ||
| 645 | + $due = getObjectByID("due"),//停车总费用 | ||
| 646 | + | ||
| 647 | + $paid = getObjectByID("paid"),//已支付金额 | ||
| 648 | + $discountDesc = getObjectByID("discountDesc"),//8折优惠折扣费用 | ||
| 649 | + $discountFee = getObjectByID("discountFee");//优惠金额 | ||
| 650 | + | ||
| 651 | + if (params != null && params != "") { | ||
| 652 | + var price = keepTwoDecimalFull((params.orderFee / 100));//(params.orderFee / 100); | ||
| 653 | + $carNum.innerHTML = params.carnum;//手机号 | ||
| 654 | + $orderNum.innerHTML = params.orderId;//订单号 | ||
| 655 | + $sumMoney.innerHTML = price;///params.orderFee//缴费金额 | ||
| 656 | + $outtime.innerHTML = params.parkOutTime;//实际出场时间 | ||
| 657 | + //.appOrderTimeout | ||
| 658 | + $payTip.innerHTML = "注意: " + params.appOrderTimeout;//请在支付完成10分钟内出场,如超时未出场,会继续计费。 | ||
| 659 | + | ||
| 660 | + $parkName.innerHTML = params.parkName; | ||
| 661 | + $inparktime.innerHTML = params.inparktime; | ||
| 662 | + $staytime.innerHTML = formatSeconds(params.staytime); | ||
| 663 | + | ||
| 664 | + $due.innerHTML = keepTwoDecimalFull((params.due / 100));//停车总费用 | ||
| 665 | + $paid.innerHTML = keepTwoDecimalFull(params.paid / 100); | ||
| 666 | + $discountFee.innerHTML = params.discountFee;//优惠金额 | ||
| 667 | + // $discountDesc.innerHTML = params.discountDesc; | ||
| 540 | } else { | 668 | } else { |
| 541 | - alertMsg("没有找到返回值"); | 669 | + console.log("没有接受到参数"); |
| 542 | } | 670 | } |
| 543 | - } else { | ||
| 544 | - $btnLoad.style.display = "none"; | ||
| 545 | - $btnObj.style.display = "block"; | ||
| 546 | - console.log(res.message); | ||
| 547 | - alertMsg(res.message); | ||
| 548 | - } | ||
| 549 | - }, function (err) { | ||
| 550 | - console.log("网络地址出错..."); | ||
| 551 | - alertMsg("网络地址出错..." + payParamsUrl); | ||
| 552 | - $btnLoad.style.display = "none"; | ||
| 553 | - $btnObj.style.display = "block"; | ||
| 554 | - }); | ||
| 555 | - }, | ||
| 556 | - | ||
| 557 | - //调用微信内置WeixinJSBridge对象发起支付 | ||
| 558 | - weixinJSBridge: function (params) { | ||
| 559 | - function onBridgeReady() { | ||
| 560 | - WeixinJSBridge.invoke( | ||
| 561 | - 'getBrandWCPayRequest', params, | ||
| 562 | - //'getBrandWCPayRequest', { | ||
| 563 | - // "appId": appWxID, //公众号名称,由商户传入 | ||
| 564 | - // "timeStamp": "1395712654", //时间戳,自1970年以来的秒数 | ||
| 565 | - // "nonceStr": "e61463f8efa94090b1f366cccfbbb444", //随机串 | ||
| 566 | - // "package": "prepay_id=u802345jgfjsdfgsdg888", | ||
| 567 | - // "signType": "MD5", //微信签名方式: | ||
| 568 | - // "paySign": "70EA570631E4BB79628FBCA90534C63FF7FADD89" //微信签名 | ||
| 569 | - //}, | ||
| 570 | - function (res) { | ||
| 571 | - //alert(res.err_msg); | ||
| 572 | - if (res.err_msg == "get_brand_wcpay_request:ok") { | ||
| 573 | - // 使用以上方式判断前端返回,微信团队郑重提示: | ||
| 574 | - //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 | ||
| 575 | - | ||
| 576 | - //window.location.href = webAppPayResult + "?trade_no=" + "success"; | ||
| 577 | - window.history.go(-2); | ||
| 578 | - setTimeout(function () { | ||
| 579 | - window.history.go(-2); | ||
| 580 | - //var src = mUrl.Uri+'/WEB-INF/pages/select.html?openid='+func.openid+'&token='+func.token+"&";//mUrl.myParkCardView; | ||
| 581 | - //window.location.href = src; | ||
| 582 | - }, 3000); | ||
| 583 | - | ||
| 584 | - } else if (res.err_msg == 'get_brand_wcpay_request:cancel') { | ||
| 585 | - window.location.href = webAppPayResult + "?trade_no=" + "fail"; | ||
| 586 | - } else { | ||
| 587 | - alertMsg(JSON.stringify(res)); | ||
| 588 | - //alert(res.err_msg); | ||
| 589 | - } | ||
| 590 | - }); | ||
| 591 | - } | 671 | + }, |
| 592 | 672 | ||
| 593 | - if (typeof WeixinJSBridge == "undefined") { | ||
| 594 | - if (document.addEventListener) { | ||
| 595 | - document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false); | ||
| 596 | - } else if (document.attachEvent) { | ||
| 597 | - document.attachEvent('WeixinJSBridgeReady', onBridgeReady); | ||
| 598 | - document.attachEvent('onWeixinJSBridgeReady', onBridgeReady); | ||
| 599 | - } | ||
| 600 | - } else { | ||
| 601 | - onBridgeReady(); | ||
| 602 | - } | ||
| 603 | - }, | ||
| 604 | - | ||
| 605 | - //异步请求-支付宝 | ||
| 606 | - payAliAjax: function (url, params) { | ||
| 607 | - var btnOBj = $btnObj; | ||
| 608 | - postRequest(url, params, function (res) { | ||
| 609 | - btnOBj.style.display = "block"; | ||
| 610 | - $btnLoad.style.display = "none"; | ||
| 611 | - if (res.code == 0) {//进场 | ||
| 612 | - document.write(res.data);//打开支付表单 | ||
| 613 | - } else {//其他情况如【该卡号场内已存在】 | ||
| 614 | - console.log(res.message); | ||
| 615 | - alertMsg(res.message); | ||
| 616 | - } | ||
| 617 | - }, function (err) { | ||
| 618 | - console.log("网络地址出错..."); | ||
| 619 | - alertMsg("网络地址出错..."); | ||
| 620 | - $btnLoad.style.display = "none"; | ||
| 621 | - btnOBj.style.display = "block"; | ||
| 622 | - }); | ||
| 623 | - }, | ||
| 624 | - | ||
| 625 | - //设置UI | ||
| 626 | - setUI: function (params) { | ||
| 627 | - console.log('ui') | ||
| 628 | - var $carNum = getObjectByID("carNum"),//车牌号 | ||
| 629 | - $orderNum = getObjectByID("orderNum"),//订单号 | ||
| 630 | - $sumMoney = getObjectByID("sumMoney"),//实际应付金额 | ||
| 631 | - $outtime = getObjectByID("outtime"),//实际出场时间 | ||
| 632 | - $payTip = getObjectByID("payTip"),//支付提示 | ||
| 633 | - | ||
| 634 | - $parkName = getObjectByID("parkName"),//车场名称 | ||
| 635 | - $inparktime = getObjectByID("inparktime"),//进场时间 | ||
| 636 | - $staytime = getObjectByID("staytime"),//停车时长 | ||
| 637 | - $due = getObjectByID("due"),//停车总费用 | ||
| 638 | - | ||
| 639 | - $paid = getObjectByID("paid"),//已支付金额 | ||
| 640 | - $discountDesc = getObjectByID("discountDesc"),//8折优惠折扣费用 | ||
| 641 | - $discountFee = getObjectByID("discountFee");//优惠金额 | ||
| 642 | - $businessFeeWrap = getObjectByID("businessFeeWrap") | ||
| 643 | - $businessFee = getObjectByID("businessFee") | ||
| 644 | - | ||
| 645 | - if (params != null && params != "") { | ||
| 646 | - var price = keepTwoDecimalFull((params.orderFee / 100));//(params.orderFee / 100); | ||
| 647 | - $carNum.innerHTML = params.carnum;//手机号 | ||
| 648 | - $orderNum.innerHTML = params.orderId;//订单号 | ||
| 649 | - $sumMoney.innerHTML = price;///params.orderFee//缴费金额 | ||
| 650 | - $outtime.innerHTML = params.parkOutTime;//实际出场时间 | ||
| 651 | - //.appOrderTimeout | ||
| 652 | - $payTip.innerHTML = "注意: " + params.appOrderTimeout;//请在支付完成10分钟内出场,如超时未出场,会继续计费。 | ||
| 653 | - | ||
| 654 | - $parkName.innerHTML = params.parkName; | ||
| 655 | - $inparktime.innerHTML = params.inparktime; | ||
| 656 | - $staytime.innerHTML = formatSeconds(params.staytime); | ||
| 657 | - // alert(params.parkName) | ||
| 658 | - // alert(params.businessFee) | ||
| 659 | - if (params.businessUsedType == 0) { | ||
| 660 | - $('#businessFeeWrap').css('display', 'none') | ||
| 661 | - } else { | ||
| 662 | - var _mon = Number(params.businessFee) | ||
| 663 | - $businessFee.innerHTML = '¥' + (_mon / 100).toFixed(2); | ||
| 664 | - } | ||
| 665 | - | ||
| 666 | - $due.innerHTML = keepTwoDecimalFull((params.due / 100));//停车总费用 | ||
| 667 | - $paid.innerHTML = keepTwoDecimalFull(params.paid / 100); | ||
| 668 | - $discountFee.innerHTML = params.discountFee;//优惠金额 | ||
| 669 | - // $discountDesc.innerHTML = params.discountDesc; | ||
| 670 | - } else { | ||
| 671 | - console.log("没有接受到参数"); | ||
| 672 | - } | ||
| 673 | - }, | ||
| 674 | 673 | ||
| 675 | } | 674 | } |
| 676 | 675 |
js/url.js
| @@ -87,14 +87,11 @@ mUrl.getJx = function(){ | @@ -87,14 +87,11 @@ mUrl.getJx = function(){ | ||
| 87 | 87 | ||
| 88 | /*end*/ | 88 | /*end*/ |
| 89 | 89 | ||
| 90 | -// var cepath = 'http://39.98.54.240:8090'; | ||
| 91 | - | ||
| 92 | -var cepath = 'http://pay.service.huangshiparking.com'; | ||
| 93 | -// http://pay.service.renniting.cn | ||
| 94 | -// var cepath = 'http://39.98.54.240:8090' | ||
| 95 | -// http://app.api.dyszt.com:8090 | ||
| 96 | -// var cepath = 'http://app.api.dyszt.com:8090'; | ||
| 97 | -// https://pay.service.rnting.com//'http://47.96.41.38:8090'; | 90 | +// var cepath = 'http://39.98.58.92:8090'; |
| 91 | + | ||
| 92 | +var cepath = 'http://pay.service.renniting.cn/'; //赤峰 | ||
| 93 | +// http://pay.service.huangshiparking.com | ||
| 94 | + | ||
| 98 | /*----------------------------------------------登录登出绑定手机号 start*/ | 95 | /*----------------------------------------------登录登出绑定手机号 start*/ |
| 99 | //发送验证码 | 96 | //发送验证码 |
| 100 | mUrl.sendRandCode = cepath + '/user/sendverificode';//webPath + '/binding/sendRandCode'+mUrl.getCommonParam(); | 97 | mUrl.sendRandCode = cepath + '/user/sendverificode';//webPath + '/binding/sendRandCode'+mUrl.getCommonParam(); |
| @@ -224,3 +221,6 @@ mUrl.vipxAliPay = cepath+ '/alipay/sendAliPayVipCardOrderInfo'; | @@ -224,3 +221,6 @@ mUrl.vipxAliPay = cepath+ '/alipay/sendAliPayVipCardOrderInfo'; | ||
| 224 | 221 | ||
| 225 | // 记录 | 222 | // 记录 |
| 226 | mUrl.listServer=cepath+"/queryParkOrder/queryParkingRecordPageByCarNumbers" | 223 | mUrl.listServer=cepath+"/queryParkOrder/queryParkingRecordPageByCarNumbers" |
| 224 | + | ||
| 225 | +//根据组织ID和活动类型查询活动列表 | ||
| 226 | +mUrl.queryActivityListByJumpType=cepath+"/activity/queryActivityListByJumpType" |
list.html
| @@ -21,6 +21,11 @@ | @@ -21,6 +21,11 @@ | ||
| 21 | <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css"> | 21 | <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css"> |
| 22 | <link rel="stylesheet" href="css/reset.css"> | 22 | <link rel="stylesheet" href="css/reset.css"> |
| 23 | 23 | ||
| 24 | + <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/Swiper/5.4.5/css/swiper.css"> | ||
| 25 | + <!-- <link rel="stylesheet" href="https://unpkg.com/swiper/css/swiper.min.css"> --> | ||
| 26 | + | ||
| 27 | + <script src="https://cdn.bootcdn.net/ajax/libs/Swiper/5.4.5/js/swiper.js"></script> | ||
| 28 | + | ||
| 24 | <style> | 29 | <style> |
| 25 | .all_told, .platen_number { | 30 | .all_told, .platen_number { |
| 26 | text-align: center; | 31 | text-align: center; |
| @@ -135,17 +140,17 @@ | @@ -135,17 +140,17 @@ | ||
| 135 | height: 100%; | 140 | height: 100%; |
| 136 | text-align: center; | 141 | text-align: center; |
| 137 | font-size: 20px; | 142 | font-size: 20px; |
| 138 | - background: rgba(0,0,0,.7); | 143 | + background: rgba(9,9,9,.5); |
| 139 | position: fixed; | 144 | position: fixed; |
| 140 | top:0; | 145 | top:0; |
| 141 | left: 0; | 146 | left: 0; |
| 142 | } | 147 | } |
| 143 | .strWrap{ | 148 | .strWrap{ |
| 144 | - width: 80%; | ||
| 145 | - background: #fff; | ||
| 146 | - border-radius: 4px; | ||
| 147 | - margin: 50px auto 0; | ||
| 148 | - padding: 0 10px 15px; | 149 | + margin: 20px auto 0; |
| 150 | + width: 330px; | ||
| 151 | + height: 431px; | ||
| 152 | + background: #FFFFFF; | ||
| 153 | + border-radius: 8px; | ||
| 149 | } | 154 | } |
| 150 | .strCon{ | 155 | .strCon{ |
| 151 | text-align: center; | 156 | text-align: center; |
| @@ -176,14 +181,67 @@ | @@ -176,14 +181,67 @@ | ||
| 176 | .hiddenBtn{ | 181 | .hiddenBtn{ |
| 177 | background: #79cbbf; | 182 | background: #79cbbf; |
| 178 | } | 183 | } |
| 179 | - .outBtn{ | ||
| 180 | - background: #509f93; | 184 | + /*.outBtn{*/ |
| 185 | + /*background: #509f93;*/ | ||
| 186 | + /*}*/ | ||
| 187 | + .tipTitle{ | ||
| 188 | + /*background: url("img/tipTitle.png") no-repeat 0 center;*/ | ||
| 189 | + margin-top: 20px; | ||
| 190 | + font-size: 14px; | ||
| 191 | + text-align: center; | ||
| 192 | + font-weight: 500; | ||
| 193 | + color: #333333; | ||
| 194 | + line-height: 20px; | ||
| 195 | + } | ||
| 196 | + .carNum{ | ||
| 197 | + width: 270px; | ||
| 198 | + height: 80px; | ||
| 199 | + margin: 20px auto; | ||
| 200 | + font-size: 24px; | ||
| 201 | + font-family: PingFang-SC-Medium, PingFang-SC; | ||
| 202 | + font-weight: 500; | ||
| 203 | + color: #FFFFFF; | ||
| 204 | + text-align: center; | ||
| 205 | + line-height: 80px; | ||
| 206 | + background: url("img/carNum.png") no-repeat; | ||
| 207 | + } | ||
| 208 | + .carNumYellow{ | ||
| 209 | + background: url("img/carNumYellow.png") no-repeat; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + .toPay{ | ||
| 213 | + width: 270px; | ||
| 214 | + height: 45px; | ||
| 215 | + line-height: 45px; | ||
| 216 | + text-align: center; | ||
| 217 | + margin: 0 auto; | ||
| 218 | + font-size: 16px; | ||
| 219 | + font-family: PingFang-SC-Medium, PingFang-SC; | ||
| 220 | + font-weight: 500; | ||
| 221 | + color: #333333; | ||
| 222 | + background: url("img/topay.png") no-repeat; | ||
| 223 | + cursor: pointer; | ||
| 224 | + } | ||
| 225 | + .toSelect{ | ||
| 226 | + width: 270px; | ||
| 227 | + margin: 20px auto 0; | ||
| 228 | + text-align: right; | ||
| 229 | + font-size: 12px; | ||
| 230 | + font-family: PingFang-SC-Medium, PingFang-SC; | ||
| 231 | + font-weight: 500; | ||
| 232 | + color: #333333; | ||
| 233 | + cursor: pointer; | ||
| 234 | + } | ||
| 235 | + .swiper-container { | ||
| 236 | + width: 100%; | ||
| 237 | + height: 165px; | ||
| 238 | + | ||
| 181 | } | 239 | } |
| 182 | 240 | ||
| 183 | </style> | 241 | </style> |
| 184 | </head> | 242 | </head> |
| 185 | <body ontouchstart=""> | 243 | <body ontouchstart=""> |
| 186 | -<!--<div id="tip-title" class="weui-cells__title" style="color: #f00;text-align: center">48小时限时补缴优惠</div>--> | 244 | +<div id="tip-title" class="weui-cells__title" style="color: #f00;text-align: center"></div> |
| 187 | <div id="pay_listcont"> | 245 | <div id="pay_listcont"> |
| 188 | 246 | ||
| 189 | </div> | 247 | </div> |
| @@ -207,11 +265,39 @@ | @@ -207,11 +265,39 @@ | ||
| 207 | 265 | ||
| 208 | <div class="strTip" id="strTip"> | 266 | <div class="strTip" id="strTip"> |
| 209 | <div class="strWrap"> | 267 | <div class="strWrap"> |
| 210 | - <div class="header-title">车牌号码确认信息提示</div> | ||
| 211 | - <div style="font-size: 13px;color: #333;padding: 15px 0;">请确认您当前缴费的车牌号码</div> | ||
| 212 | - <div class="strCon"><span class="payCarNum" id="payCarNum"></span></div> | ||
| 213 | - <div class="btn hiddenBtn" style="margin: 15px 0">是我的车,去支付</div> | ||
| 214 | - <div class="btn outBtn">不是我的车,手动输入车牌号</div> | 268 | + <div class="swiper-container"> |
| 269 | + <div class="swiper-wrapper" id="swiper-wrapper"> | ||
| 270 | + <!--<div class="swiper-slide">--> | ||
| 271 | + <!----> | ||
| 272 | + <!--</div>--> | ||
| 273 | + <!--<div class="swiper-slide">Slide 2</div>--> | ||
| 274 | + <!--<div class="swiper-slide">Slide 3</div>--> | ||
| 275 | + </div> | ||
| 276 | + <!-- 如果需要分页器 --> | ||
| 277 | + <div class="swiper-pagination"></div> | ||
| 278 | + | ||
| 279 | + <!--<!– 如果需要导航按钮 –>--> | ||
| 280 | + <!--<div class="swiper-button-prev"></div>--> | ||
| 281 | + <!--<div class="swiper-button-next"></div>--> | ||
| 282 | + | ||
| 283 | + <!--<!– 如果需要滚动条 –>--> | ||
| 284 | + <!--<div class="swiper-scrollbar"></div>--> | ||
| 285 | + </div> | ||
| 286 | + | ||
| 287 | + <div class="tipTitle"> | ||
| 288 | + <img src="img/tipTitle.png" alt="" style="vertical-align: bottom;margin-right: 10px"> 请确认您当前缴费车牌号 | ||
| 289 | + </div> | ||
| 290 | + <div class="carNum"> | ||
| 291 | + <!--蒙D T839E--> | ||
| 292 | + </div> | ||
| 293 | + | ||
| 294 | + <div class="toPay hiddenBtn"> | ||
| 295 | + 是我的车,去支付 | ||
| 296 | + </div> | ||
| 297 | + | ||
| 298 | + <div class="toSelect outBtn"> | ||
| 299 | + 不是我的车,手动输入 | ||
| 300 | + </div> | ||
| 215 | </div> | 301 | </div> |
| 216 | </div> | 302 | </div> |
| 217 | 303 | ||
| @@ -243,6 +329,50 @@ | @@ -243,6 +329,50 @@ | ||
| 243 | } | 329 | } |
| 244 | } | 330 | } |
| 245 | })(); | 331 | })(); |
| 332 | + | ||
| 333 | + | ||
| 334 | +activityQuery() | ||
| 335 | +function activityQuery() { | ||
| 336 | + // mUrl.activity = cepath + '/activity/queryActivityListByOrgId' | ||
| 337 | + var salt = jsajax.salt(32); | ||
| 338 | + var jsondata = { | ||
| 339 | + app_id: '0eca8f5373ca4866aec2f8e9d9367104', | ||
| 340 | + deviceInfo: 'BC0703A4-AFB0-4B51-9089-9B7487C0CC6E', | ||
| 341 | + salt: salt, | ||
| 342 | + sign_type: 'md5', | ||
| 343 | + sign: '1', | ||
| 344 | + orgId: '10003', | ||
| 345 | + jumpType: '7' | ||
| 346 | + //token:token | ||
| 347 | + }; | ||
| 348 | + jsondata = JSON.stringify(jsondata); | ||
| 349 | + jsajax.defaultReq( | ||
| 350 | + // 'http://39.98.58.92:8090/activity/queryActivityListByOrgId', | ||
| 351 | + | ||
| 352 | + mUrl.queryActivityListByJumpType, | ||
| 353 | + jsondata, | ||
| 354 | + function (data) { | ||
| 355 | + console.log(data.data); | ||
| 356 | + var res = data.data | ||
| 357 | + $.each(res, function (i, item) { | ||
| 358 | + console.log(item.url) | ||
| 359 | + $('#swiper-wrapper').append('<div class="swiper-slide" style="background: url(' + item.url + ') no-repeat;background-size: 100% 100%"></div>') | ||
| 360 | + }) | ||
| 361 | + | ||
| 362 | + var mySwiper = new Swiper('.swiper-container', { | ||
| 363 | + | ||
| 364 | + loop: true, // 循环模式选项 | ||
| 365 | + autoplay: true,//可选选项,自动滑动 | ||
| 366 | + // 如果需要分页器 | ||
| 367 | + pagination: { | ||
| 368 | + el: '.swiper-pagination', | ||
| 369 | + }, | ||
| 370 | + | ||
| 371 | + }) | ||
| 372 | + | ||
| 373 | + } | ||
| 374 | + ); | ||
| 375 | +} | ||
| 246 | </script> | 376 | </script> |
| 247 | <script src="js/list.js?h=11141.31"></script> | 377 | <script src="js/list.js?h=11141.31"></script> |
| 248 | </body> | 378 | </body> |