CategoryProperty.vue 17 KB

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