diff --git a/src/views/modules/coupon/coupon-add-or-update.vue b/src/views/modules/coupon/coupon-add-or-update.vue index 2614926..53777c6 100644 --- a/src/views/modules/coupon/coupon-add-or-update.vue +++ b/src/views/modules/coupon/coupon-add-or-update.vue @@ -105,7 +105,7 @@ - + + 请选择绑定类目 @@ -271,6 +272,7 @@ export default { baseUrl: global.baseUrl, data() { return { + showCateError: false, requesturl:'', // 课程的请求地址 showSelectPro:false, baseUrl: global.baseUrl, @@ -404,6 +406,7 @@ export default { changeCate(e) { console.log("e", e); this.cateSelectLinkList = e; + this.showCateError = false // this.dataForm.rangeInfo = e.join(","); }, async changeRange(e) { @@ -434,9 +437,13 @@ export default { return list; }, init(id) { + if(!id){ + console.log('没有传值') + this.visible = true; + return + } this.dataForm.id = id || 0; - this.getCouponInfoLoad = true; - + this.getCouponInfoLoad = true; this.$nextTick(() => { this.$refs["dataForm"].resetFields(); if (this.dataForm.id) { @@ -558,6 +565,7 @@ export default { couponRange: "", //优惠卷范围 0无限制 1课程卷 2课程品类卷 rangeInfo: "" //范围详情(课程卷是课程id,分割 课程品类卷是课程分类根id,分割) }; + this.proSelectLinkList = [] this.cateSelectLinkList = [] this.selectLinkList = [] this.fileList = [] @@ -566,9 +574,9 @@ export default { // 表单提交 dataFormSubmit() { this.$refs["dataForm"].validate(valid => { - if (valid) { - if(this.dataForm.effectTime < new Date().getTime()) return this.$message.error("生效时间不能小于当前时间") - if (this.dataForm.effectType == 2) { + if (valid) { + if(!this.dataForm.id && this.dataForm.effectType == 2 && this.dataForm.effectTime < new Date().getTime()) return this.$message.error("生效时间不能小于当前时间") + if (this.dataForm.effectType == 2 ) { if ( this.dataForm.effectTime == null || this.dataForm.effectTime == "" @@ -601,7 +609,7 @@ export default { } if (this.dataForm.couponRange == 2) { - if(this.cateSelectLinkList.length == 0) return this.$message.error("请选择课程品类"); + if(this.cateSelectLinkList.length == 0) {this.showCateError = true; return this.$message.error("请选择课程品类");} this.dataForm.rangeInfo = this.cateSelectLinkList.join(',') // if ( // this.dataForm.rangeInfo == null || diff --git a/src/views/modules/coupon/coupon.vue b/src/views/modules/coupon/coupon.vue index 7441f62..365cccb 100644 --- a/src/views/modules/coupon/coupon.vue +++ b/src/views/modules/coupon/coupon.vue @@ -1,6 +1,7 @@