_keycode.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div class="search-list">
  3. <div class="search-item" v-if="productList.expose > 0 || productList.brands">
  4. <span :class="activeType=='store'?'active':''" @click="clickType('store')">仅看有货</span>
  5. <span :class="activeType=='support'?'active':''" @click="clickType('support')">店铺自营</span>
  6. </div>
  7. <div class="brand-list-content" v-if="!productList.brands && productList.expose > 0 && brandList && brandList.length > 1">
  8. <div class="brand-list-top">
  9. <span>品牌墙</span>
  10. <span @click="onclick()" v-if="brandList.length > 8">{{!isShow?'收起':'展开'}}<i :class="{'iconfont icon-arrow-down':isShow,'icon-icon-shang iconfont':!isShow}"></i></span>
  11. </div>
  12. <div class="brand-list-item" >
  13. <div v-for="item in isShow?brandList.slice(0, 8):brandList">
  14. <nuxt-link :to="'/mobile/brand/'+item.br_uuid">
  15. <img :src="item.logoUrl ||'/images/component/default.png'"/>
  16. </nuxt-link>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="detail-brand-content" v-if="productList.brands" @click="goBrand(list.uuid)">
  21. <h4>主营产品</h4>
  22. <div class="brand-list">
  23. <div class="list-left">
  24. <img :src="list.logoUrl || '/images/component/default.png'" :alt="list.nameEn"/>
  25. <span>{{list.nameCn}}</span>
  26. </div>
  27. <p>{{list.series}}</p>
  28. </div>
  29. </div>
  30. <div class="detail-brand" v-for="(item, index) in productList.components" v-if="productList.components">
  31. <div class="brand-item" @click="goComponent(item.uuid)">
  32. <p>型号:<span>{{item.code}}</span></p>
  33. <p>品牌:<span>{{item.brand.nameCn}}</span></p>
  34. <p>产品描述:<span>{{item.kind.nameCn}}</span></p>
  35. <i class="iconfont icon-shoucang" :style="(item.isFocus)?'color:#ff7800':'color:#333'" @click="collect(item, $event)"></i>
  36. </div>
  37. </div>
  38. <div class="none-state" v-if="!productList.expose">
  39. <img src="/images/mobile/@2x/sousuokongzhuangtai@2x.png">
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. layout: 'main',
  46. data () {
  47. return {
  48. activeType: 'store',
  49. count: '',
  50. filter: {},
  51. page: '',
  52. sorting: {},
  53. isShow: true,
  54. isMove: '',
  55. isFocus: false,
  56. isClickCollect: false
  57. }
  58. },
  59. fetch ({store, route}) {
  60. return Promise.all([
  61. store.dispatch('searchData/searchForListInMobile', {count: 15, filter: {}, keyword: route.query.w, page: 1, sorting: {'GO_RESERVE': 'DESC', 'GO_SEARCH': 'DESC'}}),
  62. store.dispatch('searchData/searchForBrands', {collectList: 'goods_brand', keyword: route.query.w, paramJSON: {}})
  63. ])
  64. },
  65. computed: {
  66. productList () {
  67. return this.$store.state.searchData.searchList.lists.data
  68. },
  69. brandList () {
  70. return this.$store.state.searchData.searchBrands.brands.data
  71. },
  72. brandDetail () {
  73. return this.$store.state.searchData.searchList.lists.data.brands
  74. },
  75. list () {
  76. let list = this.$store.state.searchData.searchDetail.detail.data
  77. if (list.application && list.application !== '') {
  78. this.applications = list.application.split(',')
  79. }
  80. return list
  81. }
  82. },
  83. methods: {
  84. onclick () {
  85. this.isShow = !this.isShow
  86. },
  87. clickType (type) {
  88. if (type === 'store') {
  89. this.activeType = 'store'
  90. this.$store.dispatch('searchData/searchForList', {count: 15, filter: {}, keyword: this.$route.query.w, page: 1, sorting: {'GO_RESERVE': 'DESC', 'GO_SEARCH': 'DESC'}})
  91. }
  92. if (type === 'support') {
  93. this.activeType = 'support'
  94. this.$store.dispatch('searchData/searchForList', {count: 15, filter: {'goods_store_type': ['ORIGINAL_FACTORY', 'AGENCY', 'DISTRIBUTION']}, keyword: this.$route.query.w, page: 1, sorting: {'GO_RESERVE': 'DESC', 'GO_SEARCH': 'DESC'}})
  95. }
  96. },
  97. goBrand: function (uuid) {
  98. this.$router.push('/mobile/brand/' + uuid)
  99. },
  100. collect: function (item, $event) {
  101. this.isClickCollect = true
  102. if (!item.isFocus) {
  103. this.$http.post('/trade/collection/save', {componentid: item.cmpId, kind: 2})
  104. .then(response => {
  105. item.isFocus = true
  106. })
  107. } else {
  108. this.$http.delete('/trade/collection/' + item.cmpId).then(response => {
  109. item.isFocus = false
  110. })
  111. }
  112. },
  113. goComponent: function (uuid) {
  114. if (!this.isClickCollect) {
  115. this.$router.push('/mobile/brand/componentDetail/' + uuid)
  116. } else {
  117. this.isClickCollect = false
  118. }
  119. }
  120. }
  121. }
  122. </script>
  123. <style scoped lang="scss">
  124. .search-list{
  125. width:100%;
  126. margin-bottom: .98rem;
  127. .none-state{
  128. text-align: center;
  129. margin-top:2rem;
  130. width:100%;
  131. img{
  132. margin:0 auto;
  133. width:3rem;
  134. hight:3rem;
  135. }
  136. }
  137. .search-item{
  138. justify-content: space-around;
  139. text-align: center;
  140. display:flex;
  141. span{
  142. display:inline-block;
  143. width:1.41rem;
  144. line-height: .76rem;
  145. font-size:.32rem;
  146. color:#666;
  147. }
  148. span.active{
  149. color:#3976f4;
  150. border-bottom:.02rem solid #3976f4;
  151. }
  152. }
  153. .brand-list-content{
  154. margin:0 auto;
  155. border-top:.02rem solid #dedfdf;
  156. border-bottom:.02rem solid #dedfdf;
  157. width:7.1rem;
  158. min-height:3.02rem;
  159. overflow: hidden;
  160. text-align: center;
  161. padding-top:.33rem;
  162. padding-bottom:.33rem;
  163. .brand-list-top{
  164. span:first-child{
  165. font-size:.32rem;
  166. margin-right:4.78rem;
  167. }
  168. span:last-child{
  169. font-size:.28rem;
  170. color:#53a0f7;
  171. }
  172. }
  173. .brand-list-item{
  174. justify-content: space-between;
  175. flex-wrap: wrap;
  176. display:inline-flex;
  177. overflow: hidden;
  178. margin:0 .2rem;
  179. img{
  180. width:1.57rem;
  181. height:.77rem;
  182. margin-top:.2rem;
  183. border-radius: .1rem;
  184. border:.02rem solid #53a0f7;
  185. }
  186. }
  187. }
  188. .detail-brand-content{
  189. margin:0 auto;
  190. border-top:.02rem solid #dedfdf;
  191. border-bottom:.02rem solid #dedfdf;
  192. width:7.1rem;
  193. height:3.02rem;
  194. padding-top:.18rem;
  195. h4{
  196. font-size:.32rem;
  197. line-height: .6rem;
  198. margin:0;
  199. margin-left:3.97rem;
  200. }
  201. .brand-list{
  202. display:flex;
  203. justify-content: space-between;
  204. align-items: center;
  205. margin:0 .15rem;
  206. .list-left{
  207. border:.02rem solid #418ef7;
  208. border-radius: .05rem;
  209. width:2.03rem;
  210. height:1.73rem;
  211. img{
  212. display:block;
  213. width:100%;
  214. height:1.25rem;
  215. }
  216. span{
  217. display: block;
  218. font-size: .24rem;
  219. color:#fff;
  220. text-align: center;
  221. width:100%;
  222. background: #418ef7;
  223. line-height: .45rem;
  224. }
  225. }
  226. p{
  227. width:4.3rem;
  228. font-size:.28rem;
  229. line-height: .4rem;
  230. padding:.12rem .46rem 0 .05rem;
  231. }
  232. }
  233. }
  234. .detail-brand{
  235. background: #f8fcff;
  236. width:100%;
  237. min-height:1.5rem;
  238. padding-top:.2rem;
  239. .brand-item{
  240. width:7rem;
  241. margin:0 auto;
  242. border-radius:.1rem;
  243. background: #fff;
  244. padding:.2rem;
  245. position:relative;
  246. &:active{
  247. background: #e1e1e1;
  248. }
  249. p{
  250. font-size:.28rem;
  251. line-height:.4rem;
  252. color:#333;
  253. margin:0;
  254. span{}
  255. }
  256. i{
  257. display:block;
  258. position:absolute;
  259. top:.55rem;
  260. right:.1rem;
  261. font-size:.4rem;
  262. color:#ff7800;
  263. }
  264. }
  265. div.active{
  266. background: #d4d;
  267. }
  268. }
  269. }
  270. </style>