feat: 新增支付管理其他模块
This commit is contained in:
168
apps/web-ele/src/views/pay/notify/data.ts
Normal file
168
apps/web-ele/src/views/pay/notify/data.ts
Normal file
@@ -0,0 +1,168 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { getAppList } from '#/api/pay/app';
|
||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'appId',
|
||||
label: '应用编号',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const data = await getAppList();
|
||||
return data.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
autoSelect: 'first',
|
||||
placeholder: '请选择数据源',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'type',
|
||||
label: '通知类型',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: getDictOptions(DICT_TYPE.PAY_NOTIFY_TYPE, 'number'),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'dataId',
|
||||
label: '关联编号',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '通知状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: getDictOptions(DICT_TYPE.PAY_NOTIFY_STATUS, 'number'),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'merchantOrderId',
|
||||
label: '商户订单编号',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
fieldName: 'createTime',
|
||||
label: '创建时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'id',
|
||||
title: '任务编号',
|
||||
},
|
||||
{
|
||||
field: 'appName',
|
||||
title: '应用编号',
|
||||
},
|
||||
{
|
||||
field: 'merchantOrderId',
|
||||
title: '商户订单编号',
|
||||
},
|
||||
{
|
||||
field: 'type',
|
||||
title: '通知类型',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.PAY_NOTIFY_TYPE },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'dataId',
|
||||
title: '关联编号',
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '通知状态',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.PAY_NOTIFY_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'lastExecuteTime',
|
||||
title: '最后通知时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'nextNotifyTime',
|
||||
title: '下次通知时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'notifyTimes',
|
||||
title: '通知次数',
|
||||
cellRender: {
|
||||
name: 'CellTag',
|
||||
props: {
|
||||
type: 'success',
|
||||
content: '{notifyTimes} / {maxNotifyTimes}',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 80,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 详情列表的字段 */
|
||||
export const detailColumns = [
|
||||
{
|
||||
title: '日志编号',
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
width: 120,
|
||||
ellipsis: false,
|
||||
},
|
||||
{
|
||||
title: '通知状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
width: 120,
|
||||
ellipsis: false,
|
||||
},
|
||||
{
|
||||
title: '通知次数',
|
||||
dataIndex: 'notifyTimes',
|
||||
key: 'notifyTimes',
|
||||
width: 120,
|
||||
ellipsis: false,
|
||||
},
|
||||
{
|
||||
title: '通知时间',
|
||||
dataIndex: 'lastExecuteTime',
|
||||
key: 'lastExecuteTime',
|
||||
width: 120,
|
||||
ellipsis: false,
|
||||
},
|
||||
{
|
||||
title: '响应结果',
|
||||
dataIndex: 'response',
|
||||
key: 'response',
|
||||
width: 120,
|
||||
ellipsis: false,
|
||||
},
|
||||
];
|
||||
81
apps/web-ele/src/views/pay/notify/index.vue
Normal file
81
apps/web-ele/src/views/pay/notify/index.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getNotifyTaskPage } from '#/api/pay/notify';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Detail from './modules/detail.vue';
|
||||
|
||||
const [DetailModal, detailModalApi] = useVbenModal({
|
||||
connectedComponent: Detail,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: any) {
|
||||
detailModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getNotifyTaskPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<any>,
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert title="支付功能开启" url="https://doc.iocoder.cn/pay/build/" />
|
||||
</template>
|
||||
|
||||
<DetailModal @success="onRefresh" />
|
||||
<Grid table-title="支付通知列表">
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.detail'),
|
||||
type: 'primary',
|
||||
link: true,
|
||||
icon: ACTION_ICON.VIEW,
|
||||
auth: ['pay:notify:query'],
|
||||
onClick: handleDetail.bind(null, row),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
101
apps/web-ele/src/views/pay/notify/modules/detail.vue
Normal file
101
apps/web-ele/src/views/pay/notify/modules/detail.vue
Normal file
@@ -0,0 +1,101 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import { ElDescriptions, ElDescriptionsItem, ElDivider, ElTable, ElTag } from 'element-plus';
|
||||
|
||||
import { getNotifyTaskDetail } from '#/api/pay/notify';
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { DICT_TYPE } from '#/utils';
|
||||
|
||||
import { detailColumns } from '../data';
|
||||
|
||||
const formData = ref();
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getNotifyTaskDetail(data.id);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal
|
||||
title="通知详情"
|
||||
class="w-1/2"
|
||||
:show-cancel-button="false"
|
||||
:show-confirm-button="false"
|
||||
>
|
||||
<ElDescriptions border :column="2" class="mx-4">
|
||||
<ElDescriptionsItem label="商户订单编号">
|
||||
<ElTag>{{ formData?.merchantOrderId }}</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="通知状态">
|
||||
<DictTag
|
||||
:type="DICT_TYPE.PAY_NOTIFY_STATUS"
|
||||
:value="formData?.status"
|
||||
/>
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="应用编号">
|
||||
{{ formData?.appId }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="应用名称">
|
||||
{{ formData?.appName }}
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="关联编号">
|
||||
{{ formData?.dataId }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="通知类型">
|
||||
<DictTag :type="DICT_TYPE.PAY_NOTIFY_TYPE" :value="formData?.type" />
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="通知次数">
|
||||
{{ formData?.notifyTimes }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="最大通知次数">
|
||||
{{ formData?.maxNotifyTimes }}
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="最后通知时间">
|
||||
{{ formatDateTime(formData?.lastExecuteTime || '') }}
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<ElDescriptionsItem label="创建时间">
|
||||
{{ formatDateTime(formData?.createTime || '') }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="更新时间">
|
||||
{{ formatDateTime(formData?.updateTime || '') }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
|
||||
<ElDivider />
|
||||
|
||||
<ElDescriptions border :column="1" class="mx-4">
|
||||
<ElDescriptionsItem label="回调日志">
|
||||
<ElTable
|
||||
v-if="formData"
|
||||
:data-source="formData.logs"
|
||||
:columns="detailColumns"
|
||||
/>
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</Modal>
|
||||
</template>
|
||||
Reference in New Issue
Block a user