const app = getApp() Page({ data: { totalMembers: 36, directMembers: 12, indirectMembers: 24, levelOptions: ['全部', '直属下级', '间接下级'], currentLevelIndex: 0, searchKeyword: '', loading: false, noMore: false, page: 1, pageSize: 10, teamMembers: [ { id: '1', nickname: '小明', avatar: '/static/images/avatar/avatar1.png', level: '普通会员', joinTime: '2023-11-15', parentNickname: '系统邀请', commission: '256.50' }, { id: '2', nickname: '小红', avatar: '/static/images/avatar/avatar2.png', level: '白银会员', joinTime: '2023-12-01', parentNickname: '小明', commission: '356.80' }, { id: '3', nickname: '小李', avatar: '/static/images/avatar/avatar3.png', level: '黄金会员', joinTime: '2023-12-10', parentNickname: '小红', commission: '456.20' } ] }, onLoad() { // 可以在这里请求实际的数据 }, // 切换会员等级筛选 onLevelChange(e) { const index = e.detail.value this.setData({ currentLevelIndex: index, page: 1, teamMembers: [] }, () => { this.loadTeamMembers() }) }, // 搜索团队成员 onSearchInput(e) { const keyword = e.detail.value this.setData({ searchKeyword: keyword, page: 1, teamMembers: [] }, () => { this.loadTeamMembers() }) }, // 加载团队成员 loadTeamMembers(isLoadMore = false) { if (this.data.loading) return this.setData({ loading: true }) // 模拟异步加载数据 setTimeout(() => { // 这里可以根据 levelOptions 和 searchKeyword 进行过滤 const newList = this.data.teamMembers this.setData({ teamMembers: isLoadMore ? [...this.data.teamMembers, ...newList] : newList, loading: false, noMore: true }) }, 500) }, // 加载更多 loadMore() { if (this.data.noMore) return this.setData({ page: this.data.page + 1 }, () => { this.loadTeamMembers(true) }) } })