/* eslint-disable prettier/prettier */
import { BeforeRequestType, ContentConfig } from "/@/components/PageContent";
import { ElTag } from "element-plus";
import { isBeyondTime } from "/@/views/reportCollection/_utils";
import apis from "./apis";
import { h } from "vue";

export const statusOptions = [
  { value: '0', label: '待发货' },
  { value: '1', label: '待发货完成' },
  { value: '2', label: '发货已完成' },
  { value: '3', label: '订单已取消' }
]

export const orderTypeOptions = [
  { value: "1", label: "库存商品" },
  { value: "2", label: "非库存商品" },
  { value: "3", label: "反馈商品" },
  { value: "4", label: "报备商品" },
];


const columns = [
  {
    prop: 'orderCode',
    label: '订单编号',
    minWidth: '155px'
  },
  {
    prop: 'order_type',
    label: '商品类型',
    width: '100px',
    cellRenderer({ row }) {
      return h(ElTag, null, {
        default: () => orderTypeOptions.find(({ value }) => value === String(row.order_type))?.label || '--'
      })
    }
  },
  {
    prop: 'status',
    label: '订单状态',
    width: '110px',
    cellRenderer({ row }) {
      return h(ElTag, null, {
        default: () => statusOptions.find(({ value }) => value === String(row.status))?.label || '--'
      })
    }
  },

  {
    prop: 'good_code',
    label: '商品成本编号',
    width: '160px'
  },
  {
    prop: 'skuCode',
    label: '上线商品编号',
    width: '155px'
  },
  {
    prop: 'good_name',
    label: '商品名称',
    minWidth: '155px'
  },
  {
    prop: 'good_num',
    label: '购买数量',
    width: '110px'
  },
  {
    prop: 'send_num',
    label: '已发数量',
    width: '110px'
  },
  {
    prop: 'wsend_num',
    label: '未发数量',
    width: '110px'
  },
  {
    prop: 'not_addr_address_good_num',
    label: '无地址数量',
    width: '110px'
  },

  {
    prop: 'nickname',
    label: '申请人',
    width: '70px'
  },
  {
    prop: 'depart',
    label: '所属部门',
    width: '130px'
  },
  {
    prop: 'month',
    label: '下单月份',
    width: '90px'
  }
]


const contentConfig: ContentConfig = {
  columns,
  showTitle: false,
  responseCode: 1,
  superUserNoAction: false,
  // beforeRequestList(params) {
  //   const { start, end } = params;
  //   const beyondTime = isBeyondTime({ name: "下单时间", len: 90, start, end });
  //   if (beyondTime) return BeforeRequestType.EMPTY
  //   return BeforeRequestType.NEXT;
  // },
  apis: { httpList: apis.list }
};


export default contentConfig;
