<template>
  <div>
    <el-dialog :title="title" :visible="openDialog" @close="cancel" :destroy-on-close="true" center>
      <el-form ref="form" :model="form" label-width="90px" :disabled="true">
        <el-form-item label="案件编号：" prop="caseNum">
          <el-input v-model="form.caseNum" placeholder="" />
        </el-form-item>
        <el-form-item label="案件标的：" prop="caseSubjectAmount">
          <el-input v-model="form.caseSubjectAmount" />
        </el-form-item>
        <el-form-item label="缴费人：" prop="applicantName">
          <el-input v-model="form.applicantName" placeholder="" />
        </el-form-item>
        <el-form-item label="缴费金额：" prop="feePayable">
          <el-input v-model="form.feePayable" />
        </el-form-item>
        <!-- <el-form-item label="缴费截图：" prop="respondent">
          <el-input v-model="form.Respondent" placeholder="" />
        </el-form-item> -->
        <el-form-item label="案件状态：" prop="caseStatusName">
          <!-- <el-input v-model="form.caseStatusName" placeholder="" /> -->
          <el-tag>{{ form.caseStatusName }}</el-tag>
        </el-form-item>
        <el-form-item label="支付状态：" prop="paymentStatusName">
          <!-- <el-input v-model="form.paymentStatusName" placeholder="" /> -->
          <el-tag effect="dark" type="success">
            {{ form.paymentStatusName }}
          </el-tag>
        </el-form-item>
        <el-form-item label="缴费凭证：" prop="caseStatusName">
          <div style="color: #104fad;cursor:pointer" v-for="(item, index) in form.payOrderList" :key="index" @click="preview(item.annexPath)">
            {{ item.annexName }}
          </div>
          <!-- <el-tag>{{ form.caseStatusName }}</el-tag> -->
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm" v-if="flag == 0" class="endbutton">确认已缴费</el-button>
        <el-button @click="cancel" class="endbutton1">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { confirmPay } from "@/api/pay/pay";
export default {
  props: ["openDialog", "title", "flag", "detailform", "getList"],
  data() {
    return {
      // key: value
      form: {},
      srcList: []
    };
  },
  watch: {
    detailform: {
      handler(val) {
        if (val) {
          this.form = val;

        }
      },
    },
  },
  methods: {
    preview(data) {
      window.open(
        window.location.origin + "/API" + data,
        "_blank"
      );
    },
    // 确认缴费
    submitForm() {
      confirmPay({ id: this.form.id }).then((res) => {
        this.$message({
          message: "确认成功",
          type: "success",
        });
        if (res.code == 200) {
          this.getList();
        }
      });
      this.cancel();
    },
    cancel() {
      this.$emit("cancelpaymentdetails");
    },
  },
};
</script>

<style lang="scss" scoped>
::v-deep .el-dialog {
  width: 50%;
  background: #ffffff;
  border-radius: 20px;
}

.endbutton {
  width: 124px;
  height: 37px;
  background: #0072ff;
  border-radius: 19px;

  span {
    width: 32px;
    height: 15px;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #ffffff;
    // line-height: 48px;
  }
}

.endbutton1 {
  width: 124px;
  height: 37px;
  background: #ffffff;
  border: 1px solid #d0d0d0;
  border-radius: 19px;

  span {
    width: 31px;
    height: 13px;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #959595;
  }
}
</style>