import { ContentConfig } from "/@/components/PageContent";

import { httpList } from "/@/api/sellOut/zixunOrder";

import { h } from "vue";
import { ElImage } from "element-plus";
import { projectOptions, statusOptions } from "./options";
import { renderStatus } from "/@/utils/column-helper";

const columns = [
  {
    type: "selection",
    width: 55,
    hide: ({ checkList }) => !checkList.includes("勾选列")
  },
  {
    label: "序号",
    type: "index",
    width: 70,
    hide: ({ checkList }) => !checkList.includes("序号列")
  },
  {
    prop: "infoNo",
    label: "竞价编号",
    width: "180"
  },
  {
    prop: "bargain_num",
    label: "竞价次数",
    width: "100"
  },

  {
    prop: "good_img",
    label: "图片",
    width: "80",
    cellRenderer({ row }) {
      return h(ElImage, {
        previewSrcList: [row.good_img],
        src: row.good_img,
        previewTeleported: true
      });
    }
  },
  {
    prop: "good_name",
    label: "商品名称",
    "min-width": "120"
  },

  {
    prop: "status",
    label: "状态",
    width: "120px",
    cellRenderer({ row }) {
      return renderStatus(statusOptions, row.status);
    }
  },
  {
    prop: "is_project",
    label: "竞价单类型",
    width: "120px",
    cellRenderer({ row }) {
      return renderStatus(projectOptions, row.is_project);
    }
  },

  {
    prop: "khNo",
    label: "客户编号",
    width: "160"
  },
  {
    prop: "khname",
    label: "客户名称",
    "min-width": "135"
  },

  {
    prop: "budget_price",
    label: "预算单价",
    width: 110
  },
  {
    prop: "num",
    label: "竞价数量",
    width: 110
  },
  {
    prop: "company_name",
    label: "申请人部门",
    minWidth: "150px"
  },
  {
    prop: "creater",
    label: "申请人",
    width: "80"
  },

  {
    prop: "addtime",
    label: "添加时间",
    width: 142
  },
  {
    label: "操作",
    fixed: "right",
    width: 60,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "竞价单管理",
  columns,
  apis: {
    httpList
  }
};

export default contentConfig;
