MobileFooter.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="mobile-footer">
  3. <span :class="activeType=='home'?'active':''">
  4. <nuxt-link to="/">
  5. <i :class="activeType=='home'?'iconfont icon-shouye':'iconfont icon-shouye1'"></i><p>首页</p>
  6. </nuxt-link>
  7. </span>
  8. <!--<span :class="activeType=='shops'?'active':''">
  9. <nuxt-link to="/mobile/shop">
  10. <i :class="activeType=='shops'?'iconfont icon-dianpu':'iconfont icon-dianpu1'"></i><p>店铺</p>
  11. </nuxt-link>
  12. </span>-->
  13. <span class="seek" @click="goSayPrice">
  14. <a>
  15. <img src="/images/mobile/@2x/applyPurchase/home/seek-footer.png" alt="">
  16. <p>发布求购</p>
  17. </a>
  18. </span>
  19. <span :class="activeType=='user'?'active':''">
  20. <a @click="goCollect">
  21. <i :class="activeType=='user'?'iconfont icon-icon':'iconfont icon-wo'"></i><p>我</p>
  22. </a>
  23. </span>
  24. <a @click="toTop" v-show="!hideToTop"><i class="iconfont icon-arrow-up icon-xlg"></i></a>
  25. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
  26. <publish-seek :showSayPriceBox="showSayPriceBox" @cancelAction="showSayPriceBox = false" @reloadAction="onReload()"></publish-seek>
  27. </div>
  28. </template>
  29. <script>
  30. import { scrollTo } from '~utils/scroll'
  31. import {LoginBox} from '~components/mobile/common'
  32. import PublishSeek from './applyPurchase/PublishSeek.vue'
  33. export default{
  34. name: 'MobileFooter',
  35. data () {
  36. return {
  37. hideToTop: true,
  38. showLoginBox: false,
  39. showSayPriceBox: false
  40. }
  41. },
  42. components: {
  43. LoginBox,
  44. PublishSeek
  45. },
  46. computed: {
  47. activeType () {
  48. return this.$route.path === '/' ? 'home' : this.$route.path === '/mobile/shop' ? 'shops' : this.$route.path === '/mobile/user' ? 'user' : ''
  49. },
  50. user () {
  51. return this.$store.state.option.user
  52. }
  53. },
  54. mounted: function () {
  55. this.$nextTick(function () {
  56. window.addEventListener('scroll', this.onScroll)
  57. })
  58. },
  59. methods: {
  60. onScroll () {
  61. let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
  62. if (scrolled > window.screen.availHeight) {
  63. this.hideToTop = false
  64. } else {
  65. this.hideToTop = true
  66. }
  67. },
  68. toTop () {
  69. scrollTo('body', 300)
  70. },
  71. goCollect: function () {
  72. if (this.user.logged) {
  73. this.$router.push('/mobile/user')
  74. } else {
  75. this.showLoginBox = true
  76. }
  77. },
  78. onReload: function () {
  79. const path = this.$route.path
  80. if (path === '/') {
  81. this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 5, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  82. } else if (path === '/mobile/applyPurchase/list') {
  83. this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  84. } else if (path === '/user') {
  85. this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : this.user.data.userUU})
  86. }
  87. },
  88. goSayPrice: function () {
  89. if (this.user.logged) {
  90. this.showSayPriceBox = true
  91. } else {
  92. this.showLoginBox = true
  93. }
  94. }
  95. }
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. .mobile-footer{
  100. position:fixed;
  101. bottom:0;
  102. width:100%;
  103. height:.98rem;
  104. text-align: center;
  105. border-top:.04rem solid #ccc;
  106. background: #ffffff;
  107. z-index: 10;
  108. }
  109. .mobile-footer > span{
  110. display: inline-block;
  111. width: 2rem;
  112. font-size:.32rem;
  113. color:#b0b0b0;
  114. padding-top:.1rem;
  115. }
  116. .mobile-footer > span a{
  117. color:#b0b0b0;
  118. }
  119. .mobile-footer > span a i{
  120. font-size:.45rem;
  121. }
  122. .mobile-footer > span a p{
  123. font-size:.22rem;
  124. }
  125. .mobile-footer > span.active a{
  126. color:#3976f4;
  127. }
  128. .mobile-footer > a {
  129. position: absolute;
  130. right: .1rem;
  131. top: -1rem;
  132. background: rgba(0,0,0,.4);
  133. color: #fff;
  134. width: .88rem;
  135. height: .88rem;
  136. line-height: .88rem;
  137. border-radius: 100%;
  138. }
  139. .mobile-footer >a i{
  140. font-size: .46rem;
  141. }
  142. .mobile-footer > span.seek {
  143. width: 3.5rem;
  144. position: relative;
  145. }
  146. .mobile-footer > span.seek img {
  147. position: absolute;
  148. width: 1.3rem;
  149. height: 1.3rem;
  150. top: -1.3rem;
  151. right: 1.1rem;
  152. }
  153. </style>