MobileFooter.vue 4.7 KB

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