<template>
  <div class="home_wrapper">
    <!--  头部开始  -->
    <div class="header">
      <div class="header_left" @click="$router.push({name:'agriculturalTrusteeshipLogin'})">
        <img src="../../../../static/images/agriculturalTrusteeship/return.png">
        <p>退出登录</p>
      </div>
    </div>
    <!--  头部结束  -->

    <div class="nav">
      <div class="content">
        <van-grid :column-num="4" :border="false">
          <van-grid-item>
            <img src="../../../../static/images/agriculturalTrusteeship/socialization/user_nav_01.png" alt="">
            <p class="nav_num">{{content.numFinish}}</p>
            <p>已成交</p>
          </van-grid-item>
          <van-grid-item>
            <img src="../../../../static/images/agriculturalTrusteeship/socialization/user_nav_02.png" alt="">
            <p class="nav_num">{{content.numHandling}}</p>
            <p>待处理</p>
          </van-grid-item>
          <van-grid-item>
            <img src="../../../../static/images/agriculturalTrusteeship/socialization/user_nav_04.png" alt="">
            <p class="nav_num">{{content.numReject}}</p>
            <p>已拒单</p>
          </van-grid-item>
          <van-grid-item>
            <img src="../../../../static/images/agriculturalTrusteeship/socialization/user_nav_03.png" alt="">
            <p class="nav_num" style="color: #FF5D00">{{content.realityServiceMoney}}</p>
            <p style="color: #FF5D00">总收入</p>
          </van-grid-item>
        </van-grid>
      </div>
    </div>

    <!--  内容开始  -->
    <div class="main">
      <div class="main_content">
        <van-cell :border="false" center>
          <template #title>
            <p class="tt">公司信息</p>
          </template>
          <template #right-icon>
            <img src="../../../../static/images/agriculturalTrusteeship/insurance/shop_icon_edit.png" @click="$router.push({name:'agriculturalTrusteeshipSocializationUserEdit'})">
          </template>
        </van-cell>

        <div class="main_box" style="margin-top: 0;">
          <van-field label="主体名称" v-model="entityForm.entityName" left-icon="../../../../static/images/agriculturalTrusteeship/socialization/user_icon_01.png" :border="false" input-align="right" value="内容" />
          <van-field label="主体类别" v-model="entityForm.statisticsTypeId" left-icon="../../../../static/images/agriculturalTrusteeship/socialization/user_icon_02.png" :border="false" input-align="right" value="内容" />
          <van-field label="生产种类" v-model="entityForm.industryClassificationType" left-icon="../../../../static/images/agriculturalTrusteeship/socialization/user_icon_03.png" :border="false" input-align="right" value="内容" />
          <van-field label="成立时间" v-model="entityForm.registerTime" left-icon="../../../../static/images/agriculturalTrusteeship/socialization/user_icon_04.png" :border="false" input-align="right" value="内容" />
          <van-field label="示范类型" v-model="entityForm.modelSocietyType" left-icon="../../../../static/images/agriculturalTrusteeship/socialization/user_icon_05.png" :border="false" input-align="right" value="内容" />
          <van-field label="负责人" v-model="entityForm.principalName" left-icon="../../../../static/images/agriculturalTrusteeship/socialization/user_icon_06.png" :border="false" input-align="right" value="内容" />
          <van-field label="联系电话" v-model="entityForm.tal" left-icon="../../../../static/images/agriculturalTrusteeship/socialization/user_icon_07.png" :border="false" input-align="right" value="内容" />
        </div>

        <div class="main_box" v-show="entityForm.theGeom">
          <MapGisTag ref="clickLoading" :showBtn="false" :message="entityForm.theGeom"></MapGisTag>
        </div>
      </div>
    </div>
    <!--  内容结束  -->

    <agr></agr>
    <transition name="van-fade">
      <dialogClose v-show="showDialog"></dialogClose>
    </transition>
  </div>
</template>
<script>
  import Cookies from "js-cookie";
  import agr from "@/components/common/agr_footer";
  import dialogClose from "@/components/agriculturalTrusteeship/dialog";
  import {entityGet, orderStatistics} from "@/api/agriculturalTrusteeship";
  import MapGisTag from "@/components/Map/MapGisTagDTG";
  let map ;
  let myGeo ;
  export default {
    name: "agriculturalTrusteeshipInsuranceList",
    components: {
      agr,
      dialogClose,
      MapGisTag
    },
    data() {
      return {
        activeKey: 0,
        active: 0,
        loading: false,
        finished: false,
        center: { lng: 122.089726, lat: 37.540728 }, //经纬度
        zoom: 15, //地图展示级别
        showDialog:false,
        entityForm:{},
        content:{},
        statisticsTypeIdOptions:[],
        industryClassificationTypeOptions:[],
        modelSocietyTypeOptions:[],
      };
    },
    created() {
      orderStatistics().then(response => {
        this.content = response.data;
      });
      this.getDicts("newBusinessEntity_statistics_project").then(response => {
        this.statisticsTypeIdOptions = response.data;
      });
      this.getDicts("Industrial_classification_type").then(response => {
        this.industryClassificationTypeOptions = response.data;
      });
      this.getDicts("model_society_type").then(response => {
        this.modelSocietyTypeOptions = response.data;
      });
      this.getUser();
    },
    methods: {
      //每个查看修改，新增  方法下引用下面方法
      mapClickLoading(){
        setTimeout(() => {
          this.$refs.clickLoading.pointPaceCountryDarw();
        }, 500);
      },
      getUser(){
        entityGet(Cookies.get('ACCESS-SESSION-ID')).then(res=>{
          res.data.statisticsTypeId = this.selectDictLabel(this.statisticsTypeIdOptions, res.data.statisticsTypeId);
          res.data.industryClassificationType = this.selectDictLabel(this.industryClassificationTypeOptions, res.data.industryClassificationType);
          res.data.modelSocietyType = this.selectDictLabel(this.modelSocietyTypeOptions, res.data.modelSocietyType);
          if (res.data.theGeom){

            var m_center=JSON.parse(res.data.theGeom).coordinates;//地图中心点-经纬度坐标 //经纬度转至
            var m_center1 = ol.proj.transform(m_center,'EPSG:3857', 'EPSG:4326');

            this.center.lng = m_center1[0];
            this.center.lat = m_center1[1];
          }
          this.entityForm = res.data;
          this.mapClickLoading();
        })
      },
      openDialog(val){
        this.showDialog = val
      },
    },
  }
</script>
<style scoped lang="scss">
  #container{
    width: 100%;
    height: 25vh;
    overflow: hidden;
  }
.home_wrapper{
  background: #ffffff;
  min-height: 100vh;
}
  /*头部*/
  .header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-image: linear-gradient(to right , #6E93F3 , #7E89E9 , #54C6E4);
    padding: 2vh 4% 2vh;
    .header_left{
      display: flex;
      align-items: center;
      p{
        font-size: .4rem;
        color: #ffffff;
        line-height: 1;
        margin-left: 10PX;
      }
    }
    .header_right{
      font-size: .35rem;
      background: #ffffff url("../../../../static/images/agriculturalTrusteeship/address.png") no-repeat 10PX center;
      padding: 2PX 15PX 2PX 25PX;
      border-radius: 50PX;
    }
  }

  .nav{
    background-image: linear-gradient(to right , #6E93F3 , #7E89E9 , #54C6E4);
    padding-bottom: 15PX;
    .content{
      background: #ffffff;
      width: 92%;
      margin: 0 auto;
      box-shadow: 0px 0px 10PX rgba(0,0,0,0.1);
      border-radius: 25PX;
      overflow: hidden;
      .nav_num{
        font-size: .4rem;
        margin: 10PX 0 5PX;
      }
    }
  }

  /* 内容 */
  .main{
    background-image: linear-gradient(to right , #6E93F3 , #7E89E9 , #54C6E4);
    .main_content{
      border-top-left-radius: 25PX;
      border-top-right-radius: 25PX;
      overflow: hidden;
      background: #ffffff;
      .main_box{
        width: 92%;
        margin: 0 auto;
        margin-top: 2vh;
        border-radius: 10PX;
        overflow: hidden;
        background-color: #FFF;
        /deep/ .van-cell{
          padding: 0;
          margin-bottom: 10PX;
          &:last-child{
            margin-bottom: 0;
          }
        }
      }
    }
  }
</style>
