<template>
  <div class="get-red" @click="_showRed(1, info.redpacketId)">
    <div class="tip">
      <i class="icon"></i>
      {{ info.userNick }}领取了
      <em>{{ info.redFrom }}</em>
      的
      <em>{{ info.money }}</em>
      元红包
    </div>
  </div>
</template>

<script>
import { mapGetters, mapMutations } from 'vuex';
export default {
  name: 'chat-red-default-tip',
  props: {
    info: {}
  },
  computed: {
    ...mapGetters({
      channelInfo: 'channelInfo',
      userInfo: 'userInfo'
    })
  },
  methods: {
    ...mapMutations({
      set_showRedInfo: 'set_showRedInfo'
    }),
    _showRed(type, id) {
      const obj = {
        type: type,
        id: id
      };
      if (this.userInfo.id) {
        this.set_showRedInfo(obj);
      } else {
        this.$layer.msg('登陆后才能领取红包哦!~');
        this.$Bus.$emit('bus-showLogin', true);
      }
    }
  }
};
</script>

<style lang="less" scoped>
.get-red {
  text-align: center;
  .tip {
    display: inline-block;
    margin: auto;
    max-width: 90%;
    line-height: 0.2rem;
    padding: 0.05rem 0.1rem;
    border-radius: 0.05rem;
    font-size: 0.14rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
    .icon {
      display: inline-block;
      vertical-align: middle;
      width: 0.2rem;
      height: 0.2rem;
      background-image: url('./img/icon-red.png');
      background-repeat: no-repeat;
      background-size: 0.15rem auto;
      background-position: center center;
    }
    em {
      color: #d84e43;
    }
  }
}
</style>
