<template>
  <a-modal
    centered
    id="brand-category-modal"
    class="brand-category-modal"
    :footer="null"
    :maskClosable="false"
    :title="openType=='brand'?'促销品费用归属品牌':'促销品费用归属品类'"
    v-model="isShow"
    @cancel="isShow=false"
    :width="520">
    <a-spin :spinning="spinning" tip="Loading...">
      <div class="con">
        <div class="con-list">
          品{{ openType=='brand'?'牌':'类' }}数量：17
        </div>
        <div class="con-list">
          <span v-for="con in 30" :key="con">霍尼韦尔</span>
        </div>
      </div>
      <div class="btn-cont">
        <a-button id="brand-category-modal-back" @click="isShow = false">关闭</a-button>
      </div>
    </a-spin>
  </a-modal>
</template>

<script>
import { commonMixin } from '@/utils/mixin'
// 组件
import { VSelect, Upload } from '@/components'
import supplier from '@/views/common/supplier.js'
import warehouse from '@/views/common/chooseWarehouse.js'
// 接口
import { sparePartsReturnInfo } from '@/api/sparePartsReturn'
export default {
  name: 'BrandCategoryModal',
  mixins: [commonMixin],
  components: { VSelect, Upload, supplier, warehouse },
  props: {
    openModal: { //  弹框显示状态
      type: Boolean,
      default: false
    },
    openType: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      spinning: false,
      isShow: this.openModal //  是否打开弹框

    }
  },
  methods: {
    // 获取编辑详情
    getDetail () {
      sparePartsReturnInfo({ sn: this.itemSn }).then(res => {
        if (res.status == 200) {
          const resultObj = res.data
          this.attachList = resultObj.attachmentList
          const obj = {
            supplierSn: resultObj.supplierSn,
            returnReason: resultObj.returnReason, // 退货原因
            explainInfo: resultObj.explainInfo, // 补充说明
            warehouseSn: resultObj.warehouseSn,
            sparePartsReturnSn: this.itemSn
          }
          this.$nextTick(() => {
            this.$refs.attachList.setFileList(this.attachList)
          })
          this.form = { ...this.form, ...obj }
        } else {
          this.detailsData = null
        }
      })
    }
  },
  watch: {
    //  父页面传过来的弹框状态
    openModal (newValue, oldValue) {
      this.isShow = newValue
    },
    //  重定义的弹框状态
    isShow (newValue, oldValue) {
      if (!newValue) {
        this.$emit('close')
      }
    }
  }
}
</script>

<style lang="less" scoped>
  .brand-category-modal{
    .ant-modal-body {
      padding: 40px 40px 24px;
    }
    .con-list{
      margin-bottom:8px;
      span{
        display: inline-block;
        margin:5px 10px 5px 0;
      }
    }
    .btn-cont {
      text-align: center;
      margin: 35px 0 10px;
    }
    .ant-form-item:nth-child(4){
      margin-bottom: 0px !important;
    }
  }

</style>
