<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&&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.settleStyleName || '--' }}</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 { findPayDetail } from '@/api/settlePay.js'
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) {
      findPayDetail({ 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>
