_keycode.vue 8.8 KB

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