import { ContentConfig } from "/@/components/PageContent";
import { httpList } from "/@/api/purchase/paymentRecord";
import { typeOptions, statusOptions } from "./_options";
import { ElTag } from "element-plus";
import { h } from "vue";

export const businessOptions = [
  { value: '5', label: '付款标签' },
  { value: '6', label: '回票标签' }
]

const columns = [
  {
    label: '记录ID',
    prop: 'id',
    width: '60px'
  },
  {
    label: '采购单编号',
    prop: 'code',
    width: '160px'
  },
  {
    label: '卖出方公司',
    prop: 'supplierName',
    width: '200px'
  },
  {
    label: '买入方公司',
    prop: 'companyName',
    width: '200px'
  },
  {
    label: '业务类型',
    prop: 'type',
    width: '100px',
    cellRenderer({row}){
      return h(ElTag,null, {
        default: () => businessOptions.find(({value}) => String(value) === String(row.type))?.label || '--'
      })
    }
  },

  
  {
    label: '功能类型',
    prop: 'status',
    width: '70px',
    cellRenderer({row}){
      return h(ElTag,null, {
        default: () => statusOptions.find(({value}) => String(value) === String(row.status))?.label || '--'
      })
    }
  },
  {
    label: '标签名称',
    prop: 'tag_name'
  },
  {
    label: '标签金额',
    width: '80px',
    prop: 'tag_fee'
  },
  {
    label: '创建人',
    prop: 'creater'
  },
  {
    label: '操作时间',
    prop: 'addtime'
  }
];



const contentConfig: ContentConfig = {
  columns,
  superUserNoAction: true,
  apis: {
    httpList:(params = {}) => httpList({ ...params, order_type: '3' })
  }
};

export default contentConfig;
