From ab777874ef966b4ae4d55bd76e7677d60543a228 Mon Sep 17 00:00:00 2001 From: zhenghuang <236220500@qq.com> Date: Tue, 26 May 2020 09:18:35 +0800 Subject: [PATCH] 1 --- src/pages/activity/ActivityManager.vue | 67 ++++---- src/pages/activity/ActivityPlan.vue | 201 +++++++++++----------- src/pages/activity/useActivityStepTwo.vue | 2 +- 3 files changed, 132 insertions(+), 138 deletions(-) diff --git a/src/pages/activity/ActivityManager.vue b/src/pages/activity/ActivityManager.vue index 9eba1c4..5ff0894 100644 --- a/src/pages/activity/ActivityManager.vue +++ b/src/pages/activity/ActivityManager.vue @@ -1,18 +1,18 @@ @@ -61,7 +59,7 @@ export default { addActivity, }, inject: ["setMenuName"], - data() { + data () { return { showUse: false, addActivityModal: false, @@ -72,21 +70,21 @@ export default { loading: false, }; }, - mounted() { + mounted () { this.setMenuName("活动管理", "活动池"); this.getActivityTable(); }, methods: { - doShow(show) { + doShow (show) { this.showUse = show; }, - getActivityData(id) { + getActivityData (id) { let that = this; let data = { instanceId: id, }; that.loading = true; - ActivityManager.getActivityInfo(data, function(data) { + ActivityManager.getActivityInfo(data, function (data) { that.inputActivityList = []; data.data.results.params.forEach((item) => { that.inputActivityList.push({ @@ -98,35 +96,36 @@ export default { that.loading = false; }); }, - getActivityTable() { + getActivityTable () { let that = this; - ActivityManager.getActivityList({}, function(data) { + ActivityManager.getActivityList({}, function (data) { that.activityList = data.data.results; }); }, - disPlayUseTable(item) { + disPlayUseTable (item) { let that = this; let data = { id: item.id, }; // let data = new FormData() // data.append('instanceId', item.id) - ActivityManager.getActivityInfo(data, function(data) { + ActivityManager.getActivityInfo(data, function (data) { that.useSchedule = data.data.results; that.showUse = true; + that.$forceUpdate() }); }, - dispalyAddActivity(id) { + dispalyAddActivity (id) { this.addActivityModal = true; this.id = id.toString(); }, - dispalyuseModal(displayModalFlag, isCancle) { + dispalyuseModal (displayModalFlag, isCancle) { this.useModal = displayModalFlag; if (isCancle === true) { this.getActivityTable(); } }, - dispalyAddActivityModal(displayModalFlag, isCancle) { + dispalyAddActivityModal (displayModalFlag, isCancle) { this.addActivityModal = displayModalFlag; if (isCancle === true) { this.getActivityTable(); diff --git a/src/pages/activity/ActivityPlan.vue b/src/pages/activity/ActivityPlan.vue index 2eed89a..ac0000b 100644 --- a/src/pages/activity/ActivityPlan.vue +++ b/src/pages/activity/ActivityPlan.vue @@ -1,93 +1,83 @@ @@ -104,7 +94,7 @@ export default { components: { useTable, }, - data() { + data () { const _this = this; return { loading: false, @@ -166,47 +156,43 @@ export default { { title: "活动类型", key: "scheduleVO.name", - render(h, params) { - return h("span", params.row["scheduleVO"]["name"]); + render (h, params) { + return h("span", params.row["params"][0]["defaultVal"]); }, }, { - title: "活动开始时间", + title: "活动时间", key: "beginTime", + width: 230, + render (h, params) { + return h("span", (params.row.beginTime) + " - " + (params.row.endTime)); + }, }, - { - title: "活动结束时间", - key: "endTime", - }, - // { - // title: '零售公司', - // key: 'company' - // }, { title: "店铺", key: "shop", - render(h, params) { - return h("span", (params.row.stores.length || 0) + "家"); + render (h, params) { + return h("span", (params.row.stores[0].abbreviation) + "等" + (params.row.stores.length || 0) + "家"); }, }, { title: "添加好友数", key: "addFriendNum", - render(h, params) { + render (h, params) { return h("span", (params.row.friends || 0) + "人"); }, }, { title: "参与活动客户数", key: "joinActivityClientNum", - render(h, params) { + render (h, params) { return h("span", (params.row.friends || 0) + "人"); }, }, { title: "活动码", key: "activityCode", - render(h, p) { + render (h, p) { return h( "Button", { @@ -220,7 +206,7 @@ export default { { title: "活动状态", key: "status", - render(h, p) { + render (h, p) { const status = p.row.status; if (status === 1) return h("span", "未开始"); if (status === 2) return h("span", "进行中"); @@ -232,7 +218,7 @@ export default { title: "操作", key: "action", width: 200, - render(h, p) { + render (h, p) { return h("div", [ h( "Button", @@ -259,22 +245,22 @@ export default { ], }; }, - mounted() { + mounted () { this.setMenuName("活动管理", "活动计划"); this.getCompanyInfo(); this.getShopInfo(); this.searchTable(); }, methods: { - doShow(show) { + doShow (show) { this.showUse = show; }, - getCompanyInfo() { + getCompanyInfo () { let that = this; let data = { userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId, }; - ActivityManager.getCompany(data, function(data) { + ActivityManager.getCompany(data, function (data) { that.companyList = []; data.data.results.forEach((element) => { that.companyList.push({ @@ -284,12 +270,12 @@ export default { }); }); }, - getShopInfo() { + getShopInfo () { let that = this; let data = { userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId, }; - ActivityManager.getShop(data, function(data) { + ActivityManager.getShop(data, function (data) { that.shopList = []; data.data.results.forEach((element) => { that.shopList.push({ @@ -299,34 +285,43 @@ export default { }); }); }, - handlePage: function(value) { + handlePage: function (value) { this.pageNum = value; this.searchTable(); }, - stop(instance) { - this.saving = true; + stop (instance) { let _this = this; - ActivityManager.instanceTerminate({ instanceId: instance.id }, (res) => { - _this.saving = false; - if (res.success == undefined || !res.success) { - that.$Message.error("终止失败!"); - } else { - _this.searchTable(); + this.$Modal.confirm({ + title: '您确认要终止?', + content: '终止之后不可恢复', + onOk: () => { + this.saving = true; + ActivityManager.instanceTerminate({ instanceId: instance.id }, (res) => { + _this.saving = false; + if (res.data.success == undefined || !res.data.success) { + _this.$Message.error("终止失败!"); + } else { + _this.searchTable(); + } + }); + }, + onCancel: () => { + } }); }, - modify(instance) { + modify (instance) { this.activityInstance = instance; this.showUse = true; - store.commit("SET_useData", instance); + store.commit("SET_useData", Object.assign({}, instance)); }, - navigateCode(instance) { + navigateCode (instance) { this.$router.push({ path: "/activity/plan/code", query: { instanceId: instance.id }, }); }, - searchTable(params = {}) { + searchTable (params = {}) { this.loading = true; if ( this.formValidate.date !== null && diff --git a/src/pages/activity/useActivityStepTwo.vue b/src/pages/activity/useActivityStepTwo.vue index f0eb313..25166a8 100644 --- a/src/pages/activity/useActivityStepTwo.vue +++ b/src/pages/activity/useActivityStepTwo.vue @@ -117,7 +117,7 @@ export default { ActivityManager.getCompany(data, function (data) { that.companyList = []; that.companyListdata = data.data.results; - if (store.getters.useData.company.length == that.companyListdata.length) { + if (store.getters.useData.company && store.getters.useData.company.length == that.companyListdata.length) { that.allSelect = true; } data.data.results.forEach((element) => {