<template>
  <ContainerQuery>
    <div slot="left">
      <el-button
        size="small"
        type="primary"
        @click="
          $router.push('/stock/OrdersForShipment/DeliveryToBeReceivedDetails')
        "
      >
        历史
      </el-button>
      <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: 70px; left: 180px"
        @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>
          <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="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>
      <!--    选择仓库-->
      <WarehouseModel
        v-if="warehouse_show"
        :is-check="false"
        :is-show="warehouse_show"
        @confirm="selWarehouse"
        @cancel="warehouse_show = false"
      />
    </div>
    <!--    @checkbox-all="selectAllEvent"-->
    <!--    @checkbox-change="selectChangeEvent"-->
    <vxe-table ref="xTable1" :data="tableData">
      <vxe-table-column
        field="sex"
        title="任务编号"
        width="150"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="单据日期"
        width="150"
      ></vxe-table-column>
      <vxe-table-column field="age" title="司机" width="150"></vxe-table-column>
      <vxe-table-column
        field="age"
        title="送货员"
        width="150"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="拒收数量"
        width="150"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="拒收金额"
        width="150"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="退货数量"
        width="150"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="退货金额"
        width="150"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="待收货数量"
        width="150"
      ></vxe-table-column>
      <vxe-table-column
        field="age"
        title="待收货金额"
        width="150"
      ></vxe-table-column>
      <vxe-table-column fixed="right" field="name" title="操作">
        <template #default="{ row }">
          <el-button
            type="text"
            size="mini"
            @click="
              $router.push(
                `/stock/OrdersForShipment/DeliveryReceivedDetails/${row.id}`
              )
            "
          >
            明细
          </el-button>
          <el-button type="text" size="mini">入库</el-button>
        </template>
      </vxe-table-column>
    </vxe-table>
    <FooterPage
      :page-size="pageSize"
      :total-page.sync="total"
      :current-page.sync="page"
      @pageChange="pageChange"
      @sizeChange="sizeChange"
    >
      <!--      <div slot="btn-div" class="foot-btn-div">-->
      <!--        <span class="batch-checkbox">-->
      <!--          <vxe-checkbox-->
      <!--            v-model="checkedAll"-->
      <!--            @change="checkAllChange"-->
      <!--          ></vxe-checkbox>-->
      <!--        </span>-->
      <!--        <el-button size="mini">批量签收</el-button>-->
      <!--        <el-button size="mini">批量拒收</el-button>-->
      <!--        <el-button size="mini">批量收货</el-button>-->
      <!--      </div>-->
    </FooterPage>
  </ContainerQuery>
</template>
<script>
  import SelectCustomer from "@/component/common/SelectCustomer.vue";
  import WarehouseModel from "@/component/common/WarehouseModel.vue";

  export default {
    components: {
      // SelectCustomer,
      WarehouseModel,
    },
    data() {
      return {
        keyword: "",
        top_time: "1",
        customer_name: "",
        customerId: "",
        time: "",
        start: "",
        end: "",
        Return: "",
        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,
        // checkedAll: false,
        records: [],
        time1: "",
      };
    },
    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);
      },
      // selectAllEvent({ records }) {
      //   this.records = records;
      // },
      // selectChangeEvent({ records }) {
      //   this.records = records;
      // },
      // checkAllChange() {
      //   this.records = this.$refs.xTable1.getCheckboxRecords();
      //   if (this.records.length !== 0) {
      //     this.$refs.xTable1.clearCheckboxRow();
      //   } else {
      //     this.$refs.xTable1.setAllCheckboxRow(true);
      //   }
      // },
    },
  };
</script>
<style></style>
