From fdfd6fc320ae39bdfb01087bdec24af0ee76189b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E7=9A=87?= <236220500@qq.com> Date: Sat, 30 May 2020 21:38:44 +0800 Subject: [PATCH 1/5] 1 --- src/pages/shop/IncreaseWelcomeEdit.vue | 399 +++++++++++-------------- src/pages/shop/IncreaseWelcomeList.vue | 169 +++++------ 2 files changed, 256 insertions(+), 312 deletions(-) diff --git a/src/pages/shop/IncreaseWelcomeEdit.vue b/src/pages/shop/IncreaseWelcomeEdit.vue index b9847f8..16285a3 100644 --- a/src/pages/shop/IncreaseWelcomeEdit.vue +++ b/src/pages/shop/IncreaseWelcomeEdit.vue @@ -1,182 +1,132 @@ From 4715dc2d6e4f0613e44c394194b134856c68c7c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E7=9A=87?= <236220500@qq.com> Date: Sun, 31 May 2020 10:19:59 +0800 Subject: [PATCH 2/5] 1 --- src/pages/activity/useActivityStepTwo.vue | 104 ++++++++++------------ src/pages/shop/IncreaseWelcomeEdit.vue | 13 ++- src/pages/shop/IncreaseWelcomeList.vue | 2 +- 3 files changed, 58 insertions(+), 61 deletions(-) diff --git a/src/pages/activity/useActivityStepTwo.vue b/src/pages/activity/useActivityStepTwo.vue index d797993..4079f4e 100644 --- a/src/pages/activity/useActivityStepTwo.vue +++ b/src/pages/activity/useActivityStepTwo.vue @@ -1,41 +1,29 @@ @@ -44,7 +32,7 @@ import ActivityManager from "../../services/ActivityManager/ActivityManager"; import store from "../../store/index"; export default { name: "useActivityStepTwo", - data () { + data() { return { indeterminate: false, allSelect: false, @@ -52,29 +40,33 @@ export default { companyListdata: [], checkCompanys: [], orginCompanyList: [], - loading: false, + loading: false }; }, - mounted () { + mounted() { let _this = this; console.log(111, store.getters.useData); - if (store.getters.useData.company) { - store.getters.useData.company.forEach((item) => { + if ( + store.getters.useData.company && + store.getters.useData.company.length > 0 + ) { + store.getters.useData.company.forEach(item => { if (_this.checkCompanys.indexOf(item.id) == -1) { _this.checkCompanys.push(item.id); } }); } else if (store.getters.useData.stores) { - store.getters.useData.stores.forEach((item) => { + store.getters.useData.stores.forEach(item => { + console.log(112221, item.parentId); if (item.parentId && _this.checkCompanys.indexOf(item.parentId) == -1) { _this.checkCompanys.push(item.parentId); } }); } - this.getCompanyInfo() + this.getCompanyInfo(); }, methods: { - onChange (data) { + onChange(data) { let _this = this; if (data.length === this.companyList.length) { this.indeterminate = false; @@ -87,58 +79,58 @@ export default { this.allSelect = false; } store.getters.useData.company = []; - data.forEach((item) => { - const c = _this._.find( - _this.companyListdata, - (shop) => shop.id == item - ); + data.forEach(item => { + const c = _this._.find(_this.companyListdata, shop => shop.id == item); if (c) { store.getters.useData.company.push(c); } }); }, - doSearch (e) { + doSearch(e) { const keyword = e.target.value; let that = this; if (keyword.length > 0) { - that.companyList.forEach((item) => { + that.companyList.forEach(item => { if (item.label.indexOf(keyword) == -1) { item.hide = true; } }); } else { - that.companyList.forEach((item) => { - item.hide = false + that.companyList.forEach(item => { + item.hide = false; }); } this.$forceUpdate(); - console.log(1, that.companyList) + console.log(1, that.companyList); }, - getCompanyInfo () { + getCompanyInfo() { let that = this; let data = { - userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId, + userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId }; this.loading = true; - ActivityManager.getCompany(data, function (data) { + ActivityManager.getCompany(data, function(data) { that.companyList = []; that.companyListdata = data.data.results; - if (store.getters.useData.company && 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) => { + data.data.results.forEach(element => { that.companyList.push({ label: element.name, - value: element.id, + value: element.id }); that.orginCompanyList = that.companyList; }); store.getters.useData.company = []; - console.log(123, that.checkCompanys, that.companyListdata) - that.checkCompanys.forEach((item) => { + console.log(123, that.checkCompanys, that.companyListdata); + that.checkCompanys.forEach(item => { const c = that._.find( that.companyListdata, - (company) => company.id == item + company => company.id == item ); if (c) { store.getters.useData.company.push(c); @@ -147,7 +139,7 @@ export default { that.loading = false; }); }, - handleCheckAll () { + handleCheckAll() { let _this = this; if (this.indeterminate) { this.allSelect = false; @@ -158,24 +150,24 @@ export default { if (this.allSelect) { this.checkCompanys = []; - this.companyList.forEach((item) => { + this.companyList.forEach(item => { this.checkCompanys.push(item.value); }); } else { this.checkCompanys = []; } store.getters.useData.company = []; - this.checkCompanys.forEach((item) => { + this.checkCompanys.forEach(item => { const c = _this._.find( _this.companyListdata, - (company) => company.id == item + company => company.id == item ); if (c) { store.getters.useData.company.push(c); } }); - }, - }, + } + } }; diff --git a/src/pages/shop/IncreaseWelcomeEdit.vue b/src/pages/shop/IncreaseWelcomeEdit.vue index 16285a3..db8d3b4 100644 --- a/src/pages/shop/IncreaseWelcomeEdit.vue +++ b/src/pages/shop/IncreaseWelcomeEdit.vue @@ -107,7 +107,7 @@ - + @@ -166,7 +166,7 @@ export default { }, created() { this.id = this.$route.query.id; - store.commit("SET_useData", { ...store.getters.useData, ...this.welcome }); + // store.commit("SET_useData", { ...store.getters.useData, ...this.welcome }); console.log(this.$route); if (this.id) { this.getDetail(this.id); @@ -189,14 +189,19 @@ export default { }, res => { _this.welcome = res.data.results; + + store.commit("SET_useData", { + ...store.getters.useData, + ...this.welcome + }); } ); }, showStores() { console.log({ ...store.getters.useData, ...this.welcome }); store.commit("SET_useData", { - ...store.getters.useData, - ...this.welcome + ...this.welcome, + ...store.getters.useData }); this.showStoreCheck = true; }, diff --git a/src/pages/shop/IncreaseWelcomeList.vue b/src/pages/shop/IncreaseWelcomeList.vue index f7596d4..73f6d3f 100644 --- a/src/pages/shop/IncreaseWelcomeList.vue +++ b/src/pages/shop/IncreaseWelcomeList.vue @@ -103,7 +103,7 @@ export default { http.getWelcomeList(params, res => { const data = res.data.results.this || {}; this.data = data.list || []; - this.totalSize = data.total || 0; + this.total = data.total || 0; this.loading = false; }); }, From 6ef2a253ef2c71f0fffac23b78dd44b943170501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E7=9A=87?= <236220500@qq.com> Date: Sun, 31 May 2020 11:35:52 +0800 Subject: [PATCH 3/5] 1 --- src/pages/activity/selectStoreStep.vue | 100 +++++++++++----------- src/pages/activity/useActivityStepTwo.vue | 6 +- src/pages/shop/IncreaseWelcomeEdit.vue | 17 +++- src/pages/shop/IncreaseWelcomeList.vue | 14 ++- 4 files changed, 80 insertions(+), 57 deletions(-) diff --git a/src/pages/activity/selectStoreStep.vue b/src/pages/activity/selectStoreStep.vue index 7aec19e..c66472d 100644 --- a/src/pages/activity/selectStoreStep.vue +++ b/src/pages/activity/selectStoreStep.vue @@ -1,40 +1,41 @@