From bf99a60269e0ed1ef3024a74455ca18696895c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E5=90=8C=E5=AD=A6?= <2495967527@qq.com> Date: Thu, 12 Dec 2024 20:42:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=E7=AD=89=E7=BA=A7=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/views/modules/marketing/level/index.vue | 20 ++-- .../marketing/level/popup/add-coupon.vue | 61 ++++++----- .../marketing/level/popup/add-or-update.vue | 103 ++++++++++++------ 3 files changed, 119 insertions(+), 65 deletions(-) diff --git a/src/views/modules/marketing/level/index.vue b/src/views/modules/marketing/level/index.vue index 9dfa607..eaaab28 100644 --- a/src/views/modules/marketing/level/index.vue +++ b/src/views/modules/marketing/level/index.vue @@ -39,7 +39,7 @@
- 全部等级({{list.length}})全部等级({{ list.length }})+新增套餐
@@ -74,10 +74,16 @@ > @@ -102,7 +108,7 @@ - +
@@ -127,7 +133,7 @@ export default { this.formInline = { unitType: JSON.parse(sessionStorage.getItem("userInfo")).unitType, marketId: this.marketId, - shopId: "", + shopId: this.shopId, }; this.getList(); }, diff --git a/src/views/modules/marketing/level/popup/add-coupon.vue b/src/views/modules/marketing/level/popup/add-coupon.vue index fceb4d2..4143f9f 100644 --- a/src/views/modules/marketing/level/popup/add-coupon.vue +++ b/src/views/modules/marketing/level/popup/add-coupon.vue @@ -26,10 +26,24 @@ export default { show: false, width: "60%", }, - modalData: {}, - value1: [], + modalData: { + couponsName: "", + couponsThreshold: 0, + couponsMinus: 0, + couponsEffectiveTimeType: "1", + }, }; }, + watch: { + "modalConfig.show"(newVal) { + if (newVal) { + //关闭弹窗清空校验 + setTimeout(() => { + this.$refs.modal.resetFields(); + }); + } + }, + }, methods: { queryTableData(pageNo, pageSize) {}, toggle(e) { @@ -37,43 +51,33 @@ export default { this.modalConfig.show = true; } else { this.modalConfig.show = false; - this.$refs.modal.resetFields(); } if (e) { this.init(cloneDeep(e)); } return { add: (row) => { - this.modalConfig.title = "添加优惠卷"; - this.$nextTick(() => { - this.$refs.modal?.resetFields(); - }); - this.isAdd = true; - if (row) { + console.log(row); + if (row.length > 0) { this.modalData = row[0]; + } else { console.log("111"); - return; + this.modalData = { + couponsName: "", + couponsThreshold: 0, + couponsMinus: 0, + couponsEffectiveTimeType: "1", + }; } - this.modalData = { - couponsName: "", - couponsThreshold: 0, - couponsMinus: 0, - couponsEffectiveTimeType: "1", - }; - console.log("qqw"); + this.modalConfig.title = "添加优惠卷"; + this.isAdd = true; }, update: () => { this.isAdd = false; }, }; }, - init(row) { - if (row) { - this.modalData = row; - return; - } - console.log("123"); - }, + init(row) {}, }, computed: { modalCols() { @@ -146,7 +150,7 @@ export default { }, { label: "当月", - value: "2", + value: "3", }, ].map((item) => { return ( @@ -176,8 +180,11 @@ export default { loading: this.isLoading, submit: true, handle: () => { - console.log(this.modalData); - this.$emit("addCouponData", this.modalData); + console.log(JSON.parse(JSON.stringify(this.modalData))); + this.$emit( + "addCouponData", + JSON.parse(JSON.stringify(this.modalData)) + ); this.toggle(); }, }, diff --git a/src/views/modules/marketing/level/popup/add-or-update.vue b/src/views/modules/marketing/level/popup/add-or-update.vue index 12f267b..82484b1 100644 --- a/src/views/modules/marketing/level/popup/add-or-update.vue +++ b/src/views/modules/marketing/level/popup/add-or-update.vue @@ -13,7 +13,7 @@