Files
ycc-proxy-admin/apps/web-antd/src/views/complaint/list/data.ts
2026-02-08 17:01:33 +08:00

186 lines
4.1 KiB
TypeScript

import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ComplaintApi } from '#/api/complaint';
export function useColumns<T = ComplaintApi.Complaint>(
onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] {
return [
{
field: 'id',
title: 'ID',
width: 100,
},
{
cellRender: {
name: 'CellTag',
options: [
{ value: 'alipay', color: 'blue', label: '支付宝投诉' },
{ value: 'manual', color: 'green', label: '主动投诉' },
],
},
field: 'type',
title: '投诉类型',
width: 120,
},
{
field: 'name',
title: '投诉人姓名',
minWidth: 120,
},
{
field: 'contact',
title: '联系方式',
minWidth: 150,
},
{
field: 'content',
title: '投诉内容',
minWidth: 200,
showOverflow: 'tooltip',
},
{
cellRender: {
name: 'CellTag',
options: [
{ value: 'pending', color: 'warning', label: '待处理' },
{ value: 'processing', color: 'processing', label: '处理中' },
{ value: 'resolved', color: 'success', label: '已解决' },
{ value: 'closed', color: 'default', label: '已关闭' },
],
},
field: 'status',
title: '投诉状态',
width: 120,
},
{
field: 'status_description',
title: '状态描述',
minWidth: 150,
showOverflow: 'tooltip',
},
{
field: 'task_id',
title: '投诉单号',
minWidth: 150,
},
{
field: 'trade_no',
title: '交易单号',
minWidth: 180,
},
{
field: 'complain_amount',
title: '投诉金额',
width: 120,
formatter: ({ row }) => {
if (row.complain_amount) {
return `¥${parseFloat(row.complain_amount).toFixed(2)}`;
}
return '-';
},
},
{
field: 'order_id',
title: '关联订单ID',
minWidth: 150,
},
{
field: 'create_time',
title: '创建时间',
width: 180,
},
{
field: 'handle_time',
title: '处理时间',
width: 180,
},
{
align: 'center',
cellRender: {
attrs: {
nameField: 'id',
nameTitle: '投诉ID',
onClick: onActionClick,
},
name: 'CellOperation',
options: [
{
code: 'detail',
text: '查看详情',
},
{
code: 'update_status',
text: '更新状态',
},
{
code: 'update_remark',
text: '更新备注',
},
],
},
field: 'operation',
fixed: 'right',
title: '操作',
width: 200,
},
];
}
export function useGridFormSchema(): VbenFormSchema[] {
return [
{
component: 'Select',
componentProps: {
allowClear: true,
options: [
{ label: '支付宝投诉', value: 'alipay' },
{ label: '主动投诉', value: 'manual' },
],
},
fieldName: 'type',
label: '投诉类型',
},
{
component: 'Select',
componentProps: {
allowClear: true,
options: [
{ label: '待处理', value: 'pending' },
{ label: '处理中', value: 'processing' },
{ label: '已解决', value: 'resolved' },
{ label: '已关闭', value: 'closed' },
],
},
fieldName: 'status',
label: '投诉状态',
},
{
component: 'Input',
fieldName: 'name',
label: '投诉人姓名',
},
{
component: 'Input',
fieldName: 'contact',
label: '联系方式',
},
{
component: 'Input',
fieldName: 'order_id',
label: '关联订单ID',
},
{
component: 'RangePicker',
fieldName: 'create_time',
label: '创建时间',
},
{
component: 'RangePicker',
fieldName: 'handle_time',
label: '处理时间',
},
];
}