Kind.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  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 != 'undefined' && 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)&&!co_click_flag">寄售</div>
  60. <a class="f14" v-if="getType(list_store_type,store_type_co)&&!co_click_flag" @click="click_store_type('CONSIGNMENT')">寄售</a>
  61. <span v-if="co_click_flag" @click="cancel_store_type('CONSIGNMENT')">
  62. <div class="sl-filter">
  63. <a class="text-num" >寄售</a>
  64. <span><i class="fa fa-close"></i></span>
  65. </div>
  66. </span>
  67. </li>
  68. <li>
  69. <div class="f14" style="color: #999;" v-if="!getType(list_store_type,store_type_di)&&!di_click_flag">经销</div>
  70. <a class="f14" v-if="getType(list_store_type,store_type_di)&&!di_click_flag" @click="click_store_type('DISTRIBUTION')">经销</a>
  71. <span v-if="di_click_flag" @click="cancel_store_type('DISTRIBUTION')">
  72. <div class="sl-filter">
  73. <a class="text-num" >经销</a>
  74. <span><i class="fa fa-close"></i></span>
  75. </div>
  76. </span>
  77. </li>
  78. <li>
  79. <div class="f14" style="color: #999;" v-if="!getType(list_store_type,store_type_or)&&!or_click_flag">原厂</div>
  80. <a class="f14" v-if="getType(list_store_type,store_type_or)&&!or_click_flag" @click="click_store_type('ORIGINAL_FACTORY')">原厂</a>
  81. <span v-if="or_click_flag" @click="cancel_store_type('ORIGINAL_FACTORY')">
  82. <div class="sl-filter">
  83. <a class="text-num" >原厂</a>
  84. <span><i class="fa fa-close"></i></span>
  85. </div>
  86. </span>
  87. </li>
  88. <li>
  89. <div class="f14" style="color: #999;" v-if="!getType(list_store_type,store_type_ag)&&!ag_click_flag">代理</div>
  90. <a class="f14" v-if="getType(list_store_type,store_type_ag)&&!ag_click_flag" @click="click_store_type('AGENCY')">代理</a>
  91. <span v-if="ag_click_flag" @click="cancel_store_type('AGENCY')">
  92. <div class="sl-filter" >
  93. <a class="text-num" >代理</a>
  94. <span><i class="fa fa-close"></i></span>
  95. </div>
  96. </span>
  97. </li>
  98. </ul>
  99. </div>
  100. </div>
  101. <div class="sl-wrap" v-if="list_crname.length != 'undefined' && list_crname.length > 0" style="height: 40px">
  102. <div class="sl-key f14">仓库:</div>
  103. <div class="sl-value">
  104. <ul class="list-inline" >
  105. <li><a class="f14">全部</a></li>
  106. <li v-for="cr in list_crname_temp">
  107. <a v-if="cr.cr_name=='RMB'?!rmb_click_flag:!usd_click_flag" v-text="cr.cr_name=='RMB'?'大陆':'香港'" class="f14" @click="click_crname(cr.cr_name)"></a>
  108. <span v-if="cr.cr_name=='RMB'?rmb_click_flag:usd_click_flag" @click="cancel_crname(cr.cr_name)">
  109. <div class="sl-filter">
  110. <a class="text-num" v-text="cr.cr_name=='RMB'?'大陆':'香港'"></a>
  111. <span><i class="fa fa-close"></i></span>
  112. </div>
  113. </span>
  114. </li>
  115. </ul>
  116. </div>
  117. </div>
  118. <div class="sl-wrap" v-if="list_crname.length != 'undefined' && list_crname.length > 0" style="height: 40px">
  119. <div class="sl-key f14">货币:</div>
  120. <div class="sl-value">
  121. <ul class="list-inline" >
  122. <li><a class="f14">全部</a></li>
  123. <li v-for="cr in list_crname_temp">
  124. <a v-if="cr.cr_name=='RMB'?!rmb_click_flag:!usd_click_flag" v-text="cr.cr_name=='RMB'?'人民币':'美元'" class="f14" @click="click_crname(cr.cr_name)"></a>
  125. <span v-if="cr.cr_name=='RMB'?rmb_click_flag:usd_click_flag" @click="cancel_crname(cr.cr_name)">
  126. <div class="sl-filter">
  127. <a class="text-num" v-text="cr.cr_name=='RMB'?'人民币':'美元'"></a>
  128. <span><i class="fa fa-close"></i></span>
  129. </div>
  130. </span>
  131. </li>
  132. </ul>
  133. </div>
  134. </div>
  135. </div>
  136. </template>
  137. <script>
  138. export default {
  139. data () {
  140. return {
  141. kind_open: true,
  142. brand_open: true,
  143. show_kind: 'list-inline',
  144. show_brand: 'list-inline',
  145. store_type_co: {store_type: 'CONSIGNMENT'},
  146. store_type_ag: {store_type: 'AGENCY'},
  147. store_type_di: {store_type: 'DISTRIBUTION'},
  148. store_type_or: {store_type: 'ORIGINAL_FACTORY'},
  149. filter: {},
  150. kind_arr: [],
  151. brand_arr: [],
  152. type_arr: [],
  153. crname_arr: [],
  154. kind_exp_arr: [],
  155. brand_exp_arr: [],
  156. co_click_flag: false,
  157. ag_click_flag: false,
  158. di_click_flag: false,
  159. or_click_flag: false,
  160. rmb_click_flag: false,
  161. usd_click_flag: false
  162. }
  163. },
  164. computed: {
  165. list_kinds () {
  166. return this.$store.state.searchData.searchKinds.kinds
  167. },
  168. list_kind () {
  169. return this.list_kinds.data
  170. },
  171. list_brands () {
  172. return this.$store.state.searchData.searchBrands.brands
  173. },
  174. list_brand () {
  175. return this.list_brands.data
  176. },
  177. list_store_types () {
  178. return this.$store.state.searchData.searchStoreType.store_type
  179. },
  180. list_store_type () {
  181. return this.list_store_types.data
  182. },
  183. list_crnames () {
  184. return this.$store.state.searchData.searchCrname.crname
  185. },
  186. list_crname () {
  187. return this.list_crnames.data
  188. },
  189. list_crname_temp () {
  190. let arr = this.list_crnames.data
  191. if (!(JSON.stringify(arr).indexOf(JSON.stringify({cr_name: 'RMB-USD'})) === -1)) {
  192. return [{cr_name: 'RMB'}, {cr_name: 'USD'}]
  193. } else {
  194. return arr
  195. }
  196. },
  197. good_lists () {
  198. return this.$store.state.searchData.searchList.lists
  199. },
  200. good_list () {
  201. return this.good_lists.data
  202. }
  203. },
  204. methods: {
  205. click_kind_more: function (event) {
  206. if (this.kind_open) {
  207. this.show_kind = 'list-inline2'
  208. } else {
  209. this.show_kind = 'list-inline'
  210. }
  211. this.kind_open = !this.kind_open
  212. },
  213. click_brand_more: function (event) {
  214. if (this.brand_open) {
  215. this.show_brand = 'list-inline2'
  216. } else {
  217. this.show_brand = 'list-inline'
  218. }
  219. this.brand_open = !this.brand_open
  220. },
  221. getType: function (arr, obj) {
  222. return !(JSON.stringify(arr).indexOf(JSON.stringify(obj)) === -1)
  223. },
  224. click_kind: function (id, index) {
  225. this.kind_arr.push(id)
  226. this.$emit('kindFilterEvent', this.kind_arr)
  227. this.kind_exp_arr.push(this.list_kind[index])
  228. this.list_kind.splice(index, index + 1)
  229. },
  230. click_brand: function (id, index) {
  231. this.brand_arr.push(id)
  232. this.$emit('brandFilterEvent', this.brand_arr)
  233. this.brand_exp_arr.push(this.list_brand[index])
  234. this.list_brand.splice(index, index + 1)
  235. },
  236. click_store_type: function (type) {
  237. this.type_arr.push(type)
  238. this.$emit('typeFilterEvent', this.type_arr)
  239. if (type === 'CONSIGNMENT') {
  240. this.co_click_flag = true
  241. } else if (type === 'AGENCY') {
  242. this.ag_click_flag = true
  243. } else if (type === 'DISTRIBUTION') {
  244. this.di_click_flag = true
  245. } else if (type === 'ORIGINAL_FACTORY') {
  246. this.or_click_flag = true
  247. }
  248. },
  249. cancel_store_type: function (type) {
  250. if (type === 'CONSIGNMENT') {
  251. this.co_click_flag = false
  252. } else if (type === 'AGENCY') {
  253. this.ag_click_flag = false
  254. } else if (type === 'DISTRIBUTION') {
  255. this.di_click_flag = false
  256. } else if (type === 'ORIGINAL_FACTORY') {
  257. this.or_click_flag = false
  258. }
  259. let idx = this.getIndex(this.type_arr, type)
  260. this.type_arr.splice(idx, idx + 1)
  261. this.$emit('typeFilterEvent', this.type_arr)
  262. },
  263. click_crname: function (name) {
  264. this.crname_arr.push(name)
  265. if (this.getIndex(this.crname_arr, 'RMB-USD') === -1) {
  266. this.crname_arr.push('RMB-USD')
  267. }
  268. if (name === 'RMB') {
  269. this.rmb_click_flag = true
  270. } else if (name === 'USD') {
  271. this.usd_click_flag = true
  272. }
  273. this.$emit('crnameFilterEvent', this.crname_arr)
  274. },
  275. cancel_crname: function (name) {
  276. let idx = this.getIndex(this.crname_arr, name)
  277. this.crname_arr.splice(idx, idx + 1)
  278. if (this.crname_arr.length === 1) {
  279. this.crname_arr = []
  280. }
  281. if (name === 'RMB') {
  282. this.rmb_click_flag = false
  283. } else if (name === 'USD') {
  284. this.usd_click_flag = false
  285. }
  286. this.$emit('crnameFilterEvent', this.crname_arr)
  287. },
  288. click_kind_exp: function (id, index) {
  289. let idx = this.getIndex(this.kind_arr, id)
  290. this.kind_arr.splice(idx, idx + 1)
  291. this.$emit('kindFilterEvent', this.kind_arr)
  292. this.kind_exp_arr.splice(index, index + 1)
  293. },
  294. click_brand_exp: function (id, index) {
  295. let idx = this.getIndex(this.brand_arr, id)
  296. this.brand_arr.splice(idx, idx + 1)
  297. this.$emit('brandFilterEvent', this.brand_arr)
  298. this.brand_exp_arr.splice(index, index + 1)
  299. },
  300. getIndex: function (arr, obj) {
  301. for (let i = 0; i < arr.length; i++) {
  302. if (arr[i] === obj) {
  303. return i
  304. }
  305. }
  306. return -1
  307. }
  308. }
  309. }
  310. </script>
  311. <style scoped>
  312. #searchResult .selector .sl-wrap {
  313. position: relative;
  314. padding: 5px 5px;
  315. font-size: 12px;
  316. line-height: 30px;
  317. border-bottom: 1px solid #e5e5e5;
  318. }
  319. #searchResult .selector .sl-wrap .sl-key {
  320. float: left;
  321. width: 100px;
  322. }
  323. .f14 {
  324. font-size: 14px;
  325. }
  326. #searchResult .selector .sl-wrap .sl-value {
  327. margin-left: 110px;
  328. margin-right: 50px;
  329. }
  330. #searchResult .selector .sl-wrap .sl-value span >.sl-filter {
  331. display: inline-block;
  332. position: relative;
  333. line-height: 22px;
  334. padding-left: 10px;
  335. padding-right: 30px;
  336. border: 1px solid #ccc;
  337. cursor: pointer;
  338. height: 22px;
  339. margin-right: 10px;
  340. }
  341. #searchResult .selector .sl-wrap .sl-value span >.sl-filter a{
  342. color: #666;
  343. text-decoration: none;
  344. }
  345. #searchResult .selector .sl-wrap .sl-value span >.sl-filter span{
  346. display: inline-block;
  347. position: absolute;
  348. right: 0;
  349. top: 0;
  350. height: 100%;
  351. width: 20px;
  352. text-align: center;
  353. background: #ccc;
  354. color: #fff;
  355. }
  356. #searchResult .selector .sl-wrap .sl-value span >.sl-filter:hover {
  357. border: 1px solid #f50;
  358. }
  359. #searchResult .selector .sl-wrap .sl-value span >.sl-filter:hover a{
  360. color: #f50;
  361. }
  362. #searchResult .selector .sl-wrap .sl-value span >.sl-filter:hover span{
  363. background: #f50;
  364. }
  365. #searchResult .selector .sl-wrap .sl-clear {
  366. clear: both;
  367. }
  368. #searchResult .selector .sl-wrap .sl-ext {
  369. width: 40px;
  370. top: 5px;
  371. position: absolute;
  372. right: 0;
  373. }
  374. .list-inline {
  375. height: 60px;
  376. overflow: hidden;
  377. margin-bottom: 0;
  378. padding-left: 0;
  379. margin-left: -5px;
  380. list-style: none;
  381. }
  382. .list-inline2 {
  383. height: 100%;
  384. overflow: hidden;
  385. margin-bottom: 0;
  386. padding-left: 0;
  387. margin-left: -5px;
  388. list-style: none;
  389. }
  390. #searchResult .selector .sl-wrap .sl-value ul >li {
  391. display: inline-block;
  392. padding-right: 5px;
  393. padding-left: 5px;
  394. margin-right: 20px;
  395. width: 10%;
  396. height: 23px;
  397. line-height: 23px;
  398. overflow: hidden;
  399. text-overflow: ellipsis;
  400. white-space: nowrap;
  401. }
  402. #searchResult .selector .sl-wrap .sl-value ul a{
  403. color: #1162a4;
  404. }
  405. #searchResult .selector .sl-wrap .sl-value ul a:hover{
  406. text-decoration: none;
  407. color: #f50;
  408. }
  409. .sl-ext a{
  410. color: black;
  411. }
  412. .sl-ext a:hover{
  413. color: #5078cb;
  414. text-decoration: none;
  415. }
  416. </style>