feat:【antd】【ele】【pay 支付】pay/cashier 迁移 antd、ele 版本

pull/220/head
YunaiV 2025-10-06 20:45:29 +08:00
parent 38040be98f
commit 825a052533
4 changed files with 28 additions and 20 deletions

View File

@ -40,6 +40,7 @@ export const channelsAlipay = [
code: 'alipay_bar', code: 'alipay_bar',
}, },
]; ];
export const channelsWechat = [ export const channelsWechat = [
{ {
name: '微信公众号支付', name: '微信公众号支付',
@ -67,6 +68,7 @@ export const channelsWechat = [
code: 'wx_bar', code: 'wx_bar',
}, },
]; ];
export const channelsMock = [ export const channelsMock = [
{ {
name: '钱包支付', name: '钱包支付',

View File

@ -28,22 +28,21 @@ import { channelsAlipay, channelsMock, channelsWechat } from './data';
defineOptions({ name: 'PayCashier' }); defineOptions({ name: 'PayCashier' });
const [Modal, modalApi] = useVbenModal({
showConfirmButton: false,
destroyOnClose: true,
});
const route = useRoute(); const route = useRoute();
const { push } = useRouter(); // const { push } = useRouter();
const { closeCurrentTab } = useTabs(); const { closeCurrentTab } = useTabs();
const id = ref(); // const id = ref(); //
const title = ref('支付订单'); const title = ref('支付订单');
const returnUrl = ref<string>(); // const returnUrl = ref<string>(); //
const payOrder = ref<PayOrderApi.Order>(); const payOrder = ref<PayOrderApi.Order>();
const interval = ref<any>(undefined); // const interval = ref<any>(undefined); //
const [Modal, modalApi] = useVbenModal({
showConfirmButton: false,
destroyOnClose: true,
});
/** 展示形式:二维码 */ /** 展示形式:二维码 */
const qrCode = ref({ const qrCode = ref({
url: '', url: '',
@ -87,9 +86,11 @@ async function getDetail() {
goReturnUrl('close'); goReturnUrl('close');
return; return;
} }
// 2.
payOrder.value = res; payOrder.value = res;
} }
/** 处理支付 */
function handlePay(channelCode: string) { function handlePay(channelCode: string) {
switch (channelCode) { switch (channelCode) {
// //
@ -129,6 +130,7 @@ function handlePay(channelCode: string) {
} }
} }
/** 提交支付 */
async function submit(channelCode: string) { async function submit(channelCode: string) {
try { try {
const submitParam = { const submitParam = {
@ -165,9 +167,7 @@ async function submit(channelCode: string) {
// //
createQueryInterval(); createQueryInterval();
} finally { } finally {}
// message.success('')
}
} }
/** 构建提交支付的额外参数 */ /** 构建提交支付的额外参数 */
@ -291,10 +291,12 @@ function goReturnUrl(payResult: string) {
} }
} }
/** 页面加载时,获取支付信息 */
onMounted(async () => { onMounted(async () => {
await getDetail(); await getDetail();
}); });
/** 页面卸载时,清理定时任务 */
onBeforeUnmount(() => { onBeforeUnmount(() => {
clearQueryInterval(); clearQueryInterval();
}); });

View File

@ -40,6 +40,7 @@ export const channelsAlipay = [
code: 'alipay_bar', code: 'alipay_bar',
}, },
]; ];
export const channelsWechat = [ export const channelsWechat = [
{ {
name: '微信公众号支付', name: '微信公众号支付',
@ -67,6 +68,7 @@ export const channelsWechat = [
code: 'wx_bar', code: 'wx_bar',
}, },
]; ];
export const channelsMock = [ export const channelsMock = [
{ {
name: '钱包支付', name: '钱包支付',

View File

@ -28,22 +28,21 @@ import { channelsAlipay, channelsMock, channelsWechat } from './data';
defineOptions({ name: 'PayCashier' }); defineOptions({ name: 'PayCashier' });
const [Modal, modalApi] = useVbenModal({
showConfirmButton: false,
destroyOnClose: true,
});
const route = useRoute(); const route = useRoute();
const { push } = useRouter(); // const { push } = useRouter();
const { closeCurrentTab } = useTabs(); const { closeCurrentTab } = useTabs();
const id = ref(); // const id = ref(); //
const title = ref('支付订单'); const title = ref('支付订单');
const returnUrl = ref<string>(); // const returnUrl = ref<string>(); //
const payOrder = ref<PayOrderApi.Order>(); const payOrder = ref<PayOrderApi.Order>();
const interval = ref<any>(undefined); // const interval = ref<any>(undefined); //
const [Modal, modalApi] = useVbenModal({
showConfirmButton: false,
destroyOnClose: true,
});
/** 展示形式:二维码 */ /** 展示形式:二维码 */
const qrCode = ref({ const qrCode = ref({
url: '', url: '',
@ -87,9 +86,11 @@ async function getDetail() {
goReturnUrl('close'); goReturnUrl('close');
return; return;
} }
// 2.
payOrder.value = res; payOrder.value = res;
} }
/** 处理支付 */
function handlePay(channelCode: string) { function handlePay(channelCode: string) {
switch (channelCode) { switch (channelCode) {
// //
@ -129,6 +130,7 @@ function handlePay(channelCode: string) {
} }
} }
/** 提交支付 */
async function submit(channelCode: string) { async function submit(channelCode: string) {
try { try {
const submitParam = { const submitParam = {
@ -165,9 +167,7 @@ async function submit(channelCode: string) {
// //
createQueryInterval(); createQueryInterval();
} finally { } finally {}
// message.success('')
}
} }
/** 构建提交支付的额外参数 */ /** 构建提交支付的额外参数 */
@ -291,10 +291,12 @@ function goReturnUrl(payResult: string) {
} }
} }
/** 页面加载时,获取支付信息 */
onMounted(async () => { onMounted(async () => {
await getDetail(); await getDetail();
}); });
/** 页面卸载时,清理定时任务 */
onBeforeUnmount(() => { onBeforeUnmount(() => {
clearQueryInterval(); clearQueryInterval();
}); });