<template>
  <cr-popup
    :value="show"
    :style="{ backgroundColor: 'transparent' }"
    :closeable="true"
    get-container="body"
    close-icon="close"
    class="rec"
    @close="onClose"
  >
    <div class="rec-container" v-show="show">
      <div class="rec-title">
        <h4 class="rec-title_h4">0.99</h4>
      </div>
      <div class="rec-advisor">
        <img src="../../../../assets/images/goods/advisor/advisor.png" alt="advisor" />
      </div>
      <div class="rec-reason">
        <div class="rec-reason-item">
          <div class="plan-tip_img">
            <img src="../../../../assets/images/goods/advisor/slogan-01.png" alt="【省钱】" />
          </div>
          <div class="plan-tip_offset">帮您最高<br />节省50%保费</div>
        </div>
        <div class="rec-reason-item">
          <div class="plan-tip_img">
            <img src="../../../../assets/images/goods/advisor/slogan-02.png" alt="【专业】" />
          </div>
          <div class="plan-tip_offset">中立客观的<br />量身定制方案</div>
        </div>
        <div class="rec-reason-item">
          <div class="plan-tip_img">
            <img src="../../../../assets/images/goods/advisor/slogan-03.png" alt="【放心】" />
          </div>
          <div class="plan-tip_offset">帮您解读条款<br />做到有效投保</div>
        </div>
      </div>
      <div @click="go" class="rec-button">0.99元聘请</div>
      <div class="rec-discount">
        限时优惠 <del><span>原价199元</span></del>
      </div>
    </div>
  </cr-popup>
</template>

<script>
const DIALOG_CLOSE_EVENT = "close";

export default {
  name: "AdvisorRecDialog",
  props: {
    value: null
  },
  data() {
    return {
      show: false
    };
  },
  watch: {
    value: {
      immediate: true,
      handler(val) {
        this.show = val;
      }
    }
  },
  methods: {
    onClose() {
      this.$emit(DIALOG_CLOSE_EVENT, 1);
    },
    go() {
      this.$emit(DIALOG_CLOSE_EVENT, 2);
    }
  }
};
</script>

<style lang="less" scoped>
@import "../../../../style/index.less";
.rec {
  overflow: initial;
  @{deep} .cr-popup--close {
    top: -6px;
    right: -10px;
    color: @white;
    font-size: 24px;
    z-index: 99;
  }
  &-container {
    background: url("../../../../assets/images/goods/advisor/bg.png") no-repeat center/100% 100%;
    width: 262px;
    height: 448px;
    padding: 55px 30px 0;
  }
  &-advisor {
    text-align: center;
    margin: 15px 0 20px;
    img {
      width: 190px;
      height: 155px;
    }
  }
  &-title {
    background: url("../../../../assets/images/goods/advisor/title.png") no-repeat center/100% 100%;
    width: 216px;
    height: 58px;
    margin: 0 auto;
    position: relative;
    &_h4 {
      position: absolute;
      display: block;
      bottom: 4px;
      left: 42px;
      font-size: @font-size-18;
      font-weight: @font-weight-bold;
      color: @orange-dark;
    }
  }
  &-reason {
    margin: 10px 0 40px;
    display: flex;
    &-item {
      flex: 1;
      font-size: @font-size-14;
      color: @gray-4;
      line-height: @line-height-lg;
    }
  }
  &-discount {
    font-size: @font-size-12;
    color: @white;
    line-height: @line-height-sm;
    text-align: center;
    del {
      color: #8277ff;
      span {
        color: @orange-dark;
      }
    }
  }
  &-button {
    background: url("../../../../assets/images/goods/advisor/btn.png") no-repeat center/100% 100%;
    width: 255px;
    height: 24px;
    margin: 55px auto 5px;
    text-align: center;
    color: #b94a00;
    font-size: 18px;
    padding: 15px 0 16px;
    -webkit-animation: free_download 0.8s linear alternate infinite;
    animation: free_download 0.8s linear alternate infinite;
  }
}
.plan-tip {
  &_img {
    text-align: center;
    img {
      width: 35px;
      height: 18px;
    }
  }
  &_offset {
    font-size: 11px;
    color: @orange-dark;
    text-align: center;
    line-height: 14px;
    font-weight: 500;
  }
}
</style>
