import { ContentConfig } from "/@/components/PageContent";
import {
  httpList,
  httpAdd,
  httpUpdate,
  httpStatus,
  httpDelete
} from "/@/api/parameter/good";
import { renderStatus, renderImage } from "/@/utils/column-helper";
import { STATUS_OPTIONS, GOOD_OPTIONS } from "/@/config/status";

const columns = [
  {
    type: "selection",
    width: 55,
    hide: ({ checkList }) => !checkList.includes("勾选列")
  },
  {
    prop: "good_code",
    label: "商品编码",
    width: "180px"
  },
  {
    prop: "good_cover_img",
    label: "图片",
    width: "60px",
    ...renderImage("good_cover_img")
  },
  {
    prop: "good_name",
    label: "商品名称",
    minWidth: "200px"
  },

  {
    prop: "type",
    label: "商品类型",
    ...renderStatus(GOOD_OPTIONS, "type")
    // width: "100px"
  },
  {
    prop: "status",
    label: "状态",
    ...renderStatus(STATUS_OPTIONS)
    // width: "80px"
  },

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

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

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

export default contentConfig;
