<template>
  <div class="content">
    <scroller-view v-calculate-height :pulldown="pulldown" :pullup="pullup" :refresh-data="getProductInfo" :load-data="onloaddata">
      <div v-for="(item, index) in mianArray" :key="index" @click="turnInfo(item)" class="content-label">
        <img :src="item.productPicture" alt="">
        <div class="picture-label">{{ item.productName }}</div>
      </div>
    </scroller-view>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import systemApi from "@/constants/api/ms-system/system.api.ts";
import nettyApi from "@/constants/api/ms-netty/netty.api.ts";
import IF from "@/public/factory/InterFaceFactory";
import { NativeUI } from "@/public/ts/NativeUI";
/**
 * @Description 贷款类产品
 * @Author JiangTao
 * @Date 2021-11-10 下午 03:42
 */
@Component({
  name: "LoanProducts",
})
export default class LoanProducts extends Vue {
  mianArray = [];
  pullup = true;
  pulldown = true;
  pageNo = 1;
  mounted() {
    this.getProductInfo();
  }
  turnInfo(item: any) {
    this.$store.commit("setEmpty");
    this.$store.commit("setCusInfo", item);
    this.$router.push({
      path: "/ProductDetails"
    });
  };
  //上拉加载
  onloaddata() {
    this.pageNo = Math.ceil(this.mianArray.length / 10) + 1;
    return this.getProductInfo(this.pageNo);
  }
  getProductInfo(pageNo = 1) {
    const param = {
      pageNum: pageNo,
      pageSize: '10',
      productName: '',
      productRelDate: '',
      productExpDate: '',
      productType: "1",
      upstatus: '1',
      tc: 'MCEP'
    };
    return IF.transferDataInter(systemApi.productRq, param).then((res: any) => {
      if (res.code == '1') {
        if (pageNo == 1) {
          this.mianArray = res.data.records;
        } else {
          this.mianArray = this.mianArray.concat(res.data.records);
        }
      }
    });
  }
}
</script>

<style scoped>
.content {
  width: 92%;
  height: 100%;
  overflow-y: auto;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 24%);
  grid-row-gap: 10px;
  grid-column-gap: 10px;
}
.content > div {
  width: 100%;
  height: 187px !important;
  background-repeat: no-repeat;
  background-size: 100%;
  display: flex;
  align-items: flex-end;
  position: relative;
}
.content-label img {
  width: 100%;
  height: 187px !important;
}
.picture-label {
  width: 100%;
  line-height: 40px;
  background-color: #f2f2f2;
  position: absolute;
  padding: 0 10px;
}
</style>
