index.vue 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118
  1. <template>
  2. <view class="team-container">
  3. <!-- 团队数据概览 -->
  4. <view class="team-overview">
  5. <view class="overview-card">
  6. <view class="card-header">
  7. <text class="card-title">团队总览</text>
  8. </view>
  9. <view class="stats-grid">
  10. <view class="stat-item primary">
  11. <view class="stat-icon">
  12. <u-icon name="account" size="36" color="#8B5CF6"></u-icon>
  13. </view>
  14. <view class="stat-content">
  15. <text class="stat-value">{{teamData.level1Count}}</text>
  16. <text class="stat-label">直属下级</text>
  17. </view>
  18. </view>
  19. <view class="stat-item secondary">
  20. <view class="stat-icon">
  21. <u-icon name="account-fill" size="36" color="#6366F1"></u-icon>
  22. </view>
  23. <view class="stat-content">
  24. <text class="stat-value">{{teamData.level2Count}}</text>
  25. <text class="stat-label">间接下级</text>
  26. </view>
  27. </view>
  28. <view class="stat-item success">
  29. <view class="stat-icon">
  30. <u-icon name="shopping-cart" size="36" color="#10B981"></u-icon>
  31. </view>
  32. <view class="stat-content">
  33. <text class="stat-value">{{teamData.totalBuyCount}}</text>
  34. <text class="stat-label">总购买数</text>
  35. </view>
  36. </view>
  37. <view class="stat-item warning">
  38. <view class="stat-icon">
  39. <u-icon name="rmb-circle" size="36" color="#F59E0B"></u-icon>
  40. </view>
  41. <view class="stat-content">
  42. <text class="stat-value">¥{{teamData.totalAmount}}</text>
  43. <text class="stat-label">总金额</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <!-- 团队成员列表 -->
  50. <view class="team-list">
  51. <view class="list-header">
  52. <view class="header-left">
  53. <text class="header-title">我的团队</text>
  54. </view>
  55. <view class="header-right">
  56. <view class="count-display">
  57. <text class="total-count">共{{teamData.totalCount}}人</text>
  58. <view class="level-indicators">
  59. <view class="level-indicator" v-if="teamData.level1Count > 0">
  60. <view class="indicator-dot level-1"></view>
  61. <text>{{teamData.level1Count}}人(1级)</text>
  62. </view>
  63. <view class="level-indicator" v-if="teamData.level2Count > 0">
  64. <view class="indicator-dot level-2"></view>
  65. <text>{{teamData.level2Count}}人(2级)</text>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 树形结构展示 -->
  72. <view class="team-tree">
  73. <!-- 根节点(我) -->
  74. <view class="tree-node root-node" :data-level="0">
  75. <view class="node-content" @click="toggleNode('root')">
  76. <view class="node-info">
  77. <view class="avatar-wrapper">
  78. <image class="avatar" :src="'/static/images/avatar.png'" mode="aspectFill"></image>
  79. <view class="avatar-tag root-tag">我</view>
  80. </view>
  81. <view class="info">
  82. <text class="name">我的账号</text>
  83. <text class="level">{{getLevelText(user.level || 0)}}</text>
  84. <!-- 个人购买统计 -->
  85. <view class="personal-stats"
  86. v-if="personalStats.productCount > 0 || personalStats.totalAmount > 0">
  87. <text class="stat">购买{{personalStats.productCount}}件</text>
  88. <text class="stat">金额¥{{personalStats.totalAmount}}</text>
  89. </view>
  90. <view class="team-summary" v-if="teamData.totalCount > 0">
  91. <text class="summary-text">团队{{teamData.totalCount}}人</text>
  92. </view>
  93. </view>
  94. </view>
  95. <view class="node-actions">
  96. <view class="expand-info" v-if="teamData.level1Count > 0">
  97. <text class="member-preview">{{teamData.level1Count}}个直属</text>
  98. </view>
  99. <view class="btn-order1" @click.stop="viewOrders(user.id)">
  100. <text>我的订单</text>
  101. </view>
  102. <view class="expand-icon" :class="{ 'expanded': expandedNodes.root }">
  103. <u-icon :name="expandedNodes.root ? 'arrow-up' : 'arrow-down'" size="28"
  104. :color="expandedNodes.root ? '#8B5CF6' : '#64748b'"></u-icon>
  105. </view>
  106. </view>
  107. </view>
  108. <!-- 子节点 -->
  109. <view class="children level-1-children" v-if="expandedNodes.root && teamData.members.length > 0">
  110. <view class="tree-node level-1-node" v-for="(member, index) in teamData.members"
  111. :key="member.id" :data-level="1">
  112. <view class="node-content" @click="toggleNode(member.id)">
  113. <view class="node-info">
  114. <view class="avatar-wrapper">
  115. <image class="avatar" :src="member.avatar || '/static/images/avatar.png'"
  116. mode="aspectFill"></image>
  117. <view class="level-badge level-1">L1</view>
  118. </view>
  119. <view class="info">
  120. <text class="name">{{member.account}}</text>
  121. <text class="level">{{getLevelText(member.level)}}</text>
  122. <view class="member-stats">
  123. <text class="stat">购买{{member.buyCount || 0}}件</text>
  124. <text class="stat">金额¥{{formatAmount(member.amount)}}</text>
  125. </view>
  126. <view class="team-summary" v-if="member.hasChildren">
  127. <text class="summary-text">有下级团队</text>
  128. </view>
  129. </view>
  130. </view>
  131. <view class="node-actions">
  132. <view class="action-buttons">
  133. <view class="btn-order" @click.stop="viewOrders(member.id)">
  134. <u-icon name="list" size="22" color="#8B5CF6"></u-icon>
  135. <text>订单</text>
  136. </view>
  137. <!-- <view class="member-preview" v-if="member.hasChildren">
  138. <view class="preview-indicator">
  139. <u-icon name="arrow-right" size="16" color="#6366F1"></u-icon>
  140. </view>
  141. <text class="preview-label">有下级</text>
  142. </view> -->
  143. </view>
  144. <view class="expand-icon" v-if="member.hasChildren"
  145. :class="{ 'expanded': expandedNodes[member.id] }">
  146. <u-icon :name="expandedNodes[member.id] ? 'arrow-up' : 'arrow-down'" size="26"
  147. :color="expandedNodes[member.id] ? '#8B5CF6' : '#64748b'"></u-icon>
  148. </view>
  149. </view>
  150. </view>
  151. <!-- 孙节点 -->
  152. <view class="children level-2-children"
  153. v-if="expandedNodes[member.id] && member.children && member.children.length > 0">
  154. <view class="tree-node level-2-node" v-for="(child, childIndex) in member.children"
  155. :key="child.id" :data-level="2">
  156. <view class="node-content">
  157. <view class="node-info">
  158. <view class="avatar-wrapper">
  159. <image class="avatar" :src="child.avatar || '/static/images/avatar.png'"
  160. mode="aspectFill"></image>
  161. <view class="level-badge level-2">L2</view>
  162. </view>
  163. <view class="info">
  164. <text class="name">{{child.account}}</text>
  165. <text class="level">{{getLevelText(child.level)}}</text>
  166. <view class="member-stats">
  167. <text class="stat">购买{{child.buyCount || 0}}件</text>
  168. <text class="stat">金额¥{{formatAmount(child.amount)}}</text>
  169. </view>
  170. </view>
  171. </view>
  172. <view class="node-actions">
  173. <view class="action-buttons">
  174. <view class="btn-order" @click.stop="viewOrders(child.id)">
  175. <u-icon name="list" size="20" color="#8B5CF6"></u-icon>
  176. <text>订单</text>
  177. </view>
  178. </view>
  179. </view>
  180. </view>
  181. </view>
  182. </view>
  183. </view>
  184. </view>
  185. </view>
  186. <view v-if="teamData.members.length === 0" class="empty-state">
  187. <view class="empty-content">
  188. <view class="flex-items-plus">
  189. <image src="@/static/images/empty.png" class="empty"></image>
  190. </view>
  191. <text class="empty-title">暂无团队成员</text>
  192. <text class="empty-desc">您还没有团队成员,快去邀请朋友加入吧!</text>
  193. <view class="empty-actions">
  194. <view class="action-button primary" @click="inviteFriends">
  195. <u-icon name="plus" size="24" color="#fff"></u-icon>
  196. <text>邀请好友</text>
  197. </view>
  198. <view class="action-button secondary" @click="refreshData">
  199. <u-icon name="reload" size="24" color="#8B5CF6"></u-icon>
  200. <text>刷新数据</text>
  201. </view>
  202. </view>
  203. </view>
  204. </view>
  205. </view>
  206. </view>
  207. </view>
  208. </template>
  209. <script>
  210. import {
  211. getMemberlazyList,
  212. memberDetail,
  213. teamStatistics,
  214. countPaidProducts
  215. } from '@/config/api';
  216. export default {
  217. data() {
  218. return {
  219. expandedNodes: {
  220. root: true // 默认展开根节点
  221. },
  222. user: {},
  223. personalStats: {
  224. productCount: 0,
  225. totalAmount: '0.00'
  226. },
  227. teamData: {
  228. level1Count: 0,
  229. level2Count: 0,
  230. totalBuyCount: 0,
  231. totalAmount: '0.00',
  232. totalCount: 0,
  233. members: []
  234. }
  235. }
  236. },
  237. onLoad() {
  238. this.getMember()
  239. this.getTeamStatistics()
  240. this.getPersonalStats()
  241. },
  242. methods: {
  243. getMember() {
  244. memberDetail().then((res) => {
  245. this.user = res.data
  246. this.getTeamData()
  247. })
  248. },
  249. async getPersonalStats() {
  250. try {
  251. const response = await countPaidProducts()
  252. if (response.success && response.data) {
  253. const data = response.data
  254. this.personalStats.productCount = parseInt(data.productCount) || 0
  255. this.personalStats.totalAmount = parseFloat(data.totalAmount || 0).toFixed(2)
  256. }
  257. } catch (error) {
  258. console.error('获取个人购买统计数据失败:', error)
  259. }
  260. },
  261. async getTeamStatistics() {
  262. try {
  263. const response = await teamStatistics()
  264. if (response.success && response.data) {
  265. const data = response.data
  266. this.teamData.totalCount = parseInt(data.totalTeamMembers) || 0
  267. this.teamData.level1Count = parseInt(data.directSubordinates) || 0
  268. this.teamData.level2Count = parseInt(data.secondLevelSubordinates) || 0
  269. this.teamData.totalBuyCount = parseInt(data.totalPurchaseCount) || 0
  270. const amount = data.totalOrderAmount
  271. if (amount !== null && amount !== undefined && amount !== '') {
  272. this.teamData.totalAmount = parseFloat(amount).toFixed(2)
  273. } else {
  274. this.teamData.totalAmount = '0.00'
  275. }
  276. }
  277. } catch (error) {
  278. console.error('获取团队统计数据失败:', error)
  279. }
  280. },
  281. async getTeamData() {
  282. try {
  283. const response = await getMemberlazyList({
  284. id: this.user.id
  285. })
  286. if (response.success && response.data) {
  287. // 后端已经返回树形结构,直接使用
  288. this.teamData.members = response.data;
  289. // 更新统计数据
  290. this.updateTeamStats();
  291. // 默认展开所有有子节点的成员
  292. this.expandAllNodes();
  293. }
  294. } catch (error) {
  295. console.error('获取团队数据失败:', error)
  296. uni.showToast({
  297. title: '获取团队数据失败',
  298. icon: 'none'
  299. })
  300. }
  301. },
  302. buildTreeStructure(flatData) {
  303. if (!flatData || flatData.length === 0) return [];
  304. console.log('开始构建树形结构,原始数据:', flatData);
  305. console.log('当前用户ID:', this.user.id);
  306. // 数据预处理
  307. const processedData = flatData.map(member => ({
  308. ...member,
  309. buyCount: member.buyCount || 0,
  310. amount: member.amount || 0,
  311. hasChildren: member.hasChildren || false,
  312. children: []
  313. }));
  314. console.log('预处理后的数据:', processedData);
  315. // 创建ID映射
  316. const memberMap = {};
  317. processedData.forEach(member => {
  318. memberMap[member.id] = member;
  319. });
  320. console.log('成员ID映射:', memberMap);
  321. // 构建树形结构
  322. const treeData = [];
  323. const level1Members = [];
  324. const level2Members = [];
  325. processedData.forEach(member => {
  326. console.log(
  327. `处理成员: ${member.account}, ID: ${member.id}, parentId: ${member.parentId}, hasChildren: ${member.hasChildren}`
  328. );
  329. // 判断是否为一级成员(直接下级)
  330. if (!member.parentId || member.parentId === this.user.id) {
  331. level1Members.push(member);
  332. treeData.push(member);
  333. console.log(`添加一级成员: ${member.account}`);
  334. } else {
  335. // 二级成员,添加到父级的children中
  336. level2Members.push(member);
  337. const parent = memberMap[member.parentId];
  338. if (parent) {
  339. if (!parent.children) {
  340. parent.children = [];
  341. }
  342. parent.children.push(member);
  343. parent.hasChildren = true;
  344. console.log(`将二级成员 ${member.account} 添加到父级 ${parent.account} 的children中`);
  345. } else {
  346. console.log(`警告: 找不到父级成员 ${member.parentId},无法添加二级成员 ${member.account}`);
  347. }
  348. }
  349. });
  350. console.log('一级成员数量:', level1Members.length);
  351. console.log('二级成员数量:', level2Members.length);
  352. console.log('构建的树形结构:', treeData);
  353. return treeData;
  354. },
  355. updateTeamStats() {
  356. let level1Count = 0;
  357. let level2Count = 0;
  358. let totalBuyCount = 0;
  359. let totalAmount = 0;
  360. this.teamData.members.forEach(member => {
  361. level1Count++;
  362. totalBuyCount += parseInt(member.buyCount) || 0;
  363. totalAmount += parseFloat(member.amount) || 0;
  364. if (member.children && member.children.length > 0) {
  365. level2Count += member.children.length;
  366. member.children.forEach(child => {
  367. totalBuyCount += parseInt(child.buyCount) || 0;
  368. totalAmount += parseFloat(child.amount) || 0;
  369. });
  370. }
  371. });
  372. // 更新统计数据
  373. this.teamData.level1Count = level1Count;
  374. this.teamData.level2Count = level2Count;
  375. this.teamData.totalCount = level1Count + level2Count;
  376. this.teamData.totalBuyCount = totalBuyCount;
  377. this.teamData.totalAmount = totalAmount.toFixed(2);
  378. },
  379. toggleNode(nodeId) {
  380. const isExpanding = !this.expandedNodes[nodeId];
  381. this.$set(this.expandedNodes, nodeId, isExpanding);
  382. if (nodeId === 'root') return;
  383. const member = this.findMemberById(nodeId);
  384. if (!member) return;
  385. if (isExpanding && member.children && member.children.length > 0) {
  386. uni.showToast({
  387. title: `展开${member.children.length}个下级`,
  388. icon: 'success',
  389. duration: 1000
  390. });
  391. }
  392. },
  393. findMemberById(id) {
  394. const searchInMembers = (members) => {
  395. for (const member of members) {
  396. if (member.id === id) return member;
  397. if (member.children && member.children.length > 0) {
  398. const found = searchInMembers(member.children);
  399. if (found) return found;
  400. }
  401. }
  402. return null;
  403. };
  404. return searchInMembers(this.teamData.members);
  405. },
  406. getLevelText(level) {
  407. const levelMap = {
  408. 0: '普通会员',
  409. 1: 'S级会员',
  410. 2: 'SS级会员',
  411. 3: 'SSS级会员'
  412. }
  413. return levelMap[level] || '普通会员'
  414. },
  415. formatAmount(amount) {
  416. const numAmount = parseFloat(amount) || 0
  417. return numAmount.toFixed(2)
  418. },
  419. viewOrders(memberId) {
  420. uni.navigateTo({
  421. url: `/packageOrder/pages/list/record?memberId=${memberId}`
  422. })
  423. },
  424. inviteFriends() {
  425. this.$route('/packageUser/pages/share/index')
  426. },
  427. // 默认展开所有有子节点的成员
  428. expandAllNodes() {
  429. this.teamData.members.forEach(member => {
  430. if (member.hasChildren && member.children && member.children.length > 0) {
  431. this.$set(this.expandedNodes, member.id, true);
  432. }
  433. });
  434. },
  435. refreshData() {
  436. uni.showLoading({
  437. title: '刷新中...'
  438. });
  439. this.teamData = {
  440. level1Count: 0,
  441. level2Count: 0,
  442. totalBuyCount: 0,
  443. totalAmount: '0.00',
  444. totalCount: 0,
  445. members: []
  446. };
  447. Promise.all([
  448. this.getTeamStatistics(),
  449. this.getTeamData(),
  450. this.getPersonalStats()
  451. ]).finally(() => {
  452. uni.hideLoading();
  453. uni.showToast({
  454. title: '刷新完成',
  455. icon: 'success'
  456. });
  457. });
  458. }
  459. }
  460. }
  461. </script>
  462. <style lang="scss" scoped>
  463. .team-container {
  464. min-height: 100vh;
  465. background: #f8fafc;
  466. padding: 20rpx;
  467. .team-overview {
  468. margin-bottom: 20rpx;
  469. .overview-card {
  470. background: #ffffff;
  471. border-radius: 16rpx;
  472. padding: 30rpx;
  473. box-shadow: 0 2rpx 16rpx rgba(0, 0, 0, 0.06);
  474. border: 1rpx solid #e5e7eb;
  475. .card-header {
  476. display: flex;
  477. justify-content: space-between;
  478. align-items: center;
  479. margin-bottom: 30rpx;
  480. padding-bottom: 20rpx;
  481. border-bottom: 1rpx solid #f3f4f6;
  482. .card-title {
  483. font-size: 36rpx;
  484. font-weight: 600;
  485. color: #111827;
  486. }
  487. }
  488. .stats-grid {
  489. display: grid;
  490. grid-template-columns: repeat(2, 1fr);
  491. gap: 20rpx;
  492. .stat-item {
  493. display: flex;
  494. align-items: center;
  495. padding: 24rpx;
  496. border-radius: 16rpx;
  497. transition: all 0.3s ease;
  498. &.primary {
  499. background: #f8fafc;
  500. border: 1rpx solid #e2e8f0;
  501. }
  502. &.secondary {
  503. background: #f1f5f9;
  504. border: 1rpx solid #d1d5db;
  505. }
  506. &.success {
  507. background: #f0fdf4;
  508. border: 1rpx solid #bbf7d0;
  509. }
  510. &.warning {
  511. background: #fefce8;
  512. border: 1rpx solid #fde047;
  513. }
  514. .stat-icon {
  515. margin-right: 16rpx;
  516. padding: 12rpx;
  517. background: #ffffff;
  518. border-radius: 12rpx;
  519. box-shadow: 0 1rpx 3rpx rgba(0, 0, 0, 0.1);
  520. }
  521. .stat-content {
  522. flex: 1;
  523. .stat-value {
  524. font-size: 32rpx;
  525. font-weight: 600;
  526. color: #111827;
  527. margin-bottom: 4rpx;
  528. display: block;
  529. }
  530. .stat-label {
  531. font-size: 24rpx;
  532. color: #6b7280;
  533. }
  534. }
  535. }
  536. }
  537. }
  538. }
  539. .team-list {
  540. background: #ffffff;
  541. border-radius: 16rpx;
  542. padding: 30rpx;
  543. box-shadow: 0 2rpx 16rpx rgba(0, 0, 0, 0.06);
  544. border: 1rpx solid #e5e7eb;
  545. .list-header {
  546. display: flex;
  547. justify-content: space-between;
  548. align-items: flex-start;
  549. padding: 0 0 30rpx;
  550. border-bottom: 1rpx solid #f3f4f6;
  551. margin-bottom: 30rpx;
  552. .header-left {
  553. .header-title {
  554. font-size: 36rpx;
  555. font-weight: 600;
  556. color: #111827;
  557. }
  558. }
  559. .header-right {
  560. text-align: right;
  561. .count-display {
  562. .total-count {
  563. font-size: 28rpx;
  564. color: #111827;
  565. font-weight: 600;
  566. margin-bottom: 8rpx;
  567. display: block;
  568. }
  569. .level-indicators {
  570. display: flex;
  571. flex-direction: column;
  572. gap: 6rpx;
  573. .level-indicator {
  574. display: flex;
  575. align-items: center;
  576. gap: 8rpx;
  577. font-size: 22rpx;
  578. color: #6b7280;
  579. .indicator-dot {
  580. width: 8rpx;
  581. height: 8rpx;
  582. border-radius: 50%;
  583. &.level-1 {
  584. background: #3b82f6;
  585. }
  586. &.level-2 {
  587. background: #6b7280;
  588. }
  589. }
  590. }
  591. }
  592. }
  593. }
  594. }
  595. .team-tree {
  596. padding: 20rpx;
  597. .tree-node {
  598. position: relative;
  599. margin-bottom: 16rpx;
  600. &[data-level="0"] {
  601. z-index: 10;
  602. }
  603. &[data-level="1"] {
  604. margin-left: 40rpx;
  605. z-index: 9;
  606. }
  607. &[data-level="2"] {
  608. margin-left: 80rpx;
  609. z-index: 8;
  610. }
  611. &.root-node {
  612. margin-left: 0;
  613. .node-content {
  614. background: #f8fafc;
  615. border-radius: 16rpx;
  616. padding: 30rpx;
  617. box-shadow: 0 2rpx 12rpx rgba(59, 130, 246, 0.08);
  618. transition: all 0.3s ease;
  619. border: 1rpx solid #e2e8f0;
  620. position: relative;
  621. overflow: hidden;
  622. &:active {
  623. transform: scale(0.98);
  624. }
  625. }
  626. }
  627. .personal-stats {
  628. display: flex;
  629. flex-wrap: nowrap;
  630. gap: 8rpx;
  631. margin-top: 8rpx;
  632. margin-bottom: 8rpx;
  633. .stat {
  634. font-size: 20rpx;
  635. color: #6b7280;
  636. background: #f9fafb;
  637. padding: 4rpx 10rpx;
  638. border-radius: 8rpx;
  639. display: flex;
  640. align-items: center;
  641. gap: 4rpx;
  642. white-space: nowrap;
  643. border: 1rpx solid #e5e7eb;
  644. &::before {
  645. content: '';
  646. width: 4rpx;
  647. height: 4rpx;
  648. background: #3b82f6;
  649. border-radius: 50%;
  650. flex-shrink: 0;
  651. }
  652. }
  653. }
  654. .node-content {
  655. display: flex;
  656. justify-content: space-between;
  657. align-items: flex-start;
  658. background: #fff;
  659. border-radius: 16rpx;
  660. padding: 20rpx;
  661. border: 1rpx solid #e5e7eb;
  662. transition: all 0.3s ease;
  663. position: relative;
  664. overflow: hidden;
  665. box-shadow: 0 1rpx 3rpx rgba(0, 0, 0, 0.1);
  666. &:active {
  667. transform: scale(0.98);
  668. }
  669. .node-info {
  670. display: flex;
  671. align-items: flex-start;
  672. flex: 1;
  673. min-width: 0;
  674. .avatar-wrapper {
  675. position: relative;
  676. margin-right: 16rpx;
  677. flex-shrink: 0;
  678. .avatar {
  679. width: 64rpx;
  680. height: 64rpx;
  681. border-radius: 50%;
  682. background-color: #f9fafb;
  683. border: 1rpx solid #e5e7eb;
  684. }
  685. .avatar-tag,
  686. .root-tag {
  687. position: absolute;
  688. bottom: -4rpx;
  689. right: -4rpx;
  690. background: #3b82f6;
  691. color: #fff;
  692. font-size: 18rpx;
  693. padding: 2rpx 8rpx;
  694. border-radius: 8rpx;
  695. border: 1rpx solid #fff;
  696. font-weight: 600;
  697. }
  698. .level-badge {
  699. position: absolute;
  700. top: -8rpx;
  701. left: -8rpx;
  702. font-size: 16rpx;
  703. padding: 2rpx 6rpx;
  704. border-radius: 6rpx;
  705. color: #fff;
  706. font-weight: bold;
  707. border: 1rpx solid #fff;
  708. &.level-1 {
  709. background: #3b82f6;
  710. }
  711. &.level-2 {
  712. background: #6b7280;
  713. }
  714. }
  715. }
  716. .info {
  717. flex: 1;
  718. min-width: 0;
  719. .name {
  720. font-size: 28rpx;
  721. color: #111827;
  722. font-weight: 600;
  723. margin-bottom: 6rpx;
  724. width: 100%;
  725. display: block;
  726. white-space: nowrap;
  727. overflow: hidden;
  728. text-overflow: ellipsis;
  729. max-width: 300rpx;
  730. }
  731. .level {
  732. font-size: 22rpx;
  733. color: #6b7280;
  734. margin-bottom: 8rpx;
  735. display: flex;
  736. align-items: center;
  737. gap: 6rpx;
  738. &::before {
  739. content: '';
  740. width: 6rpx;
  741. height: 6rpx;
  742. background: #3b82f6;
  743. border-radius: 50%;
  744. flex-shrink: 0;
  745. }
  746. }
  747. .member-stats {
  748. display: flex;
  749. white-space: nowrap;
  750. flex-wrap: nowrap;
  751. gap: 8rpx;
  752. margin-bottom: 8rpx;
  753. .stat {
  754. white-space: nowrap;
  755. flex-wrap: nowrap;
  756. font-size: 20rpx;
  757. color: #6b7280;
  758. background: #f9fafb;
  759. padding: 4rpx 10rpx;
  760. border-radius: 8rpx;
  761. display: flex;
  762. align-items: center;
  763. gap: 4rpx;
  764. white-space: nowrap;
  765. border: 1rpx solid #e5e7eb;
  766. &::before {
  767. content: '';
  768. width: 4rpx;
  769. height: 4rpx;
  770. background: #3b82f6;
  771. border-radius: 50%;
  772. flex-shrink: 0;
  773. }
  774. }
  775. }
  776. .team-summary {
  777. display: flex;
  778. gap: 12rpx;
  779. .summary-text {
  780. font-size: 20rpx;
  781. color: #6b7280;
  782. background: rgba(107, 114, 128, 0.1);
  783. padding: 4rpx 10rpx;
  784. border-radius: 8rpx;
  785. border: 1rpx solid rgba(107, 114, 128, 0.2);
  786. font-weight: 500;
  787. }
  788. }
  789. }
  790. }
  791. .node-actions {
  792. display: flex;
  793. align-items: center;
  794. gap: 12rpx;
  795. flex-shrink: 0;
  796. .action-buttons {
  797. display: flex;
  798. align-items: center;
  799. gap: 10rpx;
  800. .btn-order {
  801. display: flex;
  802. align-items: center;
  803. gap: 4rpx;
  804. background: rgba(59, 130, 246, 0.1);
  805. padding: 8rpx 12rpx;
  806. border-radius: 8rpx;
  807. transition: all 0.2s ease;
  808. border: 1rpx solid rgba(59, 130, 246, 0.2);
  809. &:active {
  810. transform: scale(0.95);
  811. background: rgba(59, 130, 246, 0.15);
  812. }
  813. text {
  814. font-size: 20rpx;
  815. color: #3b82f6;
  816. font-weight: 500;
  817. }
  818. }
  819. .member-preview {
  820. display: flex;
  821. flex-direction: column;
  822. align-items: center;
  823. text-align: center;
  824. .preview-label {
  825. font-size: 18rpx;
  826. color: #6b7280;
  827. }
  828. }
  829. }
  830. .expand-icon {
  831. background: rgba(107, 114, 128, 0.1);
  832. padding: 8rpx;
  833. border-radius: 8rpx;
  834. transition: all 0.3s ease;
  835. &.expanded {
  836. background: rgba(59, 130, 246, 0.1);
  837. transform: rotate(180deg);
  838. }
  839. }
  840. }
  841. }
  842. .children {
  843. margin-top: 12rpx;
  844. position: relative;
  845. &.level-1-children {
  846. padding-left: 20rpx;
  847. border-left: 2rpx solid rgba(59, 130, 246, 0.2);
  848. }
  849. &.level-2-children {
  850. border-left: 2rpx solid rgba(107, 114, 128, 0.2);
  851. }
  852. &::before {
  853. content: '';
  854. position: absolute;
  855. left: -5rpx;
  856. top: 0;
  857. width: 8rpx;
  858. height: 8rpx;
  859. border-radius: 50%;
  860. background: rgba(59, 130, 246, 0.4);
  861. }
  862. .level-2-children::before {
  863. background: rgba(107, 114, 128, 0.4);
  864. }
  865. }
  866. &.level-1-node .node-content {
  867. background: #f8fafc;
  868. border: 1rpx solid rgba(59, 130, 246, 0.15);
  869. .avatar-wrapper .avatar {
  870. width: 60rpx;
  871. height: 60rpx;
  872. }
  873. .info .name {
  874. font-size: 26rpx;
  875. }
  876. }
  877. &.level-2-node .node-content {
  878. background: #f1f5f9;
  879. border: 1rpx solid rgba(107, 114, 128, 0.15);
  880. .avatar-wrapper .avatar {
  881. width: 56rpx;
  882. height: 56rpx;
  883. }
  884. .info .name {
  885. font-size: 24rpx;
  886. }
  887. .member-stats .stat {
  888. font-size: 18rpx;
  889. }
  890. }
  891. }
  892. }
  893. }
  894. .empty-state {
  895. padding: 80rpx 40rpx;
  896. .empty-content {
  897. text-align: center;
  898. .empty-title {
  899. font-size: 32rpx;
  900. color: #111827;
  901. font-weight: 600;
  902. margin-bottom: 16rpx;
  903. display: block;
  904. }
  905. .empty-desc {
  906. font-size: 26rpx;
  907. color: #6b7280;
  908. margin-bottom: 40rpx;
  909. display: block;
  910. line-height: 1.5;
  911. }
  912. .empty-actions {
  913. display: flex;
  914. justify-content: center;
  915. gap: 20rpx;
  916. .action-button {
  917. display: flex;
  918. align-items: center;
  919. gap: 8rpx;
  920. padding: 16rpx 24rpx;
  921. border-radius: 12rpx;
  922. transition: all 0.3s ease;
  923. &.primary {
  924. background: #3b82f6;
  925. color: #fff;
  926. box-shadow: 0 2rpx 8rpx rgba(59, 130, 246, 0.2);
  927. &:active {
  928. transform: scale(0.95);
  929. box-shadow: 0 1rpx 4rpx rgba(59, 130, 246, 0.2);
  930. }
  931. text {
  932. color: #fff;
  933. font-size: 24rpx;
  934. font-weight: 600;
  935. }
  936. }
  937. &.secondary {
  938. background: rgba(59, 130, 246, 0.1);
  939. border: 1rpx solid rgba(59, 130, 246, 0.2);
  940. &:active {
  941. transform: scale(0.95);
  942. background: rgba(59, 130, 246, 0.15);
  943. }
  944. text {
  945. color: #3b82f6;
  946. font-size: 24rpx;
  947. font-weight: 500;
  948. }
  949. }
  950. }
  951. }
  952. }
  953. }
  954. .flex-items-plus {
  955. display: flex;
  956. justify-content: center;
  957. align-items: center;
  958. }
  959. .empty {
  960. width: 200rpx;
  961. height: 200rpx;
  962. }
  963. }
  964. .btn-order1 {
  965. display: flex;
  966. align-items: center;
  967. gap: 4rpx;
  968. background: rgba(59, 130, 246, 0.1);
  969. padding: 8rpx 12rpx;
  970. border-radius: 8rpx;
  971. transition: all 0.2s ease;
  972. border: 1rpx solid rgba(59, 130, 246, 0.2);
  973. &:active {
  974. transform: scale(0.95);
  975. background: rgba(59, 130, 246, 0.15);
  976. }
  977. text {
  978. font-size: 20rpx;
  979. color: #3b82f6;
  980. font-weight: 500;
  981. }
  982. }
  983. </style>