Home.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <div class="home">
  3. <div class="mobile-modal" v-if="showStoreInfo">
  4. <div class="mobile-modal-box">
  5. <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
  6. <div class="mobile-modal-content">
  7. <div>商家地址:深圳市南山区英唐大厦6楼</div>
  8. <!-- <div class="content-line link-url">在线咨询</div>-->
  9. <div>致电:<a href="tel:0755-96586323" class="content-line link-url">0755-96586323</a></div>
  10. <div>邮件:<a href="mailto:yrsc@usoftchina.com" class="content-line link-url">yrsc@usoftchina.com</a></div>
  11. </div>
  12. </div>
  13. </div>
  14. <div v-if="!showMainSearch">
  15. <div class="home-header" :style="'background:url(' + bgUrl + ')no-repeat center center/100% 6.14rem'">
  16. <div class="home-search">
  17. <!--<ul>-->
  18. <!--<li :class="activeType=='model'?'active':''" @click="activeType='model'"><span>型号</span></li>-->
  19. <!--<li :class="activeType=='brand'?'active':''" @click="activeType='brand'"><span>品牌</span></li>-->
  20. <!--<li :class="activeType=='shops'?'active':''" @click="activeType='shops'"><span>商家</span></li>-->
  21. <!--</ul>-->
  22. <div class="home-input">
  23. <input type="text" placeholder="请输入您要查找的型号或品牌"
  24. @click="onHomeSearchClick()"/>
  25. <i class="iconfont icon-sousuo"></i>
  26. </div>
  27. <!--<p style="color:#e45803;line-height:.4rem;margin-top:.1rem;width:4.2rem;margin-left:1rem;">搜品牌、搜现货 、搜好店 、搜规格书 就上优软商城</p>-->
  28. </div>
  29. </div>
  30. <div class="home-main">
  31. <nuxt-link to="/mobile/shop" class="home-main-content">
  32. <div>
  33. <img src="/images/mobile/@2x/home/shopbrand@2x.png">
  34. </div>
  35. <p>店铺列表</p>
  36. </nuxt-link>
  37. <a @click="goCollect" class="home-main-content">
  38. <div>
  39. <img src="/images/mobile/@2x/home/storebrand@2x.png">
  40. </div>
  41. <p>我的收藏</p>
  42. </a>
  43. <nuxt-link to="/mobile/brand/brandCenter/ABCD" class="home-main-content">
  44. <div>
  45. <!--<i class="icon-pinpai iconfont"></i>-->
  46. <img src="/images/mobile/@2x/home/brand@2x.png" alt="">
  47. </div>
  48. <!--<h2>
  49. {{numbrand[0]}}
  50. </h2>-->
  51. <p>品牌列表</p>
  52. </nuxt-link>
  53. <a @click="showStoreInfo = true" class="home-main-content">
  54. <div>
  55. <img src="/images/mobile/@2x/home/phonebrand@2x.png">
  56. </div>
  57. <p>联系我们</p>
  58. </a>
  59. <!--<a class="home-main-content">
  60. <div>
  61. <i class="icon-xinghao iconfont"></i>
  62. </div>
  63. <h2>
  64. {{numbrand[1]}}
  65. </h2>
  66. <p>型号</p>
  67. </a>
  68. <a class="home-main-content">
  69. <div>
  70. <i class="icon-biaoguigeshuomingshu iconfont"></i>
  71. </div>
  72. <h2>
  73. {{numbrand[2]}}
  74. </h2>
  75. <p>规格书</p>
  76. </a>-->
  77. </div>
  78. </div>
  79. <main-search v-else @cancelSearchAction="onCancelSearch"></main-search>
  80. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
  81. </div>
  82. </template>
  83. <script>
  84. import MainSearch from '~/components/mobile/search/MainSearch.vue'
  85. import {LoginBox} from '~components/mobile/common'
  86. export default {
  87. name: 'home',
  88. data () {
  89. return {
  90. activeType: 'model',
  91. showMainSearch: false,
  92. showStoreInfo: false,
  93. isMore: false,
  94. isShow: false,
  95. len: 0,
  96. bgUrl: '/images/mobile/@2x/home/background@2x.png',
  97. showLoginBox: false
  98. }
  99. },
  100. components: {
  101. MainSearch,
  102. LoginBox
  103. },
  104. methods: {
  105. onHomeSearchClick () {
  106. this.showMainSearch = true
  107. this.$store.dispatch('searchData/getSearchHistory')
  108. },
  109. matNumber (num) {
  110. if (num > 99999999) {
  111. this.isShow = true
  112. let str2 = num.toString()
  113. num = Math.floor(num / 100000000)
  114. if (parseInt(str2.charAt(str2.length - 8)) > 8) {
  115. num = num + 1
  116. }
  117. num += '亿'
  118. }
  119. if (num > 9999) {
  120. this.isMore = true
  121. let str = num.toString()
  122. num = Math.floor(num / 10000)
  123. if (parseInt(str.charAt(str.length - 4)) > 4) {
  124. num = num + 1
  125. }
  126. num += '万'
  127. } else {
  128. num += '个'
  129. }
  130. return num
  131. },
  132. forNum (numbers) {
  133. let num = []
  134. for (let i = 0; i < numbers.length; i++) {
  135. num.push(this.matNumber(numbers[i].count))
  136. }
  137. return num
  138. },
  139. onCancelSearch: function () {
  140. this.showMainSearch = false
  141. },
  142. goCollect: function () {
  143. if (this.user.logged) {
  144. this.$router.push('/mobile/user')
  145. } else {
  146. this.showLoginBox = true
  147. }
  148. }
  149. },
  150. computed: {
  151. numbrand () {
  152. return this.forNum(this.counts)
  153. },
  154. counts () {
  155. return this.$store.state.product.common.counts.data
  156. },
  157. user () {
  158. return this.$store.state.option.user
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. .home{
  165. font-size: .28rem;
  166. background: #f7fbff;
  167. margin-bottom: .96rem;
  168. .home-header{
  169. width:100%;
  170. height:6.12rem;
  171. padding-bottom:1rem;
  172. .home-search{
  173. width:6rem;
  174. line-height: .3rem;
  175. margin:0 auto;
  176. text-align: center;
  177. padding-top: 1.74rem;
  178. ul{
  179. display:inline-flex;
  180. li{
  181. flex:1;
  182. text-align:center;
  183. >span{
  184. display:inline-block;
  185. width:.72rem;
  186. line-height:.33rem;
  187. height:.33rem;
  188. background: #fff;
  189. color:#000;
  190. border-radius: .05rem .05rem 0 0 ;
  191. }
  192. }
  193. li.active span{
  194. background: #3c7cf5;
  195. color:#fff;
  196. cursor:pointer;
  197. }
  198. }
  199. .home-input{
  200. width: 6rem;
  201. height: .61rem;
  202. line-height: .61rem;
  203. input{
  204. width:5.17rem;
  205. display: inline-block;
  206. padding: 0 1rem 0 .16rem;
  207. margin-right:-.83rem;
  208. font-size:.24rem;
  209. border:.04rem solid #3c7cf5;
  210. border-radius:.05rem;
  211. }
  212. i{
  213. display:inline-block;
  214. text-align: center;
  215. width:.83rem;
  216. font-size:.33rem;
  217. border-left:none;
  218. color: #999;
  219. vertical-align: middle;
  220. }
  221. }
  222. }
  223. }
  224. }
  225. .home-main{
  226. width:100%;
  227. text-align: center;
  228. padding-top: .46rem;
  229. height: 6.25rem;
  230. }
  231. .home-main a.home-main-content {
  232. width:50%;
  233. margin-bottom:.52rem;
  234. display: inline-block;
  235. }
  236. .home-main .home-main-content div{
  237. border-radius: .2rem;
  238. width:1.14rem;
  239. height:1.14rem;
  240. margin:0 auto;
  241. }
  242. .home-main .home-main-content div>img{
  243. width: 100%;
  244. height:100%;
  245. }
  246. .home-main .home-main-content div>i {
  247. font-size: .8rem;
  248. }
  249. .home-main .home-main-content:nth-child(3) div>i {
  250. color: #ff3064;
  251. }
  252. /*.home-main .home-main-content:nth-child(5) div>i {
  253. color: #fa6743;
  254. }
  255. .home-main .home-main-content:nth-child(6) div>i {
  256. color: #fcb836;
  257. }*/
  258. .home-main .home-main-content p{
  259. font-size:.28rem;
  260. color:rgb(51,51,51);
  261. line-height: .52rem;
  262. }
  263. .home-main .home-main-content h2{
  264. font-size:.3rem;
  265. color:#ff7800;
  266. line-height: .32rem;
  267. margin:0;
  268. margin-top:.1rem;
  269. }
  270. </style>