// import { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// import * as MailAccountApi from '@/api/system/mail/account'

// const userList = await MailAccountApi.getSimpleMailAccountList()
const userList = []

const crudSchemas = reactive([
  {
    label: '订单号',
    field: 'orderNo',
    isSearch: true,
    isTable: true
  },
  {
    label: '线索名称',
    field: 'name',
    isSearch: true,
    isTable: true
  },
  {
    label: '联系方式',
    field: 'contact',
    isSearch: true,
    isTable: true
  },
  {
    label: '线索来源',
    field: 'resource',
    isSearch: true,
    isTable: true,
    search: {
      component: 'Select',
      api: () => userList,
      componentProps: {
        optionsAlias: {
          labelField: 'name',
          valueField: 'id'
        }
      }
    }
  },
  {
    label: '跟进人员',
    field: 'userId',
    isSearch: true,
    isTable: true,
    search: {
      component: 'Select',
      api: () => userList,
      componentProps: {
        optionsAlias: {
          labelField: 'name',
          valueField: 'id'
        }
      }
    }
  },
  {
    label: '成交时间',
    field: 'createTime',
    isSearch: true,
    isTable: true,
    table: {
      fixed: 'left'
    },
    formatter: dateFormatter,
    detail: {
      dateFormat: 'YYYY-MM-DD'
    },
    search: {
      component: 'DatePicker',
      componentProps: {
        type: 'daterange',
        format: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD',
        startPlaceholder: '创建时间',
        endPlaceholder: '创建时间'
      }
    }
  },
  {
    label: '是否全款',
    field: 'isFull',
    isSearch: true,
    isTable: true,
    search: {
      component: 'Radio',
      componentProps: {
        options: [
          { label: '全款', value: 1 },
          { label: '非全款', value: 0 }
        ]
      }
    }
  }
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
