<template>
  <div>
    <cr-popup v-model="value" get-container="body" @close="onClose" class="intro-popup">
      <div class="intro-popup-container">
        <div class="intro-popup-title">
          <cr-image
            class="Ip-title-image"
            round
            width=""
            height=""
            src="@/assets/images/goods/detail/instruction@2x.png"
          />
        </div>
        <div class="intro-popup-desc">
          提示您即将进入投保流程，为确保流程顺利，请了解以下信息：
        </div>
        <div class="intro-popup-box">
          <div class="Ip-box-item" v-for="(item, index) in items" :key="index">
            <div class="Ipb-item-left">{{ index + 1 }}</div>
            <div class="Ipb-item-right">
              <p class="Ipbi-right-title">
                {{ item.title }}
              </p>
              <p class="Ipbi-right-content">
                {{ item.content
                }}<a v-if="index === 1" href="javascript:;" @click="popupShow = !popupShow"
                  >客户告知书</a
                >
              </p>
            </div>
          </div>
        </div>
        <div class="intro-popup-save">
          <cr-button class="Ip-save-button" @click="close()">确认</cr-button>
        </div>
        <p class="intro-popup-tips">由全天候保险代理股份有限公司提供保险中介服务</p>
      </div>
    </cr-popup>
    <popup-with-iframe v-model="popupShow" title="客户告知书" :url="customerNotificationUrl" />
  </div>
</template>

<script>
import settings from "@/api/settings";
import PopupWithIframe from "@/components/PopupWithIframe";

export default {
  name: "InstructionModal",
  components: {
    PopupWithIframe
  },
  props: {
    value: {
      type: Boolean,
      default: false
    },
    items: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      popupShow: false,
      customerNotificationUrl: settings.customerNotificationUrl
    };
  },
  watch: {},
  methods: {
    close() {
      this.$emit("input", false);
    }
  }
};
</script>

<style lang="less" scoped>
@import "../../../../style/index.less";

.intro-popup {
  box-sizing: border-box;
  padding: 27px 20px;
  width: 300px;
  height: 453px;
  background: linear-gradient(180deg, #ffc842 0%, #ffffff 20%);
  border-radius: 14px;
  &-title {
    display: flex;
    justify-content: center;
    .Ip-title-image {
      width: 156px;
      height: 39px;
    }
  }
  &-desc {
    margin: 15px auto 17px;
    width: 260px;
    height: 48px;
    font-size: 14px;
    font-weight: 400;
    color: #666666;
    line-height: 24px;
  }
  &-box {
    box-sizing: border-box;
    margin: 0 auto;
    padding: 16px;
    width: 260px;
    height: 182px;
    background: #f6f7fa;
    border-radius: 8px;
    .Ip-box-item {
      display: flex;
      align-items: center;
      &:not(:first-child) {
        margin-top: 12px;
      }
      .Ipb-item-left {
        margin-right: 12px;
        width: 19px;
        height: 19px;
        background: #ffc842;
        border-radius: 50%;
        box-shadow: 0px 6px 25px 0px rgba(255, 200, 66, 0.2);
        font-size: 12px;
        font-weight: 600;
        color: #242629;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .Ipb-item-right {
        .Ipbi-right-title {
          width: 88px;
          height: 24px;
          font-size: 14px;
          font-weight: 600;
          color: #333333;
          line-height: 24px;
        }
        .Ipbi-right-content {
          height: 18px;
          font-size: 12px;
          font-weight: 400;
          color: #666666;
          line-height: 18px;
        }
      }
    }
  }
  &-save {
    display: flex;
    justify-content: center;
    margin: 16px;
    .Ip-save-button {
      width: 260px;
      height: 52px;
      background: #ffc842 !important;
      border-radius: 14px !important;
      font-size: 16px;
      font-weight: 600;
      color: #333333;
      line-height: 22px;
    }
  }
  &-tips {
    width: 100%;
    text-align: center;
    height: 13px;
    font-size: 11px;
    font-weight: 400;
    color: #999999;
    line-height: 13px;
  }
}
</style>
