<template>
  <a-modal
    centered
    class="financialPaymentDetail-modal"
    :footer="null"
    :maskClosable="false"
    title="凭证"
    v-model="isShow"
    @cancle="isShow=false"
    :width="600">
    <!-- 详情 -->
    <div>
      <a-descriptions :column="1" size="default">
        <a-descriptions-item label="收款单号">{{ detailsData&&detailsData.settleNo || '--' }}</a-descriptions-item>
        <a-descriptions-item label="关联单号">{{ detailsData&&detailsData.bizNo || '--' }}</a-descriptions-item>
        <a-descriptions-item label="商户名称">{{ detailsData&&detailsData.settleClientName || '--' }}</a-descriptions-item>
        <a-descriptions-item label="收款金额">{{ detailsData&&(detailsData.settledAmount || detailsData.settledAmount==0) ? '￥'+ detailsData.settledAmount : '--' }}</a-descriptions-item>
        <a-descriptions-item label="收款类型">{{ detailsData&&detailsData.bizTypeDictValue || '--' }}</a-descriptions-item>
        <a-descriptions-item label="收款方式">{{ detailsData&&detailsData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
        <a-descriptions-item label="收款时间">{{ detailsData&&detailsData.settleTime || '--' }}</a-descriptions-item>
        <a-descriptions-item label="审核时间">{{ detailsData&&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
    }
  },
  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>
