<template>
  <el-table v-loading="loading" size="mini" border :data="list" max-height="300px">
    <el-table-column
      label="发货单编号"
      width="160px"
      prop="orderCode"
      show-overflow-tooltip
    />
    <el-table-column label="状态" width="120px" show-overflow-tooltip>
      <el-tag slot-scope="scope">{{
        (statusOptions.find(({ value }) => value === scope.row.status) || {}).label ||
          "--"
      }}</el-tag>
    </el-table-column>
    <el-table-column
      label="发货数量"
      width="80px"
      prop="send_num"
      show-overflow-tooltip
    />
    <el-table-column width="90px" label="联系人" prop="contactor" show-overflow-tooltip />
    <el-table-column width="120px" label="联系电话" prop="mobile" show-overflow-tooltip />
    <el-table-column label="收货地址" prop="addr" show-overflow-tooltip />
    <el-table-column label="物流公司" prop="post_name" show-overflow-tooltip />
    <el-table-column label="物流单号" prop="post_code" show-overflow-tooltip />
    <el-table-column label="发货时间" prop="updatetime" show-overflow-tooltip />
  </el-table>
</template>

<script>
import asyncRequest from '@/apis/service/sellOut/filing'
export default {
  props: ['orderCode'],
  data() {
    return {
      list: [],
      loading: false,
      statusOptions: [
        { value: '0', label: '待发货' },
        { value: '1', label: '待库管发货' },
        { value: '2', label: '已发货待收货' },
        { value: '3', label: '已收货' },
        { value: '4', label: '已全部退货' }
      ]
    }
  },
  async mounted() {
    const orderCode = this.orderCode
    if (!orderCode) return
    this.loading = true
    const { data, code, message } = await asyncRequest.saleOutList({ orderCode })
    this.loading = false
    if (Number(code) === 0) {
      this.list = data.list
    }
  }
}
</script>
