<template>
  <div class="q-pa-md businessModel">
    <div class="full-width business-header">
      请选择您的业务模式：
    </div>
    <div class="box-businessModel" :class="{ 'checked-border': msg.type == 1 }" @click="chooseChange(1)">
      <i class="iconfont icon-customer" style="font-size:38px"></i>
      <div>个人客户</div>
      <div class="right" v-if="msg.type == 1">
        <q-icon name="check" class="check-icon" />
      </div>
    </div>
    <div class="box-businessModel" :class="{ 'checked-border': msg.type == 2 }" @click="chooseChange(2)">
      <div>
        <i class="iconfont icon-customer" style="font-size:38px"></i>
        <span class="q-mx-md" style="font-size:28px">+</span>
        <i class="iconfont icon-qiye" style="font-size:38px"></i>
      </div>

      <div>个人客户 + 企业客户</div>
      <div class="right" v-if="msg.type == 2">
        <q-icon name="check" class="check-icon" />
      </div>
    </div>
  </div>
</template>

<script lang="ts">
  import {
    defineComponent,
    reactive,
  } from 'vue'

  export default defineComponent({
    setup() {
      const msg = reactive({
        type: 1
      })
      const chooseChange = (n) => {
        msg.type = n;
      }
      return {
        msg,
        chooseChange
      }
    }
  })
</script>
<style lang="scss" scoped>
  .businessModel {
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    margin: 0 auto;
    width: 700px;
    justify-content: space-between;
    margin-top: 191px;

    .business-header {
      font-size: 16px;
      font-weight: 700;
      margin-bottom: 15px;
    }

    .box-businessModel {
      cursor: pointer;
      width: 311px;
      height: 198px;
      background: #f9f9f9;
      border-radius: 5px;
      display: flex;
      justify-content: center;
      flex-direction: column;
      align-items: center;
      position: relative;

      .right {
        position: absolute;
        right: -20px;
        bottom: -20px;
        display: block;
        width: 0;
        height: 0;
        transform: rotate(45deg);
        border: 20px solid transparent;
        border-left: 20px solid #3470ff;

        .check-icon {
          position: absolute;
          top: -8px;
          left: -19px;
          transform: rotate(-45deg);
          font-size: 14px;
          font-weight: 700;
          color: #fff;
        }
      }
    }
  }

  .checked-border {
    background-color: #edf2fd !important;
    border: 2px solid #3470ff !important;
    color: #3470ff;
  }
</style>