productList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <template>
  2. <div class="brandListTool">
  3. <h3 class="toolTit">商品列表</h3>
  4. <div class="toolBox">
  5. <!-- <div class="itemBox" v-if="terminal !== 4">-->
  6. <!-- <label>标题</label>-->
  7. <!-- <el-input v-model="activeComponent.componentContent.title" placeholder="请输入内容"></el-input>-->
  8. <!-- </div>-->
  9. <tool-product-source :productData.sync='activeComponent.componentContent.productData' :type="activeComponent.type"></tool-product-source>
  10. <div class="styleSelectLine">
  11. <div class="blockTit">
  12. <span>排列样式</span>
  13. <span>{{activeComponent.componentContent.arrangeType}}</span>
  14. </div>
  15. <div class="selectCompose">
  16. <div class="composeList">
  17. <span class="item iconfont" :class="{active: activeComponent.componentContent.arrangeType === item.name}" @click="selectArrange(item)" v-for="(item) of arrangeList" :key="item.id" v-html="item.Icon"></span>
  18. </div>
  19. </div>
  20. </div>
  21. <div v-if="activeComponent.componentContent.arrangeType === '多行多列' && terminal == 4">
  22. <div class="productTit">
  23. <span>展示排数</span>
  24. <span>{{activeComponent.componentContent.productRowNum}}</span>
  25. </div>
  26. <div class="itemBox">
  27. <div class="block">
  28. <el-slider :max="9" :min="1" v-model="activeComponent.componentContent.productRowNum"></el-slider>
  29. </div>
  30. </div>
  31. <div class="productTit">
  32. <span>每排商品数</span>
  33. <span>{{activeComponent.componentContent.productNum}}</span>
  34. </div>
  35. <div class="itemBox">
  36. <div class="block">
  37. <el-slider :max="5" :min="2" v-model="activeComponent.componentContent.productNum"></el-slider>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="itemChoice">
  42. <div class="Tit">查看更多</div>
  43. <div class="Info" v-text="activeComponent.componentContent.showMore ? '显示' : '隐藏'"></div>
  44. <div class="modifyBox">
  45. <el-checkbox v-model="activeComponent.componentContent.showMore"></el-checkbox>
  46. </div>
  47. </div>
  48. <!-- <div class="moreBox" v-show="activeComponent.componentContent.showMore">-->
  49. <!-- <div class="link">-->
  50. <!-- <tool-select-link :linkObj.sync='activeComponent.componentContent.linkObj' styleType="1"></tool-select-link>-->
  51. <!-- </div>-->
  52. <!-- </div>-->
  53. </div>
  54. <el-dialog
  55. title="提示"
  56. :visible.sync="dialogVisible"
  57. width="30%"
  58. :before-close="deleteItem">
  59. <span>点击确定删除此项</span>
  60. <span slot="footer" class="dialog-footer">
  61. <el-button @click="dialogVisible = false">取 消</el-button>
  62. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  63. </span>
  64. </el-dialog>
  65. </div>
  66. </template>
  67. <script>
  68. import Draggable from 'vuedraggable'
  69. import {toolMixin} from '@@/config/mixin'
  70. import { mapGetters } from 'vuex'
  71. import ToolSelect from '../toolModule/tool-select'
  72. import ToolSingleImg from '../toolModule/tool-single-img'
  73. import ToolSelectLink from '../toolModule/tool-select-link'
  74. import ToolProductSource from '../toolModule/tool-product-source'
  75. export default {
  76. mixins: [toolMixin],
  77. name: 'productListTool',
  78. components: {
  79. ToolProductSource,
  80. ToolSelectLink,
  81. ToolSingleImg,
  82. ToolSelect,
  83. Draggable
  84. },
  85. data () {
  86. return {
  87. title: '', // 标题内容
  88. textInfo: '', // 文本
  89. imgTextData: [
  90. {
  91. title: '',
  92. isShow: true,
  93. imgData: '',
  94. describe: '',
  95. url: ''
  96. }
  97. ],
  98. alignList: [
  99. {
  100. id: 1,
  101. label: '居左',
  102. value: 'left'
  103. },
  104. {
  105. id: 2,
  106. label: '居中',
  107. value: 'center'
  108. }
  109. ],
  110. textAlign: 'left',
  111. imgCurrent: null,
  112. dialogVisible: false,
  113. currentCategory: null,
  114. // categoryName: '', // 类别名称
  115. productList: [], // 产品列表
  116. productNum: 2, // 商品展示数量
  117. labelCurrent: null,
  118. arrangePCList: [
  119. {
  120. id: 1,
  121. type: 'L2',
  122. name: '多行多列',
  123. Icon: '&#xe625'
  124. },
  125. {
  126. id: 2,
  127. type: 'L2',
  128. name: '横向滑动',
  129. Icon: '&#xe624;'
  130. }
  131. ],
  132. arrangeAppList: [
  133. {
  134. id: 1,
  135. type: 'L1',
  136. name: '多行多列',
  137. Icon: '&#xe625'
  138. },
  139. {
  140. id: 2,
  141. type: 'L2',
  142. name: '横向滑动',
  143. Icon: '&#xe624;'
  144. },
  145. ]
  146. }
  147. },
  148. computed: {
  149. ...mapGetters([
  150. 'terminal'
  151. ]),
  152. arrangeList(){
  153. if(this.terminal == 4){
  154. return this.arrangePCList
  155. } else {
  156. return this.arrangeAppList
  157. }
  158. }
  159. },
  160. methods: {
  161. openAddImg (item, index) {
  162. if (this.imgCurrent === index) {
  163. this.imgCurrent = null
  164. return false
  165. }
  166. this.imgCurrent = index
  167. },
  168. // 添加图文
  169. addImgText () {
  170. this.activeComponent.componentContent.imgTextData.push({
  171. title: '',
  172. isShow: true,
  173. imgData: '',
  174. url: ''
  175. })
  176. },
  177. // 删除内容
  178. deleteItem (item, index) {
  179. this.$confirm('确定删除此项?')
  180. .then(_ => {
  181. this.activeComponent.componentContent.imgTextData.splice(index, 1)
  182. })
  183. .catch(_ => {})
  184. },
  185. handleAvatarSuccess (res, file) {
  186. this.imageUrl = URL.createObjectURL(file.raw)
  187. },
  188. // 标签手风琴
  189. openAddLabel (item, index) {
  190. if (this.labelCurrent === index) {
  191. this.labelCurrent = null
  192. return false
  193. }
  194. this.labelCurrent = index
  195. },
  196. // 添加标签
  197. addLabel () {
  198. this.activeComponent.componentContent.labelList.push({
  199. name: '',
  200. url: ''
  201. })
  202. },
  203. // 删除标签
  204. deleteLabelItem (item, index) {
  205. this.$confirm('确定删除此项?')
  206. .then(_ => {
  207. this.activeComponent.componentContent.labelList.splice(index, 1)
  208. })
  209. .catch(_ => {})
  210. },
  211. // 布局选择
  212. selectArrange (item) {
  213. this.activeComponent.componentContent.arrangeType = item.name
  214. }
  215. }
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. .brandListTool {
  220. padding: 20px 20px 0px 20px;
  221. h3 {
  222. font-size: 18px;
  223. font-weight: 500;
  224. height: 35px;
  225. line-height: 35px;
  226. color: #333333;
  227. margin-bottom: 20px;
  228. }
  229. .toolBox {
  230. padding-bottom: 10px;
  231. .itemChoice {
  232. font-size: 14px;
  233. display: flex;
  234. margin: 20px 0;
  235. align-items: center;
  236. .Tit {
  237. color: #888888;
  238. margin-right: 10px;
  239. width: 70px;
  240. }
  241. .Info {
  242. color: #222222;
  243. }
  244. .modifyBox {
  245. text-align: right;
  246. margin-left: auto;
  247. span {
  248. height: 26px;
  249. line-height: 26px;
  250. float: left;
  251. display: block;
  252. text-align: center;
  253. cursor: pointer;
  254. width: 30px;
  255. border: 1px solid #E8EAEC;
  256. }
  257. .textActive {
  258. border: 1px solid $mainColor;
  259. color: $mainColor;
  260. }
  261. .colorBox {
  262. display: flex;
  263. align-items: center;
  264. justify-content: flex-end;
  265. span {
  266. margin-right: 10px;
  267. cursor: pointer;
  268. border: none;
  269. color: $mainColor;
  270. }
  271. }
  272. }
  273. .fontSize {
  274. span:nth-child(1) {
  275. font-size: 16px;
  276. }
  277. span:nth-child(2) {
  278. font-size: 14px;
  279. }
  280. span:nth-child(3) {
  281. font-size: 12px;
  282. }
  283. }
  284. }
  285. .moreBox{
  286. border: 1px solid #E8EAEC;
  287. border-radius: 4px;
  288. padding:20px 10px;
  289. .radio{
  290. margin-bottom: 20px;
  291. }
  292. .el-radio{
  293. margin-right: 10px;
  294. }
  295. .link{
  296. display: flex;
  297. justify-content: space-between;
  298. align-items: center;
  299. }
  300. }
  301. .itemBox {
  302. label {
  303. font-size: 14px;
  304. color: #666666;
  305. height: 40px;
  306. line-height: 40px;
  307. }
  308. margin-bottom: 15px;
  309. }
  310. .textTit {
  311. height: 35px;
  312. line-height: 35px;
  313. font-size: 14px;
  314. color: #333333;
  315. display: flex;
  316. justify-content: space-between;
  317. span {
  318. font-weight: normal;
  319. font-size: 14px;
  320. color: #666666;
  321. }
  322. }
  323. .productTit {
  324. margin-top: 20px;
  325. color: #666666;
  326. height: 35px;
  327. display: flex;
  328. align-items: center;
  329. justify-content: space-between;
  330. span {
  331. font-size: 14px;
  332. color: #666666;
  333. }
  334. }
  335. }
  336. // ::v-deep .el-select {
  337. // width: 100%;
  338. //}
  339. .addImgBtn {
  340. border-radius: 4px;
  341. background: $mainColor;
  342. text-align: center;
  343. height: 36px;
  344. color: #ffffff;
  345. font-size: 14px;
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. cursor: pointer;
  350. span {
  351. font-size: 20px;
  352. margin-right: 5px;
  353. }
  354. }
  355. .labelLisTit{
  356. display: flex;
  357. justify-content: space-between;
  358. margin-bottom: 10px;
  359. }
  360. .labelListWarp{
  361. padding-bottom: 20px;
  362. .imgListBox {
  363. margin-top: 20px;
  364. .item {
  365. border: 1px solid #E8EAEC;
  366. border-radius: 4px;
  367. margin-bottom: 10px;
  368. }
  369. .listItemBox {
  370. .addImgTit {
  371. padding: 10px;
  372. display: flex;
  373. justify-content: space-between;
  374. align-items: center;
  375. background: #F6F7F9;
  376. cursor: pointer;
  377. .titLeft {
  378. display: flex;
  379. align-items: center;
  380. span {
  381. color: #7D7E80;
  382. }
  383. span:nth-child(1) {
  384. font-size: 28px;
  385. }
  386. span:nth-child(2) {
  387. font-size: 25px;
  388. margin: 0 6px;
  389. }
  390. span:nth-child(3) {
  391. font-size: 14px;
  392. }
  393. }
  394. .titRight {
  395. display: flex;
  396. align-items: center;
  397. span:nth-child(1) {
  398. width: 40px;
  399. text-align: center;
  400. display: block;
  401. height: 30px;
  402. line-height: 30px;
  403. }
  404. }
  405. }
  406. .addLabelBox{
  407. padding:0 10px 10px;
  408. .itemBox{
  409. margin-bottom: 20px;
  410. label{
  411. font-size: 14px;
  412. color: #666666;
  413. height: 40px;
  414. line-height: 40px;
  415. }
  416. }
  417. ::v-deep .module-box{
  418. margin-bottom: 10px;
  419. }
  420. }
  421. .deleteItem {
  422. padding: 10px;
  423. display: flex;
  424. align-items: center;
  425. justify-content: center;
  426. background: #F6F7F9;
  427. cursor: pointer;
  428. color: $mainColor;
  429. font-size: 14px;
  430. span {
  431. font-size: 16px;
  432. margin-right: 5px;
  433. }
  434. }
  435. }
  436. }
  437. }
  438. }
  439. .styleSelectLine{
  440. margin-top: 30px;
  441. .blockTit{
  442. span{
  443. margin-right: 16px;
  444. &:last-child{
  445. color: $mainColor;
  446. }
  447. }
  448. }
  449. .composeList{
  450. display: flex;
  451. flex-wrap: wrap;
  452. padding-top: 20px;
  453. .item{
  454. width: 50px;
  455. height: 30px;
  456. display: flex;
  457. align-items: center;
  458. justify-content: center;
  459. border: 1px solid #E8EAEC;
  460. color: #999999;
  461. font-size: 18px;
  462. text-align: center;
  463. cursor: pointer;
  464. &:hover,&.active{
  465. color: #FF7800;
  466. border: 1px solid #FF7800;
  467. }
  468. }
  469. }
  470. }
  471. </style>