<template>
  <div class="templateYuku" id="temp">
    <div class="banner">
      <img :src="imgUrl + pageData.mainProduct.bannerPics[0]" alt="" />
    </div>
    <div class="infoBox">
      <div class="infoCell">
        <div class="title">订单信息</div>
        <div class="name">优酷VIP会员月卡</div>
      </div>
      <div class="infoCell">
        <div class="title">内容</div>
        <div class="name">优酷VIP会员月卡+10GB定向流量</div>
      </div>
      <div class="infoPhone">
        <input type="text" v-model="phone" placeholder="输入联通手机号" />
      </div>
    </div>
    <div class="buyBox" @click="buyClick">立即办理</div>
    <div class="privacyBox">
      <van-checkbox v-model="checked" checked-color="#4276fe">
        <div>
          <p style="margin: 0; padding: 0">我已阅读并同意</p>
        </div>
      </van-checkbox>
      <span class="span" @click="showConceal = true">《隐私声明》</span><span class="span"
        @click="showRule = true">《产品说明》</span>
    </div>
    <div class="explain">
      <div class="explainTitle">
        <span class="spanLeft">一</span>活动规则<span class="spanRight">一</span>
      </div>
      <div class="main" v-html="pageData.mainProduct.givePhoneInfo"></div>
    </div>

    <!-- 隐私条款 -->
    <conceal v-model="showConceal" :pageData="pageData"></conceal>
    <!-- 产品说明 -->
    <rule-modal v-if="showRule" @ruleShow="showRule = false" :pageData="pageData"></rule-modal>
    <!-- 订购成功提示  -->
    <handel-modal v-model="handelShow" @jihuo="jihuoChange"></handel-modal>
    <!-- 退出挽留 -->
    <exit-modal v-model="exitShow" />
    <!-- 会员弹框 -->
    <member-modal v-model="memberShow" />
    <!-- 会员二维码弹框 -->
    <member-code v-model="memberCode" />
  </div>
</template>

<script>
import common from "@/common/common";
import conceal from "../../components/hideModal.vue";
import ruleModal from "../../components/ruleModal002.vue";
import handelModal from "../../componentsNew/handelModal.vue";
export default {
  mixins: [common],
  components: {
    ruleModal,
    conceal,
    handelModal
  },
  data () {
    return {
      imgUrl: process.env.VUE_APP_IMGS_URL,
      phone: "",
      checked: false,
      showConceal: false,
      showRule: false,
      handelShow: false
    };
  },
  created () {
    let mobileStr = location.href.split("?");
    if (mobileStr.length > 1) {
      const res = {};
      const search = mobileStr[1];
      const strs = search.split("&");
      for (let i = 0; i < strs.length; i++) {
        res[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
      }
      if (res.mobile) {
        const Base64 = require("js-base64").Base64;
        this.phone = Base64.decode(res.mobile);
      }
    }
  },
  methods: {
    buyClick () {
      if (this.checked == false) {
        this.$toast("请勾选隐私声明");
      } else {
        this.openIframe();
      }
    },
  },
};
</script>

<style lang="scss">
.templateYuku {
  background-color: #fff;
  min-height: 100vh;

  .iframe {
    position: fixed;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    z-index: 9999;
  }

  .banner {
    width: 100%;
    height: auto;

    // height: 260px;
    img {
      width: 100%;
      height: auto;
    }
  }

  .infoBox {
    width: 670px;
    margin: 0 auto;
    margin-top: -35px;

    .infoCell {
      width: 100%;
      height: 94px;
      display: flex;
      justify-content: space-between;
      border-bottom: 1px solid #d9d9d9;
      font-family: PingFang SC, PingFang SC-Bold;
      font-size: 30px;
      line-height: 130px;

      .title {
        font-weight: 700;
        color: #616161;
        text-align: left;
      }

      .name {
        font-weight: 700;
        text-align: right;
        color: #000;
      }
    }

    .infoPhone {
      width: 100%;
      height: 108px;
      font-size: 40px;
      // line-height: 170px;
      font-weight: 700;
      color: #000000;
      text-align: left;
      border-bottom: 1px solid #d9d9d9;

      input {
        margin: 0;
        padding: 0;
        border: none;
        outline: none;
        width: 100%;
        height: 100%;
        padding-top: 40px;
        box-sizing: border-box;
      }

      input::placeholder {
        color: #000000;
      }
    }
  }

  .buyBox {
    width: 670px;
    height: 100px;
    margin: 0 auto;
    background: #4276fe;
    border-radius: 10px;
    color: #fff;
    text-align: center;
    line-height: 100px;
    font-size: 40px;
    font-weight: 700;
    margin-top: 40px;
  }

  .privacyBox {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    font-size: 20px;

    .van-checkbox {
      text-align: right;
      display: flex;
      justify-content: flex-end;
    }

    p {
      color: #616161;
    }

    .span {
      color: #4276fe;
      margin-top: 4px;
    }
  }

  .van-icon {
    transform: scale(0.75, 0.75);
    border-color: #e4e4e4;
  }

  .van-checkbox__label {
    margin-left: 1px;
  }

  .explain {
    width: 670px;
    margin: 0 auto;

    // margin-top: 20px;
    .explainTitle {
      width: 100%;
      font-weight: 700;
      font-size: 34px;
      text-align: center;
      margin-top: 60px;
      margin-bottom: 28px;

      .spanLeft {
        margin-right: 20px;
      }

      .spanRight {
        margin-left: 20px;
      }
    }

    .main {
      word-break: break-all;
      color: #9b9b9b;

      p {
        font-size: 26px;
        line-height: 40px;
        // margin: 20px 0 0 0;
        margin: 0;
        padding: 0;
      }
    }
  }
}
</style>