<template>
  <div class="mask" v-if="visibile">
    <div class="comfirm-container" :style="computedStyle">
      <svg-icon name="info" size="96" />
      <div v-if="countDown" class="count_down">{{ countDown }}</div>
      <div class="msg_container">
        <!-- <div class="msg">{{ msg }}</div>
        <div class="smMsg" v-if="smMsg">{{ smMsg }}</div> -->
        <template v-if="cusMsg">
          <slot name="cusMsg" />
        </template>
        <template v-else>
          <div class="msg">{{ msg }}</div>
          <div class="smMsg" v-if="smMsg">{{ smMsg }}</div>
        </template>
      </div>
      <div class="btns"  v-if="!cusMsg">
        <CommonButton
          v-show="showCancel"
          size="default"
          type="info"
          msg="取消"
          @click="emit('cancel')" />
        <CommonButton size="default" type="danger" msg="确定" @click="emit('confirm')" />
      </div>
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue';
import { getPx } from '@/utils';

const props = defineProps({
  visibile: {
    type: Boolean,
    default: false
  },
  msg: {
    type: String,
    default: ''
  },
  smMsg: {
    type: String,
    default: ''
  },
  showCancel: {
    type: Boolean,
    default: true
  },
  countDown: {
    type: String,
    default: ''
  },
  cusMsg: {
    type: Boolean,
    default: false
  },
  heights: {
    type: Number,
    default: ''
  }
});
let computedStyle = computed(() => {
  return {
    height: getPx(parseInt(props.heights))
  };
});
const emit = defineEmits(['confirm', 'cancel']);
</script>
<style lang="less" scoped>
.mask {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  .comfirm-container {
    width: 680px;
    height: 520px;
    background: #f8f8f8;
    box-shadow: 0px 3px 6px 1px rgba(0, 0, 0, 0.16);
    border-radius: 8px 8px 8px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 36px;
    padding: 36px;
    justify-content: space-between;
    text-align: center;
    .msg {
      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      font-size: 36px;
      color: #3a3a3a;
      line-height: 50px;
      text-align: center;
      font-style: normal;
      text-transform: none;
    }
    .smMsg {
      width: 532px;
      height: 110px;
      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      font-size: 28px;
      color: #808080;
      line-height: 41px;
      text-align: center;
      font-style: normal;
      text-transform: none;
    }
    .msg_container {
      margin-bottom: 15px;
    }
    .btns {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-around;
    }
    .count_down {
      // width: 298px;
      height: 39px;
      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      font-size: 36px;
      color: #3a3a3a;
      line-height: 50px;
      text-align: center;
      font-style: normal;
      text-transform: none;
    }
  }
}
</style>
