_keycode.vue 9.3 KB

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