MobileFooter.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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" @remindAction="onRemind"></publish-seek>
  27. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  28. </div>
  29. </template>
  30. <script>
  31. import { scrollTo } from '~utils/scroll'
  32. import {LoginBox, RemindBox} from '~components/mobile/common'
  33. import PublishSeek from './applyPurchase/PublishSeek.vue'
  34. export default{
  35. name: 'MobileFooter',
  36. data () {
  37. return {
  38. hideToTop: true,
  39. showLoginBox: false,
  40. showSayPriceBox: false,
  41. remindText: '',
  42. timeoutCount: 0
  43. }
  44. },
  45. components: {
  46. LoginBox,
  47. PublishSeek,
  48. RemindBox
  49. },
  50. computed: {
  51. activeType () {
  52. return this.$route.path === '/' ? 'home' : this.$route.path === '/mobile/shop' ? 'shops' : this.$route.path === '/mobile/user' ? 'user' : ''
  53. },
  54. user () {
  55. return this.$store.state.option.user
  56. }
  57. },
  58. mounted: function () {
  59. this.$nextTick(function () {
  60. window.addEventListener('scroll', this.onScroll)
  61. })
  62. },
  63. methods: {
  64. onScroll () {
  65. let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
  66. if (scrolled > window.screen.availHeight) {
  67. this.hideToTop = false
  68. } else {
  69. this.hideToTop = true
  70. }
  71. },
  72. toTop () {
  73. scrollTo('body', 300)
  74. },
  75. goCollect: function () {
  76. if (this.user.logged) {
  77. this.$router.push('/mobile/user?type=buyer')
  78. } else {
  79. this.showLoginBox = true
  80. }
  81. },
  82. onReload: function () {
  83. const path = this.$route.path
  84. if (path === '/') {
  85. this.$store.dispatch('applyPurchase/loadMobileHomeList', {pageNumber: 1, pageSize: 5, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  86. } else if (path === '/mobile/applyPurchase/list') {
  87. this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  88. }
  89. },
  90. goSayPrice: function () {
  91. if (this.user.logged) {
  92. this.showSayPriceBox = true
  93. } else {
  94. this.showLoginBox = true
  95. }
  96. },
  97. onRemind: function (str) {
  98. this.remindText = str
  99. this.timeoutCount ++
  100. }
  101. }
  102. }
  103. </script>
  104. <style scoped lang="scss">
  105. .mobile-footer{
  106. position:fixed;
  107. bottom:0;
  108. width:100%;
  109. height:.98rem;
  110. text-align: center;
  111. border-top:.04rem solid #ccc;
  112. background: #ffffff;
  113. z-index: 10;
  114. }
  115. .mobile-footer > span{
  116. display: inline-block;
  117. width: 2rem;
  118. font-size:.32rem;
  119. color:#b0b0b0;
  120. padding-top:.1rem;
  121. }
  122. .mobile-footer > span a{
  123. color:#b0b0b0;
  124. }
  125. .mobile-footer > span a i{
  126. font-size:.45rem;
  127. }
  128. .mobile-footer > span a p{
  129. font-size:.22rem;
  130. }
  131. .mobile-footer > span.active a{
  132. color:#3976f4;
  133. }
  134. .mobile-footer > a {
  135. position: absolute;
  136. right: .1rem;
  137. top: -1rem;
  138. background: rgba(0,0,0,.4);
  139. color: #fff;
  140. width: .88rem;
  141. height: .88rem;
  142. line-height: .88rem;
  143. border-radius: 100%;
  144. }
  145. .mobile-footer >a i{
  146. font-size: .46rem;
  147. }
  148. .mobile-footer > span.seek {
  149. width: 3.5rem;
  150. position: relative;
  151. }
  152. .mobile-footer > span.seek img {
  153. position: absolute;
  154. width: 1.3rem;
  155. height: 1.3rem;
  156. top: -1.3rem;
  157. right: 1.1rem;
  158. }
  159. </style>