<template>
  <div class="app-container">
    <div class="filter-container">
      <el-form :inline="true" @submit.native.prevent>
        <el-input v-model="inputNumber" autocomplete="off" class="inputNumber" placeholder="请录入运单号/重量" @change="inputNumberHander" />

      </el-form>
      <el-table :data="sData" border>
        <el-table-column label="运单号" prop="TrackingNumber" />
        <el-table-column label="客户重量" prop="CustomerWeight" />
        <el-table-column label="核重" prop="CheckWeight" />
        <el-table-column label="核重结果">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.IsCheck">
              通过
            </el-tag>
            <el-tag v-if="scope.row.IsCheck==false">
              拦截
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="渠道" prop="ChannelName" />
      </el-table>
    </div>
  </div>
</template>
<script>

import { _inputNumberHander } from '@/api/interceptCheck'

export default {
  name: 'Intercept',
  data() {
    return {
      inputNumber: '',
      sData: [],
      trackingNumber: '',
      dto: {}
    }
  },
  methods: {
    inputNumberHander() {
      debugger
      var that = this
      this.dto.number = this.inputNumber.trim()
      _inputNumberHander(this.dto).then(response => {
        if (response.type == 'WL') {
          that.sData = [{ trackingNumber: response.data.trackingNumber }]
          that.dto.trackingNumber = response.data.trackingNumber
        } else if (response.type == '@N') {
          that.sData = [{
            TrackingNumber: that.dto.trackingNumber,
            IsCheck: response.data.IsCheck,
            CheckWeight: response.data.CheckWeight,
            ChannelName: response.data.ChannelName,
            CustomerWeight: response.data.CustomerWeight
          }]
        }
        that.inputNumber = ''
      })
    }
  }
}
</script>
<style>
    .appBtn{
        width:100px;
        height:100px;
    }

    .inputNumber input{
        height:50px!important;
        font-size: 32px!important;
        line-height: 50px!important;
        margin-bottom: 20px;;
    }
</style>
