<template>
<el-dialog
  class="creator"
  title="商品信息"
  width="70%"
  :visible="showDetail"
  @close="close"
>
 <el-form
      inline
      ref="form"
      label-position="top"
      :model="formData"
      disabled
    >
       <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-item title="批次属性" name="2">
        <LotAttrs
           disabled
          :formData="formData"
          :queryParams="lotAttrsParams"
        ></LotAttrs>
      </el-collapse-item>
    </el-collapse>
  </div>

    </el-form>

</el-dialog>
</template>

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

  data () {
    return {
      formData: {},
      lotAttrsParams: {}, // 批次属性查询条件
      // 输入框
      detailFields: [
        { label: '入库单号', prop: 'asnNo' },
        { label: '行号', prop: 'lineNo' },
        { label: '状态', prop: 'status' },
        { label: '物流单行号', prop: 'logisticLineNo' },
        { label: '商品名称', prop: 'skuName' },
        { label: '商品编码', prop: 'skuCode' },
        { label: '计划收货库位', prop: 'planToLoc' },
        { label: '计划跟踪号', prop: 'traceId' },
        { label: '包装规格', prop: 'packDesc' },
        { label: '单位', prop: 'uomDesc' },
        { label: '采购单号', prop: 'poNo' },
        { label: '采购单行号', prop: 'poLineNo' },
        { label: '预收数', prop: 'qtyAsnUom' },
        { label: '预收数EA', prop: 'qtyAsnEa' },
        { label: '预收重量', prop: 'asnWeight' },
        { label: '商品重量', prop: 'skuWeight' },
        { label: '已收数', prop: 'qtyRcvUom' },
        { label: '已收数EA', prop: 'qtyRcvEa' },
        { label: '已收重量', prop: 'rcvWeight' },
        { label: '是否已码盘', prop: 'isPalletize' },
        { label: '单价', prop: 'price' },
        { label: '上架规则', prop: 'paRuleName' },
        { label: '上架库位指定规则', prop: 'reserveCode' },
        { label: '父件编码', prop: 'parentSkuCode' },
        { label: '是否齐套管理', prop: 'isKitting' },
        { label: '齐套管理类型', prop: 'kittingType' },
        { label: 'EDI是否已发送', prop: 'isEdiSend' },
        { label: 'EDI发送时间', prop: 'ediSendTime' },
        { label: '工单号', prop: 'workNo' },
        { label: '拒收原因', prop: 'reasonCode' },
        { label: '拒收原因描述', prop: 'reason' },
      ],
      activeNames: ['1', '2'],
      isDisabled: true,
    }
  },
  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>
