Jelajahi Sumber

feat: 金额统计完成50%

wangjiacheng 3 tahun lalu
induk
melakukan
41b114912b

+ 1 - 0
.gitignore

@@ -5,6 +5,7 @@ node_modules
 # local env files
 .env.local
 .env.*.local
+.history/
 
 # Log files
 npm-debug.log*

+ 1 - 1
.npmrc

@@ -1,2 +1,2 @@
-registry = http://172.16.0.61:8081/repository/wisdomcity-npm-group/
+registry = http://nexus.wisdomcity.com.cn/repository/wisdomcity-npm-group/
 _auth = YWRtaW46V2lzZG9tY2l0eUBAMjAyMQ==

+ 3 - 0
package.json

@@ -11,14 +11,17 @@
     "test:unit": "vue-cli-service test:unit"
   },
   "dependencies": {
+    "animated-number-vue": "^1.0.0",
     "axios": "^0.19.0",
     "babel-polyfill": "^6.26.0",
     "core-js": "^2.6.5",
+    "digit-roll": "^1.1.8",
     "echarts": "^4.3.0",
     "element-ui": "^2.12.0",
     "reset.css": "^2.0.2",
     "vue": "^2.6.10",
     "vue-count-to": "^1.0.13",
+    "vue-flip-number": "^1.1.1",
     "vue-router": "^3.0.3",
     "vue-seamless-scroll": "^1.1.17",
     "vuex": "^3.0.1"

+ 6 - 3
src/api/index.js

@@ -1,11 +1,14 @@
 /*
  * @Author: mozhuangru
- * @LastEditors: mozhuangru
+ * @LastEditors: wangjiacheng
  * @Description: api
  * @Date: 2019-10-09 09:21:46
- * @LastEditTime: 2019-10-09 09:55:16
+ * @LastEditTime: 2021-10-14 12:04:06
  */
 import api from './api'
+import totalSum from './total-sum'
+
 export {
-  api
+  api,
+  totalSum
 }

+ 18 - 0
src/api/total-sum.js

@@ -0,0 +1,18 @@
+/*
+ * @Author: wangjiacheng
+ * @Date: 2021-10-14 12:01:27
+ * @LastEditors: wangjiacheng
+ * @LastEditTime: 2021-10-14 12:04:54
+ * @Description: 金额统计
+ */
+import axios from '../assets/js/api.request'
+
+export default {
+  getTotalSum (data) {
+    return axios.request({
+      url: '/platform/payRecord/total/sum',
+      params: data,
+      method: 'get'
+    })
+  }
+}

TEMPAT SAMPAH
src/assets/css/Aldrich-Regular.ttf


TEMPAT SAMPAH
src/assets/images/huiguanjia.png


TEMPAT SAMPAH
src/assets/images/total-sum-bg.png


TEMPAT SAMPAH
src/assets/images/wc.png


+ 10 - 0
src/components/flip/index.js

@@ -0,0 +1,10 @@
+/*
+ * @Author: wangjiacheng
+ * @Date: 2021-10-14 16:45:08
+ * @LastEditors: wangjiacheng
+ * @LastEditTime: 2021-10-14 16:45:08
+ * @Description:
+ */
+import Flip from './index.vue'
+
+export default Flip

+ 273 - 0
src/components/flip/index.vue

@@ -0,0 +1,273 @@
+<!--
+ * @Author: wangjiacheng
+ * @Date: 2021-10-14 16:43:09
+ * @LastEditors: wangjiacheng
+ * @LastEditTime: 2021-10-14 17:59:12
+ * @Description:
+-->
+<template>
+    <div class="container flip-clock">
+        <template v-for="data in timeData">
+            <span v-bind:key="data.label" class="flip-clock__piece" :id="data.elementId">
+                <span class="flip-clock__card flip-card">
+                <b class="flip-card__top" :style="{ width: data.current === ',' || data.current === '.' ? 'auto' : '0.7em' }" >{{data.current}}</b>
+                <!-- <b class="flip-card__bottom" v-bind:data-value="data.current"></b> -->
+                <b class="flip-card__back" v-bind:data-value="data.previous"></b>
+                <!-- <b class="flip-card__back-bottom" v-bind:data-value="data.previous "></b> -->
+                </span>
+            </span>
+        </template>
+    </div>
+</template>
+
+<script>
+export default {
+  name: 'flipCountdown',
+  props: {
+    deadline: {
+      type: Number
+    },
+    length: {
+      type: Number
+    }
+  },
+  data () {
+    return {
+      timeData: []
+    }
+  },
+  created () {
+    if (!this.deadline) {
+      throw new Error("Missing props 'deadline'")
+    }
+    this.changeNum()
+  },
+  watch: {
+    deadline (value) {
+      let dataList = this.digitize(this.deadline)
+      console.log('--digitize', dataList)
+      if (this.length < dataList.length) {
+        throw new Error("Props 'deadline' length must be greater than 'length'")
+      }
+      if (dataList.length < this.length) {
+        let length = dataList.length
+        for (let i = 0; i < this.length - length; i++) {
+          dataList.unshift(0)
+        }
+      }
+      this.timeData.forEach((data, index) => {
+        data.elementId = 'flip-card-seconds' + index
+      })
+      dataList.forEach((data, index) => {
+        this.updateTime(index, data)
+      })
+    }
+  },
+  methods: {
+    digitize (n) { // 接受一个number类参数,拆分成一个数组并返回
+      const nn = n.toLocaleString('hanidec')
+      var str = nn + '' // 加上空字符中,把接收的参数转换为字符串
+      console.log('str--', str)
+      var arr = [] // 声明结果空数组,稍后返回
+      str.split('').forEach(function (item) { // 调用split,以空字符串为分隔符切割字符串并返回数组,在数组上调用forEach方法
+        if (!isNaN(parseInt(item))) {
+          arr.push(parseInt(item)) // 对传入的每个字符用pasreInt转换为数字并压入arr数组
+        } else {
+          arr.push(item)
+        }
+      })
+      console.log('arr--', arr)
+      return arr// 返回结果数组
+    },
+    addLength (list) {
+      if (list.length < this.length) {
+        let length = list.length
+        for (let i = 0; i < this.length - length; i++) {
+          let a = {
+            current: 0,
+            previous: 0,
+            elementId: 'flip-card-seconds'
+          }
+          list.unshift(a)
+        }
+      }
+      return list
+    },
+    changeNum () {
+      let List = this.digitize(this.deadline)
+      this.timeData = []
+      List.forEach((data, index) => {
+        let a = {
+          current: data,
+          previous: data,
+          elementId: 'flip-card-seconds' + index
+        }
+        this.timeData.push(a)
+      })
+      this.timeData = this.addLength(this.timeData)
+      this.timeData.forEach((data, index) => {
+        data.elementId = 'flip-card-seconds' + index
+      })
+    },
+    updateTime (idx, newValue) {
+      if (idx >= this.timeData.length || newValue === undefined) {
+        return
+      }
+      if (window['requestAnimationFrame']) {
+        this.frame = requestAnimationFrame(this.updateTime.bind(this))
+      }
+      const d = this.timeData[idx]
+      const val = (newValue < 0 ? 0 : newValue)
+      if (val !== d.current) {
+        d.previous = d.current
+        d.current = val
+        const el = document.querySelector(`#${d.elementId}`)
+        if (el) {
+          el.classList.remove('flip')
+          void el.offsetWidth
+          el.classList.add('flip')
+        }
+      }
+    }
+  },
+  beforeDestroy () {
+    if (window['cancelAnimationFrame']) {
+      cancelAnimationFrame(this.frame)
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.flip-clock {
+  text-align: center;
+  perspective: 600px;
+  margin: 0 auto;
+  *,
+  *:before,
+  *:after { box-sizing: border-box; }
+}
+.flip-clock__piece {
+  display: inline-block;
+  // margin: 0 0.2vw;
+  @media (min-width: 1000px) {
+    // margin: 0 5px;
+  }
+}
+.flip-clock__slot {
+  font-size: 1rem;
+  line-height: 1.5;
+  display: block;
+}
+$halfHeight: 0.73em;
+$borderRadius: 0.15em;
+.flip-card {
+  display: block;
+  position: relative;
+  // padding-bottom: $halfHeight;
+  font-size: 2.25rem;
+  line-height: 0.95;
+}
+@media (min-width: 1000px) {
+  .flip-clock__slot { font-size: 1.2rem; }
+  .flip-card { font-size: 160px; }
+}
+.flip-card__top,
+.flip-card__bottom,
+.flip-card__back-bottom,
+.flip-card__back::before,
+.flip-card__back::after {
+  display: block;
+  height: $halfHeight;
+  color: rgb(255, 181,53);
+  // background: #222;
+  background: #050E21;
+  // padding: 0.23em 0.15em 0.4em;
+  padding: 0;
+  border-radius: $borderRadius $borderRadius 0 0;
+  backface-visibility: hidden;
+  -webkit-backface-visibility: hidden;
+  transform-style: preserve-3d;
+  width: 0.7em;
+  // width: 1em;
+  height: $halfHeight;
+}
+.flip-card__bottom,
+.flip-card__back-bottom {
+  color: rgb(255, 181,53);
+  position: absolute;
+  top: 50%;
+  left: 0;
+  // border-top: solid 1px #000;
+  // background: #393939;
+  background: rgba(5,14,33, .4);
+  border-radius: 0 0 $borderRadius $borderRadius;
+  pointer-events: none;
+  overflow: hidden;
+  z-index: 2;
+}
+.flip-card__back-bottom {
+  z-index: 1;
+}
+.flip-card__bottom::after,
+.flip-card__back-bottom::after {
+  display: block;
+  margin-top: -$halfHeight;
+}
+.flip-card__back::before,
+.flip-card__bottom::after,
+.flip-card__back-bottom::after {
+  content: attr(data-value);
+}
+.flip-card__back {
+  position: absolute;
+  top: 0;
+  height: 100%;
+  left: 0%;
+  pointer-events: none;
+}
+.flip-card__back::before {
+  position: relative;
+  overflow: hidden;
+  z-index: -1;
+}
+.flip .flip-card__back::before {
+  z-index: 1;
+  animation: flipTop 0.3s cubic-bezier(.37,.01,.94,.35);
+  animation-fill-mode: both;
+  transform-origin: center bottom;
+}
+.flip .flip-card__bottom {
+  transform-origin: center top;
+  animation-fill-mode: both;
+  animation: flipBottom 0.6s cubic-bezier(.15,.45,.28,1);
+}
+@keyframes flipTop {
+  0% {
+    transform: rotateX(0deg);
+    z-index: 2;
+  }
+  0%, 99% {
+    opacity: 1;
+  }
+  100% {
+    transform: rotateX(-90deg);
+    opacity: 0;
+  }
+}
+@keyframes flipBottom {
+  0%, 50% {
+    z-index: -1;
+    transform: rotateX(90deg);
+    opacity: 0;
+  }
+  51% {
+    opacity: 1;
+  }
+  100% {
+    opacity: 1;
+    transform: rotateX(0deg);
+    z-index: 5;
+  }
+}
+</style>

+ 2 - 2
src/config/index.js

@@ -1,9 +1,9 @@
 /*
  * @Author: WangQiBiao
- * @LastEditors: MoZhuangRu
+ * @LastEditors: wangjiacheng
  * @Description: 全局参数设置
  * @Date: 2019-03-12 09:40:46
- * @LastEditTime: 2020-07-16 10:40:43
+ * @LastEditTime: 2021-10-14 15:41:11
  */
 const REQUEST_MATCHING_HASH = `/9ad134a361f8d778` // 【9ad134a361f8d778 = 前端服务,用于后端接口匹配】
 

+ 16 - 2
src/main.js

@@ -1,8 +1,8 @@
 /*
  * @Author: WangQiBiao
  * @Date: 2019-09-24 17:50:53
- * @LastEditors: MoZhuangRu
- * @LastEditTime: 2019-12-31 17:18:08
+ * @LastEditors: wangjiacheng
+ * @LastEditTime: 2021-10-14 16:29:44
  * @Description:
  */
 import Vue from 'vue'
@@ -16,6 +16,20 @@ import * as filters from './filters'
 import ElementUI from 'element-ui'
 import 'element-ui/lib/theme-chalk/index.css'
 import '@/assets/css/element-variables.scss'
+import DigitRoll from 'digit-roll'
+Vue.use(DigitRoll)
+// Vue.use(DigitRoll,
+//   {
+//   value: {
+//     type: Number,
+//     default: 0
+//   },
+//   // 持续时间
+//   duration: {
+//     type: Number,
+//     default: 1000
+//   }
+// })
 Vue.use(ElementUI)
 // 引入全局过滤器
 Object.keys(filters).forEach(key => {

+ 11 - 2
src/route/white-list.js

@@ -1,8 +1,8 @@
 /*
  * @Author: WangQiBiao
  * @Date: 2019-09-18 09:40:26
- * @LastEditors: WangQiBiao
- * @LastEditTime: 2019-10-08 16:55:23
+ * @LastEditors: wangjiacheng
+ * @LastEditTime: 2021-10-14 12:00:08
  * @Description: 白名单菜单
  */
 import _import from './_import'
@@ -30,6 +30,15 @@ export default [
       icon: ''
     }
   },
+  {
+    path: '/total-sum',
+    component: _import('total-sum'),
+    meta: {
+      title: '总金额统计',
+      hideInMenu: false,
+      icon: ''
+    }
+  },
   {
     path: '/login',
     component: _import('login'),

+ 132 - 0
src/views/total-sum/index.vue

@@ -0,0 +1,132 @@
+<!--
+ * @Author: wangjiacheng
+ * @Date: 2021-10-14 11:57:19
+ * @LastEditors: wangjiacheng
+ * @LastEditTime: 2021-10-14 22:00:18
+ * @Description:
+-->
+<template>
+  <div class="total-sum">
+    <div class="content">
+      <div class="title">
+        线上缴费累计金额
+      </div>
+      <div class="sum">
+        <!-- <flip :deadline="moneny" :length="monenyLength"></flip> -->
+        <digit-roll
+          v-model="moneny"
+          :duration="1000"
+          :delay="1000"
+        >
+        </digit-roll>
+        <!-- {{moneny}} -->
+      </div>
+    </div>
+    <div class="footer">
+      <img :src="wcLogoUrl" />
+      <el-divider direction="vertical"></el-divider>
+      <img :src="huiguanjiaLogoUrl" />
+    </div>
+  </div>
+</template>
+
+<script>
+// import Flip from '@/components/flip'
+
+// import { totalSum } from '@/api'
+import wcLogo from '@/assets/images/wc.png'
+import huiguanjiaLogo from '@/assets/images/huiguanjia.png'
+
+export default {
+  name: 'TotalSum',
+  components: {
+    // Flip
+  },
+  data () {
+    return {
+      moneny: 99634580.96,
+      monenyLength: 0,
+      timer: null
+    }
+  },
+  computed: {
+    wcLogoUrl () {
+      return wcLogo
+    },
+    huiguanjiaLogoUrl () {
+      return huiguanjiaLogo
+    }
+  },
+  methods: {
+    getTotalSum () {
+      this.timer = setInterval(() => {
+        const n = this.moneny + Math.floor(Math.random() * 100000)
+        this.moneny = n
+        this.monenyLength = `${n.toLocaleString('hanidec')}`.length
+        // totalSum.getTotalSum().then(res => {
+        //   if (res && res.data) {
+        //     const data = Number(res.data.data)
+        //     this.moneny = data
+        //     // if (typeof data === 'number') {
+        //     //   this.moneny = data.toLocaleString('hanidec')
+        //     // }
+        //   }
+        // })
+      }, 3000)
+    }
+  },
+  created () {
+    this.getTotalSum()
+  },
+  beforeDestroy () {
+    clearInterval(this.timer)
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+  @font-face {
+    font-family: AIdrich-Regular;
+    src: url('../../assets/css/Aldrich-Regular.ttf');
+  }
+
+  .total-sum {
+    text-align: center;
+    height: 100%;
+    background: url('../../assets/images/total-sum-bg.png');
+    background-repeat: no-repeat;
+    background-size: cover;
+    .content {
+      display: flex;
+      flex-direction: column;
+      justify-content: center;
+      height: calc(100% - 258px);
+    }
+    .title {
+      font-size: 58px;
+      color: rgb(255, 210, 132) !important;
+      margin-bottom: 50px;
+      font-family: 'Source Han Sans CN';
+    }
+    .sum {
+      font-size: 11.25em;
+      color: rgb(255, 181,53) !important;
+      font-family: 'AIdrich-Regular';
+      -webkit-box-reflect: below 0 linear-gradient(transparent,rgba(255, 255, 255, 0.3));
+    }
+    .footer {
+      position: fixed;
+      bottom: 0;
+      width: 100%;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      background: #bb9148;
+      height: 98px;
+      .el-divider {
+        margin: 0 16px;
+        height: 2em;
+      }
+    }
+  }
+</style>

+ 3 - 3
vue.config.js

@@ -1,9 +1,9 @@
 /*
  * @Author: WangQiBiao
- * @LastEditors: MoZhuangRu
+ * @LastEditors: wangjiacheng
  * @Description: 配置文件
  * @Date: 2019-03-02 14:21:27
- * @LastEditTime: 2020-07-16 10:38:31
+ * @LastEditTime: 2021-10-14 15:41:33
  */
 const path = require('path')
 
@@ -35,7 +35,7 @@ module.exports = {
   devServer: {
     proxy: {
       '/api': {
-        target: 'https://wy-test.huiguanjia.cn/9ad134a361f8d778/', // 对应自己的接口
+        target: 'https://wy.huiguanjia.cn/9ad134a361f8d778/', // 对应自己的接口
         changeOrigin: true,
         ws: false,
         pathRewrite: {

+ 28 - 0
yarn.lock

@@ -1255,6 +1255,19 @@ amdefine@>=0.0.4:
   resolved "https://registry.npm.taobao.org/amdefine/download/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
   integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=
 
+animated-number-vue@^1.0.0:
+  version "1.0.0"
+  resolved "http://nexus.wisdomcity.com.cn/repository/wisdomcity-npm-group/animated-number-vue/-/animated-number-vue-1.0.0.tgz#447ce78fc10c7f2c77df0ca454a1bc18052ebfc8"
+  integrity sha1-RHznj8EMfyx33wykVKG8GAUuv8g=
+  dependencies:
+    animejs "^2.2.0"
+    vue "^2.5.13"
+
+animejs@^2.2.0:
+  version "2.2.0"
+  resolved "http://nexus.wisdomcity.com.cn/repository/wisdomcity-npm-group/animejs/-/animejs-2.2.0.tgz#35eefdfc535b81949c9cb06f0b3e60c02e6fdc80"
+  integrity sha1-Ne79/FNbgZScnLBvCz5gwC5v3IA=
+
 ansi-colors@^3.0.0:
   version "3.2.4"
   resolved "https://registry.npm.taobao.org/ansi-colors/download/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf"
@@ -2872,6 +2885,11 @@ diffie-hellman@^5.0.0:
     miller-rabin "^4.0.0"
     randombytes "^2.0.0"
 
+digit-roll@^1.1.8:
+  version "1.1.8"
+  resolved "http://nexus.wisdomcity.com.cn/repository/wisdomcity-npm-group/digit-roll/-/digit-roll-1.1.8.tgz#2eee26e714a720d9e74062ffcedd9478cd5bc4ed"
+  integrity sha1-Lu4m5xSnINnnQGL/zt2UeM1bxO0=
+
 dir-glob@^2.0.0, dir-glob@^2.2.2:
   version "2.2.2"
   resolved "https://registry.npm.taobao.org/dir-glob/download/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4"
@@ -8618,6 +8636,11 @@ vue-eslint-parser@^5.0.0:
     esquery "^1.0.1"
     lodash "^4.17.11"
 
+vue-flip-number@^1.1.1:
+  version "1.1.1"
+  resolved "http://nexus.wisdomcity.com.cn/repository/wisdomcity-npm-group/vue-flip-number/-/vue-flip-number-1.1.1.tgz#2cf1dd9fe7ac72d614206ec4b1f680a923af6aca"
+  integrity sha1-LPHdn+esctYUIG7EsfaAqSOvaso=
+
 vue-hot-reload-api@^2.3.0:
   version "2.3.4"
   resolved "https://registry.npm.taobao.org/vue-hot-reload-api/download/vue-hot-reload-api-2.3.4.tgz?cache=0&sync_timestamp=1568190386192&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-hot-reload-api%2Fdownload%2Fvue-hot-reload-api-2.3.4.tgz#532955cc1eb208a3d990b3a9f9a70574657e08f2"
@@ -8667,6 +8690,11 @@ vue-template-es2015-compiler@^1.9.0:
   resolved "https://registry.npm.taobao.org/vue-template-es2015-compiler/download/vue-template-es2015-compiler-1.9.1.tgz#1ee3bc9a16ecbf5118be334bb15f9c46f82f5825"
   integrity sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=
 
+vue@^2.5.13:
+  version "2.6.14"
+  resolved "http://nexus.wisdomcity.com.cn/repository/wisdomcity-npm-group/vue/-/vue-2.6.14.tgz#e51aa5250250d569a3fbad3a8a5a687d6036e235"
+  integrity sha1-5RqlJQJQ1Wmj+606ilpofWA24jU=
+
 vue@^2.6.10:
   version "2.6.10"
   resolved "https://registry.npm.taobao.org/vue/download/vue-2.6.10.tgz#a72b1a42a4d82a721ea438d1b6bf55e66195c637"