<template>
  <div class="display-card">
    <span @click="cardClose" v-if="cardShow" class="cardClose"><img src="/images/all/close.png"></span>
     <div class="content" v-if="cardShow">
       <div>
         <count-box></count-box>
       </div>
       <div>
         <p><span v-text="all"></span></p>
       </div>
       <div>
         <p><span v-text="payMoney"></span></p>
       </div>
       <div>
         <p><span v-text="inquirySheet"></span></p>
       </div>
       <a class="enter" @click="onRegisterClick"><img src="/images/all/enter.png"></a>
     </div>
  </div>
</template>
<script>
  import CountBox from '../main/count/Box.vue'
  export default {
    name: 'display-card',
    data () {
      return {
        cardShow: true
      }
    },
    components: {
      CountBox
    },
    methods: {
      cardClose () {
        this.cardShow = false
      },
      onRegisterClick () {
        this.$http.get('/register/page').then(response => {
          if (response.data) {
            window.location.href = response.data.content
          }
        })
      }
    },
    computed: {
      payMoney () {
        let count = this.$store.state.count.payMoney.data
        let supplierCount = count.content ? count.totalElements + '' : '0'
        return supplierCount
      },
      inquirySheet () {
        let count = this.$store.state.count.inquirySheet.data
        let supplierCount = count.content ? count.totalElements + '' : '0'
        return supplierCount
      },
      all () {
        let count = this.$store.state.supplier.merchant.merchantAll.data
        let supplierCount = count.content ? count.totalElements + '' : '0'
        return supplierCount
      }
    }
  }
</script>
<style lang="scss" scoped>
  .display-card{
    position: fixed;
    right: 100px;
    top: 115px;
    width: 144px;
    height: 527px;
    z-index: 100;
    .cardClose{
      position: absolute;
      right: 0px;
      top: 0px;
      opacity: 0.8;
    }
    .content{
      margin-top: 10px;
      width: 143px;
      height: 517px;
      background: url('/images/all/displayCard.png') no-repeat;
      div{
        height: 110px;
        padding-top: 55px;
        &:first-child{
          height: 110px;
          padding-top: 1px;
        }
        p{
          width: 100%;
          text-align: center;
          font-size: 26px;
          color: #fff;
        }
      }
      .enter{
        width: 100%;
        display: inline-block;
        position: absolute;
        bottom: 48px;
        left: -4px;
        text-align: center;
      }
    }
  }
</style>
