<template>
  <card title="投保须知" :option="['查看完整费率表']" footer="协议" @option-click="openIframe(6)">
    <compactCellGroup :cell-data="cellData" />
    <div class="insure-form-pact" slot="footer">
      <cr-checkbox shape="round" icon-size="13px" v-model="pact" checked-color="#FFC842">
        投保前请阅读
      </cr-checkbox>
      <div class="insure-form-pact-link">
        <a href="javascript:;" @click="openIframe(0)">保险条款</a>
        <i></i>
        <a href="javascript:;" @click="openIframe(1)">健康告知</a>
        <i></i>
        <a href="javascript:;" @click="openIframe(2)">投保须知与声明</a>
        <i></i>
        <a href="javascript:;" @click="openIframe(3)">服务协议</a>
      </div>
    </div>
  </card>
</template>

<script>
import Card from "@/components/Card";
import CompactCellGroup from "@/components/CompactCellGroup";
const DATA_CHANGE_EVENT = "input";
const CELL_CLICK_EVENT = "cell-click";
export default {
  name: "ProtocolRead",
  components: {
    CompactCellGroup,
    Card
  },
  props: {
    value: null,
    cellData: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {
      pact: false
    };
  },
  watch: {
    value: {
      immediate: true,
      handler(val) {
        this.pact = val;
      }
    },
    pact: {
      handler(val) {
        this.$emit(DATA_CHANGE_EVENT, val);
      }
    }
  },
  methods: {
    openIframe(idx) {
      this.$emit(CELL_CLICK_EVENT, idx);
    }
  }
};
</script>
<style lang="less" scoped>
@import "../../../../style/var.less";
.insure-form {
  &-pact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    @{deep} .cr-checkbox__label {
      font-size: @font-size-11;
      color: @gray-4;
      margin-left: 5px;
    }
    &-link {
      margin-top: -3.5px;
      display: flex;
      padding-top: 3px;
      align-items: center;
      a {
        font-size: @font-size-11;
      }
      i {
        width: 0;
        height: 12px;
        border-right: 1px @blue solid;
        margin: 0 3px;
      }
    }
  }
}
</style>
