feature_0521
zhenghuang 5 years ago
parent e83a02fb9e
commit 9589780eb7

@ -1,341 +1,367 @@
<template> <template>
<div class="layout"> <div class="layout">
<Layout :style="{minHeight: '100vh'}"> <Layout :style="{minHeight: '100vh'}">
<Sider collapsible :collapsed-width="78" v-model="isCollapsed" :hide-trigger="true" > <Sider collapsible
:collapsed-width="78"
v-model="isCollapsed"
:hide-trigger="true">
<div style="margin: 40px 0 20px 10px;font-weight: bold;font-size: 30px;color: #ffffff;"> <div style="margin: 40px 0 20px 10px;font-weight: bold;font-size: 30px;color: #ffffff;">
<Poptip placement="bottom-start" width="200" :offset="-8"> <Poptip placement="bottom-start"
<img src="../../static/img/avatar.png" style="width: 32px;vertical-align: middle;cursor: pointer"/> width="200"
<div slot="content"> :offset="-8">
<div style="cursor: pointer;" @click="logoutClick"> <img src="../../static/img/avatar.png"
<span class="logout-span">退出登录</span> style="width: 32px;vertical-align: middle;cursor: pointer" />
<img class="logout-img" src="../../static/img/logout.png"/> <div slot="content">
</div> <div style="cursor: pointer;"
</div> @click="logoutClick">
</Poptip> <span class="logout-span">退出登录</span>
<span class="project-title">优客后台管理</span> <img class="logout-img"
</div> src="../../static/img/logout.png" />
</div>
</div>
</Poptip>
<span class="project-title">优客后台管理</span>
</div>
<Menu ref="menu" :active-name="selectedItemName" :open-names="openName" theme="dark" width="auto" <Menu ref="menu"
@on-select="onSelectLister" :accordion="true"> :active-name="selectedItemName"
<MenuItem v-if="roleCode === 'GLY-ADMIN' || roleCode === 'DG-YUNYING' || roleCode === 'GL-YUNYING'" :name="0" to="/customer/view"> :open-names="openName"
<Icon type="ios-paper"/> theme="dark"
<span style="margin-left: 7px">首页</span> width="auto"
</MenuItem> @on-select="onSelectLister"
<Submenu :name="item.id" v-for="item in onePermissionList" :key="item.id"> :accordion="true">
<template slot="title"> <MenuItem v-if="roleCode === 'GLY-ADMIN' || roleCode === 'DG-YUNYING' || roleCode === 'GL-YUNYING'"
<Icon type="ios-paper"/> :name="0"
{{item.name}} to="/customer/view">
</template> <Icon type="ios-paper" />
<MenuItem :name="cItem.id" :to="cItem.resource" v-for="cItem in item.subMenuList" <span style="margin-left: 7px">首页</span>
:key="cItem.id"> </MenuItem>
{{cItem.name}} <Submenu :name="item.id"
</MenuItem> v-for="item in onePermissionList"
</Submenu> :key="item.id">
</Menu> <template slot="title">
</Sider> <Icon type="ios-paper" />
<Layout> {{item.name}}
<!-- <Header :style="{background: '#fff', boxShadow: '0 2px 3px 2px rgba(0,0,0,.1)'}"></Header>--> </template>
<Content :style="{padding: '0 16px 16px'}"> <MenuItem :name="cItem.id"
<Breadcrumb :style="{margin: '16px 0'}"> :to="cItem.resource"
<BreadcrumbItem><span style="cursor: pointer" @click="breadcrumbClick">{{selectedMenu}}</span></BreadcrumbItem> v-for="cItem in item.subMenuList"
<BreadcrumbItem>{{selectedSubMenu}}</BreadcrumbItem> :key="cItem.id">
</Breadcrumb> {{cItem.name}}
<Card> </MenuItem>
<div :style="{'min-height':mHeight + 'px'}"> </Submenu>
<router-view/> </Menu>
</div> </Sider>
</Card> <Layout>
</Content> <!-- <Header :style="{background: '#fff', boxShadow: '0 2px 3px 2px rgba(0,0,0,.1)'}"></Header>-->
</Layout> <Content :style="{padding: '0 16px 16px'}">
</Layout> <Breadcrumb :style="{margin: '16px 0'}">
</div> <BreadcrumbItem><span style="cursor: pointer"
@click="breadcrumbClick">{{selectedMenu}}</span></BreadcrumbItem>
<BreadcrumbItem>{{selectedSubMenu}}</BreadcrumbItem>
</Breadcrumb>
<Card>
<div :style="{'min-height':mHeight + 'px'}">
<router-view />
</div>
</Card>
</Content>
</Layout>
</Layout>
</div>
</template> </template>
<script> <script>
import homeRequest from "../services/home/homeRequest"; import homeRequest from "../services/home/homeRequest";
export default { export default {
provide() { provide () {
return { return {
checkParamBlank: this.checkParamBlank, checkParamBlank: this.checkParamBlank,
setMenuName: this.setMenuName, setMenuName: this.setMenuName,
}; };
}, },
data() { data () {
return { return {
roleCode: JSON.parse(sessionStorage.getItem("loginInfo")).roleCode, roleCode: JSON.parse(sessionStorage.getItem("loginInfo")).roleCode,
mainUrl: "/customer/view", mainUrl: "/customer/view",
isCollapsed: false, isCollapsed: false,
mHeight: 600, mHeight: 600,
selectedItemName: "", selectedItemName: "",
openName: [], openName: [],
selectedMenu: '', selectedMenu: '',
selectedSubMenu: '', selectedSubMenu: '',
// //
onePermissionLevel: 1, onePermissionLevel: 1,
twoPermissionLevel: 2, twoPermissionLevel: 2,
threePermissionLevel: 3, threePermissionLevel: 3,
//-1 //-1
onePermissionList: [], onePermissionList: [],
//2 //2
twoPermissionList: [], twoPermissionList: [],
//3 //3
threePermissionList: [], threePermissionList: [],
// //
breadcrumbUrl: "", breadcrumbUrl: "",
} }
}, },
mounted() { mounted () {
let that = this; let that = this;
this.bus.$on('callBack', function (item) { this.bus.$on('callBack', function (item) {
that.callBack(item); that.callBack(item);
}) })
// this.bus.$on('setHeader', function (data) { // this.bus.$on('setHeader', function (data) {
// that.setHeader(data); // that.setHeader(data);
// }) // })
}, },
created() { created () {
// this.mHeight = window.screen.availHeight - 22; // this.mHeight = window.screen.availHeight - 22;
// //
this.listOnePermission(this.onePermissionLevel); this.listOnePermission(this.onePermissionLevel);
}, },
computed: { computed: {
}, },
watch: { watch: {
'selectedItemName' (val) { 'selectedItemName' (val) {
console.log(val); console.log(val);
let that = this; let that = this;
// that.openName = [that.onePermissionList[2]]; // that.openName = [that.onePermissionList[2]];
this.$nextTick(() => { this.$nextTick(() => {
that.$refs.menu.updateActiveName(); that.$refs.menu.updateActiveName();
}); });
} }
}, },
methods: { methods: {
onSelectLister(val) { onSelectLister (val) {
let i; let i;
this.onePermissionList.forEach(function (data) { this.onePermissionList.forEach(function (data) {
data.subMenuList.forEach(function (dta) { data.subMenuList.forEach(function (dta) {
if(dta.id === val){ if (dta.id === val) {
i = dta; i = dta;
} }
}) })
}); });
if(i){ if (i) {
sessionStorage.setItem("threeLevel",JSON.stringify(i.subMenuList)); sessionStorage.setItem("threeLevel", JSON.stringify(i.subMenuList));
} }
// //
if(val === 0){ if (val === 0) {
this.selectedMenu = "首页"; this.selectedMenu = "首页";
this.selectedSubMenu = ""; this.selectedSubMenu = "";
this.breadcrumbUrl = this.mainUrl; this.breadcrumbUrl = this.mainUrl;
} }
for (let i = 0; i < this.onePermissionList.length; i++) { for (let i = 0; i < this.onePermissionList.length; i++) {
let item = this.onePermissionList[i]; let item = this.onePermissionList[i];
for (let k = 0; k < item.subMenuList.length; k++) { for (let k = 0; k < item.subMenuList.length; k++) {
let cItem = item.subMenuList[k]; let cItem = item.subMenuList[k];
if (cItem.id === val) { if (cItem.id === val) {
this.selectedMenu = item.name; this.selectedMenu = item.name;
this.selectedSubMenu = cItem.name; this.selectedSubMenu = cItem.name;
this.selectedItemName = cItem.id; this.selectedItemName = cItem.id;
this.breadcrumbUrl = cItem.resource; this.breadcrumbUrl = cItem.resource;
} }
} }
} }
}, },
// //
checkParamBlank: function (obj) { checkParamBlank: function (obj) {
for (let param in obj) { for (let param in obj) {
obj[param] = this.checkBlank(obj[param]); obj[param] = this.checkBlank(obj[param]);
} }
}, },
// //
checkBlank: function (data) { checkBlank: function (data) {
if (!data && data != 0) { if (!data && data != 0) {
return "--"; return "--";
} else { } else {
return data; return data;
} }
}, },
// //
listOnePermission(level) { listOnePermission (level) {
let that = this; let that = this;
let userId = JSON.parse(sessionStorage.getItem("loginInfo")).userId; let userId = JSON.parse(sessionStorage.getItem("loginInfo")).userId;
let request = { let request = {
userId: userId, userId: userId,
level: level level: level
}; };
homeRequest.listUserLoginPermissionApi(request, function (data) { homeRequest.listUserLoginPermissionApi(request, function (data) {
data = data.data; data = data.data;
if (data.code === '0001') { if (data.code === '0001') {
that.$Message.error("查询用户权限出错"); that.$Message.error("查询用户权限出错");
return; return;
} }
if (data.code === '0000') { if (data.code === '0000') {
data = data.results; data = data.results;
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let row = data[i]; let row = data[i];
row.class = 'head-permission'; row.class = 'head-permission';
that.onePermissionList.push(row); that.onePermissionList.push(row);
} }
that.listTwoPermission(that.twoPermissionLevel); that.listTwoPermission(that.twoPermissionLevel);
} }
}) })
}, },
// //
listTwoPermission(level) { listTwoPermission (level) {
let userId = JSON.parse(sessionStorage.getItem("loginInfo")).userId; let userId = JSON.parse(sessionStorage.getItem("loginInfo")).userId;
let that = this; let that = this;
that.twoPermissionList = []; that.twoPermissionList = [];
let request = { let request = {
userId: userId, userId: userId,
level: level level: level
}; };
homeRequest.listUserLoginPermissionApi(request, function (data) { homeRequest.listUserLoginPermissionApi(request, function (data) {
data = data.data; data = data.data;
if (data.code === '0001') { if (data.code === '0001') {
that.$Message.error("查询用户权限出错"); that.$Message.error("查询用户权限出错");
return; return;
} }
if (data.code === '0000') { if (data.code === '0000') {
data = data.results; data = data.results;
that.twoPermissionList = []; that.twoPermissionList = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let row = data[i]; let row = data[i];
that.twoPermissionList.push(row); that.twoPermissionList.push(row);
} }
that.listThreePermission(that.threePermissionLevel); that.listThreePermission(that.threePermissionLevel);
} }
}) })
}, },
// //
listThreePermission(level) { listThreePermission (level) {
let userId = JSON.parse(sessionStorage.getItem("loginInfo")).userId; let userId = JSON.parse(sessionStorage.getItem("loginInfo")).userId;
let that = this; let that = this;
that.threePermissionList = []; that.threePermissionList = [];
let request = { let request = {
userId: userId, userId: userId,
level: level level: level
}; };
homeRequest.listUserLoginPermissionApi(request, function (data) { homeRequest.listUserLoginPermissionApi(request, function (data) {
data = data.data; data = data.data;
if (data.code === '0001') { if (data.code === '0001') {
that.$Message.error("查询用户权限出错"); that.$Message.error("查询用户权限出错");
return; return;
} }
if (data.code === '0000') { if (data.code === '0000') {
data = data.results; data = data.results;
that.threePermissionList = []; that.threePermissionList = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let row = data[i]; let row = data[i];
that.threePermissionList.push(row); that.threePermissionList.push(row);
} }
that.twoPermissionList.forEach(function (two) { that.twoPermissionList.forEach(function (two) {
// //
let three = that.threePermissionList.filter(function (data) { let three = that.threePermissionList.filter(function (data) {
return data.pid === two.id return data.pid === two.id
}); });
two.subMenuList = three; two.subMenuList = three;
}); });
that.onePermissionList.forEach(function (one) { that.onePermissionList.forEach(function (one) {
// //
let two = that.twoPermissionList.filter(function (data) { let two = that.twoPermissionList.filter(function (data) {
return data.pid === one.id return data.pid === one.id
}); });
one.subMenuList = two; one.subMenuList = two;
}); });
// //
that.menuInit(); that.menuInit();
} }
}) })
}, },
// //
menuInit: function () { menuInit: function () {
let that = this; let that = this;
if(this.roleCode === 'GLY-ADMIN' || this.roleCode === 'DG-YUNYING' || this.roleCode === 'GL-YUNYING'){ if (this.roleCode === 'GLY-ADMIN' || this.roleCode === 'DG-YUNYING' || this.roleCode === 'GL-YUNYING') {
// //
that.selectedItemName = 0; that.selectedItemName = 0;
this.$router.push({path: that.mainUrl}); this.$router.push({ path: that.mainUrl });
this.selectedMenu = "首页"; this.selectedMenu = "首页";
this.breadcrumbUrl = this.mainUrl; this.breadcrumbUrl = this.mainUrl;
}else{ } else {
that.selectedItemName = that.onePermissionList[0].subMenuList[0].id; that.selectedItemName = that.onePermissionList[0].subMenuList[0].id;
that.openName = [that.onePermissionList[0].id]; that.openName = [that.onePermissionList[0].id];
this.selectedMenu = this.onePermissionList[0].name; this.selectedMenu = this.onePermissionList[0].name;
this.selectedSubMenu = this.onePermissionList[0].subMenuList[0].name; this.selectedSubMenu = this.onePermissionList[0].subMenuList[0].name;
sessionStorage.setItem("threeLevel",JSON.stringify(this.onePermissionList[0].subMenuList[0].subMenuList)); sessionStorage.setItem("threeLevel", JSON.stringify(this.onePermissionList[0].subMenuList[0].subMenuList));
// this.$nextTick(() => { // this.$nextTick(() => {
// this.$refs.menu.updateOpened(); // this.$refs.menu.updateOpened();
// this.$refs.menu.updateActiveName(); // this.$refs.menu.updateActiveName();
// }); // });
this.$router.push({path: that.onePermissionList[0].subMenuList[0].resource}); this.$router.push({ path: that.onePermissionList[0].subMenuList[0].resource });
} }
}, },
// //
callBack(item) { callBack (item) {
let that = this; let that = this;
this.selectedMenu = "设置管理"; this.selectedMenu = "设置管理";
this.selectedSubMenu = "账户管理"; this.selectedSubMenu = "账户管理";
this.selectedItemName = this.onePermissionList[2].subMenuList[0].id; this.selectedItemName = this.onePermissionList[2].subMenuList[0].id;
this.$router.push({path: '/account/manager',query:item}); this.$router.push({ path: '/account/manager', query: item });
}, },
setHeader(data){ setHeader (data) {
let that = this; let that = this;
this.selectedSubMenu = data.header; this.selectedSubMenu = data.header;
this.$nextTick(() => { this.$nextTick(() => {
that.$refs.menu.updateActiveName(); that.$refs.menu.updateActiveName();
}) })
}, },
// //
setMenuName: function (menu1, menu2) { setMenuName: function (menu1, menu2) {
this.selectedMenu = menu1; console.log("setMenu", arguments)
this.selectedSubMenu = menu2; this.selectedMenu = menu1;
}, this.selectedSubMenu = menu2;
// let parentId;
breadcrumbClick: function () { let subId;
if(this.selectedMenu === "首页"){ this.onePermissionList.forEach(item => {
this.selectedSubMenu = ""; if (item.name == menu1) parentId = item.id
} })
this.$router.push(this.breadcrumbUrl); this.$forceUpdate()
}, },
// //
logoutClick: function () { breadcrumbClick: function () {
sessionStorage.setItem("loginInfo", ""); if (this.selectedMenu === "首页") {
sessionStorage.setItem("userId", ""); this.selectedSubMenu = "";
sessionStorage.setItem("roleCode", ""); }
this.$router.push('/login'); this.$router.push(this.breadcrumbUrl);
this.$Message.info("登出成功"); },
} //
}, logoutClick: function () {
sessionStorage.setItem("loginInfo", "");
sessionStorage.setItem("userId", "");
sessionStorage.setItem("roleCode", "");
this.$router.push('/login');
this.$Message.info("登出成功");
} }
},
}
</script> </script>
<style scoped> <style scoped>
.layout-con {
.layout-con { height: 100%;
height: 100%; width: 100%;
width: 100%; }
} /*项目标题*/
/*项目标题*/ .project-title {
.project-title{ font-size: 22px;
font-size: 22px; margin-left: 15px;
margin-left: 15px; }
} /*退出登入*/
/*退出登入*/ .logout-span {
.logout-span{ font-size: 15px;
font-size: 15px; vertical-align: middle;
vertical-align: middle; color: #535353;
color: #535353; }
} .logout-img {
.logout-img{ vertical-align: middle;
vertical-align: middle; margin-left: 80px;
margin-left: 80px; }
}
</style> </style>

@ -1,46 +1,50 @@
<template> <template>
<div class="use_box"> <div class="use_box">
<Modal <Modal :scrollable="false"
:scrollable="false" v-model="showUse"
v-model="showUse" title="使用活动"
title="使用活动" @on-cancel="cancel"
@on-cancel="cancel" :loading="true"
:loading="true" width="70%"
width="70%" @on-visible-change="visibleChange">
@on-visible-change="visibleChange" <Steps style="padding: 40px;"
> :current="currentStep">
<Steps style="padding: 40px;" :current="currentStep">
<Step title="基本信息"></Step> <Step title="基本信息"></Step>
<Step :title="isModify ? '修改零售公司' : '选择零售公司'" content></Step> <Step :title="isModify ? '修改零售公司' : '选择零售公司'"
<Step :title="isModify ? '修改店铺' : '选择店铺'" content></Step> content></Step>
<Step title="确认信息" content></Step> <Step :title="isModify ? '修改店铺' : '选择店铺'"
content></Step>
<Step title="确认信息"
content></Step>
</Steps> </Steps>
<useActivityStepOne :schedule="schedule" :isModify="isModify" v-if="currentStep == 0 && show"></useActivityStepOne> <useActivityStepOne :schedule="schedule"
<useActivityStepTwo :schedule="schedule" :isModify="isModify" v-if="currentStep == 1"></useActivityStepTwo> :isModify="isModify"
<useActivityStepThree :schedule="schedule" :isModify="isModify" v-if="currentStep == 2"></useActivityStepThree> v-if="currentStep == 0 && show"></useActivityStepOne>
<useActivityStepFoure :schedule="schedule" :isModify="isModify" v-if="currentStep == 3"></useActivityStepFoure> <useActivityStepTwo :schedule="schedule"
:isModify="isModify"
v-if="currentStep == 1"></useActivityStepTwo>
<useActivityStepThree :schedule="schedule"
:isModify="isModify"
v-if="currentStep == 2"></useActivityStepThree>
<useActivityStepFoure :schedule="schedule"
:isModify="isModify"
v-if="currentStep == 3"></useActivityStepFoure>
<div slot="footer"> <div slot="footer">
<Button <Button v-if="currentStep !== 0"
v-if="currentStep !== 0" type="primary"
type="primary" shape="circle"
shape="circle" :loading="modal_loading"
:loading="modal_loading" @click="back">上一步</Button>
@click="back" <Button v-if="currentStep !== 3"
>上一步</Button> type="primary"
<Button shape="circle"
v-if="currentStep !== 3" :loading="modal_loading"
type="primary" @click="next">下一步</Button>
shape="circle" <Button v-if="currentStep == 3"
:loading="modal_loading" type="primary"
@click="next" shape="circle"
>下一步</Button> :loading="modal_loading"
<Button @click="finish">完成</Button>
v-if="currentStep == 3"
type="primary"
shape="circle"
:loading="modal_loading"
@click="finish"
>完成</Button>
</div> </div>
</Modal> </Modal>
</div> </div>
@ -62,7 +66,7 @@ export default {
useActivityStepFoure useActivityStepFoure
}, },
inject: ["setMenuName"], inject: ["setMenuName"],
data() { data () {
return { return {
currentStep: 0, currentStep: 0,
modal_loading: false, modal_loading: false,
@ -83,27 +87,26 @@ export default {
} }
}, },
watch: { watch: {
show() { show () {
this.showUse = this.show; this.showUse = this.show;
}, },
schedule() { schedule () {
store.getters.useData.scheduleId = this.schedule.id; store.getters.useData.scheduleId = this.schedule.id;
} }
}, },
created() { created () {
this.setMenuName("活动管理", "活动计划");
}, },
mounted() {}, mounted () { },
methods: { methods: {
visibleChange(show) {}, visibleChange (show) { },
cancel() { cancel () {
store.commit("RSET_useData"); store.commit("RSET_useData");
this.$emit("doShow", false); this.$emit("doShow", false);
this.modal_loading = false; this.modal_loading = false;
this.showUse = false; this.showUse = false;
this.currentStep = 0; this.currentStep = 0;
}, },
next() { next () {
let data = store.getters.useData; let data = store.getters.useData;
data.name = this.schedule.name; data.name = this.schedule.name;
if (this.currentStep === 0) { if (this.currentStep === 0) {
@ -146,17 +149,18 @@ export default {
store.commit("SET_useData", data); store.commit("SET_useData", data);
this.currentStep = this.currentStep + 1; this.currentStep = this.currentStep + 1;
}, },
back() { back () {
this.currentStep = this.currentStep - 1; this.currentStep = this.currentStep - 1;
}, },
finish() { finish () {
let that = this; let that = this;
let data = store.getters.useData; let data = store.getters.useData;
data.isGetActivityInfo = true; data.isGetActivityInfo = true;
this.modal_loading = true; this.modal_loading = true;
ActivityManager.saveActivityData(store.getters.useData, function(data) { ActivityManager.saveActivityData(store.getters.useData, function (data) {
store.commit("RSET_useData"); store.commit("RSET_useData");
that.$emit("doShow", false); that.$emit("doShow", false);
that.setMenuName("活动管理", "活动计划");
that.$router.push("/activity/plan"); that.$router.push("/activity/plan");
that.currentStep = 0; that.currentStep = 0;
that.modal_loading = false; that.modal_loading = false;

Loading…
Cancel
Save