<template>
  <a-modal
    centered
    :footer="null"
    :maskClosable="false"
    title="销售退货单审核进度"
    v-model="isShow"
    @cancel="isShow=false"
    width="50%">
    <auditDetail v-if="isShow" ref="auditDetail" businessType="SALES_RETURN" @loadError="isShow = false" :itemSn="itemSn"></auditDetail>
  </a-modal>
</template>

<script>
import auditDetail from './auditDetail.vue'
export default {
  name: 'VerifyModal',
  components: { auditDetail },
  props: {
    openModal: {
      type: Boolean,
      default: false
    },
    itemSn: {
      type: [Number, String],
      default: ''
    }
  },
  data () {
    return {
      isShow: this.openModal
    }
  },
  watch: {
    openModal (nVal, oVal) {
      this.isShow = nVal
    },
    isShow (nVal, oVal) {
      if (!nVal) {
        this.$emit('close')
        this.$refs.auditDetail.clearTable()
      } else {
        this.$nextTick(() => {
          this.$refs.auditDetail.refresh()
        })
      }
    }
  }
}
</script>

<style>
</style>
