import { ContentConfig } from "/@/components/PageContent";
import {
  httpList,
  httpAdd,
  httpUpdate,
  httpStatus,
  httpDelete
} from "/@/api/operate/setService";
import { renderStatus, timeInterval } from "/@/utils/column-helper";
import { ONLINE_OPTIONS } from "/@/config/status";

const columns = [
  {
    type: "selection",
    width: 55,
    hide: ({ checkList }) => !checkList.includes("勾选列")
  },

  {
    prop: "id",
    label: "ID",
    width: "90px"
  },
  {
    prop: "title",
    label: "服务名称",
    minWidth: "180px"
  },
  {
    prop: "status",
    label: "状态",
    ...renderStatus(ONLINE_OPTIONS),
    width: "100px"
  },
  {
    prop: "company_title",
    label: "公司名称",
    minWidth: "150px"
  },

  {
    prop: "card_title",
    label: "卡类型",
    width: "120px"
  },
  {
    prop: "original_price",
    label: "原价",
    width: "110px"
  },
  {
    prop: "activity_price",
    label: "活动价",
    width: "110px"
  },
  {
    prop: "starttime",
    label: "活动时间",
    ...timeInterval(["starttime", "endtime"], "~"),
    width: "200px"
  },

  {
    prop: "addtime",
    label: "创建时间",
    sortable: true,
    width: "160px"
  },

  {
    label: "操作",
    fixed: "right",
    width: 160,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "服务管理",
  columns,
  apis: {
    httpList,
    httpAdd,
    httpUpdate,
    httpStatus,
    httpDelete
  }
};

export default contentConfig;
