feat:【antd】【ele】【pay 支付】pay/transfer 迁移 ele 版本
This commit is contained in:
@@ -1,17 +1,17 @@
|
|||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
import type { PayTransferApi } from '#/api/pay/transfer';
|
||||||
import type { DescriptionItemSchema } from '#/components/description';
|
import type { DescriptionItemSchema } from '#/components/description';
|
||||||
|
|
||||||
import { h } from 'vue';
|
import { h } from 'vue';
|
||||||
|
|
||||||
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
|
import { getDictOptions } from '@vben/hooks';
|
||||||
import { erpPriceInputFormatter, formatDateTime } from '@vben/utils';
|
import { erpPriceInputFormatter, formatDateTime } from '@vben/utils';
|
||||||
|
|
||||||
import { ElTag } from 'element-plus';
|
import { ElTag } from 'element-plus';
|
||||||
|
|
||||||
import { DictTag } from '#/components/dict-tag';
|
import { DictTag } from '#/components/dict-tag';
|
||||||
import { DICT_TYPE } from '@vben/constants';
|
|
||||||
import { getDictOptions } from '@vben/hooks';
|
|
||||||
|
|
||||||
import { getRangePickerDefaultProps } from '#/utils';
|
import { getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
/** 列表的搜索表单 */
|
/** 列表的搜索表单 */
|
||||||
@@ -22,7 +22,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
label: '转账单号',
|
label: '转账单号',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
clearable: true,
|
allowClear: true,
|
||||||
placeholder: '请输入转账单号',
|
placeholder: '请输入转账单号',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -32,7 +32,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
options: getDictOptions(DICT_TYPE.PAY_CHANNEL_CODE),
|
options: getDictOptions(DICT_TYPE.PAY_CHANNEL_CODE),
|
||||||
clearable: true,
|
allowClear: true,
|
||||||
placeholder: '请选择支付渠道',
|
placeholder: '请选择支付渠道',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -41,7 +41,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
label: '商户单号',
|
label: '商户单号',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
clearable: true,
|
allowClear: true,
|
||||||
placeholder: '请输入商户单号',
|
placeholder: '请输入商户单号',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -51,7 +51,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
options: getDictOptions(DICT_TYPE.PAY_TRANSFER_TYPE),
|
options: getDictOptions(DICT_TYPE.PAY_TRANSFER_TYPE),
|
||||||
clearable: true,
|
allowClear: true,
|
||||||
placeholder: '请选择类型',
|
placeholder: '请选择类型',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -61,7 +61,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
options: getDictOptions(DICT_TYPE.PAY_TRANSFER_STATUS),
|
options: getDictOptions(DICT_TYPE.PAY_TRANSFER_STATUS),
|
||||||
clearable: true,
|
allowClear: true,
|
||||||
placeholder: '请选择转账状态',
|
placeholder: '请选择转账状态',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -70,16 +70,16 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
label: '收款人姓名',
|
label: '收款人姓名',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
clearable: true,
|
allowClear: true,
|
||||||
placeholder: '请输入收款人姓名',
|
placeholder: '请输入收款人姓名',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'accountNo',
|
fieldName: 'userAccount',
|
||||||
label: '收款人账号',
|
label: '收款人账号',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
clearable: true,
|
allowClear: true,
|
||||||
placeholder: '请输入收款人账号',
|
placeholder: '请输入收款人账号',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -88,7 +88,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
label: '渠道单号',
|
label: '渠道单号',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
clearable: true,
|
allowClear: true,
|
||||||
placeholder: '请输入渠道单号',
|
placeholder: '请输入渠道单号',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -98,7 +98,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
...getRangePickerDefaultProps(),
|
...getRangePickerDefaultProps(),
|
||||||
clearable: true,
|
allowClear: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -110,96 +110,95 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
{
|
{
|
||||||
field: 'id',
|
field: 'id',
|
||||||
title: '编号',
|
title: '编号',
|
||||||
},
|
minWidth: 100,
|
||||||
{
|
|
||||||
field: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
formatter: 'formatDateTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'appName',
|
|
||||||
title: '支付应用',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'price',
|
field: 'price',
|
||||||
title: '转账金额',
|
title: '转账金额',
|
||||||
formatter: 'formatFenToYuanAmount',
|
minWidth: 120,
|
||||||
|
formatter: 'formatAmount2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'merchantTransferId',
|
||||||
|
title: '转账单号',
|
||||||
|
minWidth: 350,
|
||||||
|
slots: {
|
||||||
|
default: 'no',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'status',
|
field: 'status',
|
||||||
title: '转账状态',
|
title: '转账状态',
|
||||||
|
minWidth: 120,
|
||||||
cellRender: {
|
cellRender: {
|
||||||
name: 'CellDict',
|
name: 'CellDict',
|
||||||
props: { type: DICT_TYPE.PAY_TRANSFER_STATUS },
|
props: { type: DICT_TYPE.PAY_TRANSFER_STATUS },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
field: 'type',
|
|
||||||
title: '类型',
|
|
||||||
cellRender: {
|
|
||||||
name: 'CellDict',
|
|
||||||
props: { type: DICT_TYPE.PAY_TRANSFER_TYPE },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field: 'channelCode',
|
field: 'channelCode',
|
||||||
title: '支付渠道',
|
title: '转账渠道',
|
||||||
|
minWidth: 140,
|
||||||
cellRender: {
|
cellRender: {
|
||||||
name: 'CellDict',
|
name: 'CellDict',
|
||||||
props: { type: DICT_TYPE.PAY_CHANNEL_CODE },
|
props: { type: DICT_TYPE.PAY_CHANNEL_CODE },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'merchantTransferId',
|
field: 'createTime',
|
||||||
title: '商户单号',
|
title: '创建时间',
|
||||||
|
minWidth: 180,
|
||||||
|
formatter: 'formatDateTime',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'channelTransferNo',
|
field: 'successTime',
|
||||||
title: '渠道单号',
|
title: '转账时间',
|
||||||
|
minWidth: 180,
|
||||||
|
formatter: 'formatDateTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'subject',
|
||||||
|
title: '转账标题',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'appName',
|
||||||
|
title: '支付应用',
|
||||||
|
minWidth: 150,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'userName',
|
field: 'userName',
|
||||||
title: '收款人姓名',
|
title: '收款人姓名',
|
||||||
|
minWidth: 150,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'accountNo',
|
field: 'userAccount',
|
||||||
title: '收款人账号',
|
title: '收款账号',
|
||||||
|
minWidth: 200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: 120,
|
width: 80,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
slots: { default: 'actions' },
|
slots: { default: 'actions' },
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 详情的配置 */
|
/** 详情的字段 */
|
||||||
export function useDetailSchema(): DescriptionItemSchema[] {
|
export function useDetailSchema(): DescriptionItemSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
|
||||||
field: 'id',
|
|
||||||
label: '编号',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field: 'merchantTransferId',
|
field: 'merchantTransferId',
|
||||||
label: '商户单号',
|
label: '商户单号',
|
||||||
content: (data) => {
|
content: (data: PayTransferApi.Transfer) =>
|
||||||
return h(ElTag, {
|
h(ElTag, {}, () => data?.merchantTransferId),
|
||||||
color: 'blue',
|
|
||||||
content: data?.merchantTransferId,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'no',
|
field: 'no',
|
||||||
label: '转账单号',
|
label: '转账单号',
|
||||||
content: (data) => {
|
content: (data: PayTransferApi.Transfer) =>
|
||||||
return h(ElTag, {
|
h(ElTag, { color: 'orange' }, () => data?.no),
|
||||||
color: 'blue',
|
|
||||||
content: data?.no,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'appId',
|
field: 'appId',
|
||||||
@@ -208,7 +207,7 @@ export function useDetailSchema(): DescriptionItemSchema[] {
|
|||||||
{
|
{
|
||||||
field: 'status',
|
field: 'status',
|
||||||
label: '转账状态',
|
label: '转账状态',
|
||||||
content: (data) =>
|
content: (data: any) =>
|
||||||
h(DictTag, {
|
h(DictTag, {
|
||||||
type: DICT_TYPE.PAY_TRANSFER_STATUS,
|
type: DICT_TYPE.PAY_TRANSFER_STATUS,
|
||||||
value: data?.status,
|
value: data?.status,
|
||||||
@@ -217,22 +216,24 @@ export function useDetailSchema(): DescriptionItemSchema[] {
|
|||||||
{
|
{
|
||||||
field: 'price',
|
field: 'price',
|
||||||
label: '转账金额',
|
label: '转账金额',
|
||||||
content: (data) => {
|
content: (data: PayTransferApi.Transfer) =>
|
||||||
return h(ElTag, {
|
h(
|
||||||
color: 'blue',
|
ElTag,
|
||||||
content: `¥${erpPriceInputFormatter(data?.price)}`,
|
{ color: 'success' },
|
||||||
});
|
() => `¥${erpPriceInputFormatter(data?.price || 0)}`,
|
||||||
},
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'successTime',
|
field: 'successTime',
|
||||||
label: '转账时间',
|
label: '转账时间',
|
||||||
content: (data) => formatDateTime(data?.successTime) as string,
|
content: (data: PayTransferApi.Transfer) =>
|
||||||
|
formatDateTime(data?.successTime) as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
label: '创建时间',
|
label: '创建时间',
|
||||||
content: (data) => formatDateTime(data?.createTime) as string,
|
content: (data: PayTransferApi.Transfer) =>
|
||||||
|
formatDateTime(data?.createTime) as string,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'userName',
|
field: 'userName',
|
||||||
@@ -245,25 +246,23 @@ export function useDetailSchema(): DescriptionItemSchema[] {
|
|||||||
{
|
{
|
||||||
field: 'channelCode',
|
field: 'channelCode',
|
||||||
label: '支付渠道',
|
label: '支付渠道',
|
||||||
content: (data) =>
|
content: (data: PayTransferApi.Transfer) =>
|
||||||
h(DictTag, {
|
h(DictTag, {
|
||||||
type: DICT_TYPE.PAY_CHANNEL_CODE,
|
type: DICT_TYPE.PAY_CHANNEL_CODE,
|
||||||
value: data?.channelCode,
|
value: data?.channelCode,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'channelCode',
|
field: 'userIp',
|
||||||
label: '支付 IP',
|
label: '支付 IP',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'channelTransferNo',
|
field: 'channelTransferNo',
|
||||||
label: '渠道单号',
|
label: '渠道单号',
|
||||||
content: (data) => {
|
content: (data: PayTransferApi.Transfer) =>
|
||||||
return h(ElTag, {
|
data?.channelTransferNo
|
||||||
color: 'blue',
|
? h(ElTag, { color: 'success' }, () => data.channelTransferNo)
|
||||||
content: data?.channelTransferNo,
|
: '',
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'notifyUrl',
|
field: 'notifyUrl',
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
|||||||
import type { PayTransferApi } from '#/api/pay/transfer';
|
import type { PayTransferApi } from '#/api/pay/transfer';
|
||||||
|
|
||||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
|
||||||
|
import { ElTag } from 'element-plus';
|
||||||
|
|
||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
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 { $t } from '#/locales';
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
@@ -18,16 +19,10 @@ const [DetailModal, detailModalApi] = useVbenModal({
|
|||||||
});
|
});
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
function onRefresh() {
|
function handleRefresh() {
|
||||||
gridApi.query();
|
gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出表格 */
|
|
||||||
async function handleExport() {
|
|
||||||
const data = await exportTransfer(await gridApi.formApi.getValues());
|
|
||||||
downloadFileFromBlobPart({ fileName: '转账单.xls', source: data });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 查看转账详情 */
|
/** 查看转账详情 */
|
||||||
function handleDetail(row: PayTransferApi.Transfer) {
|
function handleDetail(row: PayTransferApi.Transfer) {
|
||||||
detailModalApi.setData(row).open();
|
detailModalApi.setData(row).open();
|
||||||
@@ -38,6 +33,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
},
|
},
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
|
cellConfig: {
|
||||||
|
height: 80,
|
||||||
|
},
|
||||||
columns: useGridColumns(),
|
columns: useGridColumns(),
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
@@ -54,6 +52,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
},
|
},
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
|
isHover: true,
|
||||||
},
|
},
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: true,
|
refresh: true,
|
||||||
@@ -69,21 +68,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
<DocAlert title="转账管理" url="https://doc.iocoder.cn/pay/transfer/" />
|
<DocAlert title="转账管理" url="https://doc.iocoder.cn/pay/transfer/" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<DetailModal @success="onRefresh" />
|
<DetailModal @success="handleRefresh" />
|
||||||
<Grid table-title="转账单列表">
|
<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 }">
|
<template #actions="{ row }">
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
@@ -98,6 +84,21 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<template #no="{ row }">
|
||||||
|
<div class="flex flex-col gap-1 text-left">
|
||||||
|
<p class="text-sm">
|
||||||
|
<ElTag size="small" type="primary"> 商户</ElTag>
|
||||||
|
{{ row.merchantTransferId }}
|
||||||
|
</p>
|
||||||
|
<p class="text-sm" v-if="row.no">
|
||||||
|
<ElTag size="small" type="warning">转账</ElTag> {{ row.no }}
|
||||||
|
</p>
|
||||||
|
<p class="text-sm" v-if="row.channelTransferNo">
|
||||||
|
<ElTag size="small" type="success">渠道</ElTag>
|
||||||
|
{{ row.channelTransferNo }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -12,6 +12,18 @@ import { useDetailSchema } from '../data';
|
|||||||
|
|
||||||
const formData = ref<PayTransferApi.Transfer>();
|
const formData = ref<PayTransferApi.Transfer>();
|
||||||
|
|
||||||
|
const [Descriptions] = useDescription({
|
||||||
|
componentProps: {
|
||||||
|
border: true,
|
||||||
|
column: 2,
|
||||||
|
direction: 'horizontal',
|
||||||
|
labelWidth: 140,
|
||||||
|
title: '',
|
||||||
|
extra: '',
|
||||||
|
},
|
||||||
|
schema: useDetailSchema(),
|
||||||
|
});
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
const [Modal, modalApi] = useVbenModal({
|
||||||
async onOpenChange(isOpen: boolean) {
|
async onOpenChange(isOpen: boolean) {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
@@ -31,18 +43,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const [Description] = useDescription({
|
|
||||||
componentProps: {
|
|
||||||
title: '基本信息',
|
|
||||||
border: false,
|
|
||||||
column: 2,
|
|
||||||
direction: 'horizontal',
|
|
||||||
labelWidth: 200,
|
|
||||||
extra: '',
|
|
||||||
},
|
|
||||||
schema: useDetailSchema(),
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -52,6 +52,6 @@ const [Description] = useDescription({
|
|||||||
:show-cancel-button="false"
|
:show-cancel-button="false"
|
||||||
:show-confirm-button="false"
|
:show-confirm-button="false"
|
||||||
>
|
>
|
||||||
<Description :data="formData" />
|
<Descriptions :data="formData" />
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user