56
56
<!-- 展示形式:Form -->
57
57
<div ref =" formRef" v-html =" form.value" />
58
58
59
+ <!-- 展示形式:BarCode 条形码 -->
60
+ <el-dialog :title =" barCode.title" :visible.sync =" barCode.visible" width =" 500px" append-to-body
61
+ :close-on-press-escape =" false" >
62
+ <el-form ref =" form" label-width =" 80px" >
63
+ <el-row >
64
+ <el-col :span =" 24" >
65
+ <el-form-item label =" 条形码" prop =" name" >
66
+ <el-input v-model =" barCode.value" placeholder =" 请输入条形码" required />
67
+ </el-form-item >
68
+ </el-col >
69
+ <el-col :span =" 24" >
70
+ <div style =" text-align : right " >
71
+ 或使用
72
+ <el-link type =" danger" target =" _blank"
73
+ href =" https://baike.baidu.com/item/条码支付/10711903" >(扫码枪/扫码盒)</el-link >
74
+ 扫码
75
+ </div >
76
+ </el-col >
77
+ </el-row >
78
+ </el-form >
79
+ <div slot =" footer" class =" dialog-footer" >
80
+ <el-button type =" primary" @click =" submit0(barCode.channelCode)"
81
+ :disabled =" barCode.value.length === 0" >确认支付</el-button >
82
+ <el-button @click =" barCode.visible = false" >取 消</el-button >
83
+ </div >
84
+ </el-dialog >
59
85
</div >
60
86
</template >
61
87
<script >
@@ -104,6 +130,7 @@ export default {
104
130
html: ' ' ,
105
131
},
106
132
barCode: { // 展示形式:条形码
133
+ channelCode: ' ' ,
107
134
value: ' ' ,
108
135
title: ' ' ,
109
136
visible: false ,
@@ -163,7 +190,12 @@ export default {
163
190
submit (channelCode ) {
164
191
// 条形码支付,需要特殊处理
165
192
if (channelCode === PayChannelEnum .ALIPAY_BAR .code ) {
166
-
193
+ this .barCode = {
194
+ channelCode: channelCode,
195
+ value: ' ' ,
196
+ title: ' “支付宝”条码支付' ,
197
+ visible: true
198
+ }
167
199
return ;
168
200
}
169
201
@@ -190,7 +222,9 @@ export default {
190
222
191
223
// 打开轮询任务
192
224
this .createQueryInterval ()
193
- })
225
+ }).catch (() => {
226
+ this .submitLoading = false
227
+ });
194
228
},
195
229
/** 构建提交支付的额外参数 */
196
230
buildSubmitParam (channelCode ) {
@@ -232,12 +266,22 @@ export default {
232
266
// displayMode: PayDisplayModeEnum.FORM.mode
233
267
// }
234
268
}
269
+
235
270
// ② 支付宝 Wap 支付时,引导手机扫码支付
236
271
if (channelCode === PayChannelEnum .ALIPAY_WAP .code ) {
237
272
return {
238
273
displayMode: PayDisplayModeEnum .QR_CODE .mode
239
274
}
240
275
}
276
+
277
+ // ③ 支付宝 BarCode 支付时,需要传递 authCode 条形码
278
+ if (channelCode === PayChannelEnum .ALIPAY_BAR .code ) {
279
+ return {
280
+ " channelExtras" : {
281
+ " auth_code" : this .barCode .value
282
+ }
283
+ }
284
+ }
241
285
return {}
242
286
},
243
287
/** 提交支付后,IFrame 内置 URL 的展示形式 */
0 commit comments