<template>

  <view class="head-background">
    <image mode="widthFix" :src="staticImage.bg" class="img" width="100%"/>
  </view>
  <u-navbar
      :title="title"
      :auto-back="true"
      left-icon-size="40rpx"
      :safe-area-inset-top="true"
      :placeholder="true"
      bgColor="transparent"
  ></u-navbar>
  <view class="body-background row">
    <view class="done-container row">
      <view class="image col-12 row">
        <u-image mode="aspectFill" class="img" :src="staticImage.orderDone" height="250" width="250"></u-image>
      </view>
      <view class="title col-12 row">
        <u-text :text="content" color="#020B18" size="36" mode="name" lineHeight="50" align="center"></u-text>
      </view>
      <view class="desc col-12 row" v-if="(type === 'people')" style="justify-content: center;">
        <view class="" style="text-align: center;max-width:470rpx;">
          <text style="color:#178AF2;font-size:28rpx;line-height:50rpx;">
            {{name}}
          </text>
          <text style="color:#AFB5BE;font-size:28rpx;line-height:50rpx;">
            {{desc}}
          </text>
        </view>
      </view>
      <view class="button col-12 row">

        <view class="button-group">
          <view class="button" style="margin-bottom: 20rpx;">
            <u-button
                @click="navTo('/pages/Index/index')"
                type="primary"
                text="确认"
                shape="circle"
                :custom-style="{
              color:'#020B18',
              backgroundColor:'#FF9545',
              border:'none',
              fontSize:'36',
              fontWeight:'400',
              height:'80rpx',
              width:'360rpx'
            }"
            ></u-button>
          </view>

        </view>
      </view>
    </view>
  </view>
  <!--  <view class="foot-button border-box">-->
  <!--    <u-button-->
  <!--        type="primary"-->
  <!--        text="确认兑换"-->
  <!--        shape="circle"-->
  <!--        :custom-style="{-->
  <!--              color:'#020B18',-->
  <!--              backgroundColor:'#FF9545',-->
  <!--              border:'none',-->
  <!--              fontSize:'36',-->
  <!--              fontWeight:'400',-->
  <!--              height:'80rpx'-->
  <!--            }"-->
  <!--        @click="submit"-->
  <!--    ></u-button>-->
  <!--  </view>-->
</template>

<script>
import api from "@/utils/functions.js";
import {roomDetail} from "@/api/shop";
import {imghost} from "@/config/host";

export default {
  computed: {},
  components: {},
  data() {
    return {
      title: '报名成功',
      content: '',
      desc: '',
      size: {
        height: 0
      },
      detail: {},
      staticImage: {
        bg: imghost + '/BG.png',
        orderDone: imghost + '/order-done.png',

      },
      type: '',
      order_item_id: undefined,
    }
  },
  onLoad(option) {
    this.type = option.type || 'people';
    this.name = option.name || ''
    if (this.type === '') {
      this.order_item_id = option.id;
      this.content = '报名成功！';
      this.desc = '顾问，您已报名该活动 \n 后台将会进行资格审核 \n 请随时关注报名详情页名单是否获选';
    } else {
      this.content = '报名成功！';
      this.desc = '，您已报名该活动 \n 请根据报名时间和地点准时参加 \n 现场进行扫码签到获得积分';
    }
  },
  onReady() {
    let that = this;
    let height = api.wxSystemInfo().system.windowHeight
    let headerHeight = uni.$u.getPx(44) + uni.$u.sys().statusBarHeight

    let info = uni.createSelectorQuery().in(this);
    info.select('.foot-button').boundingClientRect(function (data) {

    }).exec(function (res) {
    });
    info.select('.address-height').boundingClientRect(function (data) {

    }).exec(function (res) {
      let otherHeight = 0;
      res.forEach((item, index) => {
        otherHeight += item.height;
      });
      that.size.height = height - headerHeight - otherHeight - uni.$u.getPx('72rpx');
    });
  },
  methods: {
    navTo(url) {
      uni.reLaunch({
        url: url
      })
    },
    getDetail(id) {
      roomDetail({
        house_id: id
      }).then(res => {
        console.log(res.data)
        this.detail = res.data;
      });
    },
    goHome() {
      wx.reLaunch({
        url: '/pages/Index/index'
      });
    },
    submit() {
    },
  },
  onPageScroll(res) {

  },
  created() {

  },
  mounted() {

  },
}
</script>

<style lang="scss">
@import './components/done.scss';
</style>