import creditApi from "@/api/order/credit";
import type { IContentConfig } from "@/components/CURD/types";

const contentConfig: IContentConfig = {
  pageName: "sys:user",
  table: {
    border: true,
    highlightCurrentRow: true,
  },
  pagination: {
    background: true,
    layout: "prev,pager,next,jumper,total,sizes",
    pageSize: 20,
    pageSizes: [10, 20, 30, 50],
  },
  indexAction: function (params) {
    return creditApi.getList(params);
  },
  deleteAction: function (params) {
    return creditApi.delete(params)
  },
  // modifyAction: function (data) {
  //   // return creditApi.edit(data);
  // },
  pk: "id",
  toolbar: ["add"],
  defaultToolbar: ["refresh", "filter", "search"],
  cols: [
    {
      label: "挂账编码",
      align: "center",
      prop: "id",
    },
    {
      label: "状态",
      align: "center",
      prop: "status",
      templet: 'custom',
      slotName: 'status',
      width: 120,
    },
    {
      label: "挂账人",
      align: "center",
      prop: "debtor",
    },
    {
      label: "手机号",
      align: "center",
      prop: "mobile",
    },
    {
      label: "挂账额度（元）",
      align: "center",
      prop: "creditAmount",
    },
    {
      label: "已挂账金额（元）",
      align: "center",
      prop: "owedAmount",
      templet: "custom",
      slotName: 'owedAmount',
    },
    // {
    //   label: "剩余挂账额度（元）",
    //   align: "center",
    //   prop: "remainingAmount",
    //   templet: "custom",
    //   slotName: 'remainingAmount',
    // },
    {
      label: "账户余额（挂账额度+用户余额）",
      align: "center",
      prop: "accountBalance",
      templet: "custom",
      slotName: 'accountBalance',
    },
    {
      label: "还款提醒日",
      align: "center",
      prop: "expireRemindDay",
      templet: "custom",
      slotName: 'expireRemindDay',
    },
    {
      label: "还款提醒",
      align: "center",
      prop: "expireRemind",
      templet: "custom",
      slotName: 'expireRemind',
    },
    {
      label: "操作",
      align: "center",
      fixed: "right",
      width: 300,
      templet: "custom",
      slotName: 'tools',
      operat: [
        {
          text: "查看明细",
          name: 'detail'
        },
        {
          text: "编辑",
          name: 'edit'
        },
        {
          text: "还款",
          name: 'huankuan'
        },
        {
          text: "还款记录",
          name: 'huankuan_detail'
        },
        {
          text: "删除",
          name: 'delete'
        },
      ],
    },
  ],
};

export default contentConfig;
