Files
aiot-platform-ui/apps/web-antd/src/views/pay/refund/data.ts

127 lines
2.7 KiB
TypeScript
Raw Normal View History

2025-04-30 14:37:40 +08:00
import type { VbenFormSchema } from '#/adapter/form';
2025-05-26 17:22:09 +08:00
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
2025-04-30 14:37:40 +08:00
import { getAppList } from '#/api/pay/app';
2025-05-28 21:06:58 +08:00
import {
DICT_TYPE,
getIntDictOptions,
getRangePickerDefaultProps,
getStrDictOptions,
} from '#/utils';
2025-04-30 14:37:40 +08:00
/** 列表的搜索表单 */
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: 'channelCode',
label: '退款渠道',
component: 'Select',
componentProps: {
allowClear: true,
options: getStrDictOptions(DICT_TYPE.PAY_CHANNEL_CODE),
},
},
{
fieldName: 'merchantOrderId',
label: '商户支付单号',
component: 'Input',
},
{
fieldName: 'merchantRefundId',
label: '商户退款单号',
component: 'Input',
},
{
fieldName: 'channelOrderNo',
label: '渠道支付单号',
component: 'Input',
},
{
fieldName: 'channelRefundNo',
label: '渠道退款单号',
component: 'Input',
},
{
fieldName: 'status',
label: '退款状态',
component: 'Select',
componentProps: {
allowClear: true,
options: getIntDictOptions(DICT_TYPE.PAY_REFUND_STATUS),
},
},
{
fieldName: 'createTime',
label: '创建时间',
2025-05-28 21:06:58 +08:00
component: 'RangePicker',
2025-04-30 14:37:40 +08:00
componentProps: {
2025-05-28 21:06:58 +08:00
...getRangePickerDefaultProps(),
allowClear: true,
2025-04-30 14:37:40 +08:00
},
},
];
}
/** 列表的字段 */
2025-05-26 17:22:09 +08:00
export function useGridColumns(): VxeTableGridOptions['columns'] {
2025-04-30 14:37:40 +08:00
return [
{
field: 'id',
title: '编号',
},
{
2025-05-28 11:36:52 +08:00
field: 'merchantRefundId',
title: '退款订单号',
},
{
field: 'channelRefundNo',
title: '渠道退款单号',
2025-04-30 14:37:40 +08:00
},
{
field: 'payPrice',
title: '支付金额',
2025-05-28 11:36:52 +08:00
formatter: 'formatFraction',
2025-04-30 14:37:40 +08:00
},
{
field: 'refundPrice',
title: '退款金额',
2025-05-28 11:36:52 +08:00
formatter: 'formatFraction',
2025-04-30 14:37:40 +08:00
},
{
field: 'status',
title: '退款状态',
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.PAY_REFUND_STATUS },
},
},
2025-05-28 11:36:52 +08:00
{
field: 'createTime',
title: '创建时间',
formatter: 'formatDateTime',
},
2025-04-30 14:37:40 +08:00
{
title: '操作',
2025-05-28 11:36:52 +08:00
width: 100,
2025-04-30 14:37:40 +08:00
fixed: 'right',
2025-05-26 17:22:09 +08:00
slots: { default: 'actions' },
2025-04-30 14:37:40 +08:00
},
];
}