Commit 38872959fd0985c8aeb81bc26379940aa046aad8
1 parent
09de38e2
支付 欠费支付
Showing
3 changed files
with
110 additions
and
120 deletions
home.html
| @@ -83,10 +83,13 @@ | @@ -83,10 +83,13 @@ | ||
| 83 | 83 | ||
| 84 | 84 | ||
| 85 | <script src="js/jquery-3.2.1.min.js"></script> | 85 | <script src="js/jquery-3.2.1.min.js"></script> |
| 86 | -<script src="js/config.js?c=8.1"></script> | ||
| 87 | -<script src="js/common.js?b=4.11"></script> | 86 | + |
| 87 | +<script src="js/config.js?c=00.1"></script> | ||
| 88 | +<script src="js/common.js?b=411.11"></script> | ||
| 89 | +<script src="js/url.js?S=888.60"></script> | ||
| 90 | +<script src="js/ajax.js?S=84518.60"></script> | ||
| 88 | <!--<script src="js/jweixin-1.0.0.js?v=0.1"></script>--> | 91 | <!--<script src="js/jweixin-1.0.0.js?v=0.1"></script>--> |
| 89 | -<script src="js/pay.js?S=88118.60"></script> | 92 | +<script src="js/pay.js?S=821111318.60"></script> |
| 90 | </body> | 93 | </body> |
| 91 | 94 | ||
| 92 | </html> | 95 | </html> |
js/config.js
| @@ -53,6 +53,9 @@ webAppH5.zeroPayServer = "/appAccountPay/zeroPay"; | @@ -53,6 +53,9 @@ webAppH5.zeroPayServer = "/appAccountPay/zeroPay"; | ||
| 53 | // 新接口银联 | 53 | // 新接口银联 |
| 54 | webAppH5.doPay = "/unionpay/doPay"; | 54 | webAppH5.doPay = "/unionpay/doPay"; |
| 55 | 55 | ||
| 56 | + | ||
| 57 | +webAppH5.doOrderCreate = '/unionpay/doOrderCreate'; | ||
| 58 | + | ||
| 56 | /*入场参数*/ | 59 | /*入场参数*/ |
| 57 | //测试地址 | 60 | //测试地址 |
| 58 | //http://localhost:18879/page/in.html?plNo=P11011700C&parkingId=1&channelId=172198242&direction=0&codeType=0&expireDate=expireDate&extendData=extendData | 61 | //http://localhost:18879/page/in.html?plNo=P11011700C&parkingId=1&channelId=172198242&direction=0&codeType=0&expireDate=expireDate&extendData=extendData |
js/pay.js
| @@ -238,19 +238,9 @@ var webAppClass = { | @@ -238,19 +238,9 @@ var webAppClass = { | ||
| 238 | console.log(res) | 238 | console.log(res) |
| 239 | if (res.code == 0) { | 239 | if (res.code == 0) { |
| 240 | document.getElementById("paySuccess").style.display = 'block' | 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 | 241 | + |
| 250 | } else { | 242 | } else { |
| 251 | alert(res.message) | 243 | alert(res.message) |
| 252 | - // $discountBtn.disabled = false | ||
| 253 | - // document.getElementById("discountTip").innerHTML = res.message | ||
| 254 | } | 244 | } |
| 255 | }) | 245 | }) |
| 256 | } else { | 246 | } else { |
| @@ -260,36 +250,7 @@ var webAppClass = { | @@ -260,36 +250,7 @@ var webAppClass = { | ||
| 260 | //alert(clientType); | 250 | //alert(clientType); |
| 261 | switch (clientType) { | 251 | switch (clientType) { |
| 262 | case "wxPay"://微信[内置浏览器] | 252 | 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 | - // //新增start | ||
| 271 | - // | ||
| 272 | - // var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; | ||
| 273 | - // //window.location.href = url; | ||
| 274 | - // var wxPay = webAppH5.wxPayServer; | ||
| 275 | - // var wxParams = webAppH5.comParams; | ||
| 276 | - // wxParams.carNumber = getQueryString(window.location).carnum; | ||
| 277 | - // wxParams.orderId = orderID; | ||
| 278 | - // wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 279 | - // wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 280 | - // | ||
| 281 | - // wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 282 | - // | ||
| 283 | - // wxParams.recordArreaInfos= JSON.stringify([{"orderId":webAppParams.orderId,"orderNotPayFee":_mon*100,"parkId":getQueryString(window.location).parkCode}]); | ||
| 284 | - // | ||
| 285 | - // //新增end | ||
| 286 | - | ||
| 287 | - // if (webAppCode == null || webAppCode == "") {//code检测 | ||
| 288 | - // alertMsg(appState.codeNullTip); | ||
| 289 | - // $btnObj.style.display = "block"; | ||
| 290 | - // $btnLoad.style.display = "none"; | ||
| 291 | - // return; | ||
| 292 | - // } | 253 | + |
| 293 | webAppClass.payAjaxJDK(orderID); | 254 | webAppClass.payAjaxJDK(orderID); |
| 294 | console.log("wxPay");//微信支付 | 255 | console.log("wxPay");//微信支付 |
| 295 | break; | 256 | break; |
| @@ -298,25 +259,15 @@ var webAppClass = { | @@ -298,25 +259,15 @@ var webAppClass = { | ||
| 298 | //订单号 | 259 | //订单号 |
| 299 | var obj = {}; | 260 | var obj = {}; |
| 300 | //this.payAjax(url, { orderId: "11111", price: 0.01 }); | 261 | //this.payAjax(url, { orderId: "11111", price: 0.01 }); |
| 301 | - var aliPay = webAppH5.doPay; | ||
| 302 | - // var aliParams = webAppH5.comParams; | ||
| 303 | - // aliParams.orderId = orderID; | ||
| 304 | - // aliParams.carNumber = getQueryString(window.location).carnum; | ||
| 305 | - // aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 306 | - // aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 307 | - // aliParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 308 | - // | ||
| 309 | - // aliParams.recordArreaInfos = JSON.stringify([{ | ||
| 310 | - // "orderId": webAppParams.orderId, | ||
| 311 | - // "orderNotPayFee": _mon * 100, | ||
| 312 | - // "parkId": getQueryString(window.location).parkCode | ||
| 313 | - // }]); | ||
| 314 | - // | ||
| 315 | - | ||
| 316 | - | ||
| 317 | - // webAppClass.payAliAjax(root + aliPay, aliParams); | ||
| 318 | - | ||
| 319 | - webAppClass.payAliAjax(doPayroot + aliPay,utilParams(1,orderID,'')); | 262 | + var aliPay = webAppH5.doPay; |
| 263 | + | ||
| 264 | + if(_paySrcType == 103){ | ||
| 265 | + doOrderCreate(orderID,aliPay) | ||
| 266 | + }else{ | ||
| 267 | + webAppClass.payAliAjax(doPayroot + aliPay,utilParams(1,orderID,'')); | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + | ||
| 320 | break; | 271 | break; |
| 321 | default://第三方浏览器other | 272 | default://第三方浏览器other |
| 322 | //默认支付宝 | 273 | //默认支付宝 |
| @@ -326,41 +277,28 @@ var webAppClass = { | @@ -326,41 +277,28 @@ var webAppClass = { | ||
| 326 | var obj = {}; | 277 | var obj = {}; |
| 327 | //this.payAjax(url, { orderId: "11111", price: 0.01 }); | 278 | //this.payAjax(url, { orderId: "11111", price: 0.01 }); |
| 328 | var aliPay = webAppH5.doPay; | 279 | var aliPay = webAppH5.doPay; |
| 329 | - // var aliParams = webAppH5.comParams; | ||
| 330 | - // aliParams.orderId = orderID; | ||
| 331 | - // aliParams.carNumber = getQueryString(window.location).carnum; | ||
| 332 | - // aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 333 | - // aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 334 | - // aliParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 335 | - // | ||
| 336 | - // aliParams.recordArreaInfos = JSON.stringify([{ | ||
| 337 | - // "orderId": webAppParams.orderId, | ||
| 338 | - // "orderNotPayFee": _mon * 100, | ||
| 339 | - // "parkId": getQueryString(window.location).parkCode | ||
| 340 | - // }]); | ||
| 341 | - | ||
| 342 | - // webAppClass.payAliAjax(root + aliPay, aliParams); | ||
| 343 | - webAppClass.payAliAjax(doPayroot + aliPay, utilParams(1,orderID,'')); | 280 | + |
| 281 | + if(_paySrcType == 103){ | ||
| 282 | + doOrderCreate(orderID,aliPay) | ||
| 283 | + }else{ | ||
| 284 | + webAppClass.payAliAjax(doPayroot + aliPay,utilParams(1,orderID,'')); | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + | ||
| 288 | + // webAppClass.payAliAjax(doPayroot + aliPay, utilParams(1,orderID,'')); | ||
| 344 | 289 | ||
| 345 | } else {//微信页面支付 | 290 | } else {//微信页面支付 |
| 346 | var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; | 291 | var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; |
| 347 | //window.location.href = url; | 292 | //window.location.href = url; |
| 348 | var wxPay = webAppH5.doPay; | 293 | var wxPay = webAppH5.doPay; |
| 349 | - // var wxParams = webAppH5.comParams; | ||
| 350 | - // wxParams.carNumber = getQueryString(window.location).carnum; | ||
| 351 | - // wxParams.orderId = orderID; | ||
| 352 | - // wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 353 | - // wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 354 | - // | ||
| 355 | - // wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 356 | - // | ||
| 357 | - // wxParams.recordArreaInfos = JSON.stringify([{ | ||
| 358 | - // "orderId": webAppParams.orderId, | ||
| 359 | - // "orderNotPayFee": _mon * 100, | ||
| 360 | - // "parkId": getQueryString(window.location).parkCode | ||
| 361 | - // }]); | ||
| 362 | - // webAppClass.payAjax(root + wxPay, wxParams); | ||
| 363 | - webAppClass.payAliAjax(doPayroot + wxPay,utilParams(1,orderID,'')); | 294 | + |
| 295 | + if(_paySrcType == 103){ | ||
| 296 | + doOrderCreate(orderID,aliPay) | ||
| 297 | + }else{ | ||
| 298 | + webAppClass.payAliAjax(doPayroot + wxPay,utilParams(2,orderID,'')); | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + // webAppClass.payAliAjax(doPayroot + wxPay,utilParams(1,orderID,'')); | ||
| 364 | console.log("wxPay"); | 302 | console.log("wxPay"); |
| 365 | } | 303 | } |
| 366 | break; | 304 | break; |
| @@ -488,7 +426,49 @@ var webAppClass = { | @@ -488,7 +426,49 @@ var webAppClass = { | ||
| 488 | //alert(JSON.stringify(res)); | 426 | //alert(JSON.stringify(res)); |
| 489 | if (res.code == 0) { | 427 | if (res.code == 0) { |
| 490 | //alert(res.data); | 428 | //alert(res.data); |
| 491 | - webAppClass.getPayParams(res.data, orderID); | 429 | + |
| 430 | + | ||
| 431 | + | ||
| 432 | + var _paySrcType = getQueryString(window.location)._paySrcType | ||
| 433 | + | ||
| 434 | + if(_paySrcType == 103){ | ||
| 435 | + // doOrderCreate(orderID,aliPay) | ||
| 436 | + | ||
| 437 | + | ||
| 438 | + // var paySrcType = getQueryString(window.location)._paySrcType | ||
| 439 | + // var salt = jsajax.salt(6); | ||
| 440 | + var jsondata = { | ||
| 441 | + orderBigType: 100, | ||
| 442 | + payOrderType:_paySrcType, | ||
| 443 | + parkOrderIds:[orderID], | ||
| 444 | + terminalSource: 7, | ||
| 445 | + operName:'', | ||
| 446 | + operCode:'', | ||
| 447 | + }; | ||
| 448 | + jsondata = JSON.stringify(jsondata); | ||
| 449 | + jsajax.defaultReq( | ||
| 450 | + webAppRoot+webAppH5.doOrderCreate, | ||
| 451 | + jsondata, | ||
| 452 | + function (data) { | ||
| 453 | + console.log('调用微信支付 ' + JSON.stringify(data)); | ||
| 454 | + if (data.code == 0) { | ||
| 455 | + var orderID = data.data.rltOrderId | ||
| 456 | + // webAppClass.payAliAjax(doPayroot + aliPay,utilParams(1,orderID,'')); | ||
| 457 | + webAppClass.getPayParams(res.data, orderID); | ||
| 458 | + } else { | ||
| 459 | + alert('失败') | ||
| 460 | + } | ||
| 461 | + } | ||
| 462 | + ); | ||
| 463 | + | ||
| 464 | + | ||
| 465 | + | ||
| 466 | + }else{ | ||
| 467 | + | ||
| 468 | + webAppClass.getPayParams(res.data, orderID); | ||
| 469 | + } | ||
| 470 | + | ||
| 471 | + | ||
| 492 | } else if (res.code == 40163) {//code been used, hints[重复code问题] | 472 | } else if (res.code == 40163) {//code been used, hints[重复code问题] |
| 493 | 473 | ||
| 494 | alertMsg(appState.codeNullTip); | 474 | alertMsg(appState.codeNullTip); |
| @@ -511,32 +491,9 @@ var webAppClass = { | @@ -511,32 +491,9 @@ var webAppClass = { | ||
| 511 | //} | 491 | //} |
| 512 | }, | 492 | }, |
| 513 | getPayParams: function (openId, orderID) { | 493 | getPayParams: function (openId, orderID) { |
| 514 | - // var wxPay = window.webAppH5.wxPayServer; | ||
| 515 | - // var wxParams = window.webAppH5.comParams; | ||
| 516 | - // var _mon = document.getElementById("sumMoney").innerHTML | ||
| 517 | - // wxParams.orderId = orderID; | ||
| 518 | - // wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 519 | - // wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 520 | - // //webAppClass.payAjax(root + wxPay, wxParams); | ||
| 521 | - // | ||
| 522 | - // //新增start | ||
| 523 | - // | ||
| 524 | - // wxParams.carNumber = getQueryString(window.location).carnum; | ||
| 525 | - // | ||
| 526 | - // wxParams.paySrcType = getQueryString(window.location)._paySrcType;//101停车支付 | ||
| 527 | - // | ||
| 528 | - // wxParams.recordArreaInfos = JSON.stringify([{ | ||
| 529 | - // "orderId": webAppParams.orderId, | ||
| 530 | - // "orderNotPayFee": _mon * 100, | ||
| 531 | - // "parkId": getQueryString(window.location).parkCode | ||
| 532 | - // }]); | ||
| 533 | - | ||
| 534 | - //新增end | ||
| 535 | - | ||
| 536 | - // wxParams.openId = openId; | ||
| 537 | - // wxParams.appId = appWxID; | ||
| 538 | - | ||
| 539 | - // var jsondata = JSON.stringify(utilParams(2,orderID,openId)); | 494 | + |
| 495 | + | ||
| 496 | + | ||
| 540 | var jsondata = utilParams(2,orderID,openId); | 497 | var jsondata = utilParams(2,orderID,openId); |
| 541 | 498 | ||
| 542 | var payParamsUrl = webAppRoot + window.webAppH5.doPay; | 499 | var payParamsUrl = webAppRoot + window.webAppH5.doPay; |
| @@ -753,4 +710,31 @@ function utilParams(val,orderID,openId) { | @@ -753,4 +710,31 @@ function utilParams(val,orderID,openId) { | ||
| 753 | return jsondata | 710 | return jsondata |
| 754 | } | 711 | } |
| 755 | 712 | ||
| 713 | +function doOrderCreate(orderID,aliPay){ | ||
| 714 | + var paySrcType = getQueryString(window.location)._paySrcType | ||
| 715 | + // var salt = jsajax.salt(6); | ||
| 716 | + var jsondata = { | ||
| 717 | + orderBigType: 100, | ||
| 718 | + payOrderType:paySrcType, | ||
| 719 | + parkOrderIds:[orderID], | ||
| 720 | + terminalSource: 7, | ||
| 721 | + operName:'', | ||
| 722 | + operCode:'', | ||
| 723 | + }; | ||
| 724 | + jsondata = JSON.stringify(jsondata); | ||
| 725 | + jsajax.defaultReq( | ||
| 726 | + doPayroot+webAppH5.doOrderCreate, | ||
| 727 | + jsondata, | ||
| 728 | + function (data) { | ||
| 729 | + console.log('调用微信支付 ' + JSON.stringify(data)); | ||
| 730 | + if (data.code == 0) { | ||
| 731 | + orderID = data.data.rltOrderId | ||
| 732 | + webAppClass.payAliAjax(doPayroot + aliPay,utilParams(1,orderID,'')); | ||
| 733 | + } else { | ||
| 734 | + alert('失败') | ||
| 735 | + } | ||
| 736 | + } | ||
| 737 | + ); | ||
| 738 | +} | ||
| 739 | + | ||
| 756 | 740 |