import { FormSchema } from '/@/components/Form/index';
import { BasicColumn, FormProps } from '/@/components/Table';
import { Time } from '/@/components/Time';
import { h } from 'vue';

export interface ListItem {
  key: string;
  title: string;
  description: string;
  extra?: string;
  avatar?: string;
  color?: string;
}

// tab的list
export const settingList = [
  {
    key: '1',
    name: '用户概览',
    component: 'Overview',
  },
  {
    key: '2',
    name: '订单列表',
    component: 'OrderList',
  },
  {
    key: '3',
    name: '产品数据',
    component: 'Product',
  },
];

// 基础设置 form
export const baseSetschemas: FormSchema[] = [
  {
    field: 'email',
    component: 'Input',
    label: '邮箱',
    colProps: { span: 18 },
  },
  {
    field: 'name',
    component: 'Input',
    label: '昵称',
    colProps: { span: 18 },
  },
  {
    field: 'introduction',
    component: 'InputTextArea',
    label: '个人简介',
    colProps: { span: 18 },
  },
  {
    field: 'phone',
    component: 'Input',
    label: '联系电话',
    colProps: { span: 18 },
  },
  {
    field: 'address',
    component: 'Input',
    label: '所在地区',
    colProps: { span: 18 },
  },
];

// 安全设置 list
export const secureSettingList: ListItem[] = [
  {
    key: '1',
    title: '账户密码',
    description: '当前密码强度：：强',
    extra: '修改',
  },
  {
    key: '2',
    title: '密保手机',
    description: '已绑定手机：：138****8293',
    extra: '修改',
  },
  {
    key: '3',
    title: '密保问题',
    description: '未设置密保问题，密保问题可有效保护账户安全',
    extra: '修改',
  },
  {
    key: '4',
    title: '备用邮箱',
    description: '已绑定邮箱：：ant***sign.com',
    extra: '修改',
  },
  {
    key: '5',
    title: 'MFA 设备',
    description: '未绑定 MFA 设备，绑定后，可以进行二次确认',
    extra: '修改',
  },
];

// 账号绑定 list
export const accountBindList: ListItem[] = [
  {
    key: '1',
    title: '绑定淘宝',
    description: '当前未绑定淘宝账号',
    extra: '绑定',
    avatar: 'ri:taobao-fill',
    color: '#ff4000',
  },
  {
    key: '2',
    title: '绑定支付宝',
    description: '当前未绑定支付宝账号',
    extra: '绑定',
    avatar: 'fa-brands:alipay',
    color: '#2eabff',
  },
  {
    key: '3',
    title: '绑定钉钉',
    description: '当前未绑定钉钉账号',
    extra: '绑定',
    avatar: 'ri:dingding-fill',
    color: '#2eabff',
  },
];

// 新消息通知 list
export const msgNotifyList: ListItem[] = [
  {
    key: '1',
    title: '账户密码',
    description: '其他用户的消息将以站内信的形式通知',
  },
  {
    key: '2',
    title: '系统消息',
    description: '系统消息将以站内信的形式通知',
  },
  {
    key: '3',
    title: '待办任务',
    description: '待办任务将以站内信的形式通知',
  },
];
//权益订单
export const equityColumns: BasicColumn[] = [
  {
    title: '下单时间',
    dataIndex: 'createTime',
    width: 150,
    customRender: ({ record }) => {
      return (
        record.createTime &&
        h(Time, {
          value: record.createTime,
          mode: 'datetime',
        })
      );
    },
  },
  {
    title: '订单号',
    dataIndex: 'orderSn',
    ellipsis: false,
    width: 180,
  },
  {
    title: '用户账号',
    dataIndex: 'userName',
    width: 100,
  },
  {
    title: '数量',
    dataIndex: 'count',
    width: 80,
  },
  {
    title: '交易号',
    dataIndex: 'number',
    width: 180,
  },
  {
    title: '订单金额',
    dataIndex: 'amount',
    width: 80,
  },
  {
    title: '支付方式',
    dataIndex: 'payType',
    // slots: { customRender: 'orderType' },
    width: 80,
  },
  {
    title: '订单状态',
    dataIndex: 'payStatus',
    // slots: { customRender: 'orderStatus' },
    width: 80,
  },
];
export const equitySearchForm: Partial<FormProps> = {
  labelWidth: 100,
  autoSubmitOnEnter:true,
  autoAdvancedLine:1,
  actionColOptions: {
    span: 24,
  },
  schemas: [
    {
      field: 'ctivated',
      label: '下单时间',
      component: 'RangePicker',
      componentProps: {
        maxLength: 100,
        format: 'YYYY-MM-DD',
        valueFormat:'YYYY-MM-DD',
      },
      colProps: {
        xl: 7,
        xxl: 7,
      },
    },{
      field: 'orderSn',
      label: '订单号',
      component: 'Input',
      componentProps: {
        maxLength: 100,
      },
      colProps: {
        xl: 7,
        xxl: 7,
      },
    },{
      field: 'userName',
      label: '用户账号',
      component: 'Input',
      componentProps: {
        maxLength: 100,
      },
      colProps: {
        xl: 7,
        xxl: 7,
      },
    },{
      field: 'tradeNum',
      label: '交易号',
      component: 'Input',
      componentProps: {
        maxLength: 100,
      },
      colProps: {
        xl: 7,
        xxl: 7,
      },
    },
  ],
};
export const orderSearchForm: Partial<FormProps> = {
  labelWidth: 100,
  autoSubmitOnEnter:true,
  autoAdvancedLine:1,
  actionColOptions: {
    span: 24,
  },
  schemas: [
    {
      field: 'ctivated',
      label: '下单时间',
      component: 'RangePicker',
      componentProps: {
        maxLength: 100,
        format: 'YYYY-MM-DD',
        valueFormat:'YYYY-MM-DD',
      },
      colProps: {
        xl: 7,
        xxl: 7,
      },
    },{
      field: 'orderSn',
      label: '订单号',
      component: 'Input',
      componentProps: {
        maxLength: 100,
      },
      colProps: {
        xl: 7,
        xxl: 7,
      },
    },{
      field: 'tradeNum',
      label: '交易号',
      component: 'Input',
      componentProps: {
        maxLength: 100,
      },
      colProps: {
        xl: 7,
        xxl: 7,
      },
    },
  ],
};
//下载订单
export const dowmColumns: BasicColumn[] = [
  {
    title: '下单时间',
    dataIndex: 'createTime',
    width: 150,
    customRender: ({ record }) => {
      return (
        record.createTime &&
        h(Time, {
          value: record.createTime,
          mode: 'datetime',
        })
      );
    },
  },
  {
    title: '订单号',
    dataIndex: 'orderSn',
    ellipsis: false,
    width: 180,
  },
  {
    title: '用户账号',
    dataIndex: 'userName',
    width: 120,
  },{
    title: 'SN码',
    dataIndex: 'snCode',
    width: 120,
  },{
    title: '场景',
    dataIndex: 'sceneNum',
    width: 100,
  },
  {
    title: '订单金额(元)',
    dataIndex: 'amount',
    width: 80,
  },
  {
    title: '支付方式',
    dataIndex: 'payType',
    // slots: { customRender: 'orderType' },
    width: 80,
  },
  {
    title: '交易号',
    dataIndex: 'number',
    width: 180,
  },
  {
    title: '订单状态',
    dataIndex: 'payStatus',
    // slots: { customRender: 'orderStatus' },
    width: 80,
  },
];
//相机订单
export const cameraColumns: BasicColumn[] = [
  {
    title: '下单时间',
    dataIndex: 'orderTime',
    width: 150,
    customRender: ({ record }) => {
      return (
        record.orderTime &&
        h(Time, {
          value: record.orderTime,
          mode: 'datetime',
        })
      );
    },
  },
  {
    title: '订单号',
    dataIndex: 'orderSn',
    ellipsis: false,
    width: 180,
  },
  {
    title: '用户账号',
    dataIndex: 'userName',
    ellipsis: false,
    width: 120,
  },
  {
    title: '订单金额(元)',
    dataIndex: 'goodsAmount',
    ellipsis: false,
    width: 120,
  },
  {
    title: '支付方式',
    dataIndex: 'paymentTypeName',
    width: 80,
  },
  {
    title: '交易号',
    dataIndex: 'tradeNum',
    width: 220,
  },
  {
    title: '订单状态',
    dataIndex: 'paymentStatus',
    // slots: { customRender: 'orderStatus' },
    width: 80,
  },
];
