CategoryProperty.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  1. <template>
  2. <div class="main-content container">
  3. <div class="selector" v-if="!kind.leaf">
  4. <div class="sl-wrap" >
  5. <div class="sl-key">
  6. <span>分类:</span>
  7. </div>
  8. <div class="sl-value">
  9. <ul class="list-inline">
  10. <li v-for="c in children" :title="c.nameCn">
  11. <nuxt-link :to="`/product/kind/${c.id}`">{{c.nameCn}}</nuxt-link>
  12. </li>
  13. </ul>
  14. </div>
  15. </div>
  16. </div>
  17. <div class="div-table" split-dropdown v-if="kind.leaf">
  18. <div class="div-table-left">
  19. <table class="table table-bordered">
  20. <thead >
  21. <tr>
  22. <td class="td-width dropdown">
  23. <span class="dropdown-toggle dropdown-back" data-toggle="dropdown">品牌<span class="fa fa-angle-down td-icon"></span></span>
  24. <ul class="dropdown-menu parameter-selection-ul" role="menu" aria-labelledby="dropdownMenu1">
  25. <!--orderBy:'nameCn'-->
  26. <li v-for="b in brands"><a @click="selectBrand(b)"><span>{{b.nameCn}}</span></a></li>
  27. </ul>
  28. </td>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. <tr class="tr-brand">
  33. <td class="td-brand" style="vertical-align: middle;">
  34. <div class="sl-selected" v-if="selectedBrand.nameCn" @click="delBrand()">
  35. <a class="text-num">{{selectedBrand.nameCn}}</a>
  36. <span><i class="fa fa-close"></i></span>
  37. </div>
  38. <div v-if="!selectedBrand.nameCn">
  39. 请选择品牌
  40. </div>
  41. </td>
  42. </tr>
  43. </tbody>
  44. </table>
  45. </div>
  46. <div class="div-table-right" dropdown-scroll>
  47. <table class="table table-bordered" style="table-layout:fixed;">
  48. <thead>
  49. <tr>
  50. <td v-for="(pro, index) in properties" class="list-menu td-width word-break" split-dropdown-trigger="pro.id"
  51. @mouseenter="use_exp_list(pro,index)" @mouseleave="hide_exp_list()">
  52. <span class="dropdown-toggle dropdown-back" data-toggle="dropdown"><span>{{pro.property.labelCn}}</span><span class="fa fa-angle-down td-icon"></span></span>
  53. </td>
  54. </tr>
  55. </thead>
  56. <tbody>
  57. <tr v-if="hasProperties" class="tr-properties">
  58. <td v-for="pro in properties" class="td-properties" style="vertical-align:middle;" >
  59. <span class="sl-selected" v-if="pro.selected" @click="selectProperty(pro)">
  60. <a class="text-num">{{pro.selected.value}}</a>
  61. <span><i class="fa fa-close"></i></span>
  62. </span>
  63. </td>
  64. </tr>
  65. <tr class="properties-hint-tr" v-if="!hasProperties">
  66. <td :colspan="properties.length" class="properties-hint-td">
  67. <div>请选择筛选属性</div>
  68. </td>
  69. </tr>
  70. </tbody>
  71. </table>
  72. </div>
  73. <ul v-show="list_exp_flag" @mouseenter="show_exp_list()" @mouseleave="hide_exp_list()" class="parameter-selection-ul drop-down-list" role="menu" aria-labelledby="dropdownMenu1">
  74. <li v-for="v in selectedProperties.values"><a @click="selectPropertyValue(selectedProperties, value)" class="a-color"><span>{{v.value}}</span></a></li>
  75. </ul>
  76. </div>
  77. </div>
  78. </template>
  79. <script>
  80. export default {
  81. layout: 'main',
  82. data () {
  83. return {
  84. hasProperties: false,
  85. selectedBrand: {
  86. nameCn: null
  87. },
  88. selectedProperties: {},
  89. list_exp_flag: false
  90. }
  91. },
  92. mounted () {
  93. // var list = document.getElementsByClassName('list-menu')
  94. // var container = document.getElementsByClassName('div-table')
  95. // list.onmouseover = function () {
  96. // var id = list[0].getAttribute['split-dropdown-trigger']
  97. // console.log(id)
  98. // }
  99. },
  100. computed: {
  101. kind () {
  102. return this.$store.state.product.kind.kindsParentWithBother.data[this.$store.state.product.kind.kindsParentWithBother.data.length - 1]
  103. },
  104. children () {
  105. return this.$store.state.product.kind.children.data
  106. },
  107. properties () {
  108. return this.$store.state.product.kind.kindProperty.data
  109. },
  110. brands () {
  111. return this.$store.state.product.kind.brands.data
  112. }
  113. },
  114. methods: {
  115. triggerOnMouseEnter (id) {
  116. console.log(id)
  117. let toggles = document.getElementsByClassName('x-split-dropdown-toggle')
  118. for (let i in toggles) {
  119. console.log(toggles[i])
  120. let toggleId = toggles[i].getAttribute('split-dropdown-toggle')
  121. if (toggleId === id) {
  122. console.log(toggles[i])
  123. }
  124. }
  125. },
  126. selectBrand (item) {
  127. this.selectedBrand = item
  128. this.$emit('loadCmpGoodsByBrandEvent', item.id)
  129. },
  130. delBrand () {
  131. this.selectedBrand = {}
  132. this.$emit('loadCmpGoodsByBrandEvent', null)
  133. },
  134. selectProperty (item) {
  135. return null
  136. },
  137. selectPropertyValue (item, value) {
  138. return null
  139. },
  140. use_exp_list: function (pro, index) {
  141. this.selectedProperties = pro
  142. let dom = document.getElementsByClassName('drop-down-list')[0]
  143. let list = document.getElementsByClassName('list-menu')[index]
  144. let left = list.getBoundingClientRect().left - 169
  145. dom.setAttribute('style', 'left: ' + left + 'px')
  146. this.list_exp_flag = true
  147. },
  148. hide_exp_list: function () {
  149. this.list_exp_flag = false
  150. },
  151. show_exp_list: function () {
  152. this.list_exp_flag = true
  153. }
  154. }
  155. }
  156. </script>
  157. <style scoped>
  158. .clear, .clr {
  159. clear: both;
  160. }
  161. /* breadcrumbs */
  162. .breadcrumbs {
  163. margin-top: 20px;
  164. }
  165. .breadcrumbs ul.list-unstyled.list-inline {
  166. margin-left: 0px;
  167. }
  168. .breadcrumbs ul.list-inline.list-unstyled li.crumb-item {
  169. position: relative;
  170. padding-left: 0px;
  171. padding-right: 0px;
  172. padding-bottom: 1px;
  173. height: 32px;
  174. line-height: 30px;
  175. background: #fff;
  176. border: solid 1px #6493ff;
  177. }
  178. .breadcrumbs ul li.crumb-item-angle {
  179. margin-left: -5px;
  180. }
  181. .breadcrumbs ul li.crumb-item>a {
  182. display: inline-block;
  183. width: 100%;
  184. height: 100%;
  185. padding-left: 15px;
  186. padding-right: 15px;
  187. cursor: pointer;
  188. text-decoration: none;
  189. color: #323232;
  190. font-size: 16px;
  191. }
  192. .breadcrumbs ul li.crumb-item:hover>a span,.breadcrumbs ul li.crumb-item:hover>a i{
  193. color: #5078cb;
  194. }
  195. .breadcrumbs ul li.crumb-item>a i{
  196. margin-right: 10px;
  197. }
  198. .breadcrumbs ul li.crumb-item:hover>a i{
  199. transform: rotate(-180deg);
  200. }
  201. .breadcrumbs ul li.crumb-item .angle {
  202. position: absolute;
  203. left: -6px;
  204. top: 50%;
  205. margin-top: -5px;
  206. height: 10px;
  207. width: 10px;
  208. border-bottom: 1px solid #6493ff;
  209. border-left: 1px solid #6493ff;
  210. background: white;
  211. transform: rotate(45deg);
  212. -ms-transform: rotate(45deg); /* IE 9 */
  213. -moz-transform: rotate(45deg); /* Firefox */
  214. -webkit-transform: rotate(45deg); /* Safari 和 Chrome */
  215. -o-transform: rotate(45deg); /* Opera */
  216. z-index: 14;
  217. }
  218. .breadcrumbs ul li.crumb-item .crumb-drop {
  219. position: absolute;
  220. display: none;
  221. left: -1px;
  222. top: 30px;
  223. border: #6493ff 1px solid;
  224. background: #fff;
  225. z-index: 100;
  226. width: 200px;
  227. }
  228. .breadcrumbs ul li.crumb-item .crumb-drop li {
  229. line-height: 20px;
  230. }
  231. .breadcrumbs ul li.crumb-item .crumb-drop li a{
  232. font-size: 12px;
  233. }
  234. li{
  235. list-style: none;
  236. }
  237. .breadcrumbs ul li.crumb-item:hover .crumb-drop {
  238. display: block;
  239. }
  240. .breadcrumbs ul li.crumb-item:hover>a {
  241. border-color: #f50;
  242. background: #ffffff;
  243. z-index: 101;
  244. }
  245. .breadcrumbs ul li.crumb-item a{
  246. color: #323232;
  247. }
  248. .breadcrumbs ul li.crumb-item a:hover{
  249. color: #5078cb;
  250. }
  251. .kind-count-line {
  252. line-height: 25px;
  253. height: 25px;
  254. color: #fff;
  255. font-weight: 600;
  256. background: #7bb4e1;
  257. }
  258. .kind-count-line .kind-count {
  259. display: inline-block;
  260. padding: 0 15px;
  261. background-color: #f39800;
  262. }
  263. /* sl_warp */
  264. .main-content .selector {
  265. color: #666;
  266. border: 1px solid #ddd;
  267. border-top: #6493ff 2px solid;
  268. margin-bottom: 30px;
  269. padding: 10px 0;
  270. }
  271. .main-content .sl-wrap {
  272. position: relative;
  273. line-height: 22px;
  274. padding: 5px 0;
  275. }
  276. .main-content .sl-wrap .sl-key {
  277. float: left;
  278. width: 100px;
  279. padding: 0 8px;
  280. }
  281. .main-content .sl-wrap .sl-key>span {
  282. color: #323232;
  283. font-size: 14px;
  284. }
  285. .main-content .sl-wrap .sl-value {
  286. margin-left: 110px;
  287. overflow-y: auto;
  288. }
  289. .main-content .sl-wrap .sl-value ul li a{
  290. color: #323232;
  291. font-size: 14px;
  292. }
  293. .main-content .sl-wrap .sl-value ul li a:hover{
  294. color: #5078cb;
  295. }
  296. .main-content .sl-wrap .sl-value .sl-selected {
  297. display: inline-block;
  298. position: relative;
  299. padding-left: 10px;
  300. padding-right: 30px;
  301. border: 1px solid #ccc;
  302. cursor: pointer;
  303. }
  304. .main-content .sl-wrap .sl-value .sl-selected a {
  305. color: #666;
  306. text-decoration: none;
  307. }
  308. .main-content .sl-wrap .sl-value .sl-selected:HOVER {
  309. border: 1px solid #f50;
  310. }
  311. .main-content .sl-wrap .sl-value .sl-selected:HOVER a {
  312. color: #f50;
  313. }
  314. .main-content .sl-wrap .sl-value .sl-selected span {
  315. display: inline-block;
  316. position: absolute;
  317. right: 0px;
  318. top: 0px;
  319. height: 100%;
  320. width: 20px;
  321. text-align: center;
  322. background: #ccc;
  323. color: #fff;
  324. }
  325. .main-content .sl-wrap .sl-value .sl-selected:HOVER span {
  326. background: #f50;
  327. }
  328. .main-content .sl-wrap .sl-value ul {
  329. margin-bottom: 0;
  330. }
  331. .main-content .sl-wrap .sl-value ul.list-inline li {
  332. width: 16.6666%;
  333. white-space:nowrap;
  334. overflow:hidden;
  335. text-overflow:ellipsis;
  336. }
  337. .main-content .sl-wrap .sl-value ul, .main-content .sl-set .sl-value ul{
  338. min-height: 25px;
  339. }
  340. .main-content .sl-wrap .sl-ext {
  341. position: absolute;
  342. top: 0px;
  343. right: 0px;
  344. width: 80px;
  345. }
  346. .main-content .sl-more {
  347. position: relative;
  348. top: -1px;
  349. line-height: 30px;
  350. text-align: center;
  351. border-top: 1px solid #DDD;
  352. }
  353. .main-content .sl-more a {
  354. position: relative;
  355. display: inline-block;
  356. margin-top: -1px;
  357. height: 30px;
  358. line-height: 30px;
  359. padding: 0 10px 0 10px;
  360. border-width: 1px;
  361. border-style: solid;
  362. border-color: #FFF #DDD #DDD;
  363. background: #fff;
  364. cursor: pointer;
  365. -webkit-transition: border-color .15s ease-in-out;
  366. -moz-transition: border-color .15s ease-in-out;
  367. transition: border-color .15s ease-in-out;
  368. }
  369. .main-content .sl-more:hover {
  370. border-top-color: #f39800;
  371. }
  372. .main-content .sl-more:hover a {
  373. color: #f39800;
  374. border-color: #FFF #f39800 #f39800;
  375. text-decoration: none;
  376. }
  377. .main-content .sl-more a:focus {
  378. text-decoration: none;
  379. color: #f39800;
  380. }
  381. .main-content .sl-set {
  382. position: relative;
  383. line-height: 30px;
  384. font-size: 14px;
  385. }
  386. .main-content .sl-set .sl-key {
  387. float: left;
  388. width: 100px;
  389. }
  390. .main-content .sl-set .sl-value {
  391. margin-left: 110px;
  392. }
  393. .main-content .content {
  394. position: relative;
  395. }
  396. .main-content .content .total {
  397. position: relative;
  398. margin-bottom: 10px;
  399. line-height: 30px;
  400. height: 30px;
  401. background: #7bb4e1;
  402. color: white;
  403. font-weight: 700;
  404. }
  405. .main-content .info {
  406. line-height: 24px;
  407. }
  408. .main-content .info .title {
  409. display: inline-block;
  410. width: 100px;
  411. font-family: 'microsoft yahei';
  412. font-weight: 600;
  413. }
  414. .main-content .info .content {
  415. font-size: 14px;
  416. }
  417. .main-content .operate {
  418. margin-bottom: 5px;
  419. }
  420. .main-content .operate .btn {
  421. width: 100px;
  422. text-align: left;
  423. }
  424. .main-content .content .view_all:hover {
  425. text-decoration: none;
  426. color: #f50;
  427. background: #f5f5f5
  428. }
  429. .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th,
  430. .table>thead>tr>td, .table>thead>tr>th {
  431. padding: 10px 5px;
  432. }
  433. .total-content {
  434. background-color: #f39800;
  435. padding-left: 10px;
  436. }
  437. .btnactive {
  438. background-color: #f39800;
  439. }
  440. .reserve {
  441. color: white;
  442. font-weight: 500;
  443. }
  444. .pagging .pagging-count {
  445. padding-left: 10px;
  446. padding-right: 10px;
  447. }
  448. .pagging .pagging-count:HOVER {
  449. background: #4D7BA5;
  450. cursor: pointer;
  451. }
  452. .pagging .pagging-count a {
  453. color: white !important;
  454. text-decoration: none !important;
  455. }
  456. .parameter-selection > div:first-child {
  457. display: inline-block;
  458. position: absolute;
  459. top: 50%;
  460. left: 8px;
  461. transform: translateY(-50%);
  462. }
  463. .parameter-selection div:last-child {
  464. display: inline-block;
  465. position: absolute;
  466. top: 50%;
  467. left: 40px;
  468. transform: translateY(-50%);
  469. }
  470. .div-table{
  471. width:1190px;
  472. height:120px;
  473. border-top: #6493ff 2px solid;
  474. }
  475. .div-table-left{
  476. width:135px;
  477. float:left;
  478. text-align: center;
  479. }
  480. .parameter-selection-ul{
  481. min-height: 80px;
  482. max-height: 176px;
  483. overflow: scroll;
  484. overflow-x:hidden;
  485. }
  486. .div-table-right{
  487. float:left;
  488. height:120px;
  489. width:1055px;
  490. overflow-x:auto;
  491. overflow-y:hidden;
  492. border:1px solid #DBDBDB;
  493. }
  494. .div-table-right .table{
  495. margin-bottom: 0;
  496. }
  497. .div-table-right table thead tr td{
  498. width: 140px;
  499. text-align: center;
  500. vertical-align: middle;
  501. padding: 0;
  502. }
  503. .text-hidden {
  504. text-overflow:ellipsis;
  505. overflow:hidden;
  506. white-space: nowrap;
  507. }
  508. .text-hidden:hover{
  509. overflow: visible;
  510. }
  511. .td-width{
  512. color: #323232;
  513. font-size: 14px;
  514. }
  515. .td-icon{
  516. font-size:18px;
  517. }
  518. .tr-brand{
  519. height:80px;
  520. vertical-align: middle;
  521. }
  522. .tr-properties{
  523. height:65px;
  524. }
  525. .td-brand,.td-properties{
  526. line-height: 20px;
  527. word-wrap : break-word;
  528. word-break : break-all;
  529. }
  530. thead tr {
  531. background: linear-gradient(rgb(93, 134, 220), rgb(12, 53, 136));
  532. color: #fff;
  533. height: 48px;
  534. }
  535. .table>thead>tr>th{
  536. padding:5px 5px;
  537. }
  538. .dropdown:hover>.dropdown-back {
  539. border-color: transparent;
  540. background-color: transparent;
  541. }
  542. /* scroll */
  543. ::-webkit-scrollbar {
  544. width: 10px;
  545. height: 10px;
  546. background: #ededed;
  547. }
  548. ::-webkit-scrollbar-thumb {
  549. background-color: #c1c1c1;
  550. border-radius: 5px;
  551. }
  552. ::-webkit-scrollbar-thumb:hover {
  553. background-color: #959595;
  554. }
  555. .container {
  556. position: relative;
  557. width: 1190px;
  558. }
  559. .main-content .wrap {
  560. position: relative;
  561. width: 500px;
  562. border: 1px solid #ccc;
  563. overflow-x: auto;
  564. }
  565. .table {
  566. display: table;
  567. table-layout: fixed;
  568. width: 100%;
  569. border-collapse: collapse;
  570. position: relative;
  571. left: 0px;
  572. }
  573. .tr, .th {
  574. display: table-row;
  575. }
  576. .th {
  577. font-weight: 600;
  578. }
  579. .td {
  580. display: table-cell;
  581. padding: 5px;
  582. width: 100px;
  583. text-align: center;
  584. border: 1px solid #ddd;
  585. }
  586. .dropdown-menu {
  587. display: none;
  588. position: absolute;
  589. top: 100%;
  590. background: #fff;
  591. text-align: center;
  592. cursor: pointer;
  593. }
  594. [split-dropdown] {
  595. position: relative;
  596. }
  597. [split-dropdown-toggle] {
  598. position: absolute;
  599. display: none;
  600. border: 1px solid #ccc;
  601. background: #fff;
  602. z-index: 100;
  603. top: 40px !important;
  604. }
  605. .drop-down-list{
  606. font-size: 14px;
  607. min-width: 100px;
  608. line-height: 1.75;
  609. background: #fff;
  610. text-align:center;
  611. padding: 5px 0;
  612. margin: 1px 0 0;
  613. }
  614. .drop-down-list a{
  615. padding: 0 10px;
  616. }
  617. .drop-down-list li:hover,.dropdown-menu li:hover a{
  618. background: #5078cb;
  619. }
  620. .drop-down-list li:hover a,.dropdown-menu li:hover a{
  621. color: #fff;
  622. }
  623. .a-color {
  624. color:black;
  625. cursor: pointer;
  626. }
  627. tr.properties-hint-tr {
  628. height: 65px;
  629. }
  630. tr.properties-hint-tr > td.properties-hint-td {
  631. vertical-align: middle;
  632. line-height: 20px;
  633. border-bottom: none;
  634. }
  635. tr.properties-hint-tr > td.properties-hint-td > div {
  636. /*position: relative;
  637. left: -25em;*/
  638. text-align: left;
  639. margin-left: 38em;
  640. }
  641. .word-break {
  642. word-break: break-word;
  643. }
  644. /*修改样式*/
  645. .breadcrumbs,.main-content{
  646. padding: 0;
  647. }
  648. .main-content .table-bordered{
  649. border-top: none;
  650. }
  651. .main-content .table-bordered thead tr{
  652. background: none;
  653. line-height: 40px;
  654. height: 40px;
  655. color: #323232;
  656. }
  657. .div-table-left table thead tr td,.div-table-right table thead tr td{
  658. border-bottom: none;
  659. }
  660. .div-table-left table tbody tr td,.div-table-right table tbody tr td{
  661. font-size: 12px;
  662. }
  663. .div-table-left table tr td{
  664. border-right: none;
  665. }
  666. .div-table-right table thead tr td:first-child{
  667. border-left: none;
  668. }
  669. .table-bordered{
  670. border: none;
  671. }
  672. .div-table-right table thead tr td:hover span{
  673. color: #5078cb;
  674. }
  675. .div-table-right table thead tr td:hover span.fa-angle-down{
  676. transform: rotate(-180deg);
  677. }
  678. .div-table-right table .td-properties{
  679. text-align: center;
  680. }
  681. .div-table-right table .td-properties i,.div-table-left table i{
  682. color: #5078cb;
  683. }
  684. .div-table-right table .td-properties{
  685. border-bottom: none;
  686. }
  687. .div-table-left .table{
  688. margin-bottom: 0;
  689. }
  690. .div-table-right tbody tr td:first-child{
  691. border-left: none;
  692. }
  693. .text-length-more{
  694. width: 100px;
  695. display: block;
  696. white-space: nowrap;
  697. overflow: hidden;
  698. text-overflow: ellipsis;
  699. float: left;
  700. }
  701. .drop-down-list {
  702. max-width: 150px;
  703. position: absolute;
  704. top: 40px;
  705. left: 135px;
  706. border: 1px solid #ddd;
  707. }
  708. </style>