_keycode.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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:#bbb'" @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. <a @click="goLastPage">返回上一页</a>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. export default {
  46. layout: 'main',
  47. data () {
  48. return {
  49. activeType: 'store',
  50. count: '',
  51. filter: {},
  52. page: '',
  53. sorting: {},
  54. isShow: true,
  55. isMove: '',
  56. isFocus: false,
  57. isClickCollect: false
  58. }
  59. },
  60. fetch ({store, route}) {
  61. return Promise.all([
  62. store.dispatch('searchData/searchForListInMobile', {count: 15, filter: {}, keyword: route.query.w, page: 1, sorting: {'GO_RESERVE': 'DESC', 'GO_SEARCH': 'DESC'}}),
  63. store.dispatch('searchData/searchForBrands', {collectList: 'goods_brand', keyword: route.query.w, paramJSON: {}})
  64. ])
  65. },
  66. computed: {
  67. productList () {
  68. return this.$store.state.searchData.searchList.lists.data
  69. },
  70. brandList () {
  71. return this.$store.state.searchData.searchBrands.brands.data
  72. },
  73. brandDetail () {
  74. return this.$store.state.searchData.searchList.lists.data.brands
  75. },
  76. list () {
  77. let list = this.$store.state.searchData.searchDetail.detail.data
  78. if (list.application && list.application !== '') {
  79. this.applications = list.application.split(',')
  80. }
  81. return list
  82. }
  83. },
  84. methods: {
  85. onclick () {
  86. this.isShow = !this.isShow
  87. },
  88. clickType (type) {
  89. if (type === 'store') {
  90. this.activeType = 'store'
  91. this.$store.dispatch('searchData/searchForListInMobile', {count: 15, filter: {}, keyword: this.$route.query.w, page: 1, sorting: {'GO_RESERVE': 'DESC', 'GO_SEARCH': 'DESC'}})
  92. }
  93. if (type === 'support') {
  94. this.activeType = 'support'
  95. this.$store.dispatch('searchData/searchForListInMobile', {count: 15, filter: {'goods_store_type': ['ORIGINAL_FACTORY', 'AGENCY', 'DISTRIBUTION']}, keyword: this.$route.query.w, page: 1, sorting: {'GO_RESERVE': 'DESC', 'GO_SEARCH': 'DESC'}})
  96. }
  97. },
  98. goBrand: function (uuid) {
  99. this.$router.push('/mobile/brand/' + uuid)
  100. },
  101. collect: function (item, $event) {
  102. this.isClickCollect = true
  103. if (!item.isFocus) {
  104. this.$http.post('/trade/collection/save', {componentid: item.cmpId, kind: 2})
  105. .then(response => {
  106. item.isFocus = true
  107. })
  108. } else {
  109. this.$http.post('/trade/collection/delete/cmpId', [item.cmpId]).then(response => {
  110. item.isFocus = false
  111. })
  112. }
  113. },
  114. goComponent: function (uuid) {
  115. if (!this.isClickCollect) {
  116. this.$router.push('/mobile/brand/componentDetail/' + uuid)
  117. } else {
  118. this.isClickCollect = false
  119. }
  120. },
  121. goLastPage: function () {
  122. window.history.back(-1)
  123. }
  124. }
  125. }
  126. </script>
  127. <style scoped lang="scss">
  128. .search-list{
  129. width:100%;
  130. margin-bottom: .98rem;
  131. .none-state{
  132. text-align: center;
  133. margin-top:2rem;
  134. width:100%;
  135. img{
  136. margin:0 auto;
  137. width: 4.08rem;
  138. height: 4.13rem;
  139. }
  140. a {
  141. display: block;
  142. font-size: .28rem;
  143. color: #fff;
  144. width: 1.88rem;
  145. height: .54rem;
  146. line-height: .54rem;
  147. background: #418bf6;
  148. margin: .7rem auto 0;
  149. border-radius: .05rem;
  150. }
  151. }
  152. .search-item{
  153. justify-content: space-around;
  154. text-align: center;
  155. display:flex;
  156. span{
  157. display:inline-block;
  158. width:1.41rem;
  159. line-height: .76rem;
  160. font-size:.32rem;
  161. color:#666;
  162. }
  163. span.active{
  164. color:#3976f4;
  165. border-bottom:.02rem solid #3976f4;
  166. }
  167. }
  168. .brand-list-content{
  169. margin:0 auto;
  170. border-top:.02rem solid #dedfdf;
  171. border-bottom:.02rem solid #dedfdf;
  172. width:7.1rem;
  173. min-height:3.02rem;
  174. overflow: hidden;
  175. text-align: center;
  176. padding-top:.33rem;
  177. padding-bottom:.33rem;
  178. .brand-list-top{
  179. span:first-child{
  180. font-size:.32rem;
  181. margin-right:4.78rem;
  182. }
  183. span:last-child{
  184. font-size:.28rem;
  185. color:#53a0f7;
  186. }
  187. }
  188. .brand-list-item{
  189. justify-content: space-between;
  190. flex-wrap: wrap;
  191. display:inline-flex;
  192. overflow: hidden;
  193. margin:0 .2rem;
  194. img{
  195. width:1.57rem;
  196. height:.77rem;
  197. margin-top:.2rem;
  198. border-radius: .1rem;
  199. border:.02rem solid #53a0f7;
  200. }
  201. }
  202. }
  203. .detail-brand-content{
  204. margin:0 auto;
  205. border-top:.02rem solid #dedfdf;
  206. border-bottom:.02rem solid #dedfdf;
  207. width:7.1rem;
  208. height:3.02rem;
  209. padding-top:.18rem;
  210. h4{
  211. font-size:.32rem;
  212. line-height: .6rem;
  213. margin:0;
  214. margin-left:3.97rem;
  215. }
  216. .brand-list{
  217. display:flex;
  218. justify-content: space-between;
  219. align-items: center;
  220. margin:0 .15rem;
  221. .list-left{
  222. border:.02rem solid #418ef7;
  223. border-radius: .05rem;
  224. width:2.03rem;
  225. height:1.73rem;
  226. img{
  227. display:block;
  228. width:100%;
  229. height:1.25rem;
  230. }
  231. span{
  232. display: block;
  233. font-size: .24rem;
  234. color:#fff;
  235. text-align: center;
  236. width:100%;
  237. background: #418ef7;
  238. line-height: .45rem;
  239. }
  240. }
  241. p{
  242. width:4.3rem;
  243. font-size:.28rem;
  244. line-height: .4rem;
  245. padding:.12rem .46rem 0 .05rem;
  246. }
  247. }
  248. }
  249. .detail-brand{
  250. background: #f8fcff;
  251. width:100%;
  252. min-height:1.5rem;
  253. padding-top:.2rem;
  254. .brand-item{
  255. width:7rem;
  256. margin:0 auto;
  257. border-radius:.1rem;
  258. background: #fff;
  259. padding:.2rem;
  260. position:relative;
  261. &:active{
  262. background: #e1e1e1;
  263. }
  264. p{
  265. font-size:.28rem;
  266. line-height:.4rem;
  267. color:#333;
  268. margin:0;
  269. span{}
  270. }
  271. i{
  272. display:block;
  273. position:absolute;
  274. top:.1rem;
  275. right:.1rem;
  276. font-size:.4rem;
  277. color:#ff7800;
  278. }
  279. }
  280. div.active{
  281. background: #d4d;
  282. }
  283. }
  284. }
  285. </style>