多租户商城-商户端
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.

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