import { ContentConfig } from "/@/components/PageContent";
import { httpList } from "/@/api/mobile/exchangeOrder";
import { renderStatus, renderImage } from "/@/utils/column-helper";
import { ORDER_OPTIONS } from "/@/config/status";

const columns = [
  {
    type: "selection",
    width: 55,
    hide: ({ checkList }) => !checkList.includes("勾选列")
  },
  {
    prop: "orderCode",
    label: "订单编号",
    width: "180px"
  },
  {
    prop: "status",
    label: "状态",
    minWidth: "90px",
    ...renderStatus(ORDER_OPTIONS)
  },
  {
    prop: "company_title",
    label: "企业名称",
    width: "150px"
  },
  {
    prop: "card_title",
    label: "卡类型",
    width: "100px"
  },

  {
    prop: "username",
    label: "账号/卡号",
    width: "100px"
  },
  {
    prop: "good_code",
    label: "商品编码",
    width: "100px"
  },
  {
    prop: "good_cover_img",
    label: "图片",
    width: "100px",
    ...renderImage("good_cover_img")
  },
  {
    prop: "good_name",
    label: "商品名称",
    width: "100px"
  },
  {
    prop: "num",
    label: "数量",
    width: "110px"
  },
  {
    prop: "contactor",
    label: "收货联系人",
    width: "160px"
  },
  {
    prop: "mobile",
    label: "联系电话",
    width: "160px"
  },
  {
    prop: "addr_name",
    label: "收货省市区",
    width: "160px"
  },
  {
    prop: "addr",
    label: "详细地址",
    width: "160px"
  },
  {
    prop: "post_name",
    label: "物流公司",
    width: "160px"
  },
  {
    prop: "post_code",
    label: "物流单号",
    width: "160px"
  },
  {
    prop: "addtime",
    label: "购买时间",
    width: "160px"
  },

  {
    label: "操作",
    fixed: "right",
    width: 120,
    slot: "operation"
  }
];
const contentConfig: ContentConfig = {
  title: "订单管理",
  columns,
  showExpand: row => row.child.length > 0,
  apis: {
    httpList
  },
  notPreview: false
};

export default contentConfig;
