<template>
  <div class="home">
    <div class="container">
      <div class="box">
        <van-icon name="checked" color="#46C3B0" />
        <h2>支付成功</h2>
        <!-- <p>您已预约成功，请提前30分钟到医院确认就诊</p> -->
      </div>
      <div class="box1">
        <!-- <a @click="handleCancel">取消预约挂号</a> -->
        <a @click="handleJump()">确认</a>
      </div>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src
// import { apiOpAppCancelAppoint,apiOpAppCancelRegist } from "@/request/api.js";
// import { Toast, Dialog } from "vant";
export default {
  data() {
    return {
      title: "",
      type:1
    };
  },
  created(){
    this.title = '支付';
    this.type = this.$route.query.type;
  },
  mounted() {
    
    // if (!(this.$route.query.id && this.$route.query.type)) {
    //   this.$router.replace({
    //     path: "/Yygh",
    //     query: {}
    //   });
    //   return;
    // }
    // this.id = this.$route.query.id;
    // this.type = this.$route.query.type;
  },
  methods: {
    handleJump(){
      // console.log(this.$route.query.type)
      if(this.type==2){
        this.$router.push({ path: "/zstj_wd", query: {} });
        return
      }
      this.$router.push({ path: "/Yylb", query: {} });
    },
    handleCancel() {
      Dialog.confirm({
        title: "标题",
        message: "是否取消预约挂号"
      })
      .then(() => {
        // on confirm
        if(this.type==1){
          apiOpAppCancelRegist({id:this.id}).then(res => {
            Toast("取消成功");
            setTimeout(() => {
              this.$router.replace({       
                path: '/Yygh',       
                query: {}      
              });
            }, 1000);
          });
          retuen
        }
        apiOpAppCancelAppoint({id:this.id}).then(res => {
          Toast("取消成功");
          setTimeout(() => {
            this.$router.replace({       
              path: '/Yygh',       
              query: {}      
            });
          }, 1000);
        });
      })
      .catch(() => {
        // on cancel
      });
    }
  }
};
</script>


<style scoped lang="scss">
.box {
  padding: 60px 0px;
  padding-top: 150px;
  text-align: center;
  i {
    width: 113px;
    height: 113px;
    font-size: 113px;
  }
  h2 {
    font-size: 35px;
    padding: 15px 0px;
  }
  p {
    font-size: 26px;
  }
}
.box1 {
  a {
    width: 690px;
    height: 72px;
    line-height: 72px;
    border: 2px solid #46c3b0;
    border-radius: 24px;
    display: block;
    text-align: center;
    color: #46c3b0;
    font-size: 28px;
  }
  a:nth-last-child(1) {
    background: #46c3b0;
    color: #fff;
    margin-top: 30px;
  }
}
</style>
