TeamDetail.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="container">
  3. <!-- 导航栏 -->
  4. <div class="nav-bar">
  5. <div class="back-btn" @click="$router.back()">
  6. <i class="arrow-left"></i>
  7. </div>
  8. <div class="title">团队明细</div>
  9. </div>
  10. <div class="content">
  11. <!-- 切换按钮组 -->
  12. <div class="tab-group">
  13. <div
  14. class="tab-item"
  15. :class="{ active: currentType === 1 }"
  16. @click="switchType(1)"
  17. >一代</div>
  18. <div
  19. class="tab-item"
  20. :class="{ active: currentType === 2 }"
  21. @click="switchType(2)"
  22. >二代</div>
  23. <div
  24. class="tab-item"
  25. :class="{ active: currentType === 3 }"
  26. @click="switchType(3)"
  27. >三代</div>
  28. </div>
  29. <!-- 统计信息 -->
  30. <div class="stats-bar">
  31. <div class="stats-item">总人数:{{ teamList.length || 0 }}人</div>
  32. <div class="stats-item">有效总人数:{{ teamInfo.yxuser || 0 }}人</div>
  33. </div>
  34. <!-- 团队列表 -->
  35. <div class="team-list">
  36. <div v-for="item in teamList" :key="item.userId" class="member-card">
  37. <div style="display: flex; align-items: center; margin-bottom: 8px;">
  38. <span style="color: #888;">{{ item.id }}</span>
  39. <span style="background: #e6b7e6; color: #fff; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; margin-right: 10px;margin-left: 10px;">{{ item.level }}</span>
  40. <span style="font-weight: bold; margin-right: 10px;">{{ item.mobile }}</span>
  41. </div>
  42. <div style="margin-bottom: 4px;">直推人数 {{ item.zhituicount }}人</div>
  43. <div>邀请时间 {{ item.createtime }}</div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. import { getMyTeam } from '@/api/profile';
  51. export default {
  52. name: 'TeamDetail',
  53. data() {
  54. return {
  55. currentType: 1,
  56. teamInfo: {
  57. yxuser: 0
  58. },
  59. teamList: []
  60. }
  61. },
  62. created() {
  63. this.getTeamInfo();
  64. },
  65. methods: {
  66. async getTeamInfo() {
  67. try {
  68. const res = await getMyTeam(this.currentType);
  69. if (res && res.data) {
  70. this.teamInfo = {
  71. yxuser: res.data.yxuser || 0
  72. };
  73. this.teamList = res.data.list || [];
  74. }
  75. } catch (error) {
  76. console.error('获取团队信息失败:', error);
  77. this.teamInfo = {
  78. yxuser: 0
  79. };
  80. this.teamList = [];
  81. }
  82. },
  83. switchType(type) {
  84. this.currentType = type;
  85. this.getTeamInfo();
  86. }
  87. }
  88. }
  89. </script>
  90. <style scoped>
  91. .container {
  92. min-height: 100vh;
  93. background: #f5f5f5;
  94. }
  95. .nav-bar {
  96. height: 44px;
  97. background-color: #ed4b39;
  98. color: #fff;
  99. display: flex;
  100. align-items: center;
  101. position: relative;
  102. padding: 0 15px;
  103. }
  104. .back-btn {
  105. width: 24px;
  106. height: 44px;
  107. display: flex;
  108. align-items: center;
  109. cursor: pointer;
  110. }
  111. .arrow-left {
  112. width: 12px;
  113. height: 12px;
  114. border-left: 2px solid #fff;
  115. border-bottom: 2px solid #fff;
  116. transform: rotate(45deg);
  117. }
  118. .title {
  119. position: absolute;
  120. left: 50%;
  121. transform: translateX(-50%);
  122. font-size: 16px;
  123. font-weight: 500;
  124. }
  125. .content {
  126. padding: 15px;
  127. }
  128. .tab-group {
  129. width: 96%;
  130. height: 40px;
  131. background-color: #f8f8f8;
  132. display: flex;
  133. justify-content: space-between;
  134. line-height: 40px;
  135. text-align: center;
  136. margin: 20px auto;
  137. border-radius: 2px;
  138. }
  139. .tab-item {
  140. width: 33.33%;
  141. cursor: pointer;
  142. color: #333;
  143. transition: all 0.3s;
  144. }
  145. .tab-item:first-child {
  146. border-radius: 2px 0 0 2px;
  147. }
  148. .tab-item:last-child {
  149. border-radius: 0 2px 2px 0;
  150. }
  151. .tab-item.active {
  152. background: #2196f3;
  153. color: #fff;
  154. }
  155. .stats-bar {
  156. width: 96%;
  157. height: 40px;
  158. background-color: #f8f8f8;
  159. display: flex;
  160. justify-content: space-between;
  161. line-height: 40px;
  162. text-align: center;
  163. margin: 10px auto;
  164. border-radius: 2px;
  165. }
  166. .stats-item {
  167. width: 50%;
  168. font-size: 14px;
  169. color: #333;
  170. }
  171. .stats-item:first-child {
  172. border-right: 0.5px solid #ccc;
  173. }
  174. .team-list {
  175. margin-top: 15px;
  176. }
  177. .member-card {
  178. background: #fff;
  179. border-radius: 12px;
  180. padding: 16px;
  181. margin-bottom: 16px;
  182. box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  183. }
  184. </style>