productList.vue 13 KB

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