From 37ab37774a2d10da2fd2c07ec35a17767b3764e9 Mon Sep 17 00:00:00 2001 From: Sigo Date: Thu, 23 Jun 2022 15:55:30 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=8F=91=E5=B8=83=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=97=A8=E5=BA=97=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/mulStore/index.vue | 64 +++ src/components/mulStore/单选多选门店 | 1 + .../discount-coupon/issue/components/edit.vue | 135 +++++-- src/style/app.css | 374 +++++++++--------- 4 files changed, 348 insertions(+), 226 deletions(-) create mode 100644 src/components/mulStore/index.vue create mode 100644 src/components/mulStore/单选多选门店 diff --git a/src/components/mulStore/index.vue b/src/components/mulStore/index.vue new file mode 100644 index 0000000..37195f9 --- /dev/null +++ b/src/components/mulStore/index.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/src/components/mulStore/单选多选门店 b/src/components/mulStore/单选多选门店 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/components/mulStore/单选多选门店 @@ -0,0 +1 @@ + diff --git a/src/pages/discount-coupon/issue/components/edit.vue b/src/pages/discount-coupon/issue/components/edit.vue index 5d8ea9c..68e0f78 100644 --- a/src/pages/discount-coupon/issue/components/edit.vue +++ b/src/pages/discount-coupon/issue/components/edit.vue @@ -11,34 +11,50 @@ - 代金券 - 折扣券 - 代扣券 + + 代金券 + 折扣券 + 代扣券 + + + + + + + - 满减 - 没有限制 + + 满减 + 没有限制 + - + - 所有门店 - 指定门店 + + 所有门店 + 指定门店 + 选择门店 - 所有项目 - 指定项目 + + 所有项目 + 指定项目 + 选择项目 - 领取后多少天 - 固定日期 + + 领取后多少天 + 固定日期 + @@ -46,19 +62,21 @@ - - + + - 固定提成 - 单据金额抽成(%) + + 固定提成 + 单据金额抽成(%) + - + - + @@ -75,15 +93,16 @@ + diff --git a/src/style/app.css b/src/style/app.css index a6b300e..344bd78 100644 --- a/src/style/app.css +++ b/src/style/app.css @@ -1,187 +1,187 @@ -/* 主题样式 */ - -.el-aside { - /* background: #f78989; */ - /* background: linear-gradient(#f78989, #d69c9c); */ - /* background-color: #1873d4; */ - background: linear-gradient(#51a5ff, #1873d4); - - /* 随着.el-menu-item background:rgb(247, 137, 137) !important;一起变 */ - /* background: rgb(247, 137, 137); */ - height: 100%; - font-family: "幼圆"; - font-weight: 700; - color: rgb(207, 207, 207) !important; - -} - -.collapse:hover { - /* 收缩菜单按钮样式 */ - /* background: #fc9ca7; */ - background-color: linear-gradient(#fc3b3b, #2375f0); - box-shadow: #51a5ff 10px 10px 8px; -} - -/* 菜单 */ -.el-submenu .el-menu-item { - height: 35px; - line-height: 35px; -} - -/* 图标 */ -.el-submenu [class^=el-icon-] { - font-size: 16px; -} - -/* 一级菜单字体 */ -.el-submenu__title span { - font-size: 14px; -} - -.el-menu-item, -.el-submenu__title { - /* 一级菜单 */ - height: 50px; - line-height: 50px; -} - -/* 二级菜单字体 */ -.el-menu-item { - font-size: 12px; -} - - -.el-menu-vertical-demo { - /*菜单列表样式*/ - padding-bottom: 10px; -} - -.el-menu-item.is-active { - /* background-color: #fc7483 !important; */ - /* 右边菜单样式 */ - /* background-color: linear-gradient(#f78989, #f78989); */ - /* background-color: #1873d4; */ - /* background: linear-gradient(#1873d4, #51a5ff); */ - color: rgb(207, 207, 207) !important; -} - -.el-menu-item:focus { - background-color: none !important; -} - -.el-menu { - /* 右边菜单样式 */ - /* background: linear-gradient(#f78989, #fdb3b3); */ - /* background-color: #1873d4; */ - background: linear-gradient(#1873d4, #51a5ff); - -} - -.el-submenu .is-active { - /* 菜单栏选中样式 */ - min-width: 64px; - border: none; - /* background: #f0eeef; */ - /* background: linear-gradient(#f78989, #a1c5fc); */ - background: linear-gradient(#5aa7fa, #116cce) !important; - - -} - -.el-submenu__title:hover, -.el-menu-item:hover { - /* 菜单鼠标覆盖样式 */ - /* background: linear-gradient(#f78989, #a1c5fc) !important; */ - background: linear-gradient(#5aa7fa, #116cce) !important; - - -} - -html, -body { - /* 主题样式 */ - height: 100%; - overflow: auto; - /* background: linear-gradient(#ffffff, #f9f9f9); */ - background-color: #5e9af5; -} - -.el-header { - /* 头部样式 */ - /* background: linear-gradient(#fda1a1, #fd7b7b); */ - /* background-color: #1873d4; */ - background: linear-gradient(#6cb3ff, #1873d4); - - border-top: 2px solid linear-gradient(#f78989, #5e9af5); - width: 100%; - z-index: 98; - padding: 0 !important; -} - - -/* 面包屑导航样式 */ - - -/* ------------------- */ - - -/* ------------------- */ - - -/* 搜索 */ - - -/* .el-form-item label:after { - content: " "; - display: inline-block; - width: 100%; -} -.el-form-item__label { - text-align: justify -} -.el-form-item.is-required .el-form-item__label:before { - content: none !important; -} */ -.el-radio__input.is-checked .el-radio__inner { - border-color: #f78989; - background: #f78989; -} - -.el-radio__input.is-checked+.el-radio__label { - color: #f78989; -} - -.max-height-60 { - max-height: 60vh; - overflow: auto; -} - -.max-height-55 { - max-height: 55vh; - overflow: auto; -} - -.max-height-50 { - max-height: 50vh; - overflow: auto; -} - -.max-height-45 { - max-height: 45vh; - overflow: auto; -} - -.max-height-40 { - max-height: 40vh; - overflow: auto; -} - -.max-height-65 { - max-height: 65vh; - overflow: auto; -} - -.max-height-35 { - max-height: 35vh; - overflow: auto; -} +/* 主题样式 */ + +.el-aside { + /* background: #f78989; */ + /* background: linear-gradient(#f78989, #d69c9c); */ + /* background-color: #1873d4; */ + background: linear-gradient(#51a5ff, #1873d4); + + /* 随着.el-menu-item background:rgb(247, 137, 137) !important;一起变 */ + /* background: rgb(247, 137, 137); */ + height: 100%; + font-family: "幼圆"; + font-weight: 700; + color: rgb(207, 207, 207) !important; + +} + +.collapse:hover { + /* 收缩菜单按钮样式 */ + /* background: #fc9ca7; */ + background-color: linear-gradient(#fc3b3b, #2375f0); + box-shadow: #51a5ff 10px 10px 8px; +} + +/* 菜单 */ +.el-submenu .el-menu-item { + height: 35px; + line-height: 35px; +} + +/* 图标 */ +.el-submenu [class^=el-icon-] { + font-size: 16px; +} + +/* 一级菜单字体 */ +.el-submenu__title span { + font-size: 14px; +} + +.el-menu-item, +.el-submenu__title { + /* 一级菜单 */ + height: 50px; + line-height: 50px; +} + +/* 二级菜单字体 */ +.el-menu-item { + font-size: 12px; +} + + +.el-menu-vertical-demo { + /*菜单列表样式*/ + padding-bottom: 10px; +} + +.el-menu-item.is-active { + /* background-color: #fc7483 !important; */ + /* 右边菜单样式 */ + /* background-color: linear-gradient(#f78989, #f78989); */ + /* background-color: #1873d4; */ + /* background: linear-gradient(#1873d4, #51a5ff); */ + color: rgb(207, 207, 207) !important; +} + +.el-menu-item:focus { + background-color: none !important; +} + +.el-menu { + /* 右边菜单样式 */ + /* background: linear-gradient(#f78989, #fdb3b3); */ + /* background-color: #1873d4; */ + background: linear-gradient(#1873d4, #51a5ff); + +} + +.el-submenu .is-active { + /* 菜单栏选中样式 */ + min-width: 64px; + border: none; + /* background: #f0eeef; */ + /* background: linear-gradient(#f78989, #a1c5fc); */ + background: linear-gradient(#5aa7fa, #116cce) !important; + + +} + +.el-submenu__title:hover, +.el-menu-item:hover { + /* 菜单鼠标覆盖样式 */ + /* background: linear-gradient(#f78989, #a1c5fc) !important; */ + background: linear-gradient(#5aa7fa, #116cce) !important; + + +} + +html, +body { + /* 主题样式 */ + height: 100%; + overflow: auto; + /* background: linear-gradient(#ffffff, #f9f9f9); */ + background-color: #5e9af5; +} + +.el-header { + /* 头部样式 */ + /* background: linear-gradient(#fda1a1, #fd7b7b); */ + /* background-color: #1873d4; */ + background: linear-gradient(#6cb3ff, #1873d4); + + border-top: 2px solid linear-gradient(#f78989, #5e9af5); + width: 100%; + z-index: 98; + padding: 0 !important; +} + + +/* 面包屑导航样式 */ + + +/* ------------------- */ + + +/* ------------------- */ + + +/* 搜索 */ + + +/* .el-form-item label:after { + content: " "; + display: inline-block; + width: 100%; +} +.el-form-item__label { + text-align: justify +} +.el-form-item.is-required .el-form-item__label:before { + content: none !important; +} */ +/* .el-radio__input.is-checked .el-radio__inner { + border-color: #f78989; + background: #f78989; +} + +.el-radio__input.is-checked+.el-radio__label { + color: #f78989; +} */ + +.max-height-60 { + max-height: 60vh; + overflow: auto; +} + +.max-height-55 { + max-height: 55vh; + overflow: auto; +} + +.max-height-50 { + max-height: 50vh; + overflow: auto; +} + +.max-height-45 { + max-height: 45vh; + overflow: auto; +} + +.max-height-40 { + max-height: 40vh; + overflow: auto; +} + +.max-height-65 { + max-height: 65vh; + overflow: auto; +} + +.max-height-35 { + max-height: 35vh; + overflow: auto; +} From 699fd06fd95a9910782eb908e33151862f351288 Mon Sep 17 00:00:00 2001 From: Sigo Date: Mon, 27 Jun 2022 09:34:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/discount-coupon/management.js | 23 +++ src/components/mulProject/index.vue | 104 +++++++++++++ src/components/mulProject/单选多选项目 | 1 + src/components/mulStore/index.vue | 39 +++-- .../issue/components/complete.vue | 13 +- .../discount-coupon/issue/components/edit.vue | 68 +++++++- .../issue/components/template.vue | 59 ++++++- src/pages/discount-coupon/issue/index.vue | 7 +- .../components/{add.vue => Edit.vue} | 2 +- .../discount-coupon/management/index.vue | 122 ++++++++++++--- src/pages/discount-coupon/record/index.vue | 2 +- src/utils/partten/partten.js | 145 +++++++++--------- 12 files changed, 456 insertions(+), 129 deletions(-) create mode 100644 src/components/mulProject/index.vue create mode 100644 src/components/mulProject/单选多选项目 rename src/pages/discount-coupon/management/components/{add.vue => Edit.vue} (95%) diff --git a/src/api/discount-coupon/management.js b/src/api/discount-coupon/management.js index 065724c..f9c6386 100644 --- a/src/api/discount-coupon/management.js +++ b/src/api/discount-coupon/management.js @@ -10,3 +10,26 @@ export function getList(params) { params }); } +// 编辑 +export function doEdit(data) { + return service({ + url: "/platformCoupon/update", + method: "put", + data + }); +} +// 删除 +export function doDelete(id) { + return service({ + url: "/platformCoupon/" + id, + method: "delete", + }); +} +// 审核 +export function doAudit(data) { + return service({ + url: "/platformCoupon/shopCheck", + method: "post", + data + }); +} diff --git a/src/components/mulProject/index.vue b/src/components/mulProject/index.vue new file mode 100644 index 0000000..2ab92c8 --- /dev/null +++ b/src/components/mulProject/index.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/src/components/mulProject/单选多选项目 b/src/components/mulProject/单选多选项目 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/components/mulProject/单选多选项目 @@ -0,0 +1 @@ + diff --git a/src/components/mulStore/index.vue b/src/components/mulStore/index.vue index 37195f9..3149620 100644 --- a/src/components/mulStore/index.vue +++ b/src/components/mulStore/index.vue @@ -1,6 +1,6 @@ diff --git a/src/pages/discount-coupon/issue/components/template.vue b/src/pages/discount-coupon/issue/components/template.vue index 66e4d62..b90b309 100644 --- a/src/pages/discount-coupon/issue/components/template.vue +++ b/src/pages/discount-coupon/issue/components/template.vue @@ -5,17 +5,28 @@
+
+
+ +
+
+
领取
+
分享
+
+
+
+ +
@@ -53,9 +64,12 @@ export default { }, // 提交 async handleSubmit() { + let form = Object.assign({}, this.form); + form.useStoreList = form.useStoreList.map(item => item.storeNum); + form.projectList = form.projectList.map(item => item.projectId); let format = new FormData() - Object.keys(this.form).map(key => { - format.append(key, this.form[key]) + Object.keys(form).map(key => { + format.append(key, form[key]) }) let { code } = await doAdd(format) if (code == '000000') { @@ -65,11 +79,22 @@ export default { }); this.$emit('next', 3) } + if (code == '010000') { + this.$message({ + message: '发布失败', + type: 'error' + }); + } }, }, } diff --git a/src/pages/discount-coupon/issue/components/edit.vue b/src/pages/discount-coupon/issue/components/edit.vue index 859edc8..7c4ea39 100644 --- a/src/pages/discount-coupon/issue/components/edit.vue +++ b/src/pages/discount-coupon/issue/components/edit.vue @@ -8,7 +8,7 @@
- + @@ -75,10 +75,13 @@ - + - + + + + @@ -104,6 +107,7 @@ import ActiveImg from './activeImg' import Store from '@/components/mulStore/index' import Project from '@/components/mulProject/index' +import { partten } from "@/utils/partten/index.js"; export default { name: 'Form', components: { ActiveImg, Store, Project }, @@ -170,19 +174,35 @@ export default { { required: true, message: '请输入单据金额抽成(%', trigger: 'blur' }, ], imageUrl: [{ required: true, message: '请上传活动图片', trigger: ['blur', 'change'] }], + guaranteeMoney: [{ required: true, message: '请输入保证金', trigger: ['blur', 'change'] }], }, } }, methods: { // ============================== 操作 ============================== // + // 编辑 + handleData(row) { + // 判断传过来的值中时候有id来判断当前是新增的还是编辑的数据,有id的为编辑数据 + if (row.id) { + // 从管理页面过来useStoreList和projectList空所以取的是useStores和useProjects中的值,如果是从预览页面,即步骤2过来的就直接取useStoreList和projectList中的值 + row.useStoreList = row.useStoreList ? row.useStoreList : Array.from(row.useStores); + row.projectList = row.projectList ? row.projectList : Array.from(row.useProjects); + // 因为是编辑,所以需要将图片的链接拼接出来,将之前上传的图片展示出来,但是如果已经选了其它图片就直接使用当前的imageUrl路径 + row.imageUrl = row.imageUrl ? row.imageUrl : partten.imagePath + row.fileLists[0].filePath + '/' + row.fileLists[0].fileName + // 因为后台需要的是一个拆开的两个时间不是一个时间数组,element的时间组件获取的值时时间数组所以需要自定义一个fixDate值来接受,新增提交时拆开,现在编辑需要重新将两个值组合回一个时间数组 + row.fixDate = Array.from([row.startDate, row.endDate]); + // 展示图片,因为一开始展示页面,当前页面的子组件也是刚加载无法立马使用this.$refs获取,需要用this.$nextTick来过度一下 + this.$nextTick(function () { + this.$refs.activeImg.show(row.imageUrl) + }); + } + this.form = Object.assign({}, row); + }, // 下一步 handleNext() { this.$refs.form.validate((valid) => { if (valid) { - let form = Object.assign({}, this.form); - delete form.fixDate - delete form.imageUrl - this.$emit('next', 2, form) + this.$emit('next', 2, this.form) } else { return false } @@ -215,7 +235,7 @@ export default { handleImage(file) { let form = Object.assign({}, this.form); form.multipartFile = file - form.imageUrl = true + form.imageUrl = URL.createObjectURL(file) this.form = Object.assign({}, form); this.$nextTick(function () { this.$refs.form.validateField(['imageUrl']) @@ -250,6 +270,17 @@ export default { this.$nextTick(function () { this.$refs.form.validateField(['projectList']) }); + }, + // 计算保证金 + handleCalculate() { + let form = Object.assign({}, this.form); + // 固定提成方式:保证金(guaranteeMoney) = 优惠券数量(couponNumber) * 固定提成(元)(fixedAmount) + // 单据金额抽成:保证金(guaranteeMoney) = 当前默认10000元 + if (form.shareCommissionRules === 0) { + if (form.couponNumber && form.fixedAmount) { + // form.guaranteeMoney = + } + } } }, } diff --git a/src/pages/discount-coupon/issue/components/pay.vue b/src/pages/discount-coupon/issue/components/pay.vue new file mode 100644 index 0000000..e1ff347 --- /dev/null +++ b/src/pages/discount-coupon/issue/components/pay.vue @@ -0,0 +1,92 @@ + + + + diff --git a/src/pages/discount-coupon/issue/components/template.vue b/src/pages/discount-coupon/issue/components/template.vue index b90b309..56f6cef 100644 --- a/src/pages/discount-coupon/issue/components/template.vue +++ b/src/pages/discount-coupon/issue/components/template.vue @@ -41,7 +41,7 @@ diff --git a/src/pages/discount-coupon/issue/index.vue b/src/pages/discount-coupon/issue/index.vue index a04f8ec..2fc5a4f 100644 --- a/src/pages/discount-coupon/issue/index.vue +++ b/src/pages/discount-coupon/issue/index.vue @@ -20,6 +20,8 @@ import Complete from './components/complete' import Edit from './components/edit' import Templates from './components/template' +import Bus from "../../bus"; + export default { name: 'Form', components: { Templates, Edit, Complete }, @@ -30,19 +32,52 @@ export default { } }, created() { - + if (this.$route.params.id) { + this.$nextTick(function () { + this.$refs.edit.handleData(this.$route.params) + }); + } else { + this.$nextTick(function () { + this.$refs.edit.handleData({ + couponNumber: 1, + useStoreList: [], + projectList: [], + }) + }); + } + }, + watch: { + $route(to, from) { + if (to.fullPath == '/couponIssue' && to.params.id) { + this.$nextTick(function () { + this.$refs.edit.handleData(to.params) + }); + } else { + this.$nextTick(function () { + this.$refs.edit.handleData({ + couponNumber: 1, + useStoreList: [], + projectList: [], + }) + }); + } + } }, methods: { // 下一步/上一步 + // active=1为填写信息,active=2为预览,active=3为完成 handleNext(active, form) { this.active = active + this.form = Object.assign({}, form); + // 判断active的值,看目前需要 调用哪个组件的ref值,1=edit,2=templates,3=complete let activeName = active == 1 ? 'edit' : active == 2 ? 'templates' : 'complete' - if (activeName == 'templates') { + // 为了让填写信息和预览这两个步骤来回穿梭而不影响值,将form值来回传递 + if (activeName == 'templates' || (activeName == 'edit' && this.form)) { this.$nextTick(function () { - this.$refs[activeName].handleData(form) + this.$refs[activeName].handleData(this.form) }); } - if (active === 1) { + if (active === 1 && !this.form) { // 发布后清除选择的文件 this.$nextTick(function () { this.$refs.edit.handleClear() diff --git a/src/pages/discount-coupon/management/index.vue b/src/pages/discount-coupon/management/index.vue index 60e76f6..8d4303f 100644 --- a/src/pages/discount-coupon/management/index.vue +++ b/src/pages/discount-coupon/management/index.vue @@ -25,6 +25,7 @@ 回收 审核 反审核 + 审核失败 @@ -71,22 +72,24 @@ {{row.shareCommissionRules===0?'固定提成(元)':row.shareCommissionRules===1?'单据金额抽成(%)':''}} - - - + + + + - +