ViewTitle.vue 3.27 KB
<template>
  <div class="content flex">
    <div class="logo user-select">
      <img style="height: 4vh" src="@/assets/images/logo.svg" alt="logo" />
    </div>
    <div class="view-title flex user-select">XXX集团客户池数据大屏</div>
    <div class="time">
      <div class="top flex">
        <img src="@/assets/images/time.svg" class="icon" />
        <div class="now">{{ now }}</div>
        <div class="yesterday">数据截止至 {{ yesterday }}</div>
      </div>
      <div class="bottom flex">
        <div class="merchant">已同步门店数:{{ merchantNum.totalNum }}</div>
        <div class="merchant">上月新接入店数:{{merchantNum.increLastMonthNum}}</div>
        <div class="merchant">本月新接入店数:{{merchantNum.increThisMonthNum}}</div>
      </div>
    </div>
    <div class="center-control">
      <view-control />
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
export default {
  name: 'ViewTitle',
  data() {
    return {
      yesterday: '',
      now: new Date().format('yyyy-MM-dd hh:mm:ss'),
      merchantNum: {
        totalNum: '--',
        increLastMonthNum: '--',
        increThisMonthNum: '--'
      }
    }
  },
  mounted() {
    this.yesterday = new Date(new Date().setDate(new Date().getDate() - 1)).format('yyyy-MM-dd')
    this.timer()
    this.getMerchantNum()
  },
  methods: {
    timer() {
      setInterval(() => {
        this.now = new Date().format('yyyy-MM-dd hh:mm:ss')
      }, 1e3)
    },
    getMerchantNum() {
      this.api.overview.getMerchantNum({}).then(res => {
        console.log(res)
        if (res.code === '0') {
          this.merchantNum = res.data.dataList[0]
        }
      })
    }
  }
}
</script>

<style scoped lang="scss">
.content {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0 24px;
  position: relative;
  background: #1d1c1c;
  z-index: 9999999999;
  .view-title {
    color: transparent;
    background: linear-gradient(left, #e60115 10%, #eb6001 25%, #f5aa01 50%, #fdf006 100%);
    -webkit-background-clip: text;
    font-size: 18px;
    font-weight: 600;
    &::before {
      content: '';
      display: block;
      background: #373739;
      width: 1px;
      height: 20px;
      margin: 0 8px;
    }
  }
  .time {
    margin-left: auto;
    text-align: right;
    font-size: 14px;
    color: #ffffff;
    .top {
      justify-content: flex-end;
      .yesterday {
        font-size: 10px;
        color: #606266;
        margin-left: 5px;
      }
    }
    .icon {
      width: 16px;
      height: 16px;
      margin-right: 8px;
    }
    .bottom {
      font-size: 10px;
      line-height: 16px;
      color: #fff;
      .merchant {
        color: #eb6001;
        margin-right: 10px;
        padding-right: 10px;
        line-height: 2vh;
        position: relative;
        &::after {
          position: absolute;
          right: 0;
          top: 50%;
          transform: translateY(-50%);
          width: 1px;
          height: 1.5vh;
          content: '';
          background-color: #EB6001;
        }
        &:last-child{
          margin-right: 0;
          &::after {
            width: 0;
          }
        }
      }
    }
  }
  .center-control {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
  }
}
</style>