MobileHeader.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <div>
  3. <div class="mobile-modal" v-if="showStoreInfo || showShare">
  4. <div class="mobile-modal-box" v-if="showStoreInfo">
  5. <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
  6. <div class="mobile-modal-content" v-if="showDefaultAddr">
  7. <div>商家地址:深圳市南山区英唐大厦6楼</div>
  8. <div class="content-line link-url">在线咨询</div>
  9. <div>致电:<span class="content-line link-url">0755-96586323</span></div>
  10. </div>
  11. <div class="mobile-modal-content" v-if="!showDefaultAddr">
  12. <div>商家地址:{{store.enterprise.enAddress || store.enterprise.address}}</div>
  13. <div class="content-line link-url">在线咨询</div>
  14. <div>致电:<span class="content-line link-url">{{store.enterprise.enTel}}</span></div>
  15. </div>
  16. </div>
  17. <div class="mobile-share-box" v-if="showShare">
  18. <div class="share-area">
  19. <ul>
  20. <li class="share-item">
  21. <img src="/images/mobile/@2x/share/weChat@2x.png" alt="">
  22. <span>微信</span>
  23. </li>
  24. <li class="share-item">
  25. <img src="/images/mobile/@2x/share/QQ@2x.png" alt="">
  26. <span>QQ</span>
  27. </li>
  28. <li class="share-item">
  29. <img src="/images/mobile/@2x/share/sina@2x.png" alt="">
  30. <span>微博</span>
  31. </li>
  32. <li class="share-item">
  33. <img src="/images/mobile/@2x/share/message@2x.png" alt="">
  34. <span>短信</span>
  35. </li>
  36. <li class="share-item">
  37. <img src="/images/mobile/@2x/share/email@2x.png" alt="">
  38. <span>邮件</span>
  39. </li>
  40. <li class="share-item">
  41. <img src="/images/mobile/@2x/share/flash@2x.png" alt="">
  42. <span>刷新</span>
  43. </li>
  44. <li class="share-item">
  45. <img src="/images/mobile/@2x/share/copylink@2x.png" alt="">
  46. <span>复制链接</span>
  47. </li>
  48. </ul>
  49. </div>
  50. <div class="cancel-share" @click="showShare=false">取消</div>
  51. </div>
  52. </div>
  53. <div class="mobile-header">
  54. <a class="iconfont icon-fanhui" @click="goLastPage">返回</a>
  55. <p>{{title}}</p>
  56. <i v-show="rightIcon=='share'" class="iconfont icon-fenxiang" @click="showShare = true"></i>
  57. <i v-show="rightIcon=='phone'" class="iconfont icon-dianhua" @click="showLink"></i>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. export default {
  63. data () {
  64. return {
  65. showStoreInfo: false,
  66. showShare: false,
  67. rightIcon: 'share',
  68. showDefaultAddr: true
  69. }
  70. },
  71. computed: {
  72. brandDetail () {
  73. return this.$store.state.brandDetail.detail.data
  74. },
  75. title () {
  76. return this.initHeader(this.$route.path)
  77. },
  78. store () {
  79. return this.$store.state.shop.storeInfo.store.data
  80. }
  81. },
  82. methods: {
  83. goLastPage: function () {
  84. window.history.back(-1)
  85. },
  86. initHeader: function (val) {
  87. let title = '优软商城'
  88. if (val.startsWith('/mobile/brand/')) {
  89. title = this.brandDetail.nameCn
  90. this.rightIcon = 'share'
  91. } else if (val.startsWith('/mobile/shop')) {
  92. title = '店铺列表'
  93. this.rightIcon = 'phone'
  94. } else if (val.startsWith('/mobile/merchantDescription/')) {
  95. title = '商家简介'
  96. this.rightIcon = 'phone'
  97. } else if (val.startsWith('/mobile/user')) {
  98. title = '我的收藏'
  99. this.rightIcon = 'phone'
  100. } else if (val.startsWith('/mobile/search')) {
  101. title = '搜索结果'
  102. this.rightIcon = 'share'
  103. } else {
  104. title = '优软商城'
  105. this.rightIcon = 'phone'
  106. }
  107. return title
  108. },
  109. showLink: function () {
  110. this.showStoreInfo = true
  111. if (this.title === '商家简介') {
  112. this.showDefaultAddr = false
  113. } else {
  114. this.showDefaultAddr = true
  115. }
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. @import '~assets/scss/mobileCommon';
  122. .mobile-header{
  123. width:100%;
  124. position:fixed;
  125. top:0;
  126. z-index:10000;
  127. height:.88rem;
  128. display:flex;
  129. justify-content:space-around;
  130. align-items:center;
  131. border-bottom:.02rem solid #ccc;
  132. background: #3e82f5;
  133. padding:0 .2rem 0 .1rem;
  134. color:#fff;
  135. }
  136. .mobile-header p{
  137. flex:1;
  138. font-size:.36rem;
  139. text-align: center;
  140. margin-top:.2rem;
  141. }
  142. .mobile-header a{
  143. font-size:.28rem;
  144. color:#fff;
  145. }
  146. .mobile-header i{
  147. font-size:.32rem;
  148. }
  149. </style>