455431ac
liuqimichale
欠费缴纳--费用支付
|
1
2
3
|
<template>
<div>
<div class="car-wrap">
|
26e543b8
liuqimichale
ajax 统一封装
|
4
5
|
<div class="carBG" :class="carWrapBG | formateColor">
<p class="carNumber">{{carNumber}}</p>
|
ae6e7e99
liuqimichale
支付方式
|
6
|
<p class="payFee">{{(arrearageActFee/100).toFixed(2)}}元</p>
|
455431ac
liuqimichale
欠费缴纳--费用支付
|
7
8
9
|
</div>
</div>
|
26e543b8
liuqimichale
ajax 统一封装
|
10
11
12
|
<ul class="fee-wrap">
<li>
<span>待缴金额</span>
|
ae6e7e99
liuqimichale
支付方式
|
13
|
<span>{{(arrearageActFee/100).toFixed(2)}}</span>
|
26e543b8
liuqimichale
ajax 统一封装
|
14
15
16
|
</li>
<li>
<span>优惠金额</span>
|
ae6e7e99
liuqimichale
支付方式
|
17
|
<span>{{(arrearageDiscFee/100).toFixed(2)}}</span>
|
26e543b8
liuqimichale
ajax 统一封装
|
18
19
20
|
</li>
<li>
<span>应付金额</span>
|
ae6e7e99
liuqimichale
支付方式
|
21
|
<span>{{(arrearageActFee/100).toFixed(2)}}</span>
|
26e543b8
liuqimichale
ajax 统一封装
|
22
23
24
|
</li>
</ul>
<div style="padding: 20px 18px">
|
3c184204
liuqimichale
支付方式 -- 支付宝
|
25
|
<div class="toPay" @click="toPay">{{clientBrowser}}支付</div>
|
26e543b8
liuqimichale
ajax 统一封装
|
26
27
|
</div>
|
7ddbff4d
liuqimichale
本次停车费用 出场
|
28
29
30
31
32
33
34
35
36
|
<div v-if="appOrderTimeout.length>0">
<p class="tip">
温馨提示:
</p>
<p style="color: #666;padding: 0 18px;">
{{appOrderTimeout}}
</p>
</div>
|
26e543b8
liuqimichale
ajax 统一封装
|
37
38
|
|
455431ac
liuqimichale
欠费缴纳--费用支付
|
39
40
41
42
|
</div>
</template>
<script>
|
1d350d22
liuqimichale
微信支付 完成
|
43
|
import { aliPay, getOpenId, vxPayQuery, bankH5Pay } from '@/api/orderPay/orderPay'
|
6b286309
liuqimichale
支付方式 -- 微信
|
44
|
|
455431ac
liuqimichale
欠费缴纳--费用支付
|
45
|
export default {
|
26e543b8
liuqimichale
ajax 统一封装
|
46
47
48
49
|
name: 'orderPay',
data() {
return {
carWrapBG: 0,
|
48832909
liuqimichale
赤峰 微信支付
|
50
|
carNumber: '',
|
ae6e7e99
liuqimichale
支付方式
|
51
|
arrearageActFee: 0,
|
6b286309
liuqimichale
支付方式 -- 微信
|
52
53
54
55
56
57
|
arrearageDiscFee: 0,
arrearageActFee: 0,
clientBrowser: '', // 客户端
paySrcType: '', //支付的类型 101 是本次 103是历史欠费
orderId: '', //支付的订单
webAppCode: '', // 微信code
|
7ddbff4d
liuqimichale
本次停车费用 出场
|
58
|
appOrderTimeout: '', // 超时描述
|
26e543b8
liuqimichale
ajax 统一封装
|
59
60
61
|
}
},
created() {
|
ae6e7e99
liuqimichale
支付方式
|
62
63
|
this.carWrapBG = this.$route.query.carColor //车牌颜色
this.carNumber = this.$route.query.carNumber
|
3c184204
liuqimichale
支付方式 -- 支付宝
|
64
65
66
|
this.arrearageTotalFee = this.$route.query.arrearageTotalFee // 应收
this.arrearageDiscFee = this.$route.query.arrearageDiscFee // 优惠
this.arrearageActFee = this.$route.query.arrearageActFee // 实收
|
ae6e7e99
liuqimichale
支付方式
|
67
|
this.clientBrowser = this.$utils.clientBrowser() //支付方式
|
6b286309
liuqimichale
支付方式 -- 微信
|
68
69
|
this.paySrcType = this.$route.query.paySrcType // 实收
this.orderId = this.$route.query.ordeID
|
c865a00f
liuqimichale
赤峰支付宝支付
|
70
|
console.log(this.orderId)
|
7ddbff4d
liuqimichale
本次停车费用 出场
|
71
|
this.appOrderTimeout = this.$route.query.appOrderTimeout
|
6b286309
liuqimichale
支付方式 -- 微信
|
72
73
74
|
if (this.clientBrowser == "微信") {
this.webAppCode = this.getCode();
}
|
1d350d22
liuqimichale
微信支付 完成
|
75
|
|
3c184204
liuqimichale
支付方式 -- 支付宝
|
76
|
},
|
6b286309
liuqimichale
支付方式 -- 微信
|
77
78
79
|
methods: {
getCode() {
var appID = this.$utils.myVxAppId;
|
6ab7cc8c
liuqimichale
赤峰 微信支付
|
80
|
var code = this.getUrlParam('code');
|
6b286309
liuqimichale
支付方式 -- 微信
|
81
82
83
84
85
86
87
|
var local = window.location.href;
if (code == null || code === '') {
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'
} else {
return code;
}
},
|
6ab7cc8c
liuqimichale
赤峰 微信支付
|
88
|
getUrlParam(name) {
|
c865a00f
liuqimichale
赤峰支付宝支付
|
89
90
91
92
93
|
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
var r = window.location.search.substr(1).match(reg)
if (r != null) return unescape(r[2])
return null
},
|
6b286309
liuqimichale
支付方式 -- 微信
|
94
95
96
|
toPay() {
let me = this
let _order = []
|
c865a00f
liuqimichale
赤峰支付宝支付
|
97
|
|
6b286309
liuqimichale
支付方式 -- 微信
|
98
99
|
console.log(this.orderId)
if (this.paySrcType == 103) {
|
c865a00f
liuqimichale
赤峰支付宝支付
|
100
|
this.orderId = JSON.parse(this.orderId)
|
6b286309
liuqimichale
支付方式 -- 微信
|
101
102
103
104
105
106
107
108
109
110
|
this.orderId.forEach(item => {
_order.push({
orderId: item
})
})
this.orderId = []
this.orderId = _order
}
if (this.clientBrowser == '支付宝') { // 支付宝支付
|
3c184204
liuqimichale
支付方式 -- 支付宝
|
111
|
var aliParams = {};
|
6b286309
liuqimichale
支付方式 -- 微信
|
112
|
aliParams.orderId = this.orderId;
|
3c184204
liuqimichale
支付方式 -- 支付宝
|
113
114
115
|
aliParams.carNumber = this.carNumber;
aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号
aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付
|
6b286309
liuqimichale
支付方式 -- 微信
|
116
117
|
aliParams.paySrcType = this.paySrcType;//101停车支付
aliParams.orgId = this.$utils.myOrgId,
|
e38fe48c
liuqimichale
接口跨域
|
118
119
|
aliParams.backType = 2,
aliParams.recordArreaInfos = JSON.stringify(this.orderId);
|
c865a00f
liuqimichale
赤峰支付宝支付
|
120
|
console.log(aliParams)
|
6b286309
liuqimichale
支付方式 -- 微信
|
121
122
123
124
125
126
127
128
129
|
aliPay(aliParams).then(response => {
console.log(response)
if (response.code == 0) {//进场
document.write(response.data);//打开支付表单
} else {//其他情况如【该卡号场内已存在】
console.log(response.message);
}
})
|
3c184204
liuqimichale
支付方式 -- 支付宝
|
130
131
|
}
|
1d350d22
liuqimichale
微信支付 完成
|
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
console.log(this.clientBrowser)
if (this.clientBrowser == '农行') { // 农行支付
var aliParams = {};
aliParams.orderId = this.orderId;
aliParams.carNumber = this.carNumber;
aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号
aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付
aliParams.paySrcType = this.paySrcType;//101停车支付
aliParams.orgId = this.$utils.myOrgId,
aliParams.backType = 2,
aliParams.recordArreaInfos = JSON.stringify(this.orderId);
console.log(aliParams)
bankH5Pay(aliParams).then(response => {
let res = response.data
console.log(response.data)
if (response.code == 0) {//
window.open(response.data)
// document.write(response.data);//打开支付表单
} else {//其他情况如【该卡号场内已存在】
alert(response.message)
console.log(response.message);
}
})
}
|
6b286309
liuqimichale
支付方式 -- 微信
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
if (this.clientBrowser == '微信') { // 微信支付
//第一步获取openid
var codeParams = {
code: this.webAppCode,
appId: this.$utils.myVxAppId
};
getOpenId(codeParams).then(res => {
if (res.code == 0) {
me.vxPay(res.data, this.orderId)
} else if (res.code == 40163) { //code been used, hints[重复code问题]
alert(res.message)
console.log(res.message);
} else {
alert(res.message)
}
})
|
3c184204
liuqimichale
支付方式 -- 支付宝
|
181
|
|
6b286309
liuqimichale
支付方式 -- 微信
|
182
183
184
185
|
}
},
vxPay(openIdData, orderIdData) {
|
6ab7cc8c
liuqimichale
赤峰 微信支付
|
186
|
let vm = this
|
6b286309
liuqimichale
支付方式 -- 微信
|
187
188
189
|
var wxParams = {};
wxParams.orderId = orderIdData;
wxParams.backType = 2,
|
48832909
liuqimichale
赤峰 微信支付
|
190
191
|
wxParams.orgId = this.$utils.myOrgId,
wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号
|
6b286309
liuqimichale
支付方式 -- 微信
|
192
193
194
195
196
197
|
wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付
wxParams.carNumber = this.carNumber;
wxParams.paySrcType = this.paySrcType;//101停车支付
wxParams.recordArreaInfos = JSON.stringify(orderIdData);
wxParams.openId = openIdData;
wxParams.appId = this.$utils.myVxAppId;
|
c865a00f
liuqimichale
赤峰支付宝支付
|
198
|
vxPayQuery(wxParams).then(res => {
|
6b286309
liuqimichale
支付方式 -- 微信
|
199
|
if (res.code == 0) { //
|
6b286309
liuqimichale
支付方式 -- 微信
|
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
if (res.data) {
var data = res.data;
console.log(JSON.stringify(data));
if (typeof WeixinJSBridge === 'undefined') { // 微信浏览器内置对象。参考微信官方文档
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', vm.onBridgeReady(data), false)
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', vm.onBridgeReady(data))
document.attachEvent('onWeixinJSBridgeReady', vm.onBridgeReady(data))
}
} else {
console.log('准备调用微信支付')
vm.onBridgeReady(data)
}
} else {
alert("没有找到返回值");
}
} else {
console.log(res.message);
alert(res.message);
}
})
},
|
6ab7cc8c
liuqimichale
赤峰 微信支付
|
223
|
onBridgeReady(params) {
|
6b286309
liuqimichale
支付方式 -- 微信
|
224
|
console.log('调用微信支付WeixinJSBridge')
|
6b286309
liuqimichale
支付方式 -- 微信
|
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
WeixinJSBridge.invoke(
'getBrandWCPayRequest', params,
//
// 'getBrandWCPayRequest', { // 下面参数内容都是后台返回的
// 'appId': data.appId, // 公众号名称,由商户传入
// 'timeStamp': data.timeStamp, // 时间戳
// 'nonceStr': data.nonceStr, // 随机串
// 'package': data.package, // 预支付id
// 'signType': data.signType, // 微信签名方式
// 'paySign': data.paySign // 微信签名
// },
function (res) {
// 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
if (res.err_msg === 'get_brand_wcpay_request:ok') {
|
c865a00f
liuqimichale
赤峰支付宝支付
|
239
|
console.log('成功')
|
6ab7cc8c
liuqimichale
赤峰 微信支付
|
240
|
alert('支付成功')
|
6b286309
liuqimichale
支付方式 -- 微信
|
241
242
243
244
245
246
247
|
} else {
console.log('失败')
alert('支付失败')
}
}
)
},
|
26e543b8
liuqimichale
ajax 统一封装
|
248
|
},
|
6b286309
liuqimichale
支付方式 -- 微信
|
249
|
filters: {
|
26e543b8
liuqimichale
ajax 统一封装
|
250
|
}
|
455431ac
liuqimichale
欠费缴纳--费用支付
|
251
252
253
254
255
256
|
}
</script>
<style scoped lang="scss">
.car-wrap {
padding: 7px 7px;
|
26e543b8
liuqimichale
ajax 统一封装
|
257
|
background: #FFF;
|
455431ac
liuqimichale
欠费缴纳--费用支付
|
258
259
260
261
262
|
}
.carBG {
width: 100%;
height: 130px;
|
26e543b8
liuqimichale
ajax 统一封装
|
263
|
}
|
6b286309
liuqimichale
支付方式 -- 微信
|
264
265
|
.carBlue {
|
26e543b8
liuqimichale
ajax 统一封装
|
266
267
268
|
background: url("../assets/images/blueBG.png") no-repeat;
background-size: 100% 100%;
}
|
6b286309
liuqimichale
支付方式 -- 微信
|
269
270
|
.carYellow {
|
455431ac
liuqimichale
欠费缴纳--费用支付
|
271
272
273
|
background: url("../assets/images/yellowBG.png") no-repeat;
background-size: 100% 100%;
}
|
6b286309
liuqimichale
支付方式 -- 微信
|
274
275
|
.carGreen {
|
26e543b8
liuqimichale
ajax 统一封装
|
276
277
278
|
background: url("../assets/images/greenBG.png") no-repeat;
background-size: 100% 100%;
}
|
6b286309
liuqimichale
支付方式 -- 微信
|
279
280
|
.carWhite {
|
26e543b8
liuqimichale
ajax 统一封装
|
281
282
283
|
background: url("../assets/images/whiteBG.png") no-repeat;
background-size: 100% 100%;
}
|
6b286309
liuqimichale
支付方式 -- 微信
|
284
285
|
.carBlack {
|
26e543b8
liuqimichale
ajax 统一封装
|
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
background: url("../assets/images/blackBG.png") no-repeat;
background-size: 100% 100%;
}
.carNumber {
padding: 20px 0 10px;
font-size: 30px;
color: #fff;
text-align: center;
}
.payFee {
font-size: 24px;
color: #FF7B7B;
text-align: center;
}
.fee-wrap {
background: #FFF;
padding: 0 18px;
> li {
display: flex;
justify-content: space-between;
height: 30px;
line-height: 30px;
border-bottom: 1px solid #EAEAEA;
&:last-child {
border-bottom: 0;
}
}
}
.toPay {
width: 100%;
height: 44px;
margin: 0 auto;
line-height: 44px;
text-align: center;
background: linear-gradient(180deg, #3885D9 0%, #4194EF 100%);
border-radius: 4px;
border: 1px solid #0D72E2;
font-size: 20px;
color: #FFF;
cursor: pointer;
}
|
6b286309
liuqimichale
支付方式 -- 微信
|
332
333
|
.tip {
|
26e543b8
liuqimichale
ajax 统一封装
|
334
|
padding-left: 40px;
|
b137bb0e
liuqimichale
扫码后 车牌是否 咨询页面
|
335
|
background: url("../assets/images/tip.png") no-repeat 18px center;
|
26e543b8
liuqimichale
ajax 统一封装
|
336
337
338
|
background-size: 16px 16px;
color: #666;
}
|
455431ac
liuqimichale
欠费缴纳--费用支付
|
339
|
</style>
|