<template>
    <div id="category">
      <!--头部-->
      <!-- <Header/> -->
      <div class="header-title">
        <span class="header-title-return-back" @click="returnClick"><van-icon name="arrow-left" /></span>
        <span class="header-title-name-bold">工商信息</span>
      </div>
  
      <div class="manage-body">
        <van-cell>
          <template #title>
              <span class="custom-title cl-gray">法定代表人</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.operName }}</span>
          </template>
        </van-cell>
        <van-cell style="width: 50%;float: left;">
          <template #title>
              <span class="custom-title cl-gray">经营状态</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.status }}</span>
          </template>
        </van-cell>
        <van-cell style="width: 50%;">
          <template #title>
              <span class="custom-title cl-gray">成立日期</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.startDate }}</span>
          </template>
        </van-cell>

        <van-cell style="width: 50%;float: left;">
          <template #title>
              <span class="custom-title cl-gray">注册资本</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.registCapiValue !== null?`${businessInfo.registCapiValue}${businessInfo.registCapiUnit}`: '未披露' }}</span>
          </template>
        </van-cell>
        <van-cell style="width: 50%;">
          <template #title>
              <span class="custom-title cl-gray">实缴资本</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.recCap }}</span>
          </template>
        </van-cell>
      </div>

      <div class="manage-body">
        <van-cell style="width: 50%;float: left;">
          <template #title>
              <span class="custom-title cl-gray">统一社会信用代码</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.creditCode }}</span>
          </template>
        </van-cell>
        <van-cell style="width: 50%;">
          <template #title>
              <span class="custom-title cl-gray">组织机构代码</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.orgNo }}</span>
          </template>
        </van-cell>

        <van-cell style="width: 50%;float: left;">
          <template #title>
              <span class="custom-title cl-gray">工商注册号</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.no }}</span>
          </template>
        </van-cell>
        <van-cell style="width: 50%;">
          <template #title>
              <span class="custom-title cl-gray">纳税人识别号</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.taxNo }}</span>
          </template>
        </van-cell>

        <van-cell>
          <template #title>
              <span class="custom-title cl-gray">公司类型</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.econKind }}</span>
          </template>
        </van-cell>
        <van-cell>
          <template #title>
              <span class="custom-title cl-gray">经营期限</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.termStart == ''?'未知':businessInfo.termStart }}至{{ businessInfo.termEnd == ''?'长期':businessInfo.termEnd }}</span>
          </template>
        </van-cell>
      </div>

      <div class="manage-body">
        <van-cell>
          <template #title>
              <span class="custom-title cl-gray">登记机关</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.belongOrg }}</span>
          </template>
        </van-cell>

        <van-cell style="width: 50%;float: left;">
          <template #title>
              <span class="custom-title cl-gray">标准日期</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.checkDate }}</span>
          </template>
        </van-cell>
        <van-cell style="width: 50%;">
          <template #title>
              <span class="custom-title cl-gray">从业人数</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.operName }}</span>
          </template>
        </van-cell>
      </div>

      <div class="manage-body" style="padding-bottom: 50px;">
        <van-cell>
          <template #title>
              <span class="custom-title cl-gray">所属行业</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.industry }}</span>
          </template>
        </van-cell>
        <van-cell>
          <template #title>
              <span class="custom-title cl-gray">企业地址</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.address }}</span>
          </template>
        </van-cell>
        <van-cell>
          <template #title>
              <span class="custom-title cl-gray">经营范围</span>
          </template>
          <template #label>
              <span class="custom-title cl-black">{{ businessInfo.scope }}</span>
          </template>
        </van-cell>
      </div>
    </div>

  </template>

  <script>
  import { Button, Col, Row, Icon, Field } from 'vant';

  // 3. 引入接口
  import { postBaseInfo } from "@/service/api/customerDashboard";


  export default {
    name: "BusinessInfo",
    data() {
      return {
        // 是否显示正在加载
        showLoading: true,
        // 左侧列表数组
        categories: [],
        // 右侧列表数组
        categoriesDetail: [],
        // 左侧item选中与否
        show: false,
        text: '',
        businessInfo: {},
        token: '',
      }
    },
    components: {
      VanButton: Button,
      VanRow: Row,
      VanCol: Col,
      VanIcon: Icon,
      VanField: Field,
    },
    computed: {
      // ...mapState(["shopCart", "userInfo"])
    },
    created() {
      this.token = sessionStorage.getItem('token')
      this.postBusinessInfo();
    },
    methods: {
      // 获取工商信息
      async postBusinessInfo(){
        let result = await postBaseInfo({companyId: sessionStorage.getItem('companyId')});
        this.businessInfo = result;
        // this.businessInfo.startDate = /\d{4}\/\d{1,2}\/\d{1,2}/g.exec(this.businessInfo.startDate);
        this.businessInfo.startDate = this.businessInfo.startDate.substr(0, 10);
      },
      returnClick() {
        this.$router.go(-1)
      },

    },
  }
  </script>
  
  <style lang="less" scoped>
  
  .header-title {
    height: 46px;
    width: 100%;
    background-color: #fff;
    text-align: center;
  }
  .header-title-name {
    font-weight: bold;
    line-height: 46px;
    align-items: center;
    justify-content: center;
    display: inline-flex;
  }
  .header-title-return {
    position: absolute;
    top: 13px;
    left: 20px;
    font-size: 15px;
  }
  .manage-body {
    margin-top: 10px;
    background-color: #fff;
    padding: 0px 10px 0px 10px;
  }
  /deep/ .van-nav-bar__text {
    color: gray !important;
    font-weight: bold;
  }
  .icon-mg {
    margin-left: 3px;
  }
  /deep/ .van-card__thumb {
    width: 60px;
  }
  /deep/ .van-cell__value {
    bottom: 5px;
  }
  .custom-title {
    margin-right: 4px;
    vertical-align: middle;
  }
  .cl-gray {
    color: #8c8c8c;
  }
  .cl-black {
    color: #000;
  }
  .fw-bold {
    font-weight: bold;
  }
  </style>../../service/api/index