| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <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" :style="'top: -' + 30 * timerIndex + 'px'" :class="{'top': isTop}">
- <count-item :value ="c" :index ="index"></count-item>
- </li>
- </ul>
- </div>
- <div v-for="item in itemCounts">
- <p><span v-html="item.count"></span>
- <span style="color: #333" v-if="item.type === 3">家</span>
- <span style="color: #333" v-if="item.type === 2">条</span>
- </p>
- </div>
- <a class="enter" @click="goStoreApply()">
- <img src="/images/all/enter2.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 ++
- // let title = this.title.shift()
- // let count = this.counts.shift()
- // this.title.push(title)
- // this.counts.push(count)
- // this.timerIndex = 0
- this.isTop = (this.timerIndex === 4)
- if (this.isTop) {
- this.timerIndex = 0
- }
- }, 3000)
- } else {
- clearInterval(this.timer)
- }
- },
- cardClose () {
- this.cardShow = false
- },
- formatNumber (num, type) {
- if (num) {
- 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 += '<span style="color: #333">亿</span>'
- } 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 += '<span style="color: #333">万</span>'
- } else {
- if (type === 1) {
- num += '<span style="color: #333">元</span>'
- } else {
- num += ''
- }
- }
- }
- return num
- },
- formatDouble (num) {
- if (num) {
- if (num.toString().indexOf('E') !== -1) {
- let arr = num.toString().split('E')
- num = arr[0] * Math.pow(10, arr[1])
- }
- if (num > 99999999) {
- num = (num / 100000000).toFixed(2).slice(num.length - 1, 4) + '<span style="color: #333">亿</span>'
- } else if (num > 9999) {
- num = (num / 10000).toFixed(2).slice(num.length - 1, 4) + '<span style="color: #333">万</span>'
- } 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, 1) : 0
- },
- payMoney () {
- return this.allCount[1] ? this.formatNumber(this.allCount[1].count, 1) : 0
- },
- inquirySheet () {
- let sheetNum = this.$store.state.count.inquirySheet.data
- return sheetNum ? this.formatDouble(sheetNum.count) : 0
- },
- inquirySheetLast () {
- let lastSheetNum = this.$store.state.count.inquirySheetLast.data
- return lastSheetNum ? this.formatDouble(lastSheetNum.count) : 0
- },
- all () {
- let count = this.$store.state.supplier.merchant.merchantAll.data
- let supplierCount = count.content ? count.totalElements + '' : 0
- return this.formatNumber(supplierCount, 0)
- },
- itemCounts () {
- let arr = []
- arr.push({count: this.all ? this.all : 0, type: 3}, {count: this.payMoney ? this.payMoney : 0, type: 1}, {count: this.payMoneyLast ? this.payMoneyLast : 0, type: 1}, {count: this.inquirySheet ? this.inquirySheet : 0, type: 2}, {count: this.inquirySheetLast ? this.inquirySheetLast : 0, type: 2})
- return arr
- },
- list () {
- let list = JSON.parse(JSON.stringify(this.$store.state.provider.stores.storeList.data))
- return list
- },
- counts () {
- let arr = []
- let countM = this.$store.state.product.common.counts.data
- if (countM) {
- countM.forEach((value, key, $data) => {
- arr.push(value.count)
- })
- }
- arr.push(this.list.totalElements)
- return arr
- },
- enterprise () {
- return this.user.data.enterprise
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .display-card{
- position: fixed;
- right: 100px;
- top: 100px;
- width: 180px;
- height: 540px;
- z-index: 100;
- .cardClose{
- position: absolute;
- right: 3px;
- top: 1px;
- opacity: 0.8;
- &:hover{
- cursor: pointer;
- }
- }
- .content{
- margin-top: 10px;
- width: 178px;
- height: 536px;
- background: url('/images/all/countBackground2.png') no-repeat;
- div{
- height: 72px;
- width: 158px;
- padding-top: 30px;
- margin-left: 6px;
- &:first-child{
- height: 109px;
- 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: 20px;
- color: #f14e4e;
- }
- }
- .enter{
- width: 100%;
- display: inline-block;
- position: absolute;
- bottom: 35px;
- left: -5px;
- text-align: center;
- }
- }
- }
- </style>
|