<template>
  <modal v-model="show" :closeable="true" cancel-btn="" confirm-btn="好的 继续" @confirm="go">
    <h4 slot="title" class="pay-title">立即拥有<br />{{ title }}</h4>
    <compactCellGroup class="pay-det" :cell-data="payCellData" :text-bold="true" />
    <slot>
      <div class="pay-tip">*不满意可随时退保</div>
      <div class="pay-protocol">
        <div class="pay-protocol-tip">投保前请阅读</div>
        <div class="pay-protocol-link">
          <a href="javascript:;" @click="openIframePupop(0)">保险条款</a>
          <i></i>
          <a href="javascript:;" @click="openIframePupop(1)">健康告知</a>
          <i></i>
          <a href="javascript:;" @click="openIframePupop(2)">投保须知与声明</a>
          <i></i>
          <a href="javascript:;" @click="openIframePupop(3)">服务协议</a>
        </div>
      </div>
    </slot>
  </modal>
</template>

<script>
import CompactCellGroup from "@/components/CompactCellGroup";
import Modal from "@/components/Modal";
const DIALOG_CHANGE_EVENT = "input";
export default {
  name: "GoInsureDialog",
  components: {
    CompactCellGroup,
    Modal
  },
  props: {
    value: null,
    title: {
      type: String,
      default: ""
    },
    payData: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {
      show: false,
      payCellData: [
        { title: "首月保费", value: "3元" },
        {
          title: "次月保费",
          value: "5.6元/月起（共11期）"
        }
      ]
    };
  },
  watch: {
    value(val) {
      this.show = val;
    },
    show(val) {
      this.$emit(DIALOG_CHANGE_EVENT, val);
    }
  },
  methods: {
    openIframePupop(index) {
      this.$parent.openIframePupop(index);
    },
    go() {
      this.$router.push("/goods/inform");
    }
  }
};
</script>

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

.pay {
  &-title {
    color: @black;
    font-size: @font-size-18;
    font-weight: @font-weight-bold;
    line-height: @line-height-lg + 1;
  }
  &-det {
    padding-left: 34px;
    position: relative;
    &::after,
    &::before {
      content: " ";
      display: block;
      position: absolute;
      left: 18px;
      width: 8px;
      height: 8px;
      border-radius: @border-radius-max;
      border: 1px solid @black;
    }
    &::before {
      background-color: @orange-light;
      top: 24px;
    }
    &::after {
      bottom: 26.5px;
    }
    @{deep} & > div:first-child {
      position: absolute;
      left: 22.5px;
      top: 35px;
      height: 14px;
      width: 0;
      border-right: 1px dotted @gray-4;
    }
  }
  &-tip {
    font-size: @font-size-12;
    color: @gray-4;
    line-height: @line-height-lg;
    margin: 12px 0;
  }
  &-protocol {
    margin-bottom: 18px;
    &-tip {
      font-size: @font-size-12;
      color: @gray-4;
      line-height: @line-height-lg;
      margin-bottom: 4px;
    }
    &-link {
      a {
        font-size: @font-size-12;
        vertical-align: middle;
      }
      i {
        display: inline-block;
        width: 0;
        height: 12px;
        border-right: 1px @blue solid;
        vertical-align: middle;
        margin: 0 3px;
      }
    }
  }
}
</style>
