groupTool.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. <template>
  2. <div class="brandListTool">
  3. <h3 class="toolTit">拼团专区</h3>
  4. <!-- <div class="toolBox" v-if="terminal !== 4">-->
  5. <!-- <div class="itemBox">-->
  6. <!-- <label>标题</label>-->
  7. <!-- <el-input v-model="activeComponent.componentContent.title" placeholder="请输入内容"></el-input>-->
  8. <!-- </div>-->
  9. <!-- </div>-->
  10. <div v-if="typeId == 3">
  11. <div class="porListBox">
  12. <div class="addProduct">
  13. <div v-if="!activeComponent.componentContent.activityName" class="addProBtn addImgBtn" @click="selectActivity"><span class="iconfont">&#xe685;</span>选择活动</div>
  14. <div v-else class="categoryName">
  15. <span>{{activeComponent.componentContent.activityName}}</span>
  16. <div class="operation">
  17. <span class="iconfont" @click="replaceActivity">&#xe66c;</span>
  18. <span class="iconfont" @click="deleteActivity">&#xe633;</span>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="styleSelectLine" v-if="terminal == 4">
  25. <div class="blockTit">
  26. <span>排列样式</span>
  27. <span>{{activeComponent.componentContent.arrangeType}}</span>
  28. </div>
  29. <div class="selectCompose">
  30. <div class="composeList">
  31. <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>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="toolBox" v-if="activeComponent.componentContent.arrangeType === '多行多列' && terminal == 4">
  36. <div class="productTit">
  37. <span>展示排数</span>
  38. <span>{{activeComponent.componentContent.productRowNum}}</span>
  39. </div>
  40. <div class="itemBox">
  41. <div class="block">
  42. <el-slider :max="9" :min="1" v-model="activeComponent.componentContent.productRowNum"></el-slider>
  43. </div>
  44. </div>
  45. <div class="productTit">
  46. <span>每排商品数</span>
  47. <span>{{activeComponent.componentContent.productNum}}</span>
  48. </div>
  49. <div class="itemBox">
  50. <div class="block">
  51. <el-slider :max="5" :min="2" v-model="activeComponent.componentContent.productNum"></el-slider>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="itemChoice">
  56. <div class="Tit">查看更多</div>
  57. <div class="Info" v-text="activeComponent.componentContent.showMore ? '显示' : '隐藏'"></div>
  58. <div class="modifyBox">
  59. <el-checkbox v-model="activeComponent.componentContent.showMore"></el-checkbox>
  60. </div>
  61. </div>
  62. <el-dialog title="选择活动" :visible.sync="showSkillActivity" width="900px">
  63. <el-table :data='skillActivity' style="width: 100%" @row-click="rowClick" highlight-current-row>
  64. <el-table-column label width="35">
  65. <template slot-scope="scope">
  66. <el-radio :label="scope.row.shopGroupWorkId" v-model="radioId"/>
  67. </template>
  68. </el-table-column>
  69. <el-table-column
  70. prop="groupName"
  71. label="标题">
  72. </el-table-column>
  73. <el-table-column
  74. :formatter="getDate"
  75. width="400"
  76. label="活动时间">
  77. </el-table-column>
  78. <el-table-column
  79. prop="state"
  80. label="状态"
  81. :formatter='getState'>
  82. </el-table-column>
  83. </el-table>
  84. <span slot="footer" class="dialog-footer">
  85. <el-button @click="cancelSkill">取 消</el-button>
  86. <el-button type="primary" @click="confirmActivity">确 定</el-button>
  87. </span>
  88. </el-dialog>
  89. </div>
  90. </template>
  91. <script>
  92. import Cookies from 'js-cookie'
  93. import Draggable from 'vuedraggable'
  94. import api from '@@/components/canvasShow/config/api'
  95. import {toolMixin} from '@@/config/mixin'
  96. import {sendReqMixin} from '@@/components/canvasShow/config/mixin'
  97. import { mapGetters, mapMutations } from 'vuex'
  98. import ToolSelect from '../toolModule/tool-select'
  99. import ToolSingleImg from '../toolModule/tool-single-img'
  100. import ToolSelectLink from '../toolModule/tool-select-link'
  101. export default {
  102. mixins: [toolMixin, sendReqMixin],
  103. name: 'groupTool',
  104. components: {
  105. ToolSelectLink,
  106. ToolSingleImg,
  107. ToolSelect,
  108. Draggable
  109. },
  110. data () {
  111. return {
  112. radioId: '',
  113. skillActivity: [],
  114. selectSkill: {},
  115. showSkillActivity: false,
  116. title: '', // 标题内容
  117. textInfo: '', // 文本
  118. imgTextData: [
  119. {
  120. title: '',
  121. isShow: true,
  122. imgData: '',
  123. describe: '',
  124. url: ''
  125. }
  126. ],
  127. alignList: [
  128. {
  129. id: 1,
  130. label: '居左',
  131. value: 'left'
  132. },
  133. {
  134. id: 2,
  135. label: '居中',
  136. value: 'center'
  137. }
  138. ],
  139. categoryList: [],
  140. textAlign: 'left',
  141. imgCurrent: null,
  142. dialogVisible: false,
  143. dialogCategory: false,
  144. currentCategory: null,
  145. // categoryName: '', // 类别名称
  146. productList: [], // 产品列表
  147. productNum: 2, // 商品展示数量
  148. labelCurrent: null,
  149. arrangeList: [
  150. // {
  151. // id: 1,
  152. // type: 'L1',
  153. // name: '一行一个',
  154. // Icon: '&#xe603'
  155. // },
  156. {
  157. id: 2,
  158. type: 'L2',
  159. name: '多行多列',
  160. Icon: '&#xe625'
  161. },
  162. {
  163. id: 3,
  164. type: 'L3',
  165. name: '横向滑动',
  166. Icon: '&#xe624;'
  167. }
  168. ]
  169. }
  170. },
  171. computed: {
  172. ...mapGetters([
  173. 'terminal',
  174. 'typeId'
  175. ])
  176. },
  177. methods: {
  178. ...mapMutations({
  179. setGroupNum: 'SET_GROUPNUM'
  180. }),
  181. // 时间变换
  182. getDate(row) {
  183. return `${row.startTime}至${row.endTime}`
  184. },
  185. // 状态变换
  186. getState(row) {
  187. const opt = {
  188. 0:"未开始",
  189. 1:"进行中",
  190. 2:"已结束"
  191. }
  192. return opt[row.state]
  193. },
  194. // 点击选择活动
  195. selectActivity() {
  196. this.getActivity()
  197. this.showSkillActivity = true
  198. this.radioId = this.activeComponent.componentContent.shopGroupWorkId
  199. },
  200. // 获取活动数据
  201. getActivity() {
  202. const _ = this
  203. const params = {
  204. method: 'GET',
  205. url: `${api.getGroupWorks}?shopId=${Cookies.get('shopID')}`,
  206. }
  207. this.sendReq(params, (res) => {
  208. _.skillActivity = res.data
  209. })
  210. },
  211. // 行点击
  212. rowClick(row) {
  213. this.selectSkill = row;
  214. this.radioId=row.shopGroupWorkId;
  215. },
  216. // 确认活动选择
  217. confirmActivity() {
  218. this.activeComponent.componentContent.shopGroupWorkId = this.selectSkill.shopGroupWorkId
  219. this.activeComponent.componentContent.activityName = this.selectSkill.groupName
  220. this.showSkillActivity = false
  221. this.setGroupNum() // 通知画布刷新
  222. },
  223. // 取消活动选择
  224. cancelSkill() {
  225. this.showSkillActivity = false;
  226. this.radioId = ''
  227. },
  228. // 替换活动
  229. replaceActivity () {
  230. this.showSkillActivity = true
  231. this.getActivity()
  232. },
  233. // 删除已选活动
  234. deleteActivity () {
  235. this.activeComponent.componentContent.activityName = ''
  236. this.activeComponent.componentContent.shopGroupWorkId = ''
  237. this.setGroupNum() // 通知画布刷新
  238. this.$forceUpdate()
  239. },
  240. // 布局选择
  241. selectArrange (item) {
  242. this.activeComponent.componentContent.arrangeType = item.name
  243. }
  244. }
  245. }
  246. </script>
  247. <style lang="scss" scoped>
  248. .config-content {
  249. .item {
  250. padding: 12px 0;
  251. border-bottom: 1px #ddd solid;
  252. &:nth-child(1) {
  253. border-top: 1px #ddd solid;
  254. }
  255. }
  256. .label-text {
  257. color: #666;
  258. span {
  259. color: hsl(357, 97%, 49%);
  260. font-size: 20px;
  261. vertical-align: middle;
  262. display: inline-block;
  263. margin-right: 5px;
  264. }
  265. }
  266. .add {
  267. margin-top: 10px;
  268. width: 50px;
  269. height: 50px;
  270. text-align: center;
  271. line-height: 50px;
  272. border:1px #ddd solid;
  273. box-shadow: 0 0 10px #ddd;
  274. .el-icon-plus {
  275. color: blue !important;
  276. }
  277. &:hover {
  278. cursor: pointer;
  279. }
  280. }
  281. }
  282. .brandListTool {
  283. padding: 20px 20px 0px 20px;
  284. h3 {
  285. font-size: 18px;
  286. font-weight: 500;
  287. height: 35px;
  288. line-height: 35px;
  289. color: #333333;
  290. margin-bottom: 20px;
  291. }
  292. .toolBox {
  293. padding-bottom: 10px;
  294. .itemBox {
  295. label {
  296. font-size: 14px;
  297. color: #666666;
  298. height: 40px;
  299. line-height: 40px;
  300. }
  301. margin-bottom: 15px;
  302. }
  303. .textTit {
  304. height: 35px;
  305. line-height: 35px;
  306. font-size: 14px;
  307. color: #333333;
  308. display: flex;
  309. justify-content: space-between;
  310. span {
  311. font-weight: normal;
  312. font-size: 14px;
  313. color: #666666;
  314. }
  315. }
  316. .productTit {
  317. margin-top: 20px;
  318. color: #666666;
  319. height: 35px;
  320. display: flex;
  321. align-items: center;
  322. justify-content: space-between;
  323. span {
  324. font-size: 14px;
  325. color: #666666;
  326. }
  327. }
  328. }
  329. .itemChoice {
  330. font-size: 14px;
  331. display: flex;
  332. margin: 20px 0;
  333. align-items: center;
  334. .Tit {
  335. color: #888888;
  336. margin-right: 10px;
  337. width: 70px;
  338. }
  339. .Info {
  340. color: #222222;
  341. }
  342. .modifyBox {
  343. text-align: right;
  344. margin-left: auto;
  345. span {
  346. height: 26px;
  347. line-height: 26px;
  348. float: left;
  349. display: block;
  350. text-align: center;
  351. cursor: pointer;
  352. width: 30px;
  353. border: 1px solid #E8EAEC;
  354. }
  355. .textActive {
  356. border: 1px solid $mainColor;
  357. color: $mainColor;
  358. }
  359. .colorBox {
  360. display: flex;
  361. align-items: center;
  362. justify-content: flex-end;
  363. span {
  364. margin-right: 10px;
  365. cursor: pointer;
  366. border: none;
  367. color: $mainColor;
  368. }
  369. }
  370. }
  371. .fontSize {
  372. span:nth-child(1) {
  373. font-size: 16px;
  374. }
  375. span:nth-child(2) {
  376. font-size: 14px;
  377. }
  378. span:nth-child(3) {
  379. font-size: 12px;
  380. }
  381. }
  382. }
  383. .moreBox{
  384. border: 1px solid #E8EAEC;
  385. border-radius: 4px;
  386. padding:20px 10px;
  387. .radio{
  388. margin-bottom: 20px;
  389. }
  390. .el-radio{
  391. margin-right: 10px;
  392. }
  393. .link{
  394. display: flex;
  395. justify-content: space-between;
  396. align-items: center;
  397. }
  398. }
  399. .addImgBtn {
  400. border-radius: 4px;
  401. background: $mainColor;
  402. text-align: center;
  403. height: 36px;
  404. color: #ffffff;
  405. font-size: 14px;
  406. display: flex;
  407. align-items: center;
  408. justify-content: center;
  409. cursor: pointer;
  410. span {
  411. font-size: 20px;
  412. margin-right: 5px;
  413. }
  414. }
  415. .labelLisTit{
  416. display: flex;
  417. justify-content: space-between;
  418. margin-bottom: 10px;
  419. }
  420. .labelListWarp{
  421. padding-bottom: 20px;
  422. .imgListBox {
  423. margin-top: 20px;
  424. .item {
  425. border: 1px solid #E8EAEC;
  426. border-radius: 4px;
  427. margin-bottom: 10px;
  428. }
  429. .listItemBox {
  430. .addImgTit {
  431. padding: 10px;
  432. display: flex;
  433. justify-content: space-between;
  434. align-items: center;
  435. background: #F6F7F9;
  436. cursor: pointer;
  437. .titLeft {
  438. display: flex;
  439. align-items: center;
  440. span {
  441. color: #7D7E80;
  442. }
  443. span:nth-child(1) {
  444. font-size: 28px;
  445. }
  446. span:nth-child(2) {
  447. font-size: 25px;
  448. margin: 0 6px;
  449. }
  450. span:nth-child(3) {
  451. font-size: 14px;
  452. }
  453. }
  454. .titRight {
  455. display: flex;
  456. align-items: center;
  457. span:nth-child(1) {
  458. width: 40px;
  459. text-align: center;
  460. display: block;
  461. height: 30px;
  462. line-height: 30px;
  463. }
  464. }
  465. }
  466. .addLabelBox{
  467. padding:0 10px 10px;
  468. .itemBox{
  469. margin-bottom: 20px;
  470. label{
  471. font-size: 14px;
  472. color: #666666;
  473. height: 40px;
  474. line-height: 40px;
  475. }
  476. }
  477. ::v-deep .module-box{
  478. margin-bottom: 10px;
  479. }
  480. }
  481. .deleteItem {
  482. padding: 10px;
  483. display: flex;
  484. align-items: center;
  485. justify-content: center;
  486. background: #F6F7F9;
  487. cursor: pointer;
  488. color: $mainColor;
  489. font-size: 14px;
  490. span {
  491. font-size: 16px;
  492. margin-right: 5px;
  493. }
  494. }
  495. }
  496. }
  497. }
  498. }
  499. .styleSelectLine{
  500. margin-top: 30px;
  501. .blockTit{
  502. span{
  503. margin-right: 16px;
  504. &:last-child{
  505. color: $mainColor;
  506. }
  507. }
  508. }
  509. .composeList{
  510. display: flex;
  511. flex-wrap: wrap;
  512. padding-top: 20px;
  513. .item{
  514. width: 50px;
  515. height: 30px;
  516. display: flex;
  517. align-items: center;
  518. justify-content: center;
  519. border: 1px solid #E8EAEC;
  520. color: #999999;
  521. font-size: 18px;
  522. text-align: center;
  523. cursor: pointer;
  524. &:hover,&.active{
  525. color: #FF7800;
  526. border: 1px solid #FF7800;
  527. }
  528. }
  529. }
  530. }
  531. .porListBox {
  532. margin-top: 10px;
  533. padding: 10px;
  534. background: #F0F3F4;
  535. .addProduct {
  536. .categoryName {
  537. height: 35px;
  538. display: flex;
  539. align-items: center;
  540. background: #e9e9e9;
  541. border-radius: 4px;
  542. padding: 0 10px;
  543. justify-content: space-between;
  544. span {
  545. color: #333333;
  546. }
  547. span {
  548. color: #333333;
  549. }
  550. .operation {
  551. display: flex;
  552. span {
  553. width: 35px;
  554. display: block;
  555. height: 35px;
  556. line-height: 35px;
  557. text-align: center;
  558. cursor: pointer;
  559. }
  560. }
  561. }
  562. .addProBtn {}
  563. }
  564. }
  565. </style>