import { FormSchema } from '/@/components/Form/index';
import { BasicColumn, FormProps } from '/@/components/Table';
import { Time } from '/@/components/Time';
import { h } from 'vue';
import { incrementUseTypeList } from '/@/api/account';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();

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

// tab的list
export const settingList = [
  {
    key: '1',
    name: t('routes.dashboard.overview'),
    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: 'companyName',
    ellipsis: true,
    width: 230,
  },
  {
    title: '业务部门',
    dataIndex: 'businessDept',
    ellipsis: true,
    width: 120,
  },
  {
    title: '业务员',
    dataIndex: 'businessName',
    ellipsis: true,
    width: 120,
  },
  {
    title: '客户付款时间',
    dataIndex: 'customerPayTime',
    ellipsis: true,
    width: 160,
  },
  {
    title: '客户名称',
    dataIndex: 'customerName',
    width: 100,
  },
  {
    title: '客户类别',
    dataIndex: 'customerTypeStr',
    width: 100,
    customRender: ({ record }) => {
      return record.customerTypeStr ? record.customerTypeStr : '直销';
    },
  },
  {
    title: '终端客户名称',
    dataIndex: 'endCustomer',
    width: 100,
  },
  {
    title: '经销商名称',
    dataIndex: 'agentName',
    width: 100,
  },
  {
    title: '使用类型',
    dataIndex: 'useTypeStr',
    width: 100,
  },
  {
    title: '权益类型',
    dataIndex: 'memberLevels',
    width: 100,
  },
  {
    title: '订单金额',
    dataIndex: 'amount',
    width: 80,
  },
  {
    title: '币种',
    dataIndex: 'currencySymbol',
    width: 80,
  },
  {
    title: '数量',
    dataIndex: 'count',
    width: 80,
  },
  {
    title: '支付方式',
    dataIndex: 'payType',
    // slots: { customRender: 'orderType' },
    width: 80,
  },
  {
    title: '交易号',
    dataIndex: 'number',
    width: 180,
  },
  {
    title: '付款状态',
    dataIndex: 'payStatus',
    // slots: { customRender: 'orderStatus' },
    width: 80,
  },
  {
    title: '充值方式',
    dataIndex: 'payMethod',
    width: 100,
  },
  {
    title: '会员服务期限',
    dataIndex: 'incrementTime',
    width: 100,
  },
  {
    title: 'SN码',
    dataIndex: 'snCode',
    width: 100,
  },
  {
    title: '项目号',
    dataIndex: 'projectNum',
    width: 100,
  },
  {
    title: '备注',
    dataIndex: 'remark',
    width: 100,
  },
];
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: 8,
        xxl: 8,
      },
    },
    {
      field: 'orderSn',
      label: '订单号',
      component: 'Input',
      componentProps: {
        maxLength: 100,
      },
      colProps: {
        xl: 8,
        xxl: 8,
      },
    },
    {
      field: 'userName',
      label: '用户账号',
      component: 'Input',
      componentProps: {
        maxLength: 100,
      },
      colProps: {
        xl: 8,
        xxl: 8,
      },
    },
    {
      field: 'tradeNum',
      label: '交易号',
      component: 'Input',
      componentProps: {
        maxLength: 100,
      },
      colProps: {
        span: 8,
      },
    },
    {
      field: 'customerType',
      component: 'Select',
      label: '客户类别',
      colProps: {
        span: 8,
      },
      componentProps: {
        options: [
          {
            label: '直销',
            value: 0,
            key: '0',
          },
          {
            label: '经销',
            value: 1,
            key: '1',
          },
        ],
      },
    },
    {
      field: 'useType',
      component: 'ApiSelect',
      label: '使用类型',
      componentProps: {
        // filterOption: onFilterOption,
        // showSearch: true,
        api: incrementUseTypeList,
        labelField: 'name',
        valueField: 'id',
        immediate: true,
      },
      colProps: {
        span: 8,
      },
    },
    {
      field: 'payMethod',
      component: 'Select',
      label: '充值方式',
      colProps: {
        span: 8,
      },
      componentProps: {
        options: [
          {
            label: '线上',
            value: 0,
            key: '0',
          },
          {
            label: '线下',
            value: 1,
            key: '1',
          },
        ],
      },
    },
    {
      field: 'companyName',
      component: 'Select',
      label: '合同所属公司',
      colProps: {
        span: 8,
      },
      itemProps: {
        autoLink: false,
      },
      componentProps: {
        options: [
          {
            label: '珠海市四维时代网络科技有限公司',
            value: '珠海市四维时代网络科技有限公司',
            key: '珠海市四维时代网络科技有限公司',
          },
          {
            label: '广东四维看看智能设备有限公司',
            value: '广东四维看看智能设备有限公司',
            key: '广东四维看看智能设备有限公司',
          },
          {
            label: '四维看看（香港）有限公司',
            value: '四维看看（香港）有限公司',
            key: '四维看看（香港）有限公司',
          },
          {
            label: '四维看看(北京)数据科技有限公司',
            value: '四维看看(北京)数据科技有限公司',
            key: '四维看看(北京)数据科技有限公司',
          },
        ],
      },
    },
    {
      field: 'businessDept',
      component: 'Select',
      label: '业务部门',
      colProps: {
        span: 8,
      },
      itemProps: {
        autoLink: false,
      },
      componentProps: {
        options: [
          {
            label: '数字营销事业部',
            value: '数字营销事业部',
            key: '数字营销事业部',
          },
          {
            label: '政企事业部',
            value: '政企事业部',
            key: '政企事业部',
          },
          {
            label: '海外事业部',
            value: '海外事业部',
            key: '海外事业部',
          },
          {
            label: '市场部',
            value: '市场部',
            key: '市场部',
          },
          {
            label: '总经办',
            value: '总经办',
            key: '总经办',
          },
        ],
      },
    },
    {
      field: 'amount',
      component: 'Input',
      label: '订单金额',
      colProps: { span: 7 },
      componentProps: {
        type: 'number',
      },
    },
  ],
};
export const orderSearchForm: Partial<FormProps> = {
  labelWidth: 100,
  autoSubmitOnEnter: true,
  autoAdvancedLine: 1,
  actionColOptions: {
    span: 24,
  },
  schemas: [
    {
      field: 'orderSn',
      label: '订单号',
      component: 'Input',
      componentProps: {
        maxLength: 100,
      },
      colProps: {
        xl: 8,
        xxl: 8,
      },
    },
    // {
    //   field: 'userName',
    //   label: '用户账号',
    //   component: 'Input',
    //   componentProps: {
    //     maxLength: 100,
    //   },
    //   colProps: {
    //     xl: 7,
    //     xxl: 7,
    //   },
    // },
    {
      field: 'tradeNum',
      label: '交易号',
      component: 'Input',
      componentProps: {
        maxLength: 100,
      },
      colProps: {
        xl: 8,
        xxl: 8,
      },
    },
    {
      field: 'ctivated',
      label: '下单时间',
      component: 'RangePicker',
      componentProps: {
        maxLength: 100,
        format: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD',
      },
      colProps: {
        xl: 8,
        xxl: 8,
      },
    },
  ],
};
//下载订单
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: '合同所属公司',
    dataIndex: 'companyName',
    ellipsis: true,
    width: 230,
  },
  {
    title: '业务部门',
    dataIndex: 'businessDept',
    ellipsis: true,
    width: 120,
  },
  {
    title: '业务员',
    dataIndex: 'businessName',
    ellipsis: true,
    width: 120,
  },
  {
    title: '客户付款时间',
    dataIndex: 'customerPayTime',
    ellipsis: true,
    width: 160,
  },
  {
    title: 'SN码',
    dataIndex: 'snCode',
    width: 120,
  },
  {
    title: '场景',
    dataIndex: 'sceneNum',
    width: 100,
  },
  {
    title: '客户名称',
    dataIndex: 'customerName',
    width: 100,
  },
  {
    title: '客户类别',
    dataIndex: 'customerTypeStr',
    width: 100,
  },
  {
    title: '终端客户名称',
    dataIndex: 'endCustomer',
    width: 100,
  },
  {
    title: '经销商名称',
    dataIndex: 'agentName',
    width: 100,
  },
  {
    title: '使用类型',
    dataIndex: 'useTypeStr',
    width: 100,
  },
  {
    title: '下载类型',
    dataIndex: 'downTypeStr',
    width: 100,
    customRender: ({ record }) => {
      return record.payMethod == '线下' ? '-' : record.downTypeStr;
    },
  },
  {
    title: '订单金额(元)',
    dataIndex: 'amount',
    width: 80,
  },
  {
    title: '币种',
    dataIndex: 'currencySymbol',
    width: 80,
  },
  {
    title: '数量',
    dataIndex: 'count',
    width: 100,
  },
  {
    title: '支付方式',
    dataIndex: 'payType',
    // slots: { customRender: 'orderType' },
    width: 80,
  },
  {
    title: '交易号',
    dataIndex: 'number',
    width: 180,
  },
  {
    title: '付款状态',
    dataIndex: 'payStatus',
    // slots: { customRender: 'orderStatus' },
    width: 80,
  },
  {
    title: '充值方式',
    dataIndex: 'payMethod',
    width: 180,
  },
  {
    title: '项目号',
    dataIndex: 'projectNum',
    width: 100,
  },
  {
    title: '备注',
    dataIndex: 'remark',
    width: 100,
  },
];
//相机订单
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,
  },
];
