import type { IContentConfig } from "@/components/CURD/types";
import UserAPI from "@/api/account/coupon";

const contentConfig: IContentConfig = {
  pageName: "sys:user",
  table: {
    showOverflowTooltip: true,
  },
  toolbar: [],
  pagination: {
    background: true,
    layout: "prev,pager,next,jumper,total,sizes",
    pageSize: 10,
    pageSizes: [10, 20, 30, 50],
  },
  indexAction: function (params) {
    return UserAPI.getList(params);
  },
  modifyAction(data) {
    // 模拟发起网络请求修改字段
    // console.log("modifyAction:", data);
    ElMessage.success(JSON.stringify(data));
    return Promise.resolve(null);
  },

  cols: [
    { type: "selection", width: 50, align: "center" },
    // { label: "封面图", align: "center", prop: "coverImg", templet: "image" },
    { label: "名称", align: "center", prop: "title" },
    { label: "已使用数量", align: "center", prop: "useNumber", },
    { label: "剩余数量", align: "center", prop: "leftNumber", },
    { label: "有效天数", align: "center", prop: "validDays", },
  ],
};

export default contentConfig;
