<template>
  <div style="flex: 1;margin-bottom: 10px">
    <Card style="width:100%">
      <div class="config_meta">
        <p class="fl">
          在检任务
        </p>
        <div class="fr">
          <ButtonGroup shape="circle" size="small">
            <Button
              v-for="(item,index) in buttonList"
              :key="index"
              type="primary"
              :class="{buttonActive :activityIndex === index}"
              @click="_buttonChange(index)"
            >
              {{ item }}
            </Button>
          </ButtonGroup>
        </div>
        <div class="clear" />
      </div>
      <div class="config_footer">
        <div>
          <span class="fl">{{ num }}</span>
          <div class="clear" />
        </div>
      </div>
    </Card>
  </div>
</template>

<script>
import Global from '../../../api/config'
export default {
  data() {
    return {
      buttonList: ['本月', '本周', '今天'],
      activityIndex: 2, // 按钮0:本月  1：本周   2：当天
      type: 0,
      num: 0
    }
  },
  mounted() {
    if (Global.getLn()) {
      // this._request();
    }
  },
  methods: {
    // _request() {
    //   //type  请求 0:当天  1：本周   2：本月
    //   this.$store.dispatch('FoodContract/contractCount', {type: this.type}).then(() => {
    //     this.num = this.$store.state.FoodContract.model;
    //   });
    // },
    _buttonChange(index) {
      this.activityIndex = index
      switch (index) {
        case 0:
          this.type = 2
          break
        case 1:
          this.type = 1
          break
        case 2:
          this.type = 0
          break
      }
      // this._request();
    }
  }
}
</script>
