<template>
  <div>
   <el-table
      :data="tableData"
      size="small"
      :loading="loading"
      border>
      <el-table-column
        prop="itemno"
        label="产品编码"
        width="180">
      </el-table-column>
      <el-table-column
        prop="itemname"
        label="产品名称"
        width="180">
      </el-table-column>
      <el-table-column
        prop="model"
        label="型号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="spec"
        label="规格尺寸"
        width="180">
      </el-table-column>
      <el-table-column
        prop="qty"
        label="装箱数量"
        width="200">
      </el-table-column>
      <el-table-column
        prop="remarks"
        label="备注"
        min-width="250">
      </el-table-column>
  </el-table>
    <div style="margin-top:16px;text-align:right">
      <el-pagination
        background
        small
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-size="params.content.pageSize"
        layout="total, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      params:{
        "id": 20230109155304,
        "content": {
          "pageNumber": 1,
          "pageSize": 20,
          "sa_logistics_boxid":0,
          "where": {
            "condition": ""
          }
        }
      },
      tableData:[],
      total:0,
      currentPage:0,
      loading:false
    }
  },
  methods:{
    async listData (id) {
      console.log(id,'物流单')
      this.loading = true
      this.params.content.sa_logisticsid = this.$route.query.id
      this.params.content.sa_logistics_boxid = id

      const res = await this.$api.requested(this.params)
      this.tableData = res.data
      this.total = res.total
      this.currentPage = res.pageNumber
      this.loading = false
    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.params.content.pageSize = val
      this.listData(this.params.content.sa_logistics_boxid)
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.params.content.pageNumber = val
      this.listData(this.params.content.sa_logistics_boxid)
    },
  },
  mounted () {
    // this.listData()
  }
}

</script>
<style>
</style>