Files
tydata-admin/apps/web-antd/src/views/agent/agent-commission/data.ts
18278715334 9f511cba43
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
add
2025-12-31 12:40:55 +08:00

113 lines
2.7 KiB
TypeScript

import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { AgentApi } from '#/api';
// 佣金记录列表列配置
export function useCommissionColumns(
onActionClick?: (params: { code: string; row: AgentApi.AgentCommissionListItem }) => void,
): VxeTableGridOptions['columns'] {
return [
{
field: 'agent_id',
title: '代理ID',
width: 100,
},
{
field: 'order_id',
title: '订单ID',
width: 100,
},
{
field: 'amount',
title: '佣金金额',
width: 120,
formatter: ({ cellValue }: { cellValue: number }) =>
`¥${cellValue.toFixed(2)}`,
},
{
field: 'product_name',
title: '产品名称',
width: 150,
},
{
field: 'status',
title: '状态',
width: 100,
formatter: ({ cellValue }: { cellValue: number }) => {
const statusMap: Record<number, string> = {
0: '已结算',
1: '冻结中',
2: '已取消',
};
return statusMap[cellValue] || '未知';
},
},
{
field: 'create_time',
title: '创建时间',
width: 160,
sortable: true,
sortType: 'string' as const,
},
{
align: 'center',
cellRender: {
name: 'CellOperation',
attrs: {
nameField: 'id',
nameTitle: '操作',
onClick: onActionClick,
},
options: [
{
code: 'unfreeze',
text: '解冻',
type: 'primary',
disabled: (row: AgentApi.AgentCommissionListItem) => row?.status !== 1,
},
{
code: 'cancel',
text: '取消',
type: 'default',
disabled: (row: AgentApi.AgentCommissionListItem) => row?.status !== 1,
},
{
code: 'settled',
text: '已结算',
type: 'success',
disabled: (row: AgentApi.AgentCommissionListItem) => row?.status !== 0,
},
],
},
field: 'operation',
fixed: 'right',
title: '操作',
width: 300,
},
];
}
// 佣金记录搜索表单配置
export function useCommissionFormSchema(): VbenFormSchema[] {
return [
{
component: 'Input',
fieldName: 'product_name',
label: '产品名称',
},
{
component: 'Select',
fieldName: 'status',
label: '状态',
componentProps: {
allowClear: true,
options: [
{ label: '已结算', value: 0 },
{ label: '冻结中', value: 1 },
{ label: '已取消', value: 2 },
],
},
},
];
}