Commit 38872959fd0985c8aeb81bc26379940aa046aad8
1 parent
09de38e2
支付 欠费支付
Showing
3 changed files
with
110 additions
and
120 deletions
home.html
| ... | ... | @@ -83,10 +83,13 @@ |
| 83 | 83 | |
| 84 | 84 | |
| 85 | 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 | 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 | 93 | </body> |
| 91 | 94 | |
| 92 | 95 | </html> | ... | ... |
js/config.js
| ... | ... | @@ -53,6 +53,9 @@ webAppH5.zeroPayServer = "/appAccountPay/zeroPay"; |
| 53 | 53 | // 新接口银联 |
| 54 | 54 | webAppH5.doPay = "/unionpay/doPay"; |
| 55 | 55 | |
| 56 | + | |
| 57 | +webAppH5.doOrderCreate = '/unionpay/doOrderCreate'; | |
| 58 | + | |
| 56 | 59 | /*入场参数*/ |
| 57 | 60 | //测试地址 |
| 58 | 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 | 238 | console.log(res) |
| 239 | 239 | if (res.code == 0) { |
| 240 | 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 | 242 | } else { |
| 251 | 243 | alert(res.message) |
| 252 | - // $discountBtn.disabled = false | |
| 253 | - // document.getElementById("discountTip").innerHTML = res.message | |
| 254 | 244 | } |
| 255 | 245 | }) |
| 256 | 246 | } else { |
| ... | ... | @@ -260,36 +250,7 @@ var webAppClass = { |
| 260 | 250 | //alert(clientType); |
| 261 | 251 | switch (clientType) { |
| 262 | 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 | 254 | webAppClass.payAjaxJDK(orderID); |
| 294 | 255 | console.log("wxPay");//微信支付 |
| 295 | 256 | break; |
| ... | ... | @@ -298,25 +259,15 @@ var webAppClass = { |
| 298 | 259 | //订单号 |
| 299 | 260 | var obj = {}; |
| 300 | 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 | 271 | break; |
| 321 | 272 | default://第三方浏览器other |
| 322 | 273 | //默认支付宝 |
| ... | ... | @@ -326,41 +277,28 @@ var webAppClass = { |
| 326 | 277 | var obj = {}; |
| 327 | 278 | //this.payAjax(url, { orderId: "11111", price: 0.01 }); |
| 328 | 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 | 290 | } else {//微信页面支付 |
| 346 | 291 | var url = " https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx20161110163838f231619da20804912345&package=1037687096"; |
| 347 | 292 | //window.location.href = url; |
| 348 | 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 | 302 | console.log("wxPay"); |
| 365 | 303 | } |
| 366 | 304 | break; |
| ... | ... | @@ -488,7 +426,49 @@ var webAppClass = { |
| 488 | 426 | //alert(JSON.stringify(res)); |
| 489 | 427 | if (res.code == 0) { |
| 490 | 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 | 472 | } else if (res.code == 40163) {//code been used, hints[重复code问题] |
| 493 | 473 | |
| 494 | 474 | alertMsg(appState.codeNullTip); |
| ... | ... | @@ -511,32 +491,9 @@ var webAppClass = { |
| 511 | 491 | //} |
| 512 | 492 | }, |
| 513 | 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 | 497 | var jsondata = utilParams(2,orderID,openId); |
| 541 | 498 | |
| 542 | 499 | var payParamsUrl = webAppRoot + window.webAppH5.doPay; |
| ... | ... | @@ -753,4 +710,31 @@ function utilParams(val,orderID,openId) { |
| 753 | 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 | ... | ... |