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

import { getChargeCashPayRecordListApi } from '../api';

interface RowType {
  id: string;
  name: string;
  logo: string;
  introduce: string;
  created_at: string;
}

export const gridOptions: VxeGridProps<RowType> = {
  checkboxConfig: {
    highlight: true,
    labelField: '',
  },
  columns: [
    { field: 'id', align: 'left', title: 'ID', width: 70 },
    { field: 'order_no', title: '提现订单号' },
    { field: 'subject_name', title: '申请主体', slots: { default: 'subject' } },
    { field: 'apply_cash', title: '关联提现', slots: { default: 'apply-info' }, minWidth: 140 },
    { field: 'charge_cash', title: '手续费' },
    { field: 'status', title: '代付状态', slots: { default: 'status' } },
    { field: 'created_at', title: '记录时间' },
    {
      type: 'html',
      title: '操作',
      align: 'right',
      slots: { default: 'action' },
      width: 100,
    },
  ],
  keepSource: true,
  pagerConfig: {},
  columnConfig: {
    useKey: true,
  },
  rowConfig: {
    useKey: true,
  },
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues) => {
        return await getChargeCashPayRecordListApi({
          page: page.currentPage,
          pageSize: page.pageSize,
          ...formValues,
        });
      },
    },
  },
  height: 'auto',
  border: false,
  toolbarConfig: {
    // @ts-ignore 正式环境时有完整的类型声明
    search: true,
    refresh: true,
    print: false,
    export: false,
    zoom: true,
    slots: {
      buttons: 'toolbar-actions',
    },
    custom: {
      icon: 'vxe-icon-menu',
    },
  },
  expandConfig: {},
  showOverflow: false,
};
