多租户商城-商户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

521 lines
12 KiB

2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
  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="$t('common.defaulthint')"></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">{{ $t('common.cancel') }}</el-button>
  61. <el-button type="primary" @click="confirmActivity">{{ $t('common.sure') }}</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. import {getShopId} from "@@/utils/auth.js"
  78. export default {
  79. mixins: [toolMixin, sendReqMixin],
  80. name: 'spikeTool',
  81. components: {
  82. ToolSelectLink,
  83. ToolSingleImg,
  84. ToolSelect,
  85. Draggable
  86. },
  87. data () {
  88. return {
  89. radioId: '',
  90. skillActivity: [],
  91. selectSkill: {},
  92. showSkillActivity: false,
  93. title: '', // 标题内容
  94. textInfo: '', // 文本
  95. imgTextData: [
  96. {
  97. title: '',
  98. isShow: true,
  99. imgData: '',
  100. describe: '',
  101. url: ''
  102. }
  103. ],
  104. alignList: [
  105. {
  106. id: 1,
  107. label: '居左',
  108. value: 'left'
  109. },
  110. {
  111. id: 2,
  112. label: '居中',
  113. value: 'center'
  114. }
  115. ],
  116. categoryList: [],
  117. textAlign: 'left',
  118. imgCurrent: null,
  119. dialogVisible: false,
  120. dialogCategory: false,
  121. currentCategory: null,
  122. // categoryName: '', // 类别名称
  123. productList: [], // 产品列表
  124. productNum: 2, // 商品展示数量
  125. labelCurrent: null,
  126. multipleSelection: [], // 多选数据
  127. arrangeList: [
  128. // {
  129. // id: 1,
  130. // type: 'L1',
  131. // name: '一行一个',
  132. // Icon: '&#xe603'
  133. // },
  134. {
  135. id: 2,
  136. type: 'L2',
  137. name: '多行多列',
  138. Icon: '&#xe625'
  139. },
  140. {
  141. id: 3,
  142. type: 'L3',
  143. name: '横向滑动',
  144. Icon: '&#xe624;'
  145. }
  146. ]
  147. }
  148. },
  149. computed: {
  150. ...mapGetters([
  151. 'terminal',
  152. 'typeId'
  153. ])
  154. },
  155. methods: {
  156. ...mapMutations({
  157. setSpikeNum: 'SET_SPIKENUM'
  158. }),
  159. // 时间变换
  160. getDate(row) {
  161. if(this.typeId === 1){
  162. return `${row.startTime}${row.endTime}`
  163. }
  164. if(this.typeId === 3){
  165. return `${row.effectiveStart}${row.effectiveEnd}`
  166. }
  167. },
  168. // 状态变换
  169. getState(row) {
  170. if(this.typeId === 1){
  171. const opt = {
  172. 0:"报名未开始",
  173. 1:"报名进行中",
  174. 2:"活动待开始",
  175. 3:"活动进行中",
  176. 4:"活动已结束"
  177. }
  178. return opt[row.state]
  179. }
  180. if(this.typeId === 3){
  181. const opt = {
  182. 0:"未开始",
  183. 1:"进行中",
  184. 2:"已结束"
  185. }
  186. return opt[row.state]
  187. }
  188. },
  189. // 点击选择活动
  190. selectActivity() {
  191. this.getActivity()
  192. this.showSkillActivity = true
  193. this.radioId = this.activeComponent.componentContent.shopSeckillId
  194. },
  195. // 获取活动数据
  196. getActivity() {
  197. const _ = this
  198. let _url = ''
  199. if(this.typeId===1){
  200. _url = `${api.getPlatformSeckills}`
  201. } else if(this.typeId===3){
  202. _url = `${api.getSeckills}?shopId=${getShopId()}`
  203. }
  204. const params = {
  205. method: 'GET',
  206. url: _url,
  207. }
  208. this.sendReq(params, (res) => {
  209. _.skillActivity = res.data
  210. })
  211. },
  212. // 行点击
  213. rowClick(row) {
  214. this.selectSkill = row;
  215. this.radioId=row.shopSeckillId;
  216. },
  217. // 确认活动选择
  218. confirmActivity() {
  219. if(this.typeId === 1){
  220. let shopSeckillIds = []
  221. let activityNames = []
  222. for(let i=0;i<this.multipleSelection.length;i++){
  223. shopSeckillIds.push(this.multipleSelection[i].seckillId)
  224. activityNames.push(this.multipleSelection[i].seckillName)
  225. }
  226. this.activeComponent.componentContent.shopSeckillId = shopSeckillIds
  227. this.activeComponent.componentContent.activityName = activityNames
  228. }
  229. if(this.typeId === 3){
  230. this.activeComponent.componentContent.shopSeckillId = [this.selectSkill.shopSeckillId]
  231. this.activeComponent.componentContent.activityName = [this.selectSkill.seckillName]
  232. }
  233. this.showSkillActivity = false
  234. this.setSpikeNum()
  235. },
  236. // 取消活动选择
  237. cancelSkill() {
  238. this.showSkillActivity = false;
  239. this.radioId = ''
  240. },
  241. // 替换活动
  242. replaceActivity () {
  243. this.showSkillActivity = true
  244. this.getActivity()
  245. },
  246. // 删除已选活动
  247. deleteActivity (index) {
  248. this.activeComponent.componentContent.activityName.splice(index,1)
  249. this.activeComponent.componentContent.shopSeckillId.splice(index,1)
  250. this.$forceUpdate()
  251. this.setSpikeNum()
  252. },
  253. // 多选改变
  254. handleSelectionChange(val) {
  255. this.multipleSelection = val
  256. console.log(this.multipleSelection)
  257. }
  258. }
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  262. .config-content {
  263. .item {
  264. padding: 12px 0;
  265. border-bottom: 1px #ddd solid;
  266. &:nth-child(1) {
  267. border-top: 1px #ddd solid;
  268. }
  269. }
  270. .label-text {
  271. color: #666;
  272. span {
  273. color: hsl(357, 97%, 49%);
  274. font-size: 20px;
  275. vertical-align: middle;
  276. display: inline-block;
  277. margin-right: 5px;
  278. }
  279. }
  280. .add {
  281. margin-top: 10px;
  282. width: 50px;
  283. height: 50px;
  284. text-align: center;
  285. line-height: 50px;
  286. border:1px #ddd solid;
  287. box-shadow: 0 0 10px #ddd;
  288. .el-icon-plus {
  289. color: blue !important;
  290. }
  291. &:hover {
  292. cursor: pointer;
  293. }
  294. }
  295. }
  296. .brandListTool {
  297. padding: 20px 20px 0px 20px;
  298. h3 {
  299. font-size: 18px;
  300. font-weight: 500;
  301. height: 35px;
  302. line-height: 35px;
  303. color: #333333;
  304. margin-bottom: 20px;
  305. }
  306. .toolBox {
  307. padding-bottom: 10px;
  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. .porListBox {
  479. padding: 10px;
  480. background: #F0F3F4;
  481. .addProduct {
  482. .categoryName {
  483. height: 35px;
  484. display: flex;
  485. align-items: center;
  486. background: #e9e9e9;
  487. border-radius: 4px;
  488. padding: 0 10px;
  489. justify-content: space-between;
  490. margin-bottom: 10px;
  491. span {
  492. color: #333333;
  493. }
  494. span {
  495. color: #333333;
  496. }
  497. .operation {
  498. display: flex;
  499. span {
  500. width: 35px;
  501. display: block;
  502. height: 35px;
  503. line-height: 35px;
  504. text-align: center;
  505. cursor: pointer;
  506. }
  507. }
  508. }
  509. .addProBtn {}
  510. }
  511. }
  512. </style>