import { upcloud_base_wh_outbound } from "@/config/serviceSettings";

const baseUrl = upcloud_base_wh_outbound;
import moment from "moment";
// const baseUrl = '/wrb1'
import { remote } from "@/views/EIS/remote/index.js";

const config = function (that) {
  return {
    remoteUrl: {
      url: baseUrl + "/freight/queryFreightEnter",
      headers: {
        "Content-Type": "application/JSON",
      },
      method: "post",
    },
    items: [
      {
        span: 8,
        type: "input",
        name: "shipNo",
        label: "运单号",
        value: "",
      },
      {
        span: 8,
        type: "input",
        name: "customerName",
        label: "客户名称",
        value: "",
        options: [
          { label: "区域", value: 10 },
          { label: "接驳口", value: 20 },
        ],
      },
      {
        span: 8,
        type: "row",
        required: true,
        label: "出库日期",
        list: [
          {
            required: true,
            type: "date",
            name: "outStartDate",
            placeholder: "请输入开始日期",
            value: moment().format("YYYY-MM-DD 00:00:00"),
            format: "YYYY-MM-DD HH:mm:ss",
            showTime: true,
            style: "padding-right:5px;",
          },
          {
            required: true,
            type: "date",
            name: "outEndDate",
            placeholder: "请输入结束日期",
            format: "YYYY-MM-DD HH:mm:ss",
            showTime: true,
            value: moment().format("YYYY-MM-DD 23:59:59"),
          },
        ],
      },
      {
        span: 8,
        type: "input",
        name: "itemNo",
        label: "货号",
        value: "",
        // options: [
        //   { label: "区域", value: 10 },
        //   { label: "接驳口", value: 20 },
        // ],
      },

      {
        span: 8,
        type: "buttonGroup",
        style: { textAlign: "right" },
        options: [
          {
            value: "查询",
            icon: "search",
            btnType: "primary",
            style: "margin-right:10px",
            htmlType: "submit",
          },
          {
            value: "重置",
            icon: "redo",
            style: "margin-right:50px",
            on: {
              click: (event, form) => {
                form.resetFields();
              },
            },
          },
        ],
      },
    ],
    columns: [
      {
        dataIndex: "shipNo",
        key: "shipNo",
        align: "center",
        title: "运单号",
      },
      {
        title: "货号",
        dataIndex: "itemNo",
        align: "center",
        key: "itemNo",
      },
      {
        title: "客户名称",
        dataIndex: "customerName",
        ellipsis: true,
        align: "center",
        key: "customerName",
      },
      {
        type: "input",
        title: "联系方式",
        key: "contactWay",
        ellipsis: true,
        dataIndex: "contactWay",
        align: "center",
      },
      {
        type: "number",
        title: "客户代收款",
        dataIndex: "agencyFund",
        align: "center",
        ellipsis: true,
        key: "agencyFund",
        // customRender(text) {
        //   text == 0 && (text = '不索取')
        //   text == 1 && (text = '索取')
        //   return text
        // }
      },
      {
        required: true,
        title: "运费",
        type: "number",
        key: "freightPrice",
        ellipsis: true,
        dataIndex: "freightPrice",
        align: "center",
      },
      {
        required: true,
        title: "上门费",
        type: "number",
        key: "visitPrice",
        ellipsis: true,
        dataIndex: "visitPrice",
        align: "center",
      },
      {
        title: "箱数",
        type: "number",
        key: "boxNumber",
        ellipsis: true,
        dataIndex: "boxNumber",
        align: "center",
      },

      {
        required: true,
        title: "付运费方式",
        type: "select",
        dataIndex: "freightWayCode",
        align: "center",
        // FREIGHT-WAY
        ...remote("FREIGHT-WAY"),
        key: "freightWayCode",
      },
    ],
  };
};

export default config;
