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

import { getAccountAbleChangeLogList } from '#/views/finance/withdrawal/api/account-change';

export const accountChangeGridOptions: VxeGridProps = {
  columnConfig: {
    useKey: true,
  },
  rowConfig: {
    keyField: 'id',
    useKey: true,
  },
  columns: [
    { field: 'created_at', title: '变动时间', width: 170 },
    { field: 'source_type_txt', title: '来源类型', width: 100 },
    { field: 'field_name_txt', title: '变更字段', width: 120 },
    { field: 'before_amount', title: '变动前', width: 110 },
    { field: 'after_amount', title: '变动后', width: 110 },
    { field: 'change_amount', title: '变动值', width: 110 },
    { field: 'order_no', title: '订单号', minWidth: 160 },
    { field: 'source_table', title: '来源表', width: 140 },
    { field: 'remark', title: '备注', minWidth: 180 },
    { type: 'html', title: '操作', slots: { default: 'action' }, width: 100 },
  ],
  keepSource: true,
  pagerConfig: {},
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues) => {
        return await getAccountAbleChangeLogList({
          page: page.currentPage,
          pageSize: page.pageSize,
          ...formValues,
        });
      },
    },
  },
  border: false,
  toolbarConfig: {
    search: true,
    refresh: true,
    print: false,
    export: false,
    zoom: true,
    slots: {
      buttons: 'toolbar-buttons',
    },
  },
  showOverflow: false,
};
