spikeTool.vue 12 KB

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