From 7c223091032c8f17ef3f2bb938ac68431556c0ae Mon Sep 17 00:00:00 2001 From: zhenghuang <236220500@qq.com> Date: Thu, 28 May 2020 17:58:07 +0800 Subject: [PATCH] 1 --- src/pages/activity/addActivity.vue | 3 + src/pages/activity/selectStoreStep.vue | 130 ++++++++ src/pages/activity/useActivityStepThree.vue | 61 ++-- src/pages/activity/useTable.vue | 4 + src/pages/shop/IncreaseWelcomeEdit.vue | 323 +++++++++++++++++++- src/pages/shop/IncreaseWelcomeList.vue | 2 +- src/store/modules/activity.js | 36 +-- src/utils/Common.js | 18 ++ 8 files changed, 530 insertions(+), 47 deletions(-) create mode 100644 src/pages/activity/selectStoreStep.vue diff --git a/src/pages/activity/addActivity.vue b/src/pages/activity/addActivity.vue index 0642da9..bd57e97 100644 --- a/src/pages/activity/addActivity.vue +++ b/src/pages/activity/addActivity.vue @@ -253,6 +253,7 @@ export default { if (that.formValidate.params.hasOwnProperty(key)) { const element = that.formValidate.params[key]; if (element.name.length <= 0) { + that.modal_loading = false; that.$Message.error(`请输入类型${i}的活动类型名称!`); return false; } @@ -267,6 +268,8 @@ export default { if (valid) { // param = JSON.stringify(param) let data = { ...that.formValidate, isGetActivityInfo: true }; + data.categoryId = 0; + data.categoryCode = "promotion"; ActivityManager.addOreditActivity(data, function (data) { that.addActivityModal = false; that.formValidate = {}; diff --git a/src/pages/activity/selectStoreStep.vue b/src/pages/activity/selectStoreStep.vue new file mode 100644 index 0000000..7aec19e --- /dev/null +++ b/src/pages/activity/selectStoreStep.vue @@ -0,0 +1,130 @@ + + + + diff --git a/src/pages/activity/useActivityStepThree.vue b/src/pages/activity/useActivityStepThree.vue index 6a304ef..264748d 100644 --- a/src/pages/activity/useActivityStepThree.vue +++ b/src/pages/activity/useActivityStepThree.vue @@ -1,35 +1,45 @@ @@ -38,7 +48,7 @@ import ActivityManager from "../../services/ActivityManager/ActivityManager"; import store from "../../store/index"; export default { name: "useActivityStepThree", - data() { + data () { return { indeterminate: false, allSelect: false, @@ -56,7 +66,7 @@ export default { props: { isModify: Boolean }, - mounted() { + mounted () { this.getShopInfo(); let _this = this; if (store.getters.useData.stores) { @@ -66,7 +76,7 @@ export default { } }, methods: { - handleCheckAll() { + handleCheckAll () { let _this = this; if (this.indeterminate) { this.allSelect = false; @@ -94,13 +104,14 @@ export default { } }); }, - doSearch(e) { + doSearch (e) { const keyword = e.target.value; let that = this; that.block = 50; that.shopList = that.orginShopList; if (keyword.length > 0) { that.shopList = that._.filter(that.shopList, item => { + console.log(item.label, keyword) return item.label.indexOf(keyword) >= 0; }); } else { @@ -108,7 +119,7 @@ export default { } this.isSelect = this._.filter(this.isSelect, item => item); }, - onChange(data) { + onChange (data) { let _this = this; data = this._.filter(data, item => item); if (data.length === this.shopListData.length) { @@ -131,10 +142,10 @@ export default { } }); }, - loadMore() { + loadMore () { this.block += 50; }, - getShopInfo() { + getShopInfo () { let that = this; let companyIds = []; this.companys.forEach(item => { @@ -149,7 +160,7 @@ export default { data.scheduleId = null; } that.loading = true; - ActivityManager.getShop(data, function(data) { + ActivityManager.getShop(data, function (data) { that.shopList = []; that.shopListData = data.data.results; if (store.getters.useData.stores.length == that.shopListData.length) { diff --git a/src/pages/activity/useTable.vue b/src/pages/activity/useTable.vue index b195c82..96eb9f7 100644 --- a/src/pages/activity/useTable.vue +++ b/src/pages/activity/useTable.vue @@ -78,6 +78,10 @@ export default { isModify: { type: Boolean, default: false + }, + beginStep: { + type: Number, + default: 1 } }, watch: { diff --git a/src/pages/shop/IncreaseWelcomeEdit.vue b/src/pages/shop/IncreaseWelcomeEdit.vue index b5d23ee..8eae524 100644 --- a/src/pages/shop/IncreaseWelcomeEdit.vue +++ b/src/pages/shop/IncreaseWelcomeEdit.vue @@ -1,21 +1,336 @@ - diff --git a/src/pages/shop/IncreaseWelcomeList.vue b/src/pages/shop/IncreaseWelcomeList.vue index fbb5e42..5867173 100644 --- a/src/pages/shop/IncreaseWelcomeList.vue +++ b/src/pages/shop/IncreaseWelcomeList.vue @@ -100,7 +100,7 @@ export default { }, // 新增或修改 handleEdit (row) { - this.$router.push({ path: "/shop/increase/welcome/edit", query: row.id }) + this.$router.push({ path: "/shop/increase/welcome/edit", params: { id: row.id } }) }, // 删除 handleDelete (row) { diff --git a/src/store/modules/activity.js b/src/store/modules/activity.js index cac4cc5..d63db8a 100644 --- a/src/store/modules/activity.js +++ b/src/store/modules/activity.js @@ -1,54 +1,56 @@ -import * as types from "./mutation-type"; +import * as types from './mutation-type' const activity = { state: { useData: { - beginTime: "", - endTime: "", + beginTime: '', + endTime: '', id: null, - name: "", + name: '', params: [], scheduleId: null, + categoryId: 0, + categoryCode: 'promotion', stores: [], company: [], }, useModal: false, - id: "", + id: '', store: [], }, mutations: { [types.SET_useData](state, useData) { - state.useData = useData; + state.useData = useData }, [types.RSET_useData](state) { state.useData = { - beginTime: "", - endTime: "", + beginTime: '', + endTime: '', id: null, - name: "", + name: '', params: [], scheduleId: null, stores: [], company: [], - }; + } }, [types.SET_useModal](state, useModal) { - state.useModal = useModal; + state.useModal = useModal }, [types.SET_ID](state, id) { - state.id = id; + state.id = id }, }, actions: {}, getters: { useData: (state) => { - return state.useData; + return state.useData }, useModal: (state) => { - return state.useModal; + return state.useModal }, id: (state) => { - return state.id; + return state.id }, }, -}; -export default activity; +} +export default activity diff --git a/src/utils/Common.js b/src/utils/Common.js index 4e8a214..17bb576 100644 --- a/src/utils/Common.js +++ b/src/utils/Common.js @@ -28,7 +28,25 @@ export function formatDate(dt) { return year + '-' + month + '-' + day } +export function isURL(str_url) { + // 验证url + var strRegex = + '^((https|http)?://)' + + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" + // ftp的user@ + '(([0-9]{1,3}.){3}[0-9]{1,3}' + // IP形式的URL- 199.194.52.184 + '|' + // 允许IP和DOMAIN(域名) + "([0-9a-z_!~*'()-]+.)*" + // 域名- www. + '([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].' + // 二级域名 + '[a-z]{2,6})' + // first level domain- .com or .museum + '(:[0-9]{1,4})?' + // 端口- :80 + '((/?)|' + // a slash isn't required if there is no file name + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$" + var re = new RegExp(strRegex) + return re.test(str_url) +} + export default { goToLogin, formatDate, + isURL, }