<template>
  <ContainerQuery>
    <div slot="left">
      <el-button size="small" type="primary">打印</el-button>
      <el-button size="small" type="primary">导出</el-button>
    </div>
    <div slot="more">
      <el-tabs
        v-model="top_time"
        style="position: absolute; top: 14px; left: 220px"
        @tab-click="selTopType"
      >
        <el-tab-pane label="昨日" name="1"></el-tab-pane>
        <el-tab-pane label="今日" name="2"></el-tab-pane>
        <el-tab-pane label="本周" name="3"></el-tab-pane>
        <el-tab-pane label="本月" name="4"></el-tab-pane>
        <el-tab-pane label="上月" name="5"></el-tab-pane>
        <el-tab-pane label="近三月" name="6"></el-tab-pane>
        <el-tab-pane label="本年" name="7"></el-tab-pane>
      </el-tabs>
    </div>
    <div slot="more">
      <el-form inline size="small">
        <el-form-item>
          <el-date-picker
            v-model="time"
            clearable
            type="daterange"
            value-format="timestamp"
            range-separator="-"
            start-placeholder="下单开始日期"
            end-placeholder="下单结束日期"
            @change="orderDate"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-select
            v-model="Return"
            style="width: 220px"
            multiple
            placeholder="配送状态"
            @change="pageChange(1)"
          >
            <el-option
              v-for="item in Return_status"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-input
            v-model="keyword"
            style="width: 220px"
            placeholder="任务编号"
            clearable
            @keyup.enter.native="pageChange(1)"
            @clear="pageChange(1)"
          >
            <el-button slot="append" @click="pageChange(1)">
              <i class="el-icon-search"></i>
            </el-button>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-input
            v-model="keyword"
            style="width: 220px"
            placeholder="单据编号"
            clearable
            @keyup.enter.native="pageChange(1)"
            @clear="pageChange(1)"
          >
            <el-button slot="append" @click="pageChange(1)">
              <i class="el-icon-search"></i>
            </el-button>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-input
            v-model="keyword"
            style="width: 220px"
            placeholder="商品"
            clearable
            @keyup.enter.native="pageChange(1)"
            @clear="pageChange(1)"
          >
            <el-button slot="append" @click="pageChange(1)">
              <i class="el-icon-search"></i>
            </el-button>
          </el-input>
        </el-form-item>
        <el-form-item>
          <SelectCustomer
            v-model="customer_name"
            placeholder="客户"
            @clear="customerClear"
            @change="customerSel"
          />
        </el-form-item>
        <el-form-item>
          <SelectCustomer
            v-model="customer_name"
            placeholder="配送司机"
            @clear="customerClear"
            @change="customerSel"
          />
        </el-form-item>
        <el-form-item>
          <SelectCustomer
            v-model="customer_name"
            placeholder="送货员"
            @clear="customerClear"
            @change="customerSel"
          />
        </el-form-item>
        <el-form-item>
          <el-input
            v-model="warehouseName"
            placeholder="仓库"
            style="width: 150px"
          >
            <i
              slot="suffix"
              class="el-input__icon el-icon-search"
              @click="warehouse_show = true"
            ></i>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-select
            v-model="Return"
            style="width: 220px"
            multiple
            placeholder="收货状态"
            @change="pageChange(1)"
          >
            <el-option
              v-for="item in Return_status"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <!--    选择仓库-->
      <WarehouseModel
        v-if="warehouse_show"
        :is-check="false"
        :is-show="warehouse_show"
        @confirm="selWarehouse"
        @cancel="warehouse_show = false"
      />
    </div>
    <vxe-table ref="xTable1" :data="tableData" auto-resize>
      <vxe-table-column
        fixed="left"
        type="seq"
        title=" "
        width="60"
      ></vxe-table-column>
      <vxe-table-column
        fixed="left"
        field="name"
        title="任务编号"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        fixed="left"
        field="sex"
        title="单据编号"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="配送状态"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="单据类型"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="单据日期"
        width="100"
      ></vxe-table-column>
      <vxe-table-column field="age" title="客户" width="100"></vxe-table-column>
      <vxe-table-column field="age" title="仓库" width="100"></vxe-table-column>
      <vxe-table-column
        field="age"
        title="司机名称"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="商品名称"
        width="100"
      ></vxe-table-column>
      <vxe-table-column field="age" title="货号" width="100"></vxe-table-column>
      <vxe-table-column field="age" title="口味" width="100"></vxe-table-column>
      <vxe-table-column field="age" title="尺码" width="100"></vxe-table-column>
      <vxe-table-column field="age" title="条码" width="100"></vxe-table-column>
      <vxe-table-column field="age" title="规格" width="100"></vxe-table-column>
      <vxe-table-column field="age" title="型号" width="100"></vxe-table-column>
      <vxe-table-column field="age" title="产地" width="100"></vxe-table-column>
      <vxe-table-column field="age" title="单位" width="100"></vxe-table-column>
      <vxe-table-column
        field="age"
        title="发货数量"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="发货金额"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="退货数量"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="退货金额"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="签收数量"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="签收金额"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="拒收数量"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="拒收金额"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="待签数量"
        width="100"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="待入库数量"
        width="100"
      ></vxe-table-column>
    </vxe-table>
    <FooterPage
      :page-size="pageSize"
      :total-page.sync="total"
      :current-page.sync="page"
      @pageChange="pageChange"
      @sizeChange="sizeChange"
    ></FooterPage>
  </ContainerQuery>
</template>
<script>
  import SelectCustomer from "@/component/common/SelectCustomer.vue";
  import WarehouseModel from "@/component/common/WarehouseModel.vue";
  import RegionSelect from "@/component/common/RegionSelectJSON";
  import DepartmentSel from "@/component/common/DepartmentSel.vue";

  export default {
    components: {
      SelectCustomer,
      WarehouseModel,
      // RegionSelect,
      // DepartmentSel,
    },
    data() {
      return {
        keyword: "",
        top_time: "1",
        customer_name: "",
        customerId: "",
        time: "",
        start: "",
        end: "",
        Return: "",
        region: "",
        Return_status: [],
        warehouseName: "",
        warehouse_show: false,
        warehouseId: "",
        tableData: [
          {
            id: 10001,
            name: "Test1",
            role: "Develop",
            sex: "Man",
            age: 28,
            address: "vxe-table 从入门到放弃",
          },
          {
            id: 10002,
            name: "Test2",
            role: "Test",
            sex: "Women",
            age: 22,
            address: "Guangzhou",
          },
          {
            id: 10003,
            name: "Test3",
            role: "PM",
            sex: "Man",
            age: 32,
            address: "Shanghai",
          },
          {
            id: 10004,
            name: "Test4",
            role: "Designer",
            sex: "Women",
            age: 23,
            address: "vxe-table 从入门到放弃",
          },
          {
            id: 10005,
            name: "Test5",
            role: "Develop",
            sex: "Women",
            age: 30,
            address: "Shanghai",
          },
        ],
        page: 1,
        pageSize: 10,
        total: 0,
        records: [],
        provinceCode: "",
        cityCode: "",
        districtCode: "",
        departmentId: "",
        departmentPidPath: "",
      };
    },
    methods: {
      pageChange() {},
      sizeChange() {},
      selTopType() {},
      customerClear() {
        this.customerId = "";
        this.customer_name = "";
        this.pageChange(1);
      },
      // 选择客户
      customerSel(val, list) {
        this.customerId = list[0].id;
        this.pageChange(1);
      },
      //  时间
      orderDate(val) {
        if (val && val.length) {
          this.start = val[0] / 1000;
          this.end = val[1] / 1000 + 86399;
        } else {
          this.start = "";
          this.end = "";
        }
        this.pageChange(1);
      },
      selWarehouse(row) {
        this.warehouseName = row[0].warehouseName;
        this.warehouseId = row[0].id;
        this.pageChange(1);
      },
      // 选择区域
      regionChange(val) {
        this.provinceCode = val[0];
        this.cityCode = val[1];
        this.districtCode = val[2];
        this.pageChange(1);
      },
      // 选择部门
      selBranch(val) {
        this.departmentId = val[val.length - 1];
        this.departmentPidPath = val.join(",");
      },
    },
  };
</script>
<style></style>
