/**
 * 订单对账详情
 */
import { h } from "vue";
import { ElTag } from "element-plus";
import { createTooltip } from "/@/utils/tootip";
import { DescriptionColumns } from "/@/components/BasicDescriptions";

export const orderRecordColumns: DescriptionColumns = [
  {
    field: "payNo",
    label: "对账单号",
    span: 6
  },
  {
    field: "status",
    label: "对账状态",
    render(status) {
      return h(ElTag, null, {
        default: () =>
          statusOptions.find(s => s.value === String(status))?.label
      });
    }
  },
  {
    field: "apply_name",
    label: "申请人",
    span: 6
  },
  {
    field: "addtime",
    label: "创建时间",
    span: 6
  },
  {
    field: "supplierName",
    label: "卖出方公司",
    span: 12,
    render: (supplierName, { supplierNo }) =>
      createTooltip(supplierName, "卖出方公司编码 : " + supplierNo, 270)
  },
  {
    field: "companyName",
    label: "买入方公司",
    span: 12,
    render: (companyName, { companyNo }) =>
      createTooltip(companyName, "买入方公司编码 : " + companyNo, 270)
  },
  {
    field: "pay_status",
    label: "付款状态",
    render(status) {
      return h(ElTag, null, {
        default: () => pay_status.find(s => s.value === String(status))?.label
      });
    }
  },
  {
    field: "apay_fee",
    label: "已付款"
  },
  {
    field: "pay_fee",
    label: "付款中"
  },
  {
    field: "wpay_fee",
    label: "未付款"
  },
  {
    field: "inv_status",
    label: "开票状态",
    render(status) {
      return h(ElTag, null, {
        default: () => inv_status.find(s => s.value === String(status))?.label
      });
    }
  },

  {
    field: "ainv_fee",
    label: "已开票"
  },
  {
    field: "inv_fee",
    label: "开票中"
  },
  {
    field: "winv_fee",
    label: "未开票"
  },

  {
    field: "total_fee",
    label: "对账总额"
  },
  {
    field: "remark",
    span: 18,
    label: "备注"
  }
];

export const statusOptions = [
  {
    label: "买方公司业务审核",
    value: "1"
  },
  {
    label: "对账成功",
    value: "2"
  },
  {
    label: "对账驳回",
    value: "3"
  },
  {
    label: "已撤销对账",
    value: "4"
  }
];

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

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: "已开票"
  }
];
