displayCard.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div class="display-card">
  3. <span @click="cardClose" v-if="cardShow" class="cardClose"><img src="/images/all/close.png"></span>
  4. <div class="content" v-if="cardShow">
  5. <div>
  6. <count-box></count-box>
  7. </div>
  8. <div>
  9. <p><span>{{all}}家</span></p>
  10. </div>
  11. <div>
  12. <p v-if="payMoney">
  13. <span>{{payMoney}}</span>
  14. <span v-text="isMore?'万':'元'" v-if="!isShow"></span>
  15. <span v-if="isShow">亿</span>
  16. </p>
  17. <p v-else><span>0元</span></p>
  18. </div>
  19. <div>
  20. <p v-if="inquirySheet.count">
  21. <span>{{inquirySheet.count}}条</span>
  22. </p>
  23. <p v-else><span>0条</span></p>
  24. </div>
  25. <a class="enter" @click="goStoreApply()">
  26. <img src="/images/all/enter.png">
  27. </a>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import CountBox from '../main/count/Box.vue'
  33. export default {
  34. name: 'display-card',
  35. data () {
  36. return {
  37. cardShow: true,
  38. isShow: false,
  39. isMore: false
  40. }
  41. },
  42. components: {
  43. CountBox
  44. },
  45. methods: {
  46. cardClose () {
  47. this.cardShow = false
  48. },
  49. formatNumber (num) {
  50. if (num.toString().indexOf('E') !== -1) {
  51. let arr = num.toString().split('E')
  52. num = arr[0] * Math.pow(10, arr[1])
  53. }
  54. if (num > 99999999) {
  55. this.isShow = true
  56. let str2 = num.toString()
  57. num = Math.floor(num / 100000000)
  58. if (parseInt(str2.charAt(str2.length - 8)) > 8) {
  59. num = num + 1
  60. }
  61. }
  62. if (num > 9999) {
  63. this.isMore = true
  64. let str = num.toString()
  65. num = Math.floor(num / 10000)
  66. if (parseInt(str.charAt(str.length - 4)) > 4) {
  67. num = num + 1
  68. }
  69. }
  70. return num
  71. },
  72. goStoreApply: function () {
  73. if (this.user.logged) {
  74. if (this.enterprise && this.enterprise.isVendor === 313) {
  75. window.location.href = '/vendor#/index'
  76. } else {
  77. this.$router.push('/register-saler')
  78. }
  79. } else {
  80. this.$router.push('/auth/login')
  81. }
  82. }
  83. },
  84. computed: {
  85. allCount () {
  86. return this.$store.state.count.allCount.data
  87. },
  88. payMoney () {
  89. return this.formatNumber(this.allCount[0].count)
  90. },
  91. inquirySheet () {
  92. return this.$store.state.count.inquirySheet.data
  93. },
  94. all () {
  95. let count = this.$store.state.supplier.merchant.merchantAll.data
  96. let supplierCount = count.content ? count.totalElements + '' : '0'
  97. return supplierCount
  98. },
  99. enterprise () {
  100. return this.user.data.enterprise
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .display-card{
  107. position: fixed;
  108. right: 100px;
  109. top: 115px;
  110. width: 144px;
  111. height: 527px;
  112. z-index: 100;
  113. .cardClose{
  114. position: absolute;
  115. right: 0px;
  116. top: 0px;
  117. opacity: 0.8;
  118. }
  119. .content{
  120. margin-top: 10px;
  121. width: 143px;
  122. height: 517px;
  123. background: url('/images/all/displayCard.png') no-repeat;
  124. div{
  125. height: 110px;
  126. padding-top: 55px;
  127. &:first-child{
  128. height: 110px;
  129. padding-top: 1px;
  130. }
  131. p{
  132. width: 100%;
  133. text-align: center;
  134. font-size: 26px;
  135. color: #fff;
  136. }
  137. }
  138. .enter{
  139. width: 100%;
  140. display: inline-block;
  141. position: absolute;
  142. bottom: 48px;
  143. left: -4px;
  144. text-align: center;
  145. }
  146. }
  147. }
  148. </style>