feat:【antd】【ele】【pay 支付】pay/transfer 迁移 antd 版本
This commit is contained in:
@@ -6,31 +6,41 @@ export namespace PayTransferApi {
|
||||
/** 转账单信息 */
|
||||
export interface Transfer {
|
||||
id: number;
|
||||
no: string;
|
||||
appId: number;
|
||||
appName: string;
|
||||
channelId: number;
|
||||
channelCode: string;
|
||||
merchantTransferId: string;
|
||||
type: number;
|
||||
channelTransferNo: string;
|
||||
price: number;
|
||||
subject: string;
|
||||
userName: string;
|
||||
alipayLogonId: string;
|
||||
openid: string;
|
||||
userAccount: string;
|
||||
userIp: string;
|
||||
status: number;
|
||||
successTime: Date;
|
||||
createTime: Date;
|
||||
updateTime: Date;
|
||||
notifyUrl: string;
|
||||
channelNotifyData: string;
|
||||
}
|
||||
|
||||
/** 转账单分页请求 */
|
||||
export interface TransferPageReq extends PageParam {
|
||||
no?: string;
|
||||
appId?: number;
|
||||
channelId?: number;
|
||||
channelCode?: string;
|
||||
merchantTransferId?: string;
|
||||
channelTransferNo?: string;
|
||||
type?: number;
|
||||
price?: number;
|
||||
subject?: string;
|
||||
userName?: string;
|
||||
userAccount?: string;
|
||||
status?: number;
|
||||
successTime?: Date[];
|
||||
createTime?: Date[];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { PayTransferApi } from '#/api/pay/transfer';
|
||||
import type { DescriptionItemSchema } from '#/components/description';
|
||||
|
||||
import { h } from 'vue';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
import { erpPriceInputFormatter, formatDateTime } from '@vben/utils';
|
||||
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
@@ -75,7 +75,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'accountNo',
|
||||
fieldName: 'userAccount',
|
||||
label: '收款人账号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
@@ -110,96 +110,95 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
{
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'appName',
|
||||
title: '支付应用',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'price',
|
||||
title: '转账金额',
|
||||
minWidth: 120,
|
||||
formatter: 'formatAmount2',
|
||||
},
|
||||
{
|
||||
field: 'merchantTransferId',
|
||||
title: '转账单号',
|
||||
minWidth: 350,
|
||||
slots: {
|
||||
default: 'no',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '转账状态',
|
||||
minWidth: 120,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.PAY_TRANSFER_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'type',
|
||||
title: '类型',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.PAY_TRANSFER_TYPE },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'channelCode',
|
||||
title: '支付渠道',
|
||||
title: '转账渠道',
|
||||
minWidth: 140,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.PAY_CHANNEL_CODE },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'merchantTransferId',
|
||||
title: '商户单号',
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 180,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'channelTransferNo',
|
||||
title: '渠道单号',
|
||||
field: 'successTime',
|
||||
title: '转账时间',
|
||||
minWidth: 180,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'subject',
|
||||
title: '转账标题',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'appName',
|
||||
title: '支付应用',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'userName',
|
||||
title: '收款人姓名',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'accountNo',
|
||||
title: '收款人账号',
|
||||
field: 'userAccount',
|
||||
title: '收款账号',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 120,
|
||||
width: 80,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 详情的配置 */
|
||||
/** 详情的字段 */
|
||||
export function useDetailSchema(): DescriptionItemSchema[] {
|
||||
return [
|
||||
{
|
||||
field: 'id',
|
||||
label: '编号',
|
||||
},
|
||||
{
|
||||
field: 'merchantTransferId',
|
||||
label: '商户单号',
|
||||
content: (data) => {
|
||||
return h(Tag, {
|
||||
color: 'blue',
|
||||
content: data?.merchantTransferId,
|
||||
});
|
||||
},
|
||||
content: (data: PayTransferApi.Transfer) =>
|
||||
h(Tag, {}, () => data?.merchantTransferId || '-'),
|
||||
},
|
||||
{
|
||||
field: 'no',
|
||||
label: '转账单号',
|
||||
content: (data) => {
|
||||
return h(Tag, {
|
||||
color: 'blue',
|
||||
content: data?.no,
|
||||
});
|
||||
},
|
||||
content: (data: PayTransferApi.Transfer) =>
|
||||
h(Tag, { color: 'orange' }, () => data?.no || '-'),
|
||||
},
|
||||
{
|
||||
field: 'appId',
|
||||
@@ -208,7 +207,7 @@ export function useDetailSchema(): DescriptionItemSchema[] {
|
||||
{
|
||||
field: 'status',
|
||||
label: '转账状态',
|
||||
content: (data) =>
|
||||
content: (data: any) =>
|
||||
h(DictTag, {
|
||||
type: DICT_TYPE.PAY_TRANSFER_STATUS,
|
||||
value: data?.status,
|
||||
@@ -217,22 +216,24 @@ export function useDetailSchema(): DescriptionItemSchema[] {
|
||||
{
|
||||
field: 'price',
|
||||
label: '转账金额',
|
||||
content: (data) => {
|
||||
return h(Tag, {
|
||||
color: 'blue',
|
||||
content: `¥${erpPriceInputFormatter(data?.price)}`,
|
||||
});
|
||||
},
|
||||
content: (data: PayTransferApi.Transfer) =>
|
||||
h(
|
||||
Tag,
|
||||
{ color: 'success' },
|
||||
() => `¥${erpPriceInputFormatter(data?.price || 0)}`,
|
||||
),
|
||||
},
|
||||
{
|
||||
field: 'successTime',
|
||||
label: '转账时间',
|
||||
content: (data) => formatDateTime(data?.successTime) as string,
|
||||
content: (data: PayTransferApi.Transfer) =>
|
||||
formatDateTime(data?.successTime) as string,
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
label: '创建时间',
|
||||
content: (data) => formatDateTime(data?.createTime) as string,
|
||||
content: (data: PayTransferApi.Transfer) =>
|
||||
formatDateTime(data?.createTime) as string,
|
||||
},
|
||||
{
|
||||
field: 'userName',
|
||||
@@ -245,25 +246,23 @@ export function useDetailSchema(): DescriptionItemSchema[] {
|
||||
{
|
||||
field: 'channelCode',
|
||||
label: '支付渠道',
|
||||
content: (data) =>
|
||||
content: (data: PayTransferApi.Transfer) =>
|
||||
h(DictTag, {
|
||||
type: DICT_TYPE.PAY_CHANNEL_CODE,
|
||||
value: data?.channelCode,
|
||||
}),
|
||||
},
|
||||
{
|
||||
field: 'channelCode',
|
||||
field: 'userIp',
|
||||
label: '支付 IP',
|
||||
},
|
||||
{
|
||||
field: 'channelTransferNo',
|
||||
label: '渠道单号',
|
||||
content: (data) => {
|
||||
return h(Tag, {
|
||||
color: 'blue',
|
||||
content: data?.channelTransferNo,
|
||||
});
|
||||
},
|
||||
content: (data: PayTransferApi.Transfer) =>
|
||||
data?.channelTransferNo
|
||||
? h(Tag, { color: 'success' }, () => data.channelTransferNo)
|
||||
: '',
|
||||
},
|
||||
{
|
||||
field: 'notifyUrl',
|
||||
|
||||
@@ -3,10 +3,11 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { PayTransferApi } from '#/api/pay/transfer';
|
||||
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { exportTransfer, getTransferPage } from '#/api/pay/transfer';
|
||||
import { getTransferPage } from '#/api/pay/transfer';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
@@ -18,16 +19,10 @@ const [DetailModal, detailModalApi] = useVbenModal({
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportTransfer(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '转账单.xls', source: data });
|
||||
}
|
||||
|
||||
/** 查看转账详情 */
|
||||
function handleDetail(row: PayTransferApi.Transfer) {
|
||||
detailModalApi.setData(row).open();
|
||||
@@ -38,6 +33,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
cellConfig: {
|
||||
height: 80,
|
||||
},
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
@@ -54,6 +52,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
@@ -69,21 +68,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<DocAlert title="转账管理" url="https://doc.iocoder.cn/pay/transfer/" />
|
||||
</template>
|
||||
|
||||
<DetailModal @success="onRefresh" />
|
||||
<DetailModal @success="handleRefresh" />
|
||||
<Grid table-title="转账单列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.export'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.DOWNLOAD,
|
||||
auth: ['pay:transfer:export'],
|
||||
onClick: handleExport,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
@@ -97,6 +83,21 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #no="{ row }">
|
||||
<div class="flex flex-col gap-1 text-left">
|
||||
<p class="text-sm">
|
||||
<Tag size="small" color="blue"> 商户</Tag>
|
||||
{{ row.merchantTransferId }}
|
||||
</p>
|
||||
<p class="text-sm" v-if="row.no">
|
||||
<Tag size="small" color="orange">转账</Tag> {{ row.no }}
|
||||
</p>
|
||||
<p class="text-sm" v-if="row.channelTransferNo">
|
||||
<Tag size="small" color="green">渠道</Tag>
|
||||
{{ row.channelTransferNo }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
@@ -34,8 +34,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
|
||||
const [Descriptions] = useDescription({
|
||||
componentProps: {
|
||||
title: '基本信息',
|
||||
bordered: false,
|
||||
bordered: true,
|
||||
column: 2,
|
||||
class: 'mx-4',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user