|
|
@@ -17,7 +17,12 @@
|
|
|
<span>{{ item.name }}</span>
|
|
|
</el-menu-item>
|
|
|
</el-menu> -->
|
|
|
-
|
|
|
+ <el-dropdown class="user_top" trigger="click" @command="shopCommand" v-if="shopShow">
|
|
|
+ <div>{{currentShop}} <i class="el-icon-caret-bottom"></i></div>
|
|
|
+ <el-dropdown-menu slot="dropdown" class="popper-dropdown-menu-user">
|
|
|
+ <el-dropdown-item v-for="(item, index) in shopList" :key="index" :class="{'shopActive': item.id == userInfo.currentShopId}" :command="item">{{item.shopName}}</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
<div class="flex1"></div>
|
|
|
|
|
|
<!-- <ul class="tools">
|
|
|
@@ -55,7 +60,8 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
$projectName: this.$projectName,
|
|
|
- index: '0'
|
|
|
+ index: '0',
|
|
|
+ shopList: []
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -66,6 +72,7 @@ export default {
|
|
|
// this.SET_MENU_LIST(i);
|
|
|
// }
|
|
|
// });
|
|
|
+ this.getAllShop()
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
@@ -75,7 +82,20 @@ export default {
|
|
|
return this.shopInfo.smallLogoUrl;
|
|
|
}
|
|
|
return '';
|
|
|
- }
|
|
|
+ },
|
|
|
+ currentShop() {
|
|
|
+ let str
|
|
|
+ this.shopList.map(ele => {
|
|
|
+ console.log(ele.id, this.userInfo.currentShopId)
|
|
|
+ if(ele.id == this.userInfo.currentShopId) {
|
|
|
+ str = ele.shopName
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return str
|
|
|
+ },
|
|
|
+ shopShow(){
|
|
|
+ return this.userInfo.super == 1 && this.shopList.length > 1
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
@@ -101,6 +121,19 @@ export default {
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
+ shopCommand(item) {
|
|
|
+ console.log(item)
|
|
|
+ this.$service.common.toggleShop({shopId: item.id}).then(res => {
|
|
|
+ this.$router.go(0)
|
|
|
+ }).catch(err => {console.log(err,1111111)})
|
|
|
+ },
|
|
|
+ // 获取门店
|
|
|
+ getAllShop() {
|
|
|
+ this.$service.common.shopAll().then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.shopList = res
|
|
|
+ }).catch(err => {})
|
|
|
+ },
|
|
|
layoutGlobalKd(){
|
|
|
this.$router.push('/order/add');
|
|
|
}
|
|
|
@@ -258,5 +291,11 @@ export default {
|
|
|
margin-left: 10px;
|
|
|
}
|
|
|
}
|
|
|
+ .user_top{
|
|
|
+ min-width: 100px;
|
|
|
+ margin-left: 50px;
|
|
|
+ cursor: pointer;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|