import shopUserApi, { type getListRequest } from "@/api/account/shopUser";
import type { IContentConfig } from "@/components/CURD/types";

const contentConfig: IContentConfig<any> = {
  pageName: "sys:user",
  table: {
    border: true,
    highlightCurrentRow: true,
  },
  pagination: {
    background: true,
    layout: "prev,pager,next,jumper,total,sizes",
    pageSize: 10,
    pageSizes: [10, 20, 30, 50],
  },
  indexAction: function (params: getListRequest) {
    return shopUserApi.getList(params);
  },
  // deleteAction: shopUserApi.delete,
  // modifyAction: function (data) {
  //   // return shopUserApi.edit(data);
  // },
  pk: "id",
  toolbar: ["add", 'export'],
  defaultToolbar: ["refresh", "filter", "search"],
  cols: [
    { type: "selection", width: 50, align: "center" },
    { label: "id", align: "center", prop: "id", width: 100, show: true },
    {
      label: "用户",
      align: "center",
      prop: "user",
      templet: "custom",
      slotName: "user",
      width: 160,
    },
    {
      label: "性别",
      align: "center",
      prop: "sex",
      templet: "custom",
      slotName: "gender",
    },
    {
      label: "会员",
      align: "center",
      prop: "isVip",
      templet: "custom",
      slotName: "bol",
    },
    {
      label: "手机号",
      align: "center",
      prop: "phone",
      width: 140,
      templet: "custom",
      slotName: "mobile",
    },
    {
      label: "优惠券",
      align: "center",
      prop: "coupon",
      width: 140,
      templet: "custom",
      slotName: "coupon",
    },
    {
      label: "余额",
      align: "center",
      prop: "amount",
    },
    // {
    //   label: "积分",
    //   align: "center",
    //   prop: "accountPoints",
    // },
    {
      label: "消费累计",
      align: "center",
      prop: "consumeAmount",
    },
    {
      label: "消费次数累计",
      align: "center",
      prop: "consumeCount",
    },
    {
      label: "注册时间",
      align: "center",
      prop: "createTime",
    },
    {
      label: "操作",
      align: "center",
      fixed: "right",
      width: 180,
      templet: "tool",
      operat: [
        {
          name: "edit",
          text: "编辑",
        },
        {
          name: "more",
          text: "更多",
          options: [
            // { label: '增减积分', command: 'change-points' },
            { label: '增减余额', command: 'change-money' },
            { label: '充值记录', command: 'charge-list' },
            { label: '赠送券', command: 'give-coupon' },
            { label: '账号禁用/开启', command: 'user-disabld' },
          ]
        },
      ],
    },
  ],
};

export default contentConfig;
