<template>
  <a-modal
    centered
    class="confirmationDetail-modal"
    :footer="null"
    :maskClosable="false"
    title="详情"
    v-model="isShow"
    @cancel="isShow=false"
    width="70%">
    <div>
      <detail :outBizSn="itemSn" :showPrice="$hasPermissions('M_allocateReturnConfirmationDetail_salesPrice')" pageType="modal" ref="detail"></detail>
      <div class="btn-cont"><a-button id="confirmationDetail-modal-back" @click="isShow = false">返回列表</a-button></div>
    </div>
  </a-modal>
</template>

<script>
// 组件
import detail from '@/views/allocationManagement/transferReturn/detail'
export default {
  name: 'AllocateReturnDetailModal',
  components: { detail },
  props: {
    openModal: { //  弹框显示状态
      type: Boolean,
      default: false
    },
    itemSn: {
      type: [Number, String],
      default: ''
    }
  },
  data () {
    return {
      isShow: this.openModal //  是否打开弹框
    }
  },
  watch: {
    //  父页面传过来的弹框状态
    openModal (newValue, oldValue) {
      this.isShow = newValue
    },
    //  重定义的弹框状态
    isShow (newValue, oldValue) {
      if (!newValue) {
        this.$emit('close')
        this.$store.state.app.curActionPermission = ''
      } else {
        this.$store.state.app.curActionPermission = 'M_allocateReturnConfirmationDetail'
      }
    }
  }
}
</script>

<style lang="less">
  .confirmationDetail-modal{
    .ant-modal-body {
      padding: 10px 10px 20px;
    }
    .btn-cont {
      text-align: center;
      margin: 5px 0 10px;
    }
  }
</style>
