orderInfo.vue 2.71 KB
<template>
  <div class='order-info'>
    <view-sub-title title='订单详情' />
    <div class='business-desc-wrap' v-if='orderList'>
      <div class='business-top flex'>
        <div class='business-border'>
          <div class='business-title'>订单总数</div>
          <div class='business-number'>{{ toThousands(orderList.totalNum) }}</div>
        </div>
        <div class='business-border'>
          <div class='business-title'>今年新增</div>
          <div class='business-number'>{{ toThousands(orderList.thisyear) }}</div>
        </div>
        <div class='business-border'>
          <div class='business-title'>订单总金额</div>
          <div class='business-number'>{{ toThousands(orderList.totalMoney) }}</div>
        </div>
        <div class='business-border' v-if='orderList.activityTimes'>
          <div class='business-title'>活动总数</div>
          <div class='business-number'>{{ toThousands(orderList.activityTimes) }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'OrderInfo',
  data() {
    return {
      orderList: []
    }
  },
  mounted() {
    this.$bus.$off('orderList')
    this.$bus.$on('orderList', data => {
      this.orderList = data.orderList
    })

  },
  methods: {
    toThousands(n) {
      // return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
      return n && n.toString().replace(/\d+/, function(m) {
        return m.replace(/(\d)(?=(\d{3})+$)/g, function(y) {
          return y + ','
        })
      })
    }
  }
}
</script>
d
<style scoped lang='scss'>
.business-desc-wrap {
  padding-top: 1vw;
  //width: 40vw;
  width: 80%;
  .business-top {
    justify-content: space-around;
    //text-align: center;
    .business-border {
      height: 7vh;
      width: 12vw;
      padding: 0.4vh 1.11vw;
      box-sizing: border-box;
      background: #0b0e31;

      .business-title {
        font-weight: 400;
        font-size: 12px;
        color: #e8e8e8;
      }

      .business-number {
        font-weight: 700;
        font-size: 20px;
        line-height: 30px;
        color: #6578ff;
      }

      .business-time {
        font-weight: 700;
        font-size: 20px;
        line-height: 30px;
        color: #6578ff;
      }
    }
  }

  .business-bottom {
    margin-top: 0.5vh;
    height: 6.71vh;
    width: 100%;
    padding: 0.4vh 1.11vw;
    box-sizing: border-box;
    background: #0b0e31;

    .business-border {
      &:first-child {
        width: 12vw;
      }
    }

    .business-title {
      font-weight: 400;
      font-size: 12px;
      color: #e8e8e8;
    }

    .business-number {
      font-weight: 700;
      font-size: 24px;
      line-height: 30px;
      color: #6578ff;
    }

  }
}
</style>