<template>
  <a-modal
    centered
    class="financialPaymentDetail-modal"
    :footer="null"
    :maskClosable="false"
    title="凭证"
    v-model="isShow"
    @cancle="isShow=false"
    :width="600">
    <!-- 详情 -->
    <div v-if="detailsData">
      <a-descriptions :column="1" size="default">
        <a-descriptions-item label="收款单号">{{ detailsData.settleNo || '--' }}</a-descriptions-item>
        <a-descriptions-item label="关联单号">{{ detailsData.bizNo || '--' }}</a-descriptions-item>
        <a-descriptions-item label="商户名称">{{ detailsData.settleClientName || '--' }}</a-descriptions-item>
        <a-descriptions-item label="收款金额">{{ ('￥'+detailsData.settledAmount) || '--' }}</a-descriptions-item>
        <a-descriptions-item label="收款类型">{{ detailsData.bizTypeDictValue || '--' }}</a-descriptions-item>
        <a-descriptions-item label="收款方式">{{ detailsData.settleStyleName || '--' }}</a-descriptions-item>
        <a-descriptions-item label="收款时间">{{ detailsData.settleTime || '--' }}</a-descriptions-item>
        <a-descriptions-item label="审核时间">{{ detailsData.auditTime || '--' }}</a-descriptions-item>
      </a-descriptions>
      <div class="btn-cont"><a-button id="financialPaymentDetail-modal-back" @click="isShow = false">关闭</a-button></div>
    </div>
  </a-modal>
</template>

<script>
import { findReceiptDetail } from '@/api/settleReceipt'
export default {
  name: 'FinancialPaymentDetailModal',
  props: {
    openModal: { //  弹框显示状态
      type: Boolean,
      default: false
    },
    itemId: {
      type: [Number, String],
      default: ''
    }
  },
  data () {
    return {
      isShow: this.openModal, //  是否打开弹框
      // detailsData: null, //  详情数据
      detailsData: {
        productName: '',
        productCode: '',
        origCode: '',
        unit: '',
        productBrandName: ''
      }
    }
  },
  methods: {
    //  获取详情
    getDetail (id) {
      findReceiptDetail({ id: id }).then(res => {
        if (res.status == 200) {
          this.detailsData = res.data
        } else {
          this.detailsData = null
        }
      })
    }
  },
  watch: {
    //  父页面传过来的弹框状态
    openModal (newValue, oldValue) {
      this.isShow = newValue
    },
    //  重定义的弹框状态
    isShow (newValue, oldValue) {
      if (!newValue) {
        this.$emit('close')
        this.detailsData = null
      }
    }
  }
}
</script>

<style lang="less">
  .financialPaymentDetail-modal{
    .ant-modal-body {
      padding: 40px 40px 24px;
    }
    .btn-cont {
      text-align: center;
      margin: 35px 0 10px;
    }
  }
</style>
