HomeOld.vue 8.2 KB

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