<template>
  <view class="total-page page-env-20 page-box">
    <Nav :back="isReturn!==1" :title="'任务详情'" :genre="2" :fixedHeight="fixedHeight">
      <view class="task-tabs m-b20" :style=" {top:`${$tools.topHeight()}px`}">
        <view class="detail-bg m-lr20 m-b10 m-t10">
          <image class="detail-img" src="/page_task/static/img/task-details/top-bg.png" mode="aspectFill">
          </image>
          <view class="detail-content">
            <view class="row-c m-l10 m-t16 m-b20 text-color-fff">
              <image class="wh-45 r-circle" src="https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/307262/4/9992/255939/684f9a78Fbddd6f3f/e07bf46597371d37.jpg"
                     mode="aspectFill">
              </image>
              <text class="size-28 m-lr16  m-t6">大连市甘井子区宜居园81号2单元1层1号房屋</text>

              <view class="row-c size-24 sys-bg-007038 r-100 p-lr16 p-tb6 m-l20" >
                <text>住宅</text>
              </view>
              <image class="wh-60 animate__animated animate__fadeInDownBig"
                     style="position: absolute;right: 20rpx;"
                     :src="'/page_task/static/img/task-details/icon-1.png'"
                     mode="aspectFill">
              </image>
            </view>
            <view class="row-justify-sb center buttom-titke sys-bg-BFD2CC text-color-12 size-24">
              <text class="size-28  sys-weight-600">72.47万</text>
              <text  ><text class="size-28 text-color-E21 sys-weight-600">65.27万</text>起拍</text>
              <text>7.01%</text>
              <view class="row-c">
                <image class="wh-25 m-r10" src="/page_task/static/img/task-details/usrr.png" mode="">
                </image>
                <text>京东</text>
              </view>
            </view>
          </view>
        </view>
        <TaskTab :current="current" @onChange="onChange"></TaskTab>
      </view>
    </Nav>
    <view class="sys-list-background-color task-tabs-width ">
        <view class="p-20" v-if="current === 1">
          <property :property-list="propertyList"></property>
        </view>
        <view v-else-if="current ===2">
          <graph @setNode="setNode"></graph>
        </view>
        <view v-else-if="current ===3">
          <entities></entities>
        </view>
        <view v-else>
          <word></word>
        </view>


    </view>

    <popupModuleVue ref="popupModuleRef"></popupModuleVue>


  </view>
</template>

<script>
import TaskTab from "@/common/task/task_tab.vue"
// 身份信息
import Identity from "./module/identity.vue"
// 申请信息
import Apply from "./module/apply.vue"
// 第三方信息
import ThirdParty from "./module/third_party.vue"
// 资产信息
import Property from "./module/property.vue"
// 审核进度
import Word from "./module/word.vue"
// 跟进记录
import Record from "./module/record.vue"
import tools from "@/service/tools";

import EnSelect from "@/components/en-utils/en-select/en-select.vue";
import CreditList from "@/page_task/credit/credit.vue";
import Graph from "@/page_task/task_details/module/graph.vue";
import Entities from "@/page_task/task_details/module/entities.vue";
import popupModuleVue from "@/pages/index/module/popup-module.vue";

export default {
  components: {
    popupModuleVue,
    Entities,
    Graph,
    CreditList,
    EnSelect,
    TaskTab,
    Identity,
    ThirdParty,
    Apply,
    Property,
    Record,
    Word
  },
  data() {
    return {
      current: 1,
      fixedHeight: 220,
      options: {
        // autoHeight: true,
        slidesPerView: 1.1,
        centeredSlides: true,
        spaceBetween: 10,
        effect: 'cards'
      },
      list: [1, 2, 3],
      lists: [1, 2],
      businessId: '',
      product: {
        product_name: '',
        product_types: [],
        type_data: []
      },
      business: {
        id: 0,
        status: 0,
        phone: '',
        identity_one: '',
        identity_two: '',
        marriage_img: [],
        credit_img: [],
      }, //基本信息
      propertyList: [], //资产信息
      applyFor: {}, //申请信息
      credit: {}, //征信信息
      postLoan: {}, //贷后信息
      tripartite: [], //第三方信息
      linkman: [], //联系人信息
      stageData: {
        stageName: '',
        userName: ""
      },
      isAjax: false,
      isExecute: 0,
      msgList: [],
      executeData: [],
      showExecute: false,
      auditType: 0,
      previewList: [],
      imgKey: 0,
      imgList: [],
      replyId: "",
      stageList: [],
      businessStageList: [],
      businessFile: {
        fileList: [],
        imgList: [],
        videoList: [],
      },
      videoUrl: '',
      executeId: '',
      clientKey: [],
      propertyKey: [],
      appliesKey: [],
      tripartiteKey: [],
      linkmanKey: [],
      creditKey: [],
      identityHeight: 0,
      thirdPartHeight: 0,
      applyHeight: 0,
      propertyHeight: 0,
      creditListHeight: 0,
      maxHeight: '100%',
      creditHeight: '100%',
      basicType:['1'],
      restType:['2'],
      isReturn:0,
    }
  },
  onLoad(data) {
    // #ifdef H5
      this.fixedHeight=150
    //#endif

  },
  mounted() {
    this.propertyList=[{
      'house_city':'大连市',
      'build_date':'2018',
      'covered_area':'98.75',
      'deed_num':'202000122985',
      'currentPrice':'1165710.00',
      'startPrice':'652798.00',
      'house_address':'宜居园81号2单元1层1号房屋',
      'property':[
          'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/340792/30/21785/86397/68f6f6d7Ff0fdb2ab/d9ad7c8f2cdef1dc.jpg',
          'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/338664/12/22399/52751/68f6f6d7F6fd72b4b/6ed837bd5826b6f7.jpg',
          'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/347815/36/15489/64283/68f6f6d6F385e4cb9/0bdb5d185413939e.jpg',
          'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/247415/33/34929/101756/68f6f6d6F1fcacd2d/ebd5f58bd3299959.jpg',
          'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/338536/26/21976/65848/68f6f6d6F9e69fc0e/9abb292a0b12c485.jpg',
          'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/300340/7/16860/116238/68f6f6d6Fe3e55ad4/628c7839402fde8f.jpg',
          'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/341569/12/14423/82158/68f6f6d5F60b3c33d/0052294617b20ac9.jpg',
          'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/338017/16/22104/211768/68f6f6d5Ff213b5a7/e02c819294a0f54e.jpg',
      ],
    },{
      'house_city':'大连市',
      'build_date':'2015',
      'covered_area':'158.75',
      'currentPrice':'1733994.00',
      'startPrice':'971100.00',
      'deed_num':'201800091904',
      'house_address':'景山东园7号13层2号房屋',
      'property':[
        'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/336828/3/23029/147354/68f88ca1Fea4587dd/df1bf78aafd25a47.jpg',
        'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/333084/1/26093/211684/68f88ca0F4d5d776f/75d941dd88e60852.jpg',
        'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/246517/14/36611/138443/68f88ca0F32cbe247/b6dad4e0cd5b7d6c.jpg',
        'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/329093/21/26448/175950/68f88c9fF28d563a6/b25361a29a36d51d.jpg',
        'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/337862/13/18345/185848/68f88c9eFc9f70bd8/bd0ac6b32e4907da.jpg',
        'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/344813/19/15929/106687/68f88c9eFf8d93ccc/41e7a6521c8100ab.jpg',
        'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/247350/15/32118/248714/68f88c9dFb9c7a4b1/798b50954163dadf.jpg',
        'https://img10.360buyimg.com/imgw/s288x1000_jfs/t1/332110/23/25736/365991/68f88c9cF9d0da101/c5f5f6030115d550.jpg',
      ],
    }]
  },
  methods: {
    setNode(node){
      node.attachmentName=node.name
      this.$refs.popupModuleRef.openPop(node.nodeType,node)
    },
    makingCall(phone){
      tools.makingCall(phone)
    },
    onShowImg(item) {
      console.log(this.businessFile.imgList)
      let imgIndex=this.businessFile.imgList.indexOf(item)
      if (imgIndex < 0) {
        this.businessFile.imgList.push(item)
        imgIndex=this.businessFile.imgList.length-1
      }
      console.log(this.businessFile.imgList)

      // 预览图片
      uni.previewImage({
        current: imgIndex,
        urls: this.businessFile.imgList,
      });
    },
    auditTask(auditType) {

    },
    setPostLoan() {

    },
    editTask() {

    },
    cancellation() {

    },
    endTask() {

    },
    takeTask() {

    },
    closeExecutePopup(){

    },
    setNewExecute(type) {

      this.$refs.executePopup.close('bottom')

    },
    openExecute() {

    },
    setTaskOperate(type) {

    },
    async getTaskDetail() {

    },

    // 获取详情高度Swiper
    getDetailsHeight() {
      this.maxHeight = '100%'
      this.$nextTick(() => {
        const query = uni.createSelectorQuery().in(this);
        setTimeout(() => {
          query.select('.identity').boundingClientRect(data => {
            if (data) {
              this.maxHeight = data.height
              console.log(this.maxHeight);
              uni.pageScrollTo({
                scrollTop: 0,
                duration: 300
              });
            }
          }).exec();
        }, 200)
      })
    },
    // 获取详情高度Swiper
    onSwiper(swiper, index) {
      this.maxHeight = '100%'
      const query = uni.createSelectorQuery().in(this);
      this.$nextTick(() => {
        setTimeout(() => {
          if (index == 0) {
            query.select('.identity').boundingClientRect(data => {
              if (data) {
                this.maxHeight = data.height
              }
            }).exec();
          }
          if (index == 1) {
            query.select('.apply').boundingClientRect(data => {
              if (data) {
                this.maxHeight = data.height
              }
            }).exec();
          }
          if (index == 2) {
            query.select('.third_party').boundingClientRect(data => {
              if (data) {
                this.maxHeight = data.height
              }
            }).exec();
          }
          uni.pageScrollTo({
            scrollTop: 0,
            duration: 300
          });
        }, 200)
      })
    },
    // 征信高度Swiper
    onCreditHeight() {

    },
    // 征信高度Swiper
    onCreditSwiper(swiper, index) {

    },
    onChange(current) {
      if (current == 1) {
        this.getDetailsHeight()
      }
      if (current == 2) {
        this.onCreditHeight()
      }
      this.current = current
      uni.pageScrollTo({
        scrollTop: 0,
        duration: 300
      });
    },
    onSubmit() {

    }
  }
}
</script>

<style lang="scss" scoped>

.swiper-box{
  overflow: hidden;
  .swiper-item{
    transition: .5s ease;
  }
  .swiper-item-box{
    min-height: calc(100vh - 630rpx - 160rpx - env(safe-area-inset-bottom));
  }
}
.details_body {
  width: 100%;
  position: absolute;
}

.detail-bg {
  position: relative;
}

.detail-img {
  width: calc(100%);
  height: 220rpx;
}

.detail-content {
  position: absolute;
  top: 10rpx;
  left: 20rpx;

  .top-titke {
    height: 75rpx;
    line-height: 75rpx;
    // background: red;
  }

  .detail-line {
    width: 2rpx;
    height: 24rpx;
    background-color: #FFFFFF;
  }

  .buttom-titke {
    flex: 1;
    margin-top: 40rpx;
    height: 90rpx;
    width: 635rpx;
    line-height: 90rpx;
    border-radius: 20rpx;
    padding: 0 20rpx;
  }
}

.swiper-wrapper {
  z-index: 0 !important;
}
.video-box {
  height: 70vh;
  width: 100vw;

  .myVideo {
    height: 70vh;
    width: 100vw;
  }
}
</style>
