GoodsPayPropertion.vue 2.35 KB
<template>
  <div class="goods-pay-box">
    <box-title title="订单支付方式占比"></box-title>
    <RightViewContent
      v-if="goodsPayData.length"
      class="content-box"
      :chart="goodsPayChart"
      :listData="goodsPayData"
      :legentList="goodsPayLegend"
      :legendColors="goodsPayChart.colors"
    ></RightViewContent>
    <div v-else class="empty">
      <Empty></Empty>
    </div>
  </div>
</template>

<script>
import { boutiqueMixin } from '@/mixins'
import RightViewContent from '../solar/RightViewContent.vue'
export default {
  name: 'GoodsPayPropertion',
  mixins: [boutiqueMixin],
  components: {
    RightViewContent
  },
  props: {
    merchantid: String,
    year: String
  },
  data() {
    return {
      goodsPayData: [],
      goodsPayChart: {
        id: 'goodsPay',
        keys: ['payType', 'orderNum'],
        height: '15.34vh',
        colors: ['#34AFFF', '#16E193', '#FFC200', '#EB6001'],
        formatter: 'total',
        formatterName: '支付订单',
        formtUnit: '单'
      },
      goodsPayLegend: [
        {
          name: 'payType',
          width: '5vw'
        },
        {
          name: 'rate',
          type: 'decimal',
          width: '3vw'
        },
        {
          name: 'orderNum',
          type: 'number',
          width: '5vw',
          unitIcon: '单'
        }
      ]
    }
  },

  mounted() {},

  methods: {
    init() {
      this.getMerchantPay(this.merchantid, this.year)
    },
    // 获取门店支付方式占比
    async getMerchantPay(merchantid, year) {
      const _data = await this.api.boutique.getMerchantPay({ year, MerchantId: merchantid })
      this.goodsPayData = _data.data.dataList
    },
  }
}
</script>

<style lang="scss" scoped>
.goods-pay-box {
  width: 100%;
  background: #061422;
  box-shadow: inset 0 0 20px 0 #3d57ff69;
  height: 25vh;
  margin-bottom: 1.78vh;
  .content-box {
    padding: 0 1.39vw;
    height: 21.67vh;
  }
  .empty {
    height: 21.67vh;
    display: flex;
    align-items: center;
  }
}
</style>
<style lang="scss">
.goods-pay-box {
  .legend-item {
    &-text {
      min-width: 6vh;
      justify-content: normal;
      &:first-child {
        min-width: 15vh;
      }
      &:last-child .item-content {
        display: inline-block;
        text-align: right;
        width: 10vh !important;
        max-width: 10vh !important;
      }
    }
  }
}
</style>