From 0627f5072d629150f29690ddee2a9184fbd31e7d Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 6 Oct 2025 11:11:51 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90antd=E3=80=91=E3=80=90ele?= =?UTF-8?q?=E3=80=91=E3=80=90pay=20=E6=94=AF=E4=BB=98=E3=80=91pay/notify?= =?UTF-8?q?=20=E8=BF=81=E7=A7=BB=20ele=20=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/pay/notify/data.ts | 8 +- apps/web-ele/src/api/pay/notify/index.ts | 47 +++- apps/web-ele/src/views/pay/notify/data.ts | 211 +++++++++++++----- apps/web-ele/src/views/pay/notify/index.vue | 33 ++- .../src/views/pay/notify/modules/detail.vue | 108 ++++----- 5 files changed, 274 insertions(+), 133 deletions(-) diff --git a/apps/web-antd/src/views/pay/notify/data.ts b/apps/web-antd/src/views/pay/notify/data.ts index 6281ef8b4..d81585e2e 100644 --- a/apps/web-antd/src/views/pay/notify/data.ts +++ b/apps/web-antd/src/views/pay/notify/data.ts @@ -161,13 +161,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { field: 'notifyTimes', title: '通知次数', minWidth: 120, - cellRender: { - name: 'CellTag', - props: { - type: 'success', - content: '{notifyTimes} / {maxNotifyTimes}', - }, - }, + formatter: ({ row }) => `${row.notifyTimes} / ${row.maxNotifyTimes}`, }, { title: '操作', diff --git a/apps/web-ele/src/api/pay/notify/index.ts b/apps/web-ele/src/api/pay/notify/index.ts index b0b916ccb..fe18ac03b 100644 --- a/apps/web-ele/src/api/pay/notify/index.ts +++ b/apps/web-ele/src/api/pay/notify/index.ts @@ -1,15 +1,52 @@ -import type { PageParam } from '@vben/request'; +import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; +export namespace PayNotifyApi { + /** 支付通知任务 */ + export interface NotifyTask { + id: number; + appId: number; + appName: string; + type: number; + dataId: number; + status: number; + merchantOrderId: string; + merchantRefundId?: string; + merchantTransferId?: string; + lastExecuteTime: Date; + nextNotifyTime: Date; + notifyTimes: number; + maxNotifyTimes: number; + createTime: Date; + updateTime: Date; + logs?: any[]; + } + + /** 支付通知任务分页请求 */ + export interface NotifyTaskPageReqVO extends PageParam { + appId?: number; + type?: number; + dataId?: number; + status?: number; + merchantOrderId?: string; + merchantRefundId?: string; + merchantTransferId?: string; + createTime?: Date[]; + } +} + /** 获得支付通知明细 */ export function getNotifyTaskDetail(id: number) { return requestClient.get(`/pay/notify/get-detail?id=${id}`); } /** 获得支付通知分页 */ -export function getNotifyTaskPage(params: PageParam) { - return requestClient.get('/pay/notify/page', { - params, - }); +export function getNotifyTaskPage(params: PayNotifyApi.NotifyTaskPageReqVO) { + return requestClient.get>( + '/pay/notify/page', + { + params, + }, + ); } diff --git a/apps/web-ele/src/views/pay/notify/data.ts b/apps/web-ele/src/views/pay/notify/data.ts index f3c548728..3ab7a0b38 100644 --- a/apps/web-ele/src/views/pay/notify/data.ts +++ b/apps/web-ele/src/views/pay/notify/data.ts @@ -1,14 +1,19 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { PayNotifyApi } from '#/api/pay/notify'; +import type { DescriptionItemSchema } from '#/components/description'; + +import { h } from 'vue'; -import { getAppList } from '#/api/pay/app'; import { DICT_TYPE } from '@vben/constants'; import { getDictOptions } from '@vben/hooks'; +import { formatDateTime } from '@vben/utils'; +import { getAppList } from '#/api/pay/app'; +import { DictTag } from '#/components/dict-tag'; import { getRangePickerDefaultProps } from '#/utils'; /** 列表的搜索表单 */ -// TODO @霖:缺少 placeholder export function useGridFormSchema(): VbenFormSchema[] { return [ { @@ -24,7 +29,7 @@ export function useGridFormSchema(): VbenFormSchema[] { })); }, autoSelect: 'first', - placeholder: '请选择数据源', + placeholder: '请选择应用编号', }, }, { @@ -34,12 +39,17 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { clearable: true, options: getDictOptions(DICT_TYPE.PAY_NOTIFY_TYPE, 'number'), + placeholder: '请选择通知类型', }, }, { fieldName: 'dataId', label: '关联编号', component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入关联编号', + }, }, { fieldName: 'status', @@ -48,12 +58,35 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { clearable: true, options: getDictOptions(DICT_TYPE.PAY_NOTIFY_STATUS, 'number'), + placeholder: '请选择通知状态', }, }, { fieldName: 'merchantOrderId', label: '商户订单编号', component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入商户订单编号', + }, + }, + { + fieldName: 'merchantRefundId', + label: '商户退款编号', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入商户退款编号', + }, + }, + { + fieldName: 'merchantTransferId', + label: '商户转账编号', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入商户转账编号', + }, }, { fieldName: 'createTime', @@ -62,6 +95,7 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { ...getRangePickerDefaultProps(), clearable: true, + placeholder: ['开始日期', '结束日期'], }, }, ]; @@ -73,18 +107,25 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'id', title: '任务编号', + minWidth: 100, }, { field: 'appName', - title: '应用编号', + title: '应用名称', + minWidth: 150, }, { - field: 'merchantOrderId', - title: '商户订单编号', + field: 'merchantInfo', + title: '商户单信息', + minWidth: 240, + slots: { + default: 'merchantInfo', + }, }, { field: 'type', title: '通知类型', + minWidth: 120, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.PAY_NOTIFY_TYPE }, @@ -93,10 +134,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'dataId', title: '关联编号', + minWidth: 120, }, { field: 'status', title: '通知状态', + minWidth: 120, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.PAY_NOTIFY_STATUS }, @@ -105,23 +148,20 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'lastExecuteTime', title: '最后通知时间', + minWidth: 180, formatter: 'formatDateTime', }, { field: 'nextNotifyTime', title: '下次通知时间', + minWidth: 180, formatter: 'formatDateTime', }, { field: 'notifyTimes', title: '通知次数', - cellRender: { - name: 'CellTag', - props: { - type: 'success', - content: '{notifyTimes} / {maxNotifyTimes}', - }, - }, + minWidth: 120, + formatter: ({ row }) => `${row.notifyTimes} / ${row.maxNotifyTimes}`, }, { title: '操作', @@ -132,41 +172,110 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { ]; } -/** 详情列表的字段 */ -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, - }, -]; +/** 详情的字段 */ +export function useDetailSchema(): DescriptionItemSchema[] { + return [ + { + field: 'appId', + label: '应用编号', + }, + { + field: 'appName', + label: '应用名称', + }, + { + field: 'type', + label: '通知类型', + content: (data: PayNotifyApi.NotifyTask) => + h(DictTag, { + type: DICT_TYPE.PAY_NOTIFY_TYPE, + value: data?.type, + }), + }, + { + field: 'dataId', + label: '关联编号', + }, + { + field: 'status', + label: '通知状态', + content: (data: PayNotifyApi.NotifyTask) => + h(DictTag, { + type: DICT_TYPE.PAY_NOTIFY_STATUS, + value: data?.status, + }), + }, + { + field: 'merchantOrderId', + label: '商户订单编号', + }, + { + field: 'lastExecuteTime', + label: '最后通知时间', + content: (data: PayNotifyApi.NotifyTask) => + formatDateTime(data?.lastExecuteTime) as string, + }, + { + field: 'nextNotifyTime', + label: '下次通知时间', + content: (data: PayNotifyApi.NotifyTask) => + formatDateTime(data?.nextNotifyTime) as string, + }, + { + field: 'notifyTimes', + label: '通知次数', + }, + { + field: 'maxNotifyTimes', + label: '最大通知次数', + }, + { + field: 'createTime', + label: '创建时间', + content: (data: PayNotifyApi.NotifyTask) => + formatDateTime(data?.createTime) as string, + }, + { + field: 'updateTime', + label: '更新时间', + content: (data: PayNotifyApi.NotifyTask) => + formatDateTime(data?.updateTime) as string, + }, + ]; +} + +/** 详情的日志字段 */ +export function useDetailLogColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '日志编号', + minWidth: 120, + }, + { + field: 'status', + title: '通知状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.PAY_NOTIFY_STATUS }, + }, + }, + { + field: 'notifyTimes', + title: '通知次数', + minWidth: 120, + }, + { + field: 'createTime', + title: '通知时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + { + field: 'response', + title: '响应结果', + minWidth: 200, + }, + ]; +} diff --git a/apps/web-ele/src/views/pay/notify/index.vue b/apps/web-ele/src/views/pay/notify/index.vue index 983b94433..9821fb9ff 100644 --- a/apps/web-ele/src/views/pay/notify/index.vue +++ b/apps/web-ele/src/views/pay/notify/index.vue @@ -1,9 +1,12 @@ - - + + +