import { statusOptions } from "./options";
import { httpKHList, httpPostList } from "/@/api/other";
import { FormConfig } from "/@/components/PageSearch";
import { convertOptions } from "/@/utils/column-helper";

const searchFormConfig: FormConfig = {
  formItems: [
    {
      field: "timer",
      type: "date_picker",
      otherOptions: {
        type: "daterange",
        startProp: "start",
        endProp: "end",
        startPlaceholder: "开始时间",
        endPlaceholder: "结束时间"
      }
    },
    {
      field: "post_compay",
      type: "remote-select",
      placeholder: "物流公司",
      otherOptions: {
        api: httpPostList,
        requestProp: "post_compay",
        responseLabelProp: "name",
        responseValProp: "name",
        isRoot: true
      }
    },
    {
      field: "customer_code",
      type: "remote-select",
      placeholder: "客户公司",
      otherOptions: {
        api: httpKHList,
        requestProp: "companyName",
        responseLabelProp: "companyName",
        responseValProp: "companyNo",
        prop: "item"
      }
    },
    {
      field: "status",
      type: "select",
      placeholder: "退货单状态",
      options: convertOptions(statusOptions)
    },
    {
      field: "group",
      type_field: "group_type",
      type: "input_group",
      otherOptions: {
        inputGroupOptions: [
          { value: "thNo", label: "售后退货单编号" },
          { value: "return_code", label: "售后申请单编号" },
          { value: "out_code", label: "发货申请单编号" },
          { value: "order_code", label: "销售订单编号" },
          { value: "post_code", label: "快递单号" }
        ]
      }
    }
  ]
};

export default searchFormConfig;
