import { ContentConfig } from "/@/components/PageContent";
import { httpNewList, httpDelete } from "/@/api/InvoiceSales/capitalClaim";

import { h } from "vue";
import { ElTag } from "element-plus"
import { tradeTypeOptions } from "./configs";
import { renderIconLabelLeft, renderProp } from "/@/utils/columnRenderHelper";

const columns = [
  {
    type: 'selection',
    width: 40
  },
  {
    label: "资金编码",
    prop: "tradNo",
    fixed: "left",
    width: 150
  },
  {
    label: '客户机构名称',
    width: 160,
    prop: 'customerName'
  },
  {
    label: '客户PO',
    width: 120,
    prop: 'poCode'
  },
  {
    label: '平台物料名称',
    width: 120,
    prop: 'goodName'
  },
  {
    label: '产品数量',
    width: 120,
    prop: 'goodNum'
  },
  {
    label: '平台公司收入单价',
    width: 120,
    prop: 'platPrice'
  },
  {
    label: '平台公司收入总价',
    width: 120,
    prop: 'plat_total'
  },
  
  {
    label: '批次号',
    width: 100,
    prop: 'pcCode'
  },
  {
    label: '回款类型',
    width: 120,
    cellRenderer({ row }){
      return h(ElTag, { size: 'small' }, {
        default: () => tradeTypeOptions.find(({ value }) => value == row.trade_type)?.label || '--'
      })
    }
  },
  {
    label: '业务公司',
    width: 160,
    ...renderIconLabelLeft('companyNo', 'companyName', '收款方公司编码:')
  },
  {
    label: '收款方公司',
    width: 160,
    ...renderIconLabelLeft('trade_in_code', 'trade_in', '收款方公司编码:')
  },
  {
    label: '收款方账户',
    width: 120,
    prop: 'trade_in_account'
  },
  {
    label: '交易时间',
    width: 120,
    prop: 'trade_time'
  },

  {
    label: '客户付款银行户名',
    width: 120,
    prop: 'trade_out'
  },
  {
    label: '客户付款行名',
    width: 120,
    prop: 'trade_bank'
  },
  {
    label: '客户付款银行账号',
    width: 120,
    prop: 'trade_account'
  },

  {
    label: '客户DN',
    width: 120,
    prop: 'NdCode'
  },
  {
    label: '平台采购PO',
    width: 120,
    prop: 'palt_po'
  },
  {
    label: '泰e购SKU',
    width: 120,
    prop: 'skuCode'
  },
  {
    label: '业务公司收入单价',
    width: 120,
    prop: 'comPrice'
  },
  {
    label: '业务公司收入总价',
    width: 120,
    prop: 'comPrice'
  },
  {
    label: '交易用途',
    width: 120,
    prop: 'trade_used'
  },
  {
    label: '创建人',
    width: 120,
    prop: 'apply_name'
  },
  {
    label: '创建时间',
    width: 120,
    prop: 'addtime'
  }
];

const contentConfig: ContentConfig = {
  columns,
  apis: {
    httpList: (parameter = {}) => httpNewList({ ...parameter, status: [1, 2] }),
    httpDelete
  }
};

export default contentConfig;
