From 26dbe8ca94432de34f1ed0f2ffada3387bf4e924 Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 22 Aug 2023 11:11:40 +0800 Subject: [PATCH] feat: pay notify --- src/api/pay/app/index.ts | 5 + src/api/pay/notify/index.ts | 11 + src/components/Table/src/hooks/useRender.ts | 2 +- src/utils/dict.ts | 2 + src/views/pay/notify/NotifyModal.vue | 34 +++ src/views/pay/notify/index.vue | 50 +++++ src/views/pay/notify/notify.data.ts | 228 ++++++++++++++++++++ 7 files changed, 331 insertions(+), 1 deletion(-) create mode 100644 src/api/pay/notify/index.ts create mode 100644 src/views/pay/notify/NotifyModal.vue create mode 100644 src/views/pay/notify/index.vue create mode 100644 src/views/pay/notify/notify.data.ts diff --git a/src/api/pay/app/index.ts b/src/api/pay/app/index.ts index d566a61..322fb21 100644 --- a/src/api/pay/app/index.ts +++ b/src/api/pay/app/index.ts @@ -76,3 +76,8 @@ export function exportApp(params: AppExportReqVO) { export function getAppListByMerchantId(merchantId: number) { return defHttp.get({ url: '/pay/app/list-merchant-id', params: { merchantId } }) } + +// 获得支付应用列表 +export function getAppList() { + return defHttp.get({ url: '/pay/app/list' }) +} diff --git a/src/api/pay/notify/index.ts b/src/api/pay/notify/index.ts new file mode 100644 index 0000000..96f911f --- /dev/null +++ b/src/api/pay/notify/index.ts @@ -0,0 +1,11 @@ +import { defHttp } from '@/utils/http/axios' + +// 获得支付通知明细 +export function getNotifyTaskDetail(id) { + return defHttp.get({ url: `/pay/notify/get-detail?id=${id}` }) +} + +// 获得支付通知分页 +export function getNotifyTaskPage(params) { + return defHttp.get({ url: '/pay/notify/page', params }) +} diff --git a/src/components/Table/src/hooks/useRender.ts b/src/components/Table/src/hooks/useRender.ts index 821e6c1..9020e04 100644 --- a/src/components/Table/src/hooks/useRender.ts +++ b/src/components/Table/src/hooks/useRender.ts @@ -52,7 +52,7 @@ export const useRender = { * @param color 标签颜色 * @returns 标签 */ - renderTag: (text: string, color?: string) => { + renderTag: (text: string | number, color?: string) => { if (color) return h(Tag, { color }, () => text) else diff --git a/src/utils/dict.ts b/src/utils/dict.ts index b2fc8ff..62adc63 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -127,6 +127,8 @@ export enum DICT_TYPE { PAY_ORDER_REFUND_STATUS = 'pay_order_refund_status', // 商户支付订单退款状态 PAY_REFUND_ORDER_STATUS = 'pay_refund_order_status', // 退款订单状态 PAY_REFUND_ORDER_TYPE = 'pay_refund_order_type', // 退款订单类别 + PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态 + PAY_NOTIFY_TYPE = 'pay_notify_type', // 商户支付回调状态 // ========== MP 模块 ========== MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型 diff --git a/src/views/pay/notify/NotifyModal.vue b/src/views/pay/notify/NotifyModal.vue new file mode 100644 index 0000000..f76422f --- /dev/null +++ b/src/views/pay/notify/NotifyModal.vue @@ -0,0 +1,34 @@ + + + diff --git a/src/views/pay/notify/index.vue b/src/views/pay/notify/index.vue new file mode 100644 index 0000000..d7715ac --- /dev/null +++ b/src/views/pay/notify/index.vue @@ -0,0 +1,50 @@ + + + diff --git a/src/views/pay/notify/notify.data.ts b/src/views/pay/notify/notify.data.ts new file mode 100644 index 0000000..bc06086 --- /dev/null +++ b/src/views/pay/notify/notify.data.ts @@ -0,0 +1,228 @@ +import { getAppList } from '@/api/pay/app' +import type { DescItem } from '@/components/Description' +import type { BasicColumn, FormSchema } from '@/components/Table' +import { useRender } from '@/components/Table' +import { DICT_TYPE, getDictOptions } from '@/utils/dict' + +export const columns: BasicColumn[] = [ + { + title: '任务编号', + dataIndex: 'id', + width: 100, + }, + { + title: '应用编号', + dataIndex: 'appName', + width: 200, + }, + { + title: '商户订单编号', + dataIndex: 'merchantOrderId', + width: 200, + }, + { + title: '通知类型', + dataIndex: 'type', + width: 100, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.PAY_NOTIFY_TYPE) + }, + }, + { + title: '关联编号', + dataIndex: 'dataId', + width: 200, + }, + { + title: '通知状态', + dataIndex: 'status', + width: 100, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.PAY_NOTIFY_STATUS) + }, + }, + { + title: '最后通知时间', + dataIndex: 'lastExecuteTime', + width: 180, + customRender: ({ text }) => { + return useRender.renderDate(text) + }, + }, + { + title: '下次通知时间', + dataIndex: 'nextNotifyTime', + width: 180, + customRender: ({ text }) => { + return useRender.renderDate(text) + }, + }, + { + title: '最大通知次数', + dataIndex: 'maxNotifyTimes', + width: 120, + ifShow: false, + }, + { + title: '通知次数', + dataIndex: 'notifyTimes', + width: 120, + customRender: ({ record, text }) => { + return useRender.renderTag(`${text}/${record.maxNotifyTimes}`) + }, + }, +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '应用编号', + field: 'appId', + component: 'ApiSelect', + componentProps: { + api: () => getAppList(), + labelField: 'name', + valueField: 'id', + }, + colProps: { span: 8 }, + }, + { + label: '通知类型', + field: 'type', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.PAY_NOTIFY_TYPE, 'number'), + }, + colProps: { span: 8 }, + }, + { + label: '关联编号', + field: 'dataId', + component: 'Input', + colProps: { span: 8 }, + }, + + { + label: '通知状态', + field: 'status', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.PAY_NOTIFY_STATUS), + }, + colProps: { span: 8 }, + }, + { + label: '商户订单编号', + field: 'merchantOrderId', + component: 'Input', + colProps: { span: 8 }, + }, + { + label: '创建时间', + field: 'createTime', + component: 'RangePicker', + colProps: { span: 8 }, + }, +] + +export const descSchema: DescItem[] = [ + { + label: '商户订单编号', + field: 'merchantOrderId', + }, + { + label: '通知状态', + field: 'status', + render: (curVal) => { + return useRender.renderDict(curVal, DICT_TYPE.PAY_NOTIFY_STATUS) + }, + }, + { + label: '应用编号', + field: 'appId', + }, + { + label: '应用名称', + field: 'appName', + }, + { + label: '关联编号', + field: 'dataId', + }, + { + label: '通知类型', + field: 'type', + render: (curVal) => { + return useRender.renderDict(curVal, DICT_TYPE.PAY_NOTIFY_TYPE) + }, + }, + { + label: '通知次数', + field: 'notifyTimes', + }, + { + label: '最大通知次数', + field: 'maxNotifyTimes', + }, + { + label: '最后通知时间', + field: 'lastExecuteTime', + render: (curVal) => { + return useRender.renderDate(curVal) + }, + }, + { + label: '下次通知时间', + field: 'nextNotifyTime', + render: (curVal) => { + return useRender.renderDate(curVal) + }, + }, + { + label: '创建时间', + field: 'createTime', + render: (curVal) => { + return useRender.renderDate(curVal) + }, + }, + { + label: '更新时间', + field: 'updateTime', + render: (curVal) => { + return useRender.renderDate(curVal) + }, + }, +] + +export const descColumns: BasicColumn[] = [ + { + title: '日志编号', + dataIndex: 'id', + width: 100, + }, + { + title: '通知状态', + dataIndex: 'status', + width: 100, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.PAY_NOTIFY_STATUS) + }, + }, + { + title: '通知次数', + dataIndex: 'notifyTimes', + width: 100, + }, + { + title: '通知时间', + dataIndex: 'lastExecuteTime', + width: 100, + customRender: ({ text }) => { + return useRender.renderDate(text) + }, + }, + { + title: '响应结果', + dataIndex: 'response', + width: 100, + }, +]