Kind.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <div class="selector">
  3. <div class="sl-wrap" v-if="good_list.total > 0">
  4. <div class="sl-key f14">类目:</div>
  5. <div class="sl-value">
  6. <span v-for="(kind_temp, index) in kind_exp_arr">
  7. <div class="sl-filter" @click="click_kind_exp(kind_temp.ki_id, index)">
  8. <a class="text-num" v-text="kind_temp.ki_name_cn"></a>
  9. <span><i class="fa fa-close"></i></span>
  10. </div>
  11. </span>
  12. <ul :class="show_kind">
  13. <li><a class="f14" >全部</a></li>
  14. <li v-for="(item, index) in list_kind">
  15. <a v-text="item.ki_name_cn" class="f14" @click="click_kind(item.ki_id, index)"></a>
  16. </li>
  17. </ul>
  18. </div>
  19. <div class="sl-clear"></div>
  20. <div class="sl-ext">
  21. <a @click="click_kind_more" v-if="list_kind.length>17">
  22. <span v-text="kind_open?'更多':'收起'"></span>
  23. <i class="fa fa-angle-down ng-scope" v-if="kind_open"></i>
  24. <i class="fa fa-angle-up ng-scope" v-if="!kind_open"></i>
  25. </a>
  26. </div>
  27. </div>
  28. <div class="sl-wrap" v-if="good_list.total > 0">
  29. <div class="sl-key f14">品牌:</div>
  30. <div class="sl-value">
  31. <span v-for="(brand_temp, index) in brand_exp_arr">
  32. <div class="sl-filter">
  33. <a class="text-num" v-text="brand_temp.br_name_cn" @click="click_brand_exp(brand_temp.br_id, index)"></a>
  34. <span><i class="fa fa-close"></i></span>
  35. </div>
  36. </span>
  37. <ul :class="show_brand">
  38. <li><a class="f14" >全部</a></li>
  39. <li v-for="(item, index) in list_brand">
  40. <a v-text="item.br_name_cn" class="f14" @click="click_brand(item.br_id, index)"></a>
  41. </li>
  42. </ul>
  43. </div>
  44. <div class="sl-clear"></div>
  45. <div class="sl-ext" v-if="list_brand.length>17">
  46. <a @click="click_brand_more">
  47. <span v-text="brand_open?'更多':'收起'"></span>
  48. <i class="fa fa-angle-down ng-scope" v-if="brand_open"></i>
  49. <i class="fa fa-angle-up ng-scope" v-if="!brand_open"></i>
  50. </a>
  51. </div>
  52. </div>
  53. <div class="sl-wrap" v-if="list_store_type.length > 0" style="height: 40px">
  54. <div class="sl-key f14">货源:</div>
  55. <div class="sl-value">
  56. <ul class="list-inline" >
  57. <li><a class="f14" >全部</a></li>
  58. <li>
  59. <div class="f14" style="color: #999;" v-if="!getType(list_store_type,store_type_co)">寄售</div>
  60. <a class="f14" v-if="getType(list_store_type,store_type_co)" @click="click_store_type('CONSIGNMENT')">寄售</a>
  61. </li>
  62. <li>
  63. <div class="f14" style="color: #999;" v-if="!getType(list_store_type,store_type_di)">经销</div>
  64. <a class="f14" v-if="getType(list_store_type,store_type_di)">经销</a>
  65. </li>
  66. <li>
  67. <div class="f14" style="color: #999;" v-if="!getType(list_store_type,store_type_or)">原厂</div>
  68. <a class="f14" v-if="getType(list_store_type,store_type_or)">原厂</a>
  69. </li>
  70. <li>
  71. <div class="f14" style="color: #999;" v-if="!getType(list_store_type,store_type_ag)">代理</div>
  72. <a class="f14" v-if="getType(list_store_type,store_type_ag)">代理</a>
  73. </li>
  74. </ul>
  75. </div>
  76. </div>
  77. <div class="sl-wrap" v-if="list_crname.length > 0" style="height: 40px">
  78. <div class="sl-key f14">仓库:</div>
  79. <div class="sl-value">
  80. <ul class="list-inline" >
  81. <li><a class="f14">全部</a></li>
  82. <li v-for="cr in list_crname_temp">
  83. <a v-text="cr.cr_name=='RMB'?'大陆':'香港'" class="f14" @click="click_crname(cr.cr_name)"></a>
  84. <div class="sl-filter">
  85. <a class="text-num" ></a>
  86. <span><i class="fa fa-close"></i></span>
  87. </div>
  88. </li>
  89. </ul>
  90. </div>
  91. </div>
  92. <div class="sl-wrap" v-if="list_crname.length > 0" style="height: 40px">
  93. <div class="sl-key f14">货币:</div>
  94. <div class="sl-value">
  95. <ul class="list-inline" >
  96. <li><a class="f14">全部</a></li>
  97. <li v-for="cr in list_crname_temp">
  98. <a v-text="cr.cr_name=='RMB'?'人民币':'美元'" class="f14" @click="click_crname(cr.cr_name)"></a>
  99. <div class="sl-filter">
  100. <a class="text-num" ></a>
  101. <span><i class="fa fa-close"></i></span>
  102. </div>
  103. </li>
  104. </ul>
  105. </div>
  106. </div>
  107. </div>
  108. </template>
  109. <script>
  110. export default {
  111. data () {
  112. return {
  113. kind_open: true,
  114. brand_open: true,
  115. show_kind: 'list-inline',
  116. show_brand: 'list-inline',
  117. store_type_co: {store_type: 'CONSIGNMENT'},
  118. store_type_ag: {store_type: 'AGENCY'},
  119. store_type_di: {store_type: 'DISTRIBUTION'},
  120. store_type_or: {store_type: 'ORIGINAL_FACTORY'},
  121. filter: {},
  122. kind_arr: [],
  123. brand_arr: [],
  124. type_arr: [],
  125. crname_arr: [],
  126. kind_exp_arr: [],
  127. brand_exp_arr: []
  128. }
  129. },
  130. computed: {
  131. list_kinds () {
  132. return this.$store.state.searchData.searchKinds.kinds
  133. },
  134. list_kind () {
  135. return this.list_kinds.data
  136. },
  137. list_brands () {
  138. return this.$store.state.searchData.searchBrands.brands
  139. },
  140. list_brand () {
  141. return this.list_brands.data
  142. },
  143. list_store_types () {
  144. return this.$store.state.searchData.searchStoreType.store_type
  145. },
  146. list_store_type () {
  147. return this.list_store_types.data
  148. },
  149. list_crnames () {
  150. return this.$store.state.searchData.searchCrname.crname
  151. },
  152. list_crname () {
  153. return this.list_crnames.data
  154. },
  155. list_crname_temp () {
  156. let arr = this.list_crnames.data
  157. if (!(JSON.stringify(arr).indexOf(JSON.stringify({cr_name: 'RMB-USD'})) === -1)) {
  158. return [{cr_name: 'RMB'}, {cr_name: 'USD'}]
  159. } else {
  160. return arr
  161. }
  162. },
  163. good_lists () {
  164. return this.$store.state.searchData.searchList.lists
  165. },
  166. good_list () {
  167. return this.good_lists.data
  168. }
  169. },
  170. methods: {
  171. click_kind_more: function (event) {
  172. if (this.kind_open) {
  173. this.show_kind = 'list-inline2'
  174. } else {
  175. this.show_kind = 'list-inline'
  176. }
  177. this.kind_open = !this.kind_open
  178. },
  179. click_brand_more: function (event) {
  180. if (this.brand_open) {
  181. this.show_brand = 'list-inline2'
  182. } else {
  183. this.show_brand = 'list-inline'
  184. }
  185. this.brand_open = !this.brand_open
  186. },
  187. getType: function (arr, obj) {
  188. return !(JSON.stringify(arr).indexOf(JSON.stringify(obj)) === -1)
  189. },
  190. click_kind: function (id, index) {
  191. this.kind_arr.push(id)
  192. this.$emit('kindFilterEvent', this.kind_arr)
  193. this.kind_exp_arr.push(this.list_kind[index])
  194. this.list_kind.splice(index, index + 1)
  195. },
  196. click_brand: function (id, index) {
  197. this.brand_arr.push(id)
  198. this.$emit('brandFilterEvent', this.brand_arr)
  199. this.brand_exp_arr.push(this.list_brand[index])
  200. this.list_brand.splice(index, index + 1)
  201. },
  202. click_store_type: function (type) {
  203. this.type_arr.push(type)
  204. this.$emit('typeFilterEvent', this.type_arr)
  205. },
  206. click_crname: function (name) {
  207. this.crname_arr.push(name)
  208. if (this.crname_arr.length === 2) {
  209. this.crname_arr.push('RMB-USD')
  210. }
  211. this.$emit('crnameFilterEvent', this.crname_arr)
  212. },
  213. click_kind_exp: function (id, index) {
  214. let idx = this.getIndex(this.kind_arr, id)
  215. this.kind_arr.splice(idx, idx + 1)
  216. this.$emit('kindFilterEvent', this.kind_arr)
  217. this.kind_exp_arr.splice(index, index + 1)
  218. },
  219. click_brand_exp: function (id, index) {
  220. let idx = this.getIndex(this.brand_arr, id)
  221. this.brand_arr.splice(idx, idx + 1)
  222. this.$emit('brandFilterEvent', this.brand_arr)
  223. this.brand_exp_arr.splice(index, index + 1)
  224. },
  225. getIndex: function (arr, obj) {
  226. for (let i = 0; i < arr.length; i++) {
  227. if (arr[i] === obj) {
  228. return i
  229. }
  230. }
  231. }
  232. }
  233. }
  234. </script>
  235. <style scoped>
  236. #searchResult .selector .sl-wrap {
  237. position: relative;
  238. padding: 5px 5px;
  239. font-size: 12px;
  240. line-height: 30px;
  241. border-bottom: 1px solid #e5e5e5;
  242. }
  243. #searchResult .selector .sl-wrap .sl-key {
  244. float: left;
  245. width: 100px;
  246. }
  247. .f14 {
  248. font-size: 14px;
  249. }
  250. #searchResult .selector .sl-wrap .sl-value {
  251. margin-left: 110px;
  252. margin-right: 50px;
  253. }
  254. #searchResult .selector .sl-wrap .sl-value span >.sl-filter {
  255. display: inline-block;
  256. position: relative;
  257. line-height: 22px;
  258. padding-left: 10px;
  259. padding-right: 30px;
  260. border: 1px solid #ccc;
  261. cursor: pointer;
  262. }
  263. #searchResult .selector .sl-wrap .sl-value span >.sl-filter a{
  264. color: #666;
  265. text-decoration: none;
  266. }
  267. #searchResult .selector .sl-wrap .sl-value span >.sl-filter span{
  268. display: inline-block;
  269. position: absolute;
  270. right: 0;
  271. top: 0;
  272. height: 100%;
  273. width: 20px;
  274. text-align: center;
  275. background: #ccc;
  276. color: #fff;
  277. }
  278. #searchResult .selector .sl-wrap .sl-value span >.sl-filter:hover {
  279. border: 1px solid #f50;
  280. }
  281. #searchResult .selector .sl-wrap .sl-value span >.sl-filter:hover a{
  282. color: #f50;
  283. }
  284. #searchResult .selector .sl-wrap .sl-value span >.sl-filter:hover span{
  285. background: #f50;
  286. }
  287. #searchResult .selector .sl-wrap .sl-clear {
  288. clear: both;
  289. }
  290. #searchResult .selector .sl-wrap .sl-ext {
  291. width: 40px;
  292. top: 5px;
  293. position: absolute;
  294. right: 0;
  295. }
  296. .list-inline {
  297. height: 60px;
  298. overflow: hidden;
  299. margin-bottom: 0;
  300. padding-left: 0;
  301. margin-left: -5px;
  302. list-style: none;
  303. }
  304. .list-inline2 {
  305. height: 100%;
  306. overflow: hidden;
  307. margin-bottom: 0;
  308. padding-left: 0;
  309. margin-left: -5px;
  310. list-style: none;
  311. }
  312. #searchResult .selector .sl-wrap .sl-value ul >li {
  313. display: inline-block;
  314. padding-right: 5px;
  315. padding-left: 5px;
  316. margin-right: 20px;
  317. width: 10%;
  318. height: 23px;
  319. line-height: 23px;
  320. overflow: hidden;
  321. text-overflow: ellipsis;
  322. white-space: nowrap;
  323. }
  324. #searchResult .selector .sl-wrap .sl-value ul a{
  325. color: #1162a4;
  326. }
  327. #searchResult .selector .sl-wrap .sl-value ul a:hover{
  328. text-decoration: none;
  329. color: #f50;
  330. }
  331. .sl-ext a{
  332. color: black;
  333. }
  334. .sl-ext a:hover{
  335. color: #5078cb;
  336. text-decoration: none;
  337. }
  338. </style>