MobileFooter.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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="{'active': activeType == 'userCenter'}">
  20. <a @click="goWithLogin('/mobile/center/user')">
  21. <img :src="`/images/mobile/@2x/home/userCenter${activeType === 'userCenter' ? '-active' : ''}.png`" alt="">
  22. <p>买家中心</p>
  23. </a>
  24. </span>
  25. <span :class="{'active': activeType == 'vendorCenter'}">
  26. <a @click="goWithLogin('/mobile/center/vendor', true)">
  27. <img :src="`/images/mobile/@2x/home/vendorCenter${activeType === 'vendorCenter' ? '-active' : ''}.png`" alt="">
  28. <p>卖家中心</p>
  29. </a>
  30. </span>
  31. <span :class="activeType=='user'?'active':''">
  32. <a @click="goWithLogin('/mobile/user')">
  33. <i :class="activeType=='user'?'iconfont icon-icon':'iconfont icon-wo'"></i><p>我</p>
  34. </a>
  35. </span>
  36. <a @click.stop="toTop" v-show="!hideToTop"><i class="iconfont icon-arrow-up icon-xlg"></i></a>
  37. <login-box :url="url" @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
  38. <!--<publish-seek :showSayPriceBox="showSayPriceBox" @cancelAction="showSayPriceBox = false" @reloadAction="onReload" @remindAction="onRemind"></publish-seek>-->
  39. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  40. </div>
  41. </template>
  42. <script>
  43. import { scrollTo } from '~utils/scroll'
  44. import {LoginBox, RemindBox} from '~components/mobile/common'
  45. // import PublishSeek from './applyPurchase/PublishSeek.vue'
  46. export default{
  47. name: 'MobileFooter',
  48. data () {
  49. return {
  50. showLoginBox: false,
  51. // showSayPriceBox: false,
  52. remindText: '',
  53. timeoutCount: 0,
  54. url: '',
  55. hideToTop: true
  56. }
  57. },
  58. components: {
  59. LoginBox,
  60. // PublishSeek,
  61. RemindBox
  62. },
  63. computed: {
  64. InputGetFocus() {
  65. return this.$store.state.mobile.InputGetFocus
  66. },
  67. activeType () {
  68. let path = this.$route.path
  69. let _tp = this. $route.query.type
  70. if (path === '/') {
  71. return 'home'
  72. } else if (path === '/mobile/shop') {
  73. return 'shops'
  74. } else if (this.baseUtils.startWith(path, '/mobile/user')) {
  75. return 'user'
  76. } else if (this.baseUtils.startWith(path, '/mobile/center/user')) {
  77. if (_tp === 'frompage') {
  78. return 'user'
  79. }
  80. return 'userCenter'
  81. } else if (this.baseUtils.startWith(path, '/mobile/order') && _tp === 'buyer') {
  82. return 'userCenter'
  83. } else if (this.baseUtils.startWith(path, '/mobile/order') && _tp !== 'buyer') {
  84. return 'vendorCenter'
  85. } else if (this.baseUtils.startWith(path, '/mobile/center/vendor')) {
  86. if (_tp === 'frompage') {
  87. return 'user'
  88. }
  89. return 'vendorCenter'
  90. } else {
  91. return ''
  92. }
  93. },
  94. user () {
  95. return this.$store.state.option.user
  96. }
  97. },
  98. mounted: function () {
  99. this.$nextTick(function () {
  100. window.addEventListener('scroll', this.onScroll)
  101. })
  102. },
  103. methods: {
  104. onScroll () {
  105. let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
  106. this.hideToTop = scrolled <= window.screen.availHeight
  107. },
  108. toTop () {
  109. scrollTo('body', 300)
  110. },
  111. goWithLogin: function (url, isSelf) { // 是否拦截个人
  112. this.url = url
  113. if (this.user.logged) {
  114. if (isSelf && (!this.user.data.enterprise.uu || this.user.data.enterprise.isVendor !== 313)) {
  115. this.onRemind('请前往账户中心【我】进行开店申请')
  116. // this.onRemind('请前往PC端申请开店')
  117. } else {
  118. this.$router.push(url)
  119. }
  120. } else {
  121. this.showLoginBox = true
  122. }
  123. },
  124. // onReload: function () {
  125. // const path = this.$route.path
  126. // if (path === '/') {
  127. // this.$store.dispatch('applyPurchase/loadMobileHomeList', {pageNumber: 1, pageSize: 5, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  128. // } else if (path === '/mobile/applyPurchase/list') {
  129. // this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  130. // }
  131. // },
  132. goSayPrice: function () {
  133. if (this.user.logged) {
  134. this.showSayPriceBox = true
  135. } else {
  136. this.showLoginBox = true
  137. }
  138. },
  139. onRemind: function (str) {
  140. this.remindText = str
  141. this.timeoutCount ++
  142. }
  143. }
  144. }
  145. </script>
  146. <style scoped lang="scss">
  147. .mobile-footer{
  148. position:fixed;
  149. bottom:0;
  150. width:100%;
  151. height:.98rem;
  152. text-align: center;
  153. border-top:.02rem solid #ccc;
  154. background: #ffffff;
  155. z-index: 10;
  156. &.active{
  157. position: relative;
  158. }
  159. }
  160. .mobile-footer > span{
  161. display: inline-block;
  162. width: 25%;
  163. font-size:.32rem;
  164. color:#666;
  165. padding-top:.1rem;
  166. }
  167. .mobile-footer > span a{
  168. color:#666;
  169. }
  170. .mobile-footer > span a i{
  171. font-size:.45rem;
  172. }
  173. .mobile-footer > span a p{
  174. font-size:.22rem;
  175. }
  176. .mobile-footer > span a img{
  177. width: .46rem;
  178. }
  179. .mobile-footer > span.active a{
  180. color:#3976f4;
  181. }
  182. .mobile-footer > a {
  183. position: absolute;
  184. right: .1rem;
  185. top: -1rem;
  186. background: rgba(0,0,0,.4);
  187. color: #fff;
  188. width: .88rem;
  189. height: .88rem;
  190. line-height: .88rem;
  191. border-radius: 100%;
  192. }
  193. .mobile-footer >a i{
  194. font-size: .46rem;
  195. }
  196. .mobile-footer > span.seek {
  197. width: 3.5rem;
  198. position: relative;
  199. }
  200. .mobile-footer > span.seek img {
  201. position: absolute;
  202. width: 1.3rem;
  203. height: 1.3rem;
  204. top: -1.3rem;
  205. right: 1.1rem;
  206. }
  207. </style>