<template>
  <div>
    <el-table
      :data="tableData"
      style="width: 100%"
      size="small"
      border>
      <el-table-column
        prop="billno"
        label="核销单号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="billnodate"
        label="核销日期"
        width="160">
      </el-table-column>
      <el-table-column
        prop="cashbillbillno"
        label="收入凭证号">
      </el-table-column>
      <el-table-column
        prop="writeoffamount"
        label="核销单总金额">
      </el-table-column>
      <el-table-column
        prop="rowno"
        label="订单行号">
      </el-table-column>
      <el-table-column
        prop="itemno"
        label="产品编码">
      </el-table-column>
      <el-table-column
        prop="itemname"
        label="产品名称">
      </el-table-column>
      <el-table-column
        prop="ordetitemwriteoffamount"
        label="本次核销金额">
      </el-table-column>
    </el-table>
    <div class="container normal-panel" style="text-align:right">
      <el-pagination
        background
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[20, 50, 100, 200]"
        layout="total,sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { log } from '@antv/g2plot/lib/utils'
export default {
  data () {
    return {
      tableData:[],
      param:{
        "id": "20230225141804",
        "content": {
            "sa_orderid": 14,
            "pageSize":20,
            "pageNumber":1

        }
      },
      total:0,
      currentPage:0,
    }
  },
  methods:{
    async listData() {
      this.param.content.sa_orderid = this.$route.query.id
      const res = await this.$api.requested(this.param)
      this.tableData = res.data
      this.total = res.total
      this.currentPage = res.pageNumber
      console.log(this.tableData,'核销记录');
      
    },
    handleSizeChange(val) {
      this.param.pageSize = val
      this.listData()
    },
    handleCurrentChange(val) {
      this.param.pageNumber = val
      this.listData()
    },
    linkDetail (item) {
        let route = this.$route
        if (route.path !== '/taskDetails') {
          this.oldRoute = {path:route.path,query:route.query}
          this.$store.dispatch('setHistoryRouter',this.oldRoute)
        }
        this.$router.replace({path:'/dispatchdetail',query:{id:item.sa_dispatchid,rowindex:item.rowindex}})
      }
  },
  mounted () {
    this.listData()
  }
}

</script>
<style>
</style>