<template>
  <div class="d-page d-flex flex-column">
    <title-bar :title="title" @clickLef="onClick">
      <van-icon slot="left" name="cross" size="30" />
    </title-bar>
    <div :data="itemData" v-if="itemData != ''">
      <div v-for="(item, index) in itemData" :key="index">
        <anchor-nav ref="anchorNav" :navList="navList">
          <template slot="baseInfo">
            <div class="flow-y-dhc">
              <table-double-view :data="item" :faIndex="index" :keyValue="keyValueDouble"></table-double-view>
              <div style="height: 1px;background-color: #e0e1e2;border-left: 100px solid #fff;border-right: 100px solid #fff"></div>
            </div>
          </template>
        </anchor-nav>
      </div>
    </div>
    <img v-if="no_data" src="../../../../assets/images/nodata.png" class="no-data-class"/>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import BasicInformation from "@/components/customer-information/business-information/overview/BasicInformation.vue";
import TableDoubleView from "@/public/TableDoubleView.vue";
import TableSingleView from "@/public/TableSingleView.vue";
import Public from "@/public/ts/Public";
import nettyApi from "@/constants/api/ms-netty/netty.api";
import { NativeUI } from "@/public/ts/NativeUI";
import IF from "@/public/factory/InterFaceFactory";
import { toMillion } from "@/public/ts/money.util";
import { getText } from "@/stores";
import { forTime } from "@/public/ts/date.util";

/**
 * @Description 基本信息
 * @Author JiangTao
 * @Date 2021-11-10 下午 03:12
 */
@Component({
  name: "Overview",
  components: { BasicInformation, TableDoubleView, TableSingleView }
})
export default class Overview extends Vue {
  title = "股票信息"; // 页面标题

  indexList = ["股票信息"];
  navList = [{ key: "baseInfo", titleText: "股票信息" }];
  keyValueDouble = {
    com_stk_name: '股票名称',
    com_stk_cap_qnt: '当前股票总量(万股)',
    com_stk_eva_amt: '股票评估价',
    com_stk_mrk_dt: '上市日期',
    com_stk_code: '股票代码',
    com_stk_mrk_place: '上市'
  };
  itemData = [];
  itemData2 = [];
  no_data = true; //暂无数据

  /**
   * @Description 基本信息查询
   * @Author JiangTao
   * @Date 2022-01-07 下午 03:15
   */
  getCompanyInfo() {
    var param = {
      cus_id: this.$store.getters.getCusInfo.cus_id, //'2191710',//'1005429634',
      cus_name: this.$store.getters.getCusInfo.cus_name, //'测试企业',//'客户1005429634',//
      cert_type: this.$store.getters.getCusInfo.cert_type, //'26',//'26',//
      cert_code: this.$store.getters.getCusInfo.cert_code, //'91510100797831986W',//'913204002508323014',//
      tc: nettyApi.TRADE_CODE.selectKHXQ
    };
    NativeUI.showWaiting("正在查询...");
    IF.transferDataInter(nettyApi.commonRq, param).then((res: any) => {
      console.log('股票信息', res);
      NativeUI.closeWaiting();
      if (res.rc === '1') {
        this.itemData2 = res.cusComFinaStockIColl;
        this.itemData = this.itemData2;
        if(this.itemData.length>0){
          this.no_data = false;
        }
      } else {
        NativeUI.toast(res.msg);
      }
    });
  }

  onClick() {
    console.log(111111);
  }

  mounted() {
    this.getCompanyInfo();
  }
}
</script>

<style scoped>
span {
  color: #999999;
  font-size: 16px;
}

.verify-view-details {
  float: right;
  margin-bottom: 10px;
  color: #fd5065;
  font-size: 12px;
  border: 1px solid #fd5065;
  border-radius: 4px;
  background-color: white;
  padding: 0.5% 0.8%;
  font-family: "苹方 粗体", "苹方 中等", "苹方";
}
/*右侧导航栏*/
::v-deep .van-index-bar__sidebar {
  top: 130px !important;
  right: 5px !important;
  transform: unset;
}
.no-data-class {
  width: 40%;
  margin: auto;
  display: flex;
  margin-top: 10%;
}
</style>
