Эх сурвалжийг харах

feat(team-star): 星级透明化「我的星级」看板 — POST /api/team-star/my-view + 小程序页(§4.3.1 ①② #13)

- 后端 StarScoreCalculator + TeamStarController:当前星级/业绩分三维构成(直接50%+团队40%+推荐10%)/
  升级双门槛(业绩分+滚动12月团队直推≥1)/距下一档差距/三条换算路径(按最容易够到排序)/近12月轨迹
- 数据源:service_settlements(直接+团队含F03a交集防空转) × ppoint_consumption_log(推荐消费) ×
  referral_tree(8层团队) × distribution_relations(团队直推首单)
- DatabaseInitializer 新增 sys_config 种子:team_profit.star_tiers / star_conversion /
  valid_new_ref_min_order_cent(#12 已拍板入后台配置)
- cfc-frontend:新增 pages/promotion/star.vue(我的星级页)+ api getTeamStarMyView + 财富中心入口
Xiaogang Liao 1 долоо хоног өмнө
parent
commit
e25c0c2a82

+ 7 - 0
cfc-backend/src/main/java/com/etotem/cfc/config/DatabaseInitializer.java

@@ -1118,6 +1118,13 @@ insertSysConfigSeed("gift_membership_original_threshold", "1000000", "送会员
 insertSysConfigSeed("gift_membership_pay_price", "198000", "送会员商品达标后一口实付价(分)");
             insertSysConfigSeed("health_dimension_weights", "{\"growth\":0.20,\"sleep\":0.15,\"vision\":0.10,\"immunity\":0.15,\"nutrition\":0.15,\"gut\":0.10,\"exercise\":0.15}", "7维健康→身能量权重配置");
             insertSysConfigSeed("health_dimension_sync_factor", "0.5", "7维健康同步至身能量系数");
+            // 星级透明化(规格 §4.3 / §4.3.1 #12/#13 已拍板:档位与换算率进后台配置)
+            insertSysConfigSeed("team_profit.star_tiers", "[0,8000,25000,70000,140000,250000]",
+                    "团队星级档位业绩分门槛(分),JSON数组下标i=星级i+1(默认:一星0/二星8000/三星25000/四星70000/五星140000/六星250000,起步期可下调)");
+            insertSysConfigSeed("team_profit.star_conversion", "{\"direct\":250,\"team\":200,\"referral\":10}",
+                    "星级差距→行动换算率(¥500/次咨询基准):直接服务1次=250分/团队带教1次=200分/推荐消费每¥100=10分");
+            insertSysConfigSeed("team_profit.valid_new_ref_min_order_cent", "0",
+                    "团队直推有效新用户首单最低金额(分),默认0=首单即算,防刷预留");
             log.info("SysConfig 种子数据已加载");
         } catch (Exception e) {
             log.warn("SysConfig 种子数据初始化失败: {}", e.getMessage());

+ 34 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/TeamStarController.java

@@ -0,0 +1,34 @@
+package com.etotem.cfc.controller;
+
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.TeamStarMyViewDTO;
+import com.etotem.cfc.service.StarScoreCalculator;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * 团队星级看板(规格 §4.3.1 ①:实时星级看板「我的星级」页)。
+ */
+@Tag(name = "团队星级", description = "星级透明化:当前星级 / 三维构成 / 双门槛进度 / 换算路径 / 近12月轨迹")
+@RestController
+@RequestMapping("/api/team-star")
+public class TeamStarController {
+
+    @Resource
+    private StarScoreCalculator starScoreCalculator;
+
+    /**
+     * 我的星级看板(规格 §4.3.1 数据与接口:POST /api/team-star/my-view)。
+     */
+    @Operation(summary = "我的星级看板")
+    @PostMapping("/my-view")
+    public Result<TeamStarMyViewDTO> myView(@RequestAttribute("userId") Long userId) {
+        return Result.success(starScoreCalculator.buildMyView(userId));
+    }
+}

+ 18 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/FirstDealRow.java

@@ -0,0 +1,18 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 用户集合的首笔成交(product_orders status='paid' 的最早一单),用于团队直推判定。
+ */
+@Data
+public class FirstDealRow {
+    /** 成交人用户ID */
+    private Long userId;
+    /** 首笔成交时间 */
+    private Date firstPaidAt;
+    /** 首笔成交金额(分) */
+    private Integer firstAmountCent;
+}

+ 14 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/MonthlyAmountRow.java

@@ -0,0 +1,14 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+/**
+ * 月度金额聚合行(近 N 个月 GROUP BY 月份),用于星级轨迹滚动计算。
+ */
+@Data
+public class MonthlyAmountRow {
+    /** 月份 yyyy-MM */
+    private String ym;
+    /** 金额合计(分) */
+    private Long total;
+}

+ 85 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/TeamStarMyViewDTO.java

@@ -0,0 +1,85 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 星级透明化「我的星级」看板响应(规格 §4.3.1 ①②:#13 已拍板 P1 实时看板 + 差距换算)。
+ *
+ * <p>当前星级 / 业绩分总分 / 三维构成 / 升级双门槛进度 / 距下一档差距 /
+ * 三条换算路径(按最容易够到排序)/ 近 12 个月轨迹。</p>
+ */
+@Data
+public class TeamStarMyViewDTO {
+
+    /** 当前星级(1-6;一星=入团即得,门槛 0) */
+    private int currentStar;
+    /** 当前星级名称(一星~六星) */
+    private String currentStarName;
+    /** 业绩分总分(分)= 直接×50% + 团队×40% + 推荐×10% */
+    private long totalScore;
+    /** 直接服务贡献分 */
+    private long directScore;
+    /** 团队服务贡献分 */
+    private long teamScore;
+    /** 推荐消费贡献分 */
+    private long referralScore;
+    /** 下一档星级(0=已达最高星级,无下一档) */
+    private int nextStar;
+    /** 下一档星级名称(满级为空串) */
+    private String nextStarName;
+    /** 下一档业绩分门槛(分;满级为 0) */
+    private long nextThreshold;
+    /** 距下一档差距(分;达标或满级为 0) */
+    private long scoreGapToNext;
+    /** 业绩分门槛是否达标(对下一档) */
+    private boolean scoreMet;
+    /** 滚动 12 个月团队直推有效新用户数 */
+    private long directValidRefs;
+    /** 直推门槛是否达标(≥1) */
+    private boolean refMet;
+    /** 双门槛是否同时满足(业绩分 + 直推),满足即可升下一档 */
+    private boolean promotable;
+    /** 统计窗口起点(yyyy-MM-dd) */
+    private String windowStart;
+    /** 统计窗口终点(yyyy-MM-dd) */
+    private String windowEnd;
+    /** 档位表(星级→门槛,前端展示完整阶梯) */
+    private List<Tier> tiers;
+    /** 三条达标换算路径(按最容易够到排序,rank=1 最省力) */
+    private List<ConversionPath> paths;
+    /** 近 12 个月星级轨迹(旧→新) */
+    private List<TrajectoryPoint> trajectory;
+
+    @Data
+    public static class Tier {
+        private int star;
+        private long threshold;
+    }
+
+    @Data
+    public static class ConversionPath {
+        /** direct / team / referral */
+        private String type;
+        private String label;
+        /** 换算率说明文案(如 "1 次 1对1 咨询 = 250 分") */
+        private String conversionText;
+        /** 所需动作数量:direct/team=次数,referral=推荐消费金额(元) */
+        private long required;
+        /** 单位:direct/team=次,referral=元 */
+        private String unit;
+        /** 是否最省力路径 */
+        private boolean easiest;
+        /** 按最容易够到排序(1 起步) */
+        private int rank;
+    }
+
+    @Data
+    public static class TrajectoryPoint {
+        /** 月份 yyyy-MM */
+        private String month;
+        private int star;
+        private String starName;
+    }
+}

+ 32 - 0
cfc-backend/src/main/java/com/etotem/cfc/mapper/DistributionRelationMapper.java

@@ -1,9 +1,41 @@
 package com.etotem.cfc.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.etotem.cfc.dto.FirstDealRow;
 import com.etotem.cfc.entity.DistributionRelation;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.Collection;
+import java.util.List;
 
 @Mapper
 public interface DistributionRelationMapper extends BaseMapper<DistributionRelation> {
+
+    /**
+     * 本人直接邀请加入团队的用户ID(distribution_relations.parent_id = 本人,去重)。
+     * 规格 §4.3 / #15 团队直推定义:直接邀请加入团队(团队树 distribution_relations,非推荐人树)。
+     */
+    @Select("SELECT DISTINCT user_id FROM distribution_relations WHERE parent_id = #{parentId}")
+    List<Long> selectDirectInviteeUserIds(@Param("parentId") Long parentId);
+
+    /**
+     * 用户集合的「首笔成交」(product_orders status='paid' 的最早一单的时间与金额)。
+     * 用于判定团队直推:首单即算、无金额门槛(阈值 {@code team_profit.valid_new_ref_min_order_cent} 默认 0)。
+     */
+    @Select({
+            "<script>",
+            "SELECT t.buyer_id AS userId, t.paid_at AS firstPaidAt, t.total_amount AS firstAmountCent",
+            "FROM (",
+            "  SELECT o.buyer_id, o.paid_at, o.total_amount,",
+            "         ROW_NUMBER() OVER (PARTITION BY o.buyer_id ORDER BY o.paid_at ASC, o.id ASC) AS rn",
+            "  FROM product_orders o",
+            "  WHERE o.status = 'paid' AND o.paid_at IS NOT NULL AND o.buyer_id IN",
+            "  <foreach collection='userIds' item='uid' open='(' separator=',' close=')'>#{uid}</foreach>",
+            ") t",
+            "WHERE t.rn = 1",
+            "</script>"
+    })
+    List<FirstDealRow> selectFirstDeals(@Param("userIds") Collection<Long> userIds);
 }

+ 35 - 0
cfc-backend/src/main/java/com/etotem/cfc/mapper/PpointConsumptionLogMapper.java

@@ -1,6 +1,7 @@
 package com.etotem.cfc.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.etotem.cfc.dto.MonthlyAmountRow;
 import com.etotem.cfc.entity.PpointConsumptionLog;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -8,6 +9,7 @@ import org.apache.ibatis.annotations.Select;
 
 import java.util.Collection;
 import java.util.Date;
+import java.util.List;
 
 @Mapper
 public interface PpointConsumptionLogMapper extends BaseMapper<PpointConsumptionLog> {
@@ -27,4 +29,37 @@ public interface PpointConsumptionLogMapper extends BaseMapper<PpointConsumption
             "</script>"
     })
     int sumPpointsSince(@Param("userIds") Collection<Long> userIds, @Param("since") Date since);
+
+    /**
+     * 推荐用户平台消费额(分):被本人推荐(referral_tree 后代)用户的平台消费实付合计
+     * (规格 §4.3 推荐用户平台消费收入口径)。
+     *
+     * @param userIds 被推荐用户ID集合(空集合返回 0,由调用方保证非空)
+     * @param since   滚动一年起点(含,按消费时间)
+     */
+    @Select({
+            "<script>",
+            "SELECT COALESCE(SUM(amount_cent), 0) FROM ppoint_consumption_log",
+            "WHERE created_at &gt;= #{since}",
+            "AND user_id IN",
+            "<foreach collection='userIds' item='uid' open='(' separator=',' close=')'>#{uid}</foreach>",
+            "</script>"
+    })
+    long sumAmountCentSince(@Param("userIds") Collection<Long> userIds, @Param("since") Date since);
+
+    /**
+     * 推荐用户平台消费额的月度聚合(近 24 个月,供星级轨迹滚动计算)。
+     */
+    @Select({
+            "<script>",
+            "SELECT DATE_FORMAT(created_at, '%Y-%m') AS ym, COALESCE(SUM(amount_cent), 0) AS total",
+            "FROM ppoint_consumption_log",
+            "WHERE created_at &gt;= #{since}",
+            "AND user_id IN",
+            "<foreach collection='userIds' item='uid' open='(' separator=',' close=')'>#{uid}</foreach>",
+            "GROUP BY DATE_FORMAT(created_at, '%Y-%m')",
+            "</script>"
+    })
+    List<MonthlyAmountRow> sumAmountCentByMonth(@Param("userIds") Collection<Long> userIds,
+                                                @Param("since") Date since);
 }

+ 12 - 1
cfc-backend/src/main/java/com/etotem/cfc/mapper/ReferralTreeMapper.java

@@ -3,7 +3,18 @@ package com.etotem.cfc.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.etotem.cfc.entity.ReferralTree;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
 
 @Mapper
 public interface ReferralTreeMapper extends BaseMapper<ReferralTree> {
-}
+
+    /**
+     * 全部后代用户ID(被本人直接/间接推荐,referral_tree 全层级去重,不含本人)。
+     * 规格 §4.3 推荐用户平台消费收入口径:被本人 referral_tree 直接/间接推荐的用户。
+     */
+    @Select("SELECT DISTINCT child_id FROM referral_tree WHERE parent_id = #{parentId}")
+    List<Long> selectDescendantUserIds(@Param("parentId") Long parentId);
+}

+ 65 - 1
cfc-backend/src/main/java/com/etotem/cfc/mapper/ServiceSettlementMapper.java

@@ -1,9 +1,73 @@
 package com.etotem.cfc.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.etotem.cfc.dto.MonthlyAmountRow;
 import com.etotem.cfc.entity.ServiceSettlement;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
 
 @Mapper
 public interface ServiceSettlementMapper extends BaseMapper<ServiceSettlement> {
-}
+
+    /**
+     * 直接服务收入(分):provider_id=本人 且 settled,滚动窗口内服务费合计(规格 §4.3 直接服务口径)。
+     */
+    @Select("SELECT COALESCE(SUM(service_fee), 0) FROM service_settlements "
+            + "WHERE provider_id = #{providerId} AND status = 'settled' "
+            + "AND settled_at >= #{since} AND settled_at IS NOT NULL")
+    long sumServiceFeeByProviderSince(@Param("providerId") Long providerId, @Param("since") Date since);
+
+    /**
+     * 团队服务收入(分):provider 在团队内 且 settled,且该服务订单实际发放过 F03a
+     * (规格 §4.3 团队服务口径,仅统计「能拿到 F03a 推荐奖」的服务订单,防止空转)。
+     */
+    @Select({
+            "<script>",
+            "SELECT COALESCE(SUM(s.service_fee), 0) FROM service_settlements s",
+            "WHERE s.status = 'settled' AND s.settled_at >= #{since} AND s.settled_at IS NOT NULL",
+            "AND s.provider_id IN",
+            "<foreach collection='teamIds' item='tid' open='(' separator=',' close=')'>#{tid}</foreach>",
+            "AND s.assessment_order_id IN (",
+            "  SELECT ref_id FROM cf_balance_log",
+            "  WHERE ref_type = 'F03a' AND ref_id IS NOT NULL AND created_at >= #{since}",
+            ")",
+            "</script>"
+    })
+    long sumTeamServiceFeeSince(@Param("teamIds") Collection<Long> teamIds, @Param("since") Date since);
+
+    /**
+     * 直接服务收入的月度聚合(近 24 个月,供星级轨迹滚动窗口在内存内滑动)。
+     */
+    @Select("SELECT DATE_FORMAT(settled_at, '%Y-%m') AS ym, COALESCE(SUM(service_fee), 0) AS total "
+            + "FROM service_settlements "
+            + "WHERE provider_id = #{providerId} AND status = 'settled' "
+            + "AND settled_at >= #{since} AND settled_at IS NOT NULL "
+            + "GROUP BY DATE_FORMAT(settled_at, '%Y-%m')")
+    List<MonthlyAmountRow> sumServiceFeeByProviderByMonth(@Param("providerId") Long providerId,
+                                                          @Param("since") Date since);
+
+    /**
+     * 团队服务收入的月度聚合(近 24 个月,含 F03a 交集,供星级轨迹滚动计算)。
+     */
+    @Select({
+            "<script>",
+            "SELECT DATE_FORMAT(s.settled_at, '%Y-%m') AS ym, COALESCE(SUM(s.service_fee), 0) AS total",
+            "FROM service_settlements s",
+            "WHERE s.status = 'settled' AND s.settled_at >= #{since} AND s.settled_at IS NOT NULL",
+            "AND s.provider_id IN",
+            "<foreach collection='teamIds' item='tid' open='(' separator=',' close=')'>#{tid}</foreach>",
+            "AND s.assessment_order_id IN (",
+            "  SELECT ref_id FROM cf_balance_log",
+            "  WHERE ref_type = 'F03a' AND ref_id IS NOT NULL AND created_at >= #{since}",
+            ")",
+            "GROUP BY DATE_FORMAT(s.settled_at, '%Y-%m')",
+            "</script>"
+    })
+    List<MonthlyAmountRow> sumTeamServiceFeeByMonth(@Param("teamIds") Collection<Long> teamIds,
+                                                    @Param("since") Date since);
+}

+ 434 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/StarScoreCalculator.java

@@ -0,0 +1,434 @@
+package com.etotem.cfc.service;
+
+import com.etotem.cfc.dto.FirstDealRow;
+import com.etotem.cfc.dto.MonthlyAmountRow;
+import com.etotem.cfc.dto.TeamStarMyViewDTO;
+import com.etotem.cfc.mapper.DistributionRelationMapper;
+import com.etotem.cfc.mapper.PpointConsumptionLogMapper;
+import com.etotem.cfc.mapper.ReferralTreeMapper;
+import com.etotem.cfc.mapper.ServiceSettlementMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 星级计算与「我的星级」看板聚合(规格 §4.3 / §4.3.1 ①②,项目代号 cf-1026 星级透明化)。
+ *
+ * <p>业绩分 Score = 直接服务收入(元)×50% + 团队服务收入(元)×40% + 推荐用户平台消费(元)×10%,
+ * 结果取整为「分」;档位映射读后台配置 {@code team_profit.star_tiers}
+ * (默认 {@code [0,8000,25000,70000,140000,250000]},下标 i = 星级 i+1)。</p>
+ *
+ * <p>升级双门槛:业绩分 ≥ 目标档门槛 且 滚动 12 个月团队直推 ≥ 1(团队树
+ * {@code distribution_relations} 直接邀请 + 首笔成交落在窗口内,首单即算无金额门槛,
+ * 防刷阈值 {@code team_profit.valid_new_ref_min_order_cent} 默认 0)。</p>
+ *
+ * <p>数据源:{@code service_settlements}(直接/团队服务收入,团队口径额外与
+ * {@code cf_balance_log ref_type='F03a'} 交集防空转)+ {@code ppoint_consumption_log}(推荐消费)
+ * + {@code referral_tree}(8 层团队)+ {@code distribution_relations}(团队直推)。</p>
+ */
+@Slf4j
+@Service
+public class StarScoreCalculator {
+
+    /** 星级档位配置键:JSON 数组,下标 i = 星级 i+1 的门槛(分) */
+    public static final String CFG_STAR_TIERS = "team_profit.star_tiers";
+    /** 星级换算率配置键:JSON 对象 {"direct":250,"team":200,"referral":10} */
+    public static final String CFG_STAR_CONVERSION = "team_profit.star_conversion";
+    /** 团队直推有效新用户首单最低金额(分),默认 0 = 首单即算 */
+    public static final String CFG_MIN_ORDER_CENT = "team_profit.valid_new_ref_min_order_cent";
+
+    /** 默认档位(#12 已拍板推荐值,可后台下调) */
+    private static final long[] DEFAULT_TIERS = {0, 8000, 25000, 70000, 140000, 250000};
+
+    /** 默认换算率(¥500/次咨询基准):直接服务 1 次 = 250 分 */
+    private static final long DEFAULT_DIRECT_RATE = 250;
+    /** 团队带教 1 次 = 200 分 */
+    private static final long DEFAULT_TEAM_RATE = 200;
+    /** 推荐消费 ¥100 = 10 分 */
+    private static final long DEFAULT_REFERRAL_RATE = 10;
+
+    private static final String[] STAR_NAMES = {"一星", "二星", "三星", "四星", "五星", "六星"};
+
+    /** 团队服务收入统计深度(referral_tree 8 层内,与 F03a 团队口径一致) */
+    private static final int TEAM_DEPTH = 8;
+    /** 轨迹展示月份数(近 12 个月) */
+    private static final int TRAJECTORY_MONTHS = 12;
+    /** 轨迹取数月份数(近 24 个月,供 12 个月滚动窗口在内存内滑动) */
+    private static final int FETCH_MONTHS = 24;
+    /** SQL IN 分批大小,避免超长绑定 */
+    private static final int USER_ID_BATCH = 500;
+
+    private static final ObjectMapper JSON = new ObjectMapper();
+
+    @Resource
+    private ServiceSettlementMapper serviceSettlementMapper;
+    @Resource
+    private PpointConsumptionLogMapper ppointConsumptionLogMapper;
+    @Resource
+    private ReferralTreeMapper referralTreeMapper;
+    @Resource
+    private DistributionRelationMapper distributionRelationMapper;
+    @Resource
+    private CfReferralService cfReferralService;
+    @Resource
+    private SysConfigService sysConfigService;
+
+    /**
+     * 构建「我的星级」看板(规格 §4.3.1 接口:POST /api/team-star/my-view)。
+     */
+    public TeamStarMyViewDTO buildMyView(Long userId) {
+        long[] tiers = loadTiers();
+        long[] conversion = loadConversion();
+        long minOrderCent = loadMinOrderCent();
+
+        Date now = new Date();
+        Date since = cfReferralService.rollingYearAgo();
+        List<Long> teamIds = cfReferralService.getTeamUserIds(userId, TEAM_DEPTH);
+        List<Long> descendantIds = referralTreeMapper.selectDescendantUserIds(userId);
+        descendantIds.remove(userId);
+
+        // 三维收入(分)
+        long directCent = serviceSettlementMapper.sumServiceFeeByProviderSince(userId, since);
+        long teamCent = teamIds.isEmpty()
+                ? 0 : serviceSettlementMapper.sumTeamServiceFeeSince(teamIds, since);
+        long refCent = sumAmountCentInBatches(descendantIds, since);
+
+        // 贡献分 = 收入(元) × 权重(直接50% / 团队40% / 推荐10%),四舍五入到分
+        long directScore = Math.round(directCent * 0.5 / 100.0);
+        long teamScore = Math.round(teamCent * 0.4 / 100.0);
+        long referralScore = Math.round(refCent * 0.1 / 100.0);
+        long totalScore = directScore + teamScore + referralScore;
+
+        // 升级双门槛(§4.3):滚动 12 个月团队直推 ≥ 1
+        long refs = countDirectValidRefs(userId, since, minOrderCent);
+
+        // 当前星级:业绩分达标档位,且(一星 或 直推≥1)——两条件缺一不可
+        int currentStar = resolveCurrentStar(totalScore, refs, tiers);
+        int nextStar = currentStar < tiers.length ? currentStar + 1 : 0;
+        long nextThreshold = nextStar > 0 ? tiers[nextStar - 1] : 0;
+        long gap = nextStar > 0 ? Math.max(0, nextThreshold - totalScore) : 0;
+        boolean scoreMet = nextStar > 0 && totalScore >= nextThreshold;
+        boolean refMet = refs >= 1;
+        boolean promotable = nextStar > 0 && scoreMet && refMet;
+
+        TeamStarMyViewDTO dto = new TeamStarMyViewDTO();
+        dto.setCurrentStar(currentStar);
+        dto.setCurrentStarName(starName(currentStar));
+        dto.setTotalScore(totalScore);
+        dto.setDirectScore(directScore);
+        dto.setTeamScore(teamScore);
+        dto.setReferralScore(referralScore);
+        dto.setNextStar(nextStar);
+        dto.setNextStarName(nextStar > 0 ? starName(nextStar) : "");
+        dto.setNextThreshold(nextThreshold);
+        dto.setScoreGapToNext(gap);
+        dto.setScoreMet(scoreMet);
+        dto.setDirectValidRefs(refs);
+        dto.setRefMet(refMet);
+        dto.setPromotable(promotable);
+        dto.setWindowStart(fmtDate(since));
+        dto.setWindowEnd(fmtDate(now));
+        dto.setTiers(buildTiers(tiers));
+        dto.setPaths(buildPaths(gap, conversion));
+        dto.setTrajectory(buildTrajectory(userId, teamIds, descendantIds, tiers));
+        return dto;
+    }
+
+    // ==================== 三维收入 / 双门槛 ====================
+
+    /** 团队直推有效新用户数:本人直接邀请加入团队(distribution_relations.parent_id=本人)中,
+     *  首笔成交(product_orders status='paid' 最早一单)落在滚动 12 个月窗口内 且 首单金额 ≥ 阈值。 */
+    private long countDirectValidRefs(Long userId, Date since, long minOrderCent) {
+        List<Long> invitees = distributionRelationMapper.selectDirectInviteeUserIds(userId);
+        if (invitees == null || invitees.isEmpty()) {
+            return 0;
+        }
+        long count = 0;
+        for (int i = 0; i < invitees.size(); i += USER_ID_BATCH) {
+            List<Long> batch = invitees.subList(i, Math.min(i + USER_ID_BATCH, invitees.size()));
+            List<FirstDealRow> rows = distributionRelationMapper.selectFirstDeals(batch);
+            if (rows == null) {
+                continue;
+            }
+            for (FirstDealRow row : rows) {
+                if (row.getFirstPaidAt() == null || row.getFirstPaidAt().before(since)) {
+                    continue;
+                }
+                long amount = row.getFirstAmountCent() == null ? 0 : row.getFirstAmountCent();
+                if (amount >= minOrderCent) {
+                    count++;
+                }
+            }
+        }
+        return count;
+    }
+
+    private long sumAmountCentInBatches(List<Long> userIds, Date since) {
+        if (userIds == null || userIds.isEmpty()) {
+            return 0;
+        }
+        long total = 0;
+        for (int i = 0; i < userIds.size(); i += USER_ID_BATCH) {
+            List<Long> batch = userIds.subList(i, Math.min(i + USER_ID_BATCH, userIds.size()));
+            total += ppointConsumptionLogMapper.sumAmountCentSince(batch, since);
+        }
+        return total;
+    }
+
+    // ==================== 星级映射 / 双门槛 ====================
+
+    /** 当前星级:取满足 业绩分≥门槛 且(一星 或 直推≥1)的最高档位。 */
+    private int resolveCurrentStar(long totalScore, long refs, long[] tiers) {
+        int star = 1;
+        for (int i = 0; i < tiers.length; i++) {
+            if (totalScore >= tiers[i] && (i == 0 || refs >= 1)) {
+                star = i + 1;
+            }
+        }
+        return star;
+    }
+
+    /** 轨迹用的纯业绩分档位映射(不套直推门槛,曲线只反映业绩分演化)。 */
+    private int scoreStar(long score, long[] tiers) {
+        int star = 1;
+        for (int i = 0; i < tiers.length; i++) {
+            if (score >= tiers[i]) {
+                star = i + 1;
+            }
+        }
+        return star;
+    }
+
+    // ==================== 换算路径(§4.3.1 ②) ====================
+
+    /**
+     * 三条达标路径,按「最容易够到」排序:
+     * A 直接服务 ceil(gap/250) 次 < B 团队带教 ceil(gap/200) 次 < C 推荐消费 gap×10 元
+     * (数值序恒成立:10 > 1/200 > 1/250,rank=1 为最省力路径)。
+     */
+    private List<TeamStarMyViewDTO.ConversionPath> buildPaths(long gap, long[] conv) {
+        long directRate = conv[0] > 0 ? conv[0] : DEFAULT_DIRECT_RATE;
+        long teamRate = conv[1] > 0 ? conv[1] : DEFAULT_TEAM_RATE;
+        long refRate = conv[2] > 0 ? conv[2] : DEFAULT_REFERRAL_RATE;
+
+        long directCnt = gap <= 0 ? 0 : ceilDiv(gap, directRate);
+        long teamCnt = gap <= 0 ? 0 : ceilDiv(gap, teamRate);
+        long refYuan = gap <= 0 ? 0 : (gap * 100 + refRate - 1) / refRate;
+
+        List<TeamStarMyViewDTO.ConversionPath> paths = new ArrayList<>();
+        paths.add(buildPath("direct", "直接服务", "1 次 1对1 咨询 = " + directRate + " 分", directCnt, "次", 1));
+        paths.add(buildPath("team", "团队带教", "1 次团队服务 = " + teamRate + " 分", teamCnt, "次", 2));
+        paths.add(buildPath("referral", "推荐消费", "每 ¥100 推荐消费 = " + refRate + " 分", refYuan, "元", 3));
+        paths.sort((a, b) -> Long.compare(a.getRequired(), b.getRequired()));
+        for (int i = 0; i < paths.size(); i++) {
+            paths.get(i).setEasiest(i == 0);
+            paths.get(i).setRank(i + 1);
+        }
+        return paths;
+    }
+
+    private TeamStarMyViewDTO.ConversionPath buildPath(String type, String label, String text,
+                                                       long required, String unit, int rank) {
+        TeamStarMyViewDTO.ConversionPath p = new TeamStarMyViewDTO.ConversionPath();
+        p.setType(type);
+        p.setLabel(label);
+        p.setConversionText(text);
+        p.setRequired(required);
+        p.setUnit(unit);
+        p.setEasiest(false);
+        p.setRank(rank);
+        return p;
+    }
+
+    // ==================== 近 12 月轨迹 ====================
+
+    /**
+     * 近 12 个月星级曲线(旧→新):取近 24 个月的月度聚合,在内存中按 12 个自然月滚动窗口
+     * 逐点计算业绩分并映射档位。月度快照表 team_star_snapshot 尚未建立,按 P1 默认实时计算。
+     */
+    private List<TeamStarMyViewDTO.TrajectoryPoint> buildTrajectory(Long userId, List<Long> teamIds,
+                                                                    List<Long> descendantIds, long[] tiers) {
+        Date since = monthsAgo(FETCH_MONTHS);
+        Map<String, Long> directByMonth = toMonthMap(serviceSettlementMapper.sumServiceFeeByProviderByMonth(userId, since));
+        Map<String, Long> teamByMonth = teamIds.isEmpty()
+                ? Collections.emptyMap() : teamMonthlyBatched(teamIds, since);
+        Map<String, Long> refByMonth = descendantIds.isEmpty()
+                ? Collections.emptyMap() : refMonthlyBatched(descendantIds, since);
+
+        List<TeamStarMyViewDTO.TrajectoryPoint> points = new ArrayList<>();
+        for (int i = TRAJECTORY_MONTHS - 1; i >= 0; i--) {
+            long direct = 0, team = 0, ref = 0;
+            for (int k = 0; k < TRAJECTORY_MONTHS; k++) {
+                String m = monthKey(monthsAgo(i + k));
+                direct += directByMonth.getOrDefault(m, 0L);
+                team += teamByMonth.getOrDefault(m, 0L);
+                ref += refByMonth.getOrDefault(m, 0L);
+            }
+            long score = Math.round(direct * 0.5 / 100.0)
+                    + Math.round(team * 0.4 / 100.0)
+                    + Math.round(ref * 0.1 / 100.0);
+            int star = scoreStar(score, tiers);
+            TeamStarMyViewDTO.TrajectoryPoint p = new TeamStarMyViewDTO.TrajectoryPoint();
+            p.setMonth(monthKey(monthsAgo(i)));
+            p.setStar(star);
+            p.setStarName(starName(star));
+            points.add(p);
+        }
+        return points;
+    }
+
+    // ==================== 后台配置读取(§11 #12 已拍板进配置) ====================
+
+    /** 团队服务收入的月度聚合(IN 分批累加,避免团队过大超 MySQL 占位符上限)。 */
+    private Map<String, Long> teamMonthlyBatched(List<Long> teamIds, Date since) {
+        Map<String, Long> acc = new HashMap<>();
+        for (int i = 0; i < teamIds.size(); i += USER_ID_BATCH) {
+            List<Long> batch = teamIds.subList(i, Math.min(i + USER_ID_BATCH, teamIds.size()));
+            mergeMonthRows(acc, serviceSettlementMapper.sumTeamServiceFeeByMonth(batch, since));
+        }
+        return acc;
+    }
+
+    /** 推荐消费额的月度聚合(IN 分批累加)。 */
+    private Map<String, Long> refMonthlyBatched(List<Long> userIds, Date since) {
+        Map<String, Long> acc = new HashMap<>();
+        for (int i = 0; i < userIds.size(); i += USER_ID_BATCH) {
+            List<Long> batch = userIds.subList(i, Math.min(i + USER_ID_BATCH, userIds.size()));
+            mergeMonthRows(acc, ppointConsumptionLogMapper.sumAmountCentByMonth(batch, since));
+        }
+        return acc;
+    }
+
+    private void mergeMonthRows(Map<String, Long> acc, List<MonthlyAmountRow> rows) {
+        if (rows == null) {
+            return;
+        }
+        for (MonthlyAmountRow row : rows) {
+            if (row.getYm() == null) {
+                continue;
+            }
+            acc.merge(row.getYm(), row.getTotal() == null ? 0L : row.getTotal(), Long::sum);
+        }
+    }
+
+    private long[] loadTiers() {
+        long[] fallback = DEFAULT_TIERS.clone(); // 防御外部修改
+        String raw = sysConfigService.getValue(CFG_STAR_TIERS);
+        if (raw == null || raw.trim().isEmpty()) {
+            return fallback;
+        }
+        try {
+            long[] arr = JSON.readValue(raw.trim(), long[].class);
+            if (arr != null && arr.length == DEFAULT_TIERS.length) {
+                return arr;
+            }
+            log.warn("{} 配置长度异常({},期望 {}),使用默认档位", CFG_STAR_TIERS,
+                    arr == null ? "null" : arr.length, DEFAULT_TIERS.length);
+        } catch (Exception e) {
+            log.warn("解析 {} 失败,使用默认档位: {}", CFG_STAR_TIERS, e.getMessage());
+        }
+        return fallback;
+    }
+
+    private long[] loadConversion() {
+        long[] conv = {DEFAULT_DIRECT_RATE, DEFAULT_TEAM_RATE, DEFAULT_REFERRAL_RATE};
+        String raw = sysConfigService.getValue(CFG_STAR_CONVERSION);
+        if (raw == null || raw.trim().isEmpty()) {
+            return conv;
+        }
+        try {
+            Map<?, ?> m = JSON.readValue(raw.trim(), Map.class);
+            conv[0] = toLong(m.get("direct"), DEFAULT_DIRECT_RATE);
+            conv[1] = toLong(m.get("team"), DEFAULT_TEAM_RATE);
+            conv[2] = toLong(m.get("referral"), DEFAULT_REFERRAL_RATE);
+        } catch (Exception e) {
+            log.warn("解析 {} 失败,使用默认换算率: {}", CFG_STAR_CONVERSION, e.getMessage());
+        }
+        return conv;
+    }
+
+    private long loadMinOrderCent() {
+        String raw = sysConfigService.getValue(CFG_MIN_ORDER_CENT);
+        if (raw == null || raw.trim().isEmpty()) {
+            return 0;
+        }
+        try {
+            return Long.parseLong(raw.trim());
+        } catch (NumberFormatException e) {
+            log.warn("{} 非数字,按 0 处理: {}", CFG_MIN_ORDER_CENT, raw);
+            return 0;
+        }
+    }
+
+    // ==================== 工具 ====================
+
+    private List<TeamStarMyViewDTO.Tier> buildTiers(long[] tiers) {
+        List<TeamStarMyViewDTO.Tier> list = new ArrayList<>();
+        for (int i = 0; i < tiers.length; i++) {
+            TeamStarMyViewDTO.Tier t = new TeamStarMyViewDTO.Tier();
+            t.setStar(i + 1);
+            t.setThreshold(tiers[i]);
+            list.add(t);
+        }
+        return list;
+    }
+
+    private Map<String, Long> toMonthMap(List<MonthlyAmountRow> rows) {
+        Map<String, Long> map = new HashMap<>();
+        if (rows == null) {
+            return map;
+        }
+        for (MonthlyAmountRow row : rows) {
+            if (row.getYm() != null) {
+                map.put(row.getYm(), row.getTotal() == null ? 0L : row.getTotal());
+            }
+        }
+        return map;
+    }
+
+    private String starName(int star) {
+        return star >= 1 && star <= STAR_NAMES.length ? STAR_NAMES[star - 1] : "";
+    }
+
+    private static long ceilDiv(long a, long b) {
+        return (a + b - 1) / b;
+    }
+
+    private static long toLong(Object v, long fallback) {
+        if (v == null) {
+            return fallback;
+        }
+        if (v instanceof Number) {
+            return ((Number) v).longValue();
+        }
+        try {
+            return Long.parseLong(String.valueOf(v).trim());
+        } catch (NumberFormatException e) {
+            return fallback;
+        }
+    }
+
+    private static Date monthsAgo(int months) {
+        Calendar c = Calendar.getInstance();
+        c.add(Calendar.MONTH, -months);
+        return c.getTime();
+    }
+
+    private static String monthKey(Date d) {
+        return new SimpleDateFormat("yyyy-MM").format(d);
+    }
+
+    private static String fmtDate(Date d) {
+        return new SimpleDateFormat("yyyy-MM-dd").format(d);
+    }
+}

+ 6 - 0
cfc-frontend/pages.json

@@ -858,6 +858,12 @@
             "navigationBarTitleText": "推广团队"
           }
         },
+        {
+          "path": "star",
+          "style": {
+            "navigationBarTitleText": "我的星级"
+          }
+        },
         {
           "path": "leaderboard",
           "style": {

+ 10 - 0
cfc-frontend/pages/promotion/index.vue

@@ -150,6 +150,12 @@
         </view>
         <text class="menu-text">立即提现</text>
       </view> -->
+      <view class="menu-item" @click="goTeamStar">
+        <view class="menu-icon-wrap icon-team-star">
+          <text class="menu-icon-text">⭐</text>
+        </view>
+        <text class="menu-text">我的星级</text>
+      </view>
       <view class="menu-item" @click="goLeaderboard">
         <view class="menu-icon-wrap icon-leaderboard">
           <text class="menu-icon-text">🏆</text>
@@ -473,6 +479,9 @@ export default {
     goWithdraw() {
       uni.navigateTo({ url: '/pages/promotion/withdraw' })
     },
+    goTeamStar() {
+      uni.navigateTo({ url: '/pages/promotion/star' })
+    },
     goLeaderboard() {
       uni.navigateTo({ url: '/pages/promotion/leaderboard' })
     }
@@ -986,6 +995,7 @@ export default {
 .icon-invite { background: $status-success-soft; }
 .icon-share { background: $tint-sky-tint; }
 .icon-team { background: $accent-pink-tint; }
+.icon-team-star { background: #FFE9C7; }
 .icon-leaderboard { background: #FFF3CD; }
 .icon-records { background: $violet-tint-100; }
 .menu-icon-text {

+ 582 - 0
cfc-frontend/pages/promotion/star.vue

@@ -0,0 +1,582 @@
+<template>
+  <view class="page-wrapper" :style="{ '--font-scale': fontScale }">
+    <view class="container">
+      <view v-if="loading" class="state-card">
+        <text class="state-text">加载中…</text>
+      </view>
+      <view v-else-if="error" class="state-card">
+        <text class="state-text">{{ error }}</text>
+        <view class="state-btn" @click="load">重试</view>
+      </view>
+
+      <block v-else-if="view">
+        <!-- 当前星级 + 总分 -->
+        <view class="star-hero">
+          <view class="hero-top">
+            <view class="hero-avatar">
+              <text class="hero-icon">{{ starIcon(view.currentStar) }}</text>
+            </view>
+            <text class="hero-name">{{ view.currentStarName }}</text>
+            <text class="hero-tag">团队星级</text>
+          </view>
+          <view class="hero-score-row">
+            <text class="hero-score">{{ fmtNum(view.totalScore) }}</text>
+            <text class="hero-score-label">业绩分总分</text>
+          </view>
+          <text class="hero-window">统计窗口:{{ view.windowStart }} ~ {{ view.windowEnd }}(滚动近 12 个月)</text>
+        </view>
+
+        <!-- 升级双门槛 -->
+        <view class="card">
+          <view class="card-title">升级双门槛(两点都满足才能升星)</view>
+          <template v-if="view.nextStar > 0">
+            <view class="gate-row" :class="{ 'gate-ok': view.scoreMet }">
+              <text class="gate-check">{{ view.scoreMet ? '✅' : '❌' }}</text>
+              <view class="gate-info">
+                <text class="gate-label">业绩分 {{ fmtNum(view.totalScore) }} / {{ fmtNum(view.nextThreshold) }} 分</text>
+                <text class="gate-sub" v-if="!view.scoreMet">距 {{ view.nextStarName }} 还差 {{ fmtNum(view.scoreGapToNext) }} 分</text>
+                <text class="gate-sub" v-else>业绩分已达标 ✓</text>
+              </view>
+            </view>
+            <view class="gate-row" :class="{ 'gate-ok': view.refMet }">
+              <text class="gate-check">{{ view.refMet ? '✅' : '❌' }}</text>
+              <view class="gate-info">
+                <text class="gate-label">团队直推 {{ view.directValidRefs }} / 1</text>
+                <text class="gate-sub" v-if="!view.refMet">升级还差 1 个团队直推:去邀请好友加入团队并完成首单</text>
+                <text class="gate-sub" v-else>团队直推已达标 ✓</text>
+              </view>
+            </view>
+            <view class="gate-banner" :class="view.promotable ? 'banner-ok' : 'banner-wait'">
+              <text v-if="view.promotable">🎉 双门槛已满足,可以升级到 {{ view.nextStarName }}!</text>
+              <text v-else>继续加油,达成两个条件即可升入 {{ view.nextStarName }}</text>
+            </view>
+          </template>
+          <view v-else class="gate-banner banner-top">🌟 已达最高星级(六星),继续保持!</view>
+        </view>
+
+        <!-- 三维构成 -->
+        <view class="card">
+          <view class="card-title">业绩分构成(直接 50% + 团队 40% + 推荐 10%)</view>
+          <view class="dim-row">
+            <view class="dim-head">
+              <text class="dim-label">直接服务</text>
+              <text class="dim-val">{{ fmtNum(view.directScore) }} 分 · {{ pct(view.directScore) }}</text>
+            </view>
+            <view class="dim-bar"><view class="dim-fill fill-direct" :style="{ width: pctW(view.directScore) }"></view></view>
+          </view>
+          <view class="dim-row">
+            <view class="dim-head">
+              <text class="dim-label">团队服务</text>
+              <text class="dim-val">{{ fmtNum(view.teamScore) }} 分 · {{ pct(view.teamScore) }}</text>
+            </view>
+            <view class="dim-bar"><view class="dim-fill fill-team" :style="{ width: pctW(view.teamScore) }"></view></view>
+          </view>
+          <view class="dim-row">
+            <view class="dim-head">
+              <text class="dim-label">推荐消费</text>
+              <text class="dim-val">{{ fmtNum(view.referralScore) }} 分 · {{ pct(view.referralScore) }}</text>
+            </view>
+            <view class="dim-bar"><view class="dim-fill fill-ref" :style="{ width: pctW(view.referralScore) }"></view></view>
+          </view>
+        </view>
+
+        <!-- 达标换算路径 -->
+        <view class="card" v-if="view.nextStar > 0">
+          <view class="card-title">达标路径(按最容易够到排序)</view>
+          <view class="gap-line" v-if="view.scoreGapToNext > 0">
+            距 {{ view.nextStarName }} 还差 <text class="gap-num">{{ fmtNum(view.scoreGapToNext) }}</text> 分
+          </view>
+          <view class="gap-line" v-else>
+            业绩分已达标,再完成直推即可升级!
+          </view>
+          <view
+            class="path-item"
+            v-for="p in view.paths"
+            :key="p.type"
+            :class="{ 'path-easiest': p.easiest }"
+          >
+            <view class="path-rank">{{ p.rank }}</view>
+            <view class="path-body">
+              <view class="path-head">
+                <text class="path-label">{{ p.label }}</text>
+                <text class="path-badge" v-if="p.easiest">最省力</text>
+              </view>
+              <text class="path-text">{{ p.conversionText }}</text>
+            </view>
+            <view class="path-req" v-if="p.required > 0">
+              <text class="path-req-num">{{ fmtNum(p.required) }}</text>
+              <text class="path-req-unit">{{ p.unit }}</text>
+            </view>
+            <view class="path-req" v-else>
+              <text class="path-req-unit">已达标</text>
+            </view>
+          </view>
+        </view>
+
+        <!-- 近 12 个月轨迹 -->
+        <view class="card">
+          <view class="card-title">近 12 个月星级轨迹</view>
+          <view class="traj">
+            <view class="traj-col" v-for="(t, i) in view.trajectory" :key="i">
+              <text class="traj-month">{{ monthShort(t.month) }}</text>
+              <view class="traj-bar-wrap">
+                <view class="traj-bar" :class="trajClass(t.star)" :style="{ height: trajHeight(t.star) }"></view>
+              </view>
+              <text class="traj-star">{{ t.star }}★</text>
+            </view>
+          </view>
+          <view class="traj-note" v-if="view.trajectory && view.trajectory.length">
+            当前月为 {{ view.trajectory[view.trajectory.length - 1].month }},星级 {{ view.trajectory[view.trajectory.length - 1].starName }}
+          </view>
+        </view>
+
+        <!-- 星级档位阶梯 -->
+        <view class="card">
+          <view class="card-title">星级档位一览</view>
+          <view class="tier-row" v-for="t in view.tiers" :key="t.star" :class="{ 'tier-current': t.star === view.currentStar }">
+            <text class="tier-icon">{{ starIcon(t.star) }}</text>
+            <text class="tier-name">{{ starName(t.star) }}</text>
+            <text class="tier-threshold">{{ t.star === 1 ? '入团即得' : fmtNum(t.threshold) + ' 分' }}</text>
+            <text class="tier-current-tag" v-if="t.star === view.currentStar">当前</text>
+          </view>
+        </view>
+      </block>
+    </view>
+  </view>
+</template>
+
+<script>
+import { BrandColors } from '../../utils/brand-colors.js'
+import { getTeamStarMyView } from '../../utils/api.js'
+import fontScaleMixin from '@/mixins/font-scale.js'
+
+const STAR_NAMES = ['一星', '二星', '三星', '四星', '五星', '六星']
+
+export default {
+  mixins: [fontScaleMixin],
+  data() {
+    return {
+      loading: true,
+      error: '',
+      view: null
+    }
+  },
+  onLoad() {
+    this.load()
+  },
+  methods: {
+    async load() {
+      this.loading = true
+      this.error = ''
+      try {
+        const res = await getTeamStarMyView()
+        if (res && res.code === 200 && res.data) {
+          this.view = res.data
+        } else {
+          this.error = (res && res.message) || '加载失败,请稍后重试'
+        }
+      } catch (e) {
+        this.error = '加载失败,请稍后重试'
+      } finally {
+        this.loading = false
+      }
+    },
+    fmtNum(n) {
+      const num = Number(n || 0)
+      const str = String(num)
+      return str.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
+    },
+    pct(score) {
+      const total = Number(this.view && this.view.totalScore) || 0
+      if (total <= 0) return '0%'
+      return ((Number(score || 0) / total) * 100).toFixed(1) + '%'
+    },
+    pctW(score) {
+      const total = Number(this.view && this.view.totalScore) || 0
+      if (total <= 0) return '0%'
+      return Math.max(2, Math.round((Number(score || 0) / total) * 100)) + '%'
+    },
+    starName(star) {
+      return STAR_NAMES[Number(star || 1) - 1] || ''
+    },
+    starIcon(star) {
+      const n = Number(star || 1)
+      let s = ''
+      for (let i = 0; i < n && i < 6; i++) s += '⭐'
+      return s
+    },
+    monthShort(m) {
+      return m ? String(m).slice(2) : ''
+    },
+    trajClass(star) {
+      const n = Number(star || 1)
+      return 'traj-s' + (n > 6 ? 6 : n)
+    },
+    trajHeight(star) {
+      const n = Number(star || 1)
+      return Math.max(10, Math.min(6, n) * 14) + 'rpx'
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.page-wrapper {
+  min-height: 100vh;
+  background: #f6f7fb;
+}
+.container {
+  padding: 24rpx;
+  box-sizing: border-box;
+}
+
+.state-card {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding: 120rpx 0;
+  .state-text {
+    font-size: calc(30rpx * var(--font-scale, 1));
+    color: #999;
+  }
+  .state-btn {
+    margin-top: 24rpx;
+    padding: 12rpx 48rpx;
+    background: #fff;
+    border-radius: 999rpx;
+    color: #ff9500;
+    font-size: calc(28rpx * var(--font-scale, 1));
+  }
+}
+
+.star-hero {
+  background: linear-gradient(135deg, #ffd66b 0%, #ffb347 55%, #ff9500 100%);
+  border-radius: 24rpx;
+  padding: 40rpx 32rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  box-shadow: 0 6rpx 20rpx rgba(255, 149, 0, 0.25);
+  .hero-top {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+  }
+  .hero-avatar {
+    width: 120rpx;
+    height: 120rpx;
+    border-radius: 50%;
+    background: rgba(255, 255, 255, 0.9);
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    margin-bottom: 16rpx;
+    .hero-icon {
+      font-size: 56rpx;
+    }
+  }
+  .hero-name {
+    font-size: calc(52rpx * var(--font-scale, 1));
+    font-weight: 700;
+    color: #7a4a00;
+    line-height: 1.2;
+  }
+  .hero-tag {
+    font-size: calc(24rpx * var(--font-scale, 1));
+    color: rgba(122, 74, 0, 0.7);
+    margin-top: 6rpx;
+  }
+  .hero-score-row {
+    display: flex;
+    align-items: baseline;
+    margin-top: 24rpx;
+    .hero-score {
+      font-size: calc(68rpx * var(--font-scale, 1));
+      font-weight: 800;
+      color: #fff;
+      text-shadow: 0 2rpx 6rpx rgba(122, 74, 0, 0.3);
+    }
+    .hero-score-label {
+      font-size: calc(26rpx * var(--font-scale, 1));
+      color: #fff;
+      margin-left: 12rpx;
+    }
+  }
+  .hero-window {
+    margin-top: 20rpx;
+    font-size: calc(22rpx * var(--font-scale, 1));
+    color: rgba(255, 255, 255, 0.92);
+  }
+}
+
+.card {
+  background: #fff;
+  border-radius: 24rpx;
+  padding: 28rpx;
+  margin-top: 24rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
+  .card-title {
+    font-size: calc(30rpx * var(--font-scale, 1));
+    font-weight: 600;
+    color: #333;
+    margin-bottom: 20rpx;
+  }
+}
+
+/* 双门槛 */
+.gate-row {
+  display: flex;
+  align-items: flex-start;
+  padding: 20rpx 0;
+  border-bottom: 1rpx solid #f2f2f2;
+  &.gate-ok {
+    .gate-label {
+      color: #07c160;
+    }
+  }
+  .gate-check {
+    font-size: calc(36rpx * var(--font-scale, 1));
+    margin-right: 16rpx;
+    line-height: 1.4;
+  }
+  .gate-info {
+    flex: 1;
+    display: flex;
+    flex-direction: column;
+  }
+  .gate-label {
+    font-size: calc(30rpx * var(--font-scale, 1));
+    color: #333;
+    font-weight: 600;
+  }
+  .gate-sub {
+    font-size: calc(24rpx * var(--font-scale, 1));
+    color: #999;
+    margin-top: 6rpx;
+    line-height: 1.5;
+  }
+}
+.gate-banner {
+  margin-top: 20rpx;
+  padding: 16rpx 20rpx;
+  border-radius: 16rpx;
+  font-size: calc(26rpx * var(--font-scale, 1));
+  text-align: center;
+  &.banner-ok {
+    background: #e8f9ef;
+    color: #07c160;
+  }
+  &.banner-wait {
+    background: #fff7e6;
+    color: #b26a00;
+  }
+  &.banner-top {
+    background: #fff7e6;
+    color: #b26a00;
+  }
+}
+
+/* 三维构成 */
+.dim-row {
+  margin-bottom: 20rpx;
+  &:last-child {
+    margin-bottom: 0;
+  }
+  .dim-head {
+    display: flex;
+    justify-content: space-between;
+    margin-bottom: 10rpx;
+    .dim-label {
+      font-size: calc(26rpx * var(--font-scale, 1));
+      color: #666;
+    }
+    .dim-val {
+      font-size: calc(26rpx * var(--font-scale, 1));
+      color: #333;
+      font-weight: 600;
+    }
+  }
+  .dim-bar {
+    height: 16rpx;
+    background: #f0f0f0;
+    border-radius: 999rpx;
+    overflow: hidden;
+    .dim-fill {
+      height: 100%;
+      border-radius: 999rpx;
+      &.fill-direct {
+        background: linear-gradient(90deg, #ff9f43, #ffb86b);
+      }
+      &.fill-team {
+        background: linear-gradient(90deg, #5b8def, #7aa5ff);
+      }
+      &.fill-ref {
+        background: linear-gradient(90deg, #845ef7, #a78bfa);
+      }
+    }
+  }
+}
+
+/* 换算路径 */
+.gap-line {
+  font-size: calc(26rpx * var(--font-scale, 1));
+  color: #666;
+  margin-bottom: 16rpx;
+  .gap-num {
+    color: #ff9500;
+    font-weight: 700;
+  }
+}
+.path-item {
+  display: flex;
+  align-items: center;
+  padding: 20rpx 0;
+  border-bottom: 1rpx solid #f2f2f2;
+  &:last-child {
+    border-bottom: none;
+  }
+  &.path-easiest {
+    background: #fffaf0;
+    margin: 8rpx -12rpx;
+    padding: 20rpx 12rpx;
+    border-radius: 16rpx;
+  }
+  .path-rank {
+    width: 44rpx;
+    height: 44rpx;
+    border-radius: 50%;
+    background: #f0f0f0;
+    color: #999;
+    font-size: calc(26rpx * var(--font-scale, 1));
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    margin-right: 16rpx;
+    flex-shrink: 0;
+  }
+  &.path-easiest .path-rank {
+    background: #ff9500;
+    color: #fff;
+  }
+  .path-body {
+    flex: 1;
+    display: flex;
+    flex-direction: column;
+  }
+  .path-head {
+    display: flex;
+    align-items: center;
+    .path-label {
+      font-size: calc(30rpx * var(--font-scale, 1));
+      color: #333;
+      font-weight: 600;
+    }
+    .path-badge {
+      margin-left: 12rpx;
+      font-size: calc(20rpx * var(--font-scale, 1));
+      color: #ff9500;
+      background: #fff1dc;
+      padding: 2rpx 12rpx;
+      border-radius: 999rpx;
+    }
+  }
+  .path-text {
+    font-size: calc(24rpx * var(--font-scale, 1));
+    color: #999;
+    margin-top: 6rpx;
+  }
+  .path-req {
+    display: flex;
+    align-items: baseline;
+    margin-left: 16rpx;
+    .path-req-num {
+      font-size: calc(34rpx * var(--font-scale, 1));
+      font-weight: 700;
+      color: #333;
+    }
+    .path-req-unit {
+      font-size: calc(22rpx * var(--font-scale, 1));
+      color: #999;
+      margin-left: 4rpx;
+    }
+  }
+}
+
+/* 轨迹 */
+.traj {
+  display: flex;
+  justify-content: space-between;
+  align-items: flex-end;
+  padding: 10rpx 0 0;
+  .traj-col {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    flex: 1;
+  }
+  .traj-month {
+    font-size: calc(20rpx * var(--font-scale, 1));
+    color: #999;
+    margin-bottom: 10rpx;
+  }
+  .traj-bar-wrap {
+    height: 100rpx;
+    display: flex;
+    align-items: flex-end;
+    margin-bottom: 8rpx;
+    .traj-bar {
+      width: 20rpx;
+      border-radius: 8rpx 8rpx 4rpx 4rpx;
+    }
+  }
+  .traj-star {
+    font-size: calc(22rpx * var(--font-scale, 1));
+    color: #666;
+  }
+}
+.traj-s1 { background: #c8ccd4; }
+.traj-s2 { background: #9db8e8; }
+.traj-s3 { background: #5b8def; }
+.traj-s4 { background: #845ef7; }
+.traj-s5 { background: #ff9f43; }
+.traj-s6 { background: #ffb800; }
+.traj-note {
+  margin-top: 16rpx;
+  font-size: calc(22rpx * var(--font-scale, 1));
+  color: #999;
+  text-align: center;
+}
+
+/* 档位一览 */
+.tier-row {
+  display: flex;
+  align-items: center;
+  padding: 18rpx 16rpx;
+  border-radius: 14rpx;
+  &.tier-current {
+    background: #fff7e6;
+  }
+  .tier-icon {
+    font-size: calc(30rpx * var(--font-scale, 1));
+    margin-right: 16rpx;
+  }
+  .tier-name {
+    font-size: calc(28rpx * var(--font-scale, 1));
+    color: #333;
+    font-weight: 500;
+    width: 140rpx;
+  }
+  .tier-threshold {
+    flex: 1;
+    font-size: calc(26rpx * var(--font-scale, 1));
+    color: #666;
+  }
+  .tier-current-tag {
+    font-size: calc(20rpx * var(--font-scale, 1));
+    color: #ff9500;
+    background: #fff1dc;
+    padding: 4rpx 14rpx;
+    border-radius: 999rpx;
+  }
+}
+</style>

+ 2 - 0
cfc-frontend/utils/api.js

@@ -2160,6 +2160,8 @@ export const getTeamL1ConsumptionCurve = (months = 12) => request('/api/commissi
 export const getCfRate = () => request('/api/commission/cf/rate', 'POST')
 export const getCfSummary = () => request('/api/commission/cf/summary', 'POST')
 export const getCfList = (page, size) => request('/api/commission/cf/list', 'POST', { page, size })
+// 团队星级(星级透明化 §4.3.1 ①②)
+export const getTeamStarMyView = () => request('/api/team-star/my-view', 'POST')
 // CF 转让
 export const sendCfTransfer = (toUserId, amount) => request('/api/cf/transfer/send', 'POST', { toUserId, amount })
 export const getCfTransferList = (page, size) => request('/api/cf/transfer/list', 'POST', { page, size })