import { ContentConfig } from "/@/components/PageContent";
import { httpGoodupList } from "/@/api/sellOut/stockApply";
import { ElImage, ElTag } from "element-plus";
import { h } from "vue";



const columns = [
  {
    type: 'selection',
    width: '40px'
  },
  {
    prop: 'spuCode',
    label: '编号',
    width: '160'
  },
  {
    label: '图片',
    minWidth: '60px',
    cellRenderer({ row }){
      return h(ElImage, {
        style: { height: '20px', width: '20px' },
        previewSrcList: [row.good_info_img],
        previewTeleported: true,
        src: row.good_info_img,
      }, null)
    }
  },
  {
    prop: 'good_name',
    minWidth: '200px',
    label: '名称'
  },
  {
    label: '分类',
    width: '100px',
    cellRenderer({ row }){
      return (row.cat_info || []).map(({ name }) => name).join('/')
    }
  },
  {
    prop: 'brand_name',
    label: '品牌',
    width: '85px'
  },
  {
    prop: "create_source",
    label: "来源",
    width: '110px'
  },
  {
    prop: "good_type",
    label: "是否定制",
    width: "70px",
  },
  {
    prop: "unit",
    label: "单位",
    width: "45px",
  },
  {
    prop: "tax",
    label: "税率",
    width: "45px",
  },

  {
    prop: "supplierNo",
    label: "供应商编号",
    width: "160px",
  },
  {
    prop: "supplier_name",
    label: "供应商名称",
    width: "150px",
  },
  {
    prop: "companyNo",
    label: "业务公司编号",
    width: "160px",
  },
  {
    prop: "company",
    label: "业务公司名称",
    width: "150px",
  },
  {
    prop: "charger",
    label: "供应商负责人",
    fixed: "right",
    width: "95",
  }
];

const contentConfig: ContentConfig = {
  title: "备货申请管理",
  columns,
  apis: {
    httpList: (parameter = {}) => httpGoodupList({
      ...parameter,
      is_stock: '1',
      is_combind: '0',
      status: '1'
    }),
    httpAdd: true
  }
};

export default contentConfig;
