import { ContentConfig } from "/@/components/PageContent";
import { httpList } from "/@/api/InvoiceSales/refund";

import dayjs from "dayjs";
import { ElTag } from "element-plus";
import { h } from "vue";
import { return_status } from "./configs";

const columns = [
  {
    type: "selection",
    width: 55,
    hide: ({ checkList }) => !checkList.includes("勾选列")
  },
  {
    label: "序号",
    type: "index",
    width: 70,
    hide: ({ checkList }) => !checkList.includes("序号列")
  },
  {
    label: "退款编号",
    prop: "returnCode"
  },
  {
    label: "资金编号",
    prop: "tradNo"
  },
  {
    label: "资金认领编号",
    prop: "logNo"
  },
  {
    label: "退款回执",
    prop: "return_img"
  },
  {
    label: "退款原因",
    prop: "return_reason"
  },
  {
    label: "申请人",
    prop: "apply_name"
  },
  {
    label: "状态",
    prop: "status",
    cellRenderer: ({ row }) => {
      return h(ElTag, null, {
        default: () => return_status.find(s => s.value === row.status)?.label
      });
    }
  },
  {
    label: "退款时间",
    prop: "addtime",
    formatter: ({ addtime }) => dayjs(addtime).format("YYYY-MM-DD HH:mm:ss")
  },
  {
    label: "操作",
    fixed: "right",
    width: 80,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "退款申请管理",
  powers: ["001", "002", "003", "004", "005", "006", "007", "008"],
  columns,
  apis: {
    httpList
  }
};

export default contentConfig;
