<template>
  <div class="content">
    <div v-if="getData[0]" class="personal-mortgage">
      <div></div>
      <div @click="selectInfo(0)">
        《{{ getData[0].fileName }}》
      </div>
    </div>
    <div v-if="getData[1]" class="personal-consumption">
      <div></div>
      <div @click="selectInfo(1)">
        《{{ getData[1].fileName }}》
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import nettyApi from "@/constants/api/ms-netty/netty.api.ts";
import systemApi from "@/constants/api/ms-system/system.api.ts";
import IF from "@/public/factory/InterFaceFactory";
import { NativeUI } from "@/public/ts/NativeUI";
/**
 * @Description 利率定价
 * @Author JiangTao
 * @Date 2021-10-25 下午 08:55
 */
@Component({
  name: "InterestPricing",
})
export default class InterestPricing extends Vue {
  getData: any[] = [];

  itemInfo: any = {};

  //查询个贷利率定价
  selectPerLoanPrice() {
    NativeUI.showWaiting("正在查询...");
    return IF.transferDataInter(systemApi.selectPerLoanPrice, {}).then(
      (res: any) => {
        NativeUI.closeWaiting();
        if (res.code == 1) {
          this.getData = res.data;
          console.log(this.getData);
          for (let i = 0; i < this.getData.length; i++) {
            let temp = this.getData[i].docName;
            // let strs = temp.spit('个');
            let index = temp.indexOf("个人");
            let fileDate = temp.substr(0, index);
            let fileName = temp.substr(index);
            this.getData[i].fileDate = fileDate;
            this.getData[i].fileName = fileName;
          }
          // console.log(this.getData,'-----------------------------------------------');
        } else {
          NativeUI.toast(res.msg);
        }
      }
    );
  }
  selectInfo(index = 0) {
    const urlFront = "http://15.1.48.24:8888/"; //http://15.1.48.24:8888/
    if (index == 0) {
      window.location.href = urlFront + this.getData[0].mcepFileKey;
    } else if (index == 1) {
      window.location.href = urlFront + this.getData[1].mcepFileKey;
    }
  }
  mounted() {
    this.selectPerLoanPrice();
  }
}
</script>

<style scoped>
.content {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.personal-mortgage,
.personal-consumption {
  width: 30%;
  height: 33%;
  background-image: url("~@/assets/images/auxiliary-tools-Interest-pricing.png");
  background-repeat: no-repeat;
  background-size: 90%;
}
.personal-mortgage div:nth-child(1),
.personal-consumption div:nth-child(1) {
  width: 50%;
  height: 30%;
  margin-top: 10%;
  margin-left: 8%;
  background-image: url("~@/assets/images/chengdu-bank-logo.png");
  background-repeat: no-repeat;
  background-size: 75%;
}
.personal-mortgage div:nth-child(2),
.personal-consumption div:nth-child(2) {
  width: 50%;
  margin: 0 auto;
  margin-left: 20%;
  font-size: 115%;
}
</style>
