diff --git a/manager/src/api/promotion.js b/manager/src/api/promotion.js index 9c0ccdd0..42173562 100644 --- a/manager/src/api/promotion.js +++ b/manager/src/api/promotion.js @@ -119,8 +119,8 @@ export const getCouponActivityList = params => { return getRequest("/promotion/couponActivity", params); }; // 作废优惠券 -export const deleteCouponActivity = ids => { - return deleteRequest(`/promotion/couponActivity/${ids}`); +export const closeActivity = id => { + return deleteRequest(`/promotion/couponActivity/${id}`); }; // 更新优惠券活动 export const updateCouponActivity = params => { diff --git a/manager/src/router/router.js b/manager/src/router/router.js index 65cb5f1b..d60e240f 100644 --- a/manager/src/router/router.js +++ b/manager/src/router/router.js @@ -251,10 +251,16 @@ export const otherRouter = { }, { path: "coupon-activity/edit", - title: "编辑平台优惠券", + title: "编辑平台优惠券活动", name: "edit-coupon-activity", component: () => import("@/views/promotion/couponActivity/couponPublish.vue") }, + { + path: "promotion/coupon-activity-info", + title: "券活动详情", + name: "coupon-activity-info", + component: () => import("@/views/promotion/couponActivity/couponInfo.vue") + }, { path: "promotion/member-receive-coupon", title: "领取详情", diff --git a/manager/src/views/promotion/couponActivity/coupon.vue b/manager/src/views/promotion/couponActivity/coupon.vue index 0be79c4a..aac1d820 100644 --- a/manager/src/views/promotion/couponActivity/coupon.vue +++ b/manager/src/views/promotion/couponActivity/coupon.vue @@ -4,8 +4,17 @@ - +
+ + +
import { getCouponActivityList, - updatePlatformCouponStatus, + closeActivity, } from "@/api/promotion"; export default { - name: "coupon", + name: "couponActivity", components: {}, data() { return { @@ -148,63 +157,36 @@ export default { default: false, }, }, - watch: { - $route(to, from) { - if (to.fullPath == "/promotion/manager-coupon") { - this.init(); - } - }, - }, methods: { - // 选中优惠券 父级传值 - check(val, index) { - - this.data[index].___selected = !this.data[index].___selected - - this.$emit("selected", val); - }, + //获取数据 初始化 init() { this.getDataList(); }, + //增加券活动 add() { this.$router.push({name: "add-coupon-activity"}); }, - /** 跳转至领取详情页面 */ - receiveInfo(v) { - this.$router.push({name: "member-receive-coupon", query: {id: v.id}}); - }, + //查看详情 info(v) { - this.$router.push({name: "platform-coupon-info", query: {id: v.id}}); + this.$router.push({name: "coupon-activity-info", query: {id: v.id}}); }, + //跳转页面 changePage(v) { this.searchForm.pageNumber = v - 1; this.getDataList(); - this.clearSelectAll(); }, + //修改分页 changePageSize(v) { this.searchForm.pageSize = v; this.getDataList(); }, + //搜索活动 handleSearch() { this.searchForm.pageNumber = 0; this.searchForm.pageSize = 10; this.getDataList(); }, - changeSort(e) { - this.searchForm.sort = e.key; - this.searchForm.order = e.order; - if (e.order === "normal") { - this.searchForm.order = ""; - } - this.getDataList(); - }, - clearSelectAll() { - this.$refs.table.selectAll(false); - }, - changeSelect(e) { - this.selectList = e; - this.selectCount = e.length; - }, + //数据获取 getDataList() { this.loading = true; if (this.selectDate && this.selectDate[0] && this.selectDate[1]) { @@ -218,133 +200,32 @@ export default { getCouponActivityList(this.searchForm).then((res) => { this.loading = false; if (res.success) { - res.result.records.forEach(item => { - item.___selected = false - }) this.data = res.result.records; this.total = res.result.total; } }); - this.total = this.data.length; this.loading = false; }, - handleSubmit() { - this.$refs.form.validate((valid) => { - if (valid) { - this.submitLoading = true; - if (this.modalType === 0) { - // 添加 避免编辑后传入id等数据 记得删除 - delete this.form.id; - this.postRequest("/coupon/insertOrUpdate", this.form).then( - (res) => { - this.submitLoading = false; - if (res.success) { - this.$Message.success("操作成功"); - this.getDataList(); - this.modalVisible = false; - } - } - ); - } else { - // 编辑 - this.postRequest("/coupon/insertOrUpdate", this.form).then( - (res) => { - this.submitLoading = false; - if (res.success) { - this.$Message.success("操作成功"); - this.getDataList(); - this.modalVisible = false; - } - } - ); - } - } - }); - }, + //跳转编辑 edit(v) { this.$router.push({name: "edit-platform-coupon", query: {id: v.id}}); }, + //下架活动 remove(v) { this.$Modal.confirm({ title: "确认下架", // 记得确认修改此处 - content: "确认要下架此优惠券么?", + content: "确认要下架此优惠券活动么?下架活动只能重新创建", loading: true, onOk: () => { // 删除 - updatePlatformCouponStatus({ - couponIds: v.id, - promotionStatus: "CLOSE", - }) - .then((res) => { - this.$Modal.remove(); - if (res.success) { - this.$Message.success("优惠券已作废"); - this.getDataList(); - } - }) - .catch(() => { - this.$Modal; - }); - }, - }); - }, - delAll() { - if (this.selectCount <= 0) { - this.$Message.warning("您还未选择要下架的优惠券"); - return; - } - this.$Modal.confirm({ - title: "确认下架", - content: "您确认要下架所选的 " + this.selectCount + " 条数据?", - loading: true, - onOk: () => { - let ids = []; - this.selectList.forEach(function (e) { - ids.push(e.id); - }); - let params = { - couponIds: ids.toString(), - promotionStatus: "CLOSE", - }; - // 批量删除 - updatePlatformCouponStatus(params).then((res) => { - this.$Modal.remove(); + closeActivity(v.id).then((res) => { if (res.success) { - this.$Message.success("下架成功"); - this.clearSelectAll(); - this.getDataList(); - } - }); - }, - }); - }, - upAll() { - if (this.selectCount <= 0) { - this.$Message.warning("请选择要上架的优惠券"); - return; - } - this.$Modal.confirm({ - title: "确认上架", - content: "您确认要上架所选的 " + this.selectCount + " 条数据?", - loading: true, - onOk: () => { - let ids = []; - this.selectList.forEach(function (e) { - ids.push(e.id); - }); - let params = { - couponIds: ids.toString(), - promotionStatus: "START", - }; - // 批量上架 - updatePlatformCouponStatus(params).then((res) => { - this.$Modal.remove(); - if (res.success) { - this.$Message.success("上架成功"); - this.clearSelectAll(); + this.$Message.success("优惠券活动已作废"); this.getDataList(); } + }).catch(() => { + this.$Modal; }); }, }); diff --git a/manager/src/views/promotion/couponActivity/couponInfo.vue b/manager/src/views/promotion/couponActivity/couponInfo.vue index 87061b89..2b800adf 100644 --- a/manager/src/views/promotion/couponActivity/couponInfo.vue +++ b/manager/src/views/promotion/couponActivity/couponInfo.vue @@ -3,81 +3,37 @@
-

平台券活动详情

+

优惠券活动详情

- {{ form.promotionName }} + {{ couponActivity.promotionName }} - {{ - getCouponType(form.couponType) - }} + 新人发券 + 精确发券 - - ¥{{ form.price | unitPrice }} + + 全部会员 + 指定会员 - - {{ form.description }} + + {{ couponActivity.startTime }}~{{ couponActivity.endTime }} - - {{ form.publishNum }} - - - {{ form.limitNum }} - - - {{ form.startTime }} - - - {{ - form.consumptionLimit - }} - - - {{ form.startTime }} 至 {{ form.endTime }} - - - {{ - getScopeType(form.scopeType) - }} - - - {{ form.couponName }} - - - {{ - getStatus(form.status) - }} - - - {{ - getType(form.getType) - }} - - - {{ form.createTime }} - - - {{ form.updateTime }} - - - {{ form.updateBy }} - - - {{ form.receivedNum }} - - - {{ form.usedNum }} + + + 新建 + 已开始 + 已结束 + 已废弃
-

适用品类范围

-
-
- - - -
+

优惠券列表

+ +
+

会员列表列表

+ + +
@@ -89,145 +45,78 @@ - - - diff --git a/manager/src/views/promotion/couponActivity/memberReceiveCoupon.vue b/manager/src/views/promotion/couponActivity/memberReceiveCoupon.vue deleted file mode 100644 index 4291c1e3..00000000 --- a/manager/src/views/promotion/couponActivity/memberReceiveCoupon.vue +++ /dev/null @@ -1,250 +0,0 @@ - - - -