<template>
  <div style="height: 100vh;background-color: #fff;">
    <van-nav-bar title="账号注销" left-text="返回" @click-left="$route_back" left-arrow/>
    <div class="all">
      <div style="text-align: center;margin-bottom: 0.3rem;"><img src="static/images/e66f.jpg" class="img" /></div>
      <div class="text">
        <div>
          注销前请完成以下动作方可注销</br>
          退出所有企业/组织
        </div>
        <div>
          注销后</br>
          所有数据将被抹除且不可恢复，请谨慎操作！
        </div>
      </div>
      <van-button v-if="canNext" @click="$route_back" style="background-color: #26A2FF;border:1px solid #26A2FF;border-radius: 3px;color: #FFF;" block >我知道了</van-button>
      <van-button v-else @click="verify" style="background-color: #26A2FF;border:1px solid #26A2FF;border-radius: 3px;color: #FFF;" block >注销</van-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'verify',
  data () {
    return {
      canNext:false
    }
  },
  activated(){
    this.get_site_list()
  },
  methods: {
    verify () {
      this.$dialog.confirm({
        message: '注销操作不可撤销，是否继续？'
      }).then(() => {
        this.$router.push({name: 'accountVf'})
      }).catch(() => {
        // on cancel
      })
    },
    get_site_list() {
      this.$toast.loading({
        mask: false,
        message: '获取企业信息'
      });
      this.$axios('get', '/api/pro/account/site', '', 'token').then(res => {
        this.$toast.clear();
        if (res.data.code === 1) {
          if (res.data.data.length > 0) {
            this.canNext = true;
          }else{
            this.canNext = false;
          }
        } else {
          console.log("获取企业失败")
        }
      });
    },
  }
}
</script>

<style scoped lang="less">
  .all{
    padding: 0.32rem;
  }
  .text{
    color: #969799;
    font-size: 0.28rem;
    padding: 0 0.3rem;
  }
  .text div{
    margin-bottom: 1rem;
  }
  .img{
    width: 2rem;
    height: 2rem;
    margin: 0 auto;
  }
</style>
