当前位置: 首页 > news >正文

【CSS】数据面板

数据面板

效果

index.vue

<template>
  <div class="container">
    <div class="card">
      <div class="header">
        <div class="title">订单统计</div>
        <div class="detail">
          <el-tabs
            class="mid"
            v-model="currentDate"
            @tab-click="dateGroupChange"
          >
            <el-tab-pane
              v-for="item in Object.keys(dateMap)"
              :key="item"
              :label="dateMap[item]"
              :name="item"
            ></el-tab-pane>
          </el-tabs>
        </div>
      </div>
      <div class="content">
        <div class="list">
          <div class="item">
            <div class="text1">
              充值订单数
              <el-tooltip
                class="tooltip"
                effect="dark"
                content="周期范围内有流向的订单数"
                placement="right"
              >
                <i class="icon-question"></i>
              </el-tooltip>
            </div>
            <p class="text2">
              {{ orderCount }}
            </p>
            <CompareText
              :result="2"
              :unit="''"
              :target="dateMap[currentDate]"
            />
            <p class="unit">单位:个</p>
          </div>
          <div class="item">
            <div class="text1">
              订单流向金额
              <el-tooltip
                class="tooltip"
                effect="dark"
                content="周期范围内有订单流向的消费金额"
                placement="right"
              >
                <i class="icon-question"></i>
              </el-tooltip>
            </div>
            <p class="text2">
              {{ flowCount }}
            </p>
            <CompareText
              :result="0.5"
              :unit="''"
              :target="dateMap[currentDate]"
            />
            <p class="unit">单位:元</p>
          </div>
          <div class="item">
            <div class="text1">
              订单消费金额占比总消费金额
              <el-tooltip
                class="tooltip"
                effect="dark"
                content="周期范围内有订单流向的消费金额在总消费金额的占比"
                placement="right"
              >
                <i class="icon-question"></i>
              </el-tooltip>
            </div>
            <p class="text2">
              {{ proportion + '%'}}
            </p>
            <CompareText
              :result="-20"
              :unit="'%'"
              :target="dateMap[currentDate]"
            />
            <p class="unit">单位:%</p>
          </div>
          <div class="item">
            <div class="title">
              <div class="text1">
                {{userCountTitle[userCountIndex]}}
                <el-tooltip
                  class="tooltip"
                  effect="dark"
                  :content="userType === 'user' ? '订单用户数:周期范围内有订单的用户数' : '订单管理员:周期范围内有订单消费在店中的店家数'"
                  placement="right"
                >
                  <i class="icon-question"></i>
                </el-tooltip>
              </div>
              <div class="selectOption">
                <div :class="userType === 'user' ? 'user active' : 'user'" @click="changeUserType('user')">用户</div>
                <div :class="userType === 'manager' ? 'manager active' : 'manager'" @click="changeUserType('manager')">管理员</div>
              </div>
            </div>
            <p class="text2">
              {{ userCount }}
            </p>
            <CompareText
              :result="1"
              :unit="''"
              :target="dateMap[currentDate]"
            />
            <p class="unit">单位:个</p>
          </div>
        </div>
      </div>
      <div class="footer">
        数据周期:
        {{ startTime }}
        至
        {{ endTime }}
      </div>
    </div>
  </div>
</template>

<style lang="scss" src="./index.scss" scoped></style>
<script src="./index.js"></script>

index.js

// 订单统计-数据面板
import CompareText from '../compareText/index.vue'

const dateMap = {
  week: '近7日',
  halfMonth: '近15日',
  wholeMonth: '近30日'
}

const userCountTitle = {
  0: '订单用户数',
  1: '订单管理员数'
}

export default {
  name: 'panel',
  components: {
    CompareText
  },
  data () {
    return {
      dateMap: dateMap,
      userCountTitle: userCountTitle,
      userCountIndex: 0,
      currentDate: 'week',
      orderCount: 26,
      flowCount: 51.2,
      proportion: 30,
      userCount: 2,
      startTime: '2022-06-07',
      endTime: '2022-06-14',
      userType: 'user'
    }
  },
  computed: {},
  watch: {},
  mounted () {},
  methods: {
    // 切换数据查询时间
    dateGroupChange (target) {
      this.currentDate = target.name
    },
    // 切换用户/管理员
    changeUserType (val) {
      this.userType = val
      if (this.userType === 'manager') {
        this.userCountIndex = 1
      } else {
        this.userCountIndex = 0
      }
    }
  }
}

index.scss

.container {
  margin-bottom: 16px;
}
.tooltip {
  height: 16px;
  width: 16px;
  .icon-question {
    margin-left: 5px;
  }
}
.text1 {
  font-size: 16px;
  color: rgba(17, 17, 0, 0.65);
}
.text2 {
  text-align: center;
  font-family: $DINGfont;
  margin-top: 20px;
  font-size: 48px;
  color: rgba(0, 0, 0, 0.85);
}
.content {
  overflow: hidden;
  .list {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    .item {
      position: relative;
      flex: 1;
      min-width: 118px;
      height: 180px;
      padding: 16px 12px;
      border-radius: 8px;
      border: 0.5px solid #dcdee2;
      .title {
        display: flex;
        justify-content: space-between;
        margin-bottom: -27px;
      }
      &:hover {
        border: 0.5px solid #e8eaec;
        box-shadow: 0px 6px 16px -8px rgba(136, 161, 210, 0.08),
          0px 9px 28px rgba(136, 161, 210, 0.05),
          0px 12px 48px 16px rgba(136, 161, 210, 0.03);
      }
      .unit {
        margin-top: 10px;
        font-size: 14px;
        text-align: right;
        color: rgba(0, 0, 0, 0.55);
      }
    }
    .item + .item {
      margin-left: 15px;
    }
  }
}
.footer {
  color: rgba(0, 0, 0, 0.55);
  display: flex;
  justify-content: right;
}

.selectOption {
  display: flex;
  align-items: center;
  font-size: 12px;
  border: 1px solid #EAEBEE;
  border-radius: 6px;
  width: 120px;
  height: 32px;
  margin-bottom: 16px;
  .user, .manager {
    cursor: pointer;
    border-radius: 6px;
    width: 60px;
    height: 32px;
    text-align: center;
    line-height: 32px;
    color: #606266;
    &:hover {
      font-weight: 400;
    }
  }
  .user {
    margin-left: -1px;
  }
  .manager {
    margin-right: -1px;
  }
  .active {
    color: #ffffff;
    font-weight: 400;
    background-color: rgb(136, 82, 255);
    border-color: rgb(136, 82, 255);
    &:hover {
      background-color: rgba(136, 82, 255, 0.8);
    }
  }
}

compareText/index.vue

<template>
  <p v-if="result > 0" class="text3 marRight10 width150">
    <span class="center">较{{target}}&nbsp;<span class="increase">+{{ result | localeString }}{{unit}}</span><span class="up icon"></span></span>
  </p>
  <p v-else-if="result < 0" class="text3 marRight10 width150">
    <span class="center">较{{target}}&nbsp;<span class="decrease">-{{ (result * -1) | localeString }}{{unit}}</span><span class="down icon"></span></span>
  </p>
  <p v-else class="text3 marRight10 width150">
    <span class="flatText center">较{{target}}持平</span>
  </p>
</template>

<script>
export default {
  props: {
    result: Number,
    target: String,
    unit: String
  }
}
</script>

<style lang='scss' scoped>
.width150{
  width: 100%;
}
.center{
  display: flex;
  align-items: center;
}
.text3{
  display: flex;
  align-items: center;
  justify-content: center;
}
.marRight10{
  margin-right: 10px;
}
.increase{
  color: #00BD8D;
}
.decrease{
  color: #F76560
}
.up{
  background: url('~@/img/inline/icon/up.svg');
}
.down{
  background: url('~@/img/inline/icon/down.svg');
}
.icon{
  display: inline-block;
  width: 10px;
  height: 16px;
  background-size: 100% 100%;
  margin: 0 2px;
}
.flat{
  width: 5px;
  height: 5px;
  background-color: #999999;
}
.flatText{
  color: #999999;
}
</style>

相关文章:

  • 记一次盖茨木马应急响应
  • 兔老大的系统设计(二)定时系统(延时队列)
  • STM32cubeMX详细教学及多个小项目合集(包含RTOS)
  • 车联网白皮书(2021.12)中国信息通信研究院
  • 【中秋征文】使用Python中秋节嫦娥投食小游戏《千里婵娟》
  • OSI网络七层模型和TCP/IP模型
  • 猿创征文|Linux环境Redis部署及最佳实践
  • 猿创征文|C++来时路 _ 重温经典之C++类和对象 | 三大特性之一 - 封装 | 腾讯面试题
  • VueJS面试常见的300道题(英文版)
  • CREO:CREO软件之零件【渲染】之对三维零件实现渲染图文教程之详细攻略
  • Java数据结构之数组的增删改查
  • 函数栈桢原理
  • JSP面试题(重要)
  • 华为FreeBuds pro2大风场景下降噪差原因
  • 网课搜题接口对接教程
  • [NodeJS] 关于Buffer
  • android百种动画侧滑库、步骤视图、TextView效果、社交、搜房、K线图等源码
  • Gradle 5.0 正式版发布
  • IndexedDB
  • JS 面试题总结
  • nfs客户端进程变D,延伸linux的lock
  • vue从创建到完整的饿了么(11)组件的使用(svg图标及watch的简单使用)
  • Vue实战(四)登录/注册页的实现
  • 构建工具 - 收藏集 - 掘金
  • 警报:线上事故之CountDownLatch的威力
  • 七牛云 DV OV EV SSL 证书上线,限时折扣低至 6.75 折!
  • 译米田引理
  • 积累各种好的链接
  • ​DB-Engines 11月数据库排名:PostgreSQL坐稳同期涨幅榜冠军宝座
  • ​插件化DPI在商用WIFI中的价值
  • %3cli%3e连接html页面,html+canvas实现屏幕截取
  • (黑客游戏)HackTheGame1.21 过关攻略
  • (蓝桥杯每日一题)平方末尾及补充(常用的字符串函数功能)
  • (论文阅读30/100)Convolutional Pose Machines
  • (每日持续更新)信息系统项目管理(第四版)(高级项目管理)考试重点整理第3章 信息系统治理(一)
  • (一)python发送HTTP 请求的两种方式(get和post )
  • (一)WLAN定义和基本架构转
  • (转)创业的注意事项
  • .bat批处理(四):路径相关%cd%和%~dp0的区别
  • .dwp和.webpart的区别
  • .NET Framework杂记
  • .net 获取url的方法
  • .Net接口调试与案例
  • .NET轻量级ORM组件Dapper葵花宝典
  • /etc/shadow字段详解
  • @我的前任是个极品 微博分析
  • [ 攻防演练演示篇 ] 利用通达OA 文件上传漏洞上传webshell获取主机权限
  • [AIGC] Redis基础命令集详细介绍
  • [C++]类和对象(中)
  • [Design Pattern] 工厂方法模式
  • [Django开源学习 1]django-vue-admin
  • [go] 迭代器模式
  • [JavaWeb学习] tomcat简介、安装及项目部署
  • [js] 正则表达式
  • [NAND Flash 6.1] 怎么看时序图 | 从时序理解嵌入式 NAND Read 源码实现