<template>
  <div class="logistics-statistics-container" ref="logisticsStatisticsContainerRef"></div>
</template>

<script>
import echartsMixin from '../mixin/echarts'

export default {
  mixins: [echartsMixin('logisticsStatisticsContainerRef')],

  data() {
    return {
      staticOptions: {
        tooltip: { trigger: 'item' },
        legend: { orient: 'vertical', bottom: 'bottom' },
        series: {
          label: { normal: { position: 'outside', formatter: '{b}({c})' } },
          center: ['50%', '40%'],
          type: 'pie',
          radius: '60%',
          data: []
        }
      }
    }
  },

  methods: {
    update(data = {}) {
      this.instance.setOption({
        series: {
          data: [
            { value: data.totalQuantity, name: '总订单量', itemStyle: { color: '#14C9C9' } },
            { value: data.totalAmount, name: '总订单金额', itemStyle: { color: '#165DFF' } }
          ]
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.logistics-statistics-container {
  height: 370px;
}
</style>
