Skip to content

Commit e6f3d6b

Browse files
committed
pay: 重构支付客户端,移除 PayCommonResult 累
1 parent 88fc72d commit e6f3d6b

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

src/views/pay/order/submit.vue

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,32 @@
5656
<!-- 展示形式:Form -->
5757
<div ref="formRef" v-html="form.value" />
5858

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>
5985
</div>
6086
</template>
6187
<script>
@@ -104,6 +130,7 @@ export default {
104130
html: '',
105131
},
106132
barCode: { // 展示形式:条形码
133+
channelCode: '',
107134
value: '',
108135
title: '',
109136
visible: false,
@@ -163,7 +190,12 @@ export default {
163190
submit(channelCode) {
164191
// 条形码支付,需要特殊处理
165192
if (channelCode === PayChannelEnum.ALIPAY_BAR.code) {
166-
193+
this.barCode = {
194+
channelCode: channelCode,
195+
value: '',
196+
title: '“支付宝”条码支付',
197+
visible: true
198+
}
167199
return;
168200
}
169201
@@ -190,7 +222,9 @@ export default {
190222
191223
// 打开轮询任务
192224
this.createQueryInterval()
193-
})
225+
}).catch(() => {
226+
this.submitLoading = false
227+
});
194228
},
195229
/** 构建提交支付的额外参数 */
196230
buildSubmitParam(channelCode) {
@@ -232,12 +266,22 @@ export default {
232266
// displayMode: PayDisplayModeEnum.FORM.mode
233267
// }
234268
}
269+
235270
// ② 支付宝 Wap 支付时,引导手机扫码支付
236271
if (channelCode === PayChannelEnum.ALIPAY_WAP.code) {
237272
return {
238273
displayMode: PayDisplayModeEnum.QR_CODE.mode
239274
}
240275
}
276+
277+
// ③ 支付宝 BarCode 支付时,需要传递 authCode 条形码
278+
if (channelCode === PayChannelEnum.ALIPAY_BAR.code) {
279+
return {
280+
"channelExtras": {
281+
"auth_code": this.barCode.value
282+
}
283+
}
284+
}
241285
return {}
242286
},
243287
/** 提交支付后,IFrame 内置 URL 的展示形式 */

0 commit comments

Comments
 (0)