活动池流程

feature_0521
郑皇 6 years ago
parent e02a68db10
commit 80a041a306

@ -14,6 +14,7 @@
"file-saver": "^2.0.2",
"jquery": "^3.5.1",
"lib-flexible": "^0.3.2",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"postcss-px2rem-exclude": "0.0.6",
"script-loader": "^0.7.2",

@ -1,9 +1,9 @@
module.exports = {
plugins: {
autoprefixer: {},
"postcss-px2rem-exclude": {
remUnit: 40,
exclude: /node_modules|folder_name/i,
},
// "postcss-px2rem-exclude": {
// remUnit: 40,
// exclude: /node_modules|folder_name/i,
// },
},
};

@ -1,83 +1,89 @@
import Vue from 'vue';
import Vue from "vue";
import {
Avatar, Breadcrumb, BreadcrumbItem,
Button,
Card,
Content,
Form,
FormItem,
Icon,
Input,
InputNumber,
Layout,
Menu,
MenuItem,
Sider,
Submenu,
Table,
Row,
Col,
Select,
Option,
Poptip,
DatePicker,
CheckboxGroup,
Checkbox,
RadioGroup,
Switch,
Modal,
Message,
Radio,
List,
Divider,
Page,
Upload,
Spin,
Tooltip,
Step,
Steps,
Tag
Avatar,
Breadcrumb,
BreadcrumbItem,
Button,
Card,
Content,
Form,
FormItem,
Icon,
Input,
InputNumber,
Layout,
Menu,
MenuItem,
Sider,
Submenu,
Table,
Row,
Col,
Select,
Option,
Poptip,
DatePicker,
CheckboxGroup,
Checkbox,
RadioGroup,
Switch,
Modal,
Message,
Radio,
List,
Divider,
Page,
Upload,
Spin,
Tooltip,
Step,
Steps,
Tag,
Collapse,
Panel,
} from "view-design";
import 'view-design/dist/styles/iview.css';
import "view-design/dist/styles/iview.css";
Vue.component('Button', Button);
Vue.component('Tag', Tag);
Vue.component('Table', Table);
Vue.component('Card', Card);
Vue.component('Form', Form);
Vue.component('FormItem', FormItem);
Vue.component('InputNumber', InputNumber);
Vue.component('Icon', Icon);
Vue.component('i-input', Input);
Vue.component('Layout', Layout);
Vue.component('Sider', Sider);
Vue.component('Avatar', Avatar);
Vue.component('Menu', Menu);
Vue.component('MenuItem', MenuItem);
Vue.component('Submenu', Submenu);
Vue.component('Content', Content);
Vue.component('Breadcrumb', Breadcrumb);
Vue.component('BreadcrumbItem', BreadcrumbItem);
Vue.component('Row', Row);
Vue.component('i-col', Col);
Vue.component('Select', Select);
Vue.component('Option', Option);
Vue.component('Poptip', Poptip);
Vue.component('DatePicker', DatePicker);
Vue.component('CheckboxGroup', CheckboxGroup);
Vue.component('Checkbox', Checkbox);
Vue.component('RadioGroup', RadioGroup);
Vue.component('i-switch', Switch);
Vue.component('Modal', Modal);
Vue.component('Message', Message);
Vue.component("Button", Button);
Vue.component("Collapse", Collapse);
Vue.component("Panel", Panel);
Vue.component("Tag", Tag);
Vue.component("Table", Table);
Vue.component("Card", Card);
Vue.component("Form", Form);
Vue.component("FormItem", FormItem);
Vue.component("InputNumber", InputNumber);
Vue.component("Icon", Icon);
Vue.component("i-input", Input);
Vue.component("Layout", Layout);
Vue.component("Sider", Sider);
Vue.component("Avatar", Avatar);
Vue.component("Menu", Menu);
Vue.component("MenuItem", MenuItem);
Vue.component("Submenu", Submenu);
Vue.component("Content", Content);
Vue.component("Breadcrumb", Breadcrumb);
Vue.component("BreadcrumbItem", BreadcrumbItem);
Vue.component("Row", Row);
Vue.component("i-col", Col);
Vue.component("Select", Select);
Vue.component("Option", Option);
Vue.component("Poptip", Poptip);
Vue.component("DatePicker", DatePicker);
Vue.component("CheckboxGroup", CheckboxGroup);
Vue.component("Checkbox", Checkbox);
Vue.component("RadioGroup", RadioGroup);
Vue.component("i-switch", Switch);
Vue.component("Modal", Modal);
Vue.component("Message", Message);
Vue.prototype.$Modal = Modal;
Vue.prototype.$Message = Message;
Vue.component('Radio', Radio);
Vue.component('List', List);
Vue.component('Divider', Divider);
Vue.component('Page', Page);
Vue.component('Spin', Spin);
Vue.component('Upload', Upload);
Vue.component('Tooltip', Tooltip);
Vue.component('Step', Step);
Vue.component('Steps', Steps);
Vue.component("Radio", Radio);
Vue.component("List", List);
Vue.component("Divider", Divider);
Vue.component("Page", Page);
Vue.component("Spin", Spin);
Vue.component("Upload", Upload);
Vue.component("Tooltip", Tooltip);
Vue.component("Step", Step);
Vue.component("Steps", Steps);

@ -1,43 +1,42 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import Vuex from 'vuex'
import moment from 'moment'
import axios from 'axios';
import QS from 'qs';
import './iview';
import './vcharts'
import 'lib-flexible/flexible'
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import Vuex from "vuex";
import moment from "moment";
import axios from "axios";
import QS from "qs";
import "./iview";
import "./vcharts";
import "lib-flexible/flexible";
import _ from "lodash";
Vue.prototype.$axios = axios;
Vue.prototype.$qs = QS;
Vue.prototype.$moment = moment;
Vue.config.productionTip = false
Vue.config.productionTip = false;
Vue.prototype.$moment = moment;
Vue.prototype._ = _;
import echarts from 'echarts';
import 'echarts/map/js/china'
import echarts from "echarts";
import "echarts/map/js/china";
Vue.prototype.$echarts = echarts;
// 需要汉化
moment.locale('zh-cn');
moment.locale("zh-cn");
Vue.use(Vuex);
// Vue.use(ViewUI);
//实现了全局的事件总线对象
Vue.prototype.bus = new Vue();
new Vue({
render: h => h(App),
render: (h) => h(App),
router,
}).$mount('#app')
}).$mount("#app");
//重复点击同一个报错解决
import Router from 'vue-router'
const routerPush = Router.prototype.push
import Router from "vue-router";
const routerPush = Router.prototype.push;
Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(error=> error)
}
return routerPush.call(this, location).catch((error) => error);
};

@ -1,14 +1,21 @@
<template>
<div class="activityManager">
<Spin v-show="loading" fix>加载中...</Spin>
<Row>
<i-col class="activityListClass" v-for="(item, index) in activityList" :key="index" span="7" offset="1">
<i-col
class="activityListClass"
v-for="(item, index) in activityList"
:key="index"
span="7"
offset="1"
>
<Card>
<div class="operateAndThemeItem">
<div class="ThemeItem">
<img class="img" :src="'/kiisoo-ic' + item.logo">
<img class="img" :src="'/kiisoo-ic' + item.logo" />
<div class="tipItem">
<span>{{item.name}}</span>
<span>{{item.description}}</span>
<span>{{ item.name }}</span>
<span>{{ item.description }}</span>
</div>
</div>
<div class="operateItem">
@ -27,147 +34,150 @@
</div>
</i-col>
</Row>
<useTable @dispalyuseModal="dispalyuseModal" :useModal="useModal" :id="id"></useTable>
<addActivity @dispalyAddActivityModal="dispalyAddActivityModal" :addActivityModal="addActivityModal" :id="id"></addActivity>
<useTable
ref="useTable"
@doShow="doShow"
:show="showUse"
:schedule="useSchedule"
></useTable>
<addActivity
@dispalyAddActivityModal="dispalyAddActivityModal"
:addActivityModal="addActivityModal"
:id="id"
></addActivity>
</div>
</template>
<script>
import useTable from './useTable'
import addActivity from './addActivity'
import ActivityManager from "../../services/ActivityManager/ActivityManager"
import store from "../../store/index"
import useTable from "./useTable";
import addActivity from "./addActivity";
import ActivityManager from "../../services/ActivityManager/ActivityManager";
import store from "../../store/index";
export default {
name: "ActivityManager",
components: {
useTable,
addActivity
export default {
name: "ActivityManager",
components: {
useTable,
addActivity,
},
inject: ["setMenuName"],
data() {
return {
showUse: false,
addActivityModal: false,
activityList: [],
id: "",
inputActivityList: [],
useSchedule: {},
loading: false,
};
},
mounted() {
this.setMenuName("活动管理", "活动池");
this.getActivityTable();
},
methods: {
doShow(show) {
this.showUse = show;
},
inject: ['setMenuName'],
data() {
return {
useModal: false,
addActivityModal: false,
activityList: [],
id: '',
inputActivityList: []
}
getActivityData(id) {
let that = this;
let data = {
instanceId: id,
};
that.loading = true;
ActivityManager.getActivityInfo(data, function(data) {
that.inputActivityList = [];
data.data.results.params.forEach((item) => {
that.inputActivityList.push({
value1: item.name,
value2: item.description,
});
});
this.useModal = true;
that.loading = false;
});
},
getActivityTable() {
let that = this;
ActivityManager.getActivityList({}, function(data) {
that.activityList = data.data.results;
});
},
mounted() {
this.setMenuName("活动管理", "活动池")
this.getActivityTable()
disPlayUseTable(item) {
let that = this;
let data = {
id: item.id,
};
// let data = new FormData()
// data.append('instanceId', item.id)
ActivityManager.getActivityInfo(data, function(data) {
that.useSchedule = data.data.results;
that.showUse = true;
});
},
methods: {
getActivityData(id) {
let that = this
let data = {
instanceId: id
}
ActivityManager.getActivityInfo(data, function (data) {
that.inputActivityList = []
data.data.results.params.forEach(item => {
that.inputActivityList.push({
value1: item.name,
value2: item.description
})
})
this.useModal = true
})
},
getActivityTable() {
let that = this
ActivityManager.getActivityList({}, function (data) {
that.activityList = data.data.results
})
},
disPlayUseTable(item) {
let that = this
let data = {
id: item.id
}
// let data = new FormData()
// data.append('instanceId', item.id)
ActivityManager.getActivityInfo(data, function (data) {
that.inputActivityList = []
data.data.results.params.forEach(item => {
that.inputActivityList.push(item)
})
let useData = {
name: data.data.results.name,
inputActivityList: that.inputActivityList,
scheduleId: item.id,
}
store.commit('SET_useData', useData)
store.commit('SET_ID', item.id)
console.log(store.getters.useData)
that.useModal = true
})
},
dispalyAddActivity(id) {
this.addActivityModal = true
this.id = id.toString()
},
dispalyuseModal(displayModalFlag, isCancle) {
this.useModal = displayModalFlag
if (isCancle === true) {
this.getActivityTable()
}
},
dispalyAddActivityModal(displayModalFlag, isCancle) {
this.addActivityModal = displayModalFlag
if (isCancle === true) {
this.getActivityTable()
}
dispalyAddActivity(id) {
this.addActivityModal = true;
this.id = id.toString();
},
dispalyuseModal(displayModalFlag, isCancle) {
this.useModal = displayModalFlag;
if (isCancle === true) {
this.getActivityTable();
}
}
}
},
dispalyAddActivityModal(displayModalFlag, isCancle) {
this.addActivityModal = displayModalFlag;
if (isCancle === true) {
this.getActivityTable();
}
},
},
};
</script>
<style scoped>
.operateAndThemeItem {
display: flex;
justify-content: space-between;
}
.operateAndThemeItem {
display: flex;
justify-content: space-between;
}
.img {
width: 200px;
height: 200px;
}
.img {
height: 100px;
}
.operateItem {
display: flex;
flex-direction: column;
justify-content: space-between;
color: #6ac1d1;
width: 20%;
text-align: right;
cursor: pointer;
}
.operateItem {
display: flex;
flex-direction: column;
justify-content: space-between;
color: #6ac1d1;
width: 20%;
text-align: right;
cursor: pointer;
}
.ThemeItem {
display: flex;
justify-content: flex-start;
width: 80%;
}
.ThemeItem {
display: flex;
justify-content: flex-start;
width: 80%;
}
.tipItem {
display: flex;
flex-direction: column;
justify-content: space-between;
margin-left: 50px;
}
.tipItem {
display: flex;
flex-direction: column;
justify-content: space-between;
margin-left: 50px;
}
.activityListClass {
margin-bottom: 50px;
}
.activityListClass {
margin-bottom: 50px;
}
.addactivity {
height: 300px;
border: 1px dashed;
text-align: center;
line-height: 300px;
cursor: pointer;
}
.addactivity {
height: 100px;
border: 1px dashed;
text-align: center;
line-height: 100px;
cursor: pointer;
}
</style>

@ -1,236 +1,267 @@
<template>
<Modal v-model="dispalyModal" width="1000" :mask-closable="false" @on-cancel="cancel">
<Modal
v-model="dispalyModal"
width="1000"
:mask-closable="false"
@on-cancel="cancel"
@on-ok="save"
>
<p slot="header" style="color:#f60;text-align:left">
<span>配置活动</span>
<span>配置活动</span>
</p>
<div>基本配置</div>
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">
<Form
ref="formValidate"
:model="formValidate"
:rules="ruleValidate"
:label-width="80"
>
<Row>
<i-col style="text-align: left;" span="8">
<i-col style="text-align: left;" span="8">
<FormItem label="" prop="uploadImg">
<!-- <Upload
type="select"
:on-success="uploadImgSuccess"
:show-upload-list="false"
:before-upload="handleBeforeUpload"
action="//jsonplaceholder.typicode.com/posts/">
<div style="padding: 20px 0;">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>上传活动图片</p>
</div>
</Upload> -->
<Upload
ref='upload'
ref="upload"
:show-upload-list="false"
:on-success="uploadImgSuccess"
:format="['jpg','jpeg','png']"
:format="['jpg', 'jpeg', 'png']"
:max-size="2048"
:before-upload="handleBeforeUpload"
multiple
type="drag"
action=""
style="display: inline-block;">
style="display: inline-block;"
>
<div style="width: 200px;height:200px;line-height: 200px;">
<span v-if="!formValidate.logo"></span>
<img v-if="formValidate.logo" :src="`/kiisoo-ic` + formValidate.logo" alt="" style="width: 100%; height: auto">
<span v-if="!formValidate.logo"></span>
<img
v-if="formValidate.logo"
:src="`/kiisoo-ic` + formValidate.logo"
alt=""
style="width: 100%; height: auto"
/>
</div>
</Upload>
</Upload>
</FormItem>
</i-col>
<i-col span="15" offset="1">
<FormItem label="活动名称" prop="activityName">
<i-input type="text" v-model="formValidate.activityName" placeholder="请输入活动名称"></i-input>
<i-input
type="text"
v-model="formValidate.name"
placeholder="请输入活动名称"
></i-input>
</FormItem>
<Form-item label="活动描述" prop="activityDsc">
<i-input v-model="formValidate.activityDsc" type="textarea" :autosize="{minRows: 3}" placeholder="请输入活动描述"></i-input>
<i-input
v-model="formValidate.description"
type="textarea"
:autosize="{ minRows: 3 }"
placeholder="请输入活动描述"
></i-input>
</Form-item>
<FormItem label="APPID" prop="appId">
<i-input type="text" v-model="formValidate.appId" placeholder="请输入appid"></i-input>
<i-input
type="text"
v-model="formValidate.appId"
placeholder="请输入appid"
></i-input>
</FormItem>
<FormItem label="URI" prop="uri">
<i-input type="text" v-model="formValidate.uri" placeholder="请输入URI"></i-input>
<i-input
type="text"
v-model="formValidate.uri"
placeholder="请输入URI"
></i-input>
</FormItem>
</i-col>
</Row>
</Form>
<div class="topic">活动类型</div>
<Row class="inputItem" v-for="(item, index) in inputActivityList" :key="index">
<i-col :span="2">
类型{{index+1}}
<Row
:gutter="10"
class="inputItem"
v-for="(item, index) in formValidate.params"
:key="index"
>
<i-col :span="2"> 类型{{ index + 1 }} </i-col>
<i-col :span="9">
<i-input
class="inputClass"
type="text"
v-model="item.name"
placeholder="参数名称"
></i-input>
</i-col>
<i-col :span="9">
<i-input
class="inputClass"
type="text"
style="margin-left: 20px"
v-model="item.key"
placeholder="默认值"
></i-input>
</i-col>
<i-col :span="20">
<i-input class="inputClass" type="text" v-model="item.name" placeholder="参数名称"></i-input>
<i-input class="inputClass" type="text" style="margin-left: 20px" v-model="item.defaultVal" placeholder="默认值"></i-input>
<Button style="margin-left: 20px" type="error" @click="delActivityInput(index)"></Button>
<i-col :span="4">
<Button
style="margin-left: 20px"
type="error"
@click="delActivityInput(index)"
>删除</Button
>
</i-col>
</Row>
<Button style="margin-top: 10px" type="primary" @click="addActivityInput">+</Button>
<div style="text-align: center;" slot="footer">
<Button type="primary" size="large" shape="circle" :loading="modal_loading" @click="next"></Button>
</div>
</Modal>
<Button style="margin-top: 10px" type="primary" @click="addActivityInput"
>+添加活动类型</Button
>
</Modal>
</template>
<script>
import ActivityManager from "../../services/ActivityManager/ActivityManager";
import axios from 'axios';
import axios from "axios";
export default {
name: "addActivity",
data() {
return {
return {
dispalyModal: false,
currentStep: 0,
modal_loading: false,
inputActivityList: [],
imageName: '212',
formValidate: {
activityName: '',
activityDsc: '',
appId: '',
uri: '',
logo: '',
},
imageName: "212",
formValidate: {},
ruleValidate: {
activityName: [
{ required: true, message: '活动名称不能为空', trigger: 'blur' }
name: [
{ required: true, message: "活动名称不能为空", trigger: "blur" },
],
activityDsc: [
{ required: true, message: '活动描述不能为空', trigger: 'blur' }
],
appId: [
{ required: true, message: 'appId不能为空', trigger: 'blur' }
],
uri: [
{ required: true, message: 'URI不能为空', trigger: 'blur' }
description: [
{ required: true, message: "活动描述不能为空", trigger: "blur" },
],
appId: [{ required: true, message: "appId不能为空", trigger: "blur" }],
uri: [{ required: true, message: "URI不能为空", trigger: "blur" }],
// uploadImg: [
// { required: true, message: '', trigger: 'blur' }
// ]
}
}
},
};
},
props: {
addActivityModal: Boolean,
id: String
id: String,
},
watch: {
addActivityModal(val) {
this.dispalyModal = val
if(val === true && this.id) {
this.getActivityData()
this.dispalyModal = val;
if (val === true && this.id) {
this.getActivityData();
}
if (this.id == null || this.id.length <= 0) {
this.formValidate = {};
}
if (
typeof this.formValidate.params == "undefined" ||
this.formValidate.params.length <= 0
) {
this.formValidate.params = [
{
defaultVal: "",
description: "",
id: 0,
isRequired: 0,
key: "",
limitLower: "",
limitUpper: "",
name: "",
type: 0,
},
];
}
},
},
mounted() {
},
mounted() {},
methods: {
addActivityInput() {
this.inputActivityList.push({
name: '',
defaultVal: ''
})
this.formValidate.params.push({
defaultVal: "",
description: "",
id: 0,
isRequired: 0,
key: "",
limitLower: "",
limitUpper: "",
name: "",
type: 0,
});
},
delActivityInput(index) {
this.inputActivityList.splice(index,1)
if (this.formValidate.params.length <= 1) {
this.$Message.error("至少需要填写一个活动类型!");
return;
}
this.formValidate.params.splice(index, 1);
},
cancel() {
this.inputActivityList = []
this.formValidate.appId = ''
this.formValidate.activityDsc = ''
this.formValidate.activityName = ''
this.formValidate.uri = ''
this.dispalyModal = false
this.$emit("dispalyAddActivityModal", false, false)
this.$emit("dispalyAddActivityModal", false, false);
},
getActivityData() {
let that = this
let that = this;
let data = {
id: that.id
}
ActivityManager.getActivityInfo(data, function (data) {
that.inputActivityList = []
that.formValidate.appId = data.data.results.appId
that.formValidate.activityDsc = data.data.results.description
that.formValidate.activityName = data.data.results.name
that.formValidate.uri = data.data.results.uri
that.formValidate.logo = data.data.results.logo || '';
data.data.results.params.forEach(item => {
that.inputActivityList.push({
id: item.id,
name: item.name,
defaultVal: item.defaultVal
})
})
})
id: that.id,
};
ActivityManager.getActivityInfo(data, function(data) {
that.formValidate = data.data.results;
});
},
uploadImgSuccess(res, file) {
this.imageName = file.name
this.imageName = file.name;
},
handleBeforeUpload(res) {
const me = this;
let data = new FormData();
data.append('file', res);
data.append("file", res);
axios({
method: 'post',
url: '/upload',
method: "post",
url: "/upload",
data: data,
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(function (res) {
"Content-Type": "multipart/form-data",
},
}).then(function(res) {
if (res.data.success) {
me.formValidate.logo = res.data.results;
}
});
return false;
},
next() {
let that = this
save() {
let that = this;
if (that.formValidate.params.length <= 0) {
that.$Message.error("至少需要填写一个活动类型!");
return;
}
this.$refs["formValidate"].validate((valid) => {
if (valid) {
let param = []
that.inputActivityList.forEach(element => {
param.push({
defaultVal: element.defaultVal,
description: element.name,
key: element.name,
name: element.name,
type: 2,
id: element.id,
})
});
// param = JSON.stringify(param)
let data = {
appId: that.formValidate.appId,
logo: that.formValidate.logo,
name: that.formValidate.activityName,
uri: that.formValidate.uri,
params: param,
isGetActivityInfo: true,
description: that.formValidate.activityDsc,
id: that.id
}
ActivityManager.addOreditActivity(data, function (data) {
console.log(data)
that.addActivityModal = false
that.$emit("dispalyAddActivityModal", false, true)
})
} else {
that.$Message.error('表单验证失败!');
}
})
}
}
}
if (valid) {
// param = JSON.stringify(param)
let data = { ...that.formValidate, isGetActivityInfo: true };
ActivityManager.addOreditActivity(data, function(data) {
that.addActivityModal = false;
that.formValidate = {};
that.$emit("dispalyAddActivityModal", false, true);
});
} else {
that.$Message.error("表单验证失败!");
}
});
},
},
};
</script>
<style scoped>
.inputClass{
width: 1000px;
<style scoped>
.inputClass {
width: 100%;
}
.inputItem{
margin-top: 40px;
.inputItem {
margin-top: 20px;
}
.topic{
margin-top: 100px;
.topic {
margin-top: 20px;
}
</style>
</style>

@ -1,31 +1,58 @@
<template>
<div style="padding: 0 40px;">
<Form ref="formValidate" :model="formValidate" :label-width="80">
<Form ref="formValidate" :model="useData" :label-width="80">
<Row>
<i-col span="15" offset="2">
<i-col span="22" offset="2">
<FormItem label="活动名称" prop="activityName">
<div>{{formValidate.activityName}}</div>
<div>{{ useData.name }}</div>
</FormItem>
<Form-item label="活动时间" prop="activityDate">
<div>{{formValidate.activityDate}}</div>
<div>{{ useData.beginTime }} - {{ useData.endTime }}</div>
</Form-item>
<FormItem label="活动类型" prop="activityStyle">
<div style="display:flex" v-for="(item, index) in formValidate.activityStyle" :key="index">
<i-input class="inputClass" disabled type="text" v-model="item.name" placeholder=""></i-input>
<i-input class="inputClass" style="margin-left: 20px" disabled type="text" v-model="item.defaultVal" placeholder=""></i-input>
<div
style="display:flex"
v-for="(item, index) in useData.params"
:key="index"
>
<i-input
class="inputClass"
disabled
type="text"
v-model="item.name"
placeholder=""
></i-input>
<i-input
class="inputClass"
style="margin-left: 20px"
disabled
type="text"
v-model="item.key"
placeholder=""
></i-input>
</div>
</FormItem>
<FormItem label="活动范围" prop="activityRange">
<div>
<span>{{formValidate.activityRange}}</span>
<span class="mr10">{{formValidate.activityCompanyNum}}家店铺</span>
<Button class="mr10" type="primary" @click="isDisplay">{{operate}}</Button>
</div>
<div v-if="displayActivityShopFlag==true" class="activityShopClass">
<div class="mr10" v-for="(item, index) in formValidate.activityShop" :key="index">
<Tag class="tagClass" color="blue">{{item.name}}</Tag>
</div>
</div>
<Collapse simple>
<Panel :key="index" v-for="(item, index) in groups">
{{
item.name
}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{
item.stores.length
}}家店铺
<div slot="content">
<div class="activityShopClass">
<div
class="mr10"
v-for="(item, index) in item.stores"
:key="index"
>
<Tag class="tagClass" color="blue">{{ item.name }}</Tag>
</div>
</div>
</div>
</Panel>
</Collapse>
</FormItem>
</i-col>
</Row>
@ -33,58 +60,53 @@
</div>
</template>
<script>
import store from "../../store/index"
import store from "../../store/index";
export default {
name: "useActivityStepFoure",
data() {
return {
formValidate: {
activityName: '',
activityDate: "",
activityStyle: [],
activityRange: '上海分公司',
activityCompanyNum: '35',
activityShop: []
},
operate: '收起',
displayActivityShopFlag: false
}
return {
useData: store.getters.useData,
operate: "收起",
displayActivityShopFlag: false,
groups: [],
};
},
mounted() {
this.formValidate.activityName = store.getters.useData.name
this.formValidate.activityDate = store.getters.useData.activityStartDate + '-' + store.getters.useData.activityEndDate
this.formValidate.activityStyle = store.getters.useData.inputActivityList
created() {
let _this = this;
console.log(this.useData.stores);
this.useData.company.forEach((item) => {
item.stores = _this._.filter(
this.useData.stores,
(s) => s.companyId == item.id || s.parentId == item.id
);
_this.groups.push(item);
});
console.log(this.groups);
},
methods: {
isDisplay() {
if(this.operate === '展开') {
this.operate = '收起'
this.displayActivityShopFlag = false
if (this.operate === "展开") {
this.operate = "收起";
this.displayActivityShopFlag = false;
} else {
this.operate = '展开'
this.displayActivityShopFlag = true
this.operate = "展开";
this.displayActivityShopFlag = true;
}
}
}
}
},
},
};
</script>
<style scoped>
<style scoped>
.activityShopClass {
display: flex;
justify-content: space-between;
justify-content: start;
flex-wrap: wrap;
}
.mr10 {
margin-left: 40px;
margin-right: 20px;
}
.tagClass {
width: 360px;
text-align: center;
}
.inputClass{
width: 1000px;
}
</style>
</style>

@ -1,25 +1,65 @@
<template>
<div>
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">
<Form
ref="formValidate"
:model="formValidate"
:rules="ruleValidate"
:label-width="80"
>
<Row>
<i-col span="20" offset="2">
<FormItem label="活动名称" prop="activityName">
<div>{{formValidate.activityName}}</div>
<FormItem label="活动名称" prop="name">
<div>
<i-input
disabled
type="text"
v-model="schedule.name"
placeholder
></i-input>
</div>
</FormItem>
<div class="dateClass">
<Form-item label="活动时间" prop="activityStartDate">
<Date-picker @on-change="storeStartDate" type="date" v-model="formValidate.activityStartDate" format="yyyy-MM-dd" placeholder="请选择开始日期" style="width: 200px"></Date-picker>
<Date-picker
@on-change="storeStartDate"
type="date"
v-model="formValidate.activityStartDate"
format="yyyy-MM-dd"
placeholder="请选择开始日期"
style="width: 200px"
></Date-picker>
</Form-item>
<div class="text"></div>
<Form-item label="" prop="activityEndDate">
<Date-picker @on-change="storeEndDate" type="date" v-model="formValidate.activityEndDate" format="yyyy-MM-dd" placeholder="请选择结束日期" style="width: 200px"></Date-picker>
<Form-item label prop="activityEndDate">
<Date-picker
@on-change="storeEndDate"
type="date"
v-model="formValidate.activityEndDate"
format="yyyy-MM-dd"
placeholder="请选择结束日期"
style="width: 200px"
></Date-picker>
</Form-item>
</div>
<FormItem label="活动类型" prop="activityStyle">
<div v-for="(item, index) in formValidate.activityStyle" :key="index">
<i-input class="inputClass" disabled type="text" v-model="item.name" placeholder=""></i-input>
<i-input class="inputClass" style="margin-left: 20px" disabled type="text" v-model="item.defaultVal" placeholder=""></i-input>
</div>
<RadioGroup v-model="formValidate.activityStyle" vertical>
<Radio
:border="true"
v-for="(item, index) in schedule.params"
:key="index"
:label="item.id"
style="margin-bottom: 10px"
>
<Icon type="social-apple"></Icon>
<span
>{{
item.name
}}&nbsp;&nbsp;&nbsp;&nbsp;----&nbsp;&nbsp;&nbsp;&nbsp;{{
item.key
}}</span
>
</Radio>
</RadioGroup>
</FormItem>
</i-col>
</Row>
@ -27,70 +67,80 @@
</div>
</template>
<script>
import store from "../../store/index"
import store from "../../store/index";
import { mapGetters } from "vuex";
export default {
name: "useActivityStepOne",
data() {
return {
formValidate: {
activityName: '',
activityStartDate: '',
activityEndDate: '',
activityStyle: [],
},
flag: store.getters.useModal,
ruleValidate: {
activityName: [
{required: true, message: '活动名称不能为空', trigger: 'blur'}
],
activityStartDate: [
{required: true, type: 'date', message: '开始时间不能为空', trigger: 'change'}
],
activityEndDate: [
{required: true, type: 'date', message: '结束时间不能为空', trigger: 'change'}
],
activityStyle: [
{required: true, message: '', trigger: 'blur'}
],
}
}
},
props: {
displayUseModal: Boolean
},
watch: {
displayUseModal() {
this.formValidate.activityName = store.getters.useData.name
this.formValidate.activityStyle = store.getters.useData.inputActivityList
},
},
mounted() {
this.formValidate.activityName = store.getters.useData.name
this.formValidate.activityStyle = store.getters.useData.inputActivityList
},
methods: {
storeStartDate(date) {
store.getters.useData.activityStartDate = date
},
storeEndDate(date) {
store.getters.useData.activityEndDate = date
}
export default {
name: "useActivityStepOne",
data() {
return {
formValidate: store.getters.useData,
ruleValidate: {
activityName: [
{ required: true, message: "活动名称不能为空", trigger: "blur" },
],
activityStartDate: [
{
required: true,
type: "date",
message: "开始时间不能为空",
trigger: "change",
},
],
activityEndDate: [
{
required: true,
type: "date",
message: "结束时间不能为空",
trigger: "change",
},
],
activityStyle: [{ required: true, message: "", trigger: "blur" }],
},
};
},
props: {
schedule: Object,
},
created() {
this.formValidate = store.getters.useData;
},
watch: {
["formValidate.activityStyle"]() {
let _this = this;
let type = {};
this.schedule.params.forEach((item) => {
if (item.id == _this.formValidate.activityStyle) {
type = item;
}
}
});
store.getters.useData.params = [type];
},
},
methods: {
storeStartDate(date) {
store.getters.useData.beginTime = date;
},
storeEndDate(date) {
store.getters.useData.endTime = date;
},
},
};
</script>
<style scoped>
.dateClass {
display: flex;
}
.dateClass {
display: flex;
}
.text {
position: relative;
left: 100px;
}
.text {
position: relative;
left: 100px;
}
.inputClass {
width: 1000px;
}
</style>
.inputClass {
width: 45%;
margin-bottom: 10px;
margin-right: 20px;
}
</style>

@ -1,121 +1,214 @@
<template>
<div style="padding: 0 40px;">
<div class="selectClass">
<Checkbox v-model="allSelect" @on-change="isSelectAllCompany"></Checkbox>
<i-input icon="search" placeholder="请输入店铺名称或编码" style="width: 250px"></i-input>
<Checkbox
:indeterminate="indeterminate"
:value="allSelect"
@click.prevent.native="handleCheckAll"
>&nbsp;&nbsp;&nbsp;全选</Checkbox
>
<i-input
icon="search"
@on-change="doSearch"
placeholder="请输入店铺名称"
style="width: 250px"
></i-input>
</div>
<div class="companyTable">
<div class="companyListClass">
<div :class="isSelect[index] == true ? 'tagColorClass' : ''" class="tagClass" @click="selectTag(item,index)" v-for="(item, index) in shopList" :key="index" >{{item.label}}</div>
<Row :gutter="10">
<div v-if="loading" style="padding: 50px 0" class="loading">
<Spin fix>加载中...</Spin>
</div>
<CheckboxGroup size="large" @on-change="onChange" v-model="isSelect">
<i-col span="8" :key="index" v-for="(item, index) in shopList">
<Checkbox size="large" :label="item.value" border>
<span>{{ item.label }}</span>
</Checkbox>
</i-col>
</CheckboxGroup>
</Row>
</div>
</div>
</div>
</template>
<script>
import ActivityManager from "../../services/ActivityManager/ActivityManager"
import store from "../../store/index"
import ActivityManager from "../../services/ActivityManager/ActivityManager";
import store from "../../store/index";
export default {
name: "useActivityStepThree",
data() {
return {
return {
indeterminate: false,
allSelect: false,
shopList: [],
isSelect:[],
isSelect: [],
selectValue: [],
shopListData: []
}
shopListData: [],
loading: false,
companys: store.getters.useData.company,
orginShopList: [],
};
},
mounted() {
this.getShopInfo()
mounted() {
this.getShopInfo();
let _this = this;
if (store.getters.useData.stores) {
store.getters.useData.stores.forEach((item) => {
_this.isSelect.push(item.id);
});
}
},
methods: {
handleCheckAll() {
if (this.indeterminate) {
this.allSelect = false;
} else {
this.allSelect = !this.allSelect;
}
this.indeterminate = false;
if (this.allSelect) {
this.shopList.forEach((item) => {
this.isSelect.push(item.value);
});
} else {
this.isSelect = [];
}
},
doSearch(e) {
const keyword = e.target.value;
let that = this;
that.shopList = [];
if (keyword.length > 0) {
that.orginShopList.forEach((item) => {
if (item.label.indexOf(keyword) >= 0) {
that.shopList.push(item);
}
});
} else {
that.shopList = that.orginShopList;
}
},
onChange(data) {
let _this = this;
if (data.length === this.isSelect.length) {
this.indeterminate = false;
this.allSelect = true;
} else if (data.length > 0) {
this.indeterminate = true;
this.allSelect = false;
} else {
this.indeterminate = false;
this.allSelect = false;
}
store.getters.useData.stores = [];
data.forEach((item) => {
const s = _this._.find(_this.shopListData, (shop) => shop.id == item);
if (s) {
store.getters.useData.stores.push(
_this._.find(_this.shopListData, (shop) => shop.id == item)
);
}
});
},
getShopInfo() {
let that = this
let that = this;
let companyIds = [];
this.companys.forEach((item) => {
companyIds.push(item.id);
});
let data = {
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId
}
ActivityManager.getShop(data, function (data) {
that.shopList = []
that.shopListData = data.data.results
data.data.results.forEach(element => {
that.isSelect.push('')
that.selectValue.push('')
that.shopList.push({
label: element.name,
value: element.id
})
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId,
customerIds: companyIds.join(","),
};
that.loading = true;
ActivityManager.getShop(data, function(data) {
that.shopList = [];
that.shopListData = data.data.results;
data.data.results.forEach((element) => {
that.isSelect.push("");
that.selectValue.push("");
that.shopList.push({
label: element.name,
value: element.id,
});
})
that.orginShopList = that.shopList;
});
that.loading = false;
});
},
isSelectAllCompany() {
if(this.allSelect === true) {
this.isSelect.forEach((element,index) => {
this.isSelect.splice(index,1,true)
})
this.shopList.forEach((element,index) => {
this.selectValue.splice(index,1,element.id)
})
if (this.allSelect === true) {
this.isSelect.forEach((element, index) => {
this.isSelect.splice(index, 1, true);
});
this.shopList.forEach((element, index) => {
this.selectValue.splice(index, 1, element.id);
});
} else {
this.isSelect.forEach((element,index) => {
this.isSelect.splice(index,1,'')
})
this.shopList.forEach((element,index) => {
this.selectValue.splice(index,1,'')
})
this.isSelect.forEach((element, index) => {
this.isSelect.splice(index, 1, "");
});
this.shopList.forEach((element, index) => {
this.selectValue.splice(index, 1, "");
});
}
},
selectTag(value,index) {
this.isSelect.splice(index,1,!this.isSelect[index])
if(this.isSelect[index] === true) {
this.selectValue.splice(index, 1, value.value)
} else if(this.isSelect[index] === false) {
this.selectValue.splice(index, 1, '')
selectTag(value, index) {
this.isSelect.splice(index, 1, !this.isSelect[index]);
if (this.isSelect[index] === true) {
this.selectValue.splice(index, 1, value.value);
} else if (this.isSelect[index] === false) {
this.selectValue.splice(index, 1, "");
}
let selectShopValue = []
this.isSelect.forEach((element,index) => {
if(element === true) {
selectShopValue.push(this.selectValue[index])
let selectShopValue = [];
this.isSelect.forEach((element, index) => {
if (element === true) {
selectShopValue.push(this.selectValue[index]);
}
})
let selectShopValueObject = []
for(let j=0; j< selectShopValue.length; j++) {
for(let i = 0; i< this.shopList.length; i++){
if(this.shopList[i].value === selectShopValue[j]) {
selectShopValueObject.push(this.shopListData[i])
});
let selectShopValueObject = [];
for (let j = 0; j < selectShopValue.length; j++) {
for (let i = 0; i < this.shopList.length; i++) {
if (this.shopList[i].value === selectShopValue[j]) {
selectShopValueObject.push(this.shopListData[i]);
}
}
}
store.getters.useData.selectShopValue = selectShopValueObject
}
}
}
store.getters.useData.selectShopValue = selectShopValueObject;
},
},
};
</script>
<style scoped>
<style scoped>
.selectClass {
display: flex;
justify-content: space-between;
}
.companyTable {
width: 3150px;
height: 1000px;
border: 1px solid;
margin-top: 40px;
padding: 40px;
overflow:scroll;
height: 250px;
overflow-y: scroll;
width: 100%;
overflow-x: hidden;
margin-top: 10px;
}
.companyListClass {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.ivu-checkbox-wrapper.ivu-checkbox-large {
width: 100%;
font-size: 12px;
margin-bottom: 10px;
}
.ivu-checkbox + span {
margin-left: 4px;
}
.tagClass {
width: 31%;
margin-bottom: 30px;
height: 120px;
line-height: 120px;
border: 1px solid #e3e8ee!important;
color: #657180!important;
border: 1px solid #e3e8ee !important;
color: #657180 !important;
background: #fff;
padding: 0 12px;
cursor: pointer;
@ -123,4 +216,4 @@ export default {
.tagColorClass {
background: #6ac1d1;
}
</style>
</style>

@ -1,121 +1,170 @@
<template>
<div style="padding: 0 40px;">
<div class="selectClass">
<Checkbox v-model="allSelect" @on-change="isSelectAllCompany"></Checkbox>
<i-input icon="search" placeholder="请输入零售公司名称或编码" style="width: 250px"></i-input>
<Checkbox
:indeterminate="indeterminate"
:value="allSelect"
@click.prevent.native="handleCheckAll"
>&nbsp;&nbsp;&nbsp;全选</Checkbox
>
<i-input
icon="search"
@on-change="doSearch"
placeholder="请输入零售公司名称"
style="width: 250px"
></i-input>
</div>
<div class="companyTable">
<div class="companyListClass">
<div :class="isSelect[index] == true ? 'tagColorClass' : ''" class="tagClass" @click="selectTag(item,index)" v-for="(item, index) in companyList" :key="index" >{{item.label}}</div>
<Row :gutter="10">
<div v-show="loading" style="padding: 50px 0" class="loading">
<Spin fix>加载中...</Spin>
</div>
<CheckboxGroup
size="large"
@on-change="onChange"
v-model="checkCompanys"
>
<i-col span="8" :key="index" v-for="(item, index) in companyList">
<Checkbox size="large" :label="item.value" border>
<span>{{ item.label }}</span>
</Checkbox>
</i-col>
</CheckboxGroup>
</Row>
</div>
</div>
</div>
</template>
<script>
import ActivityManager from "../../services/ActivityManager/ActivityManager"
import store from "../../store/index"
import ActivityManager from "../../services/ActivityManager/ActivityManager";
import store from "../../store/index";
export default {
name: "useActivityStepTwo",
data() {
return {
return {
indeterminate: false,
allSelect: false,
companyList: [],
isSelect:[],
selectValue: [],
companyListdata:[]
}
companyListdata: [],
checkCompanys: [],
orginCompanyList: [],
loading: false,
};
},
mounted() {
this.getCompanyInfo()
mounted() {
this.getCompanyInfo();
let _this = this;
if (store.getters.useData.company) {
store.getters.useData.company.forEach((item) => {
_this.checkCompanys.push(item.id);
});
}
},
methods: {
getCompanyInfo() {
let that = this
let data = {
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId
onChange(data) {
let _this = this;
if (data.length === this.companyList.length) {
this.indeterminate = false;
this.allSelect = true;
} else if (data.length > 0) {
this.indeterminate = true;
this.allSelect = false;
} else {
this.indeterminate = false;
this.allSelect = false;
}
ActivityManager.getCompany(data, function (data) {
that.companyList = []
that.companyListdata = data.data.results
data.data.results.forEach(element => {
that.isSelect.push('')
that.selectValue.push('')
that.companyList.push({
label: element.name,
value: element.id
})
});
})
store.getters.useData.company = [];
data.forEach((item) => {
const c = _this._.find(
_this.companyListdata,
(shop) => shop.id == item
);
if (c) {
store.getters.useData.company.push(c);
}
});
},
isSelectAllCompany() {
if(this.allSelect === true) {
this.isSelect.forEach((element,index) => {
this.isSelect.splice(index,1,true)
})
this.companyList.forEach((element,index) => {
this.selectValue.splice(index,1,element.id)
})
doSearch(e) {
const keyword = e.target.value;
let that = this;
that.companyList = [];
if (keyword.length > 0) {
that.orginCompanyList.forEach((item) => {
if (item.label.indexOf(keyword) >= 0) {
that.companyList.push(item);
}
});
} else {
this.isSelect.forEach((element,index) => {
this.isSelect.splice(index,1,'')
})
this.companyList.forEach((element,index) => {
this.selectValue.splice(index,1,'')
})
that.companyList = that.orginCompanyList;
}
},
selectTag(value, index) {
this.isSelect.splice(index,1,!this.isSelect[index])
if(this.isSelect[index] === true) {
this.selectValue.splice(index, 1, value.value)
} else if(this.isSelect[index] === false) {
this.selectValue.splice(index, 1, '')
getCompanyInfo() {
let that = this;
let data = {
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId,
};
this.loading = true;
ActivityManager.getCompany(data, function(data) {
that.companyList = [];
that.companyListdata = data.data.results;
data.data.results.forEach((element) => {
that.companyList.push({
label: element.name,
value: element.id,
});
that.orginCompanyList = that.companyList;
});
that.loading = false;
});
},
handleCheckAll() {
if (this.indeterminate) {
this.allSelect = false;
} else {
this.allSelect = !this.allSelect;
}
let selectCompanyValue = []
this.isSelect.forEach((element,index) => {
if(element === true) {
selectCompanyValue.push(this.selectValue[index])
}
})
let selectCompanyValueObject = []
for(let j=0; j< selectCompanyValue.length; j++) {
for(let i = 0; i< this.companyList.length; i++){
if(this.companyList[i].value === selectCompanyValue[j]) {
selectCompanyValueObject.push(this.companyListdata[i])
}
}
this.indeterminate = false;
if (this.allSelect) {
this.companyList.forEach((item) => {
this.checkCompanys.push(item.value);
});
} else {
this.checkCompanys = [];
}
store.getters.useData.selectCompanyValue = selectCompanyValueObject
}
}
}
},
},
};
</script>
<style scoped>
<style scoped>
.selectClass {
display: flex;
justify-content: space-between;
}
.companyTable {
width: 3150px;
height: 1000px;
border: 1px solid;
margin-top: 40px;
padding: 40px;
overflow:scroll;
height: 250px;
overflow-y: scroll;
width: 100%;
overflow-x: hidden;
margin-top: 10px;
}
.companyListClass {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.ivu-checkbox-wrapper.ivu-checkbox-large {
width: 100%;
font-size: 12px;
margin-bottom: 10px;
}
.ivu-checkbox + span {
margin-left: 4px;
}
.tagClass {
width: 31%;
margin-bottom: 30px;
height: 120px;
line-height: 120px;
border: 1px solid #e3e8ee!important;
color: #657180!important;
border: 1px solid #e3e8ee !important;
color: #657180 !important;
background: #fff;
padding: 0 12px;
cursor: pointer;
@ -123,4 +172,4 @@ export default {
.tagColorClass {
background: #6ac1d1;
}
</style>
</style>

@ -1,118 +1,166 @@
<template>
<Modal v-model="displayUseModal" @on-cancel="cancel" width="1000">
<Steps style="padding: 40px;" :current="currentStep">
<Step title="基本信息" content=""></Step>
<Step title="选择零售公司" content=""></Step>
<Step title="选择店铺" content=""></Step>
<Step title="确认信息" content=""></Step>
</Steps>
<useActivityStepOne :displayUseModal="displayUseModal" v-if="currentStep==0"></useActivityStepOne>
<useActivityStepTwo v-if="currentStep==1"></useActivityStepTwo>
<useActivityStepThree v-if="currentStep==2"></useActivityStepThree>
<useActivityStepFoure v-if="currentStep==3"></useActivityStepFoure>
<div slot="footer">
<Button v-if="currentStep!==0" type="primary" shape="circle" :loading="modal_loading" @click="back"></Button>
<Button v-if="currentStep!==3" type="primary" shape="circle" :loading="modal_loading" @click="next"></Button>
<Button v-if="currentStep==3" type="primary" shape="circle" :loading="modal_loading" @click="finish"></Button>
</div>
<div class="use_box">
<Modal
:scrollable="false"
v-model="showUse"
title="使用活动"
@on-cancel="cancel"
:loading="modal_loading"
width="70%"
>
<Steps style="padding: 40px;" :current="currentStep">
<Step title="基本信息"></Step>
<Step title="选择零售公司" content></Step>
<Step title="选择店铺" content></Step>
<Step title="确认信息" content></Step>
</Steps>
<useActivityStepOne
:schedule="schedule"
v-if="currentStep == 0"
></useActivityStepOne>
<useActivityStepTwo
:schedule="schedule"
v-if="currentStep == 1"
></useActivityStepTwo>
<useActivityStepThree
:schedule="schedule"
v-if="currentStep == 2"
></useActivityStepThree>
<useActivityStepFoure
:schedule="schedule"
v-if="currentStep == 3"
></useActivityStepFoure>
<div slot="footer">
<Button
v-if="currentStep !== 0"
type="primary"
shape="circle"
:loading="modal_loading"
@click="back"
>上一步</Button
>
<Button
v-if="currentStep !== 3"
type="primary"
shape="circle"
:loading="modal_loading"
@click="next"
>下一步</Button
>
<Button
v-if="currentStep == 3"
type="primary"
shape="circle"
:loading="modal_loading"
@click="finish"
>完成</Button
>
</div>
</Modal>
</div>
</template>
<script>
import useActivityStepOne from './useActivityStepOne'
import useActivityStepTwo from './useActivityStepTwo'
import useActivityStepThree from './useActivityStepThree'
import useActivityStepFoure from './useActivityStepFoure'
import ActivityManager from "../../services/ActivityManager/ActivityManager"
import store from "../../store/index"
import useActivityStepOne from "./useActivityStepOne";
import useActivityStepTwo from "./useActivityStepTwo";
import useActivityStepThree from "./useActivityStepThree";
import useActivityStepFoure from "./useActivityStepFoure";
import ActivityManager from "../../services/ActivityManager/ActivityManager";
import store from "../../store/index";
export default {
name: "useTable",
components: {
useActivityStepOne,
useActivityStepTwo,
useActivityStepThree,
useActivityStepFoure
},
useActivityStepFoure,
},
data() {
return {
return {
currentStep: 0,
modal_loading: false,
displayUseModal: false
}
showUse: false,
};
},
props: {
useModal: Boolean,
id: String
id: String,
schedule: {},
show: Boolean,
},
watch: {
useModal(val) {
this.displayUseModal = val
}
},
mounted() {
console.log(this.useModal)
show() {
this.showUse = this.show;
},
schedule() {
store.getters.useData.scheduleId = this.schedule.id;
},
},
mounted() {},
methods: {
cancel() {
this.$emit("dispalyuseModal", false, false)
this.currentStep = 0
this.currentStep = 0;
},
cancel() {
store.commit("RSET_useData");
this.$emit("doShow", false);
this.modal_loading = false;
this.showUse = false;
this.currentStep = 0;
},
next() {
const data = store.getters.useData;
if (this.currentStep === 0) {
if (!data.activityStartDate) {
this.$Message.error('请填写活动开始时间');
return;
}
if (!data.activityEndDate) {
this.$Message.error('请填写活动结束时间');
return;
}
if (data.activityStartDate > data.activityEndDate) {
this.$Message.error('开始时间不能晚于结束时间');
return;
}
let data = store.getters.useData;
data.name = this.schedule.name;
if (this.currentStep === 0) {
if (data.params.length <= 0) {
this.$Message.error("请选择活动类型");
return;
}
if (!data.beginTime) {
this.$Message.error("请填写活动开始时间");
return;
}
if (!data.endTime) {
this.$Message.error("请填写活动结束时间");
return;
}
if (this.currentStep === 1) {
if (!data.selectCompanyValue || data.selectCompanyValue.length === 0) {
this.$Message.error('请至少选择1家公司');
return;
}
if (data.beginTime > data.endTime) {
this.$Message.error("开始时间不能晚于结束时间");
return;
}
if (this.currentStep === 2) {
if (!data.selectShopValue || data.selectShopValue.length === 0) {
this.$Message.error('请至少选择1家店铺');
return;
}
}
if (this.currentStep === 1) {
if (!data.company || data.company.length === 0) {
this.$Message.error("请至少选择1家公司");
return;
}
}
if (this.currentStep === 2) {
if (!data.stores || data.stores.length === 0) {
this.$Message.error("请至少选择1家店铺");
return;
}
this.currentStep = this.currentStep + 1
}
store.commit("SET_useData", data);
this.currentStep = this.currentStep + 1;
},
back() {
this.currentStep = this.currentStep - 1
this.currentStep = this.currentStep - 1;
},
finish() {
let that = this
console.log(store.getters.useData)
let data = {
beginTime: store.getters.useData.activityStartDate,
endTime: store.getters.useData.activityEndDate,
name: store.getters.useData.name,
organizations: store.getters.useData.selectCompanyValue,
params: store.getters.useData.inputActivityList,
stores: store.getters.useData.selectShopValue,
id: store.getters.useData.id,
scheduleId: store.getters.useData.scheduleId,
isGetActivityInfo: true
}
ActivityManager.saveActivityData(data, function (data) {
that.$emit("dispalyuseModal", false, false)
that.$router.push('/activity/plan');
that.currentStep = 0
})
}
}
}
let that = this;
let data = store.getters.useData;
data.isGetActivityInfo = true;
this.modal_loading = true;
ActivityManager.saveActivityData(store.getters.useData, function(data) {
store.commit("RSET_useData");
that.$emit("doShow", false);
that.$router.push("/activity/plan");
that.currentStep = 0;
that.modal_loading = false;
that.showUse = false;
});
},
},
};
</script>
<style scoped>
</style>
<style></style>

@ -4,7 +4,7 @@
* @date 2020/05/19
*/
import http from '../CommonHttp'
import http from "../CommonHttp";
/**
* 活动池列表
@ -13,56 +13,56 @@ import http from '../CommonHttp'
* @returns {Promise<any>} 返回Promise对象
*/
export function getActivityList(params, call) {
return http.get('/activity/schedule/list/all', params).then(call)
return http.get("/activity/schedule/list/all", params).then(call);
}
/**
* 新增或修改活动池
*/
export function addOreditActivity(params, call) {
return http.post('/activity/schedule/save',params).then(call)
return http.post("/activity/schedule/save", params).then(call);
}
/**
* 获取活动池详情
*/
export function getActivityInfo(params, call) {
return http.get('/activity/schedule/detail',params).then(call)
return http.get("/activity/schedule/detail", params).then(call);
}
/**
* 上传图片
*/
export function uploadImg(params, call) {
return http.post('/upload',params).then(call)
return http.post("/upload", params).then(call);
}
/**
* 获取零售公司
*/
export function getCompany(params, call) {
return http.get('/retail/company',params).then(call)
return http.get("/retail/company", params).then(call);
}
/**
* 获取店铺
*/
export function getShop(params, call) {
return http.post('poi/store/user/shop',params).then(call)
return http.post("poi/store/user/shopDTO", params).then(call);
}
/**
* 根据活动池新建/编辑实例
*/
export function saveActivityData(params, call) {
return http.post('activity/instance/save',params).then(call)
return http.post("activity/instance/save", params).then(call);
}
/**
* 活动实例分页列表
*/
export function getActivityTableData(params, call) {
return http.get('activity/instance/list',params).then(call)
return http.get("activity/instance/list", params).then(call);
}
export default {
@ -73,5 +73,5 @@ export default {
getCompany,
getShop,
getActivityTableData,
saveActivityData
}
saveActivityData,
};

@ -0,0 +1,5 @@
const getters = {
activityUseData: (state) => state.activity.useData,
};
export default getters;

@ -1,16 +1,16 @@
import Vue from 'vue'
import Vuex from 'vuex'
import home from './modules/home'
import activity from './modules/activity'
import createLogger from 'vuex/dist/logger'
import Vue from "vue";
import Vuex from "vuex";
import home from "./modules/home";
import activity from "./modules/activity";
import createLogger from "vuex/dist/logger";
Vue.use(Vuex)
const debug = true
Vue.use(Vuex);
const debug = true;
export default new Vuex.Store({
modules: {
home,
activity
activity,
},
plugins: debug ? [createLogger()] : []
})
plugins: debug ? [createLogger()] : [],
});

@ -1,35 +1,54 @@
import * as types from './mutation-type'
import * as types from "./mutation-type";
const activity = {
state: {
useData: {},
useData: {
beginTime: "",
endTime: "",
id: null,
name: "",
params: [],
scheduleId: null,
stores: [],
company: [],
},
useModal: false,
id: '',
id: "",
store: [],
company: [],
},
mutations: {
[types.SET_useData](state, useData) {
state.useData = useData
state.useData = useData;
},
[types.RSET_useData](state) {
state.useData = {
beginTime: "",
endTime: "",
id: null,
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
},
useModal: state => {
return state.useModal
},
id: state => {
return state.id
}
}
}
export default activity
useData: (state) => {
return state.useData;
},
useModal: (state) => {
return state.useModal;
},
id: (state) => {
return state.id;
},
},
};
export default activity;

@ -1,4 +1,5 @@
export const SET_NUM = 'SET_NUM'
export const SET_ID = 'SET_ID'
export const SET_useData = 'SET_useData'
export const SET_useModal = 'SET_useModal'
export const SET_NUM = "SET_NUM";
export const SET_ID = "SET_ID";
export const SET_useData = "SET_useData";
export const RSET_useData = "RSET_useData";
export const SET_useModal = "SET_useModal";

@ -31,19 +31,19 @@ module.exports = {
// proxy: 'http://192.168.1.123:8312/'
// proxy: 'http://192.168.31.177:8312/'
// proxy: 'http://localhost:8312/'
proxy: "http://111.231.218.44:8080/",
proxy: "http://localhost:8080/",
// proxy: 'http://jdxdev.vipgz4.idcfengye.com/'
},
chainWebpack: (config) => {
config.module
.rule("css")
.test(/\.css$/)
.oneOf("vue")
.resourceQuery(/\?vue/)
.use("px2rem")
.loader("px2rem-loader")
.options({
remUnit: 40,
});
// config.module
// .rule("css")
// .test(/\.css$/)
// .oneOf("vue")
// .resourceQuery(/\?vue/)
// .use("px2rem")
// .loader("px2rem-loader")
// .options({
// remUnit: 40,
// });
},
};

Loading…
Cancel
Save