import { ref } from "vue";
import dayjs from "dayjs";
import { send_status_list, inv_status_list } from "/@/utils/status";
export function useColumns() {
  const columns = ref([
    {
      label: "销售订单编号",
      prop: "sequenceNo",
      minWidth: 160,
      showOverflowTooltip: true
    },

    {
      label: "所属平台",
      prop: "department",
      minWidth: 160,
      showOverflowTooltip: true
    },
    {
      label: "商品编码",
      prop: "goodNo",
      minWidth: 160,
      showOverflowTooltip: true
    },
    {
      label: "商品名称",
      prop: "goodName",
      minWidth: 160,
      showOverflowTooltip: true
    },
    {
      label: "企业客户编号",
      prop: "companyNo",
      minWidth: 160,
      showOverflowTooltip: true
    },
    {
      label: "企业客户名称",
      prop: "companyName",
      minWidth: 160,
      showOverflowTooltip: true
    },

    {
      label: "订单总金额",
      prop: "totalPrice",
      minWidth: 110,
      showOverflowTooltip: true
    },

    {
      label: "退货数量",
      prop: "th_fee",
      width: 110,
      showOverflowTooltip: true
    },
    {
      label: "退货金额",
      prop: "th_fee",
      width: 110,
      showOverflowTooltip: true
    },
    {
      label: "发货状态",
      prop: "sendStatus",
      minWidth: 110,
      showOverflowTooltip: true,
      cellRenderer: ({ row, props }) => (
        <el-tag
          size={props.size}
          type={
            (
              send_status_list.find(
                item => item.value == row.sendStatus + ""
              ) || {}
            ).type || "info"
          }
          effect="plain"
        >
          {(
            send_status_list.find(item => item.value == row.sendStatus + "") ||
            {}
          ).label || "--"}
        </el-tag>
      )
    },

    // {
    //   label: "资金已核销",
    //   prop: "inv_out",
    //   width: 160
    // },
    // {
    //   label: "资金核销中",
    //   prop: "email"
    // },
    // {
    //   label: "资金未核销",
    //   prop: "资金未核销",
    //   width: 80
    // },
    // {
    //   label: "发货状态",
    //   prop: "sendStatus",
    //   width: 120,
    //   showOverflowTooltip: true
    // },
    {
      label: "发票已核销",
      prop: "ainv_fee",
      minWidth: 110,
      showOverflowTooltip: true
    },
    {
      label: "发票核销中",
      prop: "inv_fee",
      minWidth: 110,
      showOverflowTooltip: true
    },
    {
      label: "发票未核销",
      prop: "winv_fee",
      minWidth: 110,
      showOverflowTooltip: true
    },

    {
      label: "发票核销状态",
      prop: "inv_type",
      minWidth: 110,
      showOverflowTooltip: true,
      cellRenderer: ({ row, props }) => (
        <el-tag
          size={props.size}
          type={
            (
              inv_status_list.find(item => item.value == row.inv_status + "") ||
              {}
            ).type || "info"
          }
          effect="plain"
        >
          {(
            inv_status_list.find(item => item.value == row.inv_status + "") ||
            {}
          ).label || "--"}
        </el-tag>
      )
    },
    {
      label: "业务员",
      prop: "ownerName",
      minWidth: 80,
      showOverflowTooltip: true
    },
    {
      label: "创建时间",
      minWidth: 145,
      prop: "createTime",
      showOverflowTooltip: true,
      formatter: ({ createTime }) =>
        dayjs(createTime).format("YYYY-MM-DD HH:mm:ss")
    }
  ]);

  return {
    columns
  };
}
