Newer
Older
CloudBrainNew / src / views / socialLive / components / canteen / components / canteenCount.vue
<!--
 * @Description: 食堂、窗口、就餐卡、就餐量统计
 * @Author: 王晓颖
 * @Date: 2020-11-17 16:15:40
 -->
<template>
    <div style="width: 100%;height:100%;padding:0.1rem; padding-bottom:0.01rem;margin-left:-20px;" >
      <div class="block-container">
        <div class="line"><div class="title">食堂数</div><div class="value">{{canteen}}</div></div>
        <div class="line"><div class="title">窗口数</div><div class="value">{{window}}</div></div>
        <div class="line"><div class="title">就餐卡发放</div><div class="value">{{card}}</div></div>
        <div class="line"><div class="title">今日就餐</div><div class="value">{{today}}</div></div>
      </div>
    </div>
</template>

<script>

import {fetchCanteenInfo} from '@/api/ecard'
export default {
  name: 'canteenCount',
  components: {},
  data () {
    return {
      canteen: 0,
      window: 0,
      card: 0,
      today: 0
    }
  },
  created () {
    // this.getData()
    const mockData = this.$globalJsons.globalSocialLive
    this.canteen = mockData.right.canteen.count.canteen
    this.window = mockData.right.canteen.count.window
    this.card = mockData.right.canteen.count.card
    this.today = mockData.right.canteen.count.today
  },
  methods: {
    getData () {
      fetchCanteenInfo('canteen').then(response => {
        if (response.code === 200) {
          this.canteen = response.data.total
        }
      })

      fetchCanteenInfo('window').then(response => {
        if (response.code === 200) {
          this.window = response.data.total
        }
      })

      fetchCanteenInfo('card').then(response => {
        if (response.code === 200) {
          this.card = response.data.total
        }
      })

      fetchCanteenInfo('today').then(response => {
        if (response.code === 200) {
          this.today = response.data.total
        }
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .block-container{
    display: -webkit-flex; /* Safari */
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    .line{
      width: 50%;
      display: -webkit-flex; /* Safari */
      display: flex;
      justify-content: space-between;
      color:white;
      padding-right: 0.07rem;
      line-height: 1.5;
      .title{
        font-size:0.08rem;
      }
      .value {
        font-size:0.09rem;
        font-weight: bold;
      }
    }
  }
</style>