80 lines
1.7 KiB
TypeScript
80 lines
1.7 KiB
TypeScript
|
|
import type { VbenFormSchema } from '#/adapter/form';
|
||
|
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||
|
|
|
||
|
|
import { getRebateTypeName } from '#/utils/agent';
|
||
|
|
|
||
|
|
export function useRebateColumns(): VxeTableGridOptions['columns'] {
|
||
|
|
return [
|
||
|
|
{
|
||
|
|
field: 'id',
|
||
|
|
title: 'ID',
|
||
|
|
width: 80,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'agent_id',
|
||
|
|
title: '代理ID',
|
||
|
|
width: 100,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'source_agent_id',
|
||
|
|
title: '来源代理ID',
|
||
|
|
width: 120,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'order_id',
|
||
|
|
title: '订单ID',
|
||
|
|
width: 100,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'rebate_type',
|
||
|
|
title: '返佣类型',
|
||
|
|
width: 140,
|
||
|
|
formatter: ({ cellValue }: { cellValue: number }) => {
|
||
|
|
return getRebateTypeName(cellValue);
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'amount',
|
||
|
|
title: '返佣金额',
|
||
|
|
width: 120,
|
||
|
|
formatter: ({ cellValue }: { cellValue: number }) =>
|
||
|
|
`¥${cellValue.toFixed(2)}`,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'create_time',
|
||
|
|
title: '创建时间',
|
||
|
|
width: 160,
|
||
|
|
sortable: true,
|
||
|
|
},
|
||
|
|
] as const;
|
||
|
|
}
|
||
|
|
|
||
|
|
export function useRebateFormSchema(): VbenFormSchema[] {
|
||
|
|
return [
|
||
|
|
{
|
||
|
|
component: 'InputNumber',
|
||
|
|
fieldName: 'agent_id',
|
||
|
|
label: '代理ID',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
component: 'InputNumber',
|
||
|
|
fieldName: 'source_agent_id',
|
||
|
|
label: '来源代理ID',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
component: 'Select',
|
||
|
|
fieldName: 'rebate_type',
|
||
|
|
label: '返佣类型',
|
||
|
|
componentProps: {
|
||
|
|
allowClear: true,
|
||
|
|
options: [
|
||
|
|
{ label: '直接上级返佣', value: 1 },
|
||
|
|
{ label: '钻石上级返佣', value: 2 },
|
||
|
|
{ label: '黄金上级返佣', value: 3 },
|
||
|
|
],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|