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

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

export const gridOptions: VxeGridProps<any> = {
  columnConfig: { useKey: true },
  rowConfig: { useKey: true, isHover: true },
  columns: [
    { field: 'id', title: 'ID', width: 70 },
    { field: 'store_id', title: '门店ID', width: 90 },
    { field: 'store_name', title: '门店', minWidth: 140 },
    {
      field: 'vip_badge',
      title: 'VIP徽标',
      width: 100,
      slots: { default: 'vip_badge' },
    },
    { field: 'duration_label', title: '会员类型', width: 110 },
    { field: 'level_name', title: '等级', width: 110 },
    { field: 'level_code', title: '编码', width: 100 },
    { field: 'original_price', title: '原价', width: 90 },
    { field: 'pay_amount', title: '实付', width: 90 },
    { field: 'open_type_txt', title: '开通方式', width: 110 },
    { field: 'operator_name', title: '操作人', width: 110 },
    { field: 'expire_at', title: '到期时间', width: 170 },
    { field: 'created_at', title: '开通时间', width: 170 },
    { field: 'remark', title: '备注', minWidth: 120 },
  ],
  keepSource: true,
  pagerConfig: {},
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues) => {
        return await getVipRecordList({
          page: page.currentPage,
          pageSize: page.pageSize,
          ...formValues,
        });
      },
    },
  },
  border: false,
  toolbarConfig: { search: true, refresh: true, zoom: true },
};
