<template>
  <a-modal
    centered
    class="vinRecord-modal"
    :footer="null"
    :maskClosable="false"
    title="调回单详情——[数字货架]"
    v-model="isShow"
    @cancel="isShow=false"
    width="60%">
    <!-- 详情 -->
    <div v-if="itemData">
      <a-descriptions :column="3" size="default">
        <a-descriptions-item label="调货单号">123456789</a-descriptions-item>
        <a-descriptions-item label="创建时间">2022-11-4 10:00:02</a-descriptions-item>
        <a-descriptions-item label="状态" :span="1">已完成</a-descriptions-item>
        <a-descriptions-item label="退库时间">1</a-descriptions-item>
        <a-descriptions-item label="关联销售退货单">
          <span class="recallBillNo" @click="seeRecallBill">DH221104000008，</span>
          <span class="recallBillNo">DH221104000008</span>
          <a-button type="primary" ghost class="recallBillBtn">生成销售退货单</a-button>
        </a-descriptions-item>
      </a-descriptions>
    </div>
    <!-- 表格 -->
    <div class="table-body">
      <table>
        <tr>
          <th width="10%">序号</th>
          <th width="10%">产品编码</th>
          <th width="50%">产品名称</th>
          <th width="10%">调回数量</th>
          <th width="10%">实退数量</th>
          <th width="10%">单位</th>
        </tr>
        <tr v-for="(item,index) in 5" :key="item.productSn">
          <td>{{ index + 1 }}</td>
          <td>JA-11070N</td>
          <td>名字名字名字名字名字名字名字名字名字名字名字名字名字名字名字名字名字名字名字名字</td>
          <td>2</td>
          <td>2</td>
          <td>个</td>
        </tr>
      </table>
    </div>
    <div class="btn-cont"><a-button id="vinRecord-modal-back" @click="isShow = false">关闭</a-button></div>
    <!-- 回调单号提示窗 -->
    <a-modal
      class="tipPopup"
      :maskClosable="false"
      v-model="tipVisible"
      :centered="true"
      :closable="false"
      :footer="null"
      width="23%">
      <div class="tipTop">
        <div>产品总款数：<span>5</span></div>
        <div>产品总件数：<span>5</span></div>
      </div>
      <div class="tipCon">确认生成销售退货订单吗？</div>
      <div class="tipCon">此调货单已经存在相应的销售退货单，确定再次生成销售退货单吗？</div>
      <div class="tipRecallBillNo">
        <p>DH221104000008</p>
        <p>DH221104000008</p>
      </div>
      <div class="tipFooter">
        <div class="btnLeft" @click="tipVisible = false">取消</div>
        <div class="btnLeft">确定</div>
      </div>
    </a-modal>
  </a-modal>
</template>

<script>
export default {
  name: 'DetailModal',
  props: {
    openModal: { //  弹框显示状态
      type: Boolean,
      default: false
    },
    itemData: {
      type: Object,
      default: function () {
        return []
      }
    }
  },
  data () {
    return {
      isShow: this.openModal, //  是否打开弹框
      tipVisible: false
    }
  },
  watch: {
    //  父页面传过来的弹框状态
    openModal (newValue, oldValue) {
      this.isShow = newValue
    },
    //  重定义的弹框状态
    isShow (newValue, oldValue) {
      if (!newValue) {
        this.$emit('close')
      }
      // else {
      //   this.getDetailList()
      // }
    }
  },
  methods: {
    seeRecallBill () {
      this.tipVisible = true
    }

  }
}
</script>

<style lang="less">
  .vinRecord-modal{
    .ant-modal-body {
      padding: 40px 40px 24px;
    }
    .btn-cont {
      text-align: center;
      margin: 35px 0 10px;
    }
    .table-body{
      table{
        th,td{
          text-align: center;
          padding: 5px;
          border:1px solid #ddd;
        }
        th{
          background:#f8f8f8;
        }
      }
    }
    .recallBillNo{
      color:#39f;
     font-weight: 600;
    }
    .recallBillBtn{
      border-color:#39f;
      color:#39f;
      margin-left: 20px;
      &:hover, &:focus {
        border-color: #52a6fb;
        color: #52a6fb;
      }
    }
  }
  // 弹窗
  .tipPopup{
    .ant-modal-body{
      padding:0 !important;
    }
    text-align: center;
    .tipTop{
      width:62%;
      display: flex;
      algin-item:center;
      padding:20px 0;
      box-sizing: border-box;
      justify-content: space-between;
      color:#333;
      margin:0 auto;
      span{
        color:#f30f3;
        font-weight: bold;
      }
    }
    .tipCon{
        width:62%;
        margin: 0 auto 30px;
        text-align: center;
    }
    .tipRecallBillNo{
        padding:20px;
        p{
          padding-bottom: 15px;
          border-bottom: 1px solid #e0e0e0;
        }
    }
    .tipFooter{
      display: flex;
      algin-item:center;
      border-top:1px solid #e0e0e0;
      .btnLeft{
        width:50%;
        text-align: center;
        height:46px;
        line-height: 46px;
        color:#39f;
        &:first-child{
          border-right:1px solid #e0e0e0;
        }
      }
    }

  }
</style>
