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

This commit is contained in:
YunaiV
2025-10-06 20:37:19 +08:00
parent 584dcd5819
commit 38040be98f
4 changed files with 64 additions and 20 deletions

View File

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

View File

@@ -7,34 +7,38 @@ import { DICT_TYPE } from '@vben/constants';
export function useFormSchema(): VbenFormSchema[] {
return [
{
component: 'Input',
fieldName: 'id',
component: 'Input',
dependencies: {
triggerFields: [''],
show: () => false,
},
},
{
component: 'Input',
fieldName: 'subject',
label: '提现标题',
component: 'Input',
rules: 'required',
componentProps: {
placeholder: '请输入提现标题',
},
},
{
component: 'InputNumber',
fieldName: 'price',
label: '提现金额',
component: 'InputNumber',
rules: 'required',
componentProps: {
min: 1,
precision: 2,
step: 0.01,
placeholder: '请输入提现金额',
},
},
{
component: 'Select',
fieldName: 'type',
label: '提现类型',
component: 'Select',
rules: 'required',
componentProps: {
options: [
@@ -42,19 +46,46 @@ export function useFormSchema(): VbenFormSchema[] {
{ label: '微信余额', value: 2 },
{ label: '钱包余额', value: 3 },
],
placeholder: '请选择提现类型',
},
},
{
component: 'Input',
fieldName: 'userName',
label: '收款人姓名',
rules: 'required',
},
{
component: 'Input',
fieldName: 'userAccount',
label: '收款人账号',
component: 'Input',
rules: 'required',
dependencies: {
triggerFields: ['type'],
componentProps: (values) => {
const type = values.type;
let placeholder = '请输入收款人账号';
switch (type) {
case 1: {
placeholder = '请输入支付宝账号';
break;
}
case 2: {
placeholder = '请输入微信 openid';
break;
}
case 3: {
placeholder = '请输入钱包编号';
break;
}
}
return {
placeholder,
};
},
},
},
{
fieldName: 'userName',
label: '收款人姓名',
component: 'Input',
componentProps: {
placeholder: '请输入收款人姓名',
},
},
];
}
@@ -65,41 +96,50 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'id',
title: '提现单编号',
minWidth: 100,
},
{
field: 'subject',
title: '提现标题',
minWidth: 150,
},
{
field: 'type',
title: '提现类型',
minWidth: 100,
slots: { default: 'type' },
},
{
field: 'price',
title: '提现金额',
formatter: 'formatFenToYuanAmount',
minWidth: 100,
formatter: 'formatAmount2',
},
{
field: 'userName',
title: '收款人姓名',
minWidth: 120,
},
{
field: 'userAccount',
title: '收款人账号',
minWidth: 150,
},
{
field: 'status',
title: '提现状态',
minWidth: 100,
slots: { default: 'status' },
},
{
field: 'payTransferId',
title: '转账单号',
minWidth: 120,
},
{
field: 'transferChannelCode',
title: '转账渠道',
minWidth: 130,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.PAY_CHANNEL_CODE },
@@ -108,15 +148,17 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'transferTime',
title: '转账时间',
minWidth: 180,
formatter: 'formatDateTime',
},
{
field: 'transferErrorMsg',
title: '转账失败原因',
minWidth: 150,
},
{
title: '操作',
width: 130,
width: 220,
fixed: 'right',
slots: { default: 'actions' },
},

View File

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

View File

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