sagaProductDetail.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <div>
  3. <div class="saga-brand-box mt90 por">
  4. <div class="breadcrumb-content">
  5. <div style="width: 1020px">
  6. <el-breadcrumb
  7. separator-class="el-icon-arrow-right"
  8. style="width: 320px;display: inline-block"
  9. >
  10. <el-breadcrumb-item>所有分类</el-breadcrumb-item>
  11. <el-breadcrumb-item>给排水专业</el-breadcrumb-item>
  12. <el-breadcrumb-item>燃气系统</el-breadcrumb-item>
  13. <el-breadcrumb-item>品牌名称</el-breadcrumb-item>
  14. </el-breadcrumb>
  15. <span v-for="(item,index) in allSelect" v-if="item.check" class="select">{{item.BrandCname}}
  16. <i class="el-icon-close" @click="deleteCurrent(item,index)"></i></span>
  17. </div>
  18. <span class="total poa">共<b>42</b>件相关产品</span>
  19. </div>
  20. <div class="device-sys">
  21. <div class="left">品牌:</div>
  22. <div class="main" :class="more=='收起'? 'mt30':''">
  23. <ul v-if="more=='更多'">
  24. <li v-for="(item,index) in allDate" :key="index" v-if="index < 8" @click="handleCurrentBrand(item,index)"
  25. :class="item.check ?'light':''">
  26. {{item.BrandCname}}
  27. </li>
  28. </ul>
  29. <template v-else>
  30. <div :class="more=='收起' ? 'check':''">
  31. <span
  32. class="saga-product-letter"
  33. v-for="(list, letter,index) in brandList"
  34. @click="handleLetter(index,list,letter)"
  35. :class="idx=== index?'litter-light':''"
  36. > {{letter}}</span>
  37. </div>
  38. <ul>
  39. <li v-for="(item,index) in allDate" :key="index" @click="handleCurrentBrand(item,index)"
  40. :class="item.check ?'light':''">{{item.BrandCname}}
  41. </li>
  42. </ul>
  43. </template>
  44. </div>
  45. <div class="right" @click="allData" :class="more == '更多' ? 'dark' :'light'" style="position:relative;">
  46. <el-dropdown @command="handleCommand" style="line-height: 40px;" v-show="more=='收起'"
  47. :class="more=='收起'?'pos-drop':''">
  48. <span class="el-dropdown-link">
  49. {{sort}}<i class="el-icon-arrow-down el-icon--right"></i>
  50. </span>
  51. <el-dropdown-menu slot="dropdown">
  52. <el-dropdown-item v-for="(val, key) in sortMap" :key="key" :command="key">{{val}}</el-dropdown-item>
  53. </el-dropdown-menu>
  54. </el-dropdown>
  55. <p style="cursor: pointer;" :class="more=='收起'? 'pos-down':''">{{more}}
  56. <span :class="more=='更多' ? 'el-icon-caret-bottom':'el-icon-caret-top'"></span>
  57. </p>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="saga-brand-box mt20">
  62. <detailTable/>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import detailTable from "../../public/detailTable";
  68. import brandList from "@/data/brandList"
  69. export default {
  70. components: {detailTable},
  71. created() {
  72. this.brandList = Object.assign({
  73. '全部': [{
  74. id: 0,
  75. name: '全部'
  76. }
  77. ]
  78. }, brandList)
  79. for (let key in this.brandList) {
  80. if (Array.isArray(brandList[key])) {
  81. let list = this.temporary.concat(brandList[key])
  82. list.map(i => this.$set(i, 'check', false))
  83. this.temporary = list
  84. this.allDate = list
  85. this.allSelect = list
  86. }
  87. }
  88. },
  89. mounted() {
  90. },
  91. data() {
  92. return {
  93. idx: 0,
  94. more: '更多',
  95. // limitSys: 18,
  96. isShow: true,
  97. brandList: {},
  98. allDate: [],
  99. temporary: [],//全部数据
  100. allSelect: [],//选择的数据
  101. sortMap: {
  102. zh: "中文排序",
  103. en: "英文排序",
  104. },
  105. sort: "中文排序",
  106. }
  107. },
  108. computed: {},
  109. methods: {
  110. handleCommand(command) {// 切换排序方式
  111. this.sort = this.sortMap[command]
  112. },
  113. allData() {
  114. this.isShow = !this.isShow
  115. if (this.isShow) {
  116. this.more = '收起'
  117. } else {
  118. this.more = '更多'
  119. }
  120. },
  121. handleLetter(index, list, letter) {
  122. this.idx = index
  123. this.allDate = list
  124. if (index == 0) {
  125. this.allDate = this.temporary
  126. }
  127. },
  128. handleCurrentBrand(item, index) {
  129. item.check = !item.check
  130. this.allSelect.map((i, idx) => {
  131. if (idx == index) {
  132. i.check = item.check
  133. }
  134. })
  135. },
  136. deleteCurrent(item, index) {
  137. item.check = false
  138. this.allSelect.map((i, idx) => {
  139. if (idx == index) {
  140. i.check = item.check
  141. }
  142. })
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss" scoped>
  148. .mt90 {
  149. margin-top: 90px;
  150. }
  151. .mt20 {
  152. margin-top: 20px;
  153. }
  154. .mt30 {
  155. margin-top: 30px;
  156. }
  157. .por {
  158. position: relative;
  159. }
  160. .poa {
  161. position: absolute;
  162. }
  163. .saga-brand-box {
  164. width: 100%;
  165. padding: 16px;
  166. box-sizing: border-box;
  167. background: rgba(255, 255, 255, 1);
  168. .breadcrumb-content {
  169. display: flex;
  170. border-bottom: 1px solid #EFF0F1;
  171. padding-bottom: 20px;
  172. .total {
  173. text-align: right;
  174. color: #8D9399;
  175. right: 0;
  176. margin-right: 30px;
  177. b {
  178. color: #1F2429;
  179. }
  180. }
  181. .select {
  182. margin-left: 20px;
  183. display: inline-block;
  184. background: #EFF0F1;
  185. padding: 0 10px;
  186. line-height: 20px;
  187. cursor: pointer;
  188. margin-top: -3px;
  189. margin-bottom: 10px;
  190. }
  191. }
  192. .device-sys {
  193. display: flex;
  194. margin-top: 10px;
  195. border-bottom: 1px solid #EFF0F1;
  196. padding-bottom: 10px;
  197. position: relative;
  198. .left {
  199. padding-top: 6px;
  200. color: #8D9399;
  201. width: 50px;
  202. }
  203. .right {
  204. width: 100px;
  205. text-align: center;
  206. padding-top: 6px;
  207. }
  208. .main {
  209. color: #1F2429;
  210. width: 1020px;
  211. max-height: 150px;
  212. overflow: auto;
  213. ul {
  214. li {
  215. display: inline-block;
  216. line-height: 25px;
  217. width: 230px;
  218. margin-right: 20px;
  219. text-align: left;
  220. overflow: hidden;
  221. text-overflow: ellipsis;
  222. white-space: nowrap;
  223. cursor: pointer;
  224. }
  225. }
  226. }
  227. .saga-product-letter {
  228. display: inline-block;
  229. padding: 3px;
  230. background: #EEEEEE;
  231. margin-right: 5px;
  232. font-size: 12px;
  233. cursor: pointer;
  234. }
  235. }
  236. /deep/ .el-breadcrumb__item:first-child .el-breadcrumb__inner:first-child {
  237. color: #8D9399
  238. }
  239. .dark {
  240. color: #8D9399
  241. }
  242. .light {
  243. color: #3A8DDE;
  244. }
  245. .litter-light {
  246. background: #D1E3F4 !important;
  247. color: #3A8DDE;
  248. }
  249. .check {
  250. position: absolute;
  251. top: 5px;
  252. }
  253. .pos-drop {
  254. top: -10px;
  255. left: -80px;
  256. }
  257. .pos-down {
  258. position: relative;
  259. top: -38px;
  260. }
  261. }
  262. </style>