<template>
  <van-popup
    v-model="value"
    closeable
    :duration="0.1"
    lock-scroll
    @close="closeClick"
  >
    <div class="ruleModal">
      <div class="titles">
        <div class="title active">产品说明</div>
      </div>
      <div class="main" v-html="richText"></div>
    </div>
  </van-popup>
</template>
<script>
import Vue from "vue";
import VanPopup from "vant";
Vue.use(VanPopup);
import addR from "../common/addRecord";
export default {
  props: { pageData: Object },
  data() {
    return {
      value: true,
    };
  },
  computed: {
    richText() {
      return this.pageData.mainProduct.orderingInfo;
    },
  },
  methods: {
    closeClick() {
      this.$emit("ruleShow");
      let ruleTime = new Date().getTime() - localStorage.getItem("startTime");
      localStorage.setItem("ruleTime", ruleTime);
      addR.explainBrowseTime();
      this.$emit("change", false);
      localStorage.removeItem("startTime");
      localStorage.removeItem("ruleTime");
    },
    // ruleClose() {},
  },
};
</script>
<style lang="scss" scoped>
.ruleModal {
  box-sizing: border-box;
  width: 550px;
  padding: 30px 50px 90px 50px; 
  background-color: #fff;
  border-radius: 8px;
  .titles {
    display: flex;
    justify-content: space-around;
    .title {
      font-size: 30px;
      line-height: 30px;
      color: #222222;
      position: relative;
      &::before {
        content: "";
        position: absolute;
        height: 4px;
        background-color: #fdc51b;
        left: 33px;
        right: 33px;
        bottom: -8px;
        opacity: 0;
      }
      &.active {
        font-weight: 600;
        &::before {
          opacity: 1;
        }
      }
    }
  }
  .main {
    height: 571px;
    overflow-y: auto;
    margin-top: 47px;
    font-size: 22px;
    line-height: 36px;
    color: #222222;
    word-wrap: break-word;
    word-break: break-all;
  }
}
.van-popup--center {
  top: 40%;
  left: 50%;
}
</style>
