From 213be6af2593650a1d600dd38994c071cfd62b00 Mon Sep 17 00:00:00 2001 From: chen Date: Thu, 17 Sep 2026 14:32:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(dashboard):=20=E8=A7=84=E8=8C=83=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E8=BA=AB=E4=BB=BD=E4=B8=8E=E5=90=88=E4=BC=99=E8=82=A1?= =?UTF-8?q?=E4=B8=9C=E6=A6=82=E5=BF=B5=EF=BC=8C=E5=BD=BB=E5=BA=95=E6=B8=85?= =?UTF-8?q?=E7=90=86=E8=AF=AF=E5=AF=BC=E6=80=A7=E5=90=88=E4=BC=99=E4=BA=BA?= =?UTF-8?q?=E8=AF=8D=E6=B1=87=E5=B9=B6=E4=BC=98=E5=8C=96=E8=87=AA=E8=B4=AD?= =?UTF-8?q?=E8=80=83=E6=A0=B8=E9=9B=B7=E8=BE=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/shopro/Dashboard.php | 40 +++++++++---- .../admin/view/shopro/dashboard/index.html | 59 +++++++++++-------- public/assets/js/backend/shopro/dashboard.js | 2 +- tests/partner/DashboardWealthTest.php | 40 +++++++++++++ 4 files changed, 102 insertions(+), 39 deletions(-) diff --git a/application/admin/controller/shopro/Dashboard.php b/application/admin/controller/shopro/Dashboard.php index 7fb2f7b..0e8ed97 100644 --- a/application/admin/controller/shopro/Dashboard.php +++ b/application/admin/controller/shopro/Dashboard.php @@ -62,7 +62,7 @@ class Dashboard extends Common }) ]; - // 2. 分销商/合伙人基础数据 (保持向下兼容) + // 2. 合伙股东基础数据 (保持向下兼容) $agentData = [ 'total' => Agent::count(), 'today' => Agent::whereTime('createtime', 'today')->count(), @@ -194,7 +194,7 @@ class Dashboard extends Common $activeUserIds = $activeService->activeUserIds($activeWindowStart, $now); $activeUserMap = array_flip($activeUserIds); - // 全量合伙人基础信息 + // 全量合伙股东基础信息 $allAgents = Agent::field('user_id, level, is_venue, is_county, madow, last_self_order_time')->select(); // 收益明细按 (user_id + reward_type) 聚合,精确归集各角色产出收益 @@ -408,7 +408,7 @@ class Dashboard extends Common 'pending_voucher_quota' => number_format($pendingVoucher, 2, '.', ''), ]; - // 9. COO 视角:转化复购漏斗、合伙人自购续期雷达、供应链库存与实时待办看板 + // 9. COO 视角:转化复购漏斗、合伙股东自购续期雷达、供应链库存与实时待办看板 $paidOrderUsers = Order::whereIn('status', [Order::STATUS_PAID, Order::STATUS_COMPLETED]) ->group('user_id') ->field('user_id, count(*) as buy_count') @@ -428,13 +428,14 @@ class Dashboard extends Common $repeatPurchaseRate = $paidUsersCount > 0 ? round(($repeatBuyCount / $paidUsersCount) * 100, 1) : 0.0; $arpu = $paidUsersCount > 0 ? round($netGmv / $paidUsersCount, 2) : 0.0; - // 9.2 合伙人 30 天自购续期雷达 (客观四态分类,避免恐慌误判) + // 9.2 合伙股东 30 天自购续期雷达 (仅统计具备合伙股东身份的会员,避免恐慌误判) $activePartnersCount = 0; $warningPartnersCount = 0; $pendingRenewCount = 0; $newNoOrderCount = 0; $warningList = []; $pendingRenewList = []; + $partnerShareholderCount = 0; $agentUserIds = array_column(collection($allAgents)->toArray(), 'user_id'); $agentUserMap = []; @@ -446,12 +447,19 @@ class Dashboard extends Common } foreach ($allAgents as $ag) { + $identityData = IdentityService::build($ag); + // 核心业务规范:合伙股东仅是会员体系下的专属进阶身份(创客V1~V6、酒道馆、区县代理) + // 普通会员与品酒师属于基础会员,无需自购考核,排除在股东自购掉队雷达之外 + if (empty($identityData['is_partner'])) { + continue; + } + $partnerShareholderCount++; + $uid = (int) $ag->user_id; $u = $agentUserMap[$uid] ?? null; $nickname = $u ? ($u->nickname ?: '用户#' . $uid) : ('用户#' . $uid); $mobile = ($u && $u->mobile) ? substr_replace($u->mobile, '****', 3, 4) : '-'; $avatar = $u ? ($u->avatar ?: '') : ''; - $identityData = IdentityService::build($ag); $identityText = $identityData['identity_text'] ?: ('Lv.' . $ag->level); $lastTime = (int) $ag->getData('last_self_order_time'); @@ -492,12 +500,18 @@ class Dashboard extends Common ]; } } else { - // 新成员待自购首购 (尚未下单) + // 新晋股东待自购首购 (尚未下单) $newNoOrderCount++; } } } + // 股东专属自购达标率(分子为在保合格股东,分母为合伙股东总人数) + $partnerActiveRate = $partnerShareholderCount > 0 + ? round((($activePartnersCount + $warningPartnersCount) / $partnerShareholderCount) * 100, 1) + : 0.0; + $partnerNetwork['active_rate'] = $partnerActiveRate; + // 9.3 供应链库存安全与动销商品 $onSaleGoodsCount = (int) Goods::where('status', 'up')->count(); $totalStock = (int) SkuPriceModel::where('status', 'up')->sum('stock'); @@ -562,10 +576,10 @@ class Dashboard extends Common } elseif ($payoutRate <= 50) { $riskSuggestions[] = "综合拨比 {$payoutRate}%,略高于基础基准,建议提升高毛利商品动销比例。"; } else { - $riskSuggestions[] = "综合拨比 {$payoutRate}% 超出常规安全线,请复核极差与日结各奖项拨出参数。"; + $riskSuggestions[] = "综合拨比 {$payoutRate}% 超出常规安全线,请复核进阶与日结各奖励拨出参数。"; } if ($warningPartnersCount > 0) { - $riskSuggestions[] = "有 {$warningPartnersCount} 位合伙人进入 7 天临近到期预警期,建议及时定向提醒自购续期。"; + $riskSuggestions[] = "有 {$warningPartnersCount} 位合伙股东进入 7 天临近到期预警期,建议及时定向提醒自购续期。"; } if ($pendingWithdrawCount > 0) { $riskSuggestions[] = "当前有 {$pendingWithdrawCount} 笔提现申请等待审核(¥{$financeOverview['pending_withdraw_amount']}),请及时处理。"; @@ -714,11 +728,11 @@ class Dashboard extends Common $payoutArr = []; $periodMadow = 0.00000000; - // 四大分成板块结构 + // 四大业务板块结构 $structureMap = [ 'push3' => [ 'key' => 'push3', - 'name' => '直推裂变(推三返一)', + 'name' => '推荐开拓奖励', 'types' => ['push3'], 'amount' => 0.00, 'count' => 0, @@ -726,7 +740,7 @@ class Dashboard extends Common ], 'maker' => [ 'key' => 'maker', - 'name' => '创客团队(极差/平级/超越)', + 'name' => '创客进阶协同奖励', 'types' => ['maker_diff', 'maker_peer', 'maker_overtaken'], 'amount' => 0.00, 'count' => 0, @@ -734,7 +748,7 @@ class Dashboard extends Common ], 'channel' => [ 'key' => 'channel', - 'name' => '实体渠道(馆县拆分/平级)', + 'name' => '实体统筹协同奖励', 'types' => ['team_venue', 'team_county', 'venue_peer', 'county_peer'], 'amount' => 0.00, 'count' => 0, @@ -742,7 +756,7 @@ class Dashboard extends Common ], 'share' => [ 'key' => 'share', - 'name' => '全网共享(平台日结均分)', + 'name' => '全网加权贡献奖励', 'types' => ['venue_share', 'county_share'], 'amount' => 0.00, 'count' => 0, diff --git a/application/admin/view/shopro/dashboard/index.html b/application/admin/view/shopro/dashboard/index.html index dbc28db..e4a5072 100644 --- a/application/admin/view/shopro/dashboard/index.html +++ b/application/admin/view/shopro/dashboard/index.html @@ -90,7 +90,7 @@ .dashboard-index .font-bold { font-weight: 600; } .dashboard-index .cursor-pointer { cursor: pointer; } - /* 合伙人网络卡片 */ + /* 合伙股东与角色身份网络卡片 */ .dashboard-index .network-card { padding: 14px 16px; min-height: 98px; @@ -505,7 +505,7 @@ ¥{{ state.finance.rigid_cash_liability }}
- ① 用户未提现分润 (随时可提现): + ① 用户未提现收益 (随时可提现): ¥{{ state.finance.commission_float }}
@@ -547,13 +547,13 @@
- +
创 - 创客合伙骨干 (V1~V6) + 创客骨干 (V1~V6 · 合伙股东)
{{ state.partner.maker_count }} 人 @@ -608,14 +608,14 @@
- 全角色身份会员资产与分佣统计全景矩阵 + 全角色身份会员资产与收益统计全景矩阵 - 逐一统计每一个角色身份的会员人数、持豆存量、实时市值、专属业务分润与笔数 + 逐一统计每一个会员角色身份(普通会员、品酒师、合伙股东各层级)的人数、持豆存量、实时市值、专属业务收益与笔数
合伙股东档案 → - 全部分成流水 → + 全部结算流水 →
@@ -659,10 +659,10 @@ - + @@ -671,7 +671,7 @@ - +