118 lines
2.6 KiB
TypeScript
118 lines
2.6 KiB
TypeScript
|
|
import type { VbenFormSchema } from '#/adapter/form';
|
||
|
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||
|
|
|
||
|
|
import { getOrderProcessStatusName } from '#/utils/agent';
|
||
|
|
|
||
|
|
export function useOrderColumns(): VxeTableGridOptions['columns'] {
|
||
|
|
return [
|
||
|
|
{
|
||
|
|
field: 'id',
|
||
|
|
title: 'ID',
|
||
|
|
width: 80,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'agent_id',
|
||
|
|
title: '代理ID',
|
||
|
|
width: 100,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'order_id',
|
||
|
|
title: '订单ID',
|
||
|
|
width: 100,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'product_id',
|
||
|
|
title: '产品ID',
|
||
|
|
width: 100,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'product_name',
|
||
|
|
title: '产品名称',
|
||
|
|
width: 150,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'order_amount',
|
||
|
|
title: '订单金额',
|
||
|
|
width: 120,
|
||
|
|
formatter: ({ cellValue }: { cellValue: number }) =>
|
||
|
|
`¥${cellValue.toFixed(2)}`,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'set_price',
|
||
|
|
title: '设定价格',
|
||
|
|
width: 120,
|
||
|
|
formatter: ({ cellValue }: { cellValue: number }) =>
|
||
|
|
`¥${cellValue.toFixed(2)}`,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'actual_base_price',
|
||
|
|
title: '实际底价',
|
||
|
|
width: 120,
|
||
|
|
formatter: ({ cellValue }: { cellValue: number }) =>
|
||
|
|
`¥${cellValue.toFixed(2)}`,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'price_cost',
|
||
|
|
title: '提价成本',
|
||
|
|
width: 120,
|
||
|
|
formatter: ({ cellValue }: { cellValue: number }) =>
|
||
|
|
`¥${cellValue.toFixed(2)}`,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'agent_profit',
|
||
|
|
title: '代理收益',
|
||
|
|
width: 120,
|
||
|
|
formatter: ({ cellValue }: { cellValue: number }) =>
|
||
|
|
`¥${cellValue.toFixed(2)}`,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'process_status',
|
||
|
|
title: '处理状态',
|
||
|
|
width: 100,
|
||
|
|
cellRender: {
|
||
|
|
name: 'CellTag',
|
||
|
|
options: [
|
||
|
|
{ value: 0, color: 'warning', label: '待处理' },
|
||
|
|
{ value: 1, color: 'success', label: '处理成功' },
|
||
|
|
{ value: 2, color: 'error', label: '处理失败' },
|
||
|
|
],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
field: 'create_time',
|
||
|
|
title: '创建时间',
|
||
|
|
width: 160,
|
||
|
|
sortable: true,
|
||
|
|
},
|
||
|
|
] as const;
|
||
|
|
}
|
||
|
|
|
||
|
|
export function useOrderFormSchema(): VbenFormSchema[] {
|
||
|
|
return [
|
||
|
|
{
|
||
|
|
component: 'InputNumber',
|
||
|
|
fieldName: 'agent_id',
|
||
|
|
label: '代理ID',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
component: 'InputNumber',
|
||
|
|
fieldName: 'order_id',
|
||
|
|
label: '订单ID',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
component: 'Select',
|
||
|
|
fieldName: 'process_status',
|
||
|
|
label: '处理状态',
|
||
|
|
componentProps: {
|
||
|
|
allowClear: true,
|
||
|
|
options: [
|
||
|
|
{ label: '待处理', value: 0 },
|
||
|
|
{ label: '处理成功', value: 1 },
|
||
|
|
{ label: '处理失败', value: 2 },
|
||
|
|
],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|