leftCenter.vue 7.52 KB
<template>
  <div class="live_item acea-row acea-column" style="height:100%">
    <div class="ctit">
      <p class="tit">实况信息</p>
      <div class="line"></div>
    </div>
    <div class="container_center">
      <div class="container_center_all">
        <img src="./imgs/dianpuyoukuang.png" alt="">
        <div class="container_center_all_totla">
          <div class="container_center_all_div">游逛店铺个数</div>
          <div class="container_center_all_right">
            <span style="color:#32C5FF;fontSize:24px">{{dataObj.zone_average_visited?dataObj.zone_average_visited.today:'--'}}<small class="small_title"></small></span>
            <span style="color:#fff;fontSize:12px">昨日:<i :style="{color:dataObj.zone_average_visited&&dataObj.zone_average_visited.yesterdayRatio.toString().includes('-')?'#E02020':'#6DD400'}" class="resset">
                <span v-if="dataObj.zone_average_visited&&dataObj.zone_average_visited.yesterdayRatio.toString().includes('-')">-</span>
                {{dataObj.zone_average_visited?dataObj.zone_average_visited.yesterday:'--'}}
              </i>
            </span>
            <span style="color:#fff;fontSize:12px">上周:<i :style="{color:dataObj.zone_average_visited&&dataObj.zone_average_visited.lastWeekDayRatio.toString().includes('-')?'#E02020':'#6DD400'}" class="resset">
                <span v-if="dataObj.zone_average_visited&&dataObj.zone_average_visited.lastWeekDayRatio.toString().includes('-')">-</span>
                {{dataObj.zone_average_visited?dataObj.zone_average_visited.lastWeekDay:'--'}}
              </i>
            </span>
          </div>
        </div>
      </div>
      <div class="container_center_all">
        <img src="./imgs/yetaiyouguanshengdu.png" alt="">
        <div class="container_center_all_totla">
          <div class="container_center_all_div">游逛业态个数</div>
          <div class="container_center_all_right">
            <span style="color:#FAEC32;fontSize:24px">{{dataObj.format_average_visited?dataObj.format_average_visited.today:'--'}}<small class="small_title"></small></span>
            <span style="color:#fff;fontSize:12px">昨日:<i :style="{color:dataObj.format_average_visited&&dataObj.format_average_visited.yesterdayRatio.toString().includes('-')?'#E02020':'#6DD400'}" class="resset">
                <span v-if="dataObj.format_average_visited&&dataObj.format_average_visited.yesterdayRatio.toString().includes('-')">-</span>
                {{dataObj.format_average_visited?dataObj.format_average_visited.yesterday:'--'}}
              </i>
            </span>
            <span style="color:#fff;fontSize:12px">上周:<i :style="{color:dataObj.format_average_visited&&dataObj.format_average_visited.lastWeekDayRatio.toString().includes('-')?'#E02020':'#6DD400'}" class="resset">
                <span v-if="dataObj.format_average_visited&&dataObj.format_average_visited.lastWeekDayRatio.toString().includes('-')">-</span>
                {{dataObj.format_average_visited?dataObj.format_average_visited.lastWeekDay:'--'}}
              </i>
            </span>
          </div>
        </div>
      </div>
      <div class="container_center_all">
        <img src="./imgs/loucengyouguna.png" alt="">
        <div class="container_center_all_totla">
          <div class="container_center_all_div">游逛楼层层数</div>
          <div class="container_center_all_right">
            <span style="color:#18D2DA;fontSize:24px">{{dataObj.floor_average_visited?dataObj.floor_average_visited.today:'--'}}<small class="small_title"></small></span>
            <span style="color:#fff;fontSize:12px">昨日:<i :style="{color:dataObj.floor_average_visited&&dataObj.floor_average_visited.yesterdayRatio.toString().includes('-')?'#E02020':'#6DD400'}" class="resset">
                <span v-if="dataObj.floor_average_visited&&dataObj.floor_average_visited.yesterdayRatio.toString().includes('-')">-</span>
                {{dataObj.floor_average_visited?dataObj.floor_average_visited.yesterday:'--'}}
              </i>
            </span>
            <span style="color:#fff;fontSize:12px">上周:<i :style="{color:dataObj.floor_average_visited&&dataObj.floor_average_visited.lastWeekDayRatio.toString().includes('-')?'#E02020':'#6DD400'}" class="resset">
                <span v-if="dataObj.floor_average_visited&&dataObj.floor_average_visited.lastWeekDayRatio.toString().includes('-')">-</span>
                {{dataObj.floor_average_visited?dataObj.floor_average_visited.lastWeekDay:'--'}}
              </i></span>
          </div>
        </div>
      </div>
      <div class="container_center_all">
        <img src="./imgs/shebeizaixianqing.png" alt="">
        <div class="container_center_all_totla">
          <div class="container_center_all_div">设备在线情况</div>
          <div class="container_center_all_right">
            <span style="color:#597EF7;fontSize:24px">{{deviceNum.total?deviceNum.total:'--'}}</span>
            <span style="color:#fff;fontSize:12px">在线:<i style="color:#6DD400" class="resset">{{deviceNum.online?deviceNum.online:'--'}}</i></span>
            <span style="color:#fff;fontSize:12px">离线:<i style="color:#E02020" class="resset">{{deviceNum.offline?deviceNum.offline:'--'}}</i></span>
          </div>
        </div>
      </div>
    </div>
    <!-- <div class="live_chart">
      <div class="chart" :id="chartId"></div>
    </div> -->
  </div>
</template>
<script>
export default {
  inject: ["addModule"],
  props: {
    mallId: Number,
  },
  data() {
    return {
      dataObj: {},
      deviceNum: {},
    };
  },
  components: {},
  watch: {
    mallId: {
      handler(newVal) {
        if (newVal) {
          this.loadData();
        }
      },
      immediate: true,
    },
  },
  methods: {
    loadData() {
      let dateStr = dateUnit.dateFormat(new Date(), "yyyy-MM-dd");
      // let params = {
      //   chartIds: 471,
      //   orgType: "mall",
      //   orgIds: this.mallId,
      //   dateType: "day",
      //   startDate: dateStr,
      //   endDate: dateStr,
      // };
      let params = {
        mallId: this.mallId,
        countDate: dateStr,
      };
      this.$api.bigScreen.getLiveInfo(params).then((res) => {
        this.dataObj = res.data.data;
      });
      this.$api.bigScreen
        .getDeviceInfo({
          mallId: this.mallId,
          status: 1,
          page: 1,
          pageSize: 1,
        })
        .then((res) => {
          this.deviceNum = {
            online: res.data.data && res.data.data.online,
            offline: res.data.data && res.data.data.offline,
            total: res.data.data && res.data.data.total,
          };
        });
    },
  },
  created() {
    this.addModule(this);
  },
  mounted() {},
};
</script>

<style lang="less" scoped>
.container_center {
  width: 100%;
  height: calc(100% - 30px);
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  .container_center_all {
    display: flex;
    height: 20%;
    align-items: center;
    justify-content: space-between;
    > img {
      width: 42px;
      height: 36px;
    }
    .container_center_all_totla {
      width: calc(100% - 60px);
      display: flex;
      flex-direction: column;
      .container_center_all_right {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        > span {
          flex: 1;
        }
        .small_title {
          font-size: 18px;
        }
      }
      .container_center_all_div {
        color: #fff;
        font-size: 16px;
      }
    }
  }
}
.resset {
  font-style: normal;
}
</style>