Commit 6ab7cc8c3fe8ce7be4cfb0449b0663282028648b

Authored by liuqimichale
1 parent 48832909

赤峰 微信支付

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