import { h } from "vue";
import { ElTag } from "element-plus";
import { statusOptions } from "./_options";
import { ContentConfig } from "/@/components/PageContent";
import { httpList } from "/@/api/sellOut/bargainList";

const columns = [
  {
    prop: 'bargainNo',
    label: '议价编号',
    width: '155'
  },
  {
    prop: 'infoNo',
    label: '竞价单编号',
    width: '155'
  },
  {
    prop: 'status',
    label: '状态',
    width: '130px',
    cellRenderer({ row }){
      return h(ElTag, null, {
        default: () => statusOptions.find((item) => Number(item.value) === Number(row.status))?.label || '--' 
      })
    }
  },
  {
    prop: 'bidsNo',
    label: '采返商品编号',
    width: '155'
  },

  {
    prop: 'companyNo',
    label: '业务公司编号',
    width: '155px'
  },
  {
    prop: 'companyName',
    label: '业务公司名称',
    width: '155px'
  },
  {
    prop: 'good_name',
    label: '商品名称',
    'min-width': '180'
  },
  {
    prop: 'can',
    label: '分类',
    'min-width': '125',
    cellRenderer({row}){
      return row.can.map(({ name }) => name).join('-')
    }
  },
  {
    prop: 'company_name',
    label: '申请人部门',
    minWidth: '150px'
  },

  {
    prop: 'creater',
    label: '申请人',
    'width': '75'
  },
  {
    prop: "",
    label: "操作",
    fixed: "right",
    width: "50px",
    slot: "operation",
  }
];

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

export default contentConfig;
