pay: 接入支付宝 PC 支付的表单

This commit is contained in:
YunaiV 2023-02-18 21:16:22 +08:00
parent b34801f303
commit ce8571e313
3 changed files with 34 additions and 26 deletions

View File

@ -69,10 +69,6 @@ public class AlipayPcPayClient extends AbstractAlipayClient {
log.error("[unifiedOrder][request({}) 发起支付失败]", JsonUtils.toJsonString(reqDTO), e);
return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping);
}
// 1. form
// 2. url
// 3. code
// 4. code url
// 2.2 处理结果
System.out.println(response.getBody());

View File

@ -160,6 +160,9 @@ export const PayDisplayModeEnum = {
IFRAME: {
"mode": "iframe",
},
FORM: {
"mode": "form"
}
}
/**

View File

@ -41,20 +41,20 @@
</div>
</el-card>
<!-- 展示形式二维码 -->
<!-- 展示形式二维码 URL -->
<el-dialog :title="qrCode.title" :visible.sync="qrCode.visible" width="350px" append-to-body
:close-on-press-escape="false">
<qrcode-vue :value="qrCode.url" size="310" level="H" />
</el-dialog>
<!-- 展示形式iframe -->
<!-- 展示形式IFrame -->
<el-dialog :title="iframe.title" :visible.sync="iframe.visible" width="800px" height="800px" append-to-body
:close-on-press-escape="false">
<iframe :src="iframe.url" width="100%" />
</el-dialog>
<!-- 阿里支付 -->
<div ref="alipayWap" v-html="alipayHtml.value" />
<!-- 展示形式 -->
<div ref="formRef" v-html="form.value" />
</div>
</template>
@ -88,6 +88,7 @@ export default {
mock: require("@/assets/images/pay/icon/mock.svg"),
},
submitLoading: false, // loading
interval: undefined, //
qrCode: { //
url: '',
title: '',
@ -98,8 +99,9 @@ export default {
title: '',
visible: false
},
interval: undefined, //
alipayHtml: '' // HTML
form: { // form
html: '',
},
};
},
created() {
@ -164,6 +166,8 @@ export default {
this.displayIFrame(channelCode, data)
} else if (data.displayMode === 'url') {
this.displayUrl(channelCode, data)
} else if (data.displayMode === 'form') {
this.displayForm(channelCode, data)
}
//
// if (channelCode === PayChannelEnum.ALIPAY_QR.code) {
@ -203,7 +207,7 @@ export default {
// 4-
// return {
// "channelExtras": {
// "qr_pay_mode": "2"
// "qr_pay_mode": "4"
// }
// }
//
@ -212,6 +216,10 @@ export default {
"qr_pay_mode": "2"
}
}
//
// return {
// displayMode: PayDisplayModeEnum.FORM.mode
// }
}
return {}
},
@ -224,33 +232,34 @@ export default {
}
this.submitLoading = false
},
/** 提交支付后IFrame 内置 URL 的展示形式 */
displayIFrame(channelCode, data) {
// this.iframe = {
// title: '',
// url: data.displayContent,
// visible: true
// }
window.open(data.displayContent)
// TODO
this.iframe = {
title: '支付窗口',
url: data.displayContent,
visible: true
}
this.submitLoading = false
},
/** 提交支付后URL 的展示形式 */
displayUrl(channelCode, data) {
window.open(data.displayContent)
this.submitLoading = false
},
/** 提交支付后(支付宝 PC 网站支付) */
submitAfterAlipayPc(invokeResponse) {
/** 提交支付后Form 的展示形式 */
displayForm(channelCode, data) {
//
this.alipayHtml = {
value: invokeResponse.body,
visible: true
this.form = {
value: data.displayContent
}
//
this.$nextTick(() => {
//
// this.$refs.alipayWap.children[0].submit();
// setTimeout(() => {
// this.submitLoading = false
// }, 1000);
this.$refs.formRef.children[0].submit();
setTimeout(() => {
this.submitLoading = false
}, 1000);
});
},
/** 轮询查询任务 */