Commit 1d350d220e322b92865fda2de2fa798e4acec753
1 parent
b7e7599b
微信支付 完成
Showing
3 changed files
with
56 additions
and
4 deletions
src/api/orderPay/orderPay.js
| @@ -26,4 +26,16 @@ export function vxPayQuery(params) { // 微信 | @@ -26,4 +26,16 @@ export function vxPayQuery(params) { // 微信 | ||
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | +export function bankH5Pay(params) { // 农行 | ||
| 30 | + return request({ | ||
| 31 | + url: 'abcBankPay/bankH5Pay', | ||
| 32 | + method: 'post', | ||
| 33 | + data: params | ||
| 34 | + }) | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + | ||
| 29 | 41 |
src/components/orderPay.vue
| @@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
| 40 | </template> | 40 | </template> |
| 41 | 41 | ||
| 42 | <script> | 42 | <script> |
| 43 | -import { aliPay, getOpenId, vxPayQuery } from '@/api/orderPay/orderPay' | 43 | +import { aliPay, getOpenId, vxPayQuery, bankH5Pay } from '@/api/orderPay/orderPay' |
| 44 | 44 | ||
| 45 | export default { | 45 | export default { |
| 46 | name: 'orderPay', | 46 | name: 'orderPay', |
| @@ -72,6 +72,7 @@ export default { | @@ -72,6 +72,7 @@ export default { | ||
| 72 | if (this.clientBrowser == "微信") { | 72 | if (this.clientBrowser == "微信") { |
| 73 | this.webAppCode = this.getCode(); | 73 | this.webAppCode = this.getCode(); |
| 74 | } | 74 | } |
| 75 | + | ||
| 75 | }, | 76 | }, |
| 76 | methods: { | 77 | methods: { |
| 77 | getCode() { | 78 | getCode() { |
| @@ -128,6 +129,39 @@ export default { | @@ -128,6 +129,39 @@ export default { | ||
| 128 | }) | 129 | }) |
| 129 | } | 130 | } |
| 130 | 131 | ||
| 132 | + console.log(this.clientBrowser) | ||
| 133 | + if (this.clientBrowser == '农行') { // 农行支付 | ||
| 134 | + var aliParams = {}; | ||
| 135 | + aliParams.orderId = this.orderId; | ||
| 136 | + aliParams.carNumber = this.carNumber; | ||
| 137 | + aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
| 138 | + aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
| 139 | + aliParams.paySrcType = this.paySrcType;//101停车支付 | ||
| 140 | + aliParams.orgId = this.$utils.myOrgId, | ||
| 141 | + aliParams.backType = 2, | ||
| 142 | + aliParams.recordArreaInfos = JSON.stringify(this.orderId); | ||
| 143 | + console.log(aliParams) | ||
| 144 | + | ||
| 145 | + bankH5Pay(aliParams).then(response => { | ||
| 146 | + let res = response.data | ||
| 147 | + console.log(response.data) | ||
| 148 | + if (response.code == 0) {// | ||
| 149 | + window.open(response.data) | ||
| 150 | + // document.write(response.data);//打开支付表单 | ||
| 151 | + } else {//其他情况如【该卡号场内已存在】 | ||
| 152 | + alert(response.message) | ||
| 153 | + console.log(response.message); | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + }) | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + | ||
| 160 | + | ||
| 161 | + | ||
| 162 | + | ||
| 163 | + | ||
| 164 | + | ||
| 131 | if (this.clientBrowser == '微信') { // 微信支付 | 165 | if (this.clientBrowser == '微信') { // 微信支付 |
| 132 | //第一步获取openid | 166 | //第一步获取openid |
| 133 | var codeParams = { | 167 | var codeParams = { |
src/utils/utils.js
| @@ -79,10 +79,16 @@ export default { | @@ -79,10 +79,16 @@ export default { | ||
| 79 | return '微信' | 79 | return '微信' |
| 80 | } else if (/AlipayClient/.test(window.navigator.userAgent)) { | 80 | } else if (/AlipayClient/.test(window.navigator.userAgent)) { |
| 81 | console.log("支付宝客户端"); | 81 | console.log("支付宝客户端"); |
| 82 | - return '支付宝' | ||
| 83 | - } else { | 82 | + return '农行' |
| 83 | + } else if (/BankabciPhone/.test(window.navigator.userAgent)) { | ||
| 84 | + console.log("农行客户端"); | ||
| 85 | + return '农行' | ||
| 86 | + }else if (/BankabcAndroid/.test(window.navigator.userAgent)) { | ||
| 87 | + console.log("农行客户端"); | ||
| 88 | + return '农行' | ||
| 89 | + }else { | ||
| 84 | console.log("其他浏览器"); | 90 | console.log("其他浏览器"); |
| 85 | - return '支付宝' | 91 | + return '农行' |
| 86 | } | 92 | } |
| 87 | }, | 93 | }, |
| 88 | // 0eca8f5373ca4866aec2f8e9d9367104 老的id | 94 | // 0eca8f5373ca4866aec2f8e9d9367104 老的id |