From 1133f0ea29e8ef236c0a8515e492ccfbaa649fe2 Mon Sep 17 00:00:00 2001 From: chen Date: Sat, 19 Sep 2026 12:11:42 +0800 Subject: [PATCH] =?UTF-8?q?style(commission):=20=E9=A1=B6=E9=83=A8?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E7=B2=BE=E7=AE=80=E4=B8=BA=E7=9B=B4=E6=8E=A8?= =?UTF-8?q?=E4=BA=BA=E6=95=B0=E4=B8=8E=E5=9B=A2=E9=98=9F=E6=80=BB=E4=BA=BA?= =?UTF-8?q?=E6=95=B0=E5=B9=B6=E6=B8=85=E9=99=A4=E6=89=80=E6=9C=89=E4=B8=80?= =?UTF-8?q?=E7=BA=A7=E4=BA=8C=E7=BA=A7=E5=AD=97=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/shopro/controller/commission/Agent.php | 17 +- tests/verify_team_drilldown_spec.js | 10 +- uniapp/pages/commission/team.vue | 147 +++++++----------- 3 files changed, 81 insertions(+), 93 deletions(-) diff --git a/addons/shopro/controller/commission/Agent.php b/addons/shopro/controller/commission/Agent.php index 4a538c1..495b7ad 100644 --- a/addons/shopro/controller/commission/Agent.php +++ b/addons/shopro/controller/commission/Agent.php @@ -161,11 +161,14 @@ class Agent extends Commission } $targetUserId = $drillUserId; + $targetAgent = AgentModel::where('user_id', $targetUserId)->find(); $drillUser = [ 'id' => $targetUser->id, 'nickname' => $targetUser->nickname ?: '微信用户', 'avatar' => $targetUser->avatar, 'parent_user_id' => $targetUser->parent_user_id, + 'child_user_count_1' => intval($targetAgent->child_user_count_1 ?? 0), + 'child_user_count_all' => intval($targetAgent->child_user_count_all ?? ($targetAgent->child_user_count_1 ?? 0)), ]; } @@ -328,8 +331,13 @@ class Agent extends Commission if (empty($teamUserIds)) { $selfAgent = AgentModel::where('user_id', $targetUserId)->find(); $selfUser = UserModel::where('id', $targetUserId)->find(); + $teamCount = isset($selfAgent->child_user_count_all) && intval($selfAgent->child_user_count_all) > 0 + ? intval($selfAgent->child_user_count_all) + : intval($selfAgent->child_user_count_1 ?? 0); return [ 'total_count' => 0, + 'direct_count' => 0, + 'team_count' => $teamCount, 'active_count' => 0, 'expiring_count' => 0, 'inactive_count' => 0, @@ -397,8 +405,15 @@ class Agent extends Commission ->where('createtime', '>=', $monthStart) ->sum('amount'); + $directCount = count($teamUserIds); + $teamCount = isset($selfAgent->child_user_count_all) && intval($selfAgent->child_user_count_all) > 0 + ? intval($selfAgent->child_user_count_all) + : $directCount; + return [ - 'total_count' => count($teamUserIds), + 'total_count' => $directCount, + 'direct_count' => $directCount, + 'team_count' => $teamCount, 'active_count' => $activeCount, 'expiring_count' => $expiringCount, 'inactive_count' => $inactiveCount, diff --git a/tests/verify_team_drilldown_spec.js b/tests/verify_team_drilldown_spec.js index 5b4a4f1..df9984c 100644 --- a/tests/verify_team_drilldown_spec.js +++ b/tests/verify_team_drilldown_spec.js @@ -109,7 +109,15 @@ assert(teamVueContent.includes('drill-breadcrumb'), 'team.vue 必须包含层级 assert(teamVueContent.includes('btn-drill'), 'team.vue 成员卡片必须包含下钻团队按钮'); assert(teamVueContent.includes('drawer-drill-card'), 'team.vue 详情抽屉必须包含下钻团队卡片'); -console.log('✅ 测试点 3 通过: 前端 team.vue 状态管理、下钻面包屑导航与交互按钮规范'); +// 3.5 验证顶部卡片只展示直推人数与团队总人数,且无任何一级/二级 +assert(teamVueContent.includes('直推人数(人)'), 'team.vue 顶部必须展示直推人数(人)卡片'); +assert(teamVueContent.includes('团队总人数(人)'), 'team.vue 顶部必须展示团队总人数(人)卡片'); +assert(teamVueContent.includes('getDirectCount()'), 'team.vue 必须调用 getDirectCount 计算直推人数'); +assert(teamVueContent.includes('getTeamCount()'), 'team.vue 必须调用 getTeamCount 计算团队总人数'); +assert(!teamVueContent.includes('一级直推'), 'team.vue 顶部卡片严禁出现“一级直推”字样'); +assert(!teamVueContent.includes('一级成员'), 'team.vue 顶部卡片严禁出现“一级成员”字样'); + +console.log('✅ 测试点 3 通过: 前端 team.vue 状态管理、下钻面包屑导航与顶部纯直推/团队总人数卡片规范'); // 4. 模拟前端下钻堆栈业务状态机流转测试 class MockTeamDrillController { diff --git a/uniapp/pages/commission/team.vue b/uniapp/pages/commission/team.vue index ed40d73..e4d1a12 100644 --- a/uniapp/pages/commission/team.vue +++ b/uniapp/pages/commission/team.vue @@ -41,47 +41,25 @@ - + - - - - - {{ currentDrillUser ? (currentDrillUser.nickname + '的直推(人)') : '直推成员总数(人)' }} - - - {{ currentDrillUser ? (state.summary.total_count || currentDrillUser.child_user_count_1 || 0) : headerNum('child_user_count_1') }} - + + + + {{ currentDrillUser ? (currentDrillUser.nickname + '的直推(人)') : '直推人数(人)' }} - - 活跃保活: - {{ state.summary.active_count || 0 }} 人 + + {{ getDirectCount() }} - - - - - {{ currentDrillUser ? (currentDrillUser.nickname + '的合伙人') : '直推合伙股东(人)' }} - - - {{ currentDrillUser ? (state.summary.partner_count || 0) : headerNum('child_agent_count_1') }} - + + + + {{ currentDrillUser ? (currentDrillUser.nickname + '的团队(人)') : '团队总人数(人)' }} - - 临期/暂停: - - {{ Number(state.summary.expiring_count || 0) + Number(state.summary.inactive_count || 0) }} 人 - + + {{ getTeamCount() }} @@ -241,9 +219,7 @@ {{ item.nickname || '微信用户' }} - - {{ state.drillStack.length > 0 ? '直推成员' : '一级直推' }} - + 直推成员 {{ item.mobile_hide }} @@ -662,19 +638,41 @@ return state.drillStack[state.drillStack.length - 1]; }); - function headerNum(field) { - const stored = Number(agentInfo.value?.[field] || 0); - if (stored > 0) { - return stored; + // 获取直推人数(支持当前团队与多级下钻) + function getDirectCount() { + if (currentDrillUser.value) { + return ( + state.summary.direct_count ?? + state.summary.total_count ?? + currentDrillUser.value.child_user_count_1 ?? + 0 + ); } - const listTotal = Number(state.pagination.total || 0); - if ( - listTotal > 0 && - ['child_user_count_1', 'child_user_count_all', 'child_agent_count_1', 'child_agent_count_all'].includes(field) - ) { - return listTotal; + const count = Number(agentInfo.value?.child_user_count_1 || 0); + if (count > 0) return count; + if (state.summary.direct_count !== undefined && state.summary.direct_count > 0) { + return state.summary.direct_count; } - return 0; + return Number(state.pagination.total || 0); + } + + // 获取团队总人数(支持当前团队与多级下钻) + function getTeamCount() { + if (currentDrillUser.value) { + return ( + state.summary.team_count ?? + currentDrillUser.value.child_user_count_all ?? + state.summary.direct_count ?? + state.summary.total_count ?? + 0 + ); + } + const count = Number(agentInfo.value?.child_user_count_all || 0); + if (count > 0) return count; + if (state.summary.team_count !== undefined && state.summary.team_count > 0) { + return state.summary.team_count; + } + return getDirectCount(); } function memberLevelName(item) { @@ -1015,62 +1013,29 @@ // 团队信息总览 .team-data-box { .data-card { - width: 340rpx; background: #ffffff; border-radius: 20rpx; - padding: 20rpx 22rpx; + padding: 22rpx 24rpx; box-sizing: border-box; - border: 2rpx solid transparent; - transition: all 0.2s; - - &.card-active { - border-color: #ff6000; - box-shadow: 0 4rpx 16rpx rgba(255, 96, 0, 0.15); - } + box-shadow: 0 4rpx 14rpx rgba(0, 0, 0, 0.03); .item-title { - font-size: 22rpx; + font-size: 24rpx; font-weight: 500; color: #999999; - line-height: 30rpx; - margin-bottom: 8rpx; - } - - .total-item { - margin-bottom: 22rpx; + line-height: 32rpx; + margin-bottom: 12rpx; } .total-num { - font-size: 40rpx; + font-size: 44rpx; font-weight: bold; color: #333333; font-family: OPPOSANS; - line-height: 44rpx; - } + line-height: 48rpx; - .text-gold { - color: #c48a3a !important; - } - - .category-item { - border-top: 1rpx solid #f2f2f2; - padding-top: 14rpx; - - .category-label { - font-size: 22rpx; - color: #999999; - } - .category-val { - font-size: 24rpx; - font-weight: bold; - font-family: OPPOSANS; - - &.text-green { - color: #10b981; - } - &.text-yellow { - color: #f59e0b; - } + &.text-orange { + color: #ff6000; } } }