<template>
  <div class="tableAllDate">
      <div id="pdfDom">
      <div class="blank">
      </div>
      <div class="title">
        <h1 align="center">达州钢铁集团有限责任公司</h1>
        <h1 align="center">物资提货单</h1>
      </div>
      <div>
      <!-- tablePart0 -->
        <table border="0" cellpadding="10" cellspacing="0" style="margin: auto;font-size:20px;" width="1000px" class="tablePart0">
        <tr>
          <th style="width :14.5%">提货单编号：</th>
          <td style="width :85.5%">{{orderNumber}}</td>
        </tr>
        </table>
      </div>
      <div class="tableBody">
        <!-- tablePart1 -->
        <table border="1" cellpadding="10" cellspacing="0" style="margin-top: 10px;" width="1000px" class="tablePart1">
        <tr>
          <th style="width :8%">序号</th>
          <th style="width :23%">物资名称</th>
          <th style="width :23%">规格型号</th>
          <th style="width :23%">物资件数</th>
          <th style="width :23%">物资理重</th>
        </tr>

        <tr v-for="(item,index) in materialList" :key="index">
          <td>{{index+1}}</td>
          <td>{{item.materialName}}</td>
          <td>{{item.materialSpe}}{{materialList.materialModel}}</td>
          <td>{{item.materialNumber}}</td>
          <td>{{item.materialWeight}}</td>
        </tr>
        </table>
        <!-- tablePart2 -->
        <table border="1" cellpadding="10" cellspacing="0" style="border-top: 0px" width="1000px" class="tablePart2">
        <tr>
          <th style="width :14.5%">承运单位</th>
          <td style="width :50%">{{carrierName}}</td>
          <th style="width :10.5%">车牌号</th>
          <td style="width :25%">{{capacityNumber}}</td>
        </tr>
        </table>
        <!-- tablePart3 -->
        <table border="1" cellpadding="10" cellspacing="0" style="border-top: 0px" width="1000px" class="tablePart3">
        <tr>
          <th style="width :14.5%">提货日期</th>
          <td style="width :21%">{{billDate}}</td>
          <th style="width :19%">收货单位</th>
          <td style="width :50%">{{consigeeName}}</td>
        </tr>
        </table>
      </div>
      <div>
        <!-- tablePart6 -->
        <table border="0" cellpadding="10" cellspacing="0" style="margin: auto;font-size:20px;margin-top: 10px;" width="1000px" class="tablePart6">
        <tr>
          <td style="width :63%"></td>
          <th style="width :15.5%">日期：</th>
          <td style="width :5%">{{year}}</td>
          <th style="width :8%">年</th>
          <td style="width :3%">{{month}}</td>
          <th style="width :8%">月</th>
          <td style="width :3%">{{date}}</td>
          <th style="width :5%">日</th>
        </tr>
        </table>
      </div>
      </div>
      <el-button style="margin-left: 45%;" type="primary" @click="getPdf()">
        <i class="el-icon-download"></i>导出(pdf)
      </el-button>
      <el-button style="margin-left: 45%;margin-top: 0.2%;" type="primary" v-print="'#pdfDom'" @click="backScan()">
        <i class="el-icon-printer"></i>打印
      </el-button>
  </div>
</template>

<script>
import table from '@/components/DilCommonUI/packages/table/src/table.vue';
export default {
  components: { table },
  name: "Login",
  data() {
    return {
      orderNumber: "",
      carrierName: "",
      materialList: [{
        materialName: "",
        materialModel: "",
        materialWeight: 0,
        materialNumber: 0,
        materialSpe: ""
      }],
      capacityNumber: "",
      consigeeName: "",
      billDate: "",
      year: new Date().getFullYear(),
      month: new Date().getMonth()+1,
      date: new Date().getDate(),
      htmlTitle: '提货单'
    };
  },
  created(){
      this.getBillOrder();
  },
  methods: {
      getBillOrder(){
        let orderNumber = this.$route.query.orderNumber;
       this.axios.post("/api/v1/tms/getBillOrder?orderNumber="+orderNumber).then((res) => {
         this.orderNumber = res.data.orderNumber;
         this.carrierName = res.data.carrierName;
         this.capacityNumber = res.data.capacityNumber;
         this.consigeeName = res.data.consigeeName;
         this.billDate = res.data.billDate;
         this.materialList = res.data.materialList;
        });
      },
      backScan(){
        this.$router.go(-2);
      }
  },
};
</script>

<style lang="scss" scoped>
.title{
  font-size:25px;
}
.tableBody{
  table, th, td
  {
      border: 1px solid black;
      font-size:20px;
      margin: auto;
  }
  .tablePart1 th{
      border-top: 1px solid black;
  }
  .tablePart2 td,th{
    border-top: 0px
  }
  .tablePart3 td,th{
    border-top: 0px
  }
  .tablePart4 td,th{
    border-top: 0px
  }
  .tablePart5 td,th{
    border-top: 0px
  }
}
.blank{
  width: 100%;
  height: 50px;
}
</style>
