<template>
  <div class="boxxontent">
    <div class="title">
      <div><span>一周充值金额</span></div>
    </div>
    <div class="progress">
      <div class="sunmDevice">
        <Chart :cdata="cdata" v-if="showDom" />
      </div>
    </div>
  </div>
</template>

<script>
  import Chart from './chart.vue'
  import {
    httpGet
  } from "../../../../api";
  import moment from "moment"
  export default {
    data() {
      return {
        showDom:true,
        timer:null,
        cdata: {
          datate:[0,0,0,0,0,0,0],
          seriesData: [0, 0, 0, 0, 0, 0, 0],
        },
      };
    },
    components: {
      Chart,
    },
    created() {
      var today=moment().format("YYYY-MM-DD")
      this.cdata.datate[6]=today
      this.cdata.datate[5]=moment().subtract('days',1).format("YYYY/MM/DD")
      this.cdata.datate[4]=moment().subtract('days',2).format("YYYY/MM/DD")
      this.cdata.datate[3]=moment().subtract('days',3).format("YYYY/MM/DD")
      this.cdata.datate[2]=moment().subtract('days',4).format("YYYY/MM/DD")
      this.cdata.datate[1]=moment().subtract('days',5).format("YYYY/MM/DD")
      this.cdata.datate[0]=moment().subtract('days',6).format("YYYY/MM/DD")
    },
    mounted() {
      var that=this
      this.timer=setInterval(function(){
        that.showDom=false
        that.setShow()
      },10000)
    },
    methods: {
      setShow(){
        this.$nextTick(()=>{
          this.showDom=true
        })
      },
    },
    beforeRouteLeave(to, from, next) {
      clearInterval(this.timer)
      next()
    },
    beforeDestroy() {
      clearInterval(this.timer)
    },
  };
</script>

<style lang="scss" scoped>
  .boxxontent {
    margin: 0 20px;
    box-sizing: border-box;
  }

  .boxxontent .title {
    background: linear-gradient(to right, #042f89, transparent);
    padding: .4vw 1vw;
  }

  .boxxontent .title div {
    background: linear-gradient(to right, #007aff, #01cdf0 20%, #028ae1 80%);
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
    font-size: 1vw;
    line-height: 1vw;
    font-weight: bold;
  }
</style>
