Commit d29bf6026478ec4bc4e87b842890e37acbe04fc4
1 parent
dc296370
赤峰测试环境 农行支付
Showing
7 changed files
with
153 additions
and
25 deletions
src/api/orderPay/orderPay.js
@@ -28,7 +28,7 @@ export function vxPayQuery(params) { // 微信 | @@ -28,7 +28,7 @@ export function vxPayQuery(params) { // 微信 | ||
28 | 28 | ||
29 | export function bankH5Pay(params) { // 农行 | 29 | export function bankH5Pay(params) { // 农行 |
30 | return request({ | 30 | return request({ |
31 | - url: 'abcBankPay/bankH5Pay', | 31 | + url: 'abcBankPay/bankPayForH5', |
32 | method: 'post', | 32 | method: 'post', |
33 | data: params | 33 | data: params |
34 | }) | 34 | }) |
src/api/payResult/payResult.js
0 → 100644
src/assets/images/no.png
0 → 100644
19.2 KB
src/assets/images/ok.png
0 → 100644
29 KB
src/components/orderPay.vue
@@ -134,31 +134,64 @@ export default { | @@ -134,31 +134,64 @@ export default { | ||
134 | 134 | ||
135 | console.log(this.clientBrowser) | 135 | console.log(this.clientBrowser) |
136 | if (this.clientBrowser == '农行') { // 农行支付 | 136 | if (this.clientBrowser == '农行') { // 农行支付 |
137 | - var aliParams = {}; | ||
138 | - aliParams.orderId = this.orderId; | ||
139 | - aliParams.carNumber = this.carNumber; | ||
140 | - aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
141 | - aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
142 | - aliParams.paySrcType = this.paySrcType;//101停车支付 | ||
143 | - aliParams.orgId = this.$utils.myOrgId, | ||
144 | - aliParams.backType = 2, | ||
145 | - aliParams.PaymentLinkType = 1 | ||
146 | - aliParams.recordArreaInfos = JSON.stringify(this.orderId); | ||
147 | - console.log(aliParams) | ||
148 | - | ||
149 | - bankH5Pay(aliParams).then(response => { | 137 | + var bankabcParams = {}; |
138 | + bankabcParams.orderId = this.orderId; | ||
139 | + bankabcParams.carNumber = this.carNumber; | ||
140 | + bankabcParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
141 | + bankabcParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
142 | + bankabcParams.paySrcType = this.paySrcType;//101停车支付 | ||
143 | + bankabcParams.orgId = this.$utils.myOrgId, | ||
144 | + bankabcParams.backType = 2, | ||
145 | + bankabcParams.PaymentLinkType = 1 | ||
146 | + bankabcParams.recordArreaInfos = JSON.stringify(this.orderId); | ||
147 | + console.log(bankabcParams) | ||
148 | + | ||
149 | + bankH5Pay(bankabcParams).then(response => { | ||
150 | console.log(response) | 150 | console.log(response) |
151 | - let res = response.data | ||
152 | - let _token = res.split('TOKEN=')[1] | ||
153 | - console.log(_token) | ||
154 | - let _data = 'method=invokePayFromBrowser&tokenID='+_token | ||
155 | - let cryData = CryptoJS.encrypt(_data, 'G9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvM3', 'EkpTEA3FbZFGGq8Y') | ||
156 | - | ||
157 | - let baseCRY = Base64.encode(cryData) | ||
158 | - console.log(baseCRY) | ||
159 | - window.location.href='bankabc:' + encodeURIComponent('{"method":"invokePayFromBrowser","param":'+baseCRY+'}') | ||
160 | - // 即为加密后的数据。其中paramsEncode是需要加密的数据、 | ||
161 | - // keyStr是加密时使用的key,与服务端一致、hash是偏移量,是一个随机生成的16位字符串。 | 151 | + if(response.code=='0'){ |
152 | + let res = response.data.PaymentURL | ||
153 | + let _token = res.split('TOKEN=')[1] | ||
154 | + let OrderNo = response.data.OrderNo | ||
155 | + localStorage.setItem('OrderNum',OrderNo) | ||
156 | + | ||
157 | + | ||
158 | + if(window.navigator.userAgent.indexOf('Bankabc/Portal') > -1) { | ||
159 | + // alert('当前页面在新容器'); | ||
160 | + AlipayJSBridge.call('startApp',{ | ||
161 | + appId:'30603024', // 固定值 | ||
162 | + param:{ | ||
163 | + type:"3", // 3: 掌银内H5页面, | ||
164 | + tokenId:_token, //商户传过来的tokenId | ||
165 | + paySystem:"", //商户传过来的paySystem, 没有则传空字符串 | ||
166 | + payType:"1111", //商户传过来的payType,没有则传'1111' | ||
167 | + webviewURL:"", //商户传过来的回跳地址 | ||
168 | + remark:"其他参数", //扩展备用 | ||
169 | + showProgress:'NO', | ||
170 | + backBehavior:'back' | ||
171 | + }, | ||
172 | + },function(result){ | ||
173 | + | ||
174 | + }); | ||
175 | + } else { | ||
176 | + // alert('当前页面在旧容器'); | ||
177 | + // 旧支付方式 | ||
178 | + window.location.href = 'https://www.abchina.com/luascript/mobilePayLua/'+ encodeURI('{"return":{"tokenID":"'+_token+'","backURL":"https://wxgzh.renniting.cn/wechatwuxi/Chifeng/TEST/sweeping_payment/codepay/index.html#/payResult","payType":""}}'); | ||
179 | + | ||
180 | + } | ||
181 | + }else{ | ||
182 | + alert('请重新扫码') | ||
183 | + } | ||
184 | + | ||
185 | + | ||
186 | + // console.log(_token) | ||
187 | + // let _data = 'method=invokePayFromBrowser&tokenID='+_token | ||
188 | + // let cryData = CryptoJS.encrypt(_data, 'G9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvM3', 'EkpTEA3FbZFGGq8Y') | ||
189 | + // | ||
190 | + // let baseCRY = Base64.encode(cryData) | ||
191 | + // console.log(baseCRY) | ||
192 | + // window.location.href='bankabc:' + encodeURIComponent('{"method":"invokePayFromBrowser","param":'+baseCRY+'}') | ||
193 | + // // 即为加密后的数据。其中paramsEncode是需要加密的数据、 | ||
194 | + // // keyStr是加密时使用的key,与服务端一致、hash是偏移量,是一个随机生成的16位字符串。 | ||
162 | }) | 195 | }) |
163 | } | 196 | } |
164 | 197 |
src/components/payResult.vue
0 → 100644
1 | +<template> | ||
2 | + <div style="padding-top: 50px"> | ||
3 | + <div class="pay-result"> | ||
4 | + <div :style="{'background-image': 'url('+resultBG+')'}" class="result-bg"></div> | ||
5 | + <div>{{payMsg}}</div> | ||
6 | + </div> | ||
7 | + </div> | ||
8 | +</template> | ||
9 | + | ||
10 | +<script> | ||
11 | + | ||
12 | +import oKBg from '../assets/images/ok.png' | ||
13 | +import noBg from '../assets/images/no.png' | ||
14 | +import { queryBankOrderState } from '@/api/payResult/payResult' | ||
15 | + | ||
16 | +export default { | ||
17 | + name: 'payResult', | ||
18 | + data() { | ||
19 | + return { | ||
20 | + resultBG: '', | ||
21 | + payMsg: '支付成功', | ||
22 | + orderId:'' | ||
23 | + } | ||
24 | + }, | ||
25 | + created(){ | ||
26 | + // console.log(this.$route.query.ID) | ||
27 | + | ||
28 | + this.resultBG = oKBg | ||
29 | + this.orderId = localStorage.getItem("OrderNum") | ||
30 | + this.queryBankOrderState() | ||
31 | + // alert(window.location.href) | ||
32 | + // alert(this.$router.query.ID) | ||
33 | + }, | ||
34 | + mounted(){ | ||
35 | + // alert(window.location.href) | ||
36 | + }, | ||
37 | + methods:{ | ||
38 | + queryBankOrderState:function () { | ||
39 | + let me = this | ||
40 | + let params = { | ||
41 | + payOrderId : me.orderId | ||
42 | + } | ||
43 | + queryBankOrderState(params).then(response => { | ||
44 | + console.log(response) | ||
45 | + if(response.data.payResultEnum == 'PAY_SUCCESS'){ | ||
46 | + me.resultBG = oKBg | ||
47 | + me.payMsg = '支付成功' | ||
48 | + }else{ | ||
49 | + me.resultBG = noBg | ||
50 | + me.payMsg = '支付失败' | ||
51 | + } | ||
52 | + | ||
53 | + }) | ||
54 | + } | ||
55 | + } | ||
56 | + | ||
57 | +} | ||
58 | +</script> | ||
59 | + | ||
60 | +<style scoped lang="scss"> | ||
61 | + .pay-result { | ||
62 | + /*width: 150px;*/ | ||
63 | + margin: 0 auto; | ||
64 | + text-align: center; | ||
65 | + } | ||
66 | + .result-bg { | ||
67 | + display: inline-block; | ||
68 | + width: 70px; | ||
69 | + height: 70px; | ||
70 | + background-position: center 0; | ||
71 | + background-size: 100% 100%; | ||
72 | + } | ||
73 | + | ||
74 | + | ||
75 | +</style> |
src/router/index.js
@@ -35,6 +35,14 @@ export default new Router({ | @@ -35,6 +35,14 @@ export default new Router({ | ||
35 | component: () => import("@/components/orderPay.vue") | 35 | component: () => import("@/components/orderPay.vue") |
36 | }, | 36 | }, |
37 | 37 | ||
38 | + { | ||
39 | + path: '/payResult', | ||
40 | + name: 'payResult', | ||
41 | + component: () => import("@/components/payResult.vue") | ||
42 | + }, | ||
43 | + | ||
44 | + | ||
45 | + | ||
38 | 46 | ||
39 | ] | 47 | ] |
40 | }) | 48 | }) |