<template>
  <el-descriptions :column="3" border v-loading="loading">
    <el-descriptions-item label="单据编号">{{ data.billNumber }}</el-descriptions-item>
    <el-descriptions-item label="货物名称">{{ data.cargoName }}</el-descriptions-item>
    <el-descriptions-item label="货主名称">{{ data.custName }}</el-descriptions-item>
    <el-descriptions-item label="单据日期">{{ data.billDate }}</el-descriptions-item>
    <el-descriptions-item label="有效期至">{{ data.expiryDate }}</el-descriptions-item>
    <el-descriptions-item label="库场代码">{{ data.stockCode }}</el-descriptions-item>
    <el-descriptions-item label="库场名称">{{ data.stockName }}</el-descriptions-item>
    <el-descriptions-item label="航次号">{{ data.voyageNo }}</el-descriptions-item>
    <el-descriptions-item label="船舶名称">{{ data.vesselName }}</el-descriptions-item>
    <el-descriptions-item label="计划货物件数">{{ data.cargoNum }}</el-descriptions-item>
    <el-descriptions-item label="计划货物重量">{{ data.cargoWt }}</el-descriptions-item>
    <el-descriptions-item label="计划货物体积">{{ data.cargoVol }}</el-descriptions-item>
    <el-descriptions-item label="货物自然序号">{{ data.cargoNumber }}</el-descriptions-item>
    <el-descriptions-item label="商品料号">{{ data.itemNumber }}</el-descriptions-item>
    <el-descriptions-item label="电子账册项号">{{ data.bookNumber }}</el-descriptions-item>
    <el-descriptions-item label="HS编号">{{ data.hsCode }}</el-descriptions-item>
    <el-descriptions-item label="报关单号">{{ data.customsNo }}</el-descriptions-item>
    <el-descriptions-item label="核注清单号">{{ data.listNumber }}</el-descriptions-item>
    <el-descriptions-item label="货物价值">{{ data.cargoValue }}</el-descriptions-item>
    <el-descriptions-item label="提运单号">{{ data.billNo }}</el-descriptions-item>
    <el-descriptions-item label="规格类型品质">{{ data.cargoSpec }}</el-descriptions-item>
    <el-descriptions-item label="原产国">{{ data.originCountry }}</el-descriptions-item>
    <el-descriptions-item label="业务性质">
      <dict-tag :options="dict.type.sys_business_nature" :value="data.opType"/>
    </el-descriptions-item>
    <el-descriptions-item label="贸易性质">
      <dict-tag :options="dict.type.sys_trade_nature" :value="data.tradType"/>
    </el-descriptions-item>
    <el-descriptions-item label="货物流向">{{ data.cargoFlow }}</el-descriptions-item>
  </el-descriptions>
</template>

<script>
import {
  getCkcargo,
} from '@/api/jxc/ckcargo'
export default {
  name: 'CargoDesc',
  dicts: ['sys_business_nature', 'sys_trade_nature'],
  props: {
    outBillCargoId: {
      type: String | Number,
      default: ''
    }
  },
  watch: {
    outBillCargoId: {
      handler(val) {
        this.getDetail(val);
      },
      immediate: true
    }
  },
  data() {
    return {
      data: {},
      loading: false,
    }
  },
  methods: {
    getDetail(id) {
      if (!id) {
        return;
      }
      this.loading = true;
      getCkcargo(id).then(res => {
        this.data = res.data || {};
        this.loading = false;
      }).catch(e => {
        this.loading = false;
      });
    }
  }
}
</script>

<style>

</style>
