<template>
<el-dialog
  class="creator"
  title="上架明细"
  width="70%"
  :visible="showDetail"
  @close="close"
>
  <div class="creator__info creator__info--senior">
    <el-collapse v-model="activeNames">
      <el-collapse-item title="信息" name="1">
        <template v-for="item in detailFields">
          <div class="detail-item" :key="item.prop">
            <span class="detail-item__label">{{item.label}} :&nbsp;&nbsp;</span>
            <span class="detail-item__value">{{item.key ? $utils.keyMatcher(detailData[item.prop], $keys.stockIn.count[item.key]).name : detailData[item.prop]}}</span>
          </div>
        </template>
      </el-collapse-item>
    </el-collapse>
  </div>
</el-dialog>
</template>

<script>
export default {
  props: ['showDetail', 'detailData'],
  watch: {
    detailData: {
      immediate: true,
      handler (val) {
        this.lotAttrsParams = {
          ownerCode: val.ownerCode,
          skuCode: val.skuCode,
        }
      }
    },
  },
  created () {
  },
  mounted () {
  },

  data () {
    return {
      lotAttrsParams: {}, // 批次属性查询条件
      // 输入框
      detailFields: [
        { label: '任务ID', prop: 'paId' },
        { label: '行号', prop: 'lineNo' },
        { label: '状态', prop: 'status' },
        { label: '单据号', prop: 'orderNo' },
        { label: '货主', prop: 'ownerName' },
        { label: '商品', prop: 'skuCode' },
        { label: '商品名称', prop: 'skuName' },
        { label: '上架规则', prop: 'paRuleName' },
        { label: '批次号', prop: 'lotNum' },
        { label: '源库位', prop: 'fmLoc' },
        { label: '源跟踪号', prop: 'fmId' },
        { label: '推荐库位', prop: 'suggestLoc' },
        { label: '包装规格', prop: 'itemGroupName' },
        { label: '包装单位', prop: 'quaLotNum' },
        { label: '上架库位指定规则', prop: 'unquaLotNum' },
        { label: '上架库位', prop: 'toLoc' },
        { label: '上架跟踪号', prop: 'toId' },
        { label: '上架数', prop: 'qtyPaUom' },
        { label: '上架数EA', prop: 'qtyPaEa' },
        { label: '上架重量  ', prop: 'paWeight' },
        { label: '商品重量', prop: 'skuWeight' },
        { label: '上架人', prop: 'paName' },
        { label: '上架时间', prop: 'paTime' },
        { label: '备注', prop: 'remark' },
      ],
      activeNames: ['1', '2'],
    }
  },
  methods: {
    // 关闭
    close () {
      this.$emit('close')
    },
  },
}
</script>

<style lang="scss" scoped>
  .el-collapse-item {
    margin-bottom: 20px;
  }
  .detail-item {
    display: inline-table;
    width: 25%;
    font-size: 14px;
    padding: 7px;
  }
</style>
