import { ref } from "vue";
import {
  cg_order_type_options,
  cg_order_source_options
} from "/@/utils/status";
export function useColumns() {
  const columns = ref([
    {
      type: "selection",
      width: 55,
      hide: ({ checkList }) => !checkList.includes("勾选列")
    },
    {
      label: "序号",
      type: "index",
      width: 70,
      hide: ({ checkList }) => !checkList.includes("序号列")
    },

    {
      label: "采购单编号",
      prop: "sequenceNo"
    },
    {
      label: "商品编号",
      prop: "goodNo"
    },
    {
      label: "商品名称",
      prop: "goodName"
    },

    // {
    //   label: "业务公司编号",
    //   prop: "companyNo"
    // },
    // {
    //   label: "业务公司名称",
    //   prop: "companyName"
    // },
    {
      label: "供应商编号",
      prop: "supplierNo"
    },
    {
      label: "供应商名称",
      prop: "supplierName"
    },
    {
      label: "订单来源",
      prop: "cgdSource",
      width: 95,
      cellRenderer: ({ row, props }) => (
        <el-tag size={props.size} type="" effect="plain">
          {(
            cg_order_source_options.find(
              item => item.value == row.cgdSource + ""
            ) || {}
          ).label || "--"}
        </el-tag>
      )
    },
    {
      label: "商品类型",
      prop: "cgdType",
      width: 95,
      cellRenderer: ({ row, props }) => (
        <el-tag size={props.size} type="" effect="plain">
          {(
            cg_order_type_options.find(
              item => item.value == row.cgdType + ""
            ) || {}
          ).label || "--"}
        </el-tag>
      )
    },

    {
      label: "采购员",
      prop: "ownerName",
      width: 75
    },

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

  return {
    columns
  };
}

export const preview_columns: Array<{ field: string; label: string }> = [
  {
    label: "采购单名称",
    field: "name"
  },
  {
    label: "采购编号",
    field: "sequenceNo"
  },
  {
    label: "采购员",
    field: "ownerName"
  },
  {
    label: "部门",
    field: "department"
  },
  {
    label: "采购时间",
    field: "createdTime"
  },
  {
    label: "状态",
    field: "status"
  },
  {
    label: "采购单类型",
    field: "cgdType"
  },
  {
    label: "订单来源",
    field: "cgdSource"
  },
  {
    label: "业务企业编号",
    field: "companyNo"
  },
  {
    label: "业务企业公司",
    field: "companyName"
  },
  {
    label: "采购时间",
    field: "cgdTime"
  },
  {
    label: "备库编号",
    field: "bkCode"
  },
  {
    label: "确认单编号",
    field: "qrdCode"
  },
  {
    label: "商品编号",
    field: "goodNo"
  },
  {
    label: "商品名称",
    field: "ownerid"
  },
  {
    label: "商品类类型",
    field: "goodType"
  },
  {
    label: "品牌",
    field: "goodBrand"
  },
  {
    label: "一级分类",
    field: "firstCat"
  },
  {
    label: "二级分类",
    field: "secCat"
  },
  {
    label: "三级分类",
    field: "thirdCat"
  },
  {
    label: "核算码",
    field: "fundCode"
  },
  {
    label: "单位",
    field: "goodUnit"
  },
  {
    label: "工艺描述",
    field: "goodDesc"
  },
  {
    label: "金价",
    field: "metalsType"
  },
  {
    label: "贵金属类型",
    field: "metalsType"
  },
  {
    label: "贵金属重量",
    field: "weight"
  },
  {
    label: "金价",
    field: "goldPrice"
  },
  {
    label: "物流时间",
    field: "deliveryDay"
  },
  {
    label: "工期时间",
    field: "workDay"
  },
  {
    label: "税率",
    field: "tax"
  },
  {
    label: "裸价",
    field: "barePrice"
  },
  {
    label: "加标费",
    field: "markPrice"
  },
  {
    label: "包装费",
    field: "packPrice"
  },
  {
    label: "开模费",
    field: "costPrice"
  },
  {
    label: "物流费",
    field: "deliveryPrice"
  },
  {
    label: "单价",
    field: "goodPrice"
  },
  {
    label: "是否库存",
    field: "isStock"
  },
  {
    label: "商品数量",
    field: "goodNum"
  },
  {
    label: "总价",
    field: "totalPrice"
  },
  {
    label: "供应商编号",
    field: "supplierNo"
  },
  {
    label: "供应商名称",
    field: "supplierName"
  },
  {
    label: "已付金额",
    field: "apay_fee"
  },
  {
    label: "待付金额",
    field: "wpay_fee"
  },
  {
    label: "已回票",
    field: "ainv_fee"
  },
  {
    label: "未回票",
    field: "winv_fee"
  },
  {
    label: "发货方式",
    field: "sendType"
  },
  {
    label: "备库人员",
    field: "bkCreater"
  },
  {
    label: "发货状态",
    field: "sendStatus"
  },
  {
    label: "未发货数量",
    field: "wsendNum"
  },
  {
    label: "发货数量",
    field: "sendNum"
  },
  {
    label: "备注",
    field: "remark"
  },
  {
    label: "付款状态",
    field: "pay_status"
  },
  {
    label: "发票状态",
    field: "inv_status"
  },
  {
    label: "工差重量",
    field: "diff_weight"
  },
  {
    label: "工差金额",
    field: "diff_fee"
  },
  {
    label: "退货数量",
    field: "thNum"
  }
];

export const cgd_status = [
  {
    value: "0",
    label: "未对账"
  },
  {
    value: "1",
    label: "对账"
  }
];

export const cgd_type = [
  {
    value: "1",
    label: "库存"
  },
  {
    value: "2",
    label: "非库存"
  },
  {
    value: "3",
    label: "咨询"
  }
];

export const cgd_source = [
  {
    value: "1",
    label: "直接下单"
  },
  {
    value: "2",
    label: "咨询"
  },
  {
    value: "3",
    label: "项目"
  },
  {
    value: "4",
    label: "平台"
  },
  {
    value: "5",
    label: "有赞"
  }
];

export const product_type = [
  {
    value: "1",
    label: "正常商品"
  },
  {
    value: "2",
    label: "赠品"
  },
  {
    value: "3",
    label: "样品"
  }
];

export const send_type = [
  {
    value: "1",
    label: "包邮"
  },
  {
    value: "2",
    label: "自提"
  }
];

export const pay_status = [
  {
    value: "1",
    label: "未付款"
  },
  {
    value: "2",
    label: "部分付款"
  },
  {
    value: "3",
    label: "已付款"
  }
];

export const inv_status = [
  {
    value: "1",
    label: "未回票"
  },
  {
    value: "2",
    label: "部分回票"
  },
  {
    value: "3",
    label: "已回票"
  }
];
