ContentLeft.vue 3.47 KB
<!--
 * @Description: 1.0 太阳膜左侧内容
 * @Author: huyue
 * @Date: 2023-07-05 10:35:43
 * @LastEditors: huyue
 * @LastEditTime: 2023-07-26 17:40:58
-->
<template>
  <div class="left">
    <StatisticsBox :list="solarList"></StatisticsBox>
    <PurchaseTrends></PurchaseTrends>
    <div class="left-bottom">
      <MerchantTrends class="bottom-trends"></MerchantTrends>
      <div class="bottom-storage">
        <StorageContent></StorageContent>
      </div>
    </div>
  </div>
</template>
<script type='text/ecmascript-6'>
import PurchaseTrends from './PurchaseTrends.vue'
import MerchantTrends from './MerchantTrends.vue'
import StorageContent from './StorageContent.vue'
import { changeMixin } from '@/mixins'
import { mapActions } from 'vuex'
export default {
  name: 'ContentLeft',
  components: {
    PurchaseTrends,
    MerchantTrends,
    StorageContent
  },
  mixins: [changeMixin],
  data() {
    return {
      solarList: [
        {
          name: '总采购额',
          valueName: 'amounttotal',
          value: '0',
          unit: '¥',
          unitType: 'left',
          bottomLabel: '本月采购额:',
          bottemName: 'amounttotalThismonth',
          bottomValue: '0',
          bottomType: 'money'
        },
        {
          name: '商城采购额',
          valueName: 'amountshop',
          value: '0',
          unit: '¥',
          unitType: 'left',
          bottomLabel: '本月采购额:',
          bottemName: 'amountshopThismonth',
          bottomValue: '0',
          rate: '51%',
          rateName: 'shopRate',
          bottomType: 'money'
        },
        {
          name: '自采采购额',
          valueName: 'amountself',
          value: '0',
          unit: '¥',
          unitType: 'left',
          bottomLabel: '本月采购额:',
          bottemName: 'amountselfThismonth',
          bottomValue: '0',
          rate: '49%',
          rateName: 'selfRate',
          bottomType: 'money'
        },
        {
          name: '开通商户数',
          valueName: 'opentotal',
          value: '0',
          bottomLabel: '本月开通商户数:',
          bottemName: 'openThismonth',
          bottomValue: '0'
        },
        {
          name: '采购商户数',
          valueName: 'buytotal',
          value: '0',
          bottomLabel: '本月采购商户数:',
          bottemName: 'buyThismonth',
          bottomValue: '0'
        }
      ]
    }
  },
  mounted() {
  },
  methods: {
    ...mapActions(['setSolarTime']),
    init() {
      this.getSolarList()
    },
    async getSolarList() {
      const _data = await this.api.solar.getAllPurchase({ year: this.$store.state.app.solarYear })
      const _dataList = _data.data.dataList[0]
      this.$bus.$emit('businessstarttime', _dataList.businessstarttime)
      this.setSolarTime(_dataList.businessstarttime)
      this.solarList.forEach(item => {
        item.value = _dataList[item.valueName]
        item.bottomValue = _dataList[item.bottemName]
        if (item.rateName) item.rate = _dataList[item.rateName]
      })
    }
  }
}
</script>
<style scoped lang='scss'>
.left {
  display: flex;
  flex-direction: column;
  width: 64.17vw;
  overflow: hidden;
  // background: #091C40;
  &-bottom {
    display: flex;
    .bottom-trends {
      width: 43.33vw;
      margin-right: 1.11vw;
    }
    .bottom-storage {
      flex: 1;
    }
  }
}
</style>