index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view class="enterprise">
  3. <view class="enterprise-title">我管理的店铺</view>
  4. <view class="e-ul">
  5. <view v-for="(item, index) in enterprise_list" :key="index" class="e-li clearfix" @click="goShop(item)">
  6. <view class="float_left"><image :src="item.logo" mode="aspectFill"></image></view>
  7. <view class="float_left en-info">
  8. <view class="en-name">{{ item.enterpriseName }}</view>
  9. <view class="en-time">有效期: {{ $u.timeFormat(item.expireTime) }}</view>
  10. </view>
  11. <view class="status-r">
  12. <u-tag v-if="item.expireStatus" text="已打烊" size="mini" mode="plain" type="info" />
  13. <u-tag v-else text="营业中" size="mini" mode="plain" type="success" />
  14. <text class="custom-icon custom-icon-jinru"></text>
  15. </view>
  16. </view>
  17. <u-loadmore status="nomore" />
  18. </view>
  19. <view class="submit-btn" @click="logout"><view class="btn-min">切换登录账号</view></view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. enterprise_list: []
  27. };
  28. },
  29. onLoad() {
  30. this.getAllEnterprise();
  31. },
  32. methods: {
  33. // 获取企业列表
  34. getAllEnterprise() {
  35. this.$u.api.getAllEnterprise().then(res => {
  36. this.enterprise_list = res.data;
  37. });
  38. },
  39. // 切换登录账号(退出登录)
  40. logout() {
  41. uni.clearStorageSync();
  42. this.$store.commit('commit_hasLogin', false);
  43. this.goPage('/pages/login/index', 'reLaunch');
  44. },
  45. // 进入企业
  46. async goShop(row) {
  47. this.$store.commit('commit_enToken', row.token);
  48. this.$store.commit('commit_enterprise', row);
  49. await this.getAclList(row.roleType);
  50. await this.getStaffByToken(row.roleType);
  51. this.goPage('/pages/index/index','switchTab')
  52. },
  53. // 获取登录权限
  54. async getAclList(roleType){
  55. await this.$u.api.getAclList(roleType).then(res=>{
  56. this.$store.commit('commit_access', res.data);
  57. })
  58. },
  59. async getStaffByToken(roleType){
  60. await this.$u.api.getStaffByToken(roleType).then(res=>{
  61. this.$store.commit('commit_userInfo', res.data);
  62. })
  63. }
  64. }
  65. };
  66. </script>
  67. <style lang="scss" scoped>
  68. .enterprise {
  69. padding-bottom: 140rpx;
  70. .enterprise-title {
  71. font-size: 24rpx;
  72. font-weight: 600;
  73. line-height: 80rpx;
  74. padding: 0 25rpx;
  75. }
  76. .e-ul {
  77. .e-li {
  78. width: 700rpx;
  79. margin: 0 auto 20rpx;
  80. background-color: #ffffff;
  81. border-radius: 10rpx;
  82. padding: 20rpx;
  83. position: relative;
  84. image {
  85. width: 100rpx;
  86. height: 100rpx;
  87. border-radius: 100%;
  88. margin-right: 20rpx;
  89. }
  90. .en-info {
  91. .en-name {
  92. padding-top: 10rpx;
  93. font-weight: 700;
  94. }
  95. .en-time {
  96. padding-top: 10rpx;
  97. font-size: 22rpx;
  98. color: #999999;
  99. }
  100. }
  101. .status-r {
  102. position: absolute;
  103. top: 50%;
  104. transform: translateY(-50%);
  105. right: 20rpx;
  106. .custom-icon {
  107. vertical-align: middle;
  108. margin-left: 10rpx;
  109. color: #333333;
  110. font-size: 28rpx;
  111. }
  112. }
  113. }
  114. }
  115. }
  116. </style>