import { httpList } from "/@/api/purchase/porder";
import { ContentConfig } from "/@/components/PageContent";
import { renderIconLabelLeft, renderProp } from "/@/utils/columnRenderHelper";

import {
  cgdStatusOptions,
  cg_order_source_options,
  cg_order_type_options,
  sendStatusOptions,
  send_status_list
} from "/@/utils/status";

const columns = [
  {
    width: 40,
    type: "selection",
    align: "center",
    fixed: "left"
  },
  // {
  //   label: "序号",
  //   type: "index",
  //   width: 70,
  //   hide: ({ checkList }) => !checkList.includes("序号列")
  // },
  {
    label: "采购单编码",
    prop: "sequenceNo",
    width: "150px"
  },
  {
    label: "采购主单编码",
    prop: "cxCode",
    width: "150px"
  },
  {
    label: "销售订单编码",
    prop: "qrdCode",
    width: "150px"
  },
  {
    label: "状态",
    prop: "status",
    width: 95,
    ...renderProp(cgdStatusOptions, "status")
  },
  {
    label: "销售单发货状态",
    prop: "qrdSend",
    width: 105,
    ...renderProp(send_status_list, "qrdSend")
  },
  {
    label: "入库状态",
    prop: "sendStatus",
    width: 95,
    ...renderProp(sendStatusOptions, "sendStatus")
  },
  {
    label: "状态",
    prop: "sendStatus",
    width: 95,
    ...renderProp(sendStatusOptions, "sendStatus")
  },
  {
    label: "订单来源",
    prop: "cgdSource",
    width: 95,
    ...renderProp(cg_order_source_options, "cgdSource")
  },
  {
    label: "商品来源",
    prop: "cgdType",
    width: 95,
    ...renderProp(cg_order_type_options, "cgdType")
  },
  {
    label: "支付方式",
    prop: "pay_type",
    width: 95
  },
  {
    label: "商品编码",
    prop: "goodNo",
    width: "150px"
  },
  {
    label: "商品名称",
    prop: "goodName",
    width: "180px"
  },
  {
    label: "税率",
    prop: "tax",
    width: "45px"
  },
  {
    label: "商品数量",
    prop: "goodNum",
    width: "80px"
  },
  {
    label: "商品单价",
    prop: "goodPrice",
    width: "80px"
  },
  {
    label: "商品总价",
    prop: "totalPrice",
    width: "80px"
  },
  // {
  //   label: "买方公司编码",
  //   prop: "companyNo",
  //   width: "150
  // },
  {
    label: "买入方公司",
    prop: "companyName",
    width: "150px",
    ...renderIconLabelLeft("companyNo", "companyName", "买入方公司编码:")
  },
  {
    label: "卖出方公司",
    prop: "supplierNo",
    width: "150px",
    ...renderIconLabelLeft("supplierNo", "supplierName", "买厨房公司编码:")
  },
  // {
  //   label: "卖方公司名称",
  //   prop: "supplierName",
  //   width: "175px"
  // },
  {
    label: "备库单",
    prop: "bkCode",
    width: "150px"
  },
  {
    label: "采购员",
    prop: "ownerName",
    width: 75
  },

  {
    label: "创建时间",
    prop: "addtime",
    width: 140
  },
  {
    label: "操作",
    fixed: "right",
    width: 55,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "采购单管理",
  columns,
  companyProp: "supplierNo",
  listNoRelation: true,
  apis: {
    httpList,
    httpAdd: true
  }
};

export default contentConfig;
