|
|
@@ -0,0 +1,262 @@
|
|
|
+<template>
|
|
|
+ <div class="display-card">
|
|
|
+ <span @click="cardClose" v-if="cardShow" class="cardClose"><img src="/images/all/close.png"></span>
|
|
|
+ <div class="content" v-if="cardShow">
|
|
|
+ <div>
|
|
|
+ <ul class="list-unstyled">
|
|
|
+ <li v-for="(item, index) in title" :style="'top: -' + 30 * timerIndex + 'px'" :class="{'top': isTop}">
|
|
|
+ <span>{{item}}</span>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <ul class="list-unstyled">
|
|
|
+ <li v-for="(c, index) in counts.data" :style="'top: -' + 30 * timerIndex + 'px'" :class="{'top': isTop}">
|
|
|
+ <count-item :value ="c.count"></count-item>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <p><span>{{all}}家</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <p v-if="payMoney">
|
|
|
+ <span>{{payMoney}}</span>
|
|
|
+ </p>
|
|
|
+ <p v-else><span>0元</span></p>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <p v-if="payMoneyLast">
|
|
|
+ <span>{{payMoneyLast}}</span>
|
|
|
+ </p>
|
|
|
+ <p v-else><span>0元</span></p>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <p v-if="inquirySheet">
|
|
|
+ <span>{{inquirySheet}}条</span>
|
|
|
+ </p>
|
|
|
+ <p v-else><span>0条</span></p>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <p v-if="inquirySheetLast">
|
|
|
+ <span>{{inquirySheetLast}}条</span>
|
|
|
+ </p>
|
|
|
+ <p v-else><span>0条</span></p>
|
|
|
+ </div>
|
|
|
+ <a class="enter" @click="goStoreApply()">
|
|
|
+ <img src="/images/all/enter.png">
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+ import CountItem from './countItem.vue'
|
|
|
+ export default {
|
|
|
+ name: 'display-card',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ cardShow: true,
|
|
|
+ timerIndex: 0,
|
|
|
+ isTop: false, // 判断是否滚动至顶,
|
|
|
+ timer: {}, // 定时器实体
|
|
|
+ title: [ '品牌', '现货', '规格书' ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ CountItem
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.changeInterval(true)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ changeInterval: function (flag) {
|
|
|
+ if (flag) {
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ this.timerIndex ++
|
|
|
+ this.isTop = (this.timerIndex % 3 === 0)
|
|
|
+ if (this.isTop) {
|
|
|
+ this.timerIndex = 0
|
|
|
+ }
|
|
|
+ }, 3000)
|
|
|
+ } else {
|
|
|
+ clearInterval(this.timer)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cardClose () {
|
|
|
+ this.cardShow = false
|
|
|
+ },
|
|
|
+ formatNumber (num, type) {
|
|
|
+ if (num.toString().indexOf('E') !== -1) {
|
|
|
+ let arr = num.toString().split('E')
|
|
|
+ num = arr[0] * Math.pow(10, arr[1])
|
|
|
+ }
|
|
|
+ if (num > 99999999) {
|
|
|
+ let str2 = num.toString()
|
|
|
+ num = Math.floor(num / 100000000)
|
|
|
+ if (parseInt(str2.charAt(str2.length - 8)) > 8) {
|
|
|
+ num = num + 1
|
|
|
+ }
|
|
|
+ num += '亿'
|
|
|
+ } else if (num > 9999) {
|
|
|
+ let str = num.toString()
|
|
|
+ num = Math.floor(num / 10000)
|
|
|
+ if (parseInt(str.charAt(str.length - 4)) > 4) {
|
|
|
+ num = num + 1
|
|
|
+ }
|
|
|
+ num += '万'
|
|
|
+ } else {
|
|
|
+ if (type === 1 || type === 2) {
|
|
|
+ num += '元'
|
|
|
+ } else {
|
|
|
+ num += ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return num
|
|
|
+ },
|
|
|
+ goStoreApply: function () {
|
|
|
+ if (this.user.logged) {
|
|
|
+ if (this.enterprise && this.enterprise.isVendor === 313) {
|
|
|
+ window.location.href = '/vendor#/index'
|
|
|
+ } else {
|
|
|
+ this.$router.push('/register-saler')
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$router.push('/auth/login')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ allCount () {
|
|
|
+ return this.$store.state.count.allCount.data
|
|
|
+ },
|
|
|
+ payMoneyLast () {
|
|
|
+ return this.allCount[0] ? this.formatNumber(this.allCount[0].count, 2) : 0
|
|
|
+ },
|
|
|
+ payMoney () {
|
|
|
+ return this.allCount[1] ? this.formatNumber(this.allCount[1].count, 1) : 0
|
|
|
+ },
|
|
|
+ inquirySheet () {
|
|
|
+ let sheetNum = this.$store.state.count.inquirySheet.data.count
|
|
|
+ return this.formatNumber(sheetNum, 3)
|
|
|
+ },
|
|
|
+ inquirySheetLast () {
|
|
|
+ let lastSheetNum = this.$store.state.count.inquirySheetLast.data.count
|
|
|
+ return this.formatNumber(lastSheetNum, 4)
|
|
|
+ },
|
|
|
+ all () {
|
|
|
+ let count = this.$store.state.supplier.merchant.merchantAll.data
|
|
|
+ let supplierCount = count.content ? count.totalElements + '' : '0'
|
|
|
+ return this.formatNumber(supplierCount, 0)
|
|
|
+ },
|
|
|
+ counts () {
|
|
|
+ return this.$store.state.product.common.counts
|
|
|
+ },
|
|
|
+ enterprise () {
|
|
|
+ return this.user.data.enterprise
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .display-card{
|
|
|
+ position: fixed;
|
|
|
+ right: 100px;
|
|
|
+ top: 115px;
|
|
|
+ width: 144px;
|
|
|
+ height: 527px;
|
|
|
+ z-index: 100;
|
|
|
+ .cardClose{
|
|
|
+ position: absolute;
|
|
|
+ right: 0px;
|
|
|
+ top: 0px;
|
|
|
+ opacity: 0.8;
|
|
|
+ }
|
|
|
+ .content{
|
|
|
+ margin-top: 10px;
|
|
|
+ width: 143px;
|
|
|
+ height: 517px;
|
|
|
+ background: url('/images/all/displayCard.png') no-repeat;
|
|
|
+ div{
|
|
|
+ height: 66px;
|
|
|
+ width: 136px;
|
|
|
+ padding-top: 30px;
|
|
|
+ &:first-child{
|
|
|
+ height: 96px;
|
|
|
+ padding-top: 1px;
|
|
|
+ ul{
|
|
|
+ &:first-child{
|
|
|
+ max-height: 30px;
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ overflow: hidden;
|
|
|
+ position: relative;
|
|
|
+ top: 16px;
|
|
|
+ li{
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 21px;
|
|
|
+ letter-spacing: 0px;
|
|
|
+ color: #fff000;
|
|
|
+ position: relative;
|
|
|
+ top: 0;
|
|
|
+ transition: top 1s;
|
|
|
+ -moz-transition: top 1s; /* Firefox 4 */
|
|
|
+ -webkit-transition: top 1s; /* Safari and Chrome */
|
|
|
+ -o-transition: top 1s; /* Opera */
|
|
|
+ &.top {
|
|
|
+ transition: top 0s;
|
|
|
+ -moz-transition: top 0s; /* Firefox 4 */
|
|
|
+ -webkit-transition: top 0s; /* Safari and Chrome */
|
|
|
+ -o-transition: top 0s; /* Opera */
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &:last-child{
|
|
|
+ max-height: 30px;
|
|
|
+ width: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+ position: relative;
|
|
|
+ top: 21px;
|
|
|
+ text-align: right;
|
|
|
+ li{
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 21px;
|
|
|
+ color: #fff;
|
|
|
+ position: relative;
|
|
|
+ top: 0;
|
|
|
+ transition: top 1s;
|
|
|
+ -moz-transition: top 1s; /* Firefox 4 */
|
|
|
+ -webkit-transition: top 1s; /* Safari and Chrome */
|
|
|
+ -o-transition: top 1s; /* Opera */
|
|
|
+ &.top {
|
|
|
+ transition: top 0s;
|
|
|
+ -moz-transition: top 0s; /* Firefox 4 */
|
|
|
+ -webkit-transition: top 0s; /* Safari and Chrome */
|
|
|
+ -o-transition: top 0s; /* Opera */
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ p{
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 24px;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .enter{
|
|
|
+ width: 100%;
|
|
|
+ display: inline-block;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 28px;
|
|
|
+ left: -4px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|