![]()
0) {
this.proSelectLinkList = this.proSelectLinkList.concat(data);
var list = [...this.proSelectLinkList];
- this.proSelectLinkList = [
- ...new Map(list.map(item => [item.id, item])).values()
- ];
+ if (this.dataForm.couponRange == 1) {
+ this.proSelectLinkList = [
+ ...new Map(list.map(item => [item.id, item])).values()
+ ];
+ } else if (this.dataForm.couponRange == 4) {
+ this.proSelectLinkList = [
+ ...new Map(list.map(item => [item.productId, item])).values()
+ ];
+ }
+
// this.dataForm.rangeInfo = this.proSelectLinkList.map( item => item.id).join(',')
console.log("去重后", this.proSelectLinkList);
}
},
addLinkPro() {
this.showSelectPro = true;
- this.requesturl = "/common/coupon/getCourseList";
+ this.requesturl =
+ this.dataForm.couponRange == 1
+ ? "/common/coupon/getCourseList"
+ : "/master/shopProduct/listByPage";
},
changeCate(e) {
console.log("e", e);
+
this.cateSelectLinkList = e;
this.showCateError = false;
// this.dataForm.rangeInfo = e.join(",");
},
async changeRange(e) {
- console.log("范围切换", e);
+ console.log("范围切换", e); if (e == 1 || e == 4) {
+ this.selectLinkList = [];
+
+ this.proSelectLinkList = [];
+
+ this.$forceUpdate();
+ }
// this.dataForm.couponRange = e
// this.getDataList()
},
@@ -531,6 +564,10 @@ export default {
data.couponEntity.rangeList.length > 0
) {
this.selectLinkList = data.couponEntity.rangeList;
+ console.log(
+ "this.selectLinkList at line 544:",
+ this.selectLinkList
+ );
} else {
this.selectLinkList = [];
}
@@ -548,7 +585,10 @@ export default {
this.cateSelectLinkList = ss.map(element =>
parseInt(element)
);
- } else if (this.dataForm.couponRange == 1) {
+ } else if (
+ this.dataForm.couponRange == 1 ||
+ this.dataForm.couponRange == 4
+ ) {
this.proSelectLinkList = this.selectLinkList;
} else {
this.cateSelectLinkList = [];
@@ -683,15 +723,17 @@ export default {
this.dataForm.rangeInfo = this.proSelectLinkList
.map(item => item.id)
.join(",");
- // if (
- // this.dataForm.rangeInfo == null ||
- // this.dataForm.rangeInfo == ""
- // ) {
- // this.$message.error("请选择课程");
- // return false;
- // }
}
- if (Number(this.dataForm.useLevel) <= Number(this.dataForm.couponAmount)) {
+ if (this.dataForm.couponRange == 4) {
+ if (this.proSelectLinkList.length == 0)
+ return this.$message.error("请选择商品");
+ this.dataForm.rangeInfo = this.proSelectLinkList
+ .map(item => item.productId)
+ .join(",");
+ }
+ if (
+ Number(this.dataForm.useLevel) <= Number(this.dataForm.couponAmount)
+ ) {
this.$message.error("优惠券面额不能大于使用门槛");
return false;
}
diff --git a/src/views/modules/coupon/coupon.vue b/src/views/modules/coupon/coupon.vue
index 0b640a6..e92a193 100644
--- a/src/views/modules/coupon/coupon.vue
+++ b/src/views/modules/coupon/coupon.vue
@@ -280,6 +280,12 @@ export default {
return "课程券";
case 2:
return "课程品类券";
+ case 3:
+ return "全部课程";
+ case 4:
+ return "商品券";
+ case 5:
+ return "全部商品券";
}
}
},