From d1cf8db0b07b239e02c7f67fc7cf41b66fd522fe Mon Sep 17 00:00:00 2001 From: Sigo Date: Mon, 27 Jun 2022 15:18:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=B7=AE=E4=BF=9D=E8=AF=81?= =?UTF-8?q?=E9=87=91=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/discount-coupon/management.js | 8 ++ .../issue/components/activeImg.vue | 12 ++- .../issue/components/complete.vue | 8 +- .../discount-coupon/issue/components/edit.vue | 47 ++++++++-- .../discount-coupon/issue/components/pay.vue | 92 +++++++++++++++++++ .../issue/components/template.vue | 36 ++++++-- src/pages/discount-coupon/issue/index.vue | 43 ++++++++- .../discount-coupon/management/index.vue | 29 ++++-- src/router/index.js | 2 + src/utils/rem.js | 2 +- 10 files changed, 243 insertions(+), 36 deletions(-) create mode 100644 src/pages/discount-coupon/issue/components/pay.vue diff --git a/src/api/discount-coupon/management.js b/src/api/discount-coupon/management.js index f9c6386..1c9bd0d 100644 --- a/src/api/discount-coupon/management.js +++ b/src/api/discount-coupon/management.js @@ -10,6 +10,14 @@ export function getList(params) { params }); } +// 发布 +export function doAdd(data) { + return service({ + url: "/platformCoupon/add", + method: "post", + data + }); +} // 编辑 export function doEdit(data) { return service({ diff --git a/src/pages/discount-coupon/issue/components/activeImg.vue b/src/pages/discount-coupon/issue/components/activeImg.vue index 7cbd5b8..4e9b481 100644 --- a/src/pages/discount-coupon/issue/components/activeImg.vue +++ b/src/pages/discount-coupon/issue/components/activeImg.vue @@ -8,15 +8,17 @@ export default { data() { return { - imageUrl: '' + imageUrl: ''//图片路径 }; }, methods: { + show(url) { + this.imageUrl = url + }, + // 选择图片后形成图片访问路径和将文件流传给edit.vue handleChange(file, fileList) { - this.imageUrl = URL.createObjectURL(file.raw); - this.$emit('active-img', file.raw); - // console.log('file', file); - console.log('fileList', fileList); + this.imageUrl = URL.createObjectURL(file.raw);//形成虚拟文件访问路径 + this.$emit('active-img', file.raw);//raw要上传的文件流 }, // 发布后清除选择的文件 handleClear() { diff --git a/src/pages/discount-coupon/issue/components/complete.vue b/src/pages/discount-coupon/issue/components/complete.vue index 0e4a038..e59fc3e 100644 --- a/src/pages/discount-coupon/issue/components/complete.vue +++ b/src/pages/discount-coupon/issue/components/complete.vue @@ -12,13 +12,15 @@ + 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?'单据金额抽成(%)':''}} - - - + + + + - +