import UserAPI from "@/api/product/productclassification";
import DeptAPI from "@/api/product/specificationsconfig";

import type { ISearchConfig } from "@/components/CURD/types";

const searchConfig: ISearchConfig = {
  pageName: "sys:user",
  formItems: [
    {
      type: "input",
      label: "商品名称",
      prop: "name",
      attrs: {
        placeholder: "请输入商品名称",
        clearable: true,
        style: {
          width: "200px",
        },
      },
    },
    {
      type: "select",
      label: "商品分类",
      prop: "categoryId",
      attrs: {
        placeholder: "请选择商品分类",
        clearable: true,
        style: {
          width: "200px",
        },
      },
      options: [],
      async initFn(formItem) {
        formItem.options = await UserAPI.getList();
      },
    },
    {
      type: "select",
      label: "商品类型",
      prop: "type",
      attrs: {
        placeholder: "请选择商品类型",
        clearable: true,
        style: {
          width: "200px",
        },
      },
      options: [{
        label: "单规格商品",
        value: "single"
      }, {
        label: "多规格商品",
        value: "sku"
      }, {
        label: "套餐商品",
        value: "package"
      }, {
        label: "称重商品",
        value: "weight"
      }, {
        label: "团购券",
        value: "coupon"
      }],
      // async initFn(formItem) {
      //   formItem.options = await UserAPI.getList();
      // },
    },

    {
      type: "date-picker",
      label: "日期",
      prop: "times",
      attrs: {
        type: "daterange",
        "range-separator": "~",
        "start-placeholder": "开始时间",
        "end-placeholder": "截止时间",
        "value-format": "YYYY-MM-DD",
        style: {
          width: "240px",
        },
      }
    },
    {
      type: "select",
      label: "排序",
      prop: "orderBy",
      attrs: {
        placeholder: "请选择排序方式",
        clearable: true,
        style: {
          width: "200px",
        },
      },
      options: [{
        label: "创建时间",
        value: "create_time asc"
      }, {
        label: "数量由低到高",
        value: "stock_number asc"
      }],
    },
  ],
};

export default searchConfig;
