Commit 6ab7cc8c3fe8ce7be4cfb0449b0663282028648b

Authored by liuqimichale
1 parent 48832909

赤峰 微信支付

src/components/orderPay.vue
@@ -76,7 +76,7 @@ export default { @@ -76,7 +76,7 @@ export default {
76 methods: { 76 methods: {
77 getCode() { 77 getCode() {
78 var appID = this.$utils.myVxAppId; 78 var appID = this.$utils.myVxAppId;
79 - var code = this.getUrlParamfunction(code) 79 + var code = this.getUrlParam('code');
80 var local = window.location.href; 80 var local = window.location.href;
81 if (code == null || code === '') { 81 if (code == null || code === '') {
82 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' 82 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'
@@ -84,7 +84,7 @@ export default { @@ -84,7 +84,7 @@ export default {
84 return code; 84 return code;
85 } 85 }
86 }, 86 },
87 - getUrlParamfunction(name) { 87 + getUrlParam(name) {
88 var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); 88 var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
89 var r = window.location.search.substr(1).match(reg) 89 var r = window.location.search.substr(1).match(reg)
90 if (r != null) return unescape(r[2]) 90 if (r != null) return unescape(r[2])
@@ -149,6 +149,7 @@ export default { @@ -149,6 +149,7 @@ export default {
149 149
150 }, 150 },
151 vxPay(openIdData, orderIdData) { 151 vxPay(openIdData, orderIdData) {
  152 + let vm = this
152 var wxParams = {}; 153 var wxParams = {};
153 wxParams.orderId = orderIdData; 154 wxParams.orderId = orderIdData;
154 wxParams.backType = 2, 155 wxParams.backType = 2,
@@ -162,7 +163,6 @@ export default { @@ -162,7 +163,6 @@ export default {
162 wxParams.appId = this.$utils.myVxAppId; 163 wxParams.appId = this.$utils.myVxAppId;
163 vxPayQuery(wxParams).then(res => { 164 vxPayQuery(wxParams).then(res => {
164 if (res.code == 0) { // 165 if (res.code == 0) { //
165 - //alertMsg("出场成功");  
166 if (res.data) { 166 if (res.data) {
167 var data = res.data; 167 var data = res.data;
168 console.log(JSON.stringify(data)); 168 console.log(JSON.stringify(data));
@@ -186,9 +186,8 @@ export default { @@ -186,9 +186,8 @@ export default {
186 } 186 }
187 }) 187 })
188 }, 188 },
189 - onBridgeReady(data) { 189 + onBridgeReady(params) {
190 console.log('调用微信支付WeixinJSBridge') 190 console.log('调用微信支付WeixinJSBridge')
191 - var vm = this  
192 WeixinJSBridge.invoke( 191 WeixinJSBridge.invoke(
193 'getBrandWCPayRequest', params, 192 'getBrandWCPayRequest', params,
194 // 193 //
@@ -204,6 +203,7 @@ export default { @@ -204,6 +203,7 @@ export default {
204 // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 203 // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
205 if (res.err_msg === 'get_brand_wcpay_request:ok') { 204 if (res.err_msg === 'get_brand_wcpay_request:ok') {
206 console.log('成功') 205 console.log('成功')
  206 + alert('支付成功')
207 } else { 207 } else {
208 console.log('失败') 208 console.log('失败')
209 alert('支付失败') 209 alert('支付失败')
src/components/parkRecord.vue
@@ -310,12 +310,14 @@ export default { @@ -310,12 +310,14 @@ export default {
310 console.log(response) 310 console.log(response)
311 let res = response.data.carArrearages[0] 311 let res = response.data.carArrearages[0]
312 console.log(res) 312 console.log(res)
  313 +
313 this.orderIds = JSON.stringify(this.orderIds) 314 this.orderIds = JSON.stringify(this.orderIds)
  315 + console.log(this.orderIds)
314 this.$router.push( 316 this.$router.push(
315 { 317 {
316 path:'orderPay', 318 path:'orderPay',
317 query:{ 319 query:{
318 - carColor:0,// 车牌颜色 320 + carColor: this.carColor,// 车牌颜色
319 arrearageTotalFee: res.arrearageTotalFee,// 应收 321 arrearageTotalFee: res.arrearageTotalFee,// 应收
320 arrearageDiscFee: res.arrearageDiscFee,// 优惠 322 arrearageDiscFee: res.arrearageDiscFee,// 优惠
321 arrearageActFee: res.arrearageActFee,// 实收 323 arrearageActFee: res.arrearageActFee,// 实收
src/utils/utils.js
@@ -95,7 +95,7 @@ export default { @@ -95,7 +95,7 @@ export default {
95 95
96 myDeviceInfo: 'BC0703A4-AFB0-4B51-9089-9B7487C0CC6E', // 公共请求设备信息 96 myDeviceInfo: 'BC0703A4-AFB0-4B51-9089-9B7487C0CC6E', // 公共请求设备信息
97 97
98 - myVxAppId: 'wx2af2bab90d433c86', 98 + myVxAppId: 'wxff4cebaedbf4f886',
99 // 测试环境 微信赤峰 appid wxff4cebaedbf4f886 99 // 测试环境 微信赤峰 appid wxff4cebaedbf4f886
100 // 微信赤峰 appid wx2af2bab90d433c86 100 // 微信赤峰 appid wx2af2bab90d433c86
101 // 黄石 appid wxa1a66cc7d263afe6 101 // 黄石 appid wxa1a66cc7d263afe6