import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';


export function useWithdrawalColumns(): VxeTableGridOptions['columns'] {
  return [
    {
      title: 'ID',
      field: 'id',
      width: 80,
    },
    {
      title: '代理ID',
      field: 'agent_id',
      width: 100,
    },
    {
      title: '提现单号',
      field: 'withdraw_no',
      width: 180,
    },
    {
      title: '提现金额',
      field: 'amount',
      width: 120,
      formatter: ({ cellValue }) => `¥${cellValue.toFixed(2)}`,
    },
    {
      title: '税费金额',
      field: 'tax_amount',
      width: 120,
      formatter: ({ cellValue }) => `¥${cellValue.toFixed(2)}`,
    },
    {
      title: '实际到账金额',
      field: 'actual_amount',
      width: 120,
      formatter: ({ cellValue }) => `¥${cellValue.toFixed(2)}`,
    },
    {
      title: '收款账号',
      field: 'payee_account',
      width: 180,
    },
    {
      title: '收款人姓名',
      field: 'payee_name',
      width: 120,
    },
    {
      title: '状态',
      field: 'status',
      width: 100,
      cellRender: {
        name: 'CellTag',
        options: [
          { value: 1, color: 'warning', label: '待审核' },
          { value: 2, color: 'success', label: '审核通过' },
          { value: 3, color: 'error', label: '审核拒绝' },
          { value: 4, color: 'processing', label: '提现中' },
          { value: 5, color: 'success', label: '提现成功' },
          { value: 6, color: 'error', label: '提现失败' },
        ],
      },
    },
    {
      title: '备注',
      field: 'remark',
      width: 200,
    },
    {
      title: '创建时间',
      field: 'create_time',
      width: 160,
      sortable: true,
    },
    {
      align: 'center',
      slots: { default: 'operation' },
      field: 'operation',
      fixed: 'right',
      title: '操作',
      width: 120,
    },
  ];
}

export function useWithdrawalFormSchema(): VbenFormSchema[] {
  return [
    {
      component: 'Input',
      fieldName: 'withdraw_no',
      label: '提现单号',
    },
    {
      component: 'Select',
      fieldName: 'status',
      label: '状态',
      componentProps: {
        allowClear: true,
        options: [
          { label: '待审核', value: 1 },
          { label: '审核通过', value: 2 },
          { label: '审核拒绝', value: 3 },
          { label: '提现中', value: 4 },
          { label: '提现成功', value: 5 },
          { label: '提现失败', value: 6 },
        ],
      },
    },
  ];
}

