feat:【antd】【ele】【pay 支付】pay/demo/withdraw 迁移 ele 版本

This commit is contained in:
YunaiV
2025-10-06 20:15:17 +08:00
parent 5d9af538fd
commit dd7e4d9513
3 changed files with 29 additions and 16 deletions

View File

@@ -2,28 +2,29 @@ import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '@vben/constants'; import { DICT_TYPE } from '@vben/constants';
import { formatDateTime } from '@vben/utils';
/** 新增/修改的表单 */ /** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {
return [ return [
{ {
component: 'Input',
fieldName: 'id', fieldName: 'id',
component: 'Input',
dependencies: { dependencies: {
triggerFields: [''], triggerFields: [''],
show: () => false, show: () => false,
}, },
}, },
{ {
component: 'Input',
fieldName: 'subject', fieldName: 'subject',
label: '提现标题', label: '提现标题',
component: 'Input',
rules: 'required', rules: 'required',
}, },
{ {
component: 'InputNumber',
fieldName: 'price', fieldName: 'price',
label: '提现金额', label: '提现金额',
component: 'InputNumber',
rules: 'required', rules: 'required',
componentProps: { componentProps: {
min: 1, min: 1,
@@ -32,9 +33,9 @@ export function useFormSchema(): VbenFormSchema[] {
}, },
}, },
{ {
component: 'Select',
fieldName: 'type', fieldName: 'type',
label: '提现类型', label: '提现类型',
component: 'Select',
rules: 'required', rules: 'required',
componentProps: { componentProps: {
options: [ options: [
@@ -45,15 +46,15 @@ export function useFormSchema(): VbenFormSchema[] {
}, },
}, },
{ {
component: 'Input',
fieldName: 'userName', fieldName: 'userName',
label: '收款人姓名', label: '收款人姓名',
component: 'Input',
rules: 'required', rules: 'required',
}, },
{ {
component: 'Input',
fieldName: 'userAccount', fieldName: 'userAccount',
label: '收款人账号', label: '收款人账号',
component: 'Input',
rules: 'required', rules: 'required',
}, },
]; ];
@@ -65,41 +66,50 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
field: 'id', field: 'id',
title: '提现单编号', title: '提现单编号',
minWidth: 100,
}, },
{ {
field: 'subject', field: 'subject',
title: '提现标题', title: '提现标题',
minWidth: 150,
}, },
{ {
field: 'type', field: 'type',
title: '提现类型', title: '提现类型',
minWidth: 100,
slots: { default: 'type' }, slots: { default: 'type' },
}, },
{ {
field: 'price', field: 'price',
title: '提现金额', title: '提现金额',
minWidth: 100,
formatter: 'formatAmount2', formatter: 'formatAmount2',
}, },
{ {
field: 'userName', field: 'userName',
title: '收款人姓名', title: '收款人姓名',
minWidth: 120,
}, },
{ {
field: 'userAccount', field: 'userAccount',
title: '收款人账号', title: '收款人账号',
minWidth: 150,
}, },
{ {
field: 'status', field: 'status',
title: '提现状态', title: '提现状态',
minWidth: 100,
slots: { default: 'status' }, slots: { default: 'status' },
}, },
{ {
field: 'payTransferId', field: 'payTransferId',
title: '转账单号', title: '转账单号',
minWidth: 120,
}, },
{ {
field: 'transferChannelCode', field: 'transferChannelCode',
title: '转账渠道', title: '转账渠道',
minWidth: 120,
cellRender: { cellRender: {
name: 'CellDict', name: 'CellDict',
props: { type: DICT_TYPE.PAY_CHANNEL_CODE }, props: { type: DICT_TYPE.PAY_CHANNEL_CODE },
@@ -108,15 +118,17 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
field: 'transferTime', field: 'transferTime',
title: '转账时间', title: '转账时间',
minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {
field: 'transferErrorMsg', field: 'transferErrorMsg',
title: '转账失败原因', title: '转账失败原因',
minWidth: 150,
}, },
{ {
title: '操作', title: '操作',
width: 130, width: 220,
fixed: 'right', fixed: 'right',
slots: { default: 'actions' }, slots: { default: 'actions' },
}, },

View File

@@ -12,7 +12,6 @@ import {
getDemoWithdrawPage, getDemoWithdrawPage,
transferDemoWithdraw, transferDemoWithdraw,
} from '#/api/pay/demo/withdraw'; } from '#/api/pay/demo/withdraw';
import { $t } from '#/locales';
import { useGridColumns } from './data'; import { useGridColumns } from './data';
import Form from './modules/form.vue'; import Form from './modules/form.vue';
@@ -23,7 +22,7 @@ const [FormModal, formModalApi] = useVbenModal({
}); });
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }
@@ -40,10 +39,8 @@ async function handleTransfer(row: DemoWithdrawApi.Withdraw) {
}); });
try { try {
const payTransferId = await transferDemoWithdraw(row.id as number); const payTransferId = await transferDemoWithdraw(row.id as number);
message.success({ message.success(`转账提交成功,转账单号:${payTransferId}`);
content: `转账提交成功,转账单号:${payTransferId}`, handleRefresh();
});
onRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@@ -67,6 +64,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
}, },
rowConfig: { rowConfig: {
keyField: 'id', keyField: 'id',
isHover: true,
}, },
toolbarConfig: { toolbarConfig: {
refresh: true, refresh: true,
@@ -89,13 +87,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
/> />
</template> </template>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title="示例提现单列表"> <Grid table-title="示例提现单列表">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction
:actions="[ :actions="[
{ {
label: $t('ui.actionTitle.create', ['示例提现单']), label: '发起提现',
type: 'primary', type: 'primary',
icon: ACTION_ICON.ADD, icon: ACTION_ICON.ADD,
onClick: handleCreate, onClick: handleCreate,
@@ -127,12 +125,15 @@ const [Grid, gridApi] = useVbenVxeGrid({
{ {
label: '发起转账', label: '发起转账',
type: 'link', type: 'link',
icon: ACTION_ICON.ADD,
ifShow: row.status === 0 && !row.payTransferId, ifShow: row.status === 0 && !row.payTransferId,
onClick: handleTransfer.bind(null, row), onClick: handleTransfer.bind(null, row),
}, },
{ {
label: '重新转账', label: '重新转账',
type: 'link', type: 'link',
danger: true,
icon: ACTION_ICON.EDIT,
ifShow: row.status === 20, ifShow: row.status === 20,
onClick: handleTransfer.bind(null, row), onClick: handleTransfer.bind(null, row),
}, },

View File

@@ -49,7 +49,7 @@ const [Modal, modalApi] = useVbenModal({
</script> </script>
<template> <template>
<Modal class="w-2/5" :title="$t('ui.actionTitle.create', ['示例提现单'])"> <Modal class="w-1/4" title="发起提现">
<Form class="mx-4" /> <Form class="mx-4" />
</Modal> </Modal>
</template> </template>