<template>
  <div class="application_com">
  <van-nav-bar title="申请升级" left-text="返回" @click-left="$router.back(-1)" left-arrow>
    <div slot="right">历史记录</div>
  </van-nav-bar>

<div style="height: 0.16rem;"></div>



    <div class="panel-application" v-if="info != null" style="padding:0 0.32rem;">
      <div v-for="(item,index) in info.status0" :key="index">

        <div>审批人：{{item.parent.nickname}}</div>
        <div>微信：{{item.parent.weixin}}</div>
        <div>电话：{{item.parent.username}}</div>


      </div>
      <div style="height: 0.16rem; background-color: #f5f5f5; margin:0 -0.32rem;"></div>
    </div>



    <div class="panel-application" v-if="info != null">
<div>团队人数：{{info.user_count}}</div>
<div>当前等级：{{info.cur_level.name}}</div>
<div>您可以申请升级为：{{info.next_level.name}}</div>

<div v-if="info.can_up_level">是否提交申请？</div>
<div v-if="info.can_up_level == false" style="color:#f00;">{{info.msg}}</div>
    </div>


    <div style="padding:0.32rem;" v-if="info != null && info.can_up_level">
      <van-button type="primary" size="large" @click="submit_info">提交申请</van-button>
    </div>
  </div>
</template>

<script>
  import request from '@/utils/request'
  export default {
    name: 'application_order',
    data() {
      return {
        info:null
      }

    },
    created() {
      this.get_info()
    },
    methods: {
      get_info() {
        let self = this
        self.$toast.loading({
          mask: true,
          message: '加载中...'
        })
        request('get','/ckorder/index/get_info.html').then((res) => {
          self.info = res.data.data
          self.$toast.clear()
        })
      },

      submit_info() {
        let self = this
        self.$toast.loading({
          mask: true,
          message: '处理中...'
        })
        request('get','/ckorder/index/review_add.html').then((res) => {
          self.$toast.clear()
          if(res.data.code == 1){
            self.$toast(res.data.msg)
            self.get_info()
          }else{
            self.$toast(res.data.msg)
          }

        })
      }

    }
  }
</script>

<style scoped>
  .panel-application{background-color: #fff; padding:0.32rem;
    line-height: 2;}
.application_com{
  height: 100%; background-color: #f5f5f5;}
</style>
