26
26
<!-- 微信支付 -->
27
27
<el-descriptions title =" 选择微信支付" style =" margin-top : 20px ;" />
28
28
<div class =" pay-channel-container" >
29
- <div class =" box" v-for =" channel in channels" v-if =" channel.code.indexOf('wx_') === 0" :key =" channel.code" >
29
+ <div class =" box" v-for =" channel in channels" v-if =" channel.code.indexOf('wx_') === 0" :key =" channel.code" @click = " submit(channel.code) " >
30
30
<img :src =" channel.icon" >
31
31
<div class =" title" >{{ channel.name }}</div >
32
32
</div >
@@ -125,6 +125,10 @@ export default {
125
125
name: ' 微信 App 支付' ,
126
126
icon: require (" @/assets/images/pay/icon/wx_app.svg" ),
127
127
code: " wx_app"
128
+ }, {
129
+ name: ' 微信条码支付' ,
130
+ icon: require (" @/assets/images/pay/icon/wx_bar.svg" ),
131
+ code: " wx_bar"
128
132
}, {
129
133
name: ' 模拟支付' ,
130
134
icon: require (" @/assets/images/pay/icon/mock.svg" ),
@@ -195,6 +199,15 @@ export default {
195
199
}
196
200
return ;
197
201
}
202
+ if (channelCode === PayChannelEnum .WX_BAR .code ) {
203
+ this .barCode = {
204
+ channelCode: channelCode,
205
+ value: ' ' ,
206
+ title: ' “微信”条码支付' ,
207
+ visible: true
208
+ }
209
+ return ;
210
+ }
198
211
199
212
// 默认的提交处理
200
213
this .submit0 (channelCode)
@@ -207,7 +220,16 @@ export default {
207
220
returnUrl: location .href , // 支付成功后,支付渠道跳转回当前页;再由当前页,跳转回 {@link returnUrl} 对应的地址
208
221
... this .buildSubmitParam (channelCode)
209
222
}).then (response => {
223
+ // 直接返回已支付的情况,例如说扫码支付
210
224
const data = response .data
225
+ if (data .status === PayOrderStatusEnum .SUCCESS .status ) {
226
+ this .clearQueryInterval ();
227
+ this .$message .success (' 支付成功!' );
228
+ this .goReturnUrl ();
229
+ return
230
+ }
231
+
232
+ // 展示对应的界面
211
233
if (data .displayMode === PayDisplayModeEnum .URL .mode ) {
212
234
this .displayUrl (channelCode, data)
213
235
} else if (data .displayMode === PayDisplayModeEnum .QR_CODE .mode ) {
@@ -230,11 +252,18 @@ export default {
230
252
}
231
253
}
232
254
}
255
+ // ② 微信 BarCode 支付时,需要传递 authCode 条形码
256
+ if (channelCode === PayChannelEnum .WX_BAR .code ) {
257
+ return {
258
+ " channelExtras" : {
259
+ " authCode" : this .barCode .value
260
+ }
261
+ }
262
+ }
233
263
return {}
234
264
},
235
265
/** 提交支付后,URL 的展示形式 */
236
266
displayUrl (channelCode , data ) {
237
- // window.open(data.displayContent)
238
267
location .href = data .displayContent
239
268
this .submitLoading = false
240
269
},
0 commit comments