<template>
  <div class="pop-up-div" v-if="show" @click="setValue">
    <div
      :style="{
        top: `${top}px`,
        left: `${left}px`,
        ...style,
      }"
      :class="{
        'pop-up': true,
        px500: sizelay == 'min',
        px550: sizelay == 'big',
      }"
      @click.stop="() => {}"
    >
      <div class="pop-up-title">{{ title }}</div>
      <div class="pop-up-body">
        <slot />
        <div class="pop-up-item" v-for="(val, index) in item" :key="index">
          <div
            class="subheading"
            :style="{
              'text-align': textAlign,
            }"
          >
            {{ val.area }}
          </div>
          <div
            class="jinge"
            :style="{
              'text-align': textAlign,
            }"
          >
            {{ val.amount }}
          </div>
          <div
            class="tishi222"
            :style="{
              'text-align': textAlign,
            }"
          >
            {{ val.bills }}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import bus from '@/utils/eventBus.js';
export default {
  props: {
    top: {
      type: Number,
      default: 0,
    },
    left: {
      type: [Number, String],
      default: 0,
    },
    title: {
      type: String,
      default: '',
    },
    show: {
      type: [Boolean],
      default: false,
    },
    item: {
      type: Array,
      default: () => [],
    },
    style: {
      type: Object,
      default: () => ({}),
    },
    textAlign: {
      type: String,
      default: 'right',
    },
    sizelay: {
      type: String,
      default: 'min',
    },
  },
  watch: {
    show() {
      if (this.show) {
        bus.emit('autoplay', false);
      } else {
        bus.emit('autoplay', true);
      }
    },
  },
  methods: {
    setValue() {
      this.$emit('col', false);
    },
  },
};
</script>

<style scoped lang="scss">
.pop-up-div {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  position: fixed;
  z-index: 100000000000000;
}
.px500 {
  width: 500px;
}
.px550 {
  width: 700px;
}
.pop-up {
  display: inline-block;
  background: #185099;
  border: 1px solid #42c1eb;
  border-radius: 10px;
  position: fixed;
  z-index: 1000000000000000;
  box-sizing: border-box;
  padding: 20px;
  .pop-up-title {
    font-size: 18px;
    font-family: Source Han Sans CN, Source Han Sans CN-Medium;
    font-weight: 500;
    text-align: left;
    color: #93b0d8;
    line-height: 25px;
  }
  .pop-up-body {
    width: 100%;
    height: auto;
    display: flex;
    flex-wrap: wrap;
    .pop-up-item {
      width: 25%;
      height: auto;
      box-sizing: border-box;
      padding: 10px 10px;
      .subheading {
        font-size: 18px;
        font-family: Source Han Sans CN, Source Han Sans CN-Medium;
        font-weight: 500;
        color: #93b0d8;
        line-height: 25px;
      }
      .jinge {
        font-size: 18px;
        font-family: Source Han Sans CN, Source Han Sans CN-Medium;
        font-weight: 500;
        color: #ffffff;
        line-height: 25px;
      }
      .tishi222 {
        font-size: 16px;
        font-family: Source Han Sans CN, Source Han Sans CN-Medium;
        font-weight: 500;
        color: #7ae38d;
        line-height: 25px;
      }
    }
  }
}
</style>
