import type { VxeGridProps } from '#/adapter/vxe-table';

import { getWithdrawalApplicationList } from '#/views/system/delivery-warehouse-withdrawal/api';

interface RowType {
  id: number;
  apply_cash: number;
  true_cash: number;
  charge_cash: number;
  apply_time: string;
  check_status: number;
  check_result: string;
  dakuan_status: number;
  dakuan_time: string;
  created_at: string;
}

export const gridOptions: VxeGridProps<RowType> = {
  columnConfig: {
    useKey: true,
  },
  rowConfig: {
    useKey: true,
  },
  columns: [
    { field: 'id', align: 'left', title: 'ID', width: 80 },
    { field: 'apply_cash', title: '申请金额' },
    { field: 'true_cash', title: '实际到账' },
    { field: 'charge_cash', title: '手续费' },
    { field: 'apply_time', title: '申请时间' },
    {
      field: 'check_status',
      title: '审核状态',
      slots: { default: 'check_status' },
    },
    {
      field: 'check_result',
      title: '审核结果',
      slots: { default: 'check_result' },
    },
    {
      field: 'dakuan_status',
      title: '打款状态',
      slots: { default: 'dakuan_status' },
    },
    { field: 'dakuan_time', title: '打款时间' },
  ],
  keepSource: true,
  pagerConfig: {},
  proxyConfig: {
    ajax: {
      query: async ({ page }) => {
        return await getWithdrawalApplicationList({
          page: page.currentPage,
          pageSize: page.pageSize,
        });
      },
    },
  },
  height: 'auto',
  border: false,
  toolbarConfig: {
    refresh: true,
    print: false,
    export: false,
    zoom: true,
    custom: {
      icon: 'vxe-icon-menu',
    },
  },
  showOverflow: false,
};
