diff --git a/manager/src/config/index.js b/manager/src/config/index.js index 8b6b162f..1a28698c 100644 --- a/manager/src/config/index.js +++ b/manager/src/config/index.js @@ -21,10 +21,10 @@ export default { // buyer: "https://buyer-api.pickmall.cn", // seller: "https://store-api.pickmall.cn", // manager: "https://admin-api.pickmall.cn" - common: 'http://192.168.0.109:8890', - buyer: 'http://192.168.0.109:8888', - seller: 'http://192.168.0.109:8889', - manager: 'http://192.168.0.109:8887' + common: 'http://192.168.0.100:8890', + buyer: 'http://192.168.0.100:8888', + seller: 'http://192.168.0.100:8889', + manager: 'http://192.168.0.100:8887' }, api_prod: { common: "https://common-api.pickmall.cn", diff --git a/manager/src/views/promotion/coupon/coupon.vue b/manager/src/views/promotion/coupon/coupon.vue index 7db021f4..7f2ae93d 100644 --- a/manager/src/views/promotion/coupon/coupon.vue +++ b/manager/src/views/promotion/coupon/coupon.vue @@ -25,7 +25,7 @@ - +
- + @@ -59,7 +59,7 @@ export default { modalTitle: "", // 添加或编辑标题 searchForm: { // 搜索框初始化对象 - pageNumber: 0, // 当前页数 + pageNumber: 1, // 当前页数 pageSize: 10, // 页面大小 sort: "startTime", // 默认排序字段 order: "desc", // 默认排序方式 @@ -219,6 +219,7 @@ export default { ], data: [], // 表单数据 total: 0, // 表单数据总数 + selectCoupon: [], //本级选中的优惠券 }; }, props: { @@ -247,22 +248,22 @@ export default { }, methods: { // 选中优惠券 父级传值 + selectedList: { + handler(val) { + // 判断是否是父级回调给自己已选择优惠券 + if (val.length != 0) { + this.selectCoupon = val; + } + }, + deep: true, + immediate: true, + }, check() { - this.$emit("selected", this.selectList); + // this.selectCoupon.push(this.selectList) + this.$emit("selected", this.selectCoupon); }, init() { this.getDataList(); - - // 判断是否是父级回调给自己已选择优惠券 - if (this.selectedList.length != 0) { - // console.log(this.selectedList); - this.selectedList.forEach((item) => { - item._checked = true; - item.___selected = true; - }); - this.$set(this, "data", this.selectedList); - console.log(this.data); - } }, add() { this.$router.push({ name: "add-platform-coupon" }); @@ -275,9 +276,9 @@ export default { this.$router.push({ name: "platform-coupon-info", query: { id: v.id } }); }, changePage(v) { - this.searchForm.pageNumber = v - 1; + this.searchForm.pageNumber = v; this.getDataList(); - this.clearSelectAll(); + // this.clearSelectAll(); }, changePageSize(v) { this.searchForm.pageSize = v; @@ -299,10 +300,37 @@ export default { clearSelectAll() { this.$refs.table.selectAll(false); }, + + /** + * 取消已选择的数据 + */ + cancelSelect(selection, row) { + console.log(row) + let findCoupon = this.selectCoupon.find((item) => { + return item.id == row.id; + }); + // 如果没有则添加 + if (!findCoupon) { + this.selectCoupon.push(row); + } else { + // 有重复数据就删除 + this.selectCoupon.map((item, index) => { + if (item.id == findCoupon.id) { + this.selectCoupon.splice(index, 1); + } + }); + } + }, + /** + * 选择优惠券 + */ changeSelect(e) { + if (this.checked && e.length != 0) { + this.selectCoupon.push(...e); + this.check(); + } this.selectList = e; this.selectCount = e.length; - this.checked ? this.check() : ""; }, getDataList() { this.loading = true; @@ -318,8 +346,17 @@ export default { this.loading = false; if (res.success) { res.result.records.forEach((item) => { + if (this.selectCoupon.length != 0) { + this.selectCoupon.forEach((child) => { + if (item.id == child.id) { + item.___selected = true; + item._checked = true; + } + }); + } item.___selected = false; }); + this.data = res.result.records; this.total = res.result.total; } diff --git a/manager/src/views/promotion/couponActivity/couponPublish.vue b/manager/src/views/promotion/couponActivity/couponPublish.vue index 61fbc7bc..1f7077e5 100644 --- a/manager/src/views/promotion/couponActivity/couponPublish.vue +++ b/manager/src/views/promotion/couponActivity/couponPublish.vue @@ -62,7 +62,7 @@ - +