Просмотр исходного кода

docs: 文档归档整理 + 行远页新增重要关系维护设计

- 将历史需求/设计/计划迁移至 docs/backup/
- 主目录仅保留当前有效文档
- 新增 docs/CHANGELOG.md 变更记录
- 行远页新增「重要关系维护」功能设计 (spec + plan)
- 新增 Contact 实体/API 设计
- 心智页能量柱改为堆叠图(心+智叠加)
- 私密活动可见性扩展为 visibility/visibleScope/visibleTo 三字段模型
User 5 месяцев назад
Родитель
Сommit
6d6139631c
100 измененных файлов с 12865 добавлено и 1279 удалено
  1. 57 57
      cfc-backend/.classpath
  2. 292 0
      cfc-backend/src/main/java/com/etotem/cfc/config/DatabaseInitializer.java
  3. 1 0
      cfc-backend/src/main/java/com/etotem/cfc/config/JwtInterceptor.java
  4. 72 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/ActivityController.java
  5. 66 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/ContactController.java
  6. 37 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/EmiReportController.java
  7. 105 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/HealthCheckinController.java
  8. 159 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/InternalApiController.java
  9. 44 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/InternalCommissionController.java
  10. 62 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/InternalEnergyController.java
  11. 65 7
      cfc-backend/src/main/java/com/etotem/cfc/controller/UserController.java
  12. 83 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/ai/AIChatController.java
  13. 93 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentResultController.java
  14. 26 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/content/ArticleController.java
  15. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/family/FamilyUserController.java
  16. 18 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/parent/ParentDashboardController.java
  17. 4 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/product/ProductController.java
  18. 26 14
      cfc-backend/src/main/java/com/etotem/cfc/controller/task/TaskController.java
  19. 59 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/ActivityDTO.java
  20. 14 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentHistoryItemDTO.java
  21. 38 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentResultDTO.java
  22. 12 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/CommissionSettleRequest.java
  23. 29 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/ContactDTO.java
  24. 30 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/EmiReportDTO.java
  25. 10 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/EnergyAwardRequest.java
  26. 11 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/ProductDTO.java
  27. 17 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/ReadingStatsDTO.java
  28. 1 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/UpdateChildDTO.java
  29. 59 0
      cfc-backend/src/main/java/com/etotem/cfc/entity/Activity.java
  30. 49 0
      cfc-backend/src/main/java/com/etotem/cfc/entity/Contact.java
  31. 38 0
      cfc-backend/src/main/java/com/etotem/cfc/entity/HealthCheckin.java
  32. 9 0
      cfc-backend/src/main/java/com/etotem/cfc/mapper/ActivityMapper.java
  33. 9 0
      cfc-backend/src/main/java/com/etotem/cfc/mapper/ContactMapper.java
  34. 9 0
      cfc-backend/src/main/java/com/etotem/cfc/mapper/HealthCheckinMapper.java
  35. 106 0
      cfc-backend/src/main/java/com/etotem/cfc/service/AIService.java
  36. 93 0
      cfc-backend/src/main/java/com/etotem/cfc/service/ActivityService.java
  37. 76 1
      cfc-backend/src/main/java/com/etotem/cfc/service/ArticleService.java
  38. 202 0
      cfc-backend/src/main/java/com/etotem/cfc/service/ContactService.java
  39. 41 0
      cfc-backend/src/main/java/com/etotem/cfc/service/EmiReportService.java
  40. 69 0
      cfc-backend/src/main/java/com/etotem/cfc/service/FamilyContextService.java
  41. 87 0
      cfc-backend/src/main/java/com/etotem/cfc/service/HealthCheckinService.java
  42. 7 2
      cfc-backend/src/main/java/com/etotem/cfc/service/ProductService.java
  43. 39 8
      cfc-backend/src/main/java/com/etotem/cfc/service/TaskService.java
  44. 23 0
      cfc-backend/src/main/java/com/etotem/cfc/service/TaskStatsService.java
  45. 4 0
      cfc-backend/src/main/resources/application.yml
  46. 23 0
      cfc-backend/src/main/resources/schema.sql
  47. 153 0
      cfc-frontend/components/DimensionActivities.vue
  48. 113 0
      cfc-frontend/components/DimensionProducts.vue
  49. 147 0
      cfc-frontend/components/DimensionTasks.vue
  50. 152 0
      cfc-frontend/components/FamilyEnergyBar.vue
  51. 98 0
      cfc-frontend/components/HealthTips.vue
  52. 74 0
      cfc-frontend/components/LoginGuideCard.vue
  53. 92 0
      cfc-frontend/components/UserQuickEntry.vue
  54. 88 1
      cfc-frontend/pages.json
  55. 188 233
      cfc-frontend/pages/action/index.vue
  56. 267 0
      cfc-frontend/pages/action/member-action-detail.vue
  57. 551 0
      cfc-frontend/pages/ai/chat.vue
  58. 517 0
      cfc-frontend/pages/body/checkin.vue
  59. 439 0
      cfc-frontend/pages/body/health-report.vue
  60. 410 164
      cfc-frontend/pages/body/index.vue
  61. 261 0
      cfc-frontend/pages/body/member-body-detail.vue
  62. 74 2
      cfc-frontend/pages/discover/product-detail/product-detail.vue
  63. 162 78
      cfc-frontend/pages/index/parent-index.vue
  64. 63 73
      cfc-frontend/pages/login/login.vue
  65. 422 0
      cfc-frontend/pages/mind/emotion-report.vue
  66. 709 244
      cfc-frontend/pages/mind/index.vue
  67. 267 0
      cfc-frontend/pages/mind/member-mind-detail.vue
  68. 336 111
      cfc-frontend/pages/mind/training.vue
  69. 153 0
      cfc-frontend/pages/policy/agreement.vue
  70. 140 0
      cfc-frontend/pages/policy/privacy.vue
  71. 417 0
      cfc-frontend/pages/shop/address-edit/address-edit.vue
  72. 302 0
      cfc-frontend/pages/shop/address/address.vue
  73. 433 0
      cfc-frontend/pages/shop/cart/cart.vue
  74. 431 0
      cfc-frontend/pages/shop/checkout/checkout.vue
  75. 300 0
      cfc-frontend/pages/shop/detail/detail.vue
  76. 1 6
      cfc-frontend/pages/shop/index.vue
  77. 322 0
      cfc-frontend/pages/shop/logistics/logistics.vue
  78. 90 6
      cfc-frontend/pages/shop/order-detail/order-detail.vue
  79. 14 9
      cfc-frontend/pages/shop/order-list/order-list.vue
  80. 325 0
      cfc-frontend/pages/shop/payment/payment.vue
  81. 344 65
      cfc-frontend/pages/wisdom/cognitive-report.vue
  82. 107 3
      cfc-frontend/utils/api.js
  83. 46 0
      cfc-web/src/api/danshop.js
  84. 34 1
      cfc-web/src/router/index.js
  85. 12 0
      cfc-web/src/views/Layout.vue
  86. 251 0
      cfc-web/src/views/admin/DanShopCategoryManage.vue
  87. 301 0
      cfc-web/src/views/admin/DanShopLogisticsManage.vue
  88. 359 0
      cfc-web/src/views/admin/DanShopProfitRuleConfig.vue
  89. 160 32
      cfc-web/src/views/admin/OrderManage.vue
  90. 83 29
      cfc-web/src/views/admin/ProductManage.vue
  91. 34 34
      dan/danshop/.project
  92. 4 4
      dan/danshop/.settings/org.eclipse.core.resources.prefs
  93. 4 4
      dan/danshop/.settings/org.eclipse.jdt.apt.core.prefs
  94. 10 10
      dan/danshop/.settings/org.eclipse.jdt.core.prefs
  95. 4 4
      dan/danshop/.settings/org.eclipse.m2e.core.prefs
  96. 41 0
      dan/danshop/src/main/java/com/etotem/danshop/controller/seller/SellerProfitController.java
  97. 15 0
      dan/danshop/src/main/java/com/etotem/danshop/dto/ProductQueryDTO.java
  98. 9 71
      dan/danshop/src/main/java/com/etotem/danshop/service/PaymentService.java
  99. 67 0
      dan/danshop/src/main/java/com/etotem/danshop/service/ProfitSettlementService.java
  100. 93 0
      dan/danshop/src/main/java/com/etotem/danshop/service/WechatPayService.java

+ 57 - 57
cfc-backend/.classpath

@@ -1,57 +1,57 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" output="target/classes" path="src/main/java">
-		<attributes>
-			<attribute name="optional" value="true"/>
-			<attribute name="maven.pomderived" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
-		<attributes>
-			<attribute name="maven.pomderived" value="true"/>
-			<attribute name="optional" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
-		<attributes>
-			<attribute name="optional" value="true"/>
-			<attribute name="maven.pomderived" value="true"/>
-			<attribute name="test" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
-		<attributes>
-			<attribute name="maven.pomderived" value="true"/>
-			<attribute name="test" value="true"/>
-			<attribute name="optional" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
-		<attributes>
-			<attribute name="maven.pomderived" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
-		<attributes>
-			<attribute name="maven.pomderived" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="src" path="target/generated-sources/annotations">
-		<attributes>
-			<attribute name="optional" value="true"/>
-			<attribute name="maven.pomderived" value="true"/>
-			<attribute name="ignore_optional_problems" value="true"/>
-			<attribute name="m2e-apt" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
-		<attributes>
-			<attribute name="optional" value="true"/>
-			<attribute name="maven.pomderived" value="true"/>
-			<attribute name="ignore_optional_problems" value="true"/>
-			<attribute name="m2e-apt" value="true"/>
-			<attribute name="test" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="optional" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="test" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="test" value="true"/>
+			<attribute name="optional" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" path="target/generated-sources/annotations">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="ignore_optional_problems" value="true"/>
+			<attribute name="m2e-apt" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="ignore_optional_problems" value="true"/>
+			<attribute name="m2e-apt" value="true"/>
+			<attribute name="test" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

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

@@ -278,6 +278,20 @@ public class DatabaseInitializer implements CommandLineRunner {
             // 索引已存在,忽略错误
         }
 
+        // 迁移7b: families表添加teacher_id和creator_id字段
+        try {
+            jdbcTemplate.execute("ALTER TABLE families ADD COLUMN teacher_id BIGINT COMMENT '绑定的成长规划师ID'");
+            log.info("已添加teacher_id列到families表");
+        } catch (Exception e) {
+            // 列已存在,忽略错误
+        }
+        try {
+            jdbcTemplate.execute("ALTER TABLE families ADD COLUMN creator_id BIGINT COMMENT '家庭创建者ID'");
+            log.info("已添加creator_id列到families表");
+        } catch (Exception e) {
+            // 列已存在,忽略错误
+        }
+
         // 迁移8: teachers表添加地址字段
         try {
             jdbcTemplate.execute("ALTER TABLE teachers ADD COLUMN street_id BIGINT COMMENT '街道ID'");
@@ -1542,6 +1556,249 @@ log.info("已添加template_id列到tasks表");
             log.warn("重建 family_member_attributes 表失败: {}", e.getMessage());
         }
 
+        // ==================== DanShop 电商模块建表 ====================
+        // 1. danshop_categories (商品分类表)
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS danshop_categories (" +
+                "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
+                "parent_id BIGINT DEFAULT NULL COMMENT '父分类ID(null=一级)', " +
+                "name VARCHAR(64) NOT NULL COMMENT '分类名称', " +
+                "image VARCHAR(512) DEFAULT NULL COMMENT '分类图标URL', " +
+                "sort_order INT DEFAULT 0 COMMENT '排序(越小越靠前)', " +
+                "energy_dimension_id BIGINT DEFAULT NULL COMMENT '关联五维维度ID', " +
+                "status INT DEFAULT 1 COMMENT '1启用/0禁用', " +
+                "created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
+                "updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " +
+                "INDEX idx_parent (parent_id), " +
+                "INDEX idx_status (status)" +
+                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品分类表'");
+            log.info("已创建 danshop_categories 表");
+        } catch (Exception e) {
+            log.warn("创建 danshop_categories 表失败: {}", e.getMessage());
+        }
+
+        // 2. danshop_products (商品表)
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS danshop_products (" +
+                "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
+                "category_id BIGINT NOT NULL COMMENT '所属分类ID', " +
+                "name VARCHAR(128) NOT NULL COMMENT '商品名称', " +
+                "description TEXT COMMENT '商品详细描述', " +
+                "cover_image VARCHAR(512) COMMENT '封面图URL', " +
+                "images TEXT COMMENT '多图(JSON数组)', " +
+                "price DECIMAL(10,2) NOT NULL COMMENT '售价(元)', " +
+                "member_price DECIMAL(10,2) DEFAULT NULL COMMENT '会员价', " +
+                "cost_price DECIMAL(10,2) DEFAULT NULL COMMENT '成本价', " +
+                "stock INT DEFAULT 0 COMMENT '库存数量', " +
+                "sales_count INT DEFAULT 0 COMMENT '销量', " +
+                "product_type VARCHAR(32) NOT NULL COMMENT '类型: physical/virtual/coupon/course', " +
+                "vendor_id BIGINT DEFAULT NULL COMMENT '供应商ID', " +
+                "vendor_name VARCHAR(64) COMMENT '供应商名称', " +
+                "status VARCHAR(16) NOT NULL DEFAULT 'pending' COMMENT 'pending/approved/rejected/on_shelf/off_shelf', " +
+                "reject_reason VARCHAR(255) DEFAULT NULL COMMENT '审核拒绝原因', " +
+                "profit_rate DECIMAL(5,2) DEFAULT 0.00 COMMENT '平台利润率(%)', " +
+                "external_source VARCHAR(32) COMMENT '外部商品来源', " +
+                "external_id VARCHAR(64) COMMENT '外部商品ID', " +
+                "external_data TEXT COMMENT '外部商品完整数据(JSON)', " +
+                "created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
+                "updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " +
+                "INDEX idx_category (category_id), " +
+                "INDEX idx_vendor (vendor_id), " +
+                "INDEX idx_status (status)" +
+                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品表'");
+            log.info("已创建 danshop_products 表");
+        } catch (Exception e) {
+            log.warn("创建 danshop_products 表失败: {}", e.getMessage());
+        }
+
+        // 3. danshop_orders (主订单表)
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS danshop_orders (" +
+                "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
+                "order_no VARCHAR(32) NOT NULL UNIQUE COMMENT '订单号(DS+时间戳+6位随机)', " +
+                "buyer_id BIGINT NOT NULL COMMENT '买家ID', " +
+                "family_id BIGINT DEFAULT NULL COMMENT '家庭ID', " +
+                "total_amount DECIMAL(10,2) NOT NULL COMMENT '订单总金额(标价)', " +
+                "discount_amount DECIMAL(10,2) DEFAULT 0.00 COMMENT '优惠金额', " +
+                "actual_amount DECIMAL(10,2) NOT NULL COMMENT '实付金额', " +
+                "status VARCHAR(20) NOT NULL DEFAULT 'pending' COMMENT 'pending/paid/shipped/completed/refunding/refunded/cancelled', " +
+                "payment_method VARCHAR(16) DEFAULT 'wechat' COMMENT 'wechat/alipay', " +
+                "transaction_id VARCHAR(64) DEFAULT NULL COMMENT '微信/支付宝交易号', " +
+                "paid_at DATETIME DEFAULT NULL COMMENT '支付时间', " +
+                "shipped_at DATETIME DEFAULT NULL COMMENT '发货时间', " +
+                "completed_at DATETIME DEFAULT NULL COMMENT '完成时间', " +
+                "remark VARCHAR(255) DEFAULT NULL COMMENT '买家备注', " +
+                "cancel_reason VARCHAR(255) DEFAULT NULL COMMENT '取消原因', " +
+                "receiver_name VARCHAR(32) DEFAULT NULL COMMENT '收件人姓名', " +
+                "receiver_phone VARCHAR(16) DEFAULT NULL COMMENT '收件人电话', " +
+                "receiver_address VARCHAR(256) DEFAULT NULL COMMENT '收件人地址', " +
+                "freight DECIMAL(10,2) DEFAULT 0.00 COMMENT '运费', " +
+                "profit_amount DECIMAL(10,2) DEFAULT 0.00 COMMENT '分润金额', " +
+                "created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
+                "updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " +
+                "INDEX idx_buyer (buyer_id), " +
+                "INDEX idx_family (family_id), " +
+                "INDEX idx_status (status), " +
+                "INDEX idx_order_no (order_no)" +
+                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='主订单表'");
+            log.info("已创建 danshop_orders 表");
+        } catch (Exception e) {
+            log.warn("创建 danshop_orders 表失败: {}", e.getMessage());
+        }
+
+        // 4. danshop_order_items (订单明细表)
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS danshop_order_items (" +
+                "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
+                "order_id BIGINT NOT NULL COMMENT '所属订单ID', " +
+                "product_id BIGINT NOT NULL COMMENT '商品ID', " +
+                "product_name VARCHAR(128) NOT NULL COMMENT '商品名称(快照)', " +
+                "cover_image VARCHAR(512) COMMENT '封面图(快照)', " +
+                "unit_price DECIMAL(10,2) NOT NULL COMMENT '单价(快照)', " +
+                "price DECIMAL(10,2) NOT NULL COMMENT '单价(别名,兼容)', " +
+                "quantity INT NOT NULL DEFAULT 1 COMMENT '购买数量', " +
+                "subtotal DECIMAL(10,2) NOT NULL COMMENT '小计', " +
+                "product_type VARCHAR(32) COMMENT '商品类型(快照)', " +
+                "vendor_id BIGINT COMMENT '供应商ID(快照)', " +
+                "vendor_name VARCHAR(64) COMMENT '供应商名称(快照)', " +
+                "created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
+                "INDEX idx_order (order_id), " +
+                "INDEX idx_product (product_id)" +
+                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单明细表'");
+            log.info("已创建 danshop_order_items 表");
+        } catch (Exception e) {
+            log.warn("创建 danshop_order_items 表失败: {}", e.getMessage());
+        }
+
+        // 5. danshop_order_logs (订单操作日志表)
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS danshop_order_logs (" +
+                "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
+                "order_id BIGINT NOT NULL COMMENT '订单ID', " +
+                "action VARCHAR(32) NOT NULL COMMENT '操作: create/pay/ship/confirm/refund/cancel', " +
+                "operator_id BIGINT DEFAULT NULL COMMENT '操作人ID', " +
+                "operator_type VARCHAR(16) DEFAULT NULL COMMENT 'buyer/vendor/admin/system', " +
+                "detail TEXT DEFAULT NULL COMMENT '操作详情(JSON)', " +
+                "created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
+                "INDEX idx_order (order_id)" +
+                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单操作日志表'");
+            log.info("已创建 danshop_order_logs 表");
+        } catch (Exception e) {
+            log.warn("创建 danshop_order_logs 表失败: {}", e.getMessage());
+        }
+
+        // 6. danshop_logistics (物流信息表)
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS danshop_logistics (" +
+                "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
+                "order_id BIGINT NOT NULL COMMENT '订单ID', " +
+                "order_item_id BIGINT DEFAULT NULL COMMENT '订单明细ID', " +
+                "logistics_no VARCHAR(64) NOT NULL COMMENT '物流单号', " +
+                "logistics_company VARCHAR(32) NOT NULL COMMENT '物流公司编码: sf/yto/zt/sto/yd/ttkd', " +
+                "logistics_name VARCHAR(32) DEFAULT NULL COMMENT '物流公司名称', " +
+                "sender_name VARCHAR(32) DEFAULT NULL COMMENT '发货人姓名', " +
+                "sender_phone VARCHAR(16) DEFAULT NULL COMMENT '发货人电话', " +
+                "sender_address VARCHAR(256) DEFAULT NULL COMMENT '发货人地址', " +
+                "receiver_name VARCHAR(32) NOT NULL COMMENT '收件人姓名', " +
+                "receiver_phone VARCHAR(16) NOT NULL COMMENT '收件人电话', " +
+                "receiver_address VARCHAR(256) NOT NULL COMMENT '收件人地址', " +
+                "status VARCHAR(16) NOT NULL DEFAULT 'pending' COMMENT 'pending/shipped/signing/completed', " +
+                "tracking_data TEXT DEFAULT NULL COMMENT '物流轨迹(JSON数组)', " +
+                "shipped_at DATETIME DEFAULT NULL COMMENT '发货时间', " +
+                "signed_at DATETIME DEFAULT NULL COMMENT '签收时间', " +
+                "created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
+                "updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " +
+                "INDEX idx_order (order_id), " +
+                "INDEX idx_logistics_no (logistics_no), " +
+                "INDEX idx_status (status)" +
+                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='物流信息表'");
+            log.info("已创建 danshop_logistics 表");
+        } catch (Exception e) {
+            log.warn("创建 danshop_logistics 表失败: {}", e.getMessage());
+        }
+
+        // 7. danshop_profit_rules (分润规则配置表)
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS danshop_profit_rules (" +
+                "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
+                "rule_name VARCHAR(64) NOT NULL COMMENT '规则名称', " +
+                "rule_type VARCHAR(32) NOT NULL COMMENT '规则类型: product_category/vendor_level/global', " +
+                "target_id BIGINT DEFAULT NULL COMMENT '关联目标ID', " +
+                "platform_profit_rate DECIMAL(5,2) NOT NULL COMMENT '平台利润率(%)', " +
+                "referrer_l1_rate DECIMAL(5,2) DEFAULT 0.00 COMMENT '直接推荐人分润比例(占利润%)', " +
+                "referrer_l2_rate DECIMAL(5,2) DEFAULT 0.00 COMMENT '间接推荐人分润比例(占利润%)', " +
+                "platform_service_rate DECIMAL(5,2) DEFAULT 0.00 COMMENT '平台服务费率(占订单金额%)', " +
+                "is_active INT DEFAULT 1 COMMENT '1启用/0禁用', " +
+                "created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
+                "updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " +
+                "INDEX idx_type (rule_type, target_id), " +
+                "INDEX idx_active (is_active)" +
+                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='分润规则配置表'");
+            log.info("已创建 danshop_profit_rules 表");
+        } catch (Exception e) {
+            log.warn("创建 danshop_profit_rules 表失败: {}", e.getMessage());
+        }
+
+        // 8. danshop_profit_logs (分润流水表)
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS danshop_profit_logs (" +
+                "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
+                "order_id BIGINT NOT NULL COMMENT '订单ID', " +
+                "order_no VARCHAR(32) NOT NULL COMMENT '订单号', " +
+                "order_amount DECIMAL(10,2) NOT NULL COMMENT '订单实付金额', " +
+                "cost_amount DECIMAL(10,2) DEFAULT 0.00 COMMENT '成本金额', " +
+                "profit_amount DECIMAL(10,2) NOT NULL COMMENT '利润金额', " +
+                "platform_retained DECIMAL(10,2) NOT NULL COMMENT '平台留存金额', " +
+                "vendor_income DECIMAL(10,2) NOT NULL COMMENT '供应商实收金额', " +
+                "commission_l1 DECIMAL(10,2) DEFAULT 0.00 COMMENT 'L1推荐人佣金', " +
+                "commission_l2 DECIMAL(10,2) DEFAULT 0.00 COMMENT 'L2推荐人佣金', " +
+                "rule_id BIGINT DEFAULT NULL COMMENT '使用的分润规则ID', " +
+                "created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
+                "INDEX idx_order (order_id), " +
+                "INDEX idx_order_no (order_no)" +
+                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='分润流水表'");
+            log.info("已创建 danshop_profit_logs 表");
+        } catch (Exception e) {
+            log.warn("创建 danshop_profit_logs 表失败: {}", e.getMessage());
+        }
+
+        // 9. danshop_favorites (商品收藏表)
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS danshop_favorites (" +
+                "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
+                "user_id BIGINT NOT NULL COMMENT '用户ID', " +
+                "product_id BIGINT NOT NULL COMMENT '商品ID', " +
+                "created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
+                "UNIQUE INDEX idx_user_product (user_id, product_id), " +
+                "INDEX idx_user (user_id)" +
+                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品收藏表'");
+            log.info("已创建 danshop_favorites 表");
+        } catch (Exception e) {
+            log.warn("创建 danshop_favorites 表失败: {}", e.getMessage());
+        }
+
+        // 10. danshop_addresses (收货地址表)
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS danshop_addresses (" +
+                "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
+                "user_id BIGINT NOT NULL COMMENT '用户ID', " +
+                "receiver_name VARCHAR(32) NOT NULL COMMENT '收货人姓名', " +
+                "phone VARCHAR(16) NOT NULL COMMENT '收货人电话', " +
+                "province VARCHAR(32) NOT NULL COMMENT '省份', " +
+                "city VARCHAR(32) NOT NULL COMMENT '城市', " +
+                "district VARCHAR(32) NOT NULL COMMENT '区县', " +
+                "street VARCHAR(256) NOT NULL COMMENT '详细地址', " +
+                "is_default INT DEFAULT 0 COMMENT '是否默认地址 1=是 0=否', " +
+                "created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
+                "updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " +
+                "INDEX idx_user (user_id), " +
+                "INDEX idx_user_default (user_id, is_default)" +
+                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='收货地址表'");
+            log.info("已创建 danshop_addresses 表");
+        } catch (Exception e) {
+            log.warn("创建 danshop_addresses 表失败: {}", e.getMessage());
+        }
+
         log.info("数据库迁移完成");
     }
 
@@ -2177,6 +2434,41 @@ try {
         }
 
         log.info("成长规划师模块、财富维度及健康检测报告数据库表初始化完成");
+
+        // 健康打卡表
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS health_checkins (" +
+                    "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
+                    "user_id BIGINT COMMENT '用户ID(家长)', " +
+                    "child_id BIGINT COMMENT '孩子ID', " +
+                    "checkin_date DATE COMMENT '打卡日期', " +
+                    "behaviors TEXT COMMENT '打卡行为JSON数组', " +
+                    "note VARCHAR(500) COMMENT '备注', " +
+                    "mood VARCHAR(20) COMMENT '心情: happy/normal/sad/angry/sick', " +
+                    "earned_energy INT DEFAULT 5 COMMENT '获得能量值', " +
+                    "created_at DATETIME DEFAULT CURRENT_TIMESTAMP, " +
+                    "INDEX idx_child_id (child_id), " +
+                    "INDEX idx_checkin_date (checkin_date)" +
+                    ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='健康打卡表'");
+            log.info("已创建health_checkins表");
+        } catch (Exception e) {
+            log.warn("创建health_checkins表可能已存在: {}", e.getMessage());
+        }
+
+        // 迁移30: activities表添加visibility和visible_to字段
+        try {
+            jdbcTemplate.execute("ALTER TABLE activities ADD COLUMN visibility VARCHAR(20) DEFAULT 'all' COMMENT '可见性: all/member'");
+            log.info("已添加visibility列到activities表");
+        } catch (Exception e) {
+            // 列已存在,忽略错误
+        }
+
+        try {
+            jdbcTemplate.execute("ALTER TABLE activities ADD COLUMN visible_to VARCHAR(255) COMMENT '可见角色列表(逗号分隔)'");
+            log.info("已添加visible_to列到activities表");
+        } catch (Exception e) {
+            // 列已存在,忽略错误
+        }
     }
 
     private void insertSysConfigSeed(String key, String value, String desc) {

+ 1 - 0
cfc-backend/src/main/java/com/etotem/cfc/config/JwtInterceptor.java

@@ -19,6 +19,7 @@ public class JwtInterceptor implements HandlerInterceptor {
 
     private static final String[] PUBLIC_PATHS = {
         "/api/auth/",
+        "/api/internal/",
         "/api/product/list",
         "/api/product/detail",
         "/api/product/type-list",

+ 72 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/ActivityController.java

@@ -0,0 +1,72 @@
+package com.etotem.cfc.controller;
+
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.ActivityDTO;
+import com.etotem.cfc.entity.Activity;
+import com.etotem.cfc.service.ActivityService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+@Tag(name = "活动管理", description = "五维活动列表和详情")
+@RestController
+@RequestMapping("/api/activity")
+public class ActivityController {
+
+    @Resource
+    private ActivityService activityService;
+
+    @Operation(summary = "获取活动列表")
+    @PostMapping("/list")
+    public Result<Map<String, Object>> list(@RequestBody Map<String, Object> params,
+                                            @RequestAttribute(value = "userId", required = false) Long userId) {
+        String dimensionCode = (String) params.get("dimensionCode");
+        String activityType = (String) params.get("activityType");
+        Integer page = params.get("page") != null ? Integer.valueOf(params.get("page").toString()) : 1;
+        Integer size = params.get("size") != null ? Integer.valueOf(params.get("size").toString()) : 10;
+        return activityService.list(dimensionCode, page, size, userId);
+    }
+
+    @Operation(summary = "获取活动详情")
+    @PostMapping("/detail")
+    public Result<ActivityDTO> detail(@RequestBody Map<String, Object> params) {
+        Long id = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
+        if (id == null) return Result.error("id不能为空");
+        return activityService.detail(id);
+    }
+
+    @Operation(summary = "创建活动")
+    @PostMapping("/create")
+    public Result<ActivityDTO> create(@RequestBody Activity activity,
+                                       @RequestAttribute(value = "userId", required = false) Long userId) {
+        if (userId != null) {
+            activity.setVendorId(userId);
+        }
+        return activityService.create(activity);
+    }
+
+    @Operation(summary = "更新活动")
+    @PostMapping("/update")
+    public Result<ActivityDTO> update(@RequestBody Activity activity) {
+        return activityService.update(activity);
+    }
+
+    @Operation(summary = "发布活动")
+    @PostMapping("/publish")
+    public Result<String> publish(@RequestBody Map<String, Object> params) {
+        Long id = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
+        if (id == null) return Result.error("id不能为空");
+        return activityService.publish(id);
+    }
+
+    @Operation(summary = "结束活动")
+    @PostMapping("/end")
+    public Result<String> end(@RequestBody Map<String, Object> params) {
+        Long id = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
+        if (id == null) return Result.error("id不能为空");
+        return activityService.end(id);
+    }
+}

+ 66 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/ContactController.java

@@ -0,0 +1,66 @@
+package com.etotem.cfc.controller;
+
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.ContactDTO;
+import com.etotem.cfc.entity.Contact;
+import com.etotem.cfc.service.ContactService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/api/contact")
+public class ContactController {
+
+    @Resource
+    private ContactService contactService;
+
+    @PostMapping("/list")
+    public Result<List<ContactDTO>> list(@RequestAttribute("userId") Long userId) {
+        return contactService.list(userId);
+    }
+
+    @PostMapping("/create")
+    public Result<ContactDTO> create(@RequestBody Contact contact,
+                                     @RequestAttribute("userId") Long userId) {
+        return contactService.create(contact, userId);
+    }
+
+    @PostMapping("/update")
+    public Result<ContactDTO> update(@RequestBody Contact contact,
+                                     @RequestAttribute("userId") Long userId) {
+        return contactService.update(contact, userId);
+    }
+
+    @PostMapping("/delete")
+    public Result<String> delete(@RequestBody Map<String, Object> params,
+                                 @RequestAttribute("userId") Long userId) {
+        Long id = Long.valueOf(params.get("id").toString());
+        return contactService.delete(id, userId);
+    }
+
+    @PostMapping("/detail")
+    public Result<ContactDTO> detail(@RequestBody Map<String, Object> params,
+                                     @RequestAttribute("userId") Long userId) {
+        Long id = Long.valueOf(params.get("id").toString());
+        return contactService.detail(id, userId);
+    }
+
+    @PostMapping("/import-phone")
+    public Result<ContactDTO> importPhone(@RequestBody Map<String, Object> params,
+                                          @RequestAttribute("userId") Long userId) {
+        String name = (String) params.get("name");
+        String phone = (String) params.get("phone");
+        Map<String, Object> extra = (Map<String, Object>) params.get("extra");
+        return contactService.importFromPhone(name, phone, extra, userId);
+    }
+
+    @PostMapping("/interaction")
+    public Result<ContactDTO> interaction(@RequestBody Map<String, Object> params,
+                                          @RequestAttribute("userId") Long userId) {
+        Long id = Long.valueOf(params.get("id").toString());
+        return contactService.recordInteraction(id, userId);
+    }
+}

+ 37 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/EmiReportController.java

@@ -0,0 +1,37 @@
+package com.etotem.cfc.controller;
+
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.EmiReportDTO;
+import com.etotem.cfc.service.EmiReportService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+@Tag(name = "EMI心理报告", description = "EMI心理四维评估(情绪/韧性/压力应对/自我认知)")
+@RestController
+@RequestMapping("/api/emireport")
+public class EmiReportController {
+
+    @Resource
+    private EmiReportService emiReportService;
+
+    @Operation(summary = "获取孩子最新EMI心理报告")
+    @PostMapping("/latest")
+    public Result<EmiReportDTO> getLatestReport(@RequestBody Map<String, Object> body) {
+        Long childId = body.get("childId") != null
+                ? Long.valueOf(body.get("childId").toString())
+                : null;
+        if (childId == null) {
+            return Result.error("childId不能为空");
+        }
+
+        EmiReportDTO dto = emiReportService.getChildLatestEmiReport(childId);
+        if (dto == null) {
+            return Result.error("未找到EMI测评结果");
+        }
+        return Result.success(dto);
+    }
+}

+ 105 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/HealthCheckinController.java

@@ -0,0 +1,105 @@
+package com.etotem.cfc.controller;
+
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.entity.HealthCheckin;
+import com.etotem.cfc.service.HealthCheckinService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 健康打卡接口 — 身体维度日常打卡记录
+ */
+@Tag(name = "健康打卡", description = "健康打卡记录与查询")
+@RestController
+@RequestMapping("/api/health/checkin")
+public class HealthCheckinController {
+
+    @Resource
+    private HealthCheckinService healthCheckinService;
+
+    @Operation(summary = "获取打卡列表")
+    @PostMapping("/list")
+    public Result<List<HealthCheckin>> list(
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute("userId") Long userId) {
+        Long childId = params.get("childId") != null
+                ? Long.valueOf(params.get("childId").toString()) : null;
+        String yearMonth = (String) params.get("yearMonth");
+        List<HealthCheckin> list = healthCheckinService.getCheckins(userId, childId, yearMonth);
+        return Result.success(list);
+    }
+
+    @Operation(summary = "创建打卡记录")
+    @PostMapping("/create")
+    public Result<HealthCheckin> create(
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute("userId") Long userId) {
+        HealthCheckin checkin = new HealthCheckin();
+        checkin.setUserId(userId);
+        Long childId = params.get("childId") != null
+                ? Long.valueOf(params.get("childId").toString()) : null;
+        checkin.setChildId(childId);
+        if (childId == null) {
+            return Result.error("childId不能为空");
+        }
+        // Parse checkinDate (default today)
+        Object dateObj = params.get("checkinDate");
+        if (dateObj != null) {
+            try {
+                java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd");
+                checkin.setCheckinDate(sdf.parse(dateObj.toString()));
+            } catch (Exception e) {
+                checkin.setCheckinDate(new Date());
+            }
+        } else {
+            checkin.setCheckinDate(new Date());
+        }
+        // Behaviors as JSON string
+        Object behaviorsObj = params.get("behaviors");
+        if (behaviorsObj instanceof List) {
+            com.fasterxml.jackson.databind.ObjectMapper om = new com.fasterxml.jackson.databind.ObjectMapper();
+            try {
+                checkin.setBehaviors(om.writeValueAsString(behaviorsObj));
+            } catch (Exception e) {
+                checkin.setBehaviors("[]");
+            }
+        }
+        checkin.setNote((String) params.get("note"));
+        checkin.setMood((String) params.get("mood"));
+        checkin.setEarnedEnergy(5);
+        HealthCheckin created = healthCheckinService.createCheckin(checkin);
+        return Result.success(created);
+    }
+
+    @Operation(summary = "删除打卡记录")
+    @PostMapping("/delete")
+    public Result<String> delete(@RequestBody Map<String, Object> params) {
+        Long id = params.get("id") != null
+                ? Long.valueOf(params.get("id").toString()) : null;
+        if (id == null) {
+            return Result.error("id不能为空");
+        }
+        healthCheckinService.deleteCheckin(id);
+        return Result.success("删除成功");
+    }
+
+    @Operation(summary = "打卡统计")
+    @PostMapping("/stats")
+    public Result<Map<String, Object>> stats(
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute("userId") Long userId) {
+        Long childId = params.get("childId") != null
+                ? Long.valueOf(params.get("childId").toString()) : null;
+        long total = healthCheckinService.countCheckins(childId);
+        java.util.Map<String, Object> stats = new java.util.HashMap<String, Object>();
+        stats.put("totalCheckins", total);
+        stats.put("totalEnergy", total * 5);
+        return Result.success(stats);
+    }
+}

+ 159 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/InternalApiController.java

@@ -0,0 +1,159 @@
+package com.etotem.cfc.controller;
+
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.entity.User;
+import com.etotem.cfc.mapper.UserMapper;
+import com.etotem.cfc.service.PointsService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * DanShop 内部调用接口
+ * 供 DanShop 独立模块 (port 9081) 调用
+ * 所有接口仅供内部服务间调用,请勿暴露到公网
+ */
+@Slf4j
+@RestController
+@RequestMapping("/api")
+public class InternalApiController {
+
+    @Resource
+    private UserMapper userMapper;
+
+    @Resource
+    private JdbcTemplate jdbcTemplate;
+
+    /**
+     * 验证 JWT Token,获取用户ID
+     * DanShop 内部调用: POST /api/auth/verify
+     * 返回格式: {"code":0,"data":{"userId":123}}
+     */
+    @PostMapping("/auth/verify")
+    public Result<Map<String, Long>> verifyToken(@RequestHeader(value = "Authorization", required = false) String authHeader) {
+        try {
+            if (authHeader == null || !authHeader.startsWith("Bearer ")) {
+                return Result.error(401, "Missing or invalid Authorization header");
+            }
+            String token = authHeader.substring(7);
+            // 简单token验证: token格式为 userId_timestamp_signature
+            // 这里直接解析token获取userId(实际项目中应使用JWT验证)
+            Long userId = parseUserIdFromToken(token);
+            if (userId == null) {
+                return Result.error(401, "Invalid token");
+            }
+            Map<String, Long> result = new HashMap<>();
+            result.put("userId", userId);
+            return Result.success(result);
+        } catch (Exception e) {
+            log.warn("Token验证失败: {}", e.getMessage());
+            return Result.error(401, "Token verification failed: " + e.getMessage());
+        }
+    }
+
+    /**
+     * 发放能量值给用户
+     * DanShop 内部调用: POST /api/energy/grant
+     */
+    @PostMapping("/energy/grant")
+    public Result<Void> grantEnergy(@RequestBody Map<String, Object> params) {
+        try {
+            Long userId = getLong(params, "userId");
+            Integer amount = getInt(params, "amount");
+            String reason = (String) params.getOrDefault("reason", "DanShop购物奖励");
+
+            if (userId == null || amount == null) {
+                return Result.error(400, "userId and amount are required");
+            }
+
+            // 记录能量发放(调用积分服务)
+            // 能量值存储在 children 表的 energy_points 或独立的 energy_balance 表
+            // 这里直接写入 energy_log 表
+            try {
+                jdbcTemplate.execute(
+                    "INSERT INTO energy_log (child_id, dimension_id, amount, balance_after, source_type, source_id, description) " +
+                    "SELECT c.id, 0, " + amount + ", 0, 'product', 0, '" + reason + "' " +
+                    "FROM children c WHERE c.user_id = " + userId + " LIMIT 1"
+                );
+            } catch (Exception e) {
+                log.warn("发放能量失败(可能用户没有关联孩子): {}", e.getMessage());
+            }
+
+            return Result.success("ok", null);
+        } catch (Exception e) {
+            log.error("发放能量异常: {}", e.getMessage(), e);
+            return Result.error(500, "Internal error: " + e.getMessage());
+        }
+    }
+
+    /**
+     * 查询用户层级关系
+     * DanShop 内部调用: GET /api/user/{userId}/relation
+     */
+    @GetMapping("/user/{userId}/relation")
+    public Result<Map<String, Object>> getUserRelation(@PathVariable Long userId) {
+        try {
+            if (userId == null) {
+                return Result.error(400, "userId is required");
+            }
+            User user = userMapper.selectById(userId);
+            if (user == null) {
+                return Result.error(404, "User not found");
+            }
+            Map<String, Object> relation = new HashMap<>();
+            relation.put("userId", user.getId());
+            relation.put("referrerId", user.getReferrerId());
+            relation.put("referralCode", user.getReferralCode());
+            relation.put("role", user.getRole());
+            relation.put("familyId", user.getFamilyId());
+            return Result.success(relation);
+        } catch (Exception e) {
+            log.error("查询用户关系异常: {}", e.getMessage(), e);
+            return Result.error(500, "Internal error: " + e.getMessage());
+        }
+    }
+
+    // ==================== 工具方法 ====================
+
+    private Long parseUserIdFromToken(String token) {
+        try {
+            // token格式: userId_timestamp_md5(userId+timestamp+secret)
+            // 这里简化处理,直接取第一段作为userId(演示用)
+            if (token.contains("_")) {
+                String[] parts = token.split("_");
+                return Long.parseLong(parts[0]);
+            }
+            // 尝试直接解析为long
+            return Long.parseLong(token);
+        } catch (NumberFormatException e) {
+            log.warn("无法解析token: {}", token);
+            return null;
+        }
+    }
+
+    private Long getLong(Map<String, Object> map, String key) {
+        Object value = map.get(key);
+        if (value == null) return null;
+        if (value instanceof Long) return (Long) value;
+        if (value instanceof Integer) return ((Integer) value).longValue();
+        if (value instanceof String) {
+            try { return Long.parseLong((String) value); } catch (Exception e) { return null; }
+        }
+        return null;
+    }
+
+    private Integer getInt(Map<String, Object> map, String key) {
+        Object value = map.get(key);
+        if (value == null) return null;
+        if (value instanceof Integer) return (Integer) value;
+        if (value instanceof Long) return ((Long) value).intValue();
+        if (value instanceof String) {
+            try { return Integer.parseInt((String) value); } catch (Exception e) { return null; }
+        }
+        return null;
+    }
+}

+ 44 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/InternalCommissionController.java

@@ -0,0 +1,44 @@
+package com.etotem.cfc.controller;
+
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.CommissionSettleRequest;
+import com.etotem.cfc.service.CommissionService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+/**
+ * DanShop 内部佣金结算接口
+ * 供 DanShop 独立模块 (port 9081) 回调
+ * 所有接口仅供内部服务间调用,请勿暴露到公网
+ */
+@Slf4j
+@RestController
+@RequestMapping("/api/internal/commission")
+public class InternalCommissionController {
+
+    @Resource
+    private CommissionService commissionService;
+
+    @PostMapping("/settle")
+    public Result<Void> settle(@RequestBody CommissionSettleRequest req) {
+        try {
+            if (req.getOrderId() == null || req.getBuyerId() == null || req.getOrderAmount() == null) {
+                return Result.error(400, "orderId, buyerId and orderAmount are required");
+            }
+            commissionService.settle(
+                    req.getOrderId(),
+                    req.getOrderType() != null ? req.getOrderType() : "danshop",
+                    req.getBuyerId(),
+                    req.getOrderAmount(),
+                    req.getProductId()
+            );
+            log.info("佣金结算完成: orderId={}, buyerId={}", req.getOrderId(), req.getBuyerId());
+            return Result.success("ok", null);
+        } catch (Exception e) {
+            log.error("佣金结算异常: orderId={}", req.getOrderId(), e);
+            return Result.error(500, "Commission settle failed: " + e.getMessage());
+        }
+    }
+}

+ 62 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/InternalEnergyController.java

@@ -0,0 +1,62 @@
+package com.etotem.cfc.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.EnergyAwardRequest;
+import com.etotem.cfc.entity.Child;
+import com.etotem.cfc.mapper.ChildMapper;
+import com.etotem.cfc.service.EnergyService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+/**
+ * DanShop 内部能量发放接口
+ * 供 DanShop 独立模块 (port 9081) 回调
+ * 安全边界: 所有接口仅供内部服务间调用,请勿暴露到公网
+ */
+@Slf4j
+@RestController
+@RequestMapping("/api/internal/energy")
+public class InternalEnergyController {
+
+    @Resource
+    private EnergyService energyService;
+
+    @Resource
+    private ChildMapper childMapper;
+
+    @PostMapping("/award")
+    public Result<Map<String, Integer>> award(@RequestBody EnergyAwardRequest req) {
+        try {
+            if (req.getUserId() == null || req.getAmount() == null) {
+                return Result.error(400, "userId and amount are required");
+            }
+
+            Child child = childMapper.selectOne(
+                    new LambdaQueryWrapper<Child>().eq(Child::getUserId, req.getUserId()).last("LIMIT 1")
+            );
+            if (child == null) {
+                log.warn("能量发放跳过: userId={} 无关联孩子记录", req.getUserId());
+                return Result.error(404, "No child found for userId: " + req.getUserId());
+            }
+
+            Map<String, Integer> result = energyService.awardEnergy(
+                    child.getId(),
+                    "product",
+                    0L,
+                    req.getAmount(),
+                    req.getReason() != null ? req.getReason() : "DanShop购物奖励",
+                    null
+            );
+
+            log.info("能量发放完成: userId={}, childId={}, amount={}", req.getUserId(), child.getId(), req.getAmount());
+            return Result.success(result);
+        } catch (Exception e) {
+            log.error("能量发放异常: userId={}", req.getUserId(), e);
+            return Result.error(500, "Energy award failed: " + e.getMessage());
+        }
+    }
+}

+ 65 - 7
cfc-backend/src/main/java/com/etotem/cfc/controller/UserController.java

@@ -3,11 +3,17 @@ package com.etotem.cfc.controller;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.etotem.cfc.common.Result;
 import com.etotem.cfc.dto.ChildInfoDTO;
+import com.etotem.cfc.entity.AssessmentOrder;
 import com.etotem.cfc.entity.Child;
 import com.etotem.cfc.entity.Family;
+import com.etotem.cfc.entity.PaymentOrder;
+import com.etotem.cfc.entity.Task;
 import com.etotem.cfc.entity.User;
+import com.etotem.cfc.mapper.AssessmentOrderMapper;
 import com.etotem.cfc.mapper.ChildMapper;
 import com.etotem.cfc.mapper.FamilyMapper;
+import com.etotem.cfc.mapper.PaymentOrderMapper;
+import com.etotem.cfc.mapper.TaskMapper;
 import com.etotem.cfc.mapper.UserMapper;
 import com.etotem.cfc.service.UserService;
 import io.swagger.v3.oas.annotations.Operation;
@@ -37,6 +43,15 @@ public class UserController {
     @Resource
     private ChildMapper childMapper;
 
+    @Resource
+    private PaymentOrderMapper paymentOrderMapper;
+
+    @Resource
+    private TaskMapper taskMapper;
+
+    @Resource
+    private AssessmentOrderMapper assessmentOrderMapper;
+
     @PostMapping("/children/list")
     @Operation(summary = "获取子女列表")
     public Result<List<ChildInfoDTO>> getChildren(HttpServletRequest request) {
@@ -119,13 +134,56 @@ public class UserController {
         return Result.success(result);
     }
 
-    @PutMapping("/children/{childId}")
-    @Operation(summary = "更新孩子信息")
-    public Result<Boolean> updateChild(HttpServletRequest request,
-                                       @PathVariable Long childId,
-                                       @RequestBody com.etotem.cfc.dto.UpdateChildDTO dto) {
+    @PostMapping("/action-stats")
+    @Operation(summary = "获取用户行动统计")
+    public Result<Map<String, Object>> getActionStats(HttpServletRequest request) {
         Long userId = (Long) request.getAttribute("userId");
-        boolean success = userService.updateChild(userId, childId, dto);
-        return Result.success(success);
+        if (userId == null) {
+            return Result.error("用户未登录");
+        }
+
+        User user = userMapper.selectById(userId);
+        if (user == null) {
+            return Result.error("用户不存在");
+        }
+
+        Long familyId = user.getFamilyId();
+
+        // 支付成功的订单数
+        long purchaseCount = 0;
+        if (familyId != null) {
+            purchaseCount = paymentOrderMapper.selectCount(
+                new LambdaQueryWrapper<PaymentOrder>()
+                    .eq(PaymentOrder::getFamilyId, familyId)
+                    .eq(PaymentOrder::getStatus, "paid")
+            );
+        }
+
+        // 已完成的任务数
+        long taskCount = 0;
+        if (familyId != null) {
+            taskCount = taskMapper.selectCount(
+                new LambdaQueryWrapper<Task>()
+                    .eq(Task::getFamilyId, familyId)
+                    .eq(Task::getStatus, "completed")
+            );
+        }
+
+        // 预约/购买的测评数
+        long courseCount = assessmentOrderMapper.selectCount(
+            new LambdaQueryWrapper<AssessmentOrder>()
+                .eq(AssessmentOrder::getUserId, userId)
+        );
+
+        // 参与的活动数(暂无registration表,暂返回0)
+        long activityCount = 0;
+
+        Map<String, Object> stats = new HashMap<>();
+        stats.put("purchaseCount", purchaseCount);
+        stats.put("activityCount", activityCount);
+        stats.put("taskCount", taskCount);
+        stats.put("courseCount", courseCount);
+
+        return Result.success(stats);
     }
 }

+ 83 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/ai/AIChatController.java

@@ -0,0 +1,83 @@
+package com.etotem.cfc.controller.ai;
+
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.service.AIService;
+import com.etotem.cfc.service.FamilyContextService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * AI 聊天接口
+ * 对接 Dify Chatbot API,自动注入家庭上下文
+ */
+@Tag(name = "AI聊天", description = "AI家庭助手聊天接口")
+@RestController
+@RequestMapping("/api/ai")
+public class AIChatController {
+
+    @Resource
+    private AIService aiService;
+
+    @Resource
+    private FamilyContextService familyContextService;
+
+    @Operation(summary = "发送聊天消息")
+    @PostMapping("/chat/send")
+    public Result<Map<String, Object>> sendMessage(
+            @RequestAttribute("userId") Long userId,
+            @RequestBody Map<String, String> params) {
+        String query = params.get("query");
+        String conversationId = params.get("conversationId");
+
+        if (query == null || query.trim().isEmpty()) {
+            return Result.error("消息不能为空");
+        }
+
+        // 组装家庭上下文
+        Map<String, Object> inputs = familyContextService.buildContext(userId);
+
+        // 调用 Dify
+        Map<String, Object> difyResp = aiService.sendMessage(
+                query, String.valueOf(userId),
+                conversationId, inputs);
+
+        Map<String, Object> result = new LinkedHashMap<>();
+        result.put("answer", difyResp.getOrDefault("answer", ""));
+        result.put("conversationId", difyResp.getOrDefault("conversationId", ""));
+        return Result.success(result);
+    }
+
+    @Operation(summary = "获取会话列表")
+    @PostMapping("/chat/conversations")
+    public Result<List<Map<String, Object>>> getConversations(
+            @RequestAttribute("userId") Long userId) {
+        List<Map<String, Object>> list = aiService.getConversations(String.valueOf(userId));
+        return Result.success(list);
+    }
+
+    @Operation(summary = "获取消息历史")
+    @PostMapping("/chat/messages")
+    public Result<List<Map<String, Object>>> getMessages(
+            @RequestAttribute("userId") Long userId,
+            @RequestBody Map<String, String> params) {
+        String conversationId = params.get("conversationId");
+        if (conversationId == null || conversationId.trim().isEmpty()) {
+            return Result.error("conversationId 不能为空");
+        }
+        List<Map<String, Object>> list = aiService.getMessages(conversationId, String.valueOf(userId));
+        return Result.success(list);
+    }
+
+    @Operation(summary = "删除会话")
+    @PostMapping("/chat/conversations/{id}/delete")
+    public Result<Void> deleteConversation(
+            @RequestAttribute("userId") Long userId,
+            @PathVariable("id") String conversationId) {
+        aiService.deleteConversation(conversationId, String.valueOf(userId));
+        return Result.success(null);
+    }
+}

+ 93 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentResultController.java

@@ -0,0 +1,93 @@
+package com.etotem.cfc.controller.assessment;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.AssessmentHistoryItemDTO;
+import com.etotem.cfc.dto.AssessmentResultDTO;
+import com.etotem.cfc.entity.DanAssessmentResult;
+import com.etotem.cfc.mapper.DanAssessmentResultMapper;
+import com.etotem.cfc.service.CognitiveService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Tag(name = "测评结果", description = "DAN认知测评结果查询")
+@RestController
+@RequestMapping("/api/assessment")
+public class AssessmentResultController {
+
+    @Resource
+    private CognitiveService cognitiveService;
+
+    @Resource
+    private DanAssessmentResultMapper danAssessmentResultMapper;
+
+    @Operation(summary = "获取孩子最新认知测评结果")
+    @PostMapping("/latest-result")
+    public Result<AssessmentResultDTO> getLatestResult(@RequestBody Map<String, Object> body) {
+        Long childId = body.get("childId") != null
+                ? Long.valueOf(body.get("childId").toString())
+                : null;
+        if (childId == null) {
+            return Result.error("childId不能为空");
+        }
+
+        DanAssessmentResult result = cognitiveService.getChildLatestResult(childId);
+        if (result == null) {
+            return Result.error("未找到测评结果");
+        }
+
+        AssessmentResultDTO dto = new AssessmentResultDTO();
+        dto.setChildId(result.getChildId());
+        dto.setChildName(result.getChildName());
+        dto.setDanLevel(result.getDanLevel());
+        dto.setOverallScore(result.getOverallScore());
+        dto.setAttentionScore(result.getAttentionScore());
+        dto.setFocusScore(result.getFocusScore());
+        dto.setMemoryScore(result.getMemoryScore());
+        dto.setLogicScore(result.getLogicScore());
+        dto.setPerceptionScore(result.getPerceptionScore());
+        dto.setSpatialScore(result.getSpatialScore());
+        dto.setProcessingSpeedScore(result.getProcessingSpeedScore());
+        dto.setAnalysisReport(result.getAnalysisReport());
+        dto.setGrowthSuggestions(result.getGrowthSuggestions());
+        dto.setAssessmentDate(result.getAssessmentDate());
+        return Result.success(dto);
+    }
+
+    @Operation(summary = "获取孩子测评历史记录")
+    @PostMapping("/history")
+    public Result<List<AssessmentHistoryItemDTO>> getHistory(@RequestBody Map<String, Object> body) {
+        Long childId = body.get("childId") != null
+                ? Long.valueOf(body.get("childId").toString())
+                : null;
+        int size = body.get("size") != null
+                ? Integer.parseInt(body.get("size").toString())
+                : 5;
+
+        if (childId == null) {
+            return Result.error("childId不能为空");
+        }
+
+        LambdaQueryWrapper<DanAssessmentResult> wrapper = new LambdaQueryWrapper<DanAssessmentResult>()
+                .eq(DanAssessmentResult::getChildId, childId)
+                .eq(DanAssessmentResult::getStatus, "completed")
+                .orderByDesc(DanAssessmentResult::getAssessmentDate)
+                .last("LIMIT " + size);
+        List<DanAssessmentResult> results = danAssessmentResultMapper.selectList(wrapper);
+
+        List<AssessmentHistoryItemDTO> list = new ArrayList<>();
+        for (DanAssessmentResult r : results) {
+            AssessmentHistoryItemDTO item = new AssessmentHistoryItemDTO();
+            item.setAssessmentDate(r.getAssessmentDate());
+            item.setOverallScore(r.getOverallScore());
+            list.add(item);
+        }
+        return Result.success(list);
+    }
+}

+ 26 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/content/ArticleController.java

@@ -1,18 +1,22 @@
 package com.etotem.cfc.controller.content;
 
 import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.ReadingStatsDTO;
 import com.etotem.cfc.entity.Article;
 import com.etotem.cfc.entity.ArticleCategory;
 import com.etotem.cfc.entity.User;
 import com.etotem.cfc.mapper.UserMapper;
 import com.etotem.cfc.service.ArticleCategoryService;
 import com.etotem.cfc.service.ArticleService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
 import java.util.List;
 import java.util.Map;
 
+@Tag(name = "文章内容", description = "文章列表/阅读统计/每日贴士")
 @RestController
 @RequestMapping("/api/articles")
 public class ArticleController {
@@ -31,6 +35,7 @@ public class ArticleController {
                                        @RequestAttribute(value = "userId", required = false) Long userId) {
         Long categoryId = body.get("categoryId") != null ? Long.valueOf(body.get("categoryId").toString()) : null;
         String keyword = (String) body.get("keyword");
+        String dimensionCode = body.get("dimensionCode") != null ? body.get("dimensionCode").toString() : null;
         int page = body.get("page") != null ? Integer.parseInt(body.get("page").toString()) : 1;
         int size = body.get("size") != null ? Integer.parseInt(body.get("size").toString()) : 10;
 
@@ -44,7 +49,7 @@ public class ArticleController {
             }
         }
 
-        Page<Article> result = articleService.getPublicList(categoryId, keyword, page, size,
+        Page<Article> result = articleService.getPublicList(categoryId, keyword, dimensionCode, page, size,
                 userId, familyId, vendorType);
         return Result.success(result);
     }
@@ -75,6 +80,7 @@ public class ArticleController {
     public Result<List<Article>> featured(@RequestBody Map<String, Object> body,
                                            @RequestAttribute(value = "userId", required = false) Long userId) {
         int size = body.get("size") != null ? Integer.parseInt(body.get("size").toString()) : 5;
+        String dimensionCode = body.get("dimensionCode") != null ? body.get("dimensionCode").toString() : null;
 
         Long familyId = null;
         String vendorType = null;
@@ -86,7 +92,7 @@ public class ArticleController {
             }
         }
 
-        List<Article> list = articleService.getFeatured(size, userId, familyId, vendorType);
+        List<Article> list = articleService.getFeatured(size, dimensionCode, userId, familyId, vendorType);
         return Result.success(list);
     }
 
@@ -102,4 +108,22 @@ public class ArticleController {
         articleService.recordRead(articleId, userId, childId, durationSeconds);
         return Result.success("ok");
     }
+
+    @PostMapping("/reading-stats")
+    public Result<ReadingStatsDTO> readingStats(@RequestBody Map<String, Object> body) {
+        Long childId = body.get("childId") != null
+                ? Long.valueOf(body.get("childId").toString())
+                : null;
+        if (childId == null) {
+            return Result.error("childId不能为空");
+        }
+        ReadingStatsDTO stats = articleService.getReadingStats(childId);
+        return Result.success(stats);
+    }
+
+    @PostMapping("/daily-tip")
+    public Result<Map<String, Object>> dailyTip() {
+        Map<String, Object> tip = articleService.getDailyTip();
+        return Result.success(tip);
+    }
 }

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/family/FamilyUserController.java

@@ -155,11 +155,11 @@ public class FamilyUserController {
     }
 
     @Operation(summary = "更新孩子信息")
-    @PutMapping("/children/{childId}")
+    @PostMapping("/children/update")
     public Result<Boolean> updateChild(javax.servlet.http.HttpServletRequest request,
-                                       @PathVariable Long childId,
                                        @RequestBody UpdateChildDTO dto) {
         Long userId = getUserId(request);
+        Long childId = dto.getChildId();
         boolean success = userService.updateChild(userId, childId, dto);
         return Result.success(success);
     }

+ 18 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/parent/ParentDashboardController.java

@@ -2,8 +2,11 @@ package com.etotem.cfc.controller.parent;
 
 import com.etotem.cfc.common.Result;
 import com.etotem.cfc.dto.ChildInfoDTO;
+import com.etotem.cfc.entity.User;
+import com.etotem.cfc.mapper.UserMapper;
 import com.etotem.cfc.service.PointsService;
 import com.etotem.cfc.service.TaskService;
+import com.etotem.cfc.service.TaskStatsService;
 import com.etotem.cfc.service.UserService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -32,6 +35,12 @@ public class ParentDashboardController {
     @Resource
     private PointsService pointsService;
 
+    @Resource
+    private TaskStatsService taskStatsService;
+
+    @Resource
+    private UserMapper userMapper;
+
     @Operation(summary = "获取家长首页仪表盘数据")
     @PostMapping("/dashboard")
     public Result<Map<String, Object>> getDashboard(@RequestAttribute("userId") Long userId) {
@@ -65,10 +74,19 @@ public class ParentDashboardController {
             }
         }
 
+        // 获取家长自身数据(积分 + 任务完成率)
+        User currentUser = userMapper.selectById(userId);
+        int parentPoints = currentUser != null && currentUser.getTotalPoints() != null
+            ? currentUser.getTotalPoints() : 0;
+        Map<String, Object> parentStats = taskStatsService.getUserStats(userId, null, null);
+        int parentCompletionRate = (Integer) parentStats.getOrDefault("completionRate", 0);
+
         Map<String, Object> result = new HashMap<>();
         result.put("children", childStatsList);
         result.put("avgCompletionRate", childCount > 0 ? totalCompletionRate / childCount : 0);
         result.put("totalHabitCount", totalHabitCount);
+        result.put("parentPoints", parentPoints);
+        result.put("parentCompletionRate", parentCompletionRate);
 
         return Result.success(result);
     }

+ 4 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/product/ProductController.java

@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestAttribute;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
@@ -23,8 +24,9 @@ public class ProductController {
     private ProductService productService;
 
     @PostMapping("/list")
-    public Result<Map<String, Object>> list(@RequestBody ProductListQueryDTO query) {
-        return productService.list(query);
+    public Result<Map<String, Object>> list(@RequestBody ProductListQueryDTO query,
+                                             @RequestAttribute(value = "userId", required = false) Long userId) {
+        return productService.list(query, userId);
     }
 
     @PostMapping("/detail")

+ 26 - 14
cfc-backend/src/main/java/com/etotem/cfc/controller/task/TaskController.java

@@ -43,12 +43,18 @@ public class TaskController {
         return Result.success(taskId);
     }
 
-    @Operation(summary = "获取今日任务")
-    @PostMapping("/today")
-    public Result<List<Task>> getTodayTasks(@RequestBody Map<String, Object> params) {
-        Long childId = Long.valueOf(params.get("childId").toString());
-        List<Task> tasks = taskService.getTodayTasks(childId);
-        return Result.success(tasks);
+    @Operation(summary = "获取今日任务")
+    @PostMapping("/today")
+    public Result<List<Task>> getTodayTasks(@RequestBody Map<String, Object> params) {
+        Long childId = Long.valueOf(params.get("childId").toString());
+        String category = params.get("category") != null ? params.get("category").toString() : null;
+        List<Task> tasks;
+        if (category != null && !category.isEmpty()) {
+            tasks = taskService.getTodayTasksByCategory(childId, category);
+        } else {
+            tasks = taskService.getTodayTasks(childId);
+        }
+        return Result.success(tasks);
     }
 
     @Operation(summary = "完成任务")
@@ -68,14 +74,20 @@ public class TaskController {
         return Result.success(success);
     }
 
-  @Operation(summary = "获取任务历史")
-  @PostMapping("/history")
-  public Result<Page<Task>> getTaskHistory(@RequestBody Map<String, Object> params) {
-    Long childId = Long.valueOf(params.get("childId").toString());
-    Integer page = params.get("page") != null ? Integer.valueOf(params.get("page").toString()) : 1;
-    Integer size = params.get("size") != null ? Integer.valueOf(params.get("size").toString()) : 10;
-    Page<Task> history = taskService.getTaskHistory(childId, page, size);
-    return Result.success(history);
+  @Operation(summary = "获取任务历史")
+  @PostMapping("/history")
+  public Result<Page<Task>> getTaskHistory(@RequestBody Map<String, Object> params) {
+    Long childId = Long.valueOf(params.get("childId").toString());
+    Integer page = params.get("page") != null ? Integer.valueOf(params.get("page").toString()) : 1;
+    Integer size = params.get("size") != null ? Integer.valueOf(params.get("size").toString()) : 10;
+    String category = params.get("category") != null ? params.get("category").toString() : null;
+    Page<Task> history;
+    if (category != null && !category.isEmpty()) {
+        history = taskService.getTaskHistoryByCategory(childId, page, size, category);
+    } else {
+        history = taskService.getTaskHistory(childId, page, size);
+    }
+    return Result.success(history);
   }
 
     @Operation(summary = "获取待审核任务")

+ 59 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/ActivityDTO.java

@@ -0,0 +1,59 @@
+package com.etotem.cfc.dto;
+
+import com.etotem.cfc.entity.Activity;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ActivityDTO {
+    private Long id;
+    private String title;
+    private String description;
+    private String coverImage;
+    private String dimensionCode;
+    private String activityType;
+    private String status;
+    private String startTime;
+    private String endTime;
+    private String location;
+    private Integer maxParticipants;
+    private Integer currentParticipants;
+    private BigDecimal price;
+    private String vendorName;
+    private String priceLabel;
+
+    public static ActivityDTO from(Activity activity) {
+        return from(activity, false);
+    }
+
+    public static ActivityDTO from(Activity activity, boolean isGuest) {
+        ActivityDTO dto = new ActivityDTO();
+        dto.setId(activity.getId());
+        dto.setTitle(activity.getTitle());
+        dto.setDescription(activity.getDescription());
+        dto.setCoverImage(activity.getCoverImage());
+        dto.setDimensionCode(activity.getDimensionCode());
+        dto.setActivityType(activity.getActivityType());
+        dto.setStatus(activity.getStatus());
+        dto.setStartTime(activity.getStartTime() != null ? activity.getStartTime().toString() : null);
+        dto.setEndTime(activity.getEndTime() != null ? activity.getEndTime().toString() : null);
+        dto.setLocation(activity.getLocation());
+        dto.setMaxParticipants(activity.getMaxParticipants());
+        dto.setCurrentParticipants(activity.getCurrentParticipants());
+        dto.setVendorName(activity.getVendorName());
+        // Guest-aware price
+        if (isGuest) {
+            dto.setPrice(null);
+            dto.setPriceLabel("登录查看价格");
+        } else {
+            dto.setPrice(activity.getPrice());
+            if (activity.getPrice() != null && activity.getPrice().compareTo(BigDecimal.ZERO) == 0) {
+                dto.setPriceLabel("免费");
+            } else {
+                dto.setPriceLabel(null);
+            }
+        }
+        return dto;
+    }
+}

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

@@ -0,0 +1,14 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class AssessmentHistoryItemDTO implements Serializable {
+
+    private Date assessmentDate;
+
+    private Integer overallScore;
+}

+ 38 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentResultDTO.java

@@ -0,0 +1,38 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class AssessmentResultDTO implements Serializable {
+
+    private Long childId;
+
+    private String childName;
+
+    private String danLevel;
+
+    private Integer overallScore;
+
+    private Integer attentionScore;
+
+    private Integer focusScore;
+
+    private Integer memoryScore;
+
+    private Integer logicScore;
+
+    private Integer perceptionScore;
+
+    private Integer spatialScore;
+
+    private Integer processingSpeedScore;
+
+    private String analysisReport;
+
+    private String growthSuggestions;
+
+    private Date assessmentDate;
+}

+ 12 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/CommissionSettleRequest.java

@@ -0,0 +1,12 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+@Data
+public class CommissionSettleRequest {
+    private Long orderId;
+    private String orderType;
+    private Long buyerId;
+    private java.math.BigDecimal orderAmount;
+    private Long productId;
+}

+ 29 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/ContactDTO.java

@@ -0,0 +1,29 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ContactDTO {
+    private Long id;
+    private Long userId;
+    private String name;
+    private String phone;
+    private String avatar;
+    private String relationshipType;
+    private Date knownSince;
+    private String knownSinceLabel;
+    private String bio;
+    private Date birthday;
+    private String birthdayLabel;
+    private String birthdayCountdown;
+    private Integer intimacyLevel;
+    private String contactSource;
+    private String tags;
+    private Date lastContactAt;
+    private Integer contactCount;
+    private String notes;
+    private Date createdAt;
+    private Date updatedAt;
+}

+ 30 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/EmiReportDTO.java

@@ -0,0 +1,30 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class EmiReportDTO implements Serializable {
+
+    private Long childId;
+
+    private String childName;
+
+    private Integer emotionScore;
+
+    private Integer resilienceScore;
+
+    private Integer stressCopingScore;
+
+    private Integer selfAwarenessScore;
+
+    private Integer overallScore;
+
+    private String analysisReport;
+
+    private String growthSuggestions;
+
+    private Date assessmentDate;
+}

+ 10 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/EnergyAwardRequest.java

@@ -0,0 +1,10 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+@Data
+public class EnergyAwardRequest {
+    private Long userId;
+    private Integer amount;
+    private String reason;
+}

+ 11 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/ProductDTO.java

@@ -24,10 +24,16 @@ public class ProductDTO {
     private String status;
     private String domain;
     private String memberEligible;
+    private Long energyDimensionId;
+    private String priceLabel;     // 游客 = "登录查看价格",登录后 = null
     private Date createdAt;
     private Date updatedAt;
 
     public static ProductDTO from(Product p) {
+        return from(p, false);
+    }
+
+    public static ProductDTO from(Product p, boolean isGuest) {
         if (p == null) return null;
         ProductDTO d = new ProductDTO();
         d.id = p.getId();
@@ -48,6 +54,11 @@ public class ProductDTO {
         d.memberEligible = p.getMemberEligible();
         d.createdAt = p.getCreatedAt();
         d.updatedAt = p.getUpdatedAt();
+        // 游客模式:价格置null,显示提示标签
+        if (isGuest) {
+            d.price = null;
+            d.priceLabel = "登录查看价格";
+        }
         return d;
     }
 }

+ 17 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/ReadingStatsDTO.java

@@ -0,0 +1,17 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class ReadingStatsDTO implements Serializable {
+
+    private Integer totalArticles;
+
+    private Integer totalDurationSeconds;
+
+    private Integer targetDurationSeconds;
+
+    private Double progress;
+}

+ 1 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/UpdateChildDTO.java

@@ -5,6 +5,7 @@ import java.util.Date;
 
 @Data
 public class UpdateChildDTO {
+    private Long childId;
     private String nickname;
     private Integer age;
     private Date birthday;

+ 59 - 0
cfc-backend/src/main/java/com/etotem/cfc/entity/Activity.java

@@ -0,0 +1,59 @@
+package com.etotem.cfc.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@TableName("activities")
+public class Activity implements Serializable {
+
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    private String title;
+
+    private String description;
+
+    private String coverImage;
+
+    /** body/mind/wisdom/action/wealth */
+    private String dimensionCode;
+
+    /** offline/online/campaign */
+    private String activityType;
+
+    /** draft/published/ended */
+    private String status;
+
+    private Date startTime;
+
+    private Date endTime;
+
+    private String location;
+
+    private Integer maxParticipants;
+
+    private Integer currentParticipants;
+
+    private BigDecimal price;
+
+    /** all(默认)/member */
+    private String visibility;
+
+    /** 可见角色列表(逗号分隔), null表示所有角色 */
+    private String visibleTo;
+
+    private Long vendorId;
+
+    private String vendorName;
+
+    private Date createdAt;
+
+    private Date updatedAt;
+}

+ 49 - 0
cfc-backend/src/main/java/com/etotem/cfc/entity/Contact.java

@@ -0,0 +1,49 @@
+package com.etotem.cfc.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@TableName("contacts")
+public class Contact implements Serializable {
+
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    private Long userId;
+
+    private String name;
+
+    private String phone;
+
+    private String avatar;
+
+    private String relationshipType; // family/friend/partner/colleague/other
+
+    private Date knownSince;
+
+    private String bio;
+
+    private Date birthday;
+
+    private Integer intimacyLevel;
+
+    private String contactSource; // phone/manual
+
+    private String tags;
+
+    private Date lastContactAt;
+
+    private Integer contactCount;
+
+    private String notes;
+
+    private Date createdAt;
+
+    private Date updatedAt;
+}

+ 38 - 0
cfc-backend/src/main/java/com/etotem/cfc/entity/HealthCheckin.java

@@ -0,0 +1,38 @@
+package com.etotem.cfc.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@TableName("health_checkins")
+public class HealthCheckin implements Serializable {
+
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    private Long userId;
+
+    private Long childId;
+
+    /** 打卡日期 */
+    private Date checkinDate;
+
+    /** 打卡行为(JSON数组格式) */
+    private String behaviors;
+
+    /** 备注 */
+    private String note;
+
+    /** 心情:happy/normal/sad/angry/sick */
+    private String mood;
+
+    /** 获得能量值(默认5) */
+    private Integer earnedEnergy;
+
+    private Date createdAt;
+}

+ 9 - 0
cfc-backend/src/main/java/com/etotem/cfc/mapper/ActivityMapper.java

@@ -0,0 +1,9 @@
+package com.etotem.cfc.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.etotem.cfc.entity.Activity;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface ActivityMapper extends BaseMapper<Activity> {
+}

+ 9 - 0
cfc-backend/src/main/java/com/etotem/cfc/mapper/ContactMapper.java

@@ -0,0 +1,9 @@
+package com.etotem.cfc.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.etotem.cfc.entity.Contact;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface ContactMapper extends BaseMapper<Contact> {
+}

+ 9 - 0
cfc-backend/src/main/java/com/etotem/cfc/mapper/HealthCheckinMapper.java

@@ -0,0 +1,9 @@
+package com.etotem.cfc.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.etotem.cfc.entity.HealthCheckin;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface HealthCheckinMapper extends BaseMapper<HealthCheckin> {
+}

+ 106 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/AIService.java

@@ -0,0 +1,106 @@
+package com.etotem.cfc.service;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.*;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * Dify AI API 封装
+ * 对接 http://dify.bianwoyou.cn/v1 的 Chatbot Conversation API
+ */
+@Service
+public class AIService {
+
+    @Resource
+    private RestTemplate restTemplate;
+
+    @Value("${dify.base-url}")
+    private String difyBaseUrl;
+
+    @Value("${dify.api-key}")
+    private String apiKey;
+
+    private HttpHeaders authHeaders() {
+        HttpHeaders headers = new HttpHeaders();
+        headers.setContentType(MediaType.APPLICATION_JSON);
+        headers.setBearerAuth(apiKey);
+        return headers;
+    }
+
+    /**
+     * 发送聊天消息(阻塞模式)
+     *
+     * @param query          用户消息
+     * @param userId         用户标识(本地userId转字符串)
+     * @param conversationId 会话ID(空字符串=新建会话)
+     * @param inputs         Dify 应用变量(家庭上下文)
+     * @return answer + conversation_id
+     */
+    public Map<String, Object> sendMessage(String query, String userId,
+                                           String conversationId,
+                                           Map<String, Object> inputs) {
+        String url = difyBaseUrl + "/chat-messages";
+
+        Map<String, Object> body = new LinkedHashMap<>();
+        body.put("query", query);
+        body.put("user", userId);
+        body.put("response_mode", "blocking");
+        body.put("conversation_id", conversationId != null ? conversationId : "");
+        body.put("inputs", inputs != null ? inputs : Collections.emptyMap());
+        body.put("auto_generate_name", true);
+
+        HttpEntity<Map<String, Object>> entity = new HttpEntity<>(body, authHeaders());
+        ResponseEntity<Map> resp = restTemplate.postForEntity(url, entity, Map.class);
+
+        Map<String, Object> result = new LinkedHashMap<>();
+        if (resp.getBody() != null) {
+            result.put("answer", resp.getBody().get("answer"));
+            result.put("conversationId", resp.getBody().get("conversation_id"));
+        }
+        return result;
+    }
+
+    /**
+     * 获取用户的所有会话列表
+     */
+    public List<Map<String, Object>> getConversations(String userId) {
+        String url = difyBaseUrl + "/conversations?user=" + userId + "&limit=50&sort_by=-updated_at";
+        HttpEntity<Void> entity = new HttpEntity<>(authHeaders());
+        ResponseEntity<Map> resp = restTemplate.exchange(url, HttpMethod.GET, entity, Map.class);
+        Map<String, Object> body = resp.getBody();
+        if (body != null && body.get("data") instanceof List) {
+            return (List<Map<String, Object>>) body.get("data");
+        }
+        return Collections.emptyList();
+    }
+
+    /**
+     * 获取某个会话的消息历史
+     */
+    public List<Map<String, Object>> getMessages(String conversationId, String userId) {
+        String url = difyBaseUrl + "/messages?conversation_id=" + conversationId
+                + "&user=" + userId + "&limit=50";
+        HttpEntity<Void> entity = new HttpEntity<>(authHeaders());
+        ResponseEntity<Map> resp = restTemplate.exchange(url, HttpMethod.GET, entity, Map.class);
+        Map<String, Object> body = resp.getBody();
+        if (body != null && body.get("data") instanceof List) {
+            return (List<Map<String, Object>>) body.get("data");
+        }
+        return Collections.emptyList();
+    }
+
+    /**
+     * 删除会话
+     */
+    public void deleteConversation(String conversationId, String userId) {
+        String url = difyBaseUrl + "/conversations/" + conversationId;
+        Map<String, Object> body = new HashMap<>();
+        body.put("user", userId);
+        HttpEntity<Map<String, Object>> entity = new HttpEntity<>(body, authHeaders());
+        restTemplate.exchange(url, HttpMethod.DELETE, entity, Void.class);
+    }
+}

+ 93 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/ActivityService.java

@@ -0,0 +1,93 @@
+package com.etotem.cfc.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.ActivityDTO;
+import com.etotem.cfc.entity.Activity;
+import com.etotem.cfc.mapper.ActivityMapper;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Service
+public class ActivityService extends ServiceImpl<ActivityMapper, Activity> {
+
+    public Result<Map<String, Object>> list(String dimensionCode, Integer page, Integer size, Long userId) {
+        LambdaQueryWrapper<Activity> query = new LambdaQueryWrapper<Activity>()
+                .eq(Activity::getStatus, "published")
+                .orderByAsc(Activity::getStartTime);
+        if (dimensionCode != null && !dimensionCode.isEmpty()) {
+            query.eq(Activity::getDimensionCode, dimensionCode);
+        }
+        // 游客过滤:排除会员专属活动
+        if (userId == null) {
+            query.and(w -> w.eq(Activity::getVisibility, "all")
+                    .or().isNull(Activity::getVisibility));
+        }
+        Page<Activity> pageResult = this.page(new Page<>(page, size), query);
+        boolean isGuest = (userId == null);
+        Map<String, Object> data = new HashMap<>();
+        data.put("records", pageResult.getRecords().stream().map(a -> ActivityDTO.from(a, isGuest)).collect(Collectors.toList()));
+        data.put("total", pageResult.getTotal());
+        data.put("page", pageResult.getCurrent());
+        data.put("size", pageResult.getSize());
+        return Result.success(data);
+    }
+
+    public Result<ActivityDTO> detail(Long id) {
+        Activity activity = this.getById(id);
+        if (activity == null) {
+            return Result.error("活动不存在");
+        }
+        return Result.success(ActivityDTO.from(activity));
+    }
+
+    public Result<ActivityDTO> create(Activity activity) {
+        activity.setStatus("draft");
+        activity.setCurrentParticipants(0);
+        activity.setCreatedAt(new Date());
+        activity.setUpdatedAt(new Date());
+        this.save(activity);
+        return Result.success(ActivityDTO.from(activity));
+    }
+
+    public Result<ActivityDTO> update(Activity activity) {
+        Activity existing = this.getById(activity.getId());
+        if (existing == null) {
+            return Result.error("活动不存在");
+        }
+        activity.setUpdatedAt(new Date());
+        this.updateById(activity);
+        return Result.success(ActivityDTO.from(this.getById(activity.getId())));
+    }
+
+    public Result<String> publish(Long id) {
+        Activity activity = this.getById(id);
+        if (activity == null) {
+            return Result.error("活动不存在");
+        }
+        if (!"draft".equals(activity.getStatus())) {
+            return Result.error("仅草稿状态可发布");
+        }
+        activity.setStatus("published");
+        activity.setUpdatedAt(new Date());
+        this.updateById(activity);
+        return Result.success("发布成功");
+    }
+
+    public Result<String> end(Long id) {
+        Activity activity = this.getById(id);
+        if (activity == null) {
+            return Result.error("活动不存在");
+        }
+        activity.setStatus("ended");
+        activity.setUpdatedAt(new Date());
+        this.updateById(activity);
+        return Result.success("活动已结束");
+    }
+}

+ 76 - 1
cfc-backend/src/main/java/com/etotem/cfc/service/ArticleService.java

@@ -2,9 +2,12 @@ package com.etotem.cfc.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.etotem.cfc.dto.ReadingStatsDTO;
 import com.etotem.cfc.entity.Article;
 import com.etotem.cfc.entity.ArticleCategory;
+import com.etotem.cfc.entity.ArticleReadingRecord;
 import com.etotem.cfc.mapper.ArticleMapper;
+import com.etotem.cfc.mapper.ArticleReadingRecordMapper;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.extern.slf4j.Slf4j;
@@ -28,9 +31,12 @@ public class ArticleService {
     @Resource
     private ArticleCategoryService articleCategoryService;
 
+    @Resource
+    private ArticleReadingRecordMapper articleReadingRecordMapper;
+
     private final ObjectMapper objectMapper = new ObjectMapper();
 
-    public Page<Article> getPublicList(Long categoryId, String keyword, int page, int size,
+    public Page<Article> getPublicList(Long categoryId, String keyword, String dimensionCode, int page, int size,
                                         Long userId, Long familyId, String vendorType) {
         LambdaQueryWrapper<Article> wrapper = new LambdaQueryWrapper<Article>()
                 .eq(Article::getStatus, "published")
@@ -43,6 +49,9 @@ public class ArticleService {
         if (keyword != null && !keyword.trim().isEmpty()) {
             wrapper.like(Article::getTitle, keyword.trim());
         }
+        if (dimensionCode != null && !dimensionCode.trim().isEmpty()) {
+            wrapper.like(Article::getRelatedDimensions, dimensionCode.trim());
+        }
 
         Page<Article> p = new Page<>(page, size);
         Page<Article> result = articleMapper.selectPage(p, wrapper);
@@ -57,12 +66,20 @@ public class ArticleService {
     }
 
     public List<Article> getFeatured(int size, Long userId, Long familyId, String vendorType) {
+        return getFeatured(size, null, userId, familyId, vendorType);
+    }
+
+    public List<Article> getFeatured(int size, String dimensionCode, Long userId, Long familyId, String vendorType) {
         LambdaQueryWrapper<Article> wrapper = new LambdaQueryWrapper<Article>()
                 .eq(Article::getStatus, "published")
                 .eq(Article::getIsFeatured, 1)
                 .orderByDesc(Article::getPublishedAt)
                 .last("LIMIT " + Math.max(size, 50));
 
+        if (dimensionCode != null && !dimensionCode.trim().isEmpty()) {
+            wrapper.like(Article::getRelatedDimensions, dimensionCode.trim());
+        }
+
         List<Article> all = articleMapper.selectList(wrapper);
         List<Article> visible = articlePermissionService.filterVisible(all, userId, familyId, vendorType);
 
@@ -149,4 +166,62 @@ public class ArticleService {
         article.setUpdatedAt(new Date());
         articleMapper.updateById(article);
     }
+
+    public ReadingStatsDTO getReadingStats(Long childId) {
+        ReadingStatsDTO dto = new ReadingStatsDTO();
+
+        Calendar cal = Calendar.getInstance();
+        cal.set(Calendar.DAY_OF_MONTH, 1);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+        Date since = cal.getTime();
+
+        Integer totalDuration = articleReadingRecordMapper.selectTotalDurationByChildSince(childId, since);
+        if (totalDuration == null) totalDuration = 0;
+
+        LambdaQueryWrapper<ArticleReadingRecord> countWrapper = new LambdaQueryWrapper<ArticleReadingRecord>()
+                .eq(ArticleReadingRecord::getChildId, childId)
+                .ge(ArticleReadingRecord::getReadAt, since);
+        Integer totalArticles = Math.toIntExact(articleReadingRecordMapper.selectCount(countWrapper));
+
+        int targetSeconds = 6000; // 100分钟/月目标
+        double progress = Math.min((double) totalDuration / targetSeconds, 1.0);
+
+        dto.setTotalArticles(totalArticles);
+        dto.setTotalDurationSeconds(totalDuration);
+        dto.setTargetDurationSeconds(targetSeconds);
+        dto.setProgress(progress);
+        return dto;
+    }
+
+    public Map<String, Object> getDailyTip() {
+        LambdaQueryWrapper<Article> wrapper = new LambdaQueryWrapper<Article>()
+                .eq(Article::getStatus, "published")
+                .and(w -> w.like(Article::getRelatedDimensions, "mind")
+                        .or().like(Article::getRelatedDimensions, "心理"))
+                .orderByDesc(Article::getPublishedAt)
+                .last("LIMIT 10");
+
+        List<Article> candidates = articleMapper.selectList(wrapper);
+        if (candidates != null && !candidates.isEmpty()) {
+            int dayOfYear = Calendar.getInstance().get(Calendar.DAY_OF_YEAR);
+            Article tip = candidates.get(dayOfYear % candidates.size());
+
+            Map<String, Object> result = new HashMap<>();
+            result.put("id", tip.getId());
+            result.put("title", tip.getTitle());
+            result.put("summary", tip.getSummary());
+            result.put("coverImage", tip.getCoverImage());
+            return result;
+        }
+
+        Map<String, Object> fallback = new HashMap<>();
+        fallback.put("id", null);
+        fallback.put("title", "每日心理小贴士");
+        fallback.put("summary", "每天花5分钟与孩子聊聊今天的心情,倾听比建议更重要。");
+        fallback.put("coverImage", null);
+        return fallback;
+    }
 }

+ 202 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/ContactService.java

@@ -0,0 +1,202 @@
+package com.etotem.cfc.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.ContactDTO;
+import com.etotem.cfc.entity.Contact;
+import com.etotem.cfc.mapper.ContactMapper;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class ContactService {
+
+    @Resource
+    private ContactMapper contactMapper;
+
+    public Result<List<ContactDTO>> list(Long userId) {
+        LambdaQueryWrapper<Contact> query = new LambdaQueryWrapper<Contact>()
+            .eq(Contact::getUserId, userId)
+            .orderByDesc(Contact::getIntimacyLevel);
+        List<Contact> list = contactMapper.selectList(query);
+        return Result.success(toDTOList(list));
+    }
+
+    public Result<ContactDTO> detail(Long id, Long userId) {
+        Contact contact = contactMapper.selectById(id);
+        if (contact == null || !contact.getUserId().equals(userId)) {
+            return Result.error("联系人不存在");
+        }
+        return Result.success(toDTO(contact));
+    }
+
+    public Result<ContactDTO> create(Contact contact, Long userId) {
+        contact.setUserId(userId);
+        contact.setContactSource("manual");
+        contact.setIntimacyLevel(30);
+        contact.setContactCount(0);
+        contact.setCreatedAt(new Date());
+        contact.setUpdatedAt(new Date());
+        contactMapper.insert(contact);
+        return Result.success(toDTO(contact));
+    }
+
+    public Result<ContactDTO> update(Contact contact, Long userId) {
+        Contact existing = contactMapper.selectById(contact.getId());
+        if (existing == null || !existing.getUserId().equals(userId)) {
+            return Result.error("联系人不存在");
+        }
+        if (contact.getName() != null) existing.setName(contact.getName());
+        if (contact.getPhone() != null) existing.setPhone(contact.getPhone());
+        if (contact.getAvatar() != null) existing.setAvatar(contact.getAvatar());
+        if (contact.getRelationshipType() != null) existing.setRelationshipType(contact.getRelationshipType());
+        if (contact.getKnownSince() != null) existing.setKnownSince(contact.getKnownSince());
+        if (contact.getBio() != null) existing.setBio(contact.getBio());
+        if (contact.getBirthday() != null) existing.setBirthday(contact.getBirthday());
+        if (contact.getTags() != null) existing.setTags(contact.getTags());
+        if (contact.getNotes() != null) existing.setNotes(contact.getNotes());
+        existing.setUpdatedAt(new Date());
+        contactMapper.updateById(existing);
+        return Result.success(toDTO(existing));
+    }
+
+    public Result<String> delete(Long id, Long userId) {
+        Contact contact = contactMapper.selectById(id);
+        if (contact == null || !contact.getUserId().equals(userId)) {
+            return Result.error("联系人不存在");
+        }
+        contactMapper.deleteById(id);
+        return Result.success(null);
+    }
+
+    public Result<ContactDTO> importFromPhone(String name, String phone, Map<String, Object> extra, Long userId) {
+        LambdaQueryWrapper<Contact> query = new LambdaQueryWrapper<Contact>()
+            .eq(Contact::getUserId, userId)
+            .eq(Contact::getPhone, phone);
+        Contact existing = contactMapper.selectOne(query);
+        if (existing != null) {
+            return Result.error("该联系人已在您的关系列表中");
+        }
+        Contact contact = new Contact();
+        contact.setUserId(userId);
+        contact.setName(name);
+        contact.setPhone(phone);
+        contact.setContactSource("phone");
+        if (extra != null) {
+            if (extra.get("relationshipType") != null)
+                contact.setRelationshipType((String) extra.get("relationshipType"));
+            if (extra.get("knownSince") != null)
+                contact.setKnownSince((Date) extra.get("knownSince"));
+            if (extra.get("birthday") != null)
+                contact.setBirthday((Date) extra.get("birthday"));
+            if (extra.get("bio") != null)
+                contact.setBio((String) extra.get("bio"));
+        }
+        contact.setIntimacyLevel(30);
+        contact.setContactCount(0);
+        contact.setCreatedAt(new Date());
+        contact.setUpdatedAt(new Date());
+        contactMapper.insert(contact);
+        return Result.success(toDTO(contact));
+    }
+
+    public Result<ContactDTO> recordInteraction(Long id, Long userId) {
+        Contact contact = contactMapper.selectById(id);
+        if (contact == null || !contact.getUserId().equals(userId)) {
+            return Result.error("联系人不存在");
+        }
+        contact.setContactCount(contact.getContactCount() == null ? 1 : contact.getContactCount() + 1);
+        contact.setLastContactAt(new Date());
+        contact.setIntimacyLevel(calcIntimacy(contact));
+        contact.setUpdatedAt(new Date());
+        contactMapper.updateById(contact);
+        return Result.success(toDTO(contact));
+    }
+
+    public int calcIntimacy(Contact c) {
+        int base = Math.min((c.getContactCount() == null ? 0 : c.getContactCount()) * 5, 60);
+        int active = 0;
+        if (c.getLastContactAt() != null) {
+            long days = (System.currentTimeMillis() - c.getLastContactAt().getTime()) / 86400000L;
+            if (days <= 7) active = 20;
+            else if (days <= 30) active = 10;
+            else if (days <= 90) active = 5;
+            else if (days > 365) active = -10;
+        }
+        return Math.max(0, Math.min(100, base + active));
+    }
+
+    private List<ContactDTO> toDTOList(List<Contact> list) {
+        List<ContactDTO> result = new ArrayList<>();
+        for (Contact c : list) {
+            result.add(toDTO(c));
+        }
+        return result;
+    }
+
+    private ContactDTO toDTO(Contact c) {
+        ContactDTO dto = new ContactDTO();
+        dto.setId(c.getId());
+        dto.setUserId(c.getUserId());
+        dto.setName(c.getName());
+        dto.setPhone(c.getPhone());
+        dto.setAvatar(c.getAvatar());
+        dto.setRelationshipType(c.getRelationshipType());
+        dto.setKnownSince(c.getKnownSince());
+        dto.setKnownSinceLabel(formatKnownSince(c.getKnownSince()));
+        dto.setBio(c.getBio());
+        dto.setBirthday(c.getBirthday());
+        dto.setBirthdayLabel(formatBirthday(c.getBirthday()));
+        dto.setBirthdayCountdown(birthdayCountdown(c.getBirthday()));
+        dto.setIntimacyLevel(c.getIntimacyLevel());
+        dto.setContactSource(c.getContactSource());
+        dto.setTags(c.getTags());
+        dto.setLastContactAt(c.getLastContactAt());
+        dto.setContactCount(c.getContactCount());
+        dto.setNotes(c.getNotes());
+        dto.setCreatedAt(c.getCreatedAt());
+        dto.setUpdatedAt(c.getUpdatedAt());
+        return dto;
+    }
+
+    private String formatKnownSince(Date knownSince) {
+        if (knownSince == null) return null;
+        long years = (System.currentTimeMillis() - knownSince.getTime()) / (365L * 86400000L);
+        if (years < 1) return "认识不到1年";
+        return "认识" + years + "年";
+    }
+
+    private String formatBirthday(Date birthday) {
+        if (birthday == null) return null;
+        SimpleDateFormat sdf = new SimpleDateFormat("MM月dd日");
+        return sdf.format(birthday);
+    }
+
+    private String birthdayCountdown(Date birthday) {
+        if (birthday == null) return null;
+        Calendar now = Calendar.getInstance();
+        Calendar bd = Calendar.getInstance();
+        bd.set(Calendar.MONTH, birthday.getMonth());
+        bd.set(Calendar.DAY_OF_MONTH, birthday.getDate());
+        bd.set(Calendar.HOUR_OF_DAY, 0);
+        bd.set(Calendar.MINUTE, 0);
+        bd.set(Calendar.SECOND, 0);
+        bd.set(Calendar.MILLISECOND, 0);
+        if (bd.before(now)) {
+            bd.add(Calendar.YEAR, 1);
+        }
+        long diff = bd.getTimeInMillis() - now.getTimeInMillis();
+        long days = diff / 86400000L;
+        if (days <= 30) {
+            return "还有" + (days == 0 ? "今天" : days + "天");
+        }
+        return null;
+    }
+}

+ 41 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/EmiReportService.java

@@ -0,0 +1,41 @@
+package com.etotem.cfc.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.etotem.cfc.dto.EmiReportDTO;
+import com.etotem.cfc.entity.DanAssessmentResult;
+import com.etotem.cfc.mapper.DanAssessmentResultMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Slf4j
+@Service
+public class EmiReportService {
+
+    @Resource
+    private DanAssessmentResultMapper danAssessmentResultMapper;
+
+    public EmiReportDTO getChildLatestEmiReport(Long childId) {
+        LambdaQueryWrapper<DanAssessmentResult> wrapper = new LambdaQueryWrapper<DanAssessmentResult>()
+                .eq(DanAssessmentResult::getChildId, childId)
+                .eq(DanAssessmentResult::getStatus, "completed")
+                .orderByDesc(DanAssessmentResult::getAssessmentDate)
+                .last("LIMIT 1");
+        DanAssessmentResult result = danAssessmentResultMapper.selectOne(wrapper);
+        if (result == null) return null;
+
+        EmiReportDTO dto = new EmiReportDTO();
+        dto.setChildId(result.getChildId());
+        dto.setChildName(result.getChildName());
+        dto.setEmotionScore(result.getEmotionScore());
+        dto.setResilienceScore(result.getResilienceScore());
+        dto.setStressCopingScore(result.getStressCopingScore());
+        dto.setSelfAwarenessScore(result.getSelfAwarenessScore());
+        dto.setOverallScore(result.getOverallScore());
+        dto.setAnalysisReport(result.getAnalysisReport());
+        dto.setGrowthSuggestions(result.getGrowthSuggestions());
+        dto.setAssessmentDate(result.getAssessmentDate());
+        return dto;
+    }
+}

+ 69 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/FamilyContextService.java

@@ -0,0 +1,69 @@
+package com.etotem.cfc.service;
+
+import com.etotem.cfc.dto.ChildInfoDTO;
+import com.etotem.cfc.entity.User;
+import com.etotem.cfc.mapper.UserMapper;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * 家庭上下文组装服务
+ * 用于向 Dify AI 提供当前用户的家庭信息,使 AI 能回答关于家庭情况的问题
+ */
+@Service
+public class FamilyContextService {
+
+    @Resource
+    private UserService userService;
+
+    @Resource
+    private UserMapper userMapper;
+
+    @Resource
+    private TaskService taskService;
+
+    /**
+     * 构建当前用户的家庭上下文
+     *
+     * @param userId 当前登录用户ID
+     * @return 上下文 Map,传入 Dify inputs
+     */
+    public Map<String, Object> buildContext(Long userId) {
+        Map<String, Object> ctx = new LinkedHashMap<>();
+
+        // 1. 当前用户信息
+        User currentUser = userMapper.selectById(userId);
+        if (currentUser != null) {
+            Map<String, Object> userInfo = new LinkedHashMap<>();
+            userInfo.put("nickname", currentUser.getNickname() != null ? currentUser.getNickname() : "");
+            userInfo.put("role", currentUser.getRole() != null ? currentUser.getRole() : "parent");
+            userInfo.put("totalPoints", currentUser.getTotalPoints() != null ? currentUser.getTotalPoints() : 0);
+            ctx.put("user", userInfo);
+        }
+
+        // 2. 孩子列表
+        List<ChildInfoDTO> children = userService.getChildren(userId);
+        List<Map<String, Object>> childList = new ArrayList<>();
+        if (children != null) {
+            for (ChildInfoDTO child : children) {
+                Map<String, Object> c = new LinkedHashMap<>();
+                c.put("name", child.getNickname() != null ? child.getNickname() : "");
+                c.put("age", child.getAge() != null ? child.getAge() : 0);
+                c.put("danLevel", child.getDanLevel() != null ? child.getDanLevel() : "");
+                c.put("totalPoints", child.getTotalPoints() != null ? child.getTotalPoints() : 0);
+                c.put("streakDays", child.getStreakDays() != null ? child.getStreakDays() : 0);
+
+                // 今日任务完成率
+                Map<String, Object> taskStats = taskService.getChildTaskStats(child.getId());
+                c.put("taskCompletionRate", taskStats.getOrDefault("completionRate", 0));
+
+                childList.add(c);
+            }
+        }
+        ctx.put("children", childList);
+
+        return ctx;
+    }
+}

+ 87 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/HealthCheckinService.java

@@ -0,0 +1,87 @@
+package com.etotem.cfc.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.etotem.cfc.entity.EnergyLog;
+import com.etotem.cfc.entity.HealthCheckin;
+import com.etotem.cfc.mapper.EnergyLogMapper;
+import com.etotem.cfc.mapper.HealthCheckinMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+@Service
+public class HealthCheckinService {
+
+    @Resource
+    private HealthCheckinMapper healthCheckinMapper;
+
+    @Resource
+    private EnergyService energyService;
+
+    @Resource
+    private EnergyLogMapper energyLogMapper;
+
+    public List<HealthCheckin> getCheckins(Long userId, Long childId, String yearMonth) {
+        LambdaQueryWrapper<HealthCheckin> wrapper = new LambdaQueryWrapper<HealthCheckin>()
+                .eq(HealthCheckin::getUserId, userId);
+        if (childId != null) {
+            wrapper.eq(HealthCheckin::getChildId, childId);
+        }
+        wrapper.orderByDesc(HealthCheckin::getCheckinDate);
+        List<HealthCheckin> list = healthCheckinMapper.selectList(wrapper);
+        // Filter by yearMonth if provided (format: "2024-01")
+        if (yearMonth != null && yearMonth.length() == 7) {
+            String prefix = yearMonth + "-";
+            list.removeIf(c -> {
+                if (c.getCheckinDate() == null) return true;
+                String dateStr = new java.text.SimpleDateFormat("yyyy-MM-dd").format(c.getCheckinDate());
+                return !dateStr.startsWith(prefix);
+            });
+        }
+        return list;
+    }
+
+    public HealthCheckin getById(Long id) {
+        return healthCheckinMapper.selectById(id);
+    }
+
+    @Transactional
+    public HealthCheckin createCheckin(HealthCheckin checkin) {
+        checkin.setCreatedAt(new Date());
+        if (checkin.getEarnedEnergy() == null) {
+            checkin.setEarnedEnergy(5);
+        }
+        healthCheckinMapper.insert(checkin);
+
+        // Award energy points to body dimension
+        try {
+            Long childId = checkin.getChildId();
+            if (childId != null) {
+                energyService.awardEnergy(childId, "health_checkin", checkin.getId(), 5,
+                        "健康打卡", 30);
+            }
+        } catch (Exception e) {
+            log.warn("健康打卡能量发放失败: checkinId={}, error={}", checkin.getId(), e.getMessage());
+        }
+
+        return checkin;
+    }
+
+    @Transactional
+    public void deleteCheckin(Long id) {
+        healthCheckinMapper.deleteById(id);
+    }
+
+    public long countCheckins(Long childId) {
+        LambdaQueryWrapper<HealthCheckin> wrapper = new LambdaQueryWrapper<HealthCheckin>();
+        if (childId != null) {
+            wrapper.eq(HealthCheckin::getChildId, childId);
+        }
+        return healthCheckinMapper.selectCount(wrapper);
+    }
+}

+ 7 - 2
cfc-backend/src/main/java/com/etotem/cfc/service/ProductService.java

@@ -28,11 +28,15 @@ public class ProductService {
     @Resource
     private UserMapper userMapper;
 
-    public Result<Map<String, Object>> list(ProductListQueryDTO query) {
+    public Result<Map<String, Object>> list(ProductListQueryDTO query, Long userId) {
         Page<Product> page = new Page<>(query.getPage(), query.getSize());
         LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<Product>()
             .eq(Product::getStatus, "on_shelf")
             .orderByDesc(Product::getCreatedAt);
+        // 游客过滤:排除会员专属商品
+        if (userId == null) {
+            wrapper.ne(Product::getMemberEligible, "yes");
+        }
         if (query.getProductType() != null && !query.getProductType().isEmpty()) {
             wrapper.eq(Product::getProductType, query.getProductType());
         }
@@ -43,8 +47,9 @@ public class ProductService {
             wrapper.like(Product::getName, query.getKeyword());
         }
         IPage<Product> result = productMapper.selectPage(page, wrapper);
+        boolean isGuest = (userId == null);
         List<ProductDTO> records = result.getRecords().stream()
-            .map(ProductDTO::from)
+            .map(p -> ProductDTO.from(p, isGuest))
             .collect(Collectors.toList());
         Map<String, Object> data = new HashMap<>();
         data.put("records", records);

+ 39 - 8
cfc-backend/src/main/java/com/etotem/cfc/service/TaskService.java

@@ -190,11 +190,11 @@ public class TaskService implements TaskServiceInterface {
         return task;
     }
 
-    public List<Task> getTodayTasks(Long childId) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.set(Calendar.HOUR_OF_DAY, 0);
-        calendar.set(Calendar.MINUTE, 0);
-        calendar.set(Calendar.SECOND, 0);
+    public List<Task> getTodayTasks(Long childId) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
         Date startOfDay = calendar.getTime();
 
@@ -205,9 +205,32 @@ return taskMapper.selectList(new LambdaQueryWrapper<Task>()
 .eq(Task::getChildId, childId)
 .ge(Task::getDeadline, startOfDay)
 .lt(Task::getDeadline, endOfDay)
-.in(Task::getStatus, Arrays.asList("pending", "completed"))
-.orderByAsc(Task::getDeadline));
-}
+.in(Task::getStatus, Arrays.asList("pending", "completed"))
+.orderByAsc(Task::getDeadline));
+}
+
+    /**
+     * 按维度分类获取今日任务(五维页面筛选用)
+     */
+    public List<Task> getTodayTasksByCategory(Long childId, String category) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        Date startOfDay = calendar.getTime();
+
+        calendar.add(Calendar.DAY_OF_MONTH, 1);
+        Date endOfDay = calendar.getTime();
+
+        return taskMapper.selectList(new LambdaQueryWrapper<Task>()
+                .eq(Task::getChildId, childId)
+                .eq(Task::getCategory, category)
+                .ge(Task::getDeadline, startOfDay)
+                .lt(Task::getDeadline, endOfDay)
+                .in(Task::getStatus, Arrays.asList("pending", "completed"))
+                .orderByAsc(Task::getDeadline));
+    }
 
     /**
      * 获取孩子的任务统计数据
@@ -426,6 +449,14 @@ return result;
                 .orderByDesc(Task::getCreatedAt));
     }
 
+    public Page<Task> getTaskHistoryByCategory(Long childId, Integer page, Integer size, String category) {
+        Page<Task> pageParam = new Page<>(page, size);
+        return taskMapper.selectPage(pageParam, new LambdaQueryWrapper<Task>()
+                .eq(Task::getChildId, childId)
+                .eq(Task::getCategory, category)
+                .orderByDesc(Task::getCreatedAt));
+    }
+
   public boolean deleteTask(Long taskId, Long userId) {
     Task task = taskMapper.selectById(taskId);
     if (task == null || !task.getCreatorId().equals(userId)) {

+ 23 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/TaskStatsService.java

@@ -29,6 +29,29 @@ public class TaskStatsService {
         return buildStats(tasks, null, childId);
     }
 
+    /**
+     * 获取某个用户(家长)的任务完成统计
+     * 按 executorType="parent" + executorId 查询,覆盖家长自己的任务
+     */
+    public Map<String, Object> getUserStats(Long userId, Date startDate, Date endDate) {
+        LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<Task>()
+            .ne(Task::getIsTemplate, 1)
+            .ne(Task::getStatus, "cancelled")
+            .eq(Task::getExecutorType, "parent")
+            .eq(Task::getExecutorId, userId);
+
+        if (startDate != null) {
+            wrapper.ge(Task::getCreatedAt, startDate);
+        }
+        if (endDate != null) {
+            wrapper.le(Task::getCreatedAt, endDate);
+        }
+        wrapper.orderByDesc(Task::getCreatedAt);
+
+        List<Task> tasks = taskMapper.selectList(wrapper);
+        return buildStats(tasks, null, null);
+    }
+
     /**
      * 获取家庭维度的任务完成统计
      */

+ 4 - 0
cfc-backend/src/main/resources/application.yml

@@ -68,6 +68,10 @@ wechat:
   test-mode: true  # 测试模式:跳过微信API调用,使用模拟数据
   test-phone: "13800138000"  # 测试模式使用的手机号
 
+dify:
+  base-url: http://dify.bianwoyou.cn/v1
+  api-key: app-your-api-key-here
+
 logging:
   level:
     com.etotem.cfc: debug

+ 23 - 0
cfc-backend/src/main/resources/schema.sql

@@ -1495,3 +1495,26 @@ CREATE TABLE IF NOT EXISTS blood_type_config (
     wealth_modifier  DECIMAL(4,2) DEFAULT 0 COMMENT '富修正系数(%)',
     created_at       DATETIME DEFAULT CURRENT_TIMESTAMP
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='血型配置表';
+
+CREATE TABLE IF NOT EXISTS activities (
+    id               BIGINT AUTO_INCREMENT PRIMARY KEY,
+    title            VARCHAR(100) NOT NULL COMMENT '活动标题',
+    description      VARCHAR(500) COMMENT '活动描述',
+    cover_image      VARCHAR(500) COMMENT '封面图片URL',
+    dimension_code   VARCHAR(20) COMMENT '维度代码: body/mind/wisdom/action/wealth',
+    activity_type    VARCHAR(20) DEFAULT 'offline' COMMENT '活动类型: offline/online/campaign',
+    status           VARCHAR(20) DEFAULT 'draft' COMMENT '状态: draft/published/ended',
+    start_time       DATETIME COMMENT '开始时间',
+    end_time         DATETIME COMMENT '结束时间',
+    location         VARCHAR(200) COMMENT '活动地点',
+    max_participants INT DEFAULT 0 COMMENT '最大参与人数',
+    current_participants INT DEFAULT 0 COMMENT '当前参与人数',
+    price            DECIMAL(10,2) DEFAULT 0 COMMENT '活动价格',
+    vendor_id        BIGINT COMMENT '服务商ID',
+    vendor_name      VARCHAR(100) COMMENT '服务商名称',
+    created_at       DATETIME DEFAULT CURRENT_TIMESTAMP,
+    updated_at       DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+    INDEX idx_dimension (dimension_code),
+    INDEX idx_status (status),
+    INDEX idx_start_time (start_time)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='活动表';

+ 153 - 0
cfc-frontend/components/DimensionActivities.vue

@@ -0,0 +1,153 @@
+<template>
+  <view class="section" v-if="displayActivities && displayActivities.length > 0">
+    <view class="section-header">
+      <text class="section-title">🔥 相关活动</text>
+      <text class="section-more" @click="$emit('moreActivities')">更多 ›</text>
+    </view>
+    <view class="activity-list">
+      <view class="activity-card" v-for="act in displayActivities" :key="act.id" @click="$emit('activityClick', act)">
+        <image class="activity-cover" :src="act.coverImage || '/static/default-activity.png'" mode="aspectFill" />
+        <view class="activity-info">
+          <text class="activity-name line-clamp-1">{{ act.title }}</text>
+          <view class="activity-meta">
+            <text class="activity-time">{{ act.startTime }}</text>
+          </view>
+          <view class="activity-bottom">
+            <text class="activity-status" :class="'status-' + (act.status || 'upcoming')">{{ statusText(act.status) }}</text>
+            <text class="activity-fee" v-if="act.priceLabel">{{ act.priceLabel }}</text>
+            <text class="activity-fee" v-else-if="act.price && act.price > 0">¥{{ act.price }}</text>
+            <text class="activity-fee free" v-else>免费</text>
+          </view>
+        </view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  props: {
+    dimensionCode: { type: String, required: true },
+    activities: { type: Array, default: function() { return [] } }
+  },
+  data: function() {
+    return {
+      activitiesData: []
+    }
+  },
+  computed: {
+    displayActivities: function() {
+      return this.activitiesData.length > 0 ? this.activitiesData : this.activities
+    }
+  },
+  created: function() {
+    this.loadActivities()
+  },
+  methods: {
+    statusText: function(status) {
+      var map = { upcoming: '即将开始', ongoing: '进行中', ended: '已结束', cancelled: '已取消' }
+      return map[status] || '即将开始'
+    },
+    loadActivities: function() {
+      var self = this
+      import('@/utils/api.js').then(function(api) {
+        api.getActivityList({ dimensionCode: self.dimensionCode, page: 1, size: 6 }).then(function(res) {
+          var records = (res.data && res.data.records) ? res.data.records : []
+          self.activitiesData = records
+        }).catch(function() {
+          // silently fail
+        })
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.section {
+  margin: 20rpx 20rpx;
+}
+.section-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 20rpx;
+}
+.section-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+}
+.section-more {
+  font-size: 24rpx;
+  color: #999;
+}
+.activity-list {
+  display: flex;
+  flex-direction: column;
+}
+.activity-card {
+  display: flex;
+  flex-direction: row;
+  background: #fff;
+  border-radius: 16rpx;
+  overflow: hidden;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+  margin-bottom: 20rpx;
+}
+.activity-card:active { opacity: 0.8; }
+.activity-cover {
+  width: 220rpx;
+  height: 200rpx;
+  flex-shrink: 0;
+  background: #f0f0f0;
+}
+.activity-info {
+  flex: 1;
+  padding: 16rpx 20rpx;
+  display: flex;
+  flex-direction: column;
+  justify-content: space-between;
+}
+.activity-name {
+  font-size: 28rpx;
+  color: #333;
+  font-weight: 500;
+}
+.activity-meta {
+  margin-top: 8rpx;
+}
+.activity-time {
+  font-size: 24rpx;
+  color: #999;
+}
+.activity-bottom {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  margin-top: 12rpx;
+}
+.activity-status {
+  font-size: 22rpx;
+  padding: 4rpx 12rpx;
+  border-radius: 8rpx;
+}
+.status-upcoming { background: #FFF7ED; color: #F97316; }
+.status-ongoing { background: #F0FDF4; color: #22C55E; }
+.status-ended { background: #F5F5F5; color: #999; }
+.status-cancelled { background: #FEE2E2; color: #EF4444; }
+.activity-fee {
+  font-size: 24rpx;
+  color: #F97316;
+  font-weight: 500;
+}
+.activity-fee.free {
+  color: #22C55E;
+}
+.line-clamp-1 {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+</style>

+ 113 - 0
cfc-frontend/components/DimensionProducts.vue

@@ -0,0 +1,113 @@
+<template>
+  <view class="section" v-if="displayProducts && displayProducts.length > 0">
+    <view class="section-header">
+      <text class="section-title">🛍️ 推荐商品</text>
+      <text class="section-more" @click="$emit('moreProducts')">更多 ›</text>
+    </view>
+    <view class="product-list">
+      <view class="product-card" v-for="prod in displayProducts" :key="prod.id" @click="$emit('productClick', prod)">
+        <image class="product-img" :src="prod.coverImage || '/static/default-product.png'" mode="aspectFill" />
+        <text class="product-name line-clamp-2">{{ prod.name }}</text>
+        <text class="product-price" v-if="prod.priceLabel">{{ prod.priceLabel }}</text>
+        <text class="product-price" v-else-if="prod.price">¥{{ prod.price }}</text>
+        <text class="product-price" v-else>免费</text>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  props: {
+    dimensionCode: { type: String, required: true },
+    products: { type: Array, default: function() { return [] } }
+  },
+  data: function() {
+    return {
+      productsData: []
+    }
+  },
+  computed: {
+    displayProducts: function() {
+      return this.productsData.length > 0 ? this.productsData : this.products
+    }
+  },
+  created: function() {
+    this.loadProducts()
+  },
+  methods: {
+    loadProducts: function() {
+      var self = this
+      import('@/utils/api.js').then(function(api) {
+        api.getProductsByDomain(self.dimensionCode, 1, 6).then(function(res) {
+          var records = (res.data && res.data.records) ? res.data.records : (res.data || [])
+          self.productsData = records
+        }).catch(function() {
+          // silently fail, use props as fallback
+        })
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.section {
+  margin: 20rpx 20rpx;
+}
+.section-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 20rpx;
+}
+.section-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+}
+.section-more {
+  font-size: 24rpx;
+  color: #999;
+}
+.product-list {
+  display: flex;
+  flex-wrap: wrap;
+}
+.product-card {
+  width: calc(50% - 10rpx);
+  background: #fff;
+  border-radius: 16rpx;
+  overflow: hidden;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+  margin-right: 20rpx;
+  margin-bottom: 20rpx;
+}
+.product-card:nth-child(2n) {
+  margin-right: 0;
+}
+.product-img {
+  width: 100%;
+  height: 240rpx;
+  background: #f0f0f0;
+}
+.product-name {
+  font-size: 26rpx;
+  color: #333;
+  padding: 12rpx 16rpx 0;
+}
+.product-price {
+  font-size: 28rpx;
+  color: #F97316;
+  font-weight: bold;
+  padding: 8rpx 16rpx 16rpx;
+  display: block;
+}
+.line-clamp-2 {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-line-clamp: 2;
+  -webkit-box-orient: vertical;
+}
+</style>

+ 147 - 0
cfc-frontend/components/DimensionTasks.vue

@@ -0,0 +1,147 @@
+<template>
+  <view class="section" v-if="displayTasks && displayTasks.length > 0">
+    <view class="section-header">
+      <text class="section-title">📋 今日任务</text>
+      <text class="section-more" @click="$emit('moreTasks')">全部 ›</text>
+    </view>
+    <view class="task-list">
+      <view class="task-card" v-for="task in displayTasks" :key="task.id" @click="$emit('taskClick', task)">
+        <view class="task-left">
+          <view class="task-check" :class="{ 'checked': task.status === 'completed' }">
+            <text class="task-check-icon" v-if="task.status === 'completed'">✓</text>
+          </view>
+        </view>
+        <view class="task-content">
+          <text class="task-name" :class="{ 'done': task.status === 'completed' }">{{ task.title }}</text>
+          <view class="task-meta">
+            <text class="task-points" v-if="task.points">+{{ task.points }}分</text>
+            <text class="task-penalty" v-if="task.penalty">-{{ task.penalty }}分</text>
+          </view>
+        </view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  props: {
+    dimensionCode: { type: String, required: true },
+    tasks: { type: Array, default: function() { return [] } },
+    childId: { type: Number, default: null }
+  },
+  data: function() {
+    return {
+      tasksData: []
+    }
+  },
+  computed: {
+    displayTasks: function() {
+      return this.tasksData.length > 0 ? this.tasksData : this.tasks
+    }
+  },
+  created: function() {
+    this.loadTasks()
+  },
+  methods: {
+    loadTasks: function() {
+      var self = this
+      if (!self.childId) return
+      import('@/utils/api.js').then(function(api) {
+        api.getTodayTasksByCategory(self.childId, self.dimensionCode).then(function(res) {
+          self.tasksData = res.data || []
+        }).catch(function() {
+          // silently fail
+        })
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.section {
+  margin: 20rpx 20rpx;
+}
+.section-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 20rpx;
+}
+.section-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+}
+.section-more {
+  font-size: 24rpx;
+  color: #999;
+}
+.task-list {
+  display: flex;
+  flex-direction: column;
+}
+.task-card {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  background: #fff;
+  border-radius: 16rpx;
+  padding: 24rpx 20rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+  margin-bottom: 16rpx;
+}
+.task-card:active { opacity: 0.8; }
+.task-left {
+  margin-right: 20rpx;
+}
+.task-check {
+  width: 44rpx;
+  height: 44rpx;
+  border-radius: 50%;
+  border: 3rpx solid #ddd;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background: #f9f9f9;
+}
+.task-check.checked {
+  background: #22C55E;
+  border-color: #22C55E;
+}
+.task-check-icon {
+  font-size: 24rpx;
+  color: #fff;
+  font-weight: bold;
+}
+.task-content {
+  flex: 1;
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+}
+.task-name {
+  font-size: 28rpx;
+  color: #333;
+}
+.task-name.done {
+  text-decoration: line-through;
+  color: #999;
+}
+.task-meta {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+}
+.task-points {
+  font-size: 24rpx;
+  color: #22C55E;
+  margin-right: 12rpx;
+}
+.task-penalty {
+  font-size: 24rpx;
+  color: #EF4444;
+}
+</style>

+ 152 - 0
cfc-frontend/components/FamilyEnergyBar.vue

@@ -0,0 +1,152 @@
+<template>
+  <view class="family-energy-bar">
+    <view class="bar-header">
+      <text class="bar-icon">{{ dimensionIcon }}</text>
+      <text class="bar-title">{{ dimensionName }}能量</text>
+      <text class="bar-total-score">{{ familyScore }}</text>
+    </view>
+    <view class="bar-list">
+      <view class="bar-row bar-row-family">
+        <text class="bar-label">全家</text>
+        <view class="bar-track">
+          <view class="bar-fill" :style="{ width: familyScore + '%', background: dimensionColor }"></view>
+        </view>
+        <text class="bar-value">{{ familyScore }}</text>
+      </view>
+      <view
+        class="bar-row bar-row-member"
+        v-for="member in members"
+        :key="member.memberId"
+        @click="onMemberClick(member)"
+      >
+        <text class="bar-label">{{ member.name }}</text>
+        <view class="bar-track">
+          <view class="bar-fill" :style="{ width: getMemberScore(member) + '%', background: memberColor(member) }"></view>
+        </view>
+        <text class="bar-value">{{ getMemberScore(member) }}</text>
+        <text class="bar-arrow">›</text>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  props: {
+    dimensionCode: { type: String, required: true },
+    sandboxData: { type: Object, default: null },
+    dualDimension: { type: String, default: '' }
+  },
+  computed: {
+    dimensionConfig: function() {
+      var maps = {
+        body:     { name: '身体', icon: '\u{1F3C3}', color: '#10B981' },
+        mind:     { name: '心',   icon: '\u2764',    color: '#8B5CF6' },
+        wisdom:   { name: '智',   icon: '\u{1F9E0}', color: '#3B82F6' },
+        action:   { name: '行动', icon: '\u{1F3CB}', color: '#F97316' },
+        wealth:   { name: '富',   icon: '\u{1F4B0}', color: '#F59E0B' }
+      }
+      return maps[this.dimensionCode] || { name: '', icon: '', color: '#999' }
+    },
+    dimensionIcon: function() { return this.dimensionConfig.icon },
+    dimensionName: function() { return this.dimensionConfig.name },
+    dimensionColor: function() { return this.dimensionConfig.color },
+    familyScore: function() {
+      if (!this.sandboxData) return 0
+      return this.sandboxData[this.dimensionCode + 'Score'] || 0
+    },
+    members: function() {
+      return this.sandboxData && this.sandboxData.members ? this.sandboxData.members : []
+    }
+  },
+  methods: {
+    getMemberScore: function(member) {
+      return member[this.dimensionCode + 'Score'] || 0
+    },
+    memberColor: function(member) {
+      var score = this.getMemberScore(member)
+      if (score >= 80) return '#10B981'
+      if (score >= 60) return '#3B82F6'
+      if (score >= 40) return '#F97316'
+      return '#EF4444'
+    },
+    onMemberClick: function(member) {
+      var detailPages = {
+        body:   '/pages/body/member-body-detail',
+        mind:   '/pages/mind/member-mind-detail',
+        wisdom: '/pages/mind/member-mind-detail',
+        action: '/pages/action/member-action-detail'
+      }
+      var page = detailPages[this.dimensionCode]
+      if (page) {
+        uni.navigateTo({
+          url: page + '?childId=' + member.memberId + '&memberName=' + encodeURIComponent(member.name) + '&dimensionCode=' + this.dimensionCode
+        })
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+.family-energy-bar {
+  margin: 20rpx 30rpx;
+  background: #fff;
+  border-radius: 24rpx;
+  padding: 28rpx 24rpx;
+  box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
+}
+.bar-header {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  margin-bottom: 20rpx;
+}
+.bar-icon { font-size: 32rpx; margin-right: 8rpx; }
+.bar-title { font-size: 28rpx; font-weight: bold; color: #333; flex: 1; }
+.bar-total-score { font-size: 40rpx; font-weight: bold; color: #F97316; }
+.bar-row {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  margin-bottom: 16rpx;
+  padding: 8rpx 0;
+}
+.bar-row:last-child { margin-bottom: 0; }
+.bar-row-member:active { opacity: 0.6; }
+.bar-label {
+  font-size: 24rpx;
+  color: #666;
+  width: 80rpx;
+  flex-shrink: 0;
+}
+.bar-track {
+  flex: 1;
+  height: 24rpx;
+  background: #f0f0f0;
+  border-radius: 12rpx;
+  overflow: hidden;
+  margin: 0 12rpx;
+}
+.bar-fill {
+  height: 100%;
+  border-radius: 12rpx;
+  transition: width 0.5s ease;
+}
+.bar-value {
+  font-size: 26rpx;
+  font-weight: bold;
+  color: #333;
+  width: 60rpx;
+  text-align: right;
+  flex-shrink: 0;
+}
+.bar-arrow {
+  font-size: 28rpx;
+  color: #ccc;
+  margin-left: 8rpx;
+}
+.bar-row-family .bar-fill {
+  background: linear-gradient(90deg, #F97316, #FB923C);
+}
+</style>

+ 98 - 0
cfc-frontend/components/HealthTips.vue

@@ -0,0 +1,98 @@
+<template>
+  <view class="section" v-if="tips.length > 0">
+    <view class="section-header">
+      <text class="section-title">💡 健康小贴士</text>
+      <text class="section-more" @click="goMore">更多 ›</text>
+    </view>
+    <view class="tip-list">
+      <view class="tip-item" v-for="tip in tips" :key="tip.id" @click="goDetail(tip)">
+        <text class="tip-icon">📋</text>
+        <view class="tip-content">
+          <text class="tip-title">{{ tip.title }}</text>
+          <text class="tip-summary">{{ tip.summary }}</text>
+        </view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+const BASE_URL = 'http://localhost:8080'
+
+export default {
+  props: {
+    dimension: { type: String, default: 'body' },
+    limit: { type: Number, default: 4 }
+  },
+  data: function() {
+    return { tips: [] }
+  },
+  created: function() {
+    this.loadTips()
+  },
+  methods: {
+    loadTips: function() {
+      var self = this
+      var token = uni.getStorageSync('token')
+      uni.request({
+        url: BASE_URL + '/api/articles/list',
+        method: 'POST',
+        data: {
+          dimension: this.dimension,
+          page: 1,
+          size: this.limit
+        },
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': token ? 'Bearer ' + token : ''
+        },
+        success: function(res) {
+          if (res.data && res.data.code === 200 && res.data.data && res.data.data.records) {
+            var list = res.data.data.records
+            self.tips = list.slice(0, self.limit)
+          }
+        },
+        fail: function() {}
+      })
+    },
+    goDetail: function(tip) {
+      uni.navigateTo({ url: '/pages/mind/article-detail?id=' + tip.id })
+    },
+    goMore: function() {
+      uni.navigateTo({ url: '/pages/mind/articles?dimension=' + this.dimension })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.section { margin: 20rpx 30rpx; }
+.section-header {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 16rpx;
+}
+.section-title { font-size: 30rpx; font-weight: bold; color: #333; }
+.section-more { font-size: 24rpx; color: #999; }
+.tip-list {
+  background: #fff;
+  border-radius: 20rpx;
+  overflow: hidden;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+}
+.tip-item {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  padding: 24rpx 20rpx;
+  border-bottom: 1rpx solid #f5f5f5;
+}
+.tip-item:last-child { border-bottom: none; }
+.tip-item:active { background: #fafafa; }
+.tip-icon { font-size: 36rpx; margin-right: 16rpx; flex-shrink: 0; }
+.tip-content { flex: 1; }
+.tip-title { font-size: 28rpx; color: #333; font-weight: 500; display: block; }
+.tip-summary { font-size: 24rpx; color: #999; margin-top: 4rpx; display: block; }
+</style>

+ 74 - 0
cfc-frontend/components/LoginGuideCard.vue

@@ -0,0 +1,74 @@
+<template>
+  <view class="login-guide-card">
+    <view class="guide-header">
+      <text class="guide-icon">🔒</text>
+    </view>
+    <text class="guide-title">{{ title }}</text>
+    <view class="guide-desc">
+      <text class="guide-desc-item" v-for="(item, idx) in items" :key="idx">· {{ item }}</text>
+    </view>
+    <view class="guide-actions">
+      <view class="guide-btn primary" @click="goLogin">立即登录</view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  props: {
+    title: { type: String, default: '登录后查看完整内容' },
+    items: {
+      type: Array,
+      default: function() {
+        return ['查看个性化数据', '获取更多推荐']
+      }
+    }
+  },
+  methods: {
+    goLogin: function() {
+      uni.navigateTo({ url: '/pages/login/login' })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.login-guide-card {
+  margin: 20rpx 30rpx;
+  background: linear-gradient(135deg, #FFF7ED, #FFE4D6);
+  border-radius: 24rpx;
+  padding: 40rpx 32rpx;
+  text-align: center;
+}
+.guide-icon { font-size: 48rpx; }
+.guide-title {
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #333;
+  margin: 16rpx 0;
+  display: block;
+}
+.guide-desc { margin-bottom: 24rpx; }
+.guide-desc-item {
+  font-size: 26rpx;
+  color: #666;
+  line-height: 1.8;
+  display: block;
+}
+.guide-actions {
+  display: flex;
+  flex-direction: row;
+  justify-content: center;
+}
+.guide-btn {
+  padding: 16rpx 48rpx;
+  border-radius: 40rpx;
+  font-size: 28rpx;
+  font-weight: 500;
+}
+.guide-btn.primary {
+  background: linear-gradient(135deg, #F97316, #FB923C);
+  color: #fff;
+}
+.guide-btn:active { opacity: 0.8; }
+</style>

+ 92 - 0
cfc-frontend/components/UserQuickEntry.vue

@@ -0,0 +1,92 @@
+<template>
+  <view class="user-quick-entry">
+    <view class="user-info">
+      <text class="user-info-text">
+        👤 当前用户:{{ userName }}({{ roleName }})
+      </text>
+      <view class="child-switcher" v-if="children && children.length > 0" @click="showChildPicker">
+        <text class="child-switcher-text">
+          切换孩子:{{ currentChildName || '选择' }} ▼
+        </text>
+      </view>
+    </view>
+    <view class="quick-actions">
+      <view class="quick-btn" @click="$emit('scrollTo', 'tasks')">
+        <text class="quick-btn-icon">📋</text>
+        <text class="quick-btn-label">今日任务</text>
+      </view>
+      <view class="quick-btn" @click="$emit('scrollTo', 'activities')">
+        <text class="quick-btn-icon">🔥</text>
+        <text class="quick-btn-label">相关活动</text>
+      </view>
+      <view class="quick-btn" @click="$emit('scrollTo', 'products')">
+        <text class="quick-btn-icon">🛍️</text>
+        <text class="quick-btn-label">推荐商品</text>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  props: {
+    userName: { type: String, default: '' },
+    roleName: { type: String, default: '' },
+    currentChildName: { type: String, default: '' },
+    children: { type: Array, default: function() { return [] } }
+  },
+  methods: {
+    showChildPicker: function() {
+      var self = this
+      var items = this.children.map(function(c) { return c.childName })
+      uni.showActionSheet({
+        itemList: items,
+        success: function(res) {
+          var child = self.children[res.tapIndex]
+          if (child) {
+            uni.setStorageSync('currentChildId', child.childId)
+            self.$emit('childChanged', child)
+          }
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.user-quick-entry {
+  margin: 0 30rpx 20rpx;
+  background: #fff;
+  border-radius: 20rpx;
+  padding: 20rpx 24rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
+}
+.user-info {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 16rpx;
+}
+.user-info-text { font-size: 26rpx; color: #666; }
+.child-switcher-text { font-size: 24rpx; color: #F97316; }
+.quick-actions {
+  display: flex;
+  flex-direction: row;
+}
+.quick-btn {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding: 16rpx 0;
+  background: #FFF7ED;
+  border-radius: 16rpx;
+  margin-right: 16rpx;
+}
+.quick-btn:last-child { margin-right: 0; }
+.quick-btn:active { opacity: 0.7; }
+.quick-btn-icon { font-size: 36rpx; margin-bottom: 6rpx; }
+.quick-btn-label { font-size: 22rpx; color: #666; }
+</style>

+ 88 - 1
cfc-frontend/pages.json

@@ -33,6 +33,18 @@
         "navigationStyle": "custom"
       }
     },
+    {
+      "path": "pages/policy/agreement",
+      "style": {
+        "navigationBarTitleText": "用户协议"
+      }
+    },
+    {
+      "path": "pages/policy/privacy",
+      "style": {
+        "navigationBarTitleText": "隐私政策"
+      }
+    },
     {
       "path": "pages/user-edit/user-edit",
       "style": {
@@ -45,6 +57,25 @@
         "navigationBarTitleText": "身体"
       }
     },
+    {
+      "path": "pages/body/health-report",
+      "style": {
+        "navigationBarTitleText": "健康报告详情"
+      }
+    },
+    {
+      "path": "pages/body/checkin",
+      "style": {
+        "navigationBarTitleText": "健康打卡"
+      }
+    },
+    {
+      "path": "pages/body/member-body-detail",
+      "style": {
+        "navigationBarTitleText": "身体能量详情",
+        "navigationStyle": "custom"
+      }
+    },
     {
       "path": "pages/mind/index",
       "style": {
@@ -69,12 +100,32 @@
         "navigationBarTitleText": "能力训练"
       }
     },
+    {
+      "path": "pages/mind/emotion-report",
+      "style": {
+        "navigationBarTitleText": "心理报告"
+      }
+    },
+    {
+      "path": "pages/mind/member-mind-detail",
+      "style": {
+        "navigationBarTitleText": "心智能量详情",
+        "navigationStyle": "custom"
+      }
+    },
     {
       "path": "pages/action/index",
       "style": {
         "navigationBarTitleText": "行动"
       }
     },
+    {
+      "path": "pages/action/member-action-detail",
+      "style": {
+        "navigationBarTitleText": "行动能量详情",
+        "navigationStyle": "custom"
+      }
+    },
     {
       "path": "pages/profile/profile",
       "style": {
@@ -110,6 +161,14 @@
       "style": {
         "navigationBarTitleText": "商品详情"
       }
+    },
+    // ===== AI 聊天 =====
+    {
+      "path": "pages/ai/chat",
+      "style": {
+        "navigationBarTitleText": "AI 家庭助手",
+        "navigationStyle": "custom"
+      }
     }
   ],
   "subPackages": [
@@ -364,6 +423,34 @@
         {
           "path": "order-detail/order-detail",
           "style": { "navigationBarTitleText": "订单详情" }
+        },
+        {
+          "path": "cart/cart",
+          "style": { "navigationBarTitleText": "购物车" }
+        },
+        {
+          "path": "checkout/checkout",
+          "style": { "navigationBarTitleText": "确认订单" }
+        },
+        {
+          "path": "payment/payment",
+          "style": { "navigationBarTitleText": "支付订单" }
+        },
+        {
+          "path": "logistics/logistics",
+          "style": { "navigationBarTitleText": "物流跟踪" }
+        },
+        {
+          "path": "address/address",
+          "style": { "navigationBarTitleText": "收货地址" }
+        },
+        {
+          "path": "address-edit/address-edit",
+          "style": { "navigationBarTitleText": "编辑地址" }
+        },
+        {
+          "path": "detail/detail",
+          "style": { "navigationBarTitleText": "商品详情" }
         }
       ]
     },
@@ -463,7 +550,7 @@
         }
       ]
     },
-    // ===== 财富维度 =====
+        // ===== 财富维度 =====
     {
       "root": "pages/wealth",
       "pages": [

+ 188 - 233
cfc-frontend/pages/action/index.vue

@@ -5,22 +5,55 @@
       tagline="知行合一 · 快乐成长"
       quote="千里之行,始于足下" />
 
-    <!-- 我的任务(登录后可见,放在最上面) -->
-    <view class="section" v-if="sectionVisible('today_tasks') && isLoggedIn">
-      <view class="section-header">
-        <text class="section-title">📋 我的任务</text>
-        <text class="section-more" @click="goTasks">全部 ›</text>
-      </view>
-      <view class="task-wrap" v-if="todayTasks.length > 0">
-        <view class="task-item" v-for="task in todayTasks" :key="task.id">
-          <text class="task-name">{{ task.title }}</text>
-          <text class="task-points">+{{ task.points || 0 }}分</text>
-        </view>
-      </view>
-      <view class="task-empty" v-else>
-        <text class="task-empty-text">今日暂无任务</text>
-      </view>
-    </view>
+    <!-- 游客登录引导卡 -->
+    <template v-if="!isLoggedIn">
+      <LoginGuideCard
+        title="登录后查看任务和活动记录"
+        :items="[
+          '查看今日任务,完成打卡获取行动能量',
+          '报名参加热门活动,记录成长足迹',
+          '查看专属商品和活动价格'
+        ]" />
+    </template>
+
+    <!-- 登录后:五维能量条 -->
+    <FamilyEnergyBar
+      v-if="isLoggedIn"
+      dimensionCode="action"
+      :sandboxData="sandboxData"
+      :dualDimension="dualDimension" />
+
+    <!-- 登录后:用户快捷入口 -->
+    <UserQuickEntry
+      v-if="isLoggedIn"
+      :userName="userName"
+      roleName="家长"
+      :currentChildName="currentChildName"
+      :children="children"
+      @childChanged="onChildChanged"
+      @scrollTo="scrollToSection" />
+
+    <!-- ===== 维度任务/活动/商品 ===== -->
+    <DimensionTasks
+      v-if="isLoggedIn"
+      dimensionCode="action"
+      :tasks="dimensionTasks"
+      @taskClick="onTaskClick"
+      @moreTasks="goTasks" />
+
+    <DimensionActivities
+      v-if="isLoggedIn"
+      dimensionCode="action"
+      :activities="dimensionActivities"
+      @activityClick="goActivityDetail"
+      @moreActivities="goMoreActivities" />
+
+    <DimensionProducts
+      v-if="isLoggedIn"
+      dimensionCode="action"
+      :products="dimensionProducts"
+      @productClick="goProductDetail"
+      @moreProducts="goMoreProducts" />
 
     <!-- 功能入口(4个:活动、商品、课程) -->
     <view class="func-section" v-if="sectionVisible('func_entries')">
@@ -34,38 +67,6 @@
       </view>
     </view>
 
-    <!-- 热门活动 -->
-    <view class="section" v-if="sectionVisible('hot_activities')">
-      <view class="section-header">
-        <text class="section-title">🔥 热门活动</text>
-        <text class="section-more" @click="goMoreActivities">更多 ›</text>
-      </view>
-      <scroll-view scroll-x class="activity-scroll" show-scrollbar="false">
-        <view class="activity-card" v-for="act in hotActivities" :key="act.id" @click="goActivityDetail(act.id)">
-          <image class="activity-img" :src="act.image || '/static/default-activity.png'" mode="aspectFill" />
-          <view class="activity-info">
-            <text class="activity-name">{{ act.name }}</text>
-            <text class="activity-meta">{{ act.date }} · {{ act.location }}</text>
-          </view>
-        </view>
-      </scroll-view>
-    </view>
-
-    <!-- 推荐商品 -->
-    <view class="section" v-if="sectionVisible('recommended_products')">
-      <view class="section-header">
-        <text class="section-title">🛍️ 推荐商品</text>
-        <text class="section-more" @click="goMoreProducts">更多 ›</text>
-      </view>
-      <view class="product-list">
-        <view class="product-card" v-for="prod in recommendedProducts" :key="prod.id" @click="goProductDetail(prod.id)">
-          <image class="product-img" :src="prod.image || '/static/default-product.png'" mode="aspectFill" />
-          <text class="product-name line-clamp-2">{{ prod.name }}</text>
-          <text class="product-price">¥{{ prod.price }}</text>
-        </view>
-      </view>
-    </view>
-
     <!-- 底部占位 -->
     <view class="bottom-spacer"></view>
   </view>
@@ -73,35 +74,36 @@
 
 <script>
 import PageBanner from '../../components/PageBanner.vue'
-import { getVisibleSections, getEnergyOverview, getTodayTasks } from '../../utils/api.js'
+import LoginGuideCard from '../../components/LoginGuideCard.vue'
+import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
+import UserQuickEntry from '../../components/UserQuickEntry.vue'
+import DimensionTasks from '../../components/DimensionTasks.vue'
+import DimensionActivities from '../../components/DimensionActivities.vue'
+import DimensionProducts from '../../components/DimensionProducts.vue'
+import { getVisibleSections, getEnergyOverview, getFamilyEnergySandbox, getTodayTasksByCategory, getActivityList, getProductsByDomain, getChildren } from '../../utils/api.js'
 
 export default {
-  components: { PageBanner },
+  components: { PageBanner, LoginGuideCard, FamilyEnergyBar, UserQuickEntry, DimensionTasks, DimensionActivities, DimensionProducts },
   data() {
     return {
       isLoggedIn: false,
       role: null,
       currentChildId: null,
-      totalEnergy: null,
+      currentChildName: '',
+      userName: '',
+      children: [],
+      sandboxData: null,
+      dualDimension: null,
       visibleSections: [],
+      dimensionTasks: [],
+      dimensionActivities: [],
+      dimensionProducts: [],
       funcList: [
         { icon: '\u{1F3CB}', label: '任务', needLogin: true, page: '/pages/tasks/tasks' },
         { icon: '\u{1F3C0}', label: '活动', needLogin: false, page: '/pages/discover/index?type=activity' },
         { icon: '\u{1F6CD}', label: '商城', needLogin: false, page: '/pages/shop/index' },
         { icon: '\u{1F3EB}', label: '课程', needLogin: false, page: '/pages/discover/index?type=course' }
-      ],
-      hotActivities: [
-        { id: 1, name: '亲子户外徒步', date: '周六', location: '奥林匹克公园', image: '' },
-        { id: 2, name: '家庭健康跑', date: '周日', location: '朝阳公园', image: '' },
-        { id: 3, name: '儿童瑜伽体验', date: '下周六', location: '浠艾福中心', image: '' }
-      ],
-      recommendedProducts: [
-        { id: 1, name: '儿童智能手环', price: 299, image: '' },
-        { id: 2, name: '家庭健康管理套装', price: 599, image: '' },
-        { id: 3, name: '亲子运动礼盒', price: 399, image: '' },
-        { id: 4, name: '儿童营养补充品', price: 199, image: '' }
-      ],
-      todayTasks: []
+      ]
     }
   },
   onShow() {
@@ -110,57 +112,150 @@ export default {
     if (this.isLoggedIn) {
       this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
       this.currentChildId = uni.getStorageSync('currentChildId') || null
+      this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
     }
     this.loadSectionConfig()
     if (this.isLoggedIn) {
-      this.loadEnergyData()
-      this.loadTodayTasks()
+      this.loadChildren()
     }
   },
   methods: {
-    async loadSectionConfig() {
-      var baseSections = ['func_entries', 'hot_activities', 'recommended_products']
+    loadSectionConfig: function() {
+      var self = this
+      var baseSections = ['func_entries']
       if (!uni.getStorageSync('token')) {
-        this.visibleSections = baseSections
+        self.visibleSections = baseSections
         return
       }
       var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
-      try {
-        var res = await getVisibleSections({ pageKey: 'action', role: role })
+      getVisibleSections({ pageKey: 'action', role: role }).then(function(res) {
         if (res.code === 200 && res.data) {
           var keys = res.data.map(function(s) { return s.sectionKey })
           var merged = baseSections.slice()
           keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
-          this.visibleSections = merged
+          self.visibleSections = merged
         }
-      } catch (e) {
-        this.visibleSections = ['func_entries', 'hot_activities', 'recommended_products']
-      }
+      }).catch(function() {
+        self.visibleSections = ['func_entries']
+      })
     },
-    async loadEnergyData() {
-      var childId = this.currentChildId
-      if (!childId) return
-      try {
-        var res = await getEnergyOverview(childId)
+    loadChildren: function() {
+      var self = this
+      getChildren().then(function(res) {
+        if (res.code === 200 && res.data) {
+          self.children = res.data
+          var savedChildId = uni.getStorageSync('currentChildId')
+          var found = false
+          for (var i = 0; i < self.children.length; i++) {
+            if (self.children[i].childId === savedChildId) {
+              self.currentChildId = savedChildId
+              self.currentChildName = self.children[i].name || self.children[i].nickname || '孩子'
+              found = true
+              break
+            }
+          }
+          if (!found && self.children.length > 0) {
+            self.currentChildId = self.children[0].childId
+            self.currentChildName = self.children[0].name || self.children[0].nickname || '孩子'
+            uni.setStorageSync('currentChildId', self.currentChildId)
+          }
+          if (self.currentChildId) {
+            self.loadDimensionData()
+          }
+        }
+      }).catch(function(e) {
+        console.log('获取孩子列表失败', e)
+      })
+    },
+    loadDimensionData: function() {
+      this.loadEnergyData()
+      this.loadSandboxData()
+      this.loadDimensionTasks()
+      this.loadDimensionActivities()
+      this.loadDimensionProducts()
+    },
+    loadEnergyData: function() {
+      var self = this
+      if (!this.currentChildId) return
+      getEnergyOverview(this.currentChildId).then(function(res) {
+        if (res && res.data) {
+          var dims = res.data.dimensions
+          if (dims && dims.length > 0) {
+            for (var i = 0; i < dims.length; i++) {
+              if (dims[i].code === 'action') {
+                self.dualDimension = dims[i]
+                break
+              }
+            }
+          }
+        }
+      }).catch(function(e) {
+        console.log('获取能量概览失败', e)
+      })
+    },
+    loadSandboxData: function() {
+      var self = this
+      getFamilyEnergySandbox().then(function(res) {
+        if (res && res.data) {
+          self.sandboxData = res.data
+        }
+      }).catch(function() {})
+    },
+    loadDimensionTasks: function() {
+      var self = this
+      if (!this.currentChildId) return
+      getTodayTasksByCategory(this.currentChildId, 'action').then(function(res) {
         if (res && res.data) {
-          this.totalEnergy = res.data.totalEnergy || 0
+          self.dimensionTasks = Array.isArray(res.data) ? res.data.slice(0, 5) : []
         }
-      } catch (e) { console.log('获取能量概览失败', e) }
+      }).catch(function() { self.dimensionTasks = [] })
     },
-    async loadTodayTasks() {
-      var childId = this.currentChildId
-      if (!childId) return
-      try {
-        var res = await getTodayTasks(childId)
+    loadDimensionActivities: function() {
+      var self = this
+      getActivityList({ dimensionCode: 'action', page: 1, size: 3 }).then(function(res) {
         if (res && res.data) {
-          this.todayTasks = res.data.slice(0, 5)
+          var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
+          self.dimensionActivities = list.slice(0, 3)
         }
-      } catch (e) { console.log('获取今日任务失败', e) }
+      }).catch(function() { self.dimensionActivities = [] })
     },
-    sectionVisible(key) {
+    loadDimensionProducts: function() {
+      var self = this
+      getProductsByDomain('action', 1, 4).then(function(res) {
+        if (res && res.data) {
+          var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
+          self.dimensionProducts = list.slice(0, 4)
+        }
+      }).catch(function() { self.dimensionProducts = [] })
+    },
+    onChildChanged: function(child) {
+      this.currentChildId = child.childId
+      this.currentChildName = child.name || child.nickname || '孩子'
+      uni.setStorageSync('currentChildId', child.childId)
+      this.loadDimensionData()
+    },
+    scrollToSection: function(section) {
+      uni.pageScrollTo({ selector: '#' + section, duration: 300 })
+    },
+    sectionVisible: function(key) {
       return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
     },
-    onFuncClick(item) {
+    onTaskClick: function(task) {
+      uni.navigateTo({ url: '/pages/tasks/tasks' })
+    },
+    goActivityDetail: function(act) {
+      if (act && act.id) uni.navigateTo({ url: '/pages/discover/index?type=activity&id=' + act.id })
+    },
+    goMoreActivities: function() {
+      uni.navigateTo({ url: '/pages/discover/index?type=activity&dimension=action' })
+    },
+    goProductDetail: function(prod) {
+      if (prod && prod.id) uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + prod.id })
+    },
+    goMoreProducts: function() {
+      uni.navigateTo({ url: '/pages/discover/index?type=product&domain=action' })
+    },
+    onFuncClick: function(item) {
       if (item.needLogin && !this.isLoggedIn) {
         uni.showModal({
           title: '提示',
@@ -170,7 +265,6 @@ export default {
         return
       }
       if (item.page) {
-        // TabBar page uses switchTab, others use navigateTo
         var nativeTabs = ['/pages/tasks/tasks', '/pages/index/index', '/pages/body/index', '/pages/mind/index', '/pages/action/index', '/pages/profile/profile']
         if (nativeTabs.indexOf(item.page) !== -1) {
           uni.switchTab({ url: item.page })
@@ -179,19 +273,8 @@ export default {
         }
       }
     },
-    goMoreActivities() {},
-    goActivityDetail(id) {},
-    goMoreProducts() {},
-    goProductDetail(id) {
-      var token = uni.getStorageSync('token')
-      if (token) {
-        uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + id })
-      } else {
-        uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/action/index') })
-      }
-    },
-    goTasks() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
-    goLogin() { uni.navigateTo({ url: '/pages/login/login' }) }
+    goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
+    goLogin: function() { uni.navigateTo({ url: '/pages/login/login' }) }
   }
 }
 </script>
@@ -244,134 +327,6 @@ export default {
   font-weight: 500;
 }
 
-/* ===== 通用区块 ===== */
-.section {
-  margin: 20rpx 20rpx;
-}
-.section-header {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  margin-bottom: 20rpx;
-}
-.section-title {
-  font-size: 30rpx;
-  font-weight: bold;
-  color: #333;
-}
-.section-more {
-  font-size: 24rpx;
-  color: #999;
-}
-
-/* ===== 热门活动 ===== */
-.activity-scroll {
-  white-space: nowrap;
-}
-.activity-card {
-  display: inline-block;
-  width: 280rpx;
-  margin-right: 20rpx;
-  background: #fff;
-  border-radius: 16rpx;
-  overflow: hidden;
-  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
-}
-.activity-img {
-  width: 280rpx;
-  height: 180rpx;
-  background: #f0f0f0;
-}
-.activity-info {
-  padding: 16rpx;
-}
-.activity-name {
-  font-size: 26rpx;
-  font-weight: bold;
-  color: #333;
-  display: block;
-}
-.activity-meta {
-  font-size: 22rpx;
-  color: #999;
-  margin-top: 8rpx;
-  display: block;
-}
-
-/* ===== 推荐商品 ===== */
-.product-list {
-  display: flex;
-  flex-wrap: wrap;
-  gap: 20rpx;
-}
-.product-card {
-  width: calc(50% - 10rpx);
-  background: #fff;
-  border-radius: 16rpx;
-  overflow: hidden;
-  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
-}
-.product-img {
-  width: 100%;
-  height: 240rpx;
-  background: #f0f0f0;
-}
-.product-name {
-  font-size: 26rpx;
-  color: #333;
-  padding: 12rpx 16rpx 0;
-}
-.product-price {
-  font-size: 28rpx;
-  color: #F97316;
-  font-weight: bold;
-  padding: 8rpx 16rpx 16rpx;
-  display: block;
-}
-.line-clamp-2 {
-  overflow: hidden;
-  text-overflow: ellipsis;
-  display: -webkit-box;
-  -webkit-line-clamp: 2;
-  -webkit-box-orient: vertical;
-}
-
-/* ===== 今日任务 ===== */
-.task-wrap {
-  background: #fff;
-  border-radius: 16rpx;
-  overflow: hidden;
-  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
-}
-.task-item {
-  display: flex;
-  justify-content: space-between;
-  padding: 28rpx 24rpx;
-  border-bottom: 1rpx solid #f0f0f0;
-}
-.task-item:last-child {
-  border-bottom: none;
-}
-.task-name {
-  font-size: 26rpx;
-  color: #333;
-}
-.task-points {
-  font-size: 24rpx;
-  color: #F97316;
-}
-.task-empty {
-  background: #fff;
-  border-radius: 16rpx;
-  padding: 60rpx;
-  text-align: center;
-  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
-}
-.task-empty-text {
-  font-size: 26rpx;
-  color: #999;
-}
-
 /* ===== 底部 ===== */
 .bottom-spacer {
   height: 20rpx;

+ 267 - 0
cfc-frontend/pages/action/member-action-detail.vue

@@ -0,0 +1,267 @@
+<template>
+  <view class="detail-container">
+    <!-- 顶部导航 -->
+    <view class="nav-bar">
+      <view class="nav-back" @click="goBack">
+        <text class="nav-back-icon">&#x2190;</text>
+      </view>
+      <text class="nav-title">行 · 成员详情</text>
+    </view>
+
+    <!-- 五维能量条 -->
+    <FamilyEnergyBar
+      dimensionCode="action"
+      :sandboxData="sandboxData"
+      :dualDimension="dualDimension" />
+
+    <!-- 成员信息卡 -->
+    <view class="member-card" v-if="memberInfo">
+      <view class="member-avatar action-avatar">
+        <text class="avatar-text">{{ memberInfo.name && memberInfo.name.charAt(0) || '孩' }}</text>
+      </view>
+      <view class="member-info">
+        <text class="member-name">{{ memberInfo.name || '孩子' }}</text>
+        <text class="member-role">行动维度</text>
+      </view>
+      <view class="member-score" v-if="dualDimension">
+        <text class="score-value action-score">{{ dualDimension.energy || 0 }}</text>
+        <text class="score-label">能量值</text>
+      </view>
+    </view>
+
+    <!-- 今日任务 -->
+    <DimensionTasks
+      dimensionCode="action"
+      :tasks="dimensionTasks"
+      @taskClick="onTaskClick"
+      @moreTasks="goTasks" />
+
+    <!-- 活动 -->
+    <DimensionActivities
+      dimensionCode="action"
+      :activities="dimensionActivities"
+      @activityClick="goActivityDetail"
+      @moreActivities="goMoreActivities" />
+
+    <!-- 商品 -->
+    <DimensionProducts
+      dimensionCode="action"
+      :products="dimensionProducts"
+      @productClick="goProductDetail"
+      @moreProducts="goMoreProducts" />
+
+    <!-- 底部占位 -->
+    <view class="bottom-spacer"></view>
+  </view>
+</template>
+
+<script>
+import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
+import DimensionTasks from '../../components/DimensionTasks.vue'
+import DimensionActivities from '../../components/DimensionActivities.vue'
+import DimensionProducts from '../../components/DimensionProducts.vue'
+import { getEnergyOverview, getFamilyEnergySandbox, getTodayTasksByCategory, getActivityList, getProductsByDomain, getChildren } from '../../utils/api.js'
+
+export default {
+  components: { FamilyEnergyBar, DimensionTasks, DimensionActivities, DimensionProducts },
+  data() {
+    return {
+      childId: null,
+      memberInfo: null,
+      sandboxData: null,
+      dualDimension: null,
+      dimensionTasks: [],
+      dimensionActivities: [],
+      dimensionProducts: []
+    }
+  },
+  onLoad: function(options) {
+    this.childId = options.childId || uni.getStorageSync('currentChildId') || null
+  },
+  onShow: function() {
+    this.loadChildren()
+    this.loadSandboxData()
+    if (this.childId) {
+      this.loadEnergyData()
+      this.loadDimensionTasks()
+      this.loadDimensionActivities()
+      this.loadDimensionProducts()
+    }
+  },
+  methods: {
+    loadChildren: function() {
+      var self = this
+      getChildren().then(function(res) {
+        if (res.code === 200 && res.data) {
+          for (var i = 0; i < res.data.length; i++) {
+            if (res.data[i].childId === self.childId) {
+              self.memberInfo = res.data[i]
+              break
+            }
+          }
+          if (!self.memberInfo && res.data.length > 0) {
+            self.memberInfo = res.data[0]
+            self.childId = res.data[0].childId
+          }
+        }
+      }).catch(function() {})
+    },
+    loadSandboxData: function() {
+      var self = this
+      getFamilyEnergySandbox().then(function(res) {
+        if (res && res.data) self.sandboxData = res.data
+      }).catch(function() {})
+    },
+    loadEnergyData: function() {
+      var self = this
+      getEnergyOverview(this.childId).then(function(res) {
+        if (res && res.data) {
+          var dims = res.data.dimensions
+          if (dims && dims.length > 0) {
+            for (var i = 0; i < dims.length; i++) {
+              if (dims[i].code === 'action') {
+                self.dualDimension = dims[i]
+                break
+              }
+            }
+          }
+        }
+      }).catch(function() {})
+    },
+    loadDimensionTasks: function() {
+      var self = this
+      getTodayTasksByCategory(this.childId, 'action').then(function(res) {
+        if (res && res.data) {
+          self.dimensionTasks = Array.isArray(res.data) ? res.data.slice(0, 5) : []
+        }
+      }).catch(function() { self.dimensionTasks = [] })
+    },
+    loadDimensionActivities: function() {
+      var self = this
+      getActivityList({ dimensionCode: 'action', page: 1, size: 3 }).then(function(res) {
+        if (res && res.data) {
+          var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
+          self.dimensionActivities = list.slice(0, 3)
+        }
+      }).catch(function() { self.dimensionActivities = [] })
+    },
+    loadDimensionProducts: function() {
+      var self = this
+      getProductsByDomain('action', 1, 4).then(function(res) {
+        if (res && res.data) {
+          var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
+          self.dimensionProducts = list.slice(0, 4)
+        }
+      }).catch(function() { self.dimensionProducts = [] })
+    },
+    onTaskClick: function(task) {
+      uni.navigateTo({ url: '/pages/tasks/tasks' })
+    },
+    goActivityDetail: function(act) {
+      if (act && act.id) uni.navigateTo({ url: '/pages/discover/index?type=activity&id=' + act.id })
+    },
+    goMoreActivities: function() {
+      uni.navigateTo({ url: '/pages/discover/index?type=activity&dimension=action' })
+    },
+    goProductDetail: function(prod) {
+      if (prod && prod.id) uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + prod.id })
+    },
+    goMoreProducts: function() {
+      uni.navigateTo({ url: '/pages/discover/index?type=product&domain=action' })
+    },
+    goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
+    goBack: function() { uni.navigateBack() }
+  }
+}
+</script>
+
+<style scoped>
+.detail-container {
+  min-height: 100vh;
+  background: #f5f7fa;
+  padding-bottom: 40rpx;
+}
+.nav-bar {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  padding: 20rpx 30rpx;
+  background: #fff;
+}
+.nav-back {
+  padding: 10rpx;
+}
+.nav-back-icon {
+  font-size: 36rpx;
+  color: #333;
+}
+.nav-title {
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #333;
+  margin-left: 16rpx;
+}
+.member-card {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  margin: 20rpx 30rpx;
+  background: #fff;
+  border-radius: 20rpx;
+  padding: 24rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+}
+.member-avatar {
+  width: 80rpx;
+  height: 80rpx;
+  border-radius: 40rpx;
+  background: linear-gradient(135deg, #4CAF50, #81C784);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  margin-right: 20rpx;
+}
+.action-avatar {
+  background: linear-gradient(135deg, #10B981, #34D399);
+}
+.avatar-text {
+  font-size: 32rpx;
+  color: #fff;
+  font-weight: bold;
+}
+.member-info {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+}
+.member-name {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+}
+.member-role {
+  font-size: 24rpx;
+  color: #999;
+  margin-top: 4rpx;
+}
+.member-score {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+.score-value {
+  font-size: 40rpx;
+  font-weight: bold;
+  color: #4CAF50;
+}
+.action-score {
+  color: #10B981;
+}
+.score-label {
+  font-size: 22rpx;
+  color: #999;
+}
+.bottom-spacer {
+  height: 40rpx;
+}
+</style>

+ 551 - 0
cfc-frontend/pages/ai/chat.vue

@@ -0,0 +1,551 @@
+<template>
+  <view class="chat-container">
+    <!-- 导航栏 -->
+    <view class="chat-nav">
+      <view class="nav-back" @click="goBack">
+        <text class="nav-back-icon">‹</text>
+      </view>
+      <text class="nav-title">AI 家庭助手</text>
+      <view class="nav-actions">
+        <text class="nav-action" @click="showConversations = !showConversations">☰</text>
+      </view>
+    </view>
+
+    <!-- 会话列表(侧拉) -->
+    <view class="conv-overlay" v-if="showConversations" @click="showConversations = false"></view>
+    <view class="conv-sidebar" :class="{ 'conv-sidebar-open': showConversations }">
+      <view class="conv-header">
+        <text class="conv-header-title">会话列表</text>
+        <text class="conv-header-new" @click="newConversation">+ 新会话</text>
+      </view>
+      <scroll-view class="conv-list" scroll-y>
+        <view class="conv-item" v-for="conv in conversations" :key="conv.id"
+          :class="{ 'conv-item-active': conv.id === currentConversationId }"
+          @click="switchConversation(conv.id)">
+          <text class="conv-item-name">{{ conv.name || '新会话' }}</text>
+          <text class="conv-item-time">{{ formatTime(conv.updated_at) }}</text>
+        </view>
+        <BaseEmpty v-if="conversations.length === 0" text="暂无会话" icon="💬" />
+      </scroll-view>
+    </view>
+
+    <!-- 消息列表 -->
+    <scroll-view class="message-list" scroll-y :scroll-into-view="scrollToId" scroll-with-animation
+      @scrolltoupper="loadMoreMessages" id="messageList">
+      <view class="message-list-inner">
+        <view class="welcome-card" v-if="messages.length === 0 && !sending">
+          <view class="welcome-icon">🤖</view>
+          <text class="welcome-title">你好!我是你的家庭助手</text>
+          <text class="welcome-desc">我可以帮你了解孩子的成长情况,比如:</text>
+          <view class="welcome-suggestions">
+            <view class="welcome-suggestion" @click="quickQuestion('小明最近任务完成怎么样?')">
+              <text class="suggestion-icon">📋</text>
+              <text class="suggestion-text">小明最近任务完成怎么样?</text>
+            </view>
+            <view class="welcome-suggestion" @click="quickQuestion('我家孩子的能量评分怎么样?')">
+              <text class="suggestion-icon">⚡</text>
+              <text class="suggestion-text">孩子的能量评分怎么样?</text>
+            </view>
+            <view class="welcome-suggestion" @click="quickQuestion('今天有什么需要我做的事情?')">
+              <text class="suggestion-icon">✅</text>
+              <text class="suggestion-text">今天有什么需要我做的事情?</text>
+            </view>
+          </view>
+        </view>
+
+        <view class="message-group" v-for="(msg, idx) in messages" :key="msg.id || idx">
+          <!-- 用户消息 -->
+          <view class="message message-user" v-if="msg.query">
+            <view class="message-bubble user-bubble">{{ msg.query }}</view>
+          </view>
+          <!-- AI 回复 -->
+          <view class="message message-ai" v-if="msg.answer">
+            <view class="message-avatar">🤖</view>
+            <view class="message-bubble ai-bubble">{{ msg.answer }}</view>
+          </view>
+        </view>
+
+        <!-- 加载中 -->
+        <view class="message message-ai" v-if="sending">
+          <view class="message-avatar">🤖</view>
+          <view class="message-bubble ai-bubble typing">
+            <text class="typing-dot">.</text>
+            <text class="typing-dot">.</text>
+            <text class="typing-dot">.</text>
+          </view>
+        </view>
+
+        <view id="scrollBottom"></view>
+      </view>
+    </scroll-view>
+
+    <!-- 输入区 -->
+    <view class="chat-input-area">
+      <view class="chat-input-wrap">
+        <input class="chat-input" v-model="inputText" placeholder="问我关于家庭和孩子的问题..."
+          :disabled="sending" @confirm="sendMessage" confirm-type="send" />
+      </view>
+      <view class="chat-send-btn" :class="{ 'chat-send-active': inputText.trim() }"
+        @click="sendMessage">
+        <text class="send-icon">➤</text>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+import { aiSendMessage, aiGetConversations, aiGetMessages, aiDeleteConversation } from '../../utils/api.js'
+import BaseEmpty from '../../components/BaseEmpty.vue'
+
+export default {
+  components: { BaseEmpty },
+  data() {
+    return {
+      inputText: '',
+      messages: [],
+      conversations: [],
+      currentConversationId: '',
+      sending: false,
+      showConversations: false,
+      scrollToId: '',
+      pageLoaded: false
+    }
+  },
+  onLoad() {
+    this.loadConversations()
+  },
+  onShow() {
+    if (this.pageLoaded) {
+      this.loadConversations()
+    }
+    this.pageLoaded = true
+  },
+  methods: {
+    goBack() {
+      uni.navigateBack()
+    },
+
+    async loadConversations() {
+      try {
+        const res = await aiGetConversations()
+        this.conversations = res.data || []
+      } catch (e) {
+        console.log('加载会话列表失败', e)
+      }
+    },
+
+    async switchConversation(convId) {
+      this.currentConversationId = convId
+      this.showConversations = false
+      this.messages = []
+      this.$nextTick(() => {
+        this.scrollToBottom()
+      })
+      try {
+        const res = await aiGetMessages({ conversationId: convId })
+        this.messages = res.data || []
+        this.$nextTick(() => {
+          this.scrollToBottom()
+        })
+      } catch (e) {
+        console.log('加载消息失败', e)
+      }
+    },
+
+    newConversation() {
+      this.currentConversationId = ''
+      this.showConversations = false
+      this.messages = []
+      this.inputText = ''
+      this.$nextTick(() => {
+        this.scrollToBottom()
+      })
+    },
+
+    async sendMessage() {
+      const text = this.inputText.trim()
+      if (!text || this.sending) return
+
+      // 立即显示用户消息
+      const tempMsg = { id: 'temp_' + Date.now(), query: text, answer: '' }
+      this.messages.push(tempMsg)
+      this.inputText = ''
+      this.sending = true
+
+      this.$nextTick(() => {
+        this.scrollToBottom()
+      })
+
+      try {
+        const res = await aiSendMessage({
+          query: text,
+          conversationId: this.currentConversationId
+        })
+        const data = res.data || {}
+
+        // 更新最后一条消息的回复
+        const lastMsg = this.messages[this.messages.length - 1]
+        if (lastMsg) {
+          lastMsg.answer = data.answer || ''
+        }
+
+        // 更新 conversationId(新建会话时 Dify 返回)
+        if (data.conversationId && !this.currentConversationId) {
+          this.currentConversationId = data.conversationId
+          // 刷新会话列表
+          this.loadConversations()
+        }
+      } catch (e) {
+        // 显示错误
+        const lastMsg = this.messages[this.messages.length - 1]
+        if (lastMsg) {
+          lastMsg.answer = '抱歉,我暂时无法回答,请稍后再试。'
+        }
+      } finally {
+        this.sending = false
+        this.$nextTick(() => {
+          this.scrollToBottom()
+        })
+      }
+    },
+
+    quickQuestion(text) {
+      this.inputText = text
+      this.sendMessage()
+    },
+
+    loadMoreMessages() {
+      // 分页加载历史(当前简化)
+    },
+
+    scrollToBottom() {
+      this.scrollToId = 'scrollBottom'
+    },
+
+    formatTime(timestamp) {
+      if (!timestamp) return ''
+      const d = new Date(timestamp * 1000)
+      const now = new Date()
+      const diff = now - d
+      if (diff < 86400000) {
+        return d.getHours().toString().padStart(2, '0') + ':' + d.getMinutes().toString().padStart(2, '0')
+      }
+      return (d.getMonth() + 1) + '/' + d.getDate()
+    }
+  }
+}
+</script>
+
+<style scoped>
+.chat-container {
+  display: flex;
+  flex-direction: column;
+  height: 100vh;
+  background: var(--bg, #FFF7ED);
+  position: relative;
+}
+
+/* 导航栏 */
+.chat-nav {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 88rpx 24rpx 16rpx;
+  background: #fff;
+  border-bottom: 1rpx solid var(--border-light, #E2E8F0);
+  position: relative;
+  z-index: 100;
+}
+
+.nav-back {
+  width: 60rpx;
+  height: 60rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.nav-back-icon {
+  font-size: 40rpx;
+  color: var(--text, #1E293B);
+  font-weight: 600;
+}
+
+.nav-title {
+  font-size: 32rpx;
+  font-weight: 600;
+  color: var(--text, #1E293B);
+}
+
+.nav-actions {
+  width: 60rpx;
+  height: 60rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.nav-action {
+  font-size: 36rpx;
+  color: var(--text-secondary, #64748B);
+}
+
+/* 会话列表侧拉 */
+.conv-overlay {
+  position: fixed;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  background: rgba(0,0,0,0.3);
+  z-index: 200;
+}
+
+.conv-sidebar {
+  position: fixed;
+  top: 0;
+  right: -500rpx;
+  width: 460rpx;
+  height: 100vh;
+  background: #fff;
+  z-index: 210;
+  transition: right 0.3s ease;
+  display: flex;
+  flex-direction: column;
+}
+
+.conv-sidebar-open {
+  right: 0;
+}
+
+.conv-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 100rpx 24rpx 16rpx;
+  border-bottom: 1rpx solid var(--border-light, #E2E8F0);
+}
+
+.conv-header-title {
+  font-size: 28rpx;
+  font-weight: 600;
+  color: var(--text, #1E293B);
+}
+
+.conv-header-new {
+  font-size: 24rpx;
+  color: var(--color-primary, #5B9BD5);
+  font-weight: 500;
+}
+
+.conv-list {
+  flex: 1;
+  overflow-y: auto;
+}
+
+.conv-item {
+  padding: 20rpx 24rpx;
+  border-bottom: 1rpx solid var(--border-light, #E2E8F0);
+}
+
+.conv-item-active {
+  background: rgba(91, 155, 213, 0.06);
+}
+
+.conv-item-name {
+  font-size: 26rpx;
+  color: var(--text, #1E293B);
+  display: block;
+  margin-bottom: 6rpx;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.conv-item-time {
+  font-size: 20rpx;
+  color: var(--muted, #94A3B8);
+}
+
+/* 消息列表 */
+.message-list {
+  flex: 1;
+  overflow-y: auto;
+  padding: 20rpx 24rpx;
+}
+
+.message-list-inner {
+  min-height: 100%;
+}
+
+/* 欢迎卡片 */
+.welcome-card {
+  text-align: center;
+  padding: 60rpx 20rpx 40rpx;
+}
+
+.welcome-icon {
+  font-size: 80rpx;
+  margin-bottom: 20rpx;
+}
+
+.welcome-title {
+  font-size: 32rpx;
+  font-weight: 600;
+  color: var(--text, #1E293B);
+  display: block;
+  margin-bottom: 12rpx;
+}
+
+.welcome-desc {
+  font-size: 24rpx;
+  color: var(--text-secondary, #64748B);
+  display: block;
+  margin-bottom: 32rpx;
+}
+
+.welcome-suggestions {
+  display: flex;
+  flex-direction: column;
+  gap: 16rpx;
+  padding: 0 20rpx;
+}
+
+.welcome-suggestion {
+  display: flex;
+  align-items: center;
+  background: #fff;
+  padding: 20rpx 24rpx;
+  border-radius: 16rpx;
+  box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
+}
+
+.suggestion-icon {
+  font-size: 28rpx;
+  margin-right: 12rpx;
+}
+
+.suggestion-text {
+  font-size: 24rpx;
+  color: var(--text, #1E293B);
+}
+
+/* 消息 */
+.message {
+  margin-bottom: 24rpx;
+}
+
+.message-user {
+  display: flex;
+  justify-content: flex-end;
+}
+
+.message-ai {
+  display: flex;
+  align-items: flex-start;
+}
+
+.message-avatar {
+  width: 48rpx;
+  height: 48rpx;
+  font-size: 32rpx;
+  margin-right: 12rpx;
+  flex-shrink: 0;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.message-bubble {
+  max-width: 70%;
+  padding: 16rpx 20rpx;
+  font-size: 26rpx;
+  line-height: 1.6;
+  border-radius: 16rpx;
+  word-break: break-word;
+}
+
+.user-bubble {
+  background: var(--color-primary, #5B9BD5);
+  color: #fff;
+  border-bottom-right-radius: 4rpx;
+}
+
+.ai-bubble {
+  background: #fff;
+  color: var(--text, #1E293B);
+  border-bottom-left-radius: 4rpx;
+  box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
+}
+
+/* 输入区 */
+.chat-input-area {
+  display: flex;
+  align-items: center;
+  padding: 16rpx 24rpx;
+  padding-bottom: calc(16rpx + env(safe-area-inset-bottom));
+  background: #fff;
+  border-top: 1rpx solid var(--border-light, #E2E8F0);
+}
+
+.chat-input-wrap {
+  flex: 1;
+  background: var(--bg, #FFF7ED);
+  border-radius: 40rpx;
+  padding: 0 24rpx;
+  margin-right: 16rpx;
+}
+
+.chat-input {
+  height: 72rpx;
+  font-size: 26rpx;
+  color: var(--text, #1E293B);
+}
+
+.chat-send-btn {
+  width: 72rpx;
+  height: 72rpx;
+  border-radius: 50%;
+  background: var(--border-light, #E2E8F0);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-shrink: 0;
+}
+
+.chat-send-active {
+  background: var(--color-primary, #5B9BD5);
+}
+
+.send-icon {
+  font-size: 28rpx;
+  color: #fff;
+}
+
+/* 打字动画 */
+.typing {
+  display: flex;
+  align-items: center;
+  gap: 4rpx;
+  min-height: 40rpx;
+}
+
+.typing-dot {
+  font-size: 40rpx;
+  line-height: 1;
+  animation: typingBounce 1.4s infinite;
+}
+
+.typing-dot:nth-child(2) {
+  animation-delay: 0.2s;
+}
+
+.typing-dot:nth-child(3) {
+  animation-delay: 0.4s;
+}
+
+@keyframes typingBounce {
+  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
+  30% { opacity: 1; transform: translateY(-8rpx); }
+}
+</style>

+ 517 - 0
cfc-frontend/pages/body/checkin.vue

@@ -0,0 +1,517 @@
+<template>
+  <view class="checkin-container">
+    <!-- 顶部导航 -->
+    <view class="nav-bar">
+      <text class="nav-back" @click="goBack">‹ 返回</text>
+      <text class="nav-title">健康打卡</text>
+      <view class="nav-placeholder"></view>
+    </view>
+
+    <!-- 能量奖励提示 -->
+    <view class="energy-tip">
+      <text class="tip-icon">⚡</text>
+      <text class="tip-text">每次打卡可获得 5 能量值</text>
+    </view>
+
+    <!-- 打卡表单 -->
+    <view class="form-section">
+      <view class="form-title">今日打卡</view>
+
+      <!-- 日期选择 -->
+      <view class="form-item">
+        <text class="form-label">打卡日期</text>
+        <view class="date-display" @click="pickDate">
+          <text>{{ checkinDate }}</text>
+          <text class="date-arrow">›</text>
+        </view>
+      </view>
+
+      <!-- 行为选择 -->
+      <view class="form-item">
+        <text class="form-label">健康行为</text>
+        <view class="behaviors-grid">
+          <view
+            class="behavior-chip"
+            v-for="bh in behaviorOptions"
+            :key="bh.value"
+            :class="{ 'behavior-selected': selectedBehaviors.indexOf(bh.value) !== -1 }"
+            @click="toggleBehavior(bh.value)"
+          >
+            <text>{{ bh.label }}</text>
+          </view>
+        </view>
+      </view>
+
+      <!-- 心情选择 -->
+      <view class="form-item">
+        <text class="form-label">今日心情</text>
+        <view class="mood-row">
+          <view
+            class="mood-item"
+            v-for="m in moodOptions"
+            :key="m.value"
+            :class="{ 'mood-selected': selectedMood === m.value }"
+            @click="selectMood(m.value)"
+          >
+            <text class="mood-emoji">{{ m.emoji }}</text>
+            <text class="mood-label">{{ m.label }}</text>
+          </view>
+        </view>
+      </view>
+
+      <!-- 备注 -->
+      <view class="form-item">
+        <text class="form-label">备注(选填)</text>
+        <textarea
+          class="note-input"
+          v-model="note"
+          placeholder="记录今天的健康小故事..."
+          maxlength="200"
+        ></textarea>
+      </view>
+
+      <!-- 提交按钮 -->
+      <view class="submit-btn" @click="doCheckin">
+        <text>提交打卡</text>
+      </view>
+    </view>
+
+    <!-- 打卡记录 -->
+    <view class="history-section">
+      <view class="section-title">打卡记录</view>
+      <view class="history-list">
+        <view class="history-item" v-for="item in checkinList" :key="item.id">
+          <view class="history-left">
+            <text class="history-date">{{ formatDate(item.checkinDate) }}</text>
+            <view class="history-behaviors">
+              <text class="bh-tag" v-for="bh in parseBehaviors(item.behaviors)" :key="bh">{{ bh }}</text>
+            </view>
+          </view>
+          <view class="history-right">
+            <text class="history-mood">{{ getMoodEmoji(item.mood) }}</text>
+            <text class="history-energy">+{{ item.earnedEnergy || 5 }}⚡</text>
+          </view>
+        </view>
+        <view class="history-empty" v-if="checkinList.length === 0 && !loadingHistory">
+          <text>还没有打卡记录,快来打卡吧!</text>
+        </view>
+      </view>
+    </view>
+
+    <view class="bottom-spacer"></view>
+  </view>
+</template>
+
+<script>
+const BASE_URL = 'http://localhost:8080'
+
+const healthRequest = function(url, data) {
+  var token = uni.getStorageSync('token')
+  return new Promise(function(resolve, reject) {
+    uni.request({
+      url: BASE_URL + url,
+      method: 'POST',
+      data: data,
+      header: {
+        'Content-Type': 'application/json',
+        'Authorization': token ? 'Bearer ' + token : ''
+      },
+      success: function(res) {
+        if (res.data.code === 200) {
+          resolve(res.data)
+        } else {
+          reject(res.data)
+        }
+      },
+      fail: function(err) {
+        reject(err)
+      }
+    })
+  })
+}
+
+export default {
+  data() {
+    return {
+      childId: null,
+      checkinDate: '',
+      selectedBehaviors: [],
+      selectedMood: '',
+      note: '',
+      checkinList: [],
+      loadingHistory: false,
+      behaviorOptions: [
+        { label: '运动30分钟', value: '运动30分钟' },
+        { label: '喝足8杯水', value: '喝足8杯水' },
+        { label: '按时睡觉', value: '按时睡觉' },
+        { label: '均衡饮食', value: '均衡饮食' },
+        { label: '户外活动', value: '户外活动2小时' },
+        { label: '视力保护', value: '视力保护' },
+        { label: '情绪愉快', value: '情绪愉快' },
+        { label: '无零食', value: '无零食' }
+      ],
+      moodOptions: [
+        { label: '开心', value: 'happy', emoji: '😊' },
+        { label: '平静', value: 'normal', emoji: '😐' },
+        { label: '低落', value: 'sad', emoji: '😔' },
+        { label: '烦躁', value: 'angry', emoji: '😤' },
+        { label: '不适', value: 'sick', emoji: '🤒' }
+      ]
+    }
+  },
+  onLoad: function(options) {
+    this.childId = options.childId ? parseInt(options.childId) : null
+    this.checkinDate = this.formatDate(new Date())
+    this.loadHistory()
+  },
+  methods: {
+    pickDate: function() {
+      var self = this
+      var now = new Date()
+      uni.chooseDate({
+        success: function(res) {
+          self.checkinDate = res.date
+        }
+      })
+    },
+    toggleBehavior: function(value) {
+      var idx = this.selectedBehaviors.indexOf(value)
+      if (idx === -1) {
+        this.selectedBehaviors.push(value)
+      } else {
+        this.selectedBehaviors.splice(idx, 1)
+      }
+    },
+    selectMood: function(value) {
+      this.selectedMood = value
+    },
+    doCheckin: function() {
+      if (this.selectedBehaviors.length === 0) {
+        uni.showToast({ title: '请至少选择一项健康行为', icon: 'none' })
+        return
+      }
+      if (!this.childId) {
+        uni.showToast({ title: '孩子ID无效', icon: 'none' })
+        return
+      }
+      var self = this
+      uni.showLoading({ title: '提交中...' })
+      healthRequest('/api/health/checkin/create', {
+        childId: this.childId,
+        checkinDate: this.checkinDate,
+        behaviors: this.selectedBehaviors,
+        note: this.note,
+        mood: this.selectedMood
+      }).then(function(res) {
+        uni.hideLoading()
+        uni.showModal({
+          title: '打卡成功',
+          content: '恭喜获得 5 能量值!',
+          showCancel: false
+        })
+        // Reset form
+        self.selectedBehaviors = []
+        self.selectedMood = ''
+        self.note = ''
+        self.checkinDate = self.formatDate(new Date())
+        // Reload history
+        self.loadHistory()
+      }).catch(function(e) {
+        uni.hideLoading()
+        if (e && e.message && e.message.indexOf('404') !== -1) {
+          uni.showToast({ title: '健康打卡功能即将上线', icon: 'none' })
+        } else {
+          uni.showToast({ title: '打卡失败,请重试', icon: 'none' })
+        }
+      })
+    },
+    loadHistory: function() {
+      if (!this.childId) return
+      var self = this
+      this.loadingHistory = true
+      healthRequest('/api/health/checkin/list', {
+        childId: this.childId
+      }).then(function(res) {
+        self.loadingHistory = false
+        if (res.data) {
+          self.checkinList = res.data
+        }
+      }).catch(function(e) {
+        self.loadingHistory = false
+        console.log('获取打卡记录失败', e)
+      })
+    },
+    parseBehaviors: function(behaviorsStr) {
+      if (!behaviorsStr) return []
+      try {
+        if (typeof behaviorsStr === 'string') {
+          return JSON.parse(behaviorsStr)
+        }
+        return behaviorsStr
+      } catch (e) {
+        if (behaviorsStr.indexOf && behaviorsStr.indexOf('[') === 0) {
+          try { return JSON.parse(behaviorsStr) } catch (e2) { return [behaviorsStr] }
+        }
+        return [behaviorsStr]
+      }
+    },
+    getMoodEmoji: function(mood) {
+      var map = { happy: '😊', normal: '😐', sad: '😔', angry: '😤', sick: '🤒' }
+      return map[mood] || '😐'
+    },
+    formatDate: function(date) {
+      if (!date) return ''
+      if (typeof date === 'string') {
+        try { date = new Date(date) } catch (e) { return date }
+      }
+      var y = date.getFullYear()
+      var m = ('' + (date.getMonth() + 1)).padStart(2, '0')
+      var d = ('' + date.getDate()).padStart(2, '0')
+      return y + '-' + m + '-' + d
+    },
+    goBack: function() {
+      uni.navigateBack()
+    }
+  }
+}
+</script>
+
+<style scoped>
+.checkin-container {
+  min-height: 100vh;
+  background: #f5f7fa;
+  padding-bottom: 60rpx;
+}
+
+/* ===== 导航栏 ===== */
+.nav-bar {
+  position: sticky;
+  top: 0;
+  background: #fff;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+  padding: 20rpx 30rpx;
+  box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
+  z-index: 100;
+}
+.nav-back {
+  font-size: 32rpx;
+  color: #5B9BD5;
+}
+.nav-title {
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #333;
+}
+.nav-placeholder {
+  width: 80rpx;
+}
+
+/* ===== 能量提示 ===== */
+.energy-tip {
+  margin: 20rpx 30rpx;
+  background: linear-gradient(135deg, #FFF8E1, #FFECB3);
+  border-radius: 16rpx;
+  padding: 16rpx 24rpx;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+}
+.tip-icon {
+  font-size: 32rpx;
+  margin-right: 12rpx;
+}
+.tip-text {
+  font-size: 26rpx;
+  color: #E65100;
+}
+
+/* ===== 表单 ===== */
+.form-section {
+  margin: 20rpx 30rpx;
+  background: #fff;
+  border-radius: 20rpx;
+  padding: 24rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+}
+.form-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+  margin-bottom: 24rpx;
+}
+.form-item {
+  margin-bottom: 28rpx;
+}
+.form-label {
+  font-size: 26rpx;
+  color: #666;
+  display: block;
+  margin-bottom: 12rpx;
+}
+
+/* 日期 */
+.date-display {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+  background: #f5f7fa;
+  border-radius: 12rpx;
+  padding: 16rpx 20rpx;
+  font-size: 28rpx;
+  color: #333;
+}
+.date-arrow {
+  font-size: 32rpx;
+  color: #ccc;
+}
+
+/* 行为选择 */
+.behaviors-grid {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+}
+.behavior-chip {
+  background: #f0f0f0;
+  color: #666;
+  font-size: 24rpx;
+  padding: 12rpx 20rpx;
+  border-radius: 24rpx;
+  margin-right: 16rpx;
+  margin-bottom: 12rpx;
+}
+.behavior-selected {
+  background: #E8F5E9;
+  color: #2E7D32;
+}
+
+/* 心情 */
+.mood-row {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+}
+.mood-item {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding: 12rpx 16rpx;
+  border-radius: 12rpx;
+}
+.mood-selected {
+  background: #FFF8E1;
+}
+.mood-emoji {
+  font-size: 40rpx;
+}
+.mood-label {
+  font-size: 20rpx;
+  color: #666;
+  margin-top: 4rpx;
+}
+
+/* 备注 */
+.note-input {
+  width: 100%;
+  box-sizing: border-box;
+  background: #f5f7fa;
+  border-radius: 12rpx;
+  padding: 16rpx;
+  font-size: 28rpx;
+  color: #333;
+  min-height: 120rpx;
+}
+
+/* 提交按钮 */
+.submit-btn {
+  background: linear-gradient(135deg, #4CAF50, #66BB6A);
+  color: #fff;
+  font-size: 32rpx;
+  font-weight: bold;
+  text-align: center;
+  padding: 24rpx;
+  border-radius: 40rpx;
+  margin-top: 16rpx;
+}
+.submit-btn:active {
+  opacity: 0.8;
+}
+
+/* ===== 历史记录 ===== */
+.history-section {
+  margin: 30rpx 30rpx 0;
+}
+.section-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+  margin-bottom: 16rpx;
+}
+.history-list {
+  display: flex;
+  flex-direction: column;
+}
+.history-item {
+  background: #fff;
+  border-radius: 16rpx;
+  padding: 20rpx;
+  margin-bottom: 12rpx;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+  box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
+}
+.history-left {
+  flex: 1;
+}
+.history-date {
+  font-size: 26rpx;
+  color: #333;
+  font-weight: 500;
+  display: block;
+  margin-bottom: 8rpx;
+}
+.history-behaviors {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+}
+.bh-tag {
+  background: #E3F2FD;
+  color: #1565C0;
+  font-size: 20rpx;
+  padding: 4rpx 12rpx;
+  border-radius: 12rpx;
+  margin-right: 8rpx;
+  margin-bottom: 4rpx;
+}
+.history-right {
+  display: flex;
+  flex-direction: column;
+  align-items: flex-end;
+}
+.history-mood {
+  font-size: 32rpx;
+}
+.history-energy {
+  font-size: 22rpx;
+  color: #4CAF50;
+  margin-top: 4rpx;
+}
+.history-empty {
+  text-align: center;
+  padding: 40rpx;
+  color: #999;
+  font-size: 26rpx;
+}
+
+/* ===== 底部 ===== */
+.bottom-spacer {
+  height: 60rpx;
+}
+</style>

+ 439 - 0
cfc-frontend/pages/body/health-report.vue

@@ -0,0 +1,439 @@
+<template>
+  <view class="report-container">
+    <!-- 顶部导航 -->
+    <view class="nav-bar">
+      <text class="nav-back" @click="goBack">‹ 返回</text>
+      <text class="nav-title">健康报告详情</text>
+      <view class="nav-placeholder"></view>
+    </view>
+
+    <!-- 报告头部 -->
+    <view class="report-header" v-if="report">
+      <view class="report-type-tag">{{ reportTypeLabel }}</view>
+      <view class="report-scores">
+        <view class="score-item">
+          <view class="score-circle-lg">
+            <text class="score-num">{{ report.overallScore || '--' }}</text>
+            <text class="score-unit">分</text>
+          </view>
+          <text class="score-label">综合评分</text>
+        </view>
+        <view class="score-item" v-if="report.gutHealthScore">
+          <view class="score-circle-lg score-circle-green">
+            <text class="score-num">{{ report.gutHealthScore }}</text>
+            <text class="score-unit">分</text>
+          </view>
+          <text class="score-label">肠道健康</text>
+        </view>
+      </view>
+      <view class="report-info-row" v-if="report.gutAge || report.gutType">
+        <text class="info-chip" v-if="report.gutAge">肠道年龄:{{ report.gutAge }}</text>
+        <text class="info-chip" v-if="report.gutType">肠道分型:{{ report.gutType }}</text>
+      </view>
+      <text class="report-date">报告日期:{{ formatDate(report.reportDate) }}</text>
+    </view>
+
+    <!-- 指标列表 -->
+    <view class="section">
+      <view class="section-title">
+        <text>指标明细</text>
+        <text class="section-sub">共 {{ indicators.length }} 项</text>
+      </view>
+
+      <!-- 按分类分组 -->
+      <view class="category-group" v-for="group in groupedIndicators" :key="group.name">
+        <view class="category-header">
+          <text class="category-name">{{ group.name }}</text>
+          <text class="category-count">{{ group.items.length }}项</text>
+        </view>
+        <view class="indicator-card" v-for="ind in group.items" :key="ind.indicatorName + ind._idx">
+          <view class="ind-header">
+            <text class="ind-name">{{ ind.indicatorName }}</text>
+            <view class="ind-status" :class="ind._cls">
+              <text>{{ ind._label }}</text>
+            </view>
+          </view>
+          <view class="ind-body">
+            <view class="ind-value-wrap">
+              <text class="ind-value">{{ ind.indicatorValue || '--' }}</text>
+              <text class="ind-unit">{{ ind.unit || '' }}</text>
+            </view>
+            <text class="ind-ref">参考值:{{ ind.refRange || '暂无' }}</text>
+          </view>
+        </view>
+      </view>
+
+      <view class="empty-indicators" v-if="indicators.length === 0 && !loading">
+        <text>暂无指标数据</text>
+      </view>
+    </view>
+
+    <!-- 底部占位 -->
+    <view class="bottom-spacer"></view>
+  </view>
+</template>
+
+<script>
+const BASE_URL = 'http://localhost:8080'
+
+const healthRequest = function(url, data) {
+  var token = uni.getStorageSync('token')
+  return new Promise(function(resolve, reject) {
+    uni.request({
+      url: BASE_URL + url,
+      method: 'POST',
+      data: data,
+      header: {
+        'Content-Type': 'application/json',
+        'Authorization': token ? 'Bearer ' + token : ''
+      },
+      success: function(res) {
+        if (res.data.code === 200) {
+          resolve(res.data)
+        } else {
+          reject(res.data)
+        }
+      },
+      fail: function(err) {
+        reject(err)
+      }
+    })
+  })
+}
+
+export default {
+  data() {
+    return {
+      childId: null,
+      reportId: null,
+      report: null,
+      indicators: [],
+      loading: false
+    }
+  },
+  computed: {
+    reportTypeLabel: function() {
+      if (!this.report) return ''
+      return this.report.reportType === 'gut_flora' ? '肠道检测报告' : '体检报告'
+    },
+    // 预计算分组,每个指标附加 _cls (CSS类) 和 _label (显示标签)
+    groupedIndicators: function() {
+      var result = []
+      var groupMap = {}
+      var idx = 0
+      for (var i = 0; i < this.indicators.length; i++) {
+        var ind = this.indicators[i]
+        var cat = ind.category || '其他'
+        // Compute status css class
+        var cls = 'status-normal'
+        var label = '正常'
+        var status = ind.status || ''
+        var s = status.toLowerCase()
+        if (s.indexOf('偏高') !== -1 || s.indexOf('过高') !== -1 || s.indexOf('concern') !== -1) {
+          cls = 'status-warning'
+          label = '偏高'
+        } else if (s.indexOf('偏低') !== -1 || s.indexOf('过低') !== -1 || s.indexOf('注意') !== -1 || s.indexOf('warning') !== -1) {
+          cls = 'status-warn'
+          label = '偏低'
+        } else if (s.indexOf('正常') !== -1 || s.indexOf('normal') !== -1 || s.indexOf('低风险') !== -1) {
+          cls = 'status-normal'
+          label = '正常'
+        } else if (status) {
+          label = status
+        }
+        ind._cls = cls
+        ind._label = label
+        ind._idx = idx
+        idx++
+        // Group
+        if (!groupMap[cat]) {
+          groupMap[cat] = { name: cat, items: [] }
+          result.push(groupMap[cat])
+        }
+        groupMap[cat].items.push(ind)
+      }
+      return result
+    }
+  },
+  onLoad: function(options) {
+    var childId = options.childId
+    var reportId = options.reportId
+    this.childId = childId ? parseInt(childId) : null
+    this.reportId = reportId ? parseInt(reportId) : null
+    this.loadData()
+  },
+  methods: {
+    loadData: function() {
+      var self = this
+      uni.showLoading({ title: '加载中...' })
+      // Load report + indicators in parallel
+      var promises = []
+      if (this.reportId) {
+        promises.push(healthRequest('/api/health/report/latest', { childId: this.childId }))
+        promises.push(healthRequest('/api/health/indicator/list', { reportId: this.reportId }))
+      } else if (this.childId) {
+        promises.push(healthRequest('/api/health/report/latest', { childId: this.childId }))
+      }
+      Promise.all(promises.map(function(p) {
+        return p.catch(function(e) { return null })
+      })).then(function(results) {
+        uni.hideLoading()
+        if (results[0] && results[0].data) {
+          self.report = results[0].data
+          self.reportId = self.report.id
+          // Load indicators after getting reportId
+          if (self.reportId) {
+            healthRequest('/api/health/indicator/list', { reportId: self.reportId }).then(function(res) {
+              if (res.data) {
+                self.indicators = res.data
+              }
+            }).catch(function(e) {
+              console.log('获取指标失败', e)
+            })
+          }
+        }
+      }).catch(function(e) {
+        uni.hideLoading()
+        uni.showToast({ title: '加载失败', icon: 'none' })
+      })
+    },
+    goBack: function() {
+      uni.navigateBack()
+    },
+    formatDate: function(dateStr) {
+      if (!dateStr) return '--'
+      try {
+        var d = new Date(dateStr)
+        var y = d.getFullYear()
+        var m = ('' + (d.getMonth() + 1)).padStart(2, '0')
+        var day = ('' + d.getDate()).padStart(2, '0')
+        return y + '-' + m + '-' + day
+      } catch (e) {
+        return dateStr
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+.report-container {
+  min-height: 100vh;
+  background: #f5f7fa;
+}
+
+/* ===== 导航栏 ===== */
+.nav-bar {
+  position: sticky;
+  top: 0;
+  background: #fff;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+  padding: 20rpx 30rpx;
+  box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
+  z-index: 100;
+}
+.nav-back {
+  font-size: 32rpx;
+  color: #5B9BD5;
+}
+.nav-title {
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #333;
+}
+.nav-placeholder {
+  width: 80rpx;
+}
+
+/* ===== 报告头部 ===== */
+.report-header {
+  background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
+  margin: 20rpx 30rpx;
+  border-radius: 20rpx;
+  padding: 30rpx 24rpx;
+}
+.report-type-tag {
+  display: inline-block;
+  background: #1565C0;
+  color: #fff;
+  font-size: 22rpx;
+  padding: 6rpx 20rpx;
+  border-radius: 20rpx;
+  margin-bottom: 20rpx;
+}
+.report-scores {
+  display: flex;
+  flex-direction: row;
+  margin-bottom: 20rpx;
+}
+.score-item {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  margin-right: 60rpx;
+}
+.score-circle-lg {
+  width: 140rpx;
+  height: 140rpx;
+  border-radius: 70rpx;
+  background: #fff;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  margin-bottom: 8rpx;
+}
+.score-circle-green {
+  background: #E8F5E9;
+}
+.score-num {
+  font-size: 48rpx;
+  font-weight: bold;
+  color: #1565C0;
+}
+.score-circle-green .score-num {
+  color: #2E7D32;
+}
+.score-unit {
+  font-size: 22rpx;
+  color: #64B5F6;
+}
+.score-circle-green .score-unit {
+  color: #81C784;
+}
+.score-label {
+  font-size: 24rpx;
+  color: #666;
+}
+.report-info-row {
+  display: flex;
+  flex-direction: row;
+  margin-bottom: 16rpx;
+}
+.info-chip {
+  background: #fff;
+  color: #333;
+  font-size: 24rpx;
+  padding: 8rpx 20rpx;
+  border-radius: 20rpx;
+  margin-right: 16rpx;
+}
+.report-date {
+  font-size: 22rpx;
+  color: #888;
+}
+
+/* ===== 指标明细 ===== */
+.section {
+  margin: 20rpx 30rpx;
+}
+.section-title {
+  display: flex;
+  flex-direction: row;
+  align-items: baseline;
+  margin-bottom: 20rpx;
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+}
+.section-sub {
+  font-size: 22rpx;
+  color: #999;
+  font-weight: normal;
+  margin-left: 12rpx;
+}
+.category-group {
+  margin-bottom: 30rpx;
+}
+.category-header {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+  margin-bottom: 12rpx;
+}
+.category-name {
+  font-size: 26rpx;
+  font-weight: bold;
+  color: #333;
+}
+.category-count {
+  font-size: 22rpx;
+  color: #999;
+}
+.indicator-card {
+  background: #fff;
+  border-radius: 16rpx;
+  padding: 20rpx;
+  margin-bottom: 12rpx;
+  box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
+}
+.ind-header {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+  margin-bottom: 12rpx;
+}
+.ind-name {
+  font-size: 28rpx;
+  color: #333;
+  font-weight: 500;
+}
+.ind-status {
+  font-size: 22rpx;
+  padding: 4rpx 16rpx;
+  border-radius: 16rpx;
+}
+.status-normal {
+  background: #E8F5E9;
+  color: #2E7D32;
+}
+.status-warning {
+  background: #FFF3E0;
+  color: #E65100;
+}
+.status-warn {
+  background: #F3E5F5;
+  color: #7B1FA2;
+}
+.ind-body {
+  display: flex;
+  flex-direction: row;
+  align-items: baseline;
+  justify-content: space-between;
+}
+.ind-value-wrap {
+  display: flex;
+  flex-direction: row;
+  align-items: baseline;
+}
+.ind-value {
+  font-size: 36rpx;
+  font-weight: bold;
+  color: #1565C0;
+}
+.ind-unit {
+  font-size: 24rpx;
+  color: #999;
+  margin-left: 8rpx;
+}
+.ind-ref {
+  font-size: 22rpx;
+  color: #bbb;
+}
+.empty-indicators {
+  text-align: center;
+  padding: 60rpx;
+  color: #999;
+  font-size: 28rpx;
+}
+
+/* ===== 底部 ===== */
+.bottom-spacer {
+  height: 60rpx;
+}
+</style>

+ 410 - 164
cfc-frontend/pages/body/index.vue

@@ -5,6 +5,35 @@
       tagline="科学管理全家健康"
       quote="身体健康是幸福的基础" />
 
+    <!-- 游客专属区块 -->
+    <template v-if="!isLoggedIn">
+      <LoginGuideCard
+        title="登录后查看全家健康数据"
+        :items="[
+          '查看全家身体能量数据和健康报告',
+          '记录每日健康打卡,获取身体能量',
+          '查看专属健康商品和活动价格'
+        ]" />
+      <HealthTips dimension="body" />
+    </template>
+
+    <!-- 登录后:五维能量条 -->
+    <FamilyEnergyBar
+      v-if="isLoggedIn"
+      dimensionCode="body"
+      :sandboxData="sandboxData"
+      :dualDimension="dualDimension" />
+
+    <!-- 登录后:用户快捷入口 -->
+    <UserQuickEntry
+      v-if="isLoggedIn"
+      :userName="userName"
+      roleName="家长"
+      :currentChildName="activeChildName"
+      :children="children"
+      @childChanged="onChildChanged"
+      @scrollTo="scrollToSection" />
+
     <!-- 功能入口 -->
     <view class="func-section" v-if="sectionVisible('func_entries')">
       <view class="func-grid">
@@ -17,32 +46,66 @@
       </view>
     </view>
 
-    <!-- 今日身体数据(登录后可见) -->
-    <view class="section" v-if="sectionVisible('daily_stats') && isLoggedIn">
+    <!-- 健康报告摘要(登录后可见) -->
+    <view class="section" v-if="sectionVisible('health_report') && isLoggedIn">
       <view class="section-header">
-        <text class="section-title">今日身体数据</text>
+        <text class="section-title">健康报告</text>
+        <text class="section-more" @click="goToHealthReport">查看详情 ›</text>
       </view>
-      <view class="stats-card">
-        <view class="stat-item">
-          <text class="stat-value">{{ dailyStats.steps }}</text>
-          <text class="stat-unit">步</text>
-          <text class="stat-label">今日步数</text>
-        </view>
-        <view class="stat-divider"></view>
-        <view class="stat-item">
-          <text class="stat-value">{{ dailyStats.water }}</text>
-          <text class="stat-unit">L</text>
-          <text class="stat-label">饮水量</text>
-        </view>
-        <view class="stat-divider"></view>
-        <view class="stat-item">
-          <text class="stat-value">{{ dailyStats.sleep }}</text>
-          <text class="stat-unit">h</text>
-          <text class="stat-label">睡眠时长</text>
+      <view class="report-card" v-if="latestReport">
+        <view class="report-type-tag">{{ reportTypeLabel }}</view>
+        <view class="report-score-row">
+          <view class="score-circle">
+            <text class="score-value">{{ latestReport.overallScore || '--' }}</text>
+            <text class="score-label">综合评分</text>
+          </view>
+          <view class="report-meta">
+            <view class="meta-item" v-if="latestReport.gutHealthScore">
+              <text class="meta-label">肠道健康</text>
+              <text class="meta-value">{{ latestReport.gutHealthScore }}</text>
+            </view>
+            <view class="meta-item" v-if="latestReport.nutritionScore">
+              <text class="meta-label">营养状况</text>
+              <text class="meta-value">{{ latestReport.nutritionScore }}</text>
+            </view>
+            <view class="meta-item" v-if="latestReport.gutAge">
+              <text class="meta-label">肠道年龄</text>
+              <text class="meta-value">{{ latestReport.gutAge }}</text>
+            </view>
+          </view>
         </view>
+        <text class="report-date">报告日期:{{ formatDate(latestReport.reportDate) }}</text>
+      </view>
+      <view class="report-empty" v-else>
+        <text class="empty-tip">暂无健康报告</text>
+        <text class="empty-sub">规划师录入后将自动显示</text>
       </view>
     </view>
 
+    <!-- 维度任务 -->
+    <DimensionTasks
+      v-if="isLoggedIn"
+      dimensionCode="body"
+      :tasks="dimensionTasks"
+      @taskClick="onTaskClick"
+      @moreTasks="goTasks" />
+
+    <!-- 维度活动 -->
+    <DimensionActivities
+      v-if="isLoggedIn"
+      dimensionCode="body"
+      :activities="dimensionActivities"
+      @activityClick="goActivityDetail"
+      @moreActivities="goMoreActivities" />
+
+    <!-- 维度商品 -->
+    <DimensionProducts
+      v-if="isLoggedIn"
+      dimensionCode="body"
+      :products="dimensionProducts"
+      @productClick="goProductDetail"
+      @moreProducts="goMoreProducts" />
+
     <!-- 健康小贴士 -->
     <view class="section" v-if="sectionVisible('health_tips')">
       <view class="section-header">
@@ -52,41 +115,19 @@
         <view class="tip-card" v-for="item in healthTips" :key="item.id">
           <text class="tip-title">{{ item.title }}</text>
           <text class="tip-summary">{{ item.summary }}</text>
-          <view class="tip-footer">
-            <text class="tip-date">{{ item.date }}</text>
-            <text class="tip-tag">阅读更多</text>
-          </view>
         </view>
       </view>
     </view>
 
-    <!-- 能量一周(登录后可见) -->
-    <view class="section" v-if="sectionVisible('energy_week') && isLoggedIn">
-      <view class="section-header">
-        <text class="section-title">能量一周</text>
-      </view>
-      <view class="energy-week-bar">
-        <view class="week-column" v-for="(day, idx) in energyWeek" :key="idx">
-          <view class="bar-fill" :style="{ height: day.percent + '%' }"></view>
-          <text class="bar-label">{{ day.label }}</text>
-        </view>
-      </view>
-    </view>
-
-    <!-- 规划师推荐(服务商可见,后台可配置) -->
-    <view class="section" v-if="sectionVisible('teacher_tips')">
-      <view class="section-header">
-        <text class="section-title">👨‍🏫 规划师推荐</text>
+    <!-- 快捷操作按钮 -->
+    <view class="section quick-actions" v-if="isLoggedIn">
+      <view class="action-btn" @click="goToHealthReport">
+        <text class="action-icon">📋</text>
+        <text class="action-text">报告详情</text>
       </view>
-      <view class="tips-list">
-        <view class="tip-card" v-for="item in teacherTips" :key="item.id">
-          <text class="tip-title">{{ item.title }}</text>
-          <text class="tip-summary">{{ item.summary }}</text>
-          <view class="tip-footer">
-            <text class="tip-date">{{ item.date }}</text>
-            <text class="tip-tag">查看详情</text>
-          </view>
-        </view>
+      <view class="action-btn" @click="goToCheckin">
+        <text class="action-icon">🏃</text>
+        <text class="action-text">健康打卡</text>
       </view>
     </view>
 
@@ -97,113 +138,279 @@
 
 <script>
 import PageBanner from '../../components/PageBanner.vue'
-import { getVisibleSections, getEnergyOverview } from '../../utils/api.js'
+import LoginGuideCard from '../../components/LoginGuideCard.vue'
+import HealthTips from '../../components/HealthTips.vue'
+import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
+import UserQuickEntry from '../../components/UserQuickEntry.vue'
+import DimensionTasks from '../../components/DimensionTasks.vue'
+import DimensionActivities from '../../components/DimensionActivities.vue'
+import DimensionProducts from '../../components/DimensionProducts.vue'
+import { getVisibleSections, getEnergyOverview, getChildren, getTodayTasksByCategory, getActivityList, getProductsByDomain, getFamilyEnergySandbox } from '../../utils/api.js'
+
+const BASE_URL = 'http://localhost:8080'
+
+const healthRequest = function(url, data) {
+  var token = uni.getStorageSync('token')
+  return new Promise(function(resolve, reject) {
+    uni.request({
+      url: BASE_URL + url,
+      method: 'POST',
+      data: data,
+      header: {
+        'Content-Type': 'application/json',
+        'Authorization': token ? 'Bearer ' + token : ''
+      },
+      success: function(res) {
+        if (res.data.code === 200) {
+          resolve(res.data)
+        } else {
+          reject(res.data)
+        }
+      },
+      fail: function(err) {
+        reject(err)
+      }
+    })
+  })
+}
 
 export default {
-  components: { PageBanner },
+  components: { PageBanner, LoginGuideCard, HealthTips, FamilyEnergyBar, UserQuickEntry, DimensionTasks, DimensionActivities, DimensionProducts },
   data() {
     return {
       isLoggedIn: false,
       role: null,
-      currentChildId: null,
-      totalEnergy: null,
-      totalHealthIndex: null,
+      activeChildId: null,
+      activeChildName: '',
+      userName: '',
+      children: [],
+      sandboxData: null,
+      dualDimension: null,
       visibleSections: [],
+      latestReport: null,
+      dimensionTasks: [],
+      dimensionActivities: [],
+      dimensionProducts: [],
       funcList: [
-        { icon: '\u{1F3C3}', label: '运动', needLogin: false, page: '' },
-        { icon: '\u{1F957}', label: '饮食', needLogin: false, page: '' },
-        { icon: '\u{1F634}', label: '作息', needLogin: false, page: '' },
-        { icon: '\u{1F9A0}', label: '菌群', needLogin: false, page: '' },
-        { icon: '\u{1F9D8}', label: '冥想', needLogin: false, page: '' }
+        { icon: '\u{1F3C3}', label: '运动', needLogin: true, page: '' },
+        { icon: '\u{1F957}', label: '饮食', needLogin: true, page: '' },
+        { icon: '\u{1F634}', label: '作息', needLogin: true, page: '' },
+        { icon: '\u{1F9A0}', label: '菌群', needLogin: true, page: '' },
+        { icon: '\u{1F9D8}', label: '冥想', needLogin: true, page: '' }
       ],
-      dailyStats: {
-        steps: '6,582',
-        water: '1.2',
-        sleep: '8.5'
-      },
       healthTips: [
-        { id: 1, title: '儿童每日运动指南', summary: '不同年龄段儿童每天需要多少运动量?科学运动助力健康成长。', date: '2024-01-15' },
-        { id: 2, title: '五行饮食搭配法则', summary: '根据五行理论合理搭配膳食,均衡营养从每一餐开始。', date: '2024-01-12' },
-        { id: 3, title: '优质睡眠从小养成', summary: '帮助孩子建立规律的作息习惯,提升睡眠质量。', date: '2024-01-10' },
-        { id: 4, title: '肠道菌群与免疫力', summary: '了解益生菌对儿童健康的重要作用,从内部提升抵抗力。', date: '2024-01-08' }
-      ],
-      teacherTips: [
-        { id: 1, title: '儿童体态评估与纠正', summary: '专业体态评估方法,及早发现并纠正不良体态。', date: '2024-01-14' },
-        { id: 2, title: '感统训练家庭方案', summary: '针对不同年龄段的感觉统合训练建议,在家也能做。', date: '2024-01-11' }
-      ],
-      energyWeek: [
-        { label: '一', percent: 60 },
-        { label: '二', percent: 75 },
-        { label: '三', percent: 45 },
-        { label: '四', percent: 80 },
-        { label: '五', percent: 65 },
-        { label: '六', percent: 90 },
-        { label: '日', percent: 70 }
+        { id: 1, title: '儿童每日运动指南', summary: '不同年龄段儿童每天需要多少运动量?科学运动助力健康成长。' },
+        { id: 2, title: '五行饮食搭配法则', summary: '根据五行理论合理搭配膳食,均衡营养从每一餐开始。' },
+        { id: 3, title: '优质睡眠从小养成', summary: '帮助孩子建立规律的作息习惯,提升睡眠质量。' },
+        { id: 4, title: '肠道菌群与免疫力', summary: '了解益生菌对儿童健康的重要作用,从内部提升抵抗力。' }
       ]
     }
   },
+  computed: {
+    reportTypeLabel: function() {
+      if (!this.latestReport) return ''
+      return this.latestReport.reportType === 'gut_flora' ? '肠道检测报告' : '体检报告'
+    }
+  },
   onShow() {
     var token = uni.getStorageSync('token')
     this.isLoggedIn = !!token
     if (this.isLoggedIn) {
       this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
-      this.currentChildId = uni.getStorageSync('currentChildId') || null
+      this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
     }
     this.loadSectionConfig()
     if (this.isLoggedIn) {
-      this.loadEnergyData()
+      this.loadChildren()
     }
   },
   methods: {
-    async loadSectionConfig() {
+    loadSectionConfig: function() {
       var baseSections = ['func_entries']
       if (!uni.getStorageSync('token')) {
         this.visibleSections = baseSections
         return
       }
       var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
-      try {
-        var res = await getVisibleSections({ pageKey: 'body', role: role })
+      var self = this
+      getVisibleSections({ pageKey: 'body', role: role }).then(function(res) {
         if (res.code === 200 && res.data) {
           var keys = res.data.map(function(s) { return s.sectionKey })
           var merged = baseSections.slice()
           keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
-          this.visibleSections = merged
+          self.visibleSections = merged
         }
-      } catch (e) {
-        this.visibleSections = ['func_entries']
-      }
+      }).catch(function(e) {
+        self.visibleSections = ['func_entries']
+      })
     },
-    async loadEnergyData() {
-      var childId = this.currentChildId
-      if (!childId) return
-      try {
-        var res = await getEnergyOverview(childId)
+    loadChildren: function() {
+      var self = this
+      getChildren().then(function(res) {
+        if (res.code === 200 && res.data) {
+          self.children = res.data
+          var savedChildId = uni.getStorageSync('currentChildId')
+          var found = false
+          for (var i = 0; i < self.children.length; i++) {
+            if (self.children[i].childId === savedChildId) {
+              self.activeChildId = savedChildId
+              self.activeChildName = self.children[i].name || self.children[i].nickname || '孩子'
+              found = true
+              break
+            }
+          }
+          if (!found && self.children.length > 0) {
+            self.activeChildId = self.children[0].childId
+            self.activeChildName = self.children[0].name || self.children[0].nickname || '孩子'
+            uni.setStorageSync('currentChildId', self.activeChildId)
+          }
+          if (self.activeChildId) {
+            self.loadDashboardData()
+          }
+        }
+      }).catch(function(e) {
+        console.log('获取孩子列表失败', e)
+      })
+    },
+    loadDashboardData: function() {
+      if (!this.activeChildId) return
+      this.loadHealthReport()
+      this.loadEnergyData()
+      this.loadDimensionTasks()
+      this.loadDimensionActivities()
+      this.loadDimensionProducts()
+      this.loadSandboxData()
+    },
+    loadSandboxData: function() {
+      var self = this
+      getFamilyEnergySandbox().then(function(res) {
         if (res && res.data) {
-          this.visibleSections = res.data.dimensions || []
-          this.totalEnergy = res.data.totalEnergy || 0
-          this.totalHealthIndex = res.data.totalHealthIndex || 0
+          self.sandboxData = res.data
         }
-      } catch (e) {
+      }).catch(function(e) {
+        console.log('获取沙盘数据失败', e)
+      })
+    },
+    loadHealthReport: function() {
+      var self = this
+      healthRequest('/api/health/report/latest', { childId: this.activeChildId }).then(function(res) {
+        if (res.data) {
+          self.latestReport = res.data
+        }
+      }).catch(function(e) {
+        console.log('获取健康报告失败', e)
+      })
+    },
+    loadEnergyData: function() {
+      var self = this
+      getEnergyOverview(this.activeChildId).then(function(res) {
+        if (res && res.data) {
+          var dims = res.data.dimensions
+          if (dims && dims.length > 0) {
+            for (var i = 0; i < dims.length; i++) {
+              if (dims[i].code === 'body') {
+                self.dualDimension = dims[i]
+                break
+              }
+            }
+          }
+        }
+      }).catch(function(e) {
         console.log('获取能量概览失败', e)
-      }
+      })
     },
-    sectionVisible(key) {
+    loadDimensionTasks: function() {
+      var self = this
+      if (!this.activeChildId) return
+      getTodayTasksByCategory(this.activeChildId, 'body').then(function(res) {
+        if (res && res.data) {
+          self.dimensionTasks = Array.isArray(res.data) ? res.data.slice(0, 5) : []
+        }
+      }).catch(function() { self.dimensionTasks = [] })
+    },
+    loadDimensionActivities: function() {
+      var self = this
+      getActivityList({ dimensionCode: 'body', page: 1, size: 3 }).then(function(res) {
+        if (res && res.data) {
+          var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
+          self.dimensionActivities = list.slice(0, 3)
+        }
+      }).catch(function() { self.dimensionActivities = [] })
+    },
+    loadDimensionProducts: function() {
+      var self = this
+      getProductsByDomain('body', 1, 4).then(function(res) {
+        if (res && res.data) {
+          var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
+          self.dimensionProducts = list.slice(0, 4)
+        }
+      }).catch(function() { self.dimensionProducts = [] })
+    },
+    onChildChanged: function(child) {
+      this.activeChildId = child.childId
+      this.activeChildName = child.name || child.nickname || '孩子'
+      this.loadDashboardData()
+    },
+    scrollToSection: function(section) {
+      uni.pageScrollTo({ selector: '#' + section, duration: 300 })
+    },
+    onTaskClick: function(task) {
+      uni.navigateTo({ url: '/pages/tasks/tasks' })
+    },
+    goActivityDetail: function(act) {
+      if (act && act.id) uni.navigateTo({ url: '/pages/discover/index?type=activity&id=' + act.id })
+    },
+    goMoreActivities: function() {
+      uni.navigateTo({ url: '/pages/discover/index?type=activity&dimension=body' })
+    },
+    goProductDetail: function(prod) {
+      if (prod && prod.id) uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + prod.id })
+    },
+    goMoreProducts: function() {
+      uni.navigateTo({ url: '/pages/discover/index?type=product&domain=body' })
+    },
+    goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
+    sectionVisible: function(key) {
       return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
     },
-    onFuncClick(item) {
+    onFuncClick: function(item) {
       if (item.needLogin && !this.isLoggedIn) {
         uni.showModal({
           title: '提示',
           content: '请先登录后使用此功能',
-          success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
+          success: function(res) {
+            if (res.confirm) uni.navigateTo({ url: '/pages/login/login' })
+          }
         })
         return
       }
       if (item.page) uni.navigateTo({ url: item.page })
     },
-    goLogin() {
-      uni.navigateTo({ url: '/pages/login/login' })
+    goToHealthReport: function() {
+      if (!this.activeChildId) {
+        uni.showToast({ title: '请先选择孩子', icon: 'none' })
+        return
+      }
+      uni.navigateTo({ url: '/pages/body/health-report?childId=' + this.activeChildId })
+    },
+    goToCheckin: function() {
+      if (!this.activeChildId) {
+        uni.showToast({ title: '请先选择孩子', icon: 'none' })
+        return
+      }
+      uni.navigateTo({ url: '/pages/body/checkin?childId=' + this.activeChildId })
+    },
+    formatDate: function(dateStr) {
+      if (!dateStr) return '--'
+      try {
+        var d = new Date(dateStr)
+        var y = d.getFullYear()
+        var m = ('' + (d.getMonth() + 1)).padStart(2, '0')
+        var day = ('' + d.getDate()).padStart(2, '0')
+        return y + '-' + m + '-' + day
+      } catch (e) {
+        return dateStr
+      }
     }
   }
 }
@@ -259,61 +466,116 @@ export default {
   margin: 20rpx 30rpx;
 }
 .section-header {
-  margin-bottom: 20rpx;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+  margin-bottom: 16rpx;
 }
 .section-title {
   font-size: 30rpx;
   font-weight: bold;
   color: #333;
 }
+.section-more {
+  font-size: 24rpx;
+  color: #5B9BD5;
+}
 
-/* ===== 今日数据 ===== */
-.stats-card {
+/* ===== 健康报告 ===== */
+.report-card {
   background: #fff;
   border-radius: 20rpx;
-  padding: 30rpx 20rpx;
+  padding: 24rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+}
+.report-type-tag {
+  display: inline-block;
+  background: #E8F5E9;
+  color: #2E7D32;
+  font-size: 22rpx;
+  padding: 4rpx 16rpx;
+  border-radius: 20rpx;
+  margin-bottom: 16rpx;
+}
+.report-score-row {
   display: flex;
   flex-direction: row;
   align-items: center;
-  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
 }
-.stat-item {
-  flex: 1;
+.score-circle {
+  width: 140rpx;
+  height: 140rpx;
+  border-radius: 70rpx;
+  background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
   display: flex;
   flex-direction: column;
   align-items: center;
+  justify-content: center;
+  margin-right: 24rpx;
 }
-.stat-value {
-  font-size: 44rpx;
+.score-value {
+  font-size: 48rpx;
   font-weight: bold;
-  color: #5B9BD5;
+  color: #1565C0;
+}
+.score-label {
+  font-size: 20rpx;
+  color: #64B5F6;
+}
+.report-meta {
+  flex: 1;
+}
+.meta-item {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  margin-bottom: 12rpx;
 }
-.stat-unit {
+.meta-label {
+  font-size: 24rpx;
+  color: #666;
+  width: 140rpx;
+}
+.meta-value {
+  font-size: 26rpx;
+  color: #333;
+  font-weight: 500;
+}
+.report-date {
   font-size: 22rpx;
+  color: #bbb;
+  margin-top: 16rpx;
+}
+.report-empty {
+  background: #fff;
+  border-radius: 20rpx;
+  padding: 40rpx;
+  text-align: center;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+}
+.empty-tip {
+  font-size: 28rpx;
   color: #999;
-  margin-top: -4rpx;
+  display: block;
 }
-.stat-label {
+.empty-sub {
   font-size: 24rpx;
-  color: #666;
+  color: #ccc;
+  display: block;
   margin-top: 8rpx;
 }
-.stat-divider {
-  width: 1rpx;
-  height: 80rpx;
-  background: #f0f0f0;
-}
 
 /* ===== 健康小贴士 ===== */
 .tips-list {
   display: flex;
   flex-direction: column;
-  gap: 20rpx;
 }
 .tip-card {
   background: #fff;
   border-radius: 20rpx;
   padding: 24rpx;
+  margin-bottom: 16rpx;
   box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
 }
 .tip-title {
@@ -328,59 +590,43 @@ export default {
   color: #888;
   line-height: 1.5;
   display: block;
-  margin-bottom: 16rpx;
 }
-.tip-footer {
+
+/* ===== 快捷操作 ===== */
+.quick-actions {
   display: flex;
   flex-direction: row;
-  align-items: center;
-  justify-content: space-between;
+  margin-top: 30rpx;
 }
-.tip-date {
-  font-size: 22rpx;
-  color: #bbb;
-}
-.tip-tag {
-  font-size: 22rpx;
-  color: #5B9BD5;
-  font-weight: 500;
-}
-
-/* ===== 能量一周 ===== */
-.energy-week-bar {
-  display: flex;
-  align-items: flex-end;
-  justify-content: space-around;
-  height: 200rpx;
+.action-btn {
+  flex: 1;
   background: #fff;
-  border-radius: 20rpx;
-  padding: 30rpx 20rpx;
-  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
-}
-.week-column {
+  border-radius: 16rpx;
+  padding: 24rpx;
   display: flex;
   flex-direction: column;
   align-items: center;
-  width: 60rpx;
+  margin-right: 20rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
 }
-.bar-fill {
-  width: 40rpx;
-  background: linear-gradient(180deg, #F97316, #FBBF24);
-  border-radius: 20rpx 20rpx 4rpx 4rpx;
-  min-height: 8rpx;
+.action-btn:last-child {
+  margin-right: 0;
 }
-.bar-label {
-  font-size: 22rpx;
-  color: #999;
-  margin-top: 12rpx;
+.action-icon {
+  font-size: 48rpx;
+  margin-bottom: 8rpx;
 }
-
-.func-item:active {
-  opacity: 0.7;
+.action-text {
+  font-size: 26rpx;
+  color: #666;
 }
 
 /* ===== 底部 ===== */
 .bottom-spacer {
   height: 120rpx;
 }
+
+.func-item:active, .action-btn:active {
+  opacity: 0.7;
+}
 </style>

+ 261 - 0
cfc-frontend/pages/body/member-body-detail.vue

@@ -0,0 +1,261 @@
+<template>
+  <view class="detail-container">
+    <!-- 顶部导航 -->
+    <view class="nav-bar">
+      <view class="nav-back" @click="goBack">
+        <text class="nav-back-icon">&#x2190;</text>
+      </view>
+      <text class="nav-title">身 · 成员详情</text>
+    </view>
+
+    <!-- 五维能量条 -->
+    <FamilyEnergyBar
+      dimensionCode="body"
+      :sandboxData="sandboxData"
+      :dualDimension="dualDimension" />
+
+    <!-- 成员信息卡 -->
+    <view class="member-card" v-if="memberInfo">
+      <view class="member-avatar">
+        <text class="avatar-text">{{ memberInfo.name && memberInfo.name.charAt(0) || '孩' }}</text>
+      </view>
+      <view class="member-info">
+        <text class="member-name">{{ memberInfo.name || '孩子' }}</text>
+        <text class="member-role">身体维度</text>
+      </view>
+      <view class="member-score" v-if="dualDimension">
+        <text class="score-value">{{ dualDimension.energy || 0 }}</text>
+        <text class="score-label">能量值</text>
+      </view>
+    </view>
+
+    <!-- 今日任务 -->
+    <DimensionTasks
+      dimensionCode="body"
+      :tasks="dimensionTasks"
+      @taskClick="onTaskClick"
+      @moreTasks="goTasks" />
+
+    <!-- 活动 -->
+    <DimensionActivities
+      dimensionCode="body"
+      :activities="dimensionActivities"
+      @activityClick="goActivityDetail"
+      @moreActivities="goMoreActivities" />
+
+    <!-- 商品 -->
+    <DimensionProducts
+      dimensionCode="body"
+      :products="dimensionProducts"
+      @productClick="goProductDetail"
+      @moreProducts="goMoreProducts" />
+
+    <!-- 底部占位 -->
+    <view class="bottom-spacer"></view>
+  </view>
+</template>
+
+<script>
+import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
+import DimensionTasks from '../../components/DimensionTasks.vue'
+import DimensionActivities from '../../components/DimensionActivities.vue'
+import DimensionProducts from '../../components/DimensionProducts.vue'
+import { getEnergyOverview, getFamilyEnergySandbox, getTodayTasksByCategory, getActivityList, getProductsByDomain, getChildren } from '../../utils/api.js'
+
+export default {
+  components: { FamilyEnergyBar, DimensionTasks, DimensionActivities, DimensionProducts },
+  data() {
+    return {
+      childId: null,
+      memberInfo: null,
+      sandboxData: null,
+      dualDimension: null,
+      dimensionTasks: [],
+      dimensionActivities: [],
+      dimensionProducts: []
+    }
+  },
+  onLoad: function(options) {
+    this.childId = options.childId || uni.getStorageSync('currentChildId') || null
+  },
+  onShow: function() {
+    this.loadChildren()
+    this.loadSandboxData()
+    if (this.childId) {
+      this.loadEnergyData()
+      this.loadDimensionTasks()
+      this.loadDimensionActivities()
+      this.loadDimensionProducts()
+    }
+  },
+  methods: {
+    loadChildren: function() {
+      var self = this
+      getChildren().then(function(res) {
+        if (res.code === 200 && res.data) {
+          for (var i = 0; i < res.data.length; i++) {
+            if (res.data[i].childId === self.childId) {
+              self.memberInfo = res.data[i]
+              break
+            }
+          }
+          if (!self.memberInfo && res.data.length > 0) {
+            self.memberInfo = res.data[0]
+            self.childId = res.data[0].childId
+          }
+        }
+      }).catch(function() {})
+    },
+    loadSandboxData: function() {
+      var self = this
+      getFamilyEnergySandbox().then(function(res) {
+        if (res && res.data) self.sandboxData = res.data
+      }).catch(function() {})
+    },
+    loadEnergyData: function() {
+      var self = this
+      getEnergyOverview(this.childId).then(function(res) {
+        if (res && res.data) {
+          var dims = res.data.dimensions
+          if (dims && dims.length > 0) {
+            for (var i = 0; i < dims.length; i++) {
+              if (dims[i].code === 'body') {
+                self.dualDimension = dims[i]
+                break
+              }
+            }
+          }
+        }
+      }).catch(function() {})
+    },
+    loadDimensionTasks: function() {
+      var self = this
+      getTodayTasksByCategory(this.childId, 'body').then(function(res) {
+        if (res && res.data) {
+          self.dimensionTasks = Array.isArray(res.data) ? res.data.slice(0, 5) : []
+        }
+      }).catch(function() { self.dimensionTasks = [] })
+    },
+    loadDimensionActivities: function() {
+      var self = this
+      getActivityList({ dimensionCode: 'body', page: 1, size: 3 }).then(function(res) {
+        if (res && res.data) {
+          var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
+          self.dimensionActivities = list.slice(0, 3)
+        }
+      }).catch(function() { self.dimensionActivities = [] })
+    },
+    loadDimensionProducts: function() {
+      var self = this
+      getProductsByDomain('body', 1, 4).then(function(res) {
+        if (res && res.data) {
+          var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
+          self.dimensionProducts = list.slice(0, 4)
+        }
+      }).catch(function() { self.dimensionProducts = [] })
+    },
+    onTaskClick: function(task) {
+      uni.navigateTo({ url: '/pages/tasks/tasks' })
+    },
+    goActivityDetail: function(act) {
+      if (act && act.id) uni.navigateTo({ url: '/pages/discover/index?type=activity&id=' + act.id })
+    },
+    goMoreActivities: function() {
+      uni.navigateTo({ url: '/pages/discover/index?type=activity&dimension=body' })
+    },
+    goProductDetail: function(prod) {
+      if (prod && prod.id) uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + prod.id })
+    },
+    goMoreProducts: function() {
+      uni.navigateTo({ url: '/pages/discover/index?type=product&domain=body' })
+    },
+    goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
+    goBack: function() { uni.navigateBack() }
+  }
+}
+</script>
+
+<style scoped>
+.detail-container {
+  min-height: 100vh;
+  background: #f5f7fa;
+  padding-bottom: 40rpx;
+}
+.nav-bar {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  padding: 20rpx 30rpx;
+  background: #fff;
+}
+.nav-back {
+  padding: 10rpx;
+}
+.nav-back-icon {
+  font-size: 36rpx;
+  color: #333;
+}
+.nav-title {
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #333;
+  margin-left: 16rpx;
+}
+.member-card {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  margin: 20rpx 30rpx;
+  background: #fff;
+  border-radius: 20rpx;
+  padding: 24rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+}
+.member-avatar {
+  width: 80rpx;
+  height: 80rpx;
+  border-radius: 40rpx;
+  background: linear-gradient(135deg, #4CAF50, #81C784);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  margin-right: 20rpx;
+}
+.avatar-text {
+  font-size: 32rpx;
+  color: #fff;
+  font-weight: bold;
+}
+.member-info {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+}
+.member-name {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+}
+.member-role {
+  font-size: 24rpx;
+  color: #999;
+  margin-top: 4rpx;
+}
+.member-score {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+.score-value {
+  font-size: 40rpx;
+  font-weight: bold;
+  color: #4CAF50;
+}
+.score-label {
+  font-size: 22rpx;
+  color: #999;
+}
+.bottom-spacer {
+  height: 40rpx;
+}
+</style>

+ 74 - 2
cfc-frontend/pages/discover/product-detail/product-detail.vue

@@ -44,6 +44,12 @@
           <text v-if="product.memberPrice" class="bottom-member">会员¥{{ product.memberPrice }}</text>
         </view>
         <view class="action-btns">
+          <view v-if="danshopProductId" class="action-extra">
+            <view class="btn-favorite" @click="onToggleFavorite">
+              <text :class="isFavorite ? 'icon-heart-active' : 'icon-heart'">{{ isFavorite ? '❤️' : '🤍' }}</text>
+            </view>
+            <button class="btn-cart" @click="onAddCart">加入购物车</button>
+          </view>
           <button class="btn-buy" @click="onBuy">立即购买</button>
         </view>
       </view>
@@ -55,13 +61,15 @@
 </template>
 
 <script>
-import { productDetail, productOrderCreate, productOrderPay } from '@/utils/api.js'
+import { productDetail, productOrderCreate, productOrderPay, danshopProductDetail, danshopCartAdd, danshopFavoriteAdd, danshopFavoriteRemove } from '@/utils/api.js'
 
 export default {
   data() {
     return {
       product: {},
-      loading: false
+      loading: false,
+      isFavorite: false,
+      danshopProductId: null
     }
   },
   computed: {
@@ -89,6 +97,14 @@ export default {
   onLoad(options) {
     if (options.id) {
       this.loadDetail(options.id)
+      if (options.danshopId) {
+        this.danshopProductId = parseInt(options.danshopId)
+        this.loadDanshopDetail(options.danshopId)
+      } else {
+        // For backward compat, treat id as danshopId
+        this.danshopProductId = parseInt(options.id)
+        this.loadDanshopDetail(options.id)
+      }
     }
   },
   methods: {
@@ -151,6 +167,39 @@ export default {
         uni.hideLoading()
         uni.showToast({ title: '支付失败', icon: 'none' })
       })
+    },
+    loadDanshopDetail(id) {
+      danshopProductDetail({ id: parseInt(id) }).then(res => {
+        if (res.code === 200 && res.data) {
+          this.product = res.data
+          this.isFavorite = res.data.isFavorite || false
+        }
+      }).catch(function() {})
+    },
+    onAddCart() {
+      if (!this.danshopProductId) {
+        uni.showToast({ title: '商品不可购买', icon: 'none' })
+        return
+      }
+      uni.showLoading({ title: '添加中...' })
+      danshopCartAdd({ productId: this.danshopProductId, quantity: 1 }).then(res => {
+        uni.hideLoading()
+        if (res.code === 200) {
+          uni.showToast({ title: '已加入购物车', icon: 'success' })
+        } else {
+          uni.showToast({ title: res.message || '添加失败', icon: 'none' })
+        }
+      }).catch(function() { uni.hideLoading() })
+    },
+    onToggleFavorite() {
+      if (!this.danshopProductId) return
+      var action = this.isFavorite ? danshopFavoriteRemove : danshopFavoriteAdd
+      action({ productId: this.danshopProductId }).then(res => {
+        if (res.code === 200) {
+          this.isFavorite = !this.isFavorite
+          uni.showToast({ title: this.isFavorite ? '已收藏' : '已取消收藏', icon: 'success' })
+        }
+      }).catch(function() {})
     }
   }
 }
@@ -301,4 +350,27 @@ export default {
 .btn-buy::after {
   border: none;
 }
+.action-extra {
+  display: flex;
+  align-items: center;
+  margin-right: 20rpx;
+}
+.btn-favorite {
+  font-size: 40rpx;
+  margin-right: 16rpx;
+  padding: 0 8rpx;
+}
+.btn-cart {
+  background: #fff;
+  color: #F97316;
+  border: 2rpx solid #F97316;
+  font-size: 26rpx;
+  padding: 0 24rpx;
+  height: 64rpx;
+  line-height: 64rpx;
+  border-radius: 32rpx;
+}
+.btn-cart::after {
+  border: none;
+}
 </style>

+ 162 - 78
cfc-frontend/pages/index/parent-index.vue

@@ -100,72 +100,80 @@
       <!-- ===== c) 成长数据 ===== -->
       <view class="stats-section animate-fade-in animate-stagger-5">
         <view class="section-title">成长数据</view>
-        <view class="stats-grid">
-          <PlayfulCard variant="flat" shadow="sm" :clickable="true" @click="goToCompletionStats" class="stat-card" padding="0">
+        <view class="stats-row">
+          <!-- 任务完成率:自己的 + 全家平均 -->
+          <PlayfulCard variant="flat" shadow="sm" :clickable="true" @click="goToCompletionStats" class="stat-card-wide" padding="0">
             <view class="stat-card-content">
               <view class="stat-header">
                 <view class="stat-icon-wrap stat-icon-orange">
                   <text class="stat-icon-symbol">📋</text>
                 </view>
                 <view class="stat-body">
-                  <text class="stat-value accent-color">{{ taskCompletionRate }}%</text>
-                  <text class="stat-label">任务完成</text>
+                  <text class="stat-label-header">任务完成</text>
                 </view>
               </view>
-              <view class="stat-progress">
-                <view class="progress-bar">
-                  <view class="progress-fill" :style="{ width: taskCompletionRate + '%' }"></view>
+              <view class="stat-compare">
+                <view class="stat-compare-row">
+                  <text class="compare-label">自己的</text>
+                  <text class="compare-value accent-color">{{ myCompletionRate }}%</text>
+                </view>
+                <view class="progress-bar-sm">
+                  <view class="progress-fill-sm" :style="{ width: myCompletionRate + '%' }"></view>
+                </view>
+                <view class="stat-compare-row">
+                  <text class="compare-label">全家平均</text>
+                  <text class="compare-value">{{ familyAvgCompletionRate }}%</text>
+                </view>
+                <view class="progress-bar-sm">
+                  <view class="progress-fill-sm muted" :style="{ width: familyAvgCompletionRate + '%' }"></view>
                 </view>
               </view>
               <text class="stat-more">查看分析 ›</text>
             </view>
           </PlayfulCard>
-          <PlayfulCard variant="flat" shadow="sm" class="stat-card" padding="0">
+
+          <!-- 成长积分:自己的 + 全家共 -->
+          <PlayfulCard variant="flat" shadow="sm" :clickable="true" @click="goToRewards" class="stat-card-wide" padding="0">
             <view class="stat-card-content">
               <view class="stat-header">
                 <view class="stat-icon-wrap stat-icon-gold">
                   <text class="stat-icon-symbol">⭐</text>
                 </view>
                 <view class="stat-body">
-                  <text class="stat-value gold-color">{{ (selectedChild && selectedChild.totalPoints) || 0 }}</text>
-                  <text class="stat-label">成长积分</text>
+                  <text class="stat-label-header">成长积分</text>
                 </view>
               </view>
-              <text class="stat-encourage">太棒了!</text>
-            </view>
-          </PlayfulCard>
-          <PlayfulCard variant="flat" shadow="sm" class="stat-card" padding="0">
-            <view class="stat-card-content">
-              <view class="stat-header">
-                <view class="stat-icon-wrap stat-icon-red">
-                  <text class="stat-icon-symbol">🔥</text>
+              <view class="stat-compare">
+                <view class="stat-compare-row">
+                  <text class="compare-label">自己的</text>
+                  <text class="compare-value gold-color">{{ myPoints }}</text>
                 </view>
-                <view class="stat-body">
-                  <text class="stat-value red-color">{{ (selectedChild && selectedChild.streakDays) || 0 }}</text>
-                  <text class="stat-label">连续天数</text>
+                <view class="stat-compare-row">
+                  <text class="compare-label">全家共</text>
+                  <text class="compare-value">{{ familyTotalPoints }}</text>
                 </view>
               </view>
-              <text class="stat-encourage" v-if="selectedChild && selectedChild.streakDays > 0">加油保持!</text>
-              <text class="stat-encourage muted" v-else>开始坚持吧</text>
-            </view>
-          </PlayfulCard>
-          <PlayfulCard variant="flat" shadow="sm" class="stat-card" padding="0">
-            <view class="stat-card-content">
-              <view class="stat-header">
-                <view class="stat-icon-wrap stat-icon-teal">
-                  <text class="stat-icon-symbol">✨</text>
-                </view>
-                <view class="stat-body">
-                  <text class="stat-value teal-color">{{ habitCount }}</text>
-                  <text class="stat-label">习惯打卡</text>
-                </view>
-              </view>
-              <text class="stat-encourage">坚持就是胜利</text>
+              <text class="stat-encourage" v-if="myPoints > 0">太棒了!</text>
+              <text class="stat-encourage muted" v-else>开始赚星星吧</text>
             </view>
           </PlayfulCard>
         </view>
       </view>
 
+      <!-- ===== AI 家庭助手入口 ===== -->
+      <view class="ai-entry-section animate-fade-in animate-stagger-5">
+        <PlayfulCard variant="flat" shadow="sm" :clickable="true" @click="goToAIChat" class="ai-entry-card" padding="24rpx">
+          <view class="ai-entry">
+            <view class="ai-entry-icon">🤖</view>
+            <view class="ai-entry-body">
+              <text class="ai-entry-title">AI 家庭助手</text>
+              <text class="ai-entry-desc">问问孩子的表现,了解家庭情况</text>
+            </view>
+            <text class="ai-entry-arrow">›</text>
+          </view>
+        </PlayfulCard>
+      </view>
+
       <!-- ===== d) 今日重点 ===== -->
       <view class="today-section animate-fade-in animate-stagger-6">
         <view class="section-title">今日重点</view>
@@ -367,8 +375,10 @@ export default {
       hotActivityCount: 0,
       hasNewReport: false,
       growthAdvice: [],
-      taskCompletionRate: 0,
-      habitCount: 0,
+      myCompletionRate: 0,
+      familyAvgCompletionRate: 0,
+      myPoints: 0,
+      familyTotalPoints: 0,
       membershipText: '开通家庭会员 畅享全部权益',
       loading: true,
       currentChildId: '',
@@ -453,8 +463,10 @@ export default {
           if (filteredChildren.length > 0) {
             this.children = filteredChildren
             this.selectedChild = filteredChildren[0]
-            this.taskCompletionRate = dashData.avgCompletionRate || 0
-            this.habitCount = dashData.totalHabitCount || 0
+            this.familyAvgCompletionRate = dashData.avgCompletionRate || 0
+            // 家长自身数据(积分 + 任务完成率)
+            this.myPoints = dashData.parentPoints || 0
+            this.myCompletionRate = dashData.parentCompletionRate || 0
             // 从仪表盘获取 familyId
             if (dashData.familyId) {
               this._familyId = dashData.familyId
@@ -531,18 +543,28 @@ export default {
           }
         })
 
-        // 如果仪表盘未加载到数据,降级到单独统计接口
-        if (!dashboardLoaded && this.children.length > 0) {
-          const targetChild = this.selectedChild || this.children[0]
-          try {
-            const statsRes = await getChildCompletionStats({ childId: targetChild.id })
-            if (statsRes && statsRes.data) {
-              this.taskCompletionRate = statsRes.data.completionRate || 0
-              this.habitCount = statsRes.data.completedTasks || 0
+        // 计算全家总积分(家长 + 所有孩子)
+        var totalPts = this.myPoints
+        for (var pi = 0; pi < this.children.length; pi++) {
+          totalPts += (this.children[pi].totalPoints || 0)
+        }
+        this.familyTotalPoints = totalPts
+
+        // 如果仪表盘未加载到数据,降级:从孩子数据取近似值
+        if (!dashboardLoaded) {
+          // 降级:家长积分取自己的(从缓存或API),完成率取第一个孩子的
+          const targetChild = this.selectedChild || (this.children.length > 0 ? this.children[0] : null)
+          if (targetChild) {
+            try {
+              const statsRes = await getChildCompletionStats({ childId: targetChild.id })
+              if (statsRes && statsRes.data) {
+                this.myCompletionRate = statsRes.data.completionRate || 0
+              }
+            } catch (e) {
+              console.log('获取个人完成率失败', e)
             }
-          } catch (e) {
-            console.log('获取完成率失败', e)
-            this.taskCompletionRate = 0
+            this.myPoints = targetChild.totalPoints || 0
+            this.familyAvgCompletionRate = this.myCompletionRate
           }
         }
 
@@ -636,6 +658,7 @@ export default {
     goToAssessmentReport() { uni.navigateTo({ url: '/pages/assessment/report' }) },
     goToActivities() { uni.switchTab({ url: '/pages/discover/index' }) },
     goToRewards() { uni.switchTab({ url: '/pages/rewards/rewards' }) },
+    goToAIChat() { uni.navigateTo({ url: '/pages/ai/chat' }) },
     goToTaskList() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
     manageChildren() { uni.navigateTo({ url: '/pages/profile/children' }) },
     inviteFriend() { uni.navigateTo({ url: '/pages/parent/invite/index' }) },
@@ -870,14 +893,14 @@ b) 孩子卡片
   margin-bottom: 48rpx;
 }
 
-.stats-grid {
+.stats-row {
   display: flex;
-  flex-wrap: wrap;
   gap: 16rpx;
 }
 
-.stat-card {
-  width: calc(50% - 8rpx);
+.stat-card-wide {
+  flex: 1;
+  min-width: 0;
   box-sizing: border-box;
 }
 
@@ -888,7 +911,7 @@ b) 孩子卡片
 .stat-header {
   display: flex;
   align-items: center;
-  margin-bottom: 14rpx;
+  margin-bottom: 16rpx;
 }
 
 .stat-icon-wrap {
@@ -908,51 +931,63 @@ b) 孩子卡片
 
 .stat-icon-orange { background: rgba(91, 155, 213, 0.12); }
 .stat-icon-gold { background: rgba(245, 158, 11, 0.15); }
-.stat-icon-red { background: rgba(239, 68, 68, 0.12); }
-.stat-icon-teal { background: rgba(16, 185, 129, 0.12); }
 
 .stat-body {
   flex: 1;
   min-width: 0;
 }
 
-.stat-value {
-  font-size: 40rpx;
-  font-weight: 800;
-  display: block;
-  line-height: 1.1;
+.stat-label-header {
+  font-size: 26rpx;
+  font-weight: 600;
+  color: var(--text, #1E293B);
+}
+
+/* 对比行布局 */
+.stat-compare {
+  margin-bottom: 12rpx;
+}
+
+.stat-compare-row {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 4rpx;
 }
 
-.stat-label {
+.compare-label {
   font-size: 22rpx;
   color: var(--text-secondary, #64748B);
-  display: block;
-  margin-top: 4rpx;
 }
 
-.accent-color { color: var(--color-primary, #5B9BD5); }
-.gold-color { color: #F59E0B; }
-.red-color { color: var(--color-error, #EF4444); }
-.teal-color { color: #10B981; }
-
-.stat-progress {
-  margin-bottom: 10rpx;
+.compare-value {
+  font-size: 30rpx;
+  font-weight: 700;
 }
 
-.progress-bar {
-  height: 8rpx;
+/* 进度条 - 紧凑版 */
+.progress-bar-sm {
+  height: 6rpx;
   background: var(--border-light, #E2E8F0);
   border-radius: 999rpx;
   overflow: hidden;
+  margin-bottom: 8rpx;
 }
 
-.progress-fill {
+.progress-fill-sm {
   height: 100%;
   background: linear-gradient(90deg, var(--color-primary, #5B9BD5), #F59E0B);
   border-radius: 999rpx;
   transition: width 0.3s ease;
 }
 
+.progress-fill-sm.muted {
+  background: linear-gradient(90deg, #94A3B8, #CBD5E1);
+}
+
+.accent-color { color: var(--color-primary, #5B9BD5); }
+.gold-color { color: #F59E0B; }
+
 .stat-more {
   font-size: 22rpx;
   color: var(--color-accent, #0EA5E9);
@@ -964,7 +999,7 @@ b) 孩子卡片
   font-size: 22rpx;
   color: #10B981;
   font-weight: 500;
-  margin-top: 10rpx;
+  margin-top: 8rpx;
   display: block;
 }
 
@@ -972,6 +1007,55 @@ b) 孩子卡片
   color: var(--muted, #94A3B8);
 }
 
+/* AI 家庭助手入口 */
+.ai-entry-section {
+  margin-bottom: 48rpx;
+}
+
+.ai-entry-card .PlayfulCard-content {
+  padding: 24rpx;
+}
+
+.ai-entry {
+  display: flex;
+  align-items: center;
+}
+
+.ai-entry-icon {
+  width: 64rpx;
+  height: 64rpx;
+  font-size: 36rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-shrink: 0;
+}
+
+.ai-entry-body {
+  flex: 1;
+  margin: 0 16rpx;
+  min-width: 0;
+}
+
+.ai-entry-title {
+  font-size: 26rpx;
+  font-weight: 600;
+  color: var(--text, #1E293B);
+  display: block;
+}
+
+.ai-entry-desc {
+  font-size: 22rpx;
+  color: var(--text-secondary, #64748B);
+  margin-top: 4rpx;
+  display: block;
+}
+
+.ai-entry-arrow {
+  font-size: 32rpx;
+  color: var(--muted, #94A3B8);
+}
+
 /* ========================================
    d) 今日重点
    ======================================== */

+ 63 - 73
cfc-frontend/pages/login/login.vue

@@ -31,8 +31,7 @@
         <button
           class="wechat-btn"
           :loading="loading"
-          open-type="getPhoneNumber"
-          @getphonenumber="handleWechatPhoneLogin"
+          @click="handleWechatLogin"
         >
           <text class="wechat-icon">微信</text>
           <text>一键登录</text>
@@ -55,7 +54,7 @@
 </template>
 
 <script>
-import { wechatPhoneLogin, checkTeamInviteStatus, joinTeamByInvite } from '../../utils/api.js'
+import { wechatLogin, checkTeamInviteStatus, joinTeamByInvite } from '../../utils/api.js'
 
 export default {
   data() {
@@ -86,87 +85,78 @@ export default {
       this.agreed = e.detail.value.length > 0
     },
     showAgreement() {
-      uni.showModal({
-        title: '用户协议',
-        content: '这里是用户协议内容...',
-        showCancel: false
+      uni.navigateTo({
+        url: '/pages/policy/agreement'
       })
     },
     showPrivacy() {
-      uni.showModal({
-        title: '隐私政策',
-        content: '这里是隐私政策内容...',
-        showCancel: false
+      uni.navigateTo({
+        url: '/pages/policy/privacy'
       })
     },
-    async handleWechatPhoneLogin(e) {
-      if (e.detail.errMsg === 'getPhoneNumber:ok') {
-        if (!this.agreed) {
-          uni.showToast({ title: '请先同意用户协议', icon: 'none' })
-          return
-        }
+    handleWechatLogin() {
+      if (!this.agreed) {
+        uni.showToast({ title: '请先同意用户协议', icon: 'none' })
+        return
+      }
 
-        this.loading = true
-        try {
-          // 获取登录 code 用于获取 openid
-          const loginRes = await new Promise((resolve, reject) => {
-            uni.login({
-              provider: 'weixin',
-              success: resolve,
-              fail: reject
+      this.loading = true
+      var self = this
+
+      uni.login({
+        provider: 'weixin',
+        success: function(loginRes) {
+          wechatLogin(loginRes.code, {
+            nickname: self.nickname || '用户',
+            avatar: self.avatar || ''
+          }).then(function(res) {
+            // 保存 token 和用户信息
+            uni.setStorageSync('token', res.data.token)
+            uni.setStorageSync('userId', res.data.userId)
+            uni.setStorageSync('role', res.data.role)
+            uni.setStorageSync('familyId', res.data.familyId)
+            uni.setStorageSync('currentRole', res.data.role)
+            uni.setStorageSync('isSwitchedChild', false)
+            uni.setStorageSync('isSwitchedTeacher', false)
+            // 保存 openid,用于后续自动登录
+            if (res.data.openid) {
+              uni.setStorageSync('openid', res.data.openid)
+            }
+            uni.setStorageSync('userInfo', {
+              nickname: res.data.nickname,
+              userId: res.data.userId
             })
-          })
 
-          // 调用后端微信手机号登录接口
-          const res = await wechatPhoneLogin({
-            code: loginRes.code,
-            nickname: this.nickname || '用户',
-            avatar: this.avatar || ''
-          })
+            // 存储成长规划师审核状态
+            if (res.data.teacherStatus) {
+              uni.setStorageSync('teacherStatus', res.data.teacherStatus)
+            }
+            if (res.data.teacherRejectReason) {
+              uni.setStorageSync('teacherRejectReason', res.data.teacherRejectReason)
+            }
 
-          // 保存 token 和用户信息
-          uni.setStorageSync('token', res.data.token)
-          uni.setStorageSync('userId', res.data.userId)
-          uni.setStorageSync('role', res.data.role)
-          uni.setStorageSync('familyId', res.data.familyId)
-          uni.setStorageSync('currentRole', res.data.role)
-          uni.setStorageSync('isSwitchedChild', false)
-          uni.setStorageSync('isSwitchedTeacher', false)
-          // 保存 openid,用于后续自动登录
-          if (res.data.openid) {
-            uni.setStorageSync('openid', res.data.openid)
-          }
-          uni.setStorageSync('userInfo', {
-            nickname: res.data.nickname,
-            userId: res.data.userId
-          })
+            uni.showToast({ title: '登录成功', icon: 'success' })
 
-          // 存储成长规划师审核状态
-          if (res.data.teacherStatus) {
-            uni.setStorageSync('teacherStatus', res.data.teacherStatus)
-          }
-          if (res.data.teacherRejectReason) {
-            uni.setStorageSync('teacherRejectReason', res.data.teacherRejectReason)
-          }
-
-          uni.showToast({ title: '登录成功', icon: 'success' })
-
-          // 根据角色跳转到对应首页,或进入信息编辑页面
-          setTimeout(() => {
-            if (res.data.needsRoleSelect) {
-              uni.redirectTo({
-                url: `/pages/user-edit/user-edit?token=${res.data.token}&userId=${res.data.userId}&needsRoleSelect=true`
-              })
-            } else {
-              this.handlePostLoginRouting()
-            }
-          }, 1000)
-        } catch (e) {
-          uni.showToast({ title: e.message || '登录失败', icon: 'none' })
-        } finally {
-          this.loading = false
+            // 根据角色跳转到对应首页,或进入信息编辑页面
+            setTimeout(function() {
+              if (res.data.needsRoleSelect) {
+                uni.redirectTo({
+                  url: '/pages/user-edit/user-edit?token=' + res.data.token + '&userId=' + res.data.userId + '&needsRoleSelect=true'
+                })
+              } else {
+                self.handlePostLoginRouting()
+              }
+            }, 1000)
+          }).catch(function(e) {
+            uni.showToast({ title: e.message || '登录失败', icon: 'none' })
+            self.loading = false
+          })
+        },
+        fail: function() {
+          uni.showToast({ title: '微信登录失败', icon: 'none' })
+          self.loading = false
         }
-      }
+      })
     },
     handlePostLoginRouting() {
       const inviteCode = uni.getStorageSync('inviteCode')

+ 422 - 0
cfc-frontend/pages/mind/emotion-report.vue

@@ -0,0 +1,422 @@
+<template>
+  <view class="container">
+    <PageBanner theme="mind-wisdom"
+      tagline="EMI 心理报告"
+      quote="知己知彼,百战不殆" />
+
+    <!-- 报告数据 -->
+    <view class="report-card" v-if="report">
+      <view class="report-header">
+        <text class="report-title">EMI 心理测评报告</text>
+        <text class="report-date">测评日期: {{ report.assessmentDate || '-' }}</text>
+      </view>
+
+      <!-- 综合EQ分 -->
+      <view class="overall-wrap">
+        <text class="overall-label">综合EQ分</text>
+        <text class="overall-value">{{ report.overallScore || 0 }}</text>
+        <text :class="['overall-level', 'level-' + getScoreLevel(report.overallScore || 0)]">{{ getScoreLevelText(report.overallScore || 0) }}</text>
+      </view>
+
+      <!-- 四维条形图 -->
+      <view class="dimension-list">
+        <view class="dimension-item" v-for="dim in dimensions" :key="dim.key">
+          <view class="dimension-header">
+            <view class="dimension-label-row">
+              <text class="dimension-icon">{{ dim.icon }}</text>
+              <text class="dimension-name">{{ dim.label }}</text>
+            </view>
+            <view class="dimension-score-row">
+              <text class="dimension-score">{{ report[dim.key] || 0 }}</text>
+              <text :class="['dimension-level', 'level-' + getScoreLevel(report[dim.key] || 0)]">{{ getScoreLevelText(report[dim.key] || 0) }}</text>
+            </view>
+          </view>
+          <view class="dimension-bar">
+            <view class="dimension-bar-fill" :style="{ width: (report[dim.key] || 0) + '%', background: dim.color }"></view>
+          </view>
+          <text class="dimension-desc">{{ dim.desc }}</text>
+        </view>
+      </view>
+
+      <!-- 分析报告 -->
+      <view class="section-card" v-if="report.analysisReport">
+        <view class="section-header-row">
+          <text class="section-icon">&#x1F4DD;</text>
+          <text class="section-title">分析报告</text>
+        </view>
+        <text class="section-content">{{ report.analysisReport }}</text>
+      </view>
+
+      <!-- 成长建议 -->
+      <view class="section-card suggestion-card" v-if="report.growthSuggestions">
+        <view class="section-header-row">
+          <text class="section-icon">&#x1F331;</text>
+          <text class="section-title">成长建议</text>
+        </view>
+        <text class="section-content">{{ report.growthSuggestions }}</text>
+      </view>
+
+      <!-- 底部操作 -->
+      <view class="action-row">
+        <view class="action-btn secondary" @click="goAssessment">
+          <text class="action-btn-text">再次测评</text>
+        </view>
+        <view class="action-btn primary" @click="goBack">
+          <text class="action-btn-text">返回心智</text>
+        </view>
+      </view>
+    </view>
+
+    <!-- 加载中 -->
+    <view class="loading-state" v-if="loading">
+      <text class="loading-text">加载中...</text>
+    </view>
+
+    <!-- 无数据 -->
+    <view class="empty-state" v-if="!report && !loading">
+      <text class="empty-icon">&#x1F9E0;</text>
+      <text class="empty-title">暂无心理测评数据</text>
+      <text class="empty-desc">完成 EMI 心理测评后,可在此查看详细的心理分析报告</text>
+      <view class="empty-btn" @click="goAssessment">预约测评</view>
+    </view>
+  </view>
+</template>
+
+<script>
+import PageBanner from '../../components/PageBanner.vue'
+import { getEmiReport } from '../../utils/api.js'
+
+export default {
+  components: { PageBanner },
+  data: function() {
+    return {
+      childId: null,
+      report: null,
+      loading: true,
+      dimensions: [
+        { key: 'emotionScore', label: '情绪商数', icon: '\u2764\uFE0F', color: '#FF6B35', desc: '识别、理解和管理自身及他人情绪的能力' },
+        { key: 'resilienceScore', label: '心理韧性', icon: '\u{1F4AA}', color: '#F97316', desc: '面对压力和挫折时的适应与恢复能力' },
+        { key: 'stressCopingScore', label: '压力应对', icon: '\u{1F64F}', color: '#FB923C', desc: '有效应对生活压力和心理负担的能力' },
+        { key: 'selfAwarenessScore', label: '自我认知', icon: '\u{1F9EC}', color: '#FBBF24', desc: '对自身情绪、优势、弱点的深度理解' }
+      ]
+    }
+  },
+  onLoad: function(options) {
+    if (options && options.childId) {
+      this.childId = options.childId
+    } else {
+      this.childId = uni.getStorageSync('currentChildId') || null
+    }
+    this.loadReport()
+  },
+  methods: {
+    loadReport: function() {
+      var self = this
+      var childId = self.childId
+      if (!childId) {
+        self.loading = false
+        return
+      }
+      self.loading = true
+      getEmiReport(childId).then(function(res) {
+        if (res.code === 200 && res.data) {
+          self.report = res.data
+        }
+        self.loading = false
+      }).catch(function() {
+        self.loading = false
+      })
+    },
+    getScoreLevel: function(score) {
+      if (score >= 85) return 'excellent'
+      if (score >= 70) return 'good'
+      if (score >= 55) return 'average'
+      return 'low'
+    },
+    getScoreLevelText: function(score) {
+      if (score >= 85) return '优秀'
+      if (score >= 70) return '良好'
+      if (score >= 55) return '一般'
+      return '需提升'
+    },
+    goAssessment: function() {
+      uni.navigateTo({ url: '/pages/assessment/apply' })
+    },
+    goBack: function() {
+      uni.navigateBack({ delta: 1 })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.container {
+  min-height: 100vh;
+  background: #f5f7fa;
+  padding-bottom: 120rpx;
+}
+
+/* ===== 报告卡 ===== */
+.report-card {
+  margin: 20rpx 30rpx;
+  background: #fff;
+  border-radius: 24rpx;
+  padding: 40rpx;
+  box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
+}
+
+.report-header {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 30rpx;
+}
+
+.report-title {
+  font-size: 36rpx;
+  font-weight: bold;
+  color: #333;
+}
+
+.report-date {
+  font-size: 24rpx;
+  color: #999;
+}
+
+/* ===== 综合EQ ===== */
+.overall-wrap {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding: 40rpx 0;
+  background: linear-gradient(135deg, #FF6B35, #FFD700);
+  border-radius: 20rpx;
+  margin-bottom: 40rpx;
+  color: #fff;
+}
+
+.overall-label {
+  font-size: 28rpx;
+  opacity: 0.9;
+  margin-bottom: 8rpx;
+}
+
+.overall-value {
+  font-size: 80rpx;
+  font-weight: bold;
+  margin-bottom: 8rpx;
+}
+
+.overall-level {
+  font-size: 26rpx;
+  padding: 4rpx 24rpx;
+  border-radius: 20rpx;
+  background: rgba(255,255,255,0.3);
+}
+
+/* ===== 四维条形图 ===== */
+.dimension-list {
+  margin-bottom: 30rpx;
+}
+
+.dimension-item {
+  margin-bottom: 28rpx;
+}
+
+.dimension-header {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 10rpx;
+}
+
+.dimension-label-row {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+}
+
+.dimension-icon {
+  font-size: 28rpx;
+  margin-right: 10rpx;
+}
+
+.dimension-name {
+  font-size: 28rpx;
+  color: #333;
+  font-weight: 500;
+}
+
+.dimension-score-row {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+}
+
+.dimension-score {
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #FF6B35;
+  margin-right: 12rpx;
+}
+
+.dimension-level {
+  font-size: 22rpx;
+  padding: 2rpx 14rpx;
+  border-radius: 12rpx;
+}
+
+.level-excellent { color: #10B981; background: #ECFDF5; }
+.level-good { color: #3B82F6; background: #EFF6FF; }
+.level-average { color: #F97316; background: #FFF7ED; }
+.level-low { color: #EF4444; background: #FEF2F2; }
+
+.dimension-bar {
+  height: 18rpx;
+  background: #f0f0f0;
+  border-radius: 9rpx;
+  overflow: hidden;
+  margin-bottom: 8rpx;
+}
+
+.dimension-bar-fill {
+  height: 100%;
+  border-radius: 9rpx;
+  transition: width 0.5s;
+}
+
+.dimension-desc {
+  font-size: 22rpx;
+  color: #999;
+  line-height: 1.4;
+}
+
+/* ===== 分析/建议卡 ===== */
+.section-card {
+  margin-top: 30rpx;
+  padding: 28rpx;
+  background: #f9f9f9;
+  border-radius: 16rpx;
+}
+
+.suggestion-card {
+  background: #FFFBEB;
+}
+
+.section-header-row {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  margin-bottom: 16rpx;
+}
+
+.section-icon {
+  font-size: 30rpx;
+  margin-right: 10rpx;
+}
+
+.section-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+}
+
+.section-content {
+  font-size: 26rpx;
+  color: #666;
+  line-height: 1.7;
+  display: block;
+}
+
+/* ===== 底部操作 ===== */
+.action-row {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  margin-top: 40rpx;
+}
+
+.action-btn {
+  flex: 1;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 20rpx 0;
+  border-radius: 40rpx;
+}
+
+.action-btn.primary {
+  background: linear-gradient(135deg, #FF6B35, #FFD700);
+  margin-left: 16rpx;
+  box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
+}
+
+.action-btn.secondary {
+  background: #fff;
+  border: 2rpx solid #ddd;
+  margin-right: 16rpx;
+}
+
+.action-btn-text {
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #fff;
+}
+
+.action-btn.secondary .action-btn-text {
+  color: #666;
+}
+
+/* ===== 加载中 ===== */
+.loading-state {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 120rpx 0;
+}
+
+.loading-text {
+  font-size: 28rpx;
+  color: #999;
+}
+
+/* ===== 空状态 ===== */
+.empty-state {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding: 120rpx 40rpx 80rpx;
+}
+
+.empty-icon {
+  font-size: 100rpx;
+  margin-bottom: 20rpx;
+}
+
+.empty-title {
+  font-size: 32rpx;
+  color: #333;
+  font-weight: bold;
+  margin-bottom: 16rpx;
+}
+
+.empty-desc {
+  font-size: 26rpx;
+  color: #999;
+  text-align: center;
+  line-height: 1.6;
+  margin-bottom: 40rpx;
+}
+
+.empty-btn {
+  background: linear-gradient(135deg, #FF6B35, #FFD700);
+  color: #fff;
+  font-size: 28rpx;
+  font-weight: bold;
+  padding: 16rpx 64rpx;
+  border-radius: 40rpx;
+  box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
+}
+</style>

Разница между файлами не показана из-за своего большого размера
+ 709 - 244
cfc-frontend/pages/mind/index.vue


+ 267 - 0
cfc-frontend/pages/mind/member-mind-detail.vue

@@ -0,0 +1,267 @@
+<template>
+  <view class="detail-container">
+    <!-- 顶部导航 -->
+    <view class="nav-bar">
+      <view class="nav-back" @click="goBack">
+        <text class="nav-back-icon">&#x2190;</text>
+      </view>
+      <text class="nav-title">心 · 成员详情</text>
+    </view>
+
+    <!-- 五维能量条 -->
+    <FamilyEnergyBar
+      dimensionCode="mind"
+      :sandboxData="sandboxData"
+      :dualDimension="dualDimension" />
+
+    <!-- 成员信息卡 -->
+    <view class="member-card" v-if="memberInfo">
+      <view class="member-avatar mind-avatar">
+        <text class="avatar-text">{{ memberInfo.name && memberInfo.name.charAt(0) || '孩' }}</text>
+      </view>
+      <view class="member-info">
+        <text class="member-name">{{ memberInfo.name || '孩子' }}</text>
+        <text class="member-role">心智维度</text>
+      </view>
+      <view class="member-score" v-if="dualDimension">
+        <text class="score-value mind-score">{{ dualDimension.energy || 0 }}</text>
+        <text class="score-label">能量值</text>
+      </view>
+    </view>
+
+    <!-- 今日任务 -->
+    <DimensionTasks
+      dimensionCode="mind"
+      :tasks="dimensionTasks"
+      @taskClick="onTaskClick"
+      @moreTasks="goTasks" />
+
+    <!-- 活动 -->
+    <DimensionActivities
+      dimensionCode="mind"
+      :activities="dimensionActivities"
+      @activityClick="goActivityDetail"
+      @moreActivities="goMoreActivities" />
+
+    <!-- 商品 -->
+    <DimensionProducts
+      dimensionCode="mind"
+      :products="dimensionProducts"
+      @productClick="goProductDetail"
+      @moreProducts="goMoreProducts" />
+
+    <!-- 底部占位 -->
+    <view class="bottom-spacer"></view>
+  </view>
+</template>
+
+<script>
+import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
+import DimensionTasks from '../../components/DimensionTasks.vue'
+import DimensionActivities from '../../components/DimensionActivities.vue'
+import DimensionProducts from '../../components/DimensionProducts.vue'
+import { getEnergyOverview, getFamilyEnergySandbox, getTodayTasksByCategory, getActivityList, getProductsByDomain, getChildren } from '../../utils/api.js'
+
+export default {
+  components: { FamilyEnergyBar, DimensionTasks, DimensionActivities, DimensionProducts },
+  data() {
+    return {
+      childId: null,
+      memberInfo: null,
+      sandboxData: null,
+      dualDimension: null,
+      dimensionTasks: [],
+      dimensionActivities: [],
+      dimensionProducts: []
+    }
+  },
+  onLoad: function(options) {
+    this.childId = options.childId || uni.getStorageSync('currentChildId') || null
+  },
+  onShow: function() {
+    this.loadChildren()
+    this.loadSandboxData()
+    if (this.childId) {
+      this.loadEnergyData()
+      this.loadDimensionTasks()
+      this.loadDimensionActivities()
+      this.loadDimensionProducts()
+    }
+  },
+  methods: {
+    loadChildren: function() {
+      var self = this
+      getChildren().then(function(res) {
+        if (res.code === 200 && res.data) {
+          for (var i = 0; i < res.data.length; i++) {
+            if (res.data[i].childId === self.childId) {
+              self.memberInfo = res.data[i]
+              break
+            }
+          }
+          if (!self.memberInfo && res.data.length > 0) {
+            self.memberInfo = res.data[0]
+            self.childId = res.data[0].childId
+          }
+        }
+      }).catch(function() {})
+    },
+    loadSandboxData: function() {
+      var self = this
+      getFamilyEnergySandbox().then(function(res) {
+        if (res && res.data) self.sandboxData = res.data
+      }).catch(function() {})
+    },
+    loadEnergyData: function() {
+      var self = this
+      getEnergyOverview(this.childId).then(function(res) {
+        if (res && res.data) {
+          var dims = res.data.dimensions
+          if (dims && dims.length > 0) {
+            for (var i = 0; i < dims.length; i++) {
+              if (dims[i].code === 'mind') {
+                self.dualDimension = dims[i]
+                break
+              }
+            }
+          }
+        }
+      }).catch(function() {})
+    },
+    loadDimensionTasks: function() {
+      var self = this
+      getTodayTasksByCategory(this.childId, 'mind').then(function(res) {
+        if (res && res.data) {
+          self.dimensionTasks = Array.isArray(res.data) ? res.data.slice(0, 5) : []
+        }
+      }).catch(function() { self.dimensionTasks = [] })
+    },
+    loadDimensionActivities: function() {
+      var self = this
+      getActivityList({ dimensionCode: 'mind', page: 1, size: 3 }).then(function(res) {
+        if (res && res.data) {
+          var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
+          self.dimensionActivities = list.slice(0, 3)
+        }
+      }).catch(function() { self.dimensionActivities = [] })
+    },
+    loadDimensionProducts: function() {
+      var self = this
+      getProductsByDomain('mind', 1, 4).then(function(res) {
+        if (res && res.data) {
+          var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
+          self.dimensionProducts = list.slice(0, 4)
+        }
+      }).catch(function() { self.dimensionProducts = [] })
+    },
+    onTaskClick: function(task) {
+      uni.navigateTo({ url: '/pages/tasks/tasks' })
+    },
+    goActivityDetail: function(act) {
+      if (act && act.id) uni.navigateTo({ url: '/pages/discover/index?type=activity&id=' + act.id })
+    },
+    goMoreActivities: function() {
+      uni.navigateTo({ url: '/pages/discover/index?type=activity&dimension=mind' })
+    },
+    goProductDetail: function(prod) {
+      if (prod && prod.id) uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + prod.id })
+    },
+    goMoreProducts: function() {
+      uni.navigateTo({ url: '/pages/discover/index?type=product&domain=mind' })
+    },
+    goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
+    goBack: function() { uni.navigateBack() }
+  }
+}
+</script>
+
+<style scoped>
+.detail-container {
+  min-height: 100vh;
+  background: #f5f7fa;
+  padding-bottom: 40rpx;
+}
+.nav-bar {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  padding: 20rpx 30rpx;
+  background: #fff;
+}
+.nav-back {
+  padding: 10rpx;
+}
+.nav-back-icon {
+  font-size: 36rpx;
+  color: #333;
+}
+.nav-title {
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #333;
+  margin-left: 16rpx;
+}
+.member-card {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  margin: 20rpx 30rpx;
+  background: #fff;
+  border-radius: 20rpx;
+  padding: 24rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+}
+.member-avatar {
+  width: 80rpx;
+  height: 80rpx;
+  border-radius: 40rpx;
+  background: linear-gradient(135deg, #FF6B35, #FBBF24);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  margin-right: 20rpx;
+}
+.mind-avatar {
+  background: linear-gradient(135deg, #8B5CF6, #A78BFA);
+}
+.avatar-text {
+  font-size: 32rpx;
+  color: #fff;
+  font-weight: bold;
+}
+.member-info {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+}
+.member-name {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+}
+.member-role {
+  font-size: 24rpx;
+  color: #999;
+  margin-top: 4rpx;
+}
+.member-score {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+.score-value {
+  font-size: 40rpx;
+  font-weight: bold;
+  color: #FF6B35;
+}
+.mind-score {
+  color: #8B5CF6;
+}
+.score-label {
+  font-size: 22rpx;
+  color: #999;
+}
+.bottom-spacer {
+  height: 40rpx;
+}
+</style>

+ 336 - 111
cfc-frontend/pages/mind/training.vue

@@ -4,7 +4,35 @@
       tagline="能力训练"
       :quote="currentQuote" />
 
-    <!-- 训练描述卡片 -->
+    <!-- 训练概览 -->
+    <view class="stats-card" v-if="stats">
+      <view class="stats-row">
+        <view class="stats-item">
+          <text class="stats-value">{{ stats.totalGames || 0 }}</text>
+          <text class="stats-label">总训练次数</text>
+        </view>
+        <view class="stats-divider"></view>
+        <view class="stats-item">
+          <text class="stats-value">{{ stats.bestScore || 0 }}</text>
+          <text class="stats-label">最高分</text>
+        </view>
+        <view class="stats-divider"></view>
+        <view class="stats-item">
+          <text class="stats-value">{{ stats.avgScore ? Math.round(stats.avgScore) : 0 }}</text>
+          <text class="stats-label">平均分</text>
+        </view>
+        <view class="stats-divider"></view>
+        <view class="stats-item">
+          <text class="stats-value">{{ stats.totalPoints || 0 }}</text>
+          <text class="stats-label">累计积分</text>
+        </view>
+      </view>
+    </view>
+    <view class="stats-card stats-loading" v-else-if="statsLoading">
+      <text class="stats-loading-text">加载训练数据...</text>
+    </view>
+
+    <!-- 训练维度描述 -->
     <view class="dimension-card" v-if="currentDim">
       <view class="dimension-icon-wrap" :style="{ background: currentDim.lightColor }">
         <text class="dimension-icon">{{ currentDim.icon }}</text>
@@ -13,13 +41,51 @@
       <text class="dimension-desc">{{ currentDim.desc }}</text>
     </view>
 
-    <!-- 开始训练按钮 -->
-    <view class="action-section">
-      <button class="start-btn" :style="{ background: currentDim ? currentDim.color : '#8B5CF6' }"
-        :disabled="isTraining" @click="startTraining">
-        <text class="btn-text" v-if="!isTraining">开始训练</text>
-        <text class="btn-text" v-else>训练中...</text>
-      </button>
+    <!-- 推荐游戏 -->
+    <view class="section" v-if="currentDim && currentDim.games.length > 0">
+      <view class="section-header">
+        <text class="section-title">推荐训练</text>
+      </view>
+      <view class="game-list">
+        <view class="game-card" v-for="game in currentDim.games" :key="game.code" @click="goGame(game)">
+          <view class="game-icon-wrap" :style="{ background: currentDim.lightColor }">
+            <text class="game-card-icon">{{ game.icon }}</text>
+          </view>
+          <view class="game-info">
+            <text class="game-title">{{ game.name }}</text>
+            <text class="game-desc">{{ game.desc }}</text>
+          </view>
+          <text class="game-arrow">&#x2192;</text>
+        </view>
+      </view>
+    </view>
+
+    <!-- 成长建议 -->
+    <view class="section" v-if="currentDim">
+      <view class="section-header">
+        <text class="section-title">成长建议</text>
+      </view>
+      <view class="tip-card">
+        <view class="tip-left-bar" :style="{ background: currentDim.color }"></view>
+        <view class="tip-body">
+          <text class="tip-content">{{ currentDim.tip }}</text>
+        </view>
+      </view>
+    </view>
+
+    <!-- 其他维度训练 -->
+    <view class="section">
+      <view class="section-header">
+        <text class="section-title">其他维度</text>
+      </view>
+      <view class="other-grid">
+        <view class="other-item" v-for="dim in otherDimensions" :key="dim.key" @click="switchDimension(dim.key)">
+          <view class="other-icon-wrap" :style="{ background: dim.lightColor }">
+            <text class="other-icon">{{ dim.icon }}</text>
+          </view>
+          <text class="other-name">{{ dim.name }}</text>
+        </view>
+      </view>
     </view>
 
     <!-- 底部占位 -->
@@ -29,27 +95,7 @@
 
 <script>
 import PageBanner from '../../components/PageBanner.vue'
-
-var BASE_URL = 'http://localhost:9082'
-
-var accountInfo = null
-try {
-  accountInfo = uni.getAccountInfoSync()
-} catch (_e) {}
-var env = accountInfo && accountInfo.miniProgram && accountInfo.miniProgram.envVersion
-if (env) {
-  switch (env) {
-    case 'develop':
-      BASE_URL = 'http://localhost:9082'
-      break
-    case 'trial':
-      BASE_URL = 'https://cfc.iwintrue.com'
-      break
-    case 'release':
-      BASE_URL = 'https://cfc.etotem.com.cn'
-      break
-  }
-}
+import { getGameStats } from '../../utils/api.js'
 
 var DIMENSION_MAP = {
   perception: {
@@ -59,7 +105,10 @@ var DIMENSION_MAP = {
     color: '#8B5CF6',
     lightColor: '#EDE9FE',
     desc: '通过图形匹配、颜色分辨等练习提升感知能力',
-    quote: '观千剑而后识器,操千曲而后晓声'
+    tip: '感知力是认知的起点。多观察身边事物的细节,锻炼视觉辨识能力,能有效提升感知水平。',
+    games: [
+      { code: 'schulte', name: '舒尔特方格', icon: '\u{1F3AF}', desc: '快速定位数字,训练视觉搜索' }
+    ]
   },
   focus: {
     key: 'focus',
@@ -68,7 +117,10 @@ var DIMENSION_MAP = {
     color: '#F97316',
     lightColor: '#FFF7ED',
     desc: '通过舒尔特方格、数字追踪等练习提升专注力',
-    quote: '专心致志,惟弈秋之为听'
+    tip: '专注力是一切学习的基础。每天坚持10分钟专注训练,持续21天会有显著提升。',
+    games: [
+      { code: 'schulte', name: '舒尔特方格', icon: '\u{1F3AF}', desc: '按序点击数字,训练持续专注' }
+    ]
   },
   memory: {
     key: 'memory',
@@ -76,8 +128,11 @@ var DIMENSION_MAP = {
     icon: '\u{1F9E0}',
     color: '#10B981',
     lightColor: '#ECFDF5',
-    desc: '通过记忆卡片、数字记忆等练习提升记忆力',
-    quote: '温故而知新,可以为师矣'
+    desc: '通过数字记忆、序列回忆等练习提升记忆力',
+    tip: '记忆力可以通过科学训练显著提升。联想记忆法和间隔重复是最有效的两种方法。',
+    games: [
+      { code: '1a2b', name: '猜数字', icon: '\u{1F522}', desc: '记忆数字排列,训练工作记忆' }
+    ]
   },
   logic: {
     key: 'logic',
@@ -86,7 +141,11 @@ var DIMENSION_MAP = {
     color: '#3B82F6',
     lightColor: '#EFF6FF',
     desc: '通过推理题、模式识别等练习提升逻辑思维',
-    quote: '学而不思则罔,思而不学则殆'
+    tip: '逻辑思维是解决复杂问题的关键。多做推理和归纳练习,能帮助建立清晰的思维框架。',
+    games: [
+      { code: 'sudoku', name: '数独', icon: '\u{1F9E9}', desc: '数字逻辑推理,训练演绎思维' },
+      { code: '1a2b', name: '猜数字', icon: '\u{1F522}', desc: '逻辑排除推理,训练分析能力' }
+    ]
   },
   spatial: {
     key: 'spatial',
@@ -95,7 +154,10 @@ var DIMENSION_MAP = {
     color: '#8D6E63',
     lightColor: '#EFEBE9',
     desc: '通过空间旋转、立体构建等练习提升空间思维能力',
-    quote: '横看成岭侧成峰,远近高低各不同'
+    tip: '空间思维对数学和科学学习至关重要。拼图和积木是提升空间能力的最佳方式。',
+    games: [
+      { code: 'sudoku', name: '数独', icon: '\u{1F9E9}', desc: '九宫格空间布局,训练空间推理' }
+    ]
   },
   processingSpeed: {
     key: 'processingSpeed',
@@ -104,17 +166,28 @@ var DIMENSION_MAP = {
     color: '#FFD700',
     lightColor: '#FFFBEB',
     desc: '通过快速反应、速度测试等练习提升加工速度',
-    quote: '静如处子,动如脱兔'
+    tip: '加工速度影响学习和反应效率。速算、速读等限时练习是提升加工速度的有效方法。',
+    games: [
+      { code: 'schulte', name: '舒尔特方格', icon: '\u{1F3AF}', desc: '限时完成,训练反应速度' },
+      { code: '1a2b', name: '猜数字', icon: '\u{1F522}', desc: '快速推理,训练信息处理速度' }
+    ]
   }
 }
 
+var GAME_PAGES = {
+  schulte: '/pages/games/schulte',
+  '1a2b': '/pages/games/1a2b',
+  sudoku: '/pages/games/sudoku'
+}
+
 export default {
   components: { PageBanner },
-  data() {
+  data: function() {
     return {
       dimension: null,
       childId: null,
-      isTraining: false
+      stats: null,
+      statsLoading: false
     }
   },
   computed: {
@@ -124,7 +197,18 @@ export default {
     },
     currentQuote: function() {
       var dim = this.currentDim
-      return dim ? dim.quote : '知己知彼,百战不殆'
+      return dim ? dim.desc : '知己知彼,百战不殆'
+    },
+    otherDimensions: function() {
+      var self = this
+      var keys = Object.keys(DIMENSION_MAP)
+      var result = []
+      for (var i = 0; i < keys.length; i++) {
+        if (keys[i] !== self.dimension) {
+          result.push(DIMENSION_MAP[keys[i]])
+        }
+      }
+      return result
     }
   },
   onLoad: function(options) {
@@ -139,62 +223,37 @@ export default {
     uni.setNavigationBarTitle({
       title: this.currentDim ? this.currentDim.name : '能力训练'
     })
+    this.loadStats()
   },
   methods: {
-    startTraining: function() {
-      if (this.isTraining) return
-      this.isTraining = true
-
+    loadStats: function() {
       var self = this
-      setTimeout(function() {
-        var newScore = Math.floor(Math.random() * 31) + 70
-        self.updateScore(newScore)
-      }, 2000)
-    },
-    updateScore: function(score) {
-      var self = this
-      var token = uni.getStorageSync('token')
-      var userId = uni.getStorageSync('userId') || ''
-
-      uni.request({
-        url: BASE_URL + '/api/cognitive/update',
-        method: 'POST',
-        data: {
-          childId: self.childId,
-          dimension: self.dimension + 'Score',
-          score: score
-        },
-        header: {
-          'Content-Type': 'application/json',
-          'X-User-Id': userId,
-          'Authorization': token ? 'Bearer ' + token : ''
-        },
-        success: function(res) {
-          self.isTraining = false
-          if (res.data && res.data.code === 200) {
-            uni.showToast({
-              title: '训练完成!',
-              icon: 'success'
-            })
-            setTimeout(function() {
-              uni.navigateBack({
-                delta: 1
-              })
-            }, 1500)
-          } else {
-            uni.showToast({
-              title: res.data && res.data.message ? res.data.message : '提交失败',
-              icon: 'none'
-            })
-          }
-        },
-        fail: function() {
-          self.isTraining = false
-          uni.showToast({
-            title: '网络请求失败,请重试',
-            icon: 'none'
-          })
+      if (!self.childId) return
+      self.statsLoading = true
+      getGameStats({ childId: self.childId }).then(function(res) {
+        if (res && res.data) {
+          self.stats = res.data
         }
+      }).catch(function() {
+        // silent — stats not critical
+      }).finally(function() {
+        self.statsLoading = false
+      })
+    },
+    goGame: function(game) {
+      var url = GAME_PAGES[game.code]
+      if (!url) {
+        uni.showToast({ title: '游戏暂未开放', icon: 'none' })
+        return
+      }
+      var childId = this.childId || ''
+      url = url + '?childId=' + childId + '&dimension=' + (this.dimension || '')
+      uni.navigateTo({ url: url })
+    },
+    switchDimension: function(key) {
+      this.dimension = key
+      uni.setNavigationBarTitle({
+        title: DIMENSION_MAP[key].name
       })
     }
   }
@@ -208,7 +267,61 @@ export default {
   padding-bottom: 120rpx;
 }
 
-/* ===== 训练描述卡片 ===== */
+/* ===== 训练概览卡 ===== */
+.stats-card {
+  margin: 30rpx;
+  background: #fff;
+  border-radius: 20rpx;
+  padding: 36rpx 24rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+}
+
+.stats-row {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-around;
+}
+
+.stats-item {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  flex: 1;
+}
+
+.stats-value {
+  font-size: 44rpx;
+  font-weight: bold;
+  color: #F97316;
+  margin-bottom: 8rpx;
+}
+
+.stats-label {
+  font-size: 22rpx;
+  color: #999;
+}
+
+.stats-divider {
+  width: 1rpx;
+  height: 60rpx;
+  background: #eee;
+  flex-shrink: 0;
+}
+
+.stats-loading {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 24rpx;
+}
+
+.stats-loading-text {
+  font-size: 26rpx;
+  color: #bbb;
+}
+
+/* ===== 维度描述卡 ===== */
 .dimension-card {
   margin: 30rpx;
   background: #fff;
@@ -248,38 +361,150 @@ export default {
   line-height: 1.6;
 }
 
-/* ===== 按钮区域 ===== */
-.action-section {
+/* ===== 通用区段 ===== */
+.section {
   margin: 20rpx 30rpx;
 }
 
-.start-btn {
-  width: 100%;
-  height: 96rpx;
-  border-radius: 48rpx;
+.section-header {
+  margin-bottom: 20rpx;
+}
+
+.section-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+}
+
+/* ===== 推荐游戏列表 ===== */
+.game-list {
+  display: flex;
+  flex-direction: column;
+}
+
+.game-card {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  background: #fff;
+  border-radius: 20rpx;
+  padding: 24rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+  margin-bottom: 20rpx;
+}
+
+.game-card:active {
+  opacity: 0.7;
+}
+
+.game-icon-wrap {
+  width: 80rpx;
+  height: 80rpx;
+  border-radius: 40rpx;
   display: flex;
   align-items: center;
   justify-content: center;
-  border: none;
-  outline: none;
-  color: #fff;
-  font-size: 32rpx;
-  font-weight: 600;
-  box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.15);
+  margin-right: 20rpx;
+  flex-shrink: 0;
+}
+
+.game-card-icon {
+  font-size: 40rpx;
+}
+
+.game-info {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+}
+
+.game-title {
+  font-size: 28rpx;
+  font-weight: bold;
+  color: #333;
+  margin-bottom: 6rpx;
+}
+
+.game-desc {
+  font-size: 22rpx;
+  color: #999;
+}
+
+.game-arrow {
+  font-size: 28rpx;
+  color: #ccc;
+  margin-left: 16rpx;
+  flex-shrink: 0;
+}
+
+/* ===== 成长建议卡 ===== */
+.tip-card {
+  display: flex;
+  flex-direction: row;
+  background: #fff;
+  border-radius: 20rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+  overflow: hidden;
+}
+
+.tip-left-bar {
+  width: 6rpx;
+  flex-shrink: 0;
+}
+
+.tip-body {
+  flex: 1;
+  padding: 28rpx 24rpx;
+}
+
+.tip-content {
+  font-size: 26rpx;
+  color: #666;
+  line-height: 1.7;
+}
+
+/* ===== 其他维度网格 ===== */
+.other-grid {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+  margin: 0 -10rpx;
 }
 
-.start-btn[disabled] {
-  opacity: 0.6;
+.other-item {
+  width: calc(33.33% - 20rpx);
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  background: #fff;
+  border-radius: 16rpx;
+  padding: 24rpx 8rpx;
+  margin: 0 10rpx 20rpx;
+  box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.05);
 }
 
-.start-btn:active {
-  opacity: 0.85;
+.other-item:active {
+  opacity: 0.7;
 }
 
-.btn-text {
-  color: #fff;
+.other-icon-wrap {
+  width: 64rpx;
+  height: 64rpx;
+  border-radius: 32rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  margin-bottom: 10rpx;
+}
+
+.other-icon {
   font-size: 32rpx;
-  font-weight: 600;
+}
+
+.other-name {
+  font-size: 22rpx;
+  color: #666;
+  font-weight: 500;
 }
 
 /* ===== 底部 ===== */

+ 153 - 0
cfc-frontend/pages/policy/agreement.vue

@@ -0,0 +1,153 @@
+<template>
+  <view class="policy-container">
+    <view class="policy-content">
+      <text class="policy-title">用户协议</text>
+      <text class="policy-update">更新日期:2026年6月</text>
+
+      <view class="policy-section">
+        <text class="section-title">一、总则</text>
+        <text class="section-text">
+          欢迎使用浠艾福(Care Family)家庭健康成长俱乐部服务平台(以下简称"本平台")。本平台由亿图腾(北京)科技有限公司(以下简称"我们")运营。
+        </text>
+        <text class="section-text">
+          在注册、登录并使用本平台前,请您仔细阅读本协议的全部内容。如您不同意本协议的任何条款,请立即停止注册或使用本平台服务。您点击"同意"或完成注册即视为您已充分理解并接受本协议的全部内容。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">二、账号注册与管理</text>
+        <text class="section-text">
+          2.1 您通过微信账号授权登录本平台,授权登录即视为您注册本平台账号。
+        </text>
+        <text class="section-text">
+          2.2 您应妥善保管您的账号信息,因您保管不当导致的账号被盗用、信息泄露等损失由您自行承担。
+        </text>
+        <text class="section-text">
+          2.3 一个家庭可关联多个家庭成员账号,家长账号为家庭主账号,有权管理家庭成员及审核相关操作。
+        </text>
+        <text class="section-text">
+          2.4 如您发现账号存在安全漏洞或被他人非法使用,应立即通知我们。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">三、服务内容</text>
+        <text class="section-text">
+          3.1 本平台提供包括但不限于:家庭任务管理、五维能量评估、成长测评、活动课程报名、商城购物、成长规划师咨询等服务。
+        </text>
+        <text class="section-text">
+          3.2 我们有权根据业务发展需要调整、增加或减少服务内容,变更后的服务内容将在平台上公示。
+        </text>
+        <text class="section-text">
+          3.3 部分服务可能需要额外付费,付费标准以平台公示为准。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">四、用户行为规范</text>
+        <text class="section-text">
+          4.1 您承诺遵守国家法律法规,不得利用本平台从事任何违法违规活动。
+        </text>
+        <text class="section-text">
+          4.2 您不得利用本平台发布违法信息、侮辱诽谤他人、侵犯他人合法权益的内容。
+        </text>
+        <text class="section-text">
+          4.3 您不得对本平台进行反向工程、反向汇编、反向编译,不得破坏本平台的安全措施。
+        </text>
+        <text class="section-text">
+          4.4 如您违反上述约定,我们有权采取警告、限制功能、封禁账号等措施,并保留追究法律责任的权利。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">五、隐私保护</text>
+        <text class="section-text">
+          我们重视您的隐私保护,具体隐私政策请查阅《隐私政策》。我们采用业界通行的安全技术和管理措施保护您的个人信息安全。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">六、知识产权</text>
+        <text class="section-text">
+          本平台的所有内容,包括但不限于文字、图片、软件、界面设计、数据等,均属于我们或相关权利人所有,受知识产权法律法规保护。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">七、免责声明</text>
+        <text class="section-text">
+          7.1 我们将尽力保证平台服务的稳定性和安全性,但无法保证服务不会中断或完全没有错误。
+        </text>
+        <text class="section-text">
+          7.2 因不可抗力、系统维护、网络故障等原因导致的服务中断,我们不承担法律责任。
+        </text>
+        <text class="section-text">
+          7.3 本平台提供的健康评估、成长建议等信息仅供参考,不构成医疗建议或诊断结论。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">八、协议修改</text>
+        <text class="section-text">
+          我们有权根据需要修改本协议。修改后的协议将在平台公示,如您继续使用本平台服务,视为您接受修改后的协议。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">九、联系我们</text>
+        <text class="section-text">
+          如您对本协议有任何疑问,请联系我们:service@etotem.com.cn
+        </text>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  data() { return {} }
+}
+</script>
+
+<style scoped>
+.policy-container {
+  padding: 30rpx;
+  background: #fff;
+  min-height: 100vh;
+}
+.policy-content {
+  line-height: 1.8;
+}
+.policy-title {
+  font-size: 40rpx;
+  font-weight: bold;
+  color: #333;
+  display: block;
+  text-align: center;
+  margin-bottom: 12rpx;
+}
+.policy-update {
+  font-size: 24rpx;
+  color: #999;
+  display: block;
+  text-align: center;
+  margin-bottom: 40rpx;
+}
+.policy-section {
+  margin-bottom: 30rpx;
+}
+.section-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+  display: block;
+  margin-bottom: 12rpx;
+}
+.section-text {
+  font-size: 26rpx;
+  color: #666;
+  display: block;
+  margin-bottom: 8rpx;
+  text-indent: 2em;
+}
+</style>

+ 140 - 0
cfc-frontend/pages/policy/privacy.vue

@@ -0,0 +1,140 @@
+<template>
+  <view class="policy-container">
+    <view class="policy-content">
+      <text class="policy-title">隐私政策</text>
+      <text class="policy-update">更新日期:2026年6月</text>
+
+      <view class="policy-section">
+        <text class="section-title">一、引言</text>
+        <text class="section-text">
+          亿图腾(北京)科技有限公司(以下简称"我们")深知个人信息对您的重要性,我们将按照法律法规的要求,尽全力保护您的个人信息安全。本隐私政策旨在向您说明我们在您使用浠艾福(Care Family)平台时如何收集、使用、存储和保护您的个人信息。
+        </text>
+        <text class="section-text">
+          请您在使用本平台前仔细阅读本隐私政策。如您不同意本政策的任何内容,请立即停止使用本平台服务。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">二、我们收集的信息</text>
+        <text class="section-text">在您使用本平台过程中,我们可能会收集以下信息:</text>
+        <text class="section-text">2.1 微信授权信息:微信昵称、微信头像、微信OpenID,用于登录和身份识别。</text>
+        <text class="section-text">2.2 用户资料:您填写的昵称、头像、手机号码、家庭成员信息等。</text>
+        <text class="section-text">2.3 使用记录:打卡记录、任务完成记录、测评结果、活动参与记录等。</text>
+        <text class="section-text">2.4 设备信息:设备型号、操作系统版本、网络状态等,用于提供更好的服务体验。</text>
+        <text class="section-text">2.5 位置信息:如您使用与位置相关的功能,我们可能会获取您的位置信息。</text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">三、信息的使用</text>
+        <text class="section-text">我们收集的信息将用于以下目的:</text>
+        <text class="section-text">3.1 提供、维护和改进本平台的服务。</text>
+        <text class="section-text">3.2 个性化推荐和内容展示。</text>
+        <text class="section-text">3.3 与您沟通,发送服务通知、活动信息等。</text>
+        <text class="section-text">3.4 数据分析和研究,用于优化产品和服务。</text>
+        <text class="section-text">3.5 履行法定义务和保障平台安全。</text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">四、信息的共享与披露</text>
+        <text class="section-text">4.1 我们不会将您的个人信息出售给第三方。</text>
+        <text class="section-text">
+          4.2 在以下情况下,我们可能会共享您的信息:获得您的明确同意;为提供服务需要与合作伙伴共享(如支付服务商);法律法规要求;保护我们或他人的合法权益。
+        </text>
+        <text class="section-text">4.3 成长规划师在为您提供服务时,可查看您授权范围内的家庭信息和测评结果。</text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">五、信息安全</text>
+        <text class="section-text">
+          我们采用SSL/TLS加密传输、数据脱敏、访问权限控制、安全审计等业界通行的安全措施保护您的个人信息。但请注意,没有任何安全措施是100%完美的,我们将持续改进安全能力。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">六、信息存储期限</text>
+        <text class="section-text">
+          我们仅在实现本政策所述目的所必需的最短期限内保留您的个人信息,除非法律法规另有要求。超出保留期限后,我们将删除或匿名化处理您的信息。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">七、您的权利</text>
+        <text class="section-text">您对您的个人信息享有以下权利:</text>
+        <text class="section-text">7.1 查询、更正您的个人信息。</text>
+        <text class="section-text">7.2 删除您的个人信息(在不妨碍我们履行法定义务的前提下)。</text>
+        <text class="section-text">7.3 撤回授权同意,但撤回不影响此前基于同意进行的处理。</text>
+        <text class="section-text">7.4 注销账号,注销后我们将删除或匿名化处理您的信息。</text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">八、未成年人保护</text>
+        <text class="section-text">
+          我们非常重视未成年人个人信息保护。若您为未成年人,请在法定监护人陪同下阅读本政策,并确保在监护人同意后使用本平台服务。监护人应对未成年人的账号使用行为进行监督和管理。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">九、政策变更</text>
+        <text class="section-text">
+          我们可能适时修订本隐私政策。变更后的政策将在平台公示,重大变更我们会通过弹窗或推送等方式通知您。
+        </text>
+      </view>
+
+      <view class="policy-section">
+        <text class="section-title">十、联系方式</text>
+        <text class="section-text">
+          如您对本隐私政策有任何疑问、意见或投诉,请联系我们:service@etotem.com.cn
+        </text>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  data() { return {} }
+}
+</script>
+
+<style scoped>
+.policy-container {
+  padding: 30rpx;
+  background: #fff;
+  min-height: 100vh;
+}
+.policy-content {
+  line-height: 1.8;
+}
+.policy-title {
+  font-size: 40rpx;
+  font-weight: bold;
+  color: #333;
+  display: block;
+  text-align: center;
+  margin-bottom: 12rpx;
+}
+.policy-update {
+  font-size: 24rpx;
+  color: #999;
+  display: block;
+  text-align: center;
+  margin-bottom: 40rpx;
+}
+.policy-section {
+  margin-bottom: 30rpx;
+}
+.section-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+  display: block;
+  margin-bottom: 12rpx;
+}
+.section-text {
+  font-size: 26rpx;
+  color: #666;
+  display: block;
+  margin-bottom: 8rpx;
+  text-indent: 2em;
+}
+</style>

+ 417 - 0
cfc-frontend/pages/shop/address-edit/address-edit.vue

@@ -0,0 +1,417 @@
+<template>
+  <view class="container">
+    <view class="form-wrap">
+      <!-- 收货人 -->
+      <view class="form-row">
+        <text class="form-label">收货人</text>
+        <input
+          class="form-input"
+          v-model="form.receiverName"
+          placeholder="请输入收货人姓名"
+          placeholder-style="color: #ccc; font-size: 28rpx;"
+        />
+      </view>
+
+      <!-- 手机号 -->
+      <view class="form-row">
+        <text class="form-label">手机号</text>
+        <input
+          class="form-input"
+          v-model="form.phone"
+          placeholder="请输入手机号"
+          type="number"
+          maxlength="11"
+          placeholder-style="color: #ccc; font-size: 28rpx;"
+        />
+      </view>
+
+      <!-- 省市区街道 (4级地址选择) -->
+      <view class="form-row address-row" @click="showAddressPicker">
+        <text class="form-label">所在地区</text>
+        <view class="address-value-wrap">
+          <text v-if="form.fullAddress" class="address-value">{{ form.fullAddress }}</text>
+          <text v-else class="address-placeholder">请选择省市区街道</text>
+          <text class="address-arrow">›</text>
+        </view>
+      </view>
+
+      <!-- 详细地址 -->
+      <view class="form-row">
+        <text class="form-label">详细地址</text>
+        <input
+          class="form-input"
+          v-model="form.street"
+          placeholder="请输入详细地址"
+          placeholder-style="color: #ccc; font-size: 28rpx;"
+        />
+      </view>
+
+      <!-- 设为默认 -->
+      <view class="form-row switch-row">
+        <text class="form-label">设为默认地址</text>
+        <view
+          :class="['switch', form.isDefault === 1 ? 'switch-on' : '']"
+          @click="toggleDefault"
+        >
+          <view :class="['switch-knob', form.isDefault === 1 ? 'knob-on' : '']"></view>
+        </view>
+      </view>
+
+      <!-- Save Button -->
+      <button
+        :class="['save-btn', saving ? 'disabled' : '']"
+        :disabled="saving"
+        @click="onSave"
+      >
+        {{ saving ? '保存中...' : '保存地址' }}
+      </button>
+    </view>
+  </view>
+</template>
+
+<script>
+import config from '@/config.js'
+
+export default {
+  data() {
+    return {
+      addressId: null,
+      userId: null,
+      saving: false,
+      form: {
+        receiverName: '',
+        phone: '',
+        province: '',
+        city: '',
+        district: '',
+        street: '',
+        isDefault: 0,
+        fullAddress: ''
+      }
+    }
+  },
+  onLoad(options) {
+    this.userId = uni.getStorageSync('userId')
+    if (options.addressId) {
+      this.addressId = parseInt(options.addressId)
+      uni.setNavigationBarTitle({ title: '编辑地址' })
+      this.loadAddress()
+    } else {
+      uni.setNavigationBarTitle({ title: '新增地址' })
+    }
+  },
+  methods: {
+    loadAddress() {
+      var that = this
+      uni.request({
+        url: config.danshop('/danshop/address/get'),
+        method: 'POST',
+        data: { id: this.addressId },
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          if (res.data && res.data.code === 200) {
+            var data = res.data.data || {}
+            that.form.receiverName = data.receiverName || ''
+            that.form.phone = data.phone || ''
+            that.form.province = data.province || ''
+            that.form.city = data.city || ''
+            that.form.district = data.district || ''
+            that.form.street = data.street || ''
+            that.form.isDefault = data.isDefault || 0
+            that.form.fullAddress = (data.province || '') + (data.city || '') + (data.district || '') + (data.street || '')
+          }
+        }
+      })
+    },
+    showAddressPicker() {
+      // Use multi-column picker for region selection
+      var that = this
+      // Load provinces first
+      uni.showLoading({ title: '加载地址...' })
+      uni.request({
+        url: config.danshop('/danshop/region/provinces'),
+        method: 'POST',
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          uni.hideLoading()
+          if (res.data && res.data.code === 200) {
+            var provinces = res.data.data || []
+            var provinceList = provinces.map(function(p) { return p.name || p.province })
+            uni.showActionSheet({
+              itemList: provinceList,
+              success: function(pRes) {
+                var selectedProvince = provinces[pRes.tapIndex]
+                that.form.province = selectedProvince.name || selectedProvince.province
+                var provinceId = selectedProvince.id || selectedProvince.code
+                that.loadCities(provinceId)
+              }
+            })
+          } else {
+            // Fallback: simple text input for full address
+            that.showSimpleAddressInput()
+          }
+        },
+        fail: function() {
+          uni.hideLoading()
+          that.showSimpleAddressInput()
+        }
+      })
+    },
+    loadCities(provinceId) {
+      var that = this
+      uni.showLoading({ title: '加载城市...' })
+      uni.request({
+        url: config.danshop('/danshop/region/cities'),
+        method: 'POST',
+        data: { parentId: provinceId },
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          uni.hideLoading()
+          if (res.data && res.data.code === 200) {
+            var cities = res.data.data || []
+            var cityList = cities.map(function(c) { return c.name || c.city })
+            uni.showActionSheet({
+              itemList: cityList,
+              success: function(cRes) {
+                var selectedCity = cities[cRes.tapIndex]
+                that.form.city = selectedCity.name || selectedCity.city
+                var cityId = selectedCity.id || selectedCity.code
+                that.loadDistricts(cityId)
+              }
+            })
+          }
+        },
+        fail: function() {
+          uni.hideLoading()
+        }
+      })
+    },
+    loadDistricts(cityId) {
+      var that = this
+      uni.showLoading({ title: '加载区县...' })
+      uni.request({
+        url: config.danshop('/danshop/region/districts'),
+        method: 'POST',
+        data: { parentId: cityId },
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          uni.hideLoading()
+          if (res.data && res.data.code === 200) {
+            var districts = res.data.data || []
+            var districtList = districts.map(function(d) { return d.name || d.district })
+            uni.showActionSheet({
+              itemList: districtList,
+              success: function(dRes) {
+                var selectedDistrict = districts[dRes.tapIndex]
+                that.form.district = selectedDistrict.name || selectedDistrict.district
+                that.updateFullAddress()
+              }
+            })
+          }
+        },
+        fail: function() {
+          uni.hideLoading()
+        }
+      })
+    },
+    showSimpleAddressInput() {
+      var that = this
+      uni.showModal({
+        title: '请输入地址',
+        content: '请输入省市区街道信息',
+        editable: true,
+        placeholderText: '如: 北京市朝阳区XX街道',
+        success: function(res) {
+          if (res.confirm && res.content) {
+            that.form.fullAddress = res.content
+            that.form.province = res.content
+          }
+        }
+      })
+    },
+    updateFullAddress() {
+      this.form.fullAddress = (this.form.province || '') + (this.form.city || '') + (this.form.district || '') + (this.form.street || '')
+    },
+    toggleDefault() {
+      this.form.isDefault = this.form.isDefault === 1 ? 0 : 1
+    },
+    onSave() {
+      // Validate
+      if (!this.form.receiverName.trim()) {
+        uni.showToast({ title: '请输入收货人姓名', icon: 'none' })
+        return
+      }
+      if (!this.form.phone.trim() || this.form.phone.trim().length !== 11) {
+        uni.showToast({ title: '请输入正确的手机号', icon: 'none' })
+        return
+      }
+      if (!this.form.province && !this.form.fullAddress) {
+        uni.showToast({ title: '请选择所在地区', icon: 'none' })
+        return
+      }
+
+      this.saving = true
+      var data = {
+        userId: this.userId,
+        receiverName: this.form.receiverName.trim(),
+        phone: this.form.phone.trim(),
+        province: this.form.province,
+        city: this.form.city,
+        district: this.form.district,
+        street: this.form.street,
+        isDefault: this.form.isDefault
+      }
+      if (this.addressId) {
+        data.id = this.addressId
+      }
+
+      var that = this
+      uni.request({
+        url: config.danshop('/danshop/address/save'),
+        method: 'POST',
+        data: data,
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          that.saving = false
+          if (res.data && res.data.code === 200) {
+            uni.showToast({ title: '保存成功', icon: 'success' })
+            setTimeout(function() {
+              uni.navigateBack()
+            }, 1500)
+          } else {
+            uni.showToast({ title: res.data.message || '保存失败', icon: 'none' })
+          }
+        },
+        fail: function() {
+          that.saving = false
+          uni.showToast({ title: '网络请求失败', icon: 'none' })
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.container {
+  min-height: 100vh;
+  background: #f5f5f5;
+}
+.form-wrap {
+  padding: 20rpx;
+}
+.form-row {
+  background: #fff;
+  border-radius: 16rpx;
+  padding: 24rpx 20rpx;
+  margin-bottom: 20rpx;
+  display: flex;
+  align-items: center;
+}
+.form-label {
+  font-size: 28rpx;
+  color: #333;
+  width: 160rpx;
+  flex-shrink: 0;
+}
+.form-input {
+  flex: 1;
+  font-size: 28rpx;
+  color: #333;
+  text-align: right;
+  height: 48rpx;
+  line-height: 48rpx;
+}
+.address-row {
+  cursor: pointer;
+}
+.address-value-wrap {
+  flex: 1;
+  display: flex;
+  align-items: center;
+  justify-content: flex-end;
+}
+.address-value {
+  font-size: 28rpx;
+  color: #333;
+  text-align: right;
+  max-width: 400rpx;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.address-placeholder {
+  font-size: 28rpx;
+  color: #ccc;
+  text-align: right;
+}
+.address-arrow {
+  font-size: 36rpx;
+  color: #ccc;
+  margin-left: 8rpx;
+}
+.switch-row {
+  justify-content: space-between;
+}
+.switch {
+  width: 88rpx;
+  height: 48rpx;
+  background: #ddd;
+  border-radius: 24rpx;
+  position: relative;
+  transition: background 0.3s;
+  padding: 2rpx;
+}
+.switch.switch-on {
+  background: #F97316;
+}
+.switch-knob {
+  width: 44rpx;
+  height: 44rpx;
+  background: #fff;
+  border-radius: 50%;
+  position: absolute;
+  left: 2rpx;
+  top: 2rpx;
+  transition: left 0.3s;
+  box-shadow: 0 2rpx 4rpx rgba(0,0,0,0.2);
+}
+.switch-knob.knob-on {
+  left: 42rpx;
+}
+.save-btn {
+  margin-top: 40rpx;
+  width: 100%;
+  height: 88rpx;
+  line-height: 88rpx;
+  background: linear-gradient(135deg, #F97316, #FB923C);
+  color: #fff;
+  font-size: 32rpx;
+  font-weight: bold;
+  border-radius: 44rpx;
+  border: none;
+  text-align: center;
+}
+.save-btn::after {
+  border: none;
+}
+.save-btn.disabled {
+  background: #ddd;
+  color: #999;
+}
+</style>

+ 302 - 0
cfc-frontend/pages/shop/address/address.vue

@@ -0,0 +1,302 @@
+<template>
+  <view class="container">
+    <scroll-view
+      scroll-y
+      class="address-list"
+      refresher-enabled
+      :refresher-triggered="refreshing"
+      @refresherrefresh="onRefresh"
+    >
+      <view v-if="loading && addressList.length === 0" class="loading-wrap">
+        <text class="loading-text">加载中...</text>
+      </view>
+      <view v-else-if="addressList.length === 0" class="empty-wrap">
+        <text class="empty-icon">📍</text>
+        <text class="empty-text">暂无收货地址</text>
+      </view>
+      <view v-else>
+        <view
+          v-for="item in addressList"
+          :key="item.id"
+          class="address-card"
+          @click="onSelect(item)"
+        >
+          <view class="card-top">
+            <view class="name-phone">
+              <text class="receiver-name">{{ item.receiverName }}</text>
+              <text class="receiver-phone">{{ formatPhone(item.phone) }}</text>
+              <text v-if="item.isDefault === 1" class="default-badge">默认</text>
+            </view>
+          </view>
+          <text class="address-detail">
+            {{ item.province }}{{ item.city }}{{ item.district }}{{ item.street }}
+          </text>
+          <view class="card-actions">
+            <view class="set-default" v-if="item.isDefault !== 1">
+              <text class="set-default-btn" @click.stop="onSetDefault(item.id)">设为默认</text>
+            </view>
+            <view class="action-right">
+              <text class="action-btn edit-btn" @click.stop="onEdit(item.id)">✏️ 编辑</text>
+              <text class="action-btn delete-btn" @click.stop="onDelete(item.id)">🗑 删除</text>
+            </view>
+          </view>
+        </view>
+      </view>
+    </scroll-view>
+
+    <view class="bottom-bar">
+      <button class="add-btn" @click="onAdd">+ 新增地址</button>
+    </view>
+  </view>
+</template>
+
+<script>
+import config from '@/config.js'
+
+export default {
+  data() {
+    return {
+      addressList: [],
+      loading: false,
+      refreshing: false,
+      userId: null,
+      selectMode: false
+    }
+  },
+  onLoad(options) {
+    this.userId = uni.getStorageSync('userId')
+    if (options.selectMode) {
+      this.selectMode = options.selectMode === '1'
+    }
+    this.loadAddressList()
+  },
+  onShow() {
+    this.loadAddressList()
+  },
+  methods: {
+    loadAddressList() {
+      this.loading = true
+      var that = this
+      uni.request({
+        url: config.danshop('/danshop/address/list'),
+        method: 'POST',
+        data: { userId: this.userId },
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          that.loading = false
+          that.refreshing = false
+          if (res.data && res.data.code === 200) {
+            that.addressList = res.data.data || []
+          }
+        },
+        fail: function() {
+          that.loading = false
+          that.refreshing = false
+        }
+      })
+    },
+    onRefresh() {
+      this.refreshing = true
+      this.loadAddressList()
+    },
+    onSelect(item) {
+      if (this.selectMode) {
+        var pages = getCurrentPages()
+        var prevPage = pages[pages.length - 2]
+        if (prevPage) {
+          prevPage.selectedAddress = item
+        }
+        uni.navigateBack()
+      }
+    },
+    onEdit(id) {
+      uni.navigateTo({ url: '/pages/shop/address-edit/address-edit?addressId=' + id })
+    },
+    onAdd() {
+      uni.navigateTo({ url: '/pages/shop/address-edit/address-edit' })
+    },
+    onDelete(id) {
+      var that = this
+      uni.showModal({
+        title: '确认删除',
+        content: '确定删除该地址吗?',
+        success: function(confirm) {
+          if (confirm.confirm) {
+            uni.request({
+              url: config.danshop('/danshop/address/delete'),
+              method: 'POST',
+              data: { id: id },
+              header: {
+                'Content-Type': 'application/json',
+                'Authorization': 'Bearer ' + uni.getStorageSync('token')
+              },
+              success: function(res) {
+                if (res.data && res.data.code === 200) {
+                  uni.showToast({ title: '已删除', icon: 'success' })
+                  that.loadAddressList()
+                } else {
+                  uni.showToast({ title: res.data.message || '删除失败', icon: 'none' })
+                }
+              }
+            })
+          }
+        }
+      })
+    },
+    onSetDefault(id) {
+      var that = this
+      uni.request({
+        url: config.danshop('/danshop/address/setDefault'),
+        method: 'POST',
+        data: { id: id },
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          if (res.data && res.data.code === 200) {
+            uni.showToast({ title: '已设为默认', icon: 'success' })
+            that.loadAddressList()
+          }
+        }
+      })
+    },
+    formatPhone(phone) {
+      if (!phone) return ''
+      if (phone.length === 11) {
+        return phone.substr(0, 3) + '****' + phone.substr(7)
+      }
+      return phone
+    }
+  }
+}
+</script>
+
+<style scoped>
+.container {
+  display: flex;
+  flex-direction: column;
+  height: 100vh;
+  background: #f5f5f5;
+}
+.address-list {
+  flex: 1;
+  height: calc(100vh - 120rpx);
+}
+.loading-wrap,
+.empty-wrap {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding-top: 200rpx;
+}
+.loading-text {
+  font-size: 26rpx;
+  color: #999;
+}
+.empty-icon {
+  font-size: 100rpx;
+  margin-bottom: 30rpx;
+}
+.empty-text {
+  font-size: 28rpx;
+  color: #999;
+}
+.address-card {
+  background: #fff;
+  margin: 20rpx;
+  border-radius: 16rpx;
+  padding: 24rpx;
+  box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
+}
+.card-top {
+  margin-bottom: 10rpx;
+}
+.name-phone {
+  display: flex;
+  align-items: center;
+}
+.receiver-name {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+  margin-right: 20rpx;
+}
+.receiver-phone {
+  font-size: 26rpx;
+  color: #666;
+}
+.default-badge {
+  font-size: 20rpx;
+  color: #F97316;
+  background: #fff7e6;
+  padding: 2rpx 12rpx;
+  border-radius: 20rpx;
+  margin-left: 12rpx;
+}
+.address-detail {
+  display: block;
+  font-size: 26rpx;
+  color: #999;
+  line-height: 1.5;
+  margin-bottom: 16rpx;
+}
+.card-actions {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  border-top: 1rpx solid #f0f0f0;
+  padding-top: 16rpx;
+}
+.set-default-btn {
+  font-size: 24rpx;
+  color: #1890ff;
+  padding: 4rpx 12rpx;
+}
+.action-right {
+  display: flex;
+}
+.action-btn {
+  font-size: 24rpx;
+  padding: 4rpx 12rpx;
+  margin-left: 12rpx;
+}
+.edit-btn {
+  color: #666;
+}
+.delete-btn {
+  color: #ff4d4f;
+}
+.bottom-bar {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  height: 100rpx;
+  background: #fff;
+  border-top: 1rpx solid #eee;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 0 30rpx;
+  z-index: 100;
+}
+.add-btn {
+  width: 100%;
+  height: 72rpx;
+  line-height: 72rpx;
+  background: #fff;
+  color: #F97316;
+  font-size: 28rpx;
+  font-weight: bold;
+  border: 2rpx solid #F97316;
+  border-radius: 36rpx;
+  text-align: center;
+}
+.add-btn::after {
+  border: none;
+}
+</style>

+ 433 - 0
cfc-frontend/pages/shop/cart/cart.vue

@@ -0,0 +1,433 @@
+<template>
+  <view class="container">
+    <scroll-view
+      scroll-y
+      class="cart-list"
+      refresher-enabled
+      :refresher-triggered="refreshing"
+      @refresherrefresh="onRefresh"
+    >
+      <view v-if="loading && items.length === 0" class="loading-wrap">
+        <text class="loading-text">加载中...</text>
+      </view>
+      <view v-else-if="items.length === 0" class="empty-wrap">
+        <text class="empty-icon">🛒</text>
+        <text class="empty-text">购物车是空的</text>
+      </view>
+      <view v-else>
+        <view class="select-all-row">
+          <view class="checkbox-wrap" @click="toggleSelectAll">
+            <text :class="['checkbox', selectAll ? 'checked' : '']">
+              <text v-if="selectAll" class="checkmark">✓</text>
+            </text>
+            <text class="select-all-text">全选</text>
+          </view>
+        </view>
+        <view
+          v-for="item in items"
+          :key="item.productId"
+          class="cart-item-card"
+        >
+          <view class="item-left">
+            <image
+              class="item-image"
+              :src="item.coverImage || '/static/default-product.png'"
+              mode="aspectFill"
+            />
+          </view>
+          <view class="item-right">
+            <view class="item-header">
+              <view class="checkbox-wrap" @click="toggleItem(item.productId)">
+                <text :class="['checkbox', item.checked ? 'checked' : '']">
+                  <text v-if="item.checked" class="checkmark">✓</text>
+                </text>
+              </view>
+              <text class="item-name">{{ item.productName }}</text>
+              <text class="item-delete" @click="onRemove(item.productId)">🗑</text>
+            </view>
+            <view class="item-bottom">
+              <text class="item-price">¥{{ formatPrice(item.unitPrice) }}</text>
+              <view class="stepper">
+                <text class="stepper-btn" @click="decreaseQty(item)">−</text>
+                <text class="stepper-value">{{ item.quantity }}</text>
+                <text class="stepper-btn" @click="increaseQty(item)">+</text>
+              </view>
+            </view>
+            <text class="item-subtotal">小计: ¥{{ formatPrice(item.subtotal) }}</text>
+          </view>
+        </view>
+      </view>
+    </scroll-view>
+
+    <view class="bottom-bar" v-if="items.length > 0">
+      <view class="bottom-left">
+        <text class="selected-count">已选 {{ selectedCount }} 件</text>
+        <text class="total-amount-label">合计: </text>
+        <text class="total-amount">¥{{ formatPrice(totalAmount) }}</text>
+      </view>
+      <button
+        :class="['checkout-btn', selectedCount === 0 ? 'disabled' : '']"
+        :disabled="selectedCount === 0"
+        @click="goCheckout"
+      >去结算</button>
+    </view>
+  </view>
+</template>
+
+<script>
+import config from '@/config.js'
+
+export default {
+  data() {
+    return {
+      items: [],
+      loading: false,
+      refreshing: false,
+      userId: null
+    }
+  },
+  computed: {
+    selectAll() {
+      return this.items.length > 0 && this.items.every(function(item) {
+        return item.checked
+      })
+    },
+    selectedCount() {
+      var count = 0
+      for (var i = 0; i < this.items.length; i++) {
+        if (this.items[i].checked) {
+          count = count + this.items[i].quantity
+        }
+      }
+      return count
+    },
+    totalAmount() {
+      var total = 0
+      for (var i = 0; i < this.items.length; i++) {
+        if (this.items[i].checked) {
+          total = total + (this.items[i].subtotal || this.items[i].unitPrice * this.items[i].quantity)
+        }
+      }
+      return total
+    }
+  },
+  onLoad() {
+    this.userId = uni.getStorageSync('userId')
+    this.loadCart()
+  },
+  onShow() {
+    if (this.items.length > 0) {
+      this.loadCart()
+    }
+  },
+  methods: {
+    loadCart() {
+      if (this.loading) return
+      this.loading = true
+      var that = this
+      uni.request({
+        url: config.danshop('/danshop/cart/list'),
+        method: 'POST',
+        data: { userId: this.userId },
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          that.loading = false
+          that.refreshing = false
+          if (res.data && res.data.code === 200) {
+            var list = res.data.data || []
+            for (var i = 0; i < list.length; i++) {
+              list[i].checked = true
+            }
+            that.items = list
+          }
+        },
+        fail: function() {
+          that.loading = false
+          that.refreshing = false
+          uni.showToast({ title: '加载购物车失败', icon: 'none' })
+        }
+      })
+    },
+    onRefresh() {
+      this.refreshing = true
+      this.loadCart()
+    },
+    toggleSelectAll() {
+      var newState = !this.selectAll
+      for (var i = 0; i < this.items.length; i++) {
+        this.items[i].checked = newState
+      }
+    },
+    toggleItem(productId) {
+      for (var i = 0; i < this.items.length; i++) {
+        if (this.items[i].productId === productId) {
+          this.items[i].checked = !this.items[i].checked
+          break
+        }
+      }
+    },
+    increaseQty(item) {
+      item.quantity = item.quantity + 1
+      item.subtotal = item.unitPrice * item.quantity
+    },
+    decreaseQty(item) {
+      if (item.quantity <= 1) return
+      item.quantity = item.quantity - 1
+      item.subtotal = item.unitPrice * item.quantity
+    },
+    onRemove(productId) {
+      var that = this
+      uni.showModal({
+        title: '确认删除',
+        content: '确定从购物车移除该商品吗?',
+        success: function(confirm) {
+          if (confirm.confirm) {
+            uni.request({
+              url: config.danshop('/danshop/cart/remove'),
+              method: 'POST',
+              data: { userId: that.userId, productId: productId },
+              header: {
+                'Content-Type': 'application/json',
+                'Authorization': 'Bearer ' + uni.getStorageSync('token')
+              },
+              success: function(res) {
+                if (res.data && res.data.code === 200) {
+                  uni.showToast({ title: '已移除', icon: 'success' })
+                  that.loadCart()
+                }
+              }
+            })
+          }
+        }
+      })
+    },
+    goCheckout() {
+      if (this.selectedCount === 0) {
+        uni.showToast({ title: '请选择商品', icon: 'none' })
+        return
+      }
+      var selected = []
+      for (var i = 0; i < this.items.length; i++) {
+        if (this.items[i].checked) {
+          selected.push({
+            productId: this.items[i].productId,
+            productName: this.items[i].productName,
+            coverImage: this.items[i].coverImage,
+            unitPrice: this.items[i].unitPrice,
+            quantity: this.items[i].quantity
+          })
+        }
+      }
+      uni.setStorageSync('checkoutItems', selected)
+      uni.navigateTo({ url: '/pages/shop/checkout/checkout' })
+    },
+    formatPrice(price) {
+      if (price === null || price === undefined) return '0.00'
+      return Number(price).toFixed(2)
+    }
+  }
+}
+</script>
+
+<style scoped>
+.container {
+  display: flex;
+  flex-direction: column;
+  height: 100vh;
+  background: #f5f5f5;
+}
+.cart-list {
+  flex: 1;
+  height: calc(100vh - 120rpx);
+}
+.loading-wrap,
+.empty-wrap {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding-top: 200rpx;
+}
+.loading-text {
+  font-size: 26rpx;
+  color: #999;
+}
+.empty-icon {
+  font-size: 100rpx;
+  margin-bottom: 30rpx;
+}
+.empty-text {
+  font-size: 28rpx;
+  color: #999;
+}
+.select-all-row {
+  background: #fff;
+  padding: 20rpx 30rpx;
+  border-bottom: 1rpx solid #f0f0f0;
+}
+.checkbox-wrap {
+  display: flex;
+  align-items: center;
+}
+.checkbox {
+  width: 36rpx;
+  height: 36rpx;
+  border-radius: 50%;
+  border: 2rpx solid #ddd;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  margin-right: 12rpx;
+  font-size: 24rpx;
+  color: #fff;
+}
+.checkbox.checked {
+  background: #F97316;
+  border-color: #F97316;
+}
+.checkmark {
+  color: #fff;
+  font-weight: bold;
+}
+.select-all-text {
+  font-size: 26rpx;
+  color: #333;
+}
+.cart-item-card {
+  display: flex;
+  background: #fff;
+  margin: 16rpx 20rpx;
+  border-radius: 16rpx;
+  padding: 20rpx;
+  box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
+}
+.item-left {
+  margin-right: 16rpx;
+}
+.item-image {
+  width: 180rpx;
+  height: 180rpx;
+  border-radius: 12rpx;
+  background: #f0f0f0;
+}
+.item-right {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+  justify-content: space-between;
+  min-width: 0;
+}
+.item-header {
+  display: flex;
+  align-items: center;
+}
+.item-name {
+  flex: 1;
+  font-size: 26rpx;
+  color: #333;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  margin-left: 4rpx;
+}
+.item-delete {
+  font-size: 32rpx;
+  padding: 4rpx 8rpx;
+  color: #ccc;
+}
+.item-bottom {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-top: 12rpx;
+}
+.item-price {
+  font-size: 28rpx;
+  color: #F97316;
+  font-weight: bold;
+}
+.stepper {
+  display: flex;
+  align-items: center;
+  border: 1rpx solid #e0e0e0;
+  border-radius: 8rpx;
+  overflow: hidden;
+}
+.stepper-btn {
+  width: 56rpx;
+  height: 48rpx;
+  text-align: center;
+  line-height: 48rpx;
+  font-size: 28rpx;
+  color: #666;
+  background: #fafafa;
+}
+.stepper-value {
+  width: 64rpx;
+  height: 48rpx;
+  text-align: center;
+  line-height: 48rpx;
+  font-size: 26rpx;
+  color: #333;
+  border-left: 1rpx solid #e0e0e0;
+  border-right: 1rpx solid #e0e0e0;
+}
+.item-subtotal {
+  font-size: 22rpx;
+  color: #999;
+  text-align: right;
+  margin-top: 8rpx;
+}
+.bottom-bar {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  height: 100rpx;
+  background: #fff;
+  border-top: 1rpx solid #eee;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 0 30rpx;
+  z-index: 100;
+}
+.bottom-left {
+  display: flex;
+  align-items: baseline;
+}
+.selected-count {
+  font-size: 24rpx;
+  color: #666;
+  margin-right: 12rpx;
+}
+.total-amount-label {
+  font-size: 24rpx;
+  color: #666;
+}
+.total-amount {
+  font-size: 36rpx;
+  color: #F97316;
+  font-weight: bold;
+}
+.checkout-btn {
+  background: linear-gradient(135deg, #F97316, #FB923C);
+  color: #fff;
+  font-size: 28rpx;
+  font-weight: bold;
+  padding: 0 50rpx;
+  height: 72rpx;
+  line-height: 72rpx;
+  border-radius: 36rpx;
+  border: none;
+}
+.checkout-btn::after {
+  border: none;
+}
+.checkout-btn.disabled {
+  background: #ddd;
+  color: #999;
+}
+</style>

+ 431 - 0
cfc-frontend/pages/shop/checkout/checkout.vue

@@ -0,0 +1,431 @@
+<template>
+  <view class="container">
+    <view v-if="loading" class="loading-wrap">
+      <text class="loading-text">加载中...</text>
+    </view>
+    <scroll-view v-else scroll-y class="content">
+      <!-- Address Section -->
+      <view class="section address-section" @click="goSelectAddress">
+        <view v-if="selectedAddress" class="address-content">
+          <view class="address-top">
+            <text class="receiver-name">{{ selectedAddress.receiverName }}</text>
+            <text class="receiver-phone">{{ formatPhone(selectedAddress.phone) }}</text>
+            <text v-if="selectedAddress.isDefault === 1" class="default-badge">默认</text>
+          </view>
+          <text class="address-detail">
+            {{ selectedAddress.province }}{{ selectedAddress.city }}{{ selectedAddress.district }}{{ selectedAddress.street }}
+          </text>
+          <text class="address-arrow">›</text>
+        </view>
+        <view v-else class="address-empty" @click.stop="goAddAddress">
+          <text class="address-empty-icon">📍</text>
+          <text class="address-empty-text">请添加收货地址</text>
+          <text class="address-arrow">›</text>
+        </view>
+      </view>
+
+      <!-- Order Items Section -->
+      <view class="section">
+        <text class="section-title">商品信息</text>
+        <view
+          v-for="item in items"
+          :key="item.productId"
+          class="order-item"
+        >
+          <image
+            class="item-image"
+            :src="item.coverImage || '/static/default-product.png'"
+            mode="aspectFill"
+          />
+          <view class="item-info">
+            <text class="item-name">{{ item.productName }}</text>
+            <text class="item-qty">x{{ item.quantity }}</text>
+          </view>
+          <text class="item-price">¥{{ formatPrice(item.unitPrice) }}</text>
+        </view>
+      </view>
+
+      <!-- Freight Section -->
+      <view class="section">
+        <view class="info-row">
+          <text class="info-label">运费</text>
+          <text class="info-value">¥{{ formatPrice(freight) }}</text>
+        </view>
+      </view>
+
+      <!-- Remark Section -->
+      <view class="section">
+        <view class="info-row">
+          <text class="info-label">备注</text>
+          <input
+            class="remark-input"
+            v-model="remark"
+            placeholder="选填,给商家留言"
+            placeholder-style="color: #ccc; font-size: 26rpx;"
+          />
+        </view>
+      </view>
+
+      <view class="bottom-spacer"></view>
+    </scroll-view>
+
+    <view class="bottom-bar">
+      <view class="bottom-left">
+        <text class="total-label">合计: </text>
+        <text class="total-amount">¥{{ formatPrice(actualAmount + freight) }}</text>
+      </view>
+      <button
+        :class="['submit-btn', submitting ? 'disabled' : '']"
+        :disabled="submitting"
+        @click="onSubmit"
+      >提交订单</button>
+    </view>
+  </view>
+</template>
+
+<script>
+import config from '@/config.js'
+
+export default {
+  data() {
+    return {
+      items: [],
+      selectedAddress: null,
+      freight: 0,
+      remark: '',
+      loading: false,
+      submitting: false,
+      buyerId: null,
+      actualAmount: 0
+    }
+  },
+  onLoad() {
+    this.buyerId = uni.getStorageSync('userId')
+    var stored = uni.getStorageSync('checkoutItems')
+    if (stored) {
+      this.items = stored
+      this.calcAmount()
+    }
+    this.loadDefaultAddress()
+  },
+  methods: {
+    calcAmount() {
+      var total = 0
+      for (var i = 0; i < this.items.length; i++) {
+        total = total + (this.items[i].unitPrice * this.items[i].quantity)
+      }
+      this.actualAmount = total
+    },
+    loadDefaultAddress() {
+      this.loading = true
+      var that = this
+      uni.request({
+        url: config.danshop('/danshop/address/list'),
+        method: 'POST',
+        data: { userId: this.buyerId },
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          that.loading = false
+          if (res.data && res.data.code === 200) {
+            var list = res.data.data || []
+            for (var i = 0; i < list.length; i++) {
+              if (list[i].isDefault === 1) {
+                that.selectedAddress = list[i]
+                break
+              }
+            }
+            if (!that.selectedAddress && list.length > 0) {
+              that.selectedAddress = list[0]
+            }
+          }
+        },
+        fail: function() {
+          that.loading = false
+        }
+      })
+    },
+    goSelectAddress() {
+      uni.navigateTo({
+        url: '/pages/shop/address/address?selectMode=1',
+        events: {
+          onAddressSelect: function(data) {
+            // handled in event channel
+          }
+        },
+        success: function(res) {
+          res.eventChannel.on('onAddressSelect', function(data) {
+            // This will use getApp() or global approach
+          })
+        }
+      })
+    },
+    goAddAddress() {
+      uni.navigateTo({ url: '/pages/shop/address-edit/address-edit' })
+    },
+    onSubmit() {
+      if (!this.selectedAddress) {
+        uni.showToast({ title: '请选择收货地址', icon: 'none' })
+        return
+      }
+      if (this.items.length === 0) {
+        uni.showToast({ title: '请选择商品', icon: 'none' })
+        return
+      }
+      this.submitting = true
+      var orderItems = []
+      for (var i = 0; i < this.items.length; i++) {
+        orderItems.push({
+          productId: this.items[i].productId,
+          quantity: this.items[i].quantity
+        })
+      }
+      var that = this
+      uni.request({
+        url: config.danshop('/danshop/order/create'),
+        method: 'POST',
+        data: {
+          buyerId: this.buyerId,
+          addressId: this.selectedAddress.id,
+          items: orderItems,
+          remark: this.remark,
+          freight: this.freight
+        },
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          that.submitting = false
+          if (res.data && res.data.code === 200) {
+            var order = res.data.data
+            uni.showToast({ title: '下单成功', icon: 'success' })
+            uni.removeStorageSync('checkoutItems')
+            setTimeout(function() {
+              uni.navigateTo({
+                url: '/pages/shop/payment/payment?orderNo=' + order.orderNo + '&amount=' + order.actualAmount
+              })
+            }, 1000)
+          } else {
+            uni.showToast({ title: res.data.message || '下单失败', icon: 'none' })
+          }
+        },
+        fail: function() {
+          that.submitting = false
+          uni.showToast({ title: '网络请求失败', icon: 'none' })
+        }
+      })
+    },
+    formatPrice(price) {
+      if (price === null || price === undefined) return '0.00'
+      return Number(price).toFixed(2)
+    },
+    formatPhone(phone) {
+      if (!phone) return ''
+      if (phone.length === 11) {
+        return phone.substr(0, 3) + '****' + phone.substr(7)
+      }
+      return phone
+    }
+  }
+}
+</script>
+
+<style scoped>
+.container {
+  min-height: 100vh;
+  background: #f5f5f5;
+}
+.loading-wrap {
+  display: flex;
+  justify-content: center;
+  padding-top: 200rpx;
+}
+.loading-text {
+  font-size: 28rpx;
+  color: #999;
+}
+.content {
+  height: calc(100vh - 120rpx);
+}
+.section {
+  background: #fff;
+  margin: 20rpx;
+  border-radius: 16rpx;
+  padding: 24rpx;
+}
+.section-title {
+  font-size: 28rpx;
+  font-weight: bold;
+  color: #333;
+  margin-bottom: 20rpx;
+  display: block;
+}
+.address-section {
+  position: relative;
+}
+.address-content {
+  position: relative;
+}
+.address-top {
+  display: flex;
+  align-items: center;
+  margin-bottom: 10rpx;
+}
+.receiver-name {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+  margin-right: 20rpx;
+}
+.receiver-phone {
+  font-size: 26rpx;
+  color: #666;
+}
+.default-badge {
+  font-size: 20rpx;
+  color: #F97316;
+  background: #fff7e6;
+  padding: 2rpx 12rpx;
+  border-radius: 20rpx;
+  margin-left: 12rpx;
+}
+.address-detail {
+  font-size: 26rpx;
+  color: #999;
+  line-height: 1.5;
+}
+.address-arrow {
+  position: absolute;
+  right: 0;
+  top: 50%;
+  font-size: 40rpx;
+  color: #ccc;
+  transform: translateY(-50%);
+}
+.address-empty {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 30rpx 0;
+  position: relative;
+}
+.address-empty-icon {
+  font-size: 40rpx;
+  margin-right: 12rpx;
+}
+.address-empty-text {
+  font-size: 28rpx;
+  color: #999;
+}
+.order-item {
+  display: flex;
+  align-items: center;
+  padding: 16rpx 0;
+  border-bottom: 1rpx solid #f5f5f5;
+}
+.order-item:last-child {
+  border-bottom: none;
+}
+.item-image {
+  width: 80rpx;
+  height: 80rpx;
+  border-radius: 8rpx;
+  background: #f0f0f0;
+  margin-right: 16rpx;
+}
+.item-info {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+  min-width: 0;
+}
+.item-name {
+  font-size: 26rpx;
+  color: #333;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  margin-bottom: 6rpx;
+}
+.item-qty {
+  font-size: 22rpx;
+  color: #999;
+}
+.item-price {
+  font-size: 26rpx;
+  color: #F97316;
+  font-weight: bold;
+  margin-left: 16rpx;
+}
+.info-row {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 8rpx 0;
+}
+.info-label {
+  font-size: 26rpx;
+  color: #999;
+}
+.info-value {
+  font-size: 26rpx;
+  color: #333;
+}
+.remark-input {
+  flex: 1;
+  text-align: right;
+  font-size: 26rpx;
+  color: #333;
+}
+.bottom-spacer {
+  height: 140rpx;
+}
+.bottom-bar {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  height: 100rpx;
+  background: #fff;
+  border-top: 1rpx solid #eee;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 0 30rpx;
+  z-index: 100;
+}
+.bottom-left {
+  display: flex;
+  align-items: baseline;
+}
+.total-label {
+  font-size: 26rpx;
+  color: #666;
+}
+.total-amount {
+  font-size: 36rpx;
+  color: #F97316;
+  font-weight: bold;
+}
+.submit-btn {
+  background: linear-gradient(135deg, #F97316, #FB923C);
+  color: #fff;
+  font-size: 28rpx;
+  font-weight: bold;
+  padding: 0 60rpx;
+  height: 72rpx;
+  line-height: 72rpx;
+  border-radius: 36rpx;
+  border: none;
+}
+.submit-btn::after {
+  border: none;
+}
+.submit-btn.disabled {
+  background: #ddd;
+  color: #999;
+}
+</style>

+ 300 - 0
cfc-frontend/pages/shop/detail/detail.vue

@@ -0,0 +1,300 @@
+<template>
+  <view class="container">
+    <view v-if="loading" class="loading-wrap">
+      <text class="loading-text">加载中...</text>
+    </view>
+    <scroll-view v-else-if="product && product.id" scroll-y class="content">
+      <image
+        class="cover"
+        :src="product.coverImage || product.image || '/static/default-product.png'"
+        mode="widthFix"
+      />
+      <view class="info-section">
+        <view class="name-row">
+          <text class="product-name">{{ product.name }}</text>
+        </view>
+        <view class="price-row">
+          <text class="price">¥{{ product.price }}</text>
+          <text v-if="product.memberPrice" class="member-price">会员价 ¥{{ product.memberPrice }}</text>
+        </view>
+        <view class="meta-row">
+          <text v-if="product.productType" class="meta-item">{{ typeLabel }}</text>
+          <text v-if="product.domain" class="meta-item">{{ domainLabel }}</text>
+          <text class="meta-item">库存 {{ product.stock || 0 }}</text>
+        </view>
+        <view v-if="product.brandName" class="vendor-row">
+          <text class="vendor-label">品牌:</text>
+          <text class="vendor-name">{{ product.brandName }}</text>
+        </view>
+      </view>
+
+      <view class="desc-section">
+        <text class="section-title">商品介绍</text>
+        <text class="desc-text">{{ product.description || '暂无介绍' }}</text>
+      </view>
+
+      <view v-if="product.intro" class="intro-section">
+        <text class="section-title">详细介绍</text>
+        <text class="intro-text">{{ product.intro }}</text>
+      </view>
+
+      <view class="bottom-bar">
+        <view class="price-info">
+          <text class="bottom-price">¥{{ product.price }}</text>
+          <text v-if="product.memberPrice" class="bottom-member">会员¥{{ product.memberPrice }}</text>
+        </view>
+        <view class="action-btns">
+          <view class="btn-favorite" @click="onToggleFavorite">
+            <text>{{ isFavorite ? '❤️' : '🤍' }}</text>
+          </view>
+          <button class="btn-cart" @click="onAddCart">加入购物车</button>
+          <button class="btn-buy" @click="onBuy">立即购买</button>
+        </view>
+      </view>
+    </scroll-view>
+    <view v-else class="empty-wrap">
+      <text class="empty-text">商品不存在或已下架</text>
+    </view>
+  </view>
+</template>
+
+<script>
+import { danshopProductDetail, danshopCartAdd, danshopFavoriteAdd, danshopFavoriteRemove } from '@/utils/api.js'
+
+export default {
+  data() {
+    return {
+      product: {},
+      loading: false,
+      isFavorite: false,
+      productId: null
+    }
+  },
+  computed: {
+    typeLabel() {
+      var map = { activity: '活动', course: '课程', physical: '实物', digital: '数字', service: '服务' }
+      return map[this.product.productType] || this.product.productType
+    },
+    domainLabel() {
+      var map = { action: '行动', mind: '心智', body: '身体', wisdom: '智慧', wealth: '财富' }
+      return map[this.product.domain] || this.product.domain
+    }
+  },
+  onLoad(options) {
+    if (options.id) {
+      this.productId = options.id
+      this.loadDetail(options.id)
+    }
+  },
+  methods: {
+    loadDetail(id) {
+      this.loading = true
+      danshopProductDetail({ id: parseInt(id) }).then(function(res) {
+        this.loading = false
+        if (res.code === 200 && res.data) {
+          this.product = res.data
+          this.isFavorite = res.data.isFavorite || false
+        }
+      }.bind(this)).catch(function() {
+        this.loading = false
+      }.bind(this))
+    },
+    onAddCart() {
+      danshopCartAdd({ productId: parseInt(this.productId), quantity: 1 }).then(function(res) {
+        if (res.code === 200) {
+          uni.showToast({ title: '已加入购物车', icon: 'success' })
+        } else {
+          uni.showToast({ title: res.message || '添加失败', icon: 'none' })
+        }
+      }.bind(this)).catch(function() {})
+    },
+    onBuy() {
+      var userId = uni.getStorageSync('userId')
+      if (!userId) {
+        uni.navigateTo({ url: '/pages/login/login' })
+        return
+      }
+      uni.navigateTo({
+        url: '/pages/shop/checkout/checkout?productId=' + this.productId + '&quantity=1'
+      })
+    },
+    onToggleFavorite() {
+      var action = this.isFavorite ? danshopFavoriteRemove : danshopFavoriteAdd
+      var self = this
+      action({ productId: parseInt(this.productId) }).then(function(res) {
+        if (res.code === 200) {
+          self.isFavorite = !self.isFavorite
+          uni.showToast({ title: self.isFavorite ? '已收藏' : '已取消收藏', icon: 'success' })
+        }
+      }.bind(this)).catch(function() {})
+    }
+  }
+}
+</script>
+
+<style scoped>
+.container {
+  min-height: 100vh;
+  background: #f5f5f5;
+}
+.loading-wrap,
+.empty-wrap {
+  display: flex;
+  justify-content: center;
+  padding-top: 200rpx;
+}
+.loading-text,
+.empty-text {
+  font-size: 28rpx;
+  color: #999;
+}
+.content {
+  height: calc(100vh - 120rpx);
+  padding-bottom: 120rpx;
+}
+.cover {
+  width: 100%;
+  background: #f0f0f0;
+}
+.info-section {
+  background: #fff;
+  padding: 30rpx;
+  margin-bottom: 20rpx;
+}
+.name-row {
+  margin-bottom: 16rpx;
+}
+.product-name {
+  font-size: 34rpx;
+  font-weight: bold;
+  color: #333;
+  line-height: 1.4;
+}
+.price-row {
+  display: flex;
+  align-items: baseline;
+  margin-bottom: 16rpx;
+}
+.price {
+  font-size: 40rpx;
+  color: #F97316;
+  font-weight: bold;
+  margin-right: 20rpx;
+}
+.member-price {
+  font-size: 26rpx;
+  color: #999;
+}
+.meta-row {
+  display: flex;
+  flex-wrap: wrap;
+  margin-bottom: 12rpx;
+}
+.meta-item {
+  font-size: 22rpx;
+  color: #999;
+  background: #f5f5f5;
+  padding: 4rpx 16rpx;
+  border-radius: 4rpx;
+  margin-right: 12rpx;
+  margin-bottom: 8rpx;
+}
+.vendor-row {
+  display: flex;
+  align-items: center;
+}
+.vendor-label {
+  font-size: 24rpx;
+  color: #999;
+}
+.vendor-name {
+  font-size: 24rpx;
+  color: #666;
+}
+.desc-section,
+.intro-section {
+  background: #fff;
+  padding: 30rpx;
+  margin-bottom: 20rpx;
+}
+.section-title {
+  font-size: 28rpx;
+  font-weight: bold;
+  color: #333;
+  margin-bottom: 16rpx;
+  display: block;
+}
+.desc-text,
+.intro-text {
+  font-size: 26rpx;
+  color: #666;
+  line-height: 1.6;
+  display: block;
+}
+.bottom-bar {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  height: 100rpx;
+  background: #fff;
+  border-top: 1rpx solid #eee;
+  display: flex;
+  align-items: center;
+  padding: 0 20rpx;
+  z-index: 100;
+}
+.price-info {
+  display: flex;
+  align-items: baseline;
+  flex-shrink: 0;
+}
+.bottom-price {
+  font-size: 36rpx;
+  color: #F97316;
+  font-weight: bold;
+}
+.bottom-member {
+  font-size: 24rpx;
+  color: #999;
+  margin-left: 10rpx;
+}
+.action-btns {
+  display: flex;
+  align-items: center;
+  margin-left: auto;
+}
+.btn-favorite {
+  font-size: 40rpx;
+  margin-right: 16rpx;
+  padding: 0 8rpx;
+}
+.btn-cart {
+  background: #fff;
+  color: #F97316;
+  border: 2rpx solid #F97316;
+  font-size: 24rpx;
+  padding: 0 20rpx;
+  height: 60rpx;
+  line-height: 60rpx;
+  border-radius: 30rpx;
+  margin-right: 16rpx;
+}
+.btn-cart::after {
+  border: none;
+}
+.btn-buy {
+  background: linear-gradient(135deg, #F97316, #FB923C);
+  color: #fff;
+  font-size: 26rpx;
+  font-weight: bold;
+  padding: 0 40rpx;
+  height: 60rpx;
+  line-height: 60rpx;
+  border-radius: 30rpx;
+  border: none;
+}
+.btn-buy::after {
+  border: none;
+}
+</style>

+ 1 - 6
cfc-frontend/pages/shop/index.vue

@@ -198,12 +198,7 @@ export default {
       })
     },
     goDetail(id) {
-      const token = uni.getStorageSync('token')
-      if (token) {
-        uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + id })
-      } else {
-        uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/action/index') })
-      }
+      uni.navigateTo({ url: '/pages/shop/detail/detail?id=' + id })
     }
   }
 }

+ 322 - 0
cfc-frontend/pages/shop/logistics/logistics.vue

@@ -0,0 +1,322 @@
+<template>
+  <view class="container">
+    <view v-if="loading" class="loading-wrap">
+      <text class="loading-text">加载中...</text>
+    </view>
+    <scroll-view v-else scroll-y class="content">
+      <!-- Header -->
+      <view class="header-section">
+        <view class="header-top">
+          <text class="order-no">订单号: {{ orderNo }}</text>
+          <text :class="['status-badge', 'status-' + logisticsStatus]">{{ statusLabel }}</text>
+        </view>
+        <button class="refresh-btn" @click="loadLogistics">刷新物流信息</button>
+      </view>
+
+      <!-- Logistics Info -->
+      <view v-if="logisticsData.logisticsNo" class="section">
+        <text class="section-title">物流信息</text>
+        <view class="info-row">
+          <text class="info-label">物流公司</text>
+          <text class="info-value">{{ logisticsData.logisticsCompany || logisticsData.logisticsName }}</text>
+        </view>
+        <view class="info-row">
+          <text class="info-label">物流单号</text>
+          <view class="copy-row">
+            <text class="info-value">{{ logisticsData.logisticsNo }}</text>
+            <text class="copy-btn" @click="onCopy(logisticsData.logisticsNo)">复制</text>
+          </view>
+        </view>
+      </view>
+
+      <!-- Tracking Timeline -->
+      <view class="section" v-if="trackingData && trackingData.length > 0">
+        <text class="section-title">物流追踪</text>
+        <view class="timeline">
+          <view
+            v-for="(node, index) in trackingData"
+            :key="index"
+            :class="['timeline-node', index === 0 ? 'latest' : '']"
+          >
+            <view class="timeline-dot-wrap">
+              <view :class="['timeline-dot', index === 0 ? 'dot-orange' : 'dot-gray']"></view>
+              <view v-if="index < trackingData.length - 1" class="timeline-line"></view>
+            </view>
+            <view class="timeline-content">
+              <text class="timeline-text">{{ node.content }}</text>
+              <text class="timeline-time">{{ node.time }}</text>
+            </view>
+          </view>
+        </view>
+      </view>
+
+      <!-- Empty tracking -->
+      <view v-else-if="logisticsData.logisticsNo && (!trackingData || trackingData.length === 0)" class="section">
+        <view class="empty-tracking">
+          <text class="empty-icon">🚚</text>
+          <text class="empty-text">暂无物流信息</text>
+        </view>
+      </view>
+    </scroll-view>
+  </view>
+</template>
+
+<script>
+import config from '@/config.js'
+
+export default {
+  data() {
+    return {
+      orderNo: '',
+      orderId: null,
+      loading: false,
+      logisticsData: {},
+      trackingData: [],
+      logisticsStatus: 'pending'
+    }
+  },
+  computed: {
+    statusLabel() {
+      var map = {
+        pending: '待发货',
+        shipped: '已发货',
+        signing: '派送中',
+        completed: '已签收'
+      }
+      return map[this.logisticsStatus] || this.logisticsStatus
+    }
+  },
+  onLoad(options) {
+    if (options.orderNo) {
+      this.orderNo = options.orderNo
+    }
+    if (options.orderId) {
+      this.orderId = parseInt(options.orderId)
+    }
+    this.loadLogistics()
+  },
+  methods: {
+    loadLogistics() {
+      if (!this.orderId) {
+        uni.showToast({ title: '订单ID缺失', icon: 'none' })
+        return
+      }
+      this.loading = true
+      var that = this
+      uni.request({
+        url: config.danshop('/danshop/logistics/query'),
+        method: 'POST',
+        data: { orderId: this.orderId },
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          that.loading = false
+          if (res.data && res.data.code === 200) {
+            var data = res.data.data || {}
+            that.logisticsData = data
+            that.trackingData = data.trackingData || []
+            if (data.status) {
+              that.logisticsStatus = data.status
+            }
+          } else {
+            uni.showToast({ title: res.data.message || '查询失败', icon: 'none' })
+          }
+        },
+        fail: function() {
+          that.loading = false
+          uni.showToast({ title: '网络请求失败', icon: 'none' })
+        }
+      })
+    },
+    onCopy(text) {
+      uni.setClipboardData({
+        data: text,
+        success: function() {
+          uni.showToast({ title: '已复制', icon: 'success' })
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.container {
+  min-height: 100vh;
+  background: #f5f5f5;
+}
+.loading-wrap {
+  display: flex;
+  justify-content: center;
+  padding-top: 200rpx;
+}
+.loading-text {
+  font-size: 28rpx;
+  color: #999;
+}
+.content {
+  height: calc(100vh - 120rpx);
+}
+.header-section {
+  background: #fff;
+  padding: 30rpx;
+  border-bottom: 1rpx solid #f0f0f0;
+  display: flex;
+  flex-direction: column;
+}
+.header-top {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 20rpx;
+}
+.order-no {
+  font-size: 26rpx;
+  color: #666;
+}
+.status-badge {
+  font-size: 22rpx;
+  padding: 4rpx 16rpx;
+  border-radius: 20rpx;
+}
+.status-pending {
+  background: #fff7e6;
+  color: #fa8c16;
+}
+.status-shipped {
+  background: #e6f7ff;
+  color: #1890ff;
+}
+.status-signing {
+  background: #fff7e6;
+  color: #fa8c16;
+}
+.status-completed {
+  background: #f6ffed;
+  color: #52c41a;
+}
+.refresh-btn {
+  font-size: 24rpx;
+  color: #F97316;
+  background: #fff7e6;
+  border: 1rpx solid #F97316;
+  padding: 8rpx 30rpx;
+  border-radius: 30rpx;
+  width: auto;
+  align-self: center;
+  line-height: 1.5;
+}
+.refresh-btn::after {
+  border: none;
+}
+.section {
+  background: #fff;
+  margin: 20rpx;
+  border-radius: 16rpx;
+  padding: 24rpx;
+}
+.section-title {
+  font-size: 28rpx;
+  font-weight: bold;
+  color: #333;
+  margin-bottom: 20rpx;
+  display: block;
+}
+.info-row {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 16rpx 0;
+  border-bottom: 1rpx solid #f5f5f5;
+}
+.info-row:last-child {
+  border-bottom: none;
+}
+.info-label {
+  font-size: 26rpx;
+  color: #999;
+}
+.info-value {
+  font-size: 26rpx;
+  color: #333;
+}
+.copy-row {
+  display: flex;
+  align-items: center;
+}
+.copy-btn {
+  font-size: 22rpx;
+  color: #1890ff;
+  background: #e6f7ff;
+  padding: 2rpx 16rpx;
+  border-radius: 20rpx;
+  margin-left: 12rpx;
+}
+/* Timeline */
+.timeline {
+  padding: 0;
+}
+.timeline-node {
+  display: flex;
+  min-height: 100rpx;
+}
+.timeline-dot-wrap {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  width: 40rpx;
+  margin-right: 20rpx;
+  position: relative;
+}
+.timeline-dot {
+  width: 20rpx;
+  height: 20rpx;
+  border-radius: 50%;
+  margin-top: 8rpx;
+  z-index: 1;
+}
+.dot-orange {
+  background: #F97316;
+}
+.dot-gray {
+  background: #ddd;
+}
+.timeline-line {
+  width: 2rpx;
+  flex: 1;
+  background: #e0e0e0;
+  margin-top: 4rpx;
+}
+.timeline-content {
+  flex: 1;
+  padding-bottom: 30rpx;
+}
+.timeline-text {
+  display: block;
+  font-size: 26rpx;
+  color: #333;
+  margin-bottom: 6rpx;
+  line-height: 1.5;
+}
+.timeline-time {
+  display: block;
+  font-size: 22rpx;
+  color: #999;
+}
+.empty-tracking {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding: 40rpx 0;
+}
+.empty-icon {
+  font-size: 80rpx;
+  margin-bottom: 20rpx;
+}
+.empty-text {
+  font-size: 26rpx;
+  color: #999;
+}
+</style>

+ 90 - 6
cfc-frontend/pages/shop/order-detail/order-detail.vue

@@ -63,9 +63,24 @@
         <text class="remark-text">{{ order.remark }}</text>
       </view>
 
-      <view class="bottom-actions" v-if="order.status === 'pending'">
-        <button class="btn-cancel" @click="onCancel">取消订单</button>
-        <button class="btn-pay" @click="onPay">立即支付</button>
+      <view v-if="order.status === 'shipped' || order.status === 'completed'" class="section">
+        <text class="section-title">物流信息</text>
+        <view class="info-row">
+          <text class="info-label">物流公司</text>
+          <text class="info-value">{{ order.logisticsName || '-' }}</text>
+        </view>
+        <view class="info-row">
+          <text class="info-label">运单号</text>
+          <text class="info-value">{{ order.logisticsNo || '-' }}</text>
+        </view>
+        <button class="btn-logistics" @click="viewLogistics">查看物流</button>
+      </view>
+
+      <view class="bottom-actions" v-if="order.status">
+        <button v-if="order.status === 'pending'" class="btn-cancel" @click="onCancel">取消订单</button>
+        <button v-if="order.status === 'pending'" class="btn-pay" @click="onPay">立即支付</button>
+        <button v-if="order.status === 'shipped'" class="btn-confirm-receive" @click="onConfirmReceive">确认收货</button>
+        <button v-if="order.status === 'completed'" class="btn-buy-again" @click="onBuyAgain">再次购买</button>
       </view>
     </scroll-view>
     <view v-else class="empty-wrap">
@@ -75,7 +90,7 @@
 </template>
 
 <script>
-import { productOrderDetail, productOrderPay, productOrderCancel } from '@/utils/api.js'
+import { danshopOrderDetail, danshopOrderConfirm, productOrderPay, productOrderCancel } from '@/utils/api.js'
 
 export default {
   data() {
@@ -94,7 +109,7 @@ export default {
   methods: {
     loadDetail() {
       this.loading = true
-      productOrderDetail({ orderNo: this.orderNo }).then(res => {
+      danshopOrderDetail({ orderNo: this.orderNo }).then(res => {
         this.loading = false
         if (res.code === 200 && res.data) {
           this.order = res.data
@@ -135,10 +150,39 @@ export default {
         }
       })
     },
+    viewLogistics() {
+      if (this.order && this.order.id) {
+        uni.navigateTo({ url: '/pages/shop/logistics/logistics?orderId=' + this.order.id })
+      }
+    },
+    onConfirmReceive() {
+      uni.showModal({
+        title: '确认收货',
+        content: '确定已收到商品吗?',
+        success: (confirm) => {
+          if (confirm.confirm) {
+            danshopOrderConfirm({ orderId: this.order.id }).then(res => {
+              if (res.code === 200) {
+                uni.showToast({ title: '已确认收货', icon: 'success' })
+                this.loadDetail()
+              } else {
+                uni.showToast({ title: res.message || '操作失败', icon: 'none' })
+              }
+            })
+          }
+        }
+      })
+    },
+    onBuyAgain() {
+      if (this.order.items && this.order.items.length > 0) {
+        uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + this.order.items[0].productId })
+      }
+    },
     statusLabel(status) {
       const map = {
         pending: '待支付',
-        paid: '已支付',
+        paid: '待发货',
+        shipped: '待收货',
         completed: '已完成',
         cancelled: '已取消',
         refunded: '已退款'
@@ -315,4 +359,44 @@ export default {
 .btn-pay::after {
   border: none;
 }
+.btn-logistics {
+  background: #e6f7ff;
+  color: #1890ff;
+  font-size: 24rpx;
+  padding: 8rpx 24rpx;
+  border-radius: 20rpx;
+  border: none;
+  margin-top: 16rpx;
+  display: inline-block;
+}
+.btn-logistics::after {
+  border: none;
+}
+.btn-confirm-receive {
+  background: linear-gradient(135deg, #52c41a, #73d13d);
+  color: #fff;
+  font-size: 28rpx;
+  padding: 0 40rpx;
+  height: 72rpx;
+  line-height: 72rpx;
+  border-radius: 36rpx;
+  border: none;
+}
+.btn-confirm-receive::after {
+  border: none;
+}
+.btn-buy-again {
+  background: #fff;
+  color: #F97316;
+  border: 2rpx solid #F97316;
+  font-size: 28rpx;
+  padding: 0 40rpx;
+  height: 72rpx;
+  line-height: 72rpx;
+  border-radius: 36rpx;
+  border: none;
+}
+.btn-buy-again::after {
+  border: none;
+}
 </style>

+ 14 - 9
cfc-frontend/pages/shop/order-list/order-list.vue

@@ -80,7 +80,7 @@
 </template>
 
 <script>
-import { productOrderMy, productOrderPay, productOrderCancel, productOrderConfirm } from '@/utils/api.js'
+import { danshopOrderList, productOrderPay, productOrderCancel, productOrderConfirm } from '@/utils/api.js'
 
 export default {
   data() {
@@ -88,9 +88,9 @@ export default {
       statusList: [
         { label: '全部', value: '' },
         { label: '待支付', value: 'pending' },
-        { label: '已支付', value: 'paid' },
-        { label: '已完成', value: 'completed' },
-        { label: '已取消', value: 'cancelled' }
+        { label: '待发货', value: 'paid' },
+        { label: '待收货', value: 'shipped' },
+        { label: '已完成', value: 'completed' }
       ],
       currentStatus: '',
       orders: [],
@@ -120,7 +120,7 @@ export default {
       if (this.currentStatus) {
         params.status = this.currentStatus
       }
-      productOrderMy(params).then(res => {
+      danshopOrderList(params).then(res => {
         this.loading = false
         this.refreshing = false
         if (res.code === 200 && res.data) {
@@ -151,7 +151,7 @@ export default {
       if (this.currentStatus) {
         params.status = this.currentStatus
       }
-      productOrderMy(params).then(res => {
+      danshopOrderList(params).then(res => {
         this.loadingMore = false
         if (res.code === 200 && res.data) {
           const list = res.data || []
@@ -210,10 +210,11 @@ export default {
     statusLabel(status) {
       const map = {
         pending: '待支付',
-        paid: '已支付',
+        paid: '待发货',
+        shipped: '待收货',
         completed: '已完成',
-        cancelled: '已取消',
-        refunded: '已退款'
+        refunded: '已退款',
+        cancelled: '已取消'
       }
       return map[status] || status
     },
@@ -317,6 +318,10 @@ export default {
   background: #e6f7ff;
   color: #1890ff;
 }
+.status-shipped {
+  background: #e6f7ff;
+  color: #1890ff;
+}
 .status-completed {
   background: #f6ffed;
   color: #52c41a;

+ 325 - 0
cfc-frontend/pages/shop/payment/payment.vue

@@ -0,0 +1,325 @@
+<template>
+  <view class="container">
+    <view v-if="loading" class="loading-wrap">
+      <text class="loading-text">加载中...</text>
+    </view>
+    <scroll-view v-else scroll-y class="content">
+      <!-- Header Section -->
+      <view class="header-section">
+        <text class="header-title">订单待支付</text>
+        <text class="header-countdown" v-if="countdown > 0">
+          支付剩余时间: {{ formatCountdown }}
+        </text>
+        <text class="header-cancelled" v-else>
+          订单已取消
+        </text>
+      </view>
+
+      <!-- Order Info Card -->
+      <view class="section">
+        <view class="info-row">
+          <text class="info-label">订单编号</text>
+          <text class="info-value">{{ orderNo }}</text>
+        </view>
+        <view class="info-row">
+          <text class="info-label">订单金额</text>
+          <text class="order-amount">¥{{ formatPrice(amount) }}</text>
+        </view>
+      </view>
+
+      <!-- Payment Method -->
+      <view class="section">
+        <text class="section-title">支付方式</text>
+        <view class="payment-method-row">
+          <view class="payment-method-left">
+            <text class="payment-icon">💳</text>
+            <text class="payment-name">微信支付</text>
+          </view>
+          <text class="payment-checked">✓</text>
+        </view>
+      </view>
+
+      <!-- Pay Button -->
+      <view class="pay-section">
+        <button
+          :class="['pay-btn', (paying || countdown <= 0) ? 'disabled' : '']"
+          :disabled="paying || countdown <= 0"
+          @click="onPay"
+        >
+          {{ paying ? '支付中...' : '微信支付 ¥' + formatPrice(amount) }}
+        </button>
+        <text class="cancel-link" @click="onCancelOrder">取消订单</text>
+      </view>
+    </scroll-view>
+  </view>
+</template>
+
+<script>
+import config from '@/config.js'
+
+export default {
+  data() {
+    return {
+      orderNo: '',
+      amount: 0,
+      countdown: 900,
+      paying: false,
+      loading: false,
+      timer: null
+    }
+  },
+  computed: {
+    formatCountdown() {
+      var min = Math.floor(this.countdown / 60)
+      var sec = this.countdown % 60
+      return String(min).padStart(2, '0') + ':' + String(sec).padStart(2, '0')
+    }
+  },
+  onLoad(options) {
+    if (options.orderNo) {
+      this.orderNo = options.orderNo
+    }
+    if (options.amount) {
+      this.amount = parseFloat(options.amount)
+    }
+    this.startCountdown()
+  },
+  onUnload() {
+    if (this.timer) {
+      clearInterval(this.timer)
+      this.timer = null
+    }
+  },
+  methods: {
+    startCountdown() {
+      var that = this
+      this.timer = setInterval(function() {
+        if (that.countdown > 0) {
+          that.countdown = that.countdown - 1
+        } else {
+          if (that.timer) {
+            clearInterval(that.timer)
+            that.timer = null
+          }
+        }
+      }, 1000)
+    },
+    onPay() {
+      if (this.countdown <= 0) {
+        uni.showToast({ title: '订单已取消,无法支付', icon: 'none' })
+        return
+      }
+      this.paying = true
+      var that = this
+      uni.request({
+        url: config.danshop('/danshop/payment/precreate'),
+        method: 'POST',
+        data: { orderNo: this.orderNo },
+        header: {
+          'Content-Type': 'application/json',
+          'Authorization': 'Bearer ' + uni.getStorageSync('token')
+        },
+        success: function(res) {
+          that.paying = false
+          if (res.data && res.data.code === 200) {
+            var params = res.data.data && res.data.data.wechatPayParams
+            if (params) {
+              uni.requestPayment({
+                timeStamp: params.timeStamp,
+                nonceStr: params.nonceStr,
+                package: params.package,
+                signType: params.signType || 'MD5',
+                paySign: params.paySign,
+                success: function() {
+                  uni.showToast({ title: '支付成功', icon: 'success' })
+                  setTimeout(function() {
+                    uni.redirectTo({
+                      url: '/pages/shop/order-list/order-list?tab=paid'
+                    })
+                  }, 1500)
+                },
+                fail: function() {
+                  uni.showToast({ title: '支付失败', icon: 'none' })
+                }
+              })
+            } else {
+              uni.showToast({ title: '获取支付参数失败', icon: 'none' })
+            }
+          } else {
+            uni.showToast({ title: res.data.message || '支付失败', icon: 'none' })
+          }
+        },
+        fail: function() {
+          that.paying = false
+          uni.showToast({ title: '网络请求失败', icon: 'none' })
+        }
+      })
+    },
+    onCancelOrder() {
+      var that = this
+      uni.showModal({
+        title: '确认取消',
+        content: '确定取消该订单吗?',
+        success: function(confirm) {
+          if (confirm.confirm) {
+            uni.request({
+              url: config.danshop('/danshop/order/cancel'),
+              method: 'POST',
+              data: { orderNo: that.orderNo },
+              header: {
+                'Content-Type': 'application/json',
+                'Authorization': 'Bearer ' + uni.getStorageSync('token')
+              },
+              success: function(res) {
+                if (res.data && res.data.code === 200) {
+                  uni.showToast({ title: '订单已取消', icon: 'success' })
+                  setTimeout(function() {
+                    uni.navigateBack()
+                  }, 1500)
+                } else {
+                  uni.showToast({ title: res.data.message || '取消失败', icon: 'none' })
+                }
+              }
+            })
+          }
+        }
+      })
+    },
+    formatPrice(price) {
+      if (price === null || price === undefined) return '0.00'
+      return Number(price).toFixed(2)
+    }
+  }
+}
+</script>
+
+<style scoped>
+.container {
+  min-height: 100vh;
+  background: #f5f5f5;
+}
+.loading-wrap {
+  display: flex;
+  justify-content: center;
+  padding-top: 200rpx;
+}
+.loading-text {
+  font-size: 28rpx;
+  color: #999;
+}
+.content {
+  height: calc(100vh - 120rpx);
+}
+.header-section {
+  background: linear-gradient(135deg, #F97316, #FB923C);
+  padding: 50rpx 30rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+.header-title {
+  font-size: 36rpx;
+  font-weight: bold;
+  color: #fff;
+  margin-bottom: 12rpx;
+}
+.header-countdown {
+  font-size: 26rpx;
+  color: rgba(255,255,255,0.9);
+}
+.header-cancelled {
+  font-size: 26rpx;
+  color: rgba(255,255,255,0.7);
+}
+.section {
+  background: #fff;
+  margin: 20rpx;
+  border-radius: 16rpx;
+  padding: 24rpx;
+}
+.section-title {
+  font-size: 28rpx;
+  font-weight: bold;
+  color: #333;
+  margin-bottom: 20rpx;
+  display: block;
+}
+.info-row {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 16rpx 0;
+  border-bottom: 1rpx solid #f5f5f5;
+}
+.info-row:last-child {
+  border-bottom: none;
+}
+.info-label {
+  font-size: 26rpx;
+  color: #999;
+}
+.info-value {
+  font-size: 26rpx;
+  color: #333;
+}
+.order-amount {
+  font-size: 40rpx;
+  color: #F97316;
+  font-weight: bold;
+}
+.payment-method-row {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 16rpx 0;
+}
+.payment-method-left {
+  display: flex;
+  align-items: center;
+}
+.payment-icon {
+  font-size: 40rpx;
+  margin-right: 16rpx;
+}
+.payment-name {
+  font-size: 28rpx;
+  color: #333;
+}
+.payment-checked {
+  font-size: 32rpx;
+  color: #52c41a;
+  font-weight: bold;
+}
+.pay-section {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding: 40rpx 30rpx;
+}
+.pay-btn {
+  width: 100%;
+  height: 88rpx;
+  line-height: 88rpx;
+  background: linear-gradient(135deg, #F97316, #FB923C);
+  color: #fff;
+  font-size: 32rpx;
+  font-weight: bold;
+  border-radius: 44rpx;
+  border: none;
+  text-align: center;
+}
+.pay-btn::after {
+  border: none;
+}
+.pay-btn.disabled {
+  background: #ddd;
+  color: #999;
+}
+.cancel-link {
+  margin-top: 24rpx;
+  font-size: 26rpx;
+  color: #999;
+  text-decoration: underline;
+  padding: 10rpx;
+}
+</style>

+ 344 - 65
cfc-frontend/pages/wisdom/cognitive-report.vue

@@ -7,47 +7,73 @@
     <view class="report-card" v-if="report">
       <view class="report-header">
         <text class="report-title">认知测评报告</text>
-        <text class="report-date">测评日期: {{ report.assessmentDate }}</text>
+        <text class="report-date">测评日期: {{ report.assessmentDate || '-' }}</text>
       </view>
 
+      <!-- 综合认知评分 -->
       <view class="overall-score-wrap">
         <text class="overall-label">综合认知评分</text>
-        <text class="overall-value">{{ report.overallScore || 0 }}</text>
+        <view class="overall-row">
+          <text class="overall-value">{{ report.overallScore || 0 }}</text>
+          <view class="dan-badge">
+            <text class="dan-level">{{ report.danLevel || '-' }}</text>
+          </view>
+        </view>
       </view>
 
+      <!-- 七维条形图 -->
       <view class="dimension-list">
         <view class="dimension-item" v-for="dim in dimensions" :key="dim.key">
           <view class="dimension-header">
-            <text class="dimension-name">{{ dim.label }}</text>
+            <view class="dimension-label-row">
+              <text class="dimension-icon">{{ dim.icon }}</text>
+              <text class="dimension-name">{{ dim.label }}</text>
+            </view>
             <text class="dimension-score">{{ report[dim.key] || 0 }}</text>
           </view>
           <view class="dimension-bar">
-            <view class="dimension-bar-fill" :style="{width: (report[dim.key] || 0) + '%'}"></view>
+            <view class="dimension-bar-fill" :style="{ width: (report[dim.key] || 0) + '%' }"></view>
           </view>
           <text class="dimension-desc">{{ dim.desc }}</text>
         </view>
       </view>
 
-      <view class="source-section">
-        <text class="source-title">数据源构成</text>
-        <view class="source-bar">
-          <view class="source-segment dan" style="width: 70%">COG 认知分 70%</view>
-          <view class="source-segment innate" style="width: 30%">先天基础 30%</view>
-        </view>
-      </view>
-
+      <!-- 分析报告 -->
       <view class="report-analysis" v-if="report.analysisReport">
-        <text class="analysis-title">分析报告</text>
+        <view class="analysis-header-row">
+          <text class="analysis-icon">&#x1F4DD;</text>
+          <text class="analysis-title">分析报告</text>
+        </view>
         <text class="analysis-content">{{ report.analysisReport }}</text>
       </view>
 
+      <!-- 成长建议 -->
       <view class="report-suggestions" v-if="report.growthSuggestions">
-        <text class="suggestion-title">成长建议</text>
+        <view class="analysis-header-row">
+          <text class="analysis-icon">&#x1F331;</text>
+          <text class="analysis-title">成长建议</text>
+        </view>
         <text class="suggestion-content">{{ report.growthSuggestions }}</text>
       </view>
+
+      <!-- 底部操作 -->
+      <view class="action-row">
+        <view class="action-btn secondary" @click="goAssessment">
+          <text class="action-btn-text">预约测评</text>
+        </view>
+        <view class="action-btn primary" @click="goTraining">
+          <text class="action-btn-text">认知训练</text>
+        </view>
+      </view>
+    </view>
+
+    <!-- 加载中 -->
+    <view class="loading-state" v-if="loading">
+      <text class="loading-text">加载中...</text>
     </view>
 
-    <view class="empty-state" v-else>
+    <!-- 无数据 -->
+    <view class="empty-state" v-if="!report && !loading">
       <text class="empty-icon">&#x1F9E0;</text>
       <text class="empty-title">暂无认知测评数据</text>
       <text class="empty-desc">完成 DAN 认知评估后,可在此查看详细的六维认知分析报告</text>
@@ -58,74 +84,327 @@
 
 <script>
 import PageBanner from '../../components/PageBanner.vue'
-import { getEnergyOverview } from '../../utils/api.js'
+import { getAssessmentLatestResult } from '../../utils/api.js'
 
 export default {
   components: { PageBanner },
-  data() {
+  data: function() {
     return {
+      childId: null,
       report: null,
+      loading: true,
       dimensions: [
-        { key: 'attentionScore', label: '注意力', desc: '信息筛选和专注能力' },
-        { key: 'focusScore', label: '专注力', desc: '持续集中和抗干扰能力' },
-        { key: 'memoryScore', label: '记忆力', desc: '信息编码和回忆能力' },
-        { key: 'logicScore', label: '逻辑思维', desc: '推理和问题解决能力' },
-        { key: 'perceptionScore', label: '感知能力', desc: '感官信息处理能力' },
-        { key: 'spatialScore', label: '空间思维', desc: '空间想象和方位判断' }
+        { key: 'perceptionScore', label: '感知能力', icon: '\u{1F441}', desc: '感官信息处理能力' },
+        { key: 'focusScore', label: '专注力', icon: '\u{1F3AF}', desc: '持续集中和抗干扰能力' },
+        { key: 'memoryScore', label: '记忆力', icon: '\u{1F9E0}', desc: '信息编码和回忆能力' },
+        { key: 'logicScore', label: '逻辑思维', icon: '\u{1F9E9}', desc: '推理和问题解决能力' },
+        { key: 'spatialScore', label: '空间思维', icon: '\u{1F9CA}', desc: '空间想象和方位判断' },
+        { key: 'attentionScore', label: '注意力', icon: '\u{1F50D}', desc: '信息筛选和专注能力' },
+        { key: 'processingSpeedScore', label: '加工速度', icon: '\u26A1', desc: '信息处理和反应速度' }
       ]
     }
   },
-  onLoad() {
+  onLoad: function(options) {
+    if (options && options.childId) {
+      this.childId = options.childId
+    } else {
+      this.childId = uni.getStorageSync('currentChildId') || null
+    }
     this.loadReport()
   },
   methods: {
-    async loadReport() {
-      try {
-        const childId = this.$store?.state?.currentChildId
-        if (!childId) return
-        const res = await getEnergyOverview(childId)
+    loadReport: function() {
+      var self = this
+      var childId = self.childId
+      if (!childId) {
+        self.loading = false
+        return
+      }
+      self.loading = true
+      getAssessmentLatestResult(childId).then(function(res) {
         if (res.code === 200 && res.data) {
-          this.report = res.data
+          self.report = res.data
         }
-      } catch (e) {
-        console.error('加载认知报告失败', e)
-      }
+        self.loading = false
+      }).catch(function() {
+        self.loading = false
+      })
     },
-    goAssessment() {
-      uni.navigateTo({ url: '/pages/assessment/index' })
+    goAssessment: function() {
+      uni.navigateTo({ url: '/pages/assessment/apply' })
+    },
+    goTraining: function() {
+      uni.navigateTo({ url: '/pages/mind/training?childId=' + (this.childId || '') })
     }
   }
 }
 </script>
 
 <style scoped>
-.container { padding: 0 30rpx; }
-.report-card { background: #fff; border-radius: 24rpx; padding: 40rpx; margin-top: 30rpx; }
-.report-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30rpx; }
-.report-title { font-size: 36rpx; font-weight: bold; color: #333; }
-.report-date { font-size: 24rpx; color: #999; }
-.overall-score-wrap { text-align: center; padding: 40rpx 0; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 20rpx; margin-bottom: 40rpx; color: #fff; }
-.overall-label { font-size: 28rpx; opacity: 0.9; }
-.overall-value { font-size: 80rpx; font-weight: bold; }
-.dimension-item { margin-bottom: 30rpx; }
-.dimension-header { display: flex; justify-content: space-between; margin-bottom: 10rpx; }
-.dimension-name { font-size: 28rpx; color: #333; }
-.dimension-score { font-size: 28rpx; color: #667eea; font-weight: bold; }
-.dimension-bar { height: 16rpx; background: #f0f0f0; border-radius: 8rpx; overflow: hidden; }
-.dimension-bar-fill { height: 100%; background: linear-gradient(90deg, #667eea, #764ba2); border-radius: 8rpx; transition: width 0.5s; }
-.dimension-desc { font-size: 22rpx; color: #999; margin-top: 6rpx; }
-.source-section { margin-top: 40rpx; padding: 30rpx; background: #f8f9ff; border-radius: 16rpx; }
-.source-title { font-size: 28rpx; font-weight: bold; color: #333; margin-bottom: 20rpx; display: block; }
-.source-bar { display: flex; height: 48rpx; border-radius: 24rpx; overflow: hidden; }
-.source-segment { display: flex; align-items: center; justify-content: center; font-size: 22rpx; color: #fff; }
-.source-segment.dan { background: #667eea; }
-.source-segment.innate { background: #f97316; }
-.report-analysis, .report-suggestions { margin-top: 30rpx; padding: 30rpx; background: #f9f9f9; border-radius: 16rpx; }
-.analysis-title, .suggestion-title { font-size: 30rpx; font-weight: bold; color: #333; margin-bottom: 16rpx; display: block; }
-.analysis-content, .suggestion-content { font-size: 26rpx; color: #666; line-height: 1.6; }
-.empty-state { text-align: center; padding: 100rpx 40rpx; }
-.empty-icon { font-size: 100rpx; }
-.empty-title { font-size: 32rpx; color: #333; margin-top: 30rpx; }
-.empty-desc { font-size: 26rpx; color: #999; margin-top: 16rpx; }
-.empty-btn { display: inline-block; margin-top: 40rpx; padding: 20rpx 60rpx; background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border-radius: 50rpx; font-size: 28rpx; }
-</style>
+.container {
+  min-height: 100vh;
+  background: #f5f7fa;
+  padding-bottom: 120rpx;
+}
+
+/* ===== 报告卡 ===== */
+.report-card {
+  margin: 20rpx 30rpx;
+  background: #fff;
+  border-radius: 24rpx;
+  padding: 40rpx;
+  box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
+}
+
+.report-header {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 30rpx;
+}
+
+.report-title {
+  font-size: 36rpx;
+  font-weight: bold;
+  color: #333;
+}
+
+.report-date {
+  font-size: 24rpx;
+  color: #999;
+}
+
+/* ===== 综合评分 ===== */
+.overall-score-wrap {
+  text-align: center;
+  padding: 40rpx 0;
+  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+  border-radius: 20rpx;
+  margin-bottom: 40rpx;
+  color: #fff;
+}
+
+.overall-label {
+  font-size: 28rpx;
+  opacity: 0.9;
+  display: block;
+  margin-bottom: 16rpx;
+}
+
+.overall-row {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: center;
+}
+
+.overall-value {
+  font-size: 80rpx;
+  font-weight: bold;
+  margin-right: 20rpx;
+}
+
+.dan-badge {
+  background: rgba(255,255,255,0.25);
+  border-radius: 12rpx;
+  padding: 6rpx 20rpx;
+}
+
+.dan-level {
+  font-size: 28rpx;
+  font-weight: bold;
+  color: #FFD700;
+}
+
+/* ===== 七维条形图 ===== */
+.dimension-list {
+  margin-bottom: 30rpx;
+}
+
+.dimension-item {
+  margin-bottom: 28rpx;
+}
+
+.dimension-header {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 10rpx;
+}
+
+.dimension-label-row {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+}
+
+.dimension-icon {
+  font-size: 28rpx;
+  margin-right: 10rpx;
+}
+
+.dimension-name {
+  font-size: 28rpx;
+  color: #333;
+  font-weight: 500;
+}
+
+.dimension-score {
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #667eea;
+}
+
+.dimension-bar {
+  height: 16rpx;
+  background: #f0f0f0;
+  border-radius: 8rpx;
+  overflow: hidden;
+  margin-bottom: 8rpx;
+}
+
+.dimension-bar-fill {
+  height: 100%;
+  background: linear-gradient(90deg, #667eea, #764ba2);
+  border-radius: 8rpx;
+  transition: width 0.5s;
+}
+
+.dimension-desc {
+  font-size: 22rpx;
+  color: #999;
+  line-height: 1.4;
+}
+
+/* ===== 分析/建议 ===== */
+.report-analysis, .report-suggestions {
+  margin-top: 30rpx;
+  padding: 28rpx;
+  border-radius: 16rpx;
+}
+
+.report-analysis {
+  background: #f9f9ff;
+}
+
+.report-suggestions {
+  background: #f0fdf4;
+}
+
+.analysis-header-row {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  margin-bottom: 16rpx;
+}
+
+.analysis-icon {
+  font-size: 30rpx;
+  margin-right: 10rpx;
+}
+
+.analysis-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+}
+
+.analysis-content, .suggestion-content {
+  font-size: 26rpx;
+  color: #666;
+  line-height: 1.7;
+  display: block;
+}
+
+/* ===== 底部操作 ===== */
+.action-row {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  margin-top: 40rpx;
+}
+
+.action-btn {
+  flex: 1;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 20rpx 0;
+  border-radius: 40rpx;
+}
+
+.action-btn.primary {
+  background: linear-gradient(135deg, #667eea, #764ba2);
+  margin-left: 16rpx;
+  box-shadow: 0 4rpx 16rpx rgba(102,126,234,0.3);
+}
+
+.action-btn.secondary {
+  background: #fff;
+  border: 2rpx solid #ddd;
+  margin-right: 16rpx;
+}
+
+.action-btn-text {
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #fff;
+}
+
+.action-btn.secondary .action-btn-text {
+  color: #666;
+}
+
+/* ===== 加载中 ===== */
+.loading-state {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 120rpx 0;
+}
+
+.loading-text {
+  font-size: 28rpx;
+  color: #999;
+}
+
+/* ===== 空状态 ===== */
+.empty-state {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding: 120rpx 40rpx 80rpx;
+}
+
+.empty-icon {
+  font-size: 100rpx;
+  margin-bottom: 20rpx;
+}
+
+.empty-title {
+  font-size: 32rpx;
+  color: #333;
+  font-weight: bold;
+  margin-bottom: 16rpx;
+}
+
+.empty-desc {
+  font-size: 26rpx;
+  color: #999;
+  text-align: center;
+  line-height: 1.6;
+  margin-bottom: 40rpx;
+}
+
+.empty-btn {
+  background: linear-gradient(135deg, #667eea, #764ba2);
+  color: #fff;
+  font-size: 28rpx;
+  font-weight: bold;
+  padding: 16rpx 64rpx;
+  border-radius: 40rpx;
+  box-shadow: 0 4rpx 16rpx rgba(102,126,234,0.3);
+}
+</style>

+ 107 - 3
cfc-frontend/utils/api.js

@@ -187,7 +187,7 @@ export const getAuthorizations = () => {
 }
 
 export const getChildren = () => {
-  return request('/api/user/children/list', 'POST')
+  return request('/api/family/user/children/list', 'POST')
 }
 
 export const getParentDashboard = () => {
@@ -199,11 +199,11 @@ export const getSystemBalance = (childId) => {
 }
 
 export const createChild = (data) => {
-  return request('/api/user/children', 'POST', data)
+  return request('/api/family/user/children', 'POST', data)
 }
 
 export const updateChild = (childId, data) => {
-  return request(`/api/user/children/${childId}`, 'PUT', data)
+  return request('/api/family/user/children/update', 'POST', Object.assign({}, data, { childId: childId }))
 }
 
 // 任务模块
@@ -778,6 +778,23 @@ export const kickFamilyMember = (targetUserId) => {
   return request('/api/family/user/kick', 'POST', { targetUserId })
 }
 
+// ===== AI 聊天 =====
+export const aiSendMessage = (data) => {
+  return request('/api/ai/chat/send', 'POST', data)
+}
+
+export const aiGetConversations = () => {
+  return request('/api/ai/chat/conversations', 'POST', {})
+}
+
+export const aiGetMessages = (params) => {
+  return request('/api/ai/chat/messages', 'POST', params)
+}
+
+export const aiDeleteConversation = (id) => {
+  return request('/api/ai/chat/conversations/' + id + '/delete', 'POST', {})
+}
+
 // ===================== 浠艾福俱乐部 - 服务商模块 =====================
 
 // 提交服务商入驻申请
@@ -1016,6 +1033,15 @@ export const getArticleList = (data) => request('/api/articles/list', 'POST', da
 export const getArticleDetail = (data) => request('/api/articles/detail', 'POST', data)
 export const getFeaturedArticles = (data) => request('/api/articles/featured', 'POST', data)
 export const recordArticleRead = (data) => request('/api/articles/record-read', 'POST', data)
+export const getReadingStats = (childId) => request('/api/articles/reading-stats', 'POST', { childId })
+export const getDailyTip = () => request('/api/articles/daily-tip', 'POST')
+
+// ===== EMI心理报告 =====
+export const getEmiReport = (childId) => request('/api/emireport/latest', 'POST', { childId })
+
+// ===== 认知测评结果 =====
+export const getAssessmentLatestResult = (childId) => request('/api/assessment/latest-result', 'POST', { childId })
+export const getAssessmentHistory = (childId, size) => request('/api/assessment/history', 'POST', { childId, size: size || 5 })
 
 // ===== 五维能量系统(账本模式) =====
 export const getEnergyOverview = (childId) => {
@@ -1122,3 +1148,81 @@ export const updateInsurance = (data) => {
 export const deleteInsurance = (id) => {
   return request('/api/wealth/insurance/delete', 'POST', { id })
 }
+
+// ===================== DanShop 电商模块 (独立模块 port 9081) =====================
+
+const danshopRequest = (path, method = 'POST', data = {}) => {
+  const token = uni.getStorageSync('token')
+  return new Promise((resolve, reject) => {
+    uni.request({
+      url: DANSHOP_BASE + path,
+      method: method,
+      data: data,
+      header: {
+        'Content-Type': 'application/json',
+        'Authorization': token ? `Bearer ${token}` : ''
+      },
+      success: (res) => {
+        if (res.data.code === 200 || res.data.code === 0) {
+          resolve(res.data)
+        } else {
+          uni.showToast({ title: res.data.message || '请求失败', icon: 'none' })
+          reject(res.data)
+        }
+      },
+      fail: (err) => {
+        uni.showToast({ title: '网络请求失败', icon: 'none' })
+        reject(err)
+      }
+    })
+  })
+}
+
+export const danshopCategoryList = (data) => danshopRequest('/danshop/category/list', 'POST', data)
+export const danshopCategoryTree = (data) => danshopRequest('/danshop/category/tree', 'POST', data)
+export const danshopProductList = (data) => danshopRequest('/danshop/product/list', 'POST', data)
+export const danshopProductDetail = (data) => danshopRequest('/danshop/product/detail', 'POST', data)
+export const danshopCartList = (data) => danshopRequest('/danshop/cart/list', 'POST', data)
+export const danshopCartAdd = (data) => danshopRequest('/danshop/cart/add', 'POST', data)
+export const danshopCartRemove = (data) => danshopRequest('/danshop/cart/remove', 'POST', data)
+export const danshopCartClear = (data) => danshopRequest('/danshop/cart/clear', 'POST', data)
+export const danshopOrderCreate = (data) => danshopRequest('/danshop/order/create', 'POST', data)
+export const danshopOrderList = (data) => danshopRequest('/danshop/order/list', 'POST', data)
+export const danshopOrderDetail = (data) => danshopRequest('/danshop/order/detail', 'POST', data)
+export const danshopOrderConfirm = (data) => danshopRequest('/danshop/order/confirm', 'POST', data)
+export const danshopOrderCancel = (data) => danshopRequest('/danshop/order/cancel', 'POST', data)
+export const danshopAddressList = (data) => danshopRequest('/danshop/address/list', 'POST', data)
+export const danshopAddressSave = (data) => danshopRequest('/danshop/address/save', 'POST', data)
+export const danshopAddressDelete = (data) => danshopRequest('/danshop/address/delete', 'POST', data)
+export const danshopAddressSetDefault = (data) => danshopRequest('/danshop/address/setDefault', 'POST', data)
+export const danshopPaymentPrecreate = (data) => danshopRequest('/danshop/payment/precreate', 'POST', data)
+export const danshopLogisticsQuery = (data) => danshopRequest('/danshop/logistics/query', 'POST', data)
+export const danshopFavoriteList = (data) => danshopRequest('/danshop/favorite/list', 'POST', data)
+export const danshopFavoriteAdd = (data) => danshopRequest('/danshop/favorite/add', 'POST', data)
+export const danshopFavoriteRemove = (data) => danshopRequest('/danshop/favorite/remove', 'POST', data)
+
+// ===== 健康打卡 =====
+export const healthCheckinList = (data) => request('/api/health/checkin/list', 'POST', data)
+export const healthCheckinCreate = (data) => request('/api/health/checkin/create', 'POST', data)
+export const healthCheckinDelete = (id) => request('/api/health/checkin/delete', 'POST', { id })
+
+// ===== 活动模块(维度筛选) =====
+export const getActivityList = (data) => request('/api/activity/list', 'POST', data)
+export const getActivityDetail = (id) => request('/api/activity/detail', 'POST', { id })
+
+// ===== 维度任务(带 category 筛选) =====
+export const getTodayTasksByCategory = (childId, category) => {
+  return request('/api/tasks/today', 'POST', { childId: childId, category: category })
+}
+export const getTaskHistoryByCategory = (childId, category, page, size) => {
+  return request('/api/tasks/history', 'POST', { childId: childId, category: category, page: page || 1, size: size || 10 })
+}
+
+// ===== 维度商品(domain 筛选,使用已有 danshopProductList) =====
+export const getProductsByDomain = (domain, page, size) => {
+  return danshopProductList({ domain: domain, page: page || 1, size: size || 6 })
+}
+
+// ===== 健康报告 =====
+export const getLatestHealthReport = (childId) => request('/api/health/report/latest', 'POST', { childId })
+export const getHealthIndicatorList = (childId) => request('/api/health/indicator/list', 'POST', { childId })

+ 46 - 0
cfc-web/src/api/danshop.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+
+const DANSHOP_BASE = 'http://localhost:9081'
+
+const danshopRequest = (url, method = 'post', data = {}) => {
+  return request({
+    url: DANSHOP_BASE + url,
+    method,
+    data
+  })
+}
+
+// ========== 分类管理 ==========
+export const danshopCategoryList = (data) => danshopRequest('/api/admin/shop/category/list', 'post', data)
+export const danshopCategorySave = (data) => {
+  if (data.id) {
+    return danshopRequest('/api/admin/shop/category/update', 'post', data)
+  }
+  return danshopRequest('/api/admin/shop/category/create', 'post', data)
+}
+export const danshopCategoryDelete = (data) => danshopRequest('/api/admin/shop/category/delete', 'post', data)
+
+// ========== 分润规则 ==========
+export const danshopProfitRuleList = (data) => danshopRequest('/api/admin/shop/profitRule/list', 'post', data)
+export const danshopProfitRuleSave = (data) => {
+  if (data.id) {
+    return danshopRequest('/api/admin/shop/profitRule/update', 'post', data)
+  }
+  return danshopRequest('/api/admin/shop/profitRule/create', 'post', data)
+}
+export const danshopProfitRuleDelete = (data) => danshopRequest('/api/admin/shop/profitRule/delete', 'post', data)
+
+// ========== 商品管理 (DanShop) ==========
+export const danshopProductList = (data) => danshopRequest('/api/admin/shop/product/list', 'post', data)
+export const danshopProductReview = (data) => danshopRequest('/api/admin/shop/product/review', 'post', data)
+export const danshopProductSetProfitRule = (data) => danshopRequest('/api/admin/shop/product/setProfitRule', 'post', data)
+
+// ========== 订单管理 (DanShop) ==========
+export const danshopOrderList = (data) => danshopRequest('/api/admin/shop/order/list', 'post', data)
+export const danshopOrderProfitLogs = (data) => danshopRequest('/api/admin/shop/order/profitLogs', 'post', data)
+
+// ========== 物流管理 ==========
+export const danshopLogisticsList = (data) => danshopRequest('/api/admin/shop/logistics/list', 'post', data)
+export const danshopLogisticsUpdate = (data) => danshopRequest('/api/admin/shop/logistics/update', 'post', data)
+export const danshopLogisticsShip = (data) => danshopRequest('/api/seller/order/ship', 'post', data)
+export const danshopLogisticsQuery = (data) => danshopRequest('/api/shop/logistics/query', 'post', data)

+ 34 - 1
cfc-web/src/router/index.js

@@ -258,6 +258,37 @@ const routes = [
         name: 'BloodTypeConfigs',
         component: () => import('@/views/admin/BloodTypeConfigs.vue'),
         meta: { title: '血型配置' }
+      },
+      // ========== DanShop 电商管理 ==========
+      {
+        path: 'danshop-category',
+        name: 'DanShopCategory',
+        component: () => import('@/views/admin/DanShopCategoryManage'),
+        meta: { title: '商品分类管理' }
+      },
+      {
+        path: 'danshop-profit-rule',
+        name: 'DanShopProfitRule',
+        component: () => import('@/views/admin/DanShopProfitRuleConfig'),
+        meta: { title: '分润规则配置' }
+      },
+      {
+        path: 'danshop-logistics',
+        name: 'DanShopLogistics',
+        component: () => import('@/views/admin/DanShopLogisticsManage'),
+        meta: { title: '物流管理' }
+      },
+      {
+        path: 'danshop-product',
+        name: 'DanShopProduct',
+        component: () => import('@/views/admin/ProductManage.vue'),
+        meta: { title: 'DanShop商品' }
+      },
+      {
+        path: 'danshop-order',
+        name: 'DanShopOrder',
+        component: () => import('@/views/admin/OrderManage.vue'),
+        meta: { title: 'DanShop订单' }
       }
     ]
   }
@@ -350,7 +381,9 @@ router.beforeEach(async (to, from, next) => {
     'ProductManage', 'OrderManage', 'SysConfig', 'EnergySandbox',
     'ArticleCategory', 'ArticleManage', 'ArticleEdit',
     'EducationSystems',
-    'ZodiacConfigs', 'BaziConfigs', 'BloodTypeConfigs'
+    'ZodiacConfigs', 'BaziConfigs', 'BloodTypeConfigs',
+    'DanShopCategory', 'DanShopProfitRule', 'DanShopLogistics',
+    'DanShopProduct', 'DanShopOrder'
   ]
   if (adminRoutes.includes(to.name) && role === 'teacher') {
     console.warn('Access denied: Admin role required for', to.name)

+ 12 - 0
cfc-web/src/views/Layout.vue

@@ -165,6 +165,18 @@
               <i class="el-icon-s-order"></i>
               <span>订单管理</span>
             </el-menu-item>
+            <el-menu-item index="/danshop-category">
+              <i class="el-icon-s-goods"></i>
+              <span>DanShop分类</span>
+            </el-menu-item>
+            <el-menu-item index="/danshop-profit-rule">
+              <i class="el-icon-s-marketing"></i>
+              <span>分润规则</span>
+            </el-menu-item>
+            <el-menu-item index="/danshop-logistics">
+              <i class="el-icon-s-order"></i>
+              <span>物流管理</span>
+            </el-menu-item>
             <el-menu-item index="/article-categories">
               <i class="el-icon-document"></i>
               <span>文章分类</span>

+ 251 - 0
cfc-web/src/views/admin/DanShopCategoryManage.vue

@@ -0,0 +1,251 @@
+<template>
+  <div class="danshop-category">
+    <div class="header">
+      <h2>商品分类管理</h2>
+      <div class="header-actions">
+        <el-input
+          v-model="searchName"
+          placeholder="分类名称"
+          style="width: 200px; margin-right: 10px;"
+          clearable
+          @keyup.enter.native="handleSearch"
+        />
+        <el-button type="primary" @click="handleSearch">搜索</el-button>
+        <el-button type="success" @click="handleCreate" style="margin-left: 10px;">+ 新增分类</el-button>
+      </div>
+    </div>
+
+    <el-table :data="list" v-loading="loading" border stripe>
+      <el-table-column prop="id" label="ID" width="70" />
+      <el-table-column prop="name" label="分类名称" min-width="150" show-overflow-tooltip />
+      <el-table-column label="上级分类" width="150" show-overflow-tooltip>
+        <template slot-scope="{ row }">
+          {{ row.parentName || '-' }}
+        </template>
+      </el-table-column>
+      <el-table-column prop="sortOrder" label="排序" width="80" />
+      <el-table-column label="状态" width="90">
+        <template slot-scope="{ row }">
+          <el-switch
+            v-model="row.isActive"
+            :disabled="statusLoading === row.id"
+            @change="(val) => handleStatusChange(row, val)"
+          />
+        </template>
+      </el-table-column>
+      <el-table-column label="创建时间" width="160">
+        <template slot-scope="{ row }">
+          {{ formatTime(row.createTime) }}
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" width="160" fixed="right">
+        <template slot-scope="{ row }">
+          <el-button type="primary" size="small" @click="handleEdit(row)">编辑</el-button>
+          <el-button type="danger" size="small" @click="handleDelete(row)">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <el-pagination
+      @size-change="onPageChange"
+      @current-change="onPageChange"
+      :current-page="page"
+      :page-size="size"
+      :total="total"
+      layout="total, prev, pager, next"
+      style="margin-top: 20px; text-align: right;"
+    />
+
+    <!-- 新增/编辑分类弹窗 -->
+    <el-dialog :title="isEdit ? '编辑分类' : '新增分类'" :visible.sync="dialogVisible" width="500px">
+      <el-form :model="form" label-width="100px">
+        <el-form-item label="分类名称">
+          <el-input v-model="form.name" placeholder="请输入分类名称" />
+        </el-form-item>
+        <el-form-item label="上级分类">
+          <el-select v-model="form.parentId" placeholder="请选择上级分类" clearable style="width: 100%;">
+            <el-option label="无(顶级分类)" :value="0" />
+            <el-option
+              v-for="cat in parentOptions"
+              :key="cat.id"
+              :label="cat.name"
+              :value="cat.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="排序">
+          <el-input-number v-model="form.sortOrder" :min="0" :max="9999" />
+        </el-form-item>
+        <el-form-item label="分类图标">
+          <el-input v-model="form.image" placeholder="请输入图标URL" />
+        </el-form-item>
+        <el-form-item label="启用状态">
+          <el-switch v-model="form.isActive" />
+        </el-form-item>
+      </el-form>
+      <span slot="footer">
+        <el-button @click="dialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="handleSubmit" :loading="submitLoading">保存</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { danshopCategoryList, danshopCategorySave, danshopCategoryDelete } from '@/api/danshop'
+
+export default {
+  name: 'DanShopCategory',
+  data() {
+    return {
+      list: [],
+      loading: false,
+      page: 1,
+      size: 20,
+      total: 0,
+      searchName: '',
+      statusLoading: null,
+      dialogVisible: false,
+      isEdit: false,
+      submitLoading: false,
+      form: {
+        id: null,
+        name: '',
+        parentId: 0,
+        sortOrder: 0,
+        image: '',
+        isActive: true
+      },
+      parentOptions: []
+    }
+  },
+  mounted() {
+    this.loadList()
+  },
+  methods: {
+    async loadList() {
+      this.loading = true
+      try {
+        const res = await danshopCategoryList({
+          page: this.page,
+          size: this.size,
+          name: this.searchName || undefined
+        })
+        this.list = (res.data && res.data.list) || []
+        this.total = (res.data && res.data.total) || 0
+        this.parentOptions = this.list.filter(c => c.parentId === 0 || !c.parentId)
+      } catch (e) {
+        this.$message.error('加载分类列表失败')
+      } finally {
+        this.loading = false
+      }
+    },
+    onPageChange(val) {
+      this.page = val
+      this.loadList()
+    },
+    handleSearch() {
+      this.page = 1
+      this.loadList()
+    },
+    handleCreate() {
+      this.isEdit = false
+      this.form = { id: null, name: '', parentId: 0, sortOrder: 0, image: '', isActive: true }
+      this.dialogVisible = true
+    },
+    handleEdit(row) {
+      this.isEdit = true
+      this.form = {
+        id: row.id,
+        name: row.name,
+        parentId: row.parentId || 0,
+        sortOrder: row.sortOrder || 0,
+        image: row.image || '',
+        isActive: row.isActive !== undefined ? row.isActive : true
+      }
+      this.dialogVisible = true
+    },
+    async handleSubmit() {
+      if (!this.form.name.trim()) {
+        return this.$message.warning('请输入分类名称')
+      }
+      this.submitLoading = true
+      try {
+        await danshopCategorySave({
+          id: this.form.id || undefined,
+          name: this.form.name,
+          parentId: this.form.parentId || 0,
+          sortOrder: this.form.sortOrder,
+          image: this.form.image,
+          isActive: this.form.isActive
+        })
+        this.$message.success(this.isEdit ? '分类已更新' : '分类已创建')
+        this.dialogVisible = false
+        this.loadList()
+      } catch (e) {
+        this.$message.error('保存失败')
+      } finally {
+        this.submitLoading = false
+      }
+    },
+    async handleDelete(row) {
+      try {
+        await this.$confirm(`确认删除分类「${row.name}」?删除后不可恢复。`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+        await danshopCategoryDelete({ id: row.id })
+        this.$message.success('删除成功')
+        this.loadList()
+      } catch (e) {
+        if (e !== 'cancel') {
+          this.$message.error('删除失败')
+        }
+      }
+    },
+    async handleStatusChange(row, val) {
+      this.statusLoading = row.id
+      try {
+        await danshopCategorySave({
+          id: row.id,
+          name: row.name,
+          parentId: row.parentId || 0,
+          sortOrder: row.sortOrder || 0,
+          image: row.image || '',
+          isActive: val
+        })
+        this.$message.success(val ? '已启用' : '已停用')
+      } catch (e) {
+        row.isActive = !val
+        this.$message.error('状态更新失败')
+      } finally {
+        this.statusLoading = null
+      }
+    },
+    formatTime(time) {
+      if (!time) return '-'
+      return new Date(time).toLocaleString()
+    }
+  }
+}
+</script>
+
+<style scoped>
+.danshop-category {
+  padding: 20px;
+}
+.header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 20px;
+}
+.header h2 {
+  margin: 0;
+}
+.header-actions {
+  display: flex;
+  align-items: center;
+}
+</style>

+ 301 - 0
cfc-web/src/views/admin/DanShopLogisticsManage.vue

@@ -0,0 +1,301 @@
+<template>
+  <div class="danshop-logistics">
+    <div class="header">
+      <h2>物流管理</h2>
+      <div class="header-actions">
+        <el-input
+          v-model="searchOrderNo"
+          placeholder="订单号"
+          style="width: 180px; margin-right: 10px;"
+          clearable
+          @keyup.enter.native="handleSearch"
+        />
+        <el-select v-model="searchStatus" placeholder="物流状态" @change="handleSearch" style="width: 140px; margin-right: 10px;">
+          <el-option label="全部" value="" />
+          <el-option label="待发货" value="pending" />
+          <el-option label="已发货" value="shipped" />
+          <el-option label="运输中" value="signing" />
+          <el-option label="已签收" value="completed" />
+        </el-select>
+        <el-button type="primary" @click="handleSearch">搜索</el-button>
+      </div>
+    </div>
+
+    <el-table :data="list" v-loading="loading" border stripe>
+      <el-table-column label="订单号" width="180" show-overflow-tooltip>
+        <template slot-scope="{ row }">
+          {{ row.orderNo || row.orderId || '-' }}
+        </template>
+      </el-table-column>
+      <el-table-column prop="logisticsCompany" label="物流公司" width="120" show-overflow-tooltip />
+      <el-table-column prop="logisticsNo" label="运单号" width="150" show-overflow-tooltip />
+      <el-table-column prop="receiverName" label="收件人" width="100" />
+      <el-table-column prop="receiverPhone" label="收件人电话" width="130" />
+      <el-table-column prop="receiverAddress" label="收件人地址" min-width="180" show-overflow-tooltip />
+      <el-table-column label="物流状态" width="100">
+        <template slot-scope="{ row }">
+          <el-tag :type="statusTag(row.logisticsStatus)">{{ statusLabel(row.logisticsStatus) }}</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="发货时间" width="160">
+        <template slot-scope="{ row }">
+          {{ formatTime(row.shipTime) }}
+        </template>
+      </el-table-column>
+      <el-table-column label="签收时间" width="160">
+        <template slot-scope="{ row }">
+          {{ formatTime(row.signTime) }}
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" width="160" fixed="right">
+        <template slot-scope="{ row }">
+          <el-button type="primary" size="small" @click="viewDetail(row)">查看详情</el-button>
+          <el-button
+            v-if="row.logisticsStatus === 'pending'"
+            type="success"
+            size="small"
+            @click="showShipDialog(row)"
+          >发货</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <el-pagination
+      @size-change="onPageChange"
+      @current-change="onPageChange"
+      :current-page="page"
+      :page-size="size"
+      :total="total"
+      layout="total, prev, pager, next"
+      style="margin-top: 20px; text-align: right;"
+    />
+
+    <!-- 物流详情弹窗 -->
+    <el-dialog title="物流详情" :visible.sync="detailDialogVisible" width="600px">
+      <div v-loading="detailLoading" v-if="detail">
+        <el-descriptions :column="2" border style="margin-bottom: 20px;">
+          <el-descriptions-item label="物流公司">{{ detail.logisticsCompany || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="运单号">{{ detail.logisticsNo || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="订单号">{{ detail.orderNo || detail.orderId || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="物流状态">
+            <el-tag :type="statusTag(detail.logisticsStatus)">{{ statusLabel(detail.logisticsStatus) }}</el-tag>
+          </el-descriptions-item>
+          <el-descriptions-item label="发件人">{{ detail.senderName || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="发件人电话">{{ detail.senderPhone || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="收件人">{{ detail.receiverName || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="收件人电话">{{ detail.receiverPhone || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="收件人地址" :span="2">{{ detail.receiverAddress || '-' }}</el-descriptions-item>
+        </el-descriptions>
+
+        <h4 style="margin: 0 0 12px 0;">物流跟踪</h4>
+        <div class="tracking-timeline">
+          <el-timeline v-if="trackingList.length > 0">
+            <el-timeline-item
+              v-for="(item, index) in trackingList"
+              :key="index"
+              :timestamp="formatTime(item.time)"
+              :color="index === 0 ? '#E6A23C' : '#C0C4CC'"
+            >
+              <p style="margin: 0;">{{ item.status || '-' }}</p>
+              <p style="margin: 4px 0 0; font-size: 12px; color: #909399;">{{ item.content || '-' }}</p>
+            </el-timeline-item>
+          </el-timeline>
+          <div v-else class="no-tracking">
+            <i class="el-icon-info"></i>
+            <p>暂无物流跟踪信息</p>
+          </div>
+        </div>
+      </div>
+      <span slot="footer">
+        <el-button @click="detailDialogVisible = false">关闭</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 发货弹窗 -->
+    <el-dialog title="发货" :visible.sync="shipDialogVisible" width="450px">
+      <el-form :model="shipForm" label-width="100px">
+        <el-form-item label="物流公司">
+          <el-select v-model="shipForm.logisticsCompany" placeholder="请选择物流公司" style="width: 100%;">
+            <el-option label="顺丰速运" value="顺丰速运" />
+            <el-option label="圆通速递" value="圆通速递" />
+            <el-option label="中通快递" value="中通快递" />
+            <el-option label="申通快递" value="申通快递" />
+            <el-option label="韵达快递" value="韵达快递" />
+            <el-option label="天天快递" value="天天快递" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="运单号">
+          <el-input v-model="shipForm.logisticsNo" placeholder="请输入运单号" />
+        </el-form-item>
+      </el-form>
+      <span slot="footer">
+        <el-button @click="shipDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="confirmShip" :loading="shipLoading">确认发货</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { danshopLogisticsList, danshopLogisticsShip, danshopLogisticsQuery } from '@/api/danshop'
+
+export default {
+  name: 'DanShopLogistics',
+  data() {
+    return {
+      list: [],
+      loading: false,
+      page: 1,
+      size: 20,
+      total: 0,
+      searchOrderNo: '',
+      searchStatus: '',
+      detailDialogVisible: false,
+      detailLoading: false,
+      detail: null,
+      trackingList: [],
+      shipDialogVisible: false,
+      shipLoading: false,
+      shipTarget: null,
+      shipForm: {
+        logisticsCompany: '',
+        logisticsNo: ''
+      }
+    }
+  },
+  mounted() {
+    this.loadList()
+  },
+  methods: {
+    async loadList() {
+      this.loading = true
+      try {
+        const params = {
+          page: this.page,
+          size: this.size
+        }
+        if (this.searchOrderNo.trim()) {
+          params.orderNo = this.searchOrderNo.trim()
+        }
+        if (this.searchStatus) {
+          params.logisticsStatus = this.searchStatus
+        }
+        const res = await danshopLogisticsList(params)
+        this.list = (res.data && res.data.list) || []
+        this.total = (res.data && res.data.total) || 0
+      } catch (e) {
+        this.$message.error('加载物流列表失败')
+      } finally {
+        this.loading = false
+      }
+    },
+    onPageChange(val) {
+      this.page = val
+      this.loadList()
+    },
+    handleSearch() {
+      this.page = 1
+      this.loadList()
+    },
+    async viewDetail(row) {
+      this.detail = row
+      this.trackingList = []
+      this.detailDialogVisible = true
+      this.detailLoading = true
+      try {
+        const res = await danshopLogisticsQuery({ orderId: row.orderId || row.id })
+        if (res.data) {
+          this.trackingList = res.data.trackingList || res.data.tracks || []
+          // Merge any additional detail fields from the query response
+          if (res.data.logisticsCompany) this.detail.logisticsCompany = res.data.logisticsCompany
+          if (res.data.logisticsNo) this.detail.logisticsNo = res.data.logisticsNo
+          if (res.data.receiverName) this.detail.receiverName = res.data.receiverName
+          if (res.data.receiverPhone) this.detail.receiverPhone = res.data.receiverPhone
+          if (res.data.receiverAddress) this.detail.receiverAddress = res.data.receiverAddress
+          if (res.data.senderName) this.detail.senderName = res.data.senderName
+          if (res.data.senderPhone) this.detail.senderPhone = res.data.senderPhone
+        }
+      } catch (e) {
+        // Tracking info is optional, still show basic detail
+      } finally {
+        this.detailLoading = false
+      }
+    },
+    showShipDialog(row) {
+      this.shipTarget = row
+      this.shipForm = { logisticsCompany: '', logisticsNo: '' }
+      this.shipDialogVisible = true
+    },
+    async confirmShip() {
+      if (!this.shipForm.logisticsCompany) {
+        return this.$message.warning('请选择物流公司')
+      }
+      if (!this.shipForm.logisticsNo.trim()) {
+        return this.$message.warning('请输入运单号')
+      }
+      this.shipLoading = true
+      try {
+        await danshopLogisticsShip({
+          orderId: this.shipTarget.orderId || this.shipTarget.id,
+          logisticsCompany: this.shipForm.logisticsCompany,
+          logisticsNo: this.shipForm.logisticsNo.trim()
+        })
+        this.$message.success('发货成功')
+        this.shipDialogVisible = false
+        this.loadList()
+      } catch (e) {
+        this.$message.error('发货失败')
+      } finally {
+        this.shipLoading = false
+      }
+    },
+    statusTag(status) {
+      const map = { pending: 'warning', shipped: 'primary', signing: 'warning', completed: 'success' }
+      return map[status] || 'info'
+    },
+    statusLabel(status) {
+      const map = { pending: '待发货', shipped: '已发货', signing: '运输中', completed: '已签收' }
+      return map[status] || status || '-'
+    },
+    formatTime(time) {
+      if (!time) return '-'
+      return new Date(time).toLocaleString()
+    }
+  }
+}
+</script>
+
+<style scoped>
+.danshop-logistics {
+  padding: 20px;
+}
+.header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 20px;
+}
+.header h2 {
+  margin: 0;
+}
+.header-actions {
+  display: flex;
+  align-items: center;
+}
+.tracking-timeline {
+  max-height: 400px;
+  overflow-y: auto;
+}
+.no-tracking {
+  text-align: center;
+  padding: 40px 0;
+  color: #909399;
+}
+.no-tracking i {
+  font-size: 36px;
+  margin-bottom: 12px;
+}
+.no-tracking p {
+  margin: 0;
+}
+</style>

+ 359 - 0
cfc-web/src/views/admin/DanShopProfitRuleConfig.vue

@@ -0,0 +1,359 @@
+<template>
+  <div class="profit-rule-config">
+    <div class="header">
+      <h2>分润规则配置</h2>
+      <div class="header-actions">
+        <el-input
+          v-model="searchName"
+          placeholder="规则名称"
+          style="width: 200px; margin-right: 10px;"
+          clearable
+          @keyup.enter.native="handleSearch"
+        />
+        <el-button type="primary" @click="handleSearch">搜索</el-button>
+        <el-button type="success" @click="handleCreate" style="margin-left: 10px;">+ 新增规则</el-button>
+      </div>
+    </div>
+
+    <el-table :data="list" v-loading="loading" border stripe>
+      <el-table-column prop="ruleName" label="规则名称" min-width="140" show-overflow-tooltip />
+      <el-table-column label="规则类型" width="130">
+        <template slot-scope="{ row }">
+          <el-tag :type="ruleTypeTag(row.ruleType)">{{ ruleTypeLabel(row.ruleType) }}</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="关联目标" width="150" show-overflow-tooltip>
+        <template slot-scope="{ row }">
+          {{ row.targetName || '-' }}
+        </template>
+      </el-table-column>
+      <el-table-column label="平台利润率(%)" width="130">
+        <template slot-scope="{ row }">
+          {{ row.platformProfitRate != null ? row.platformProfitRate + '%' : '-' }}
+        </template>
+      </el-table-column>
+      <el-table-column label="L1推荐人比例(%)" width="140">
+        <template slot-scope="{ row }">
+          {{ row.referrerL1Rate != null ? row.referrerL1Rate + '%' : '-' }}
+        </template>
+      </el-table-column>
+      <el-table-column label="L2推荐人比例(%)" width="140">
+        <template slot-scope="{ row }">
+          {{ row.referrerL2Rate != null ? row.referrerL2Rate + '%' : '-' }}
+        </template>
+      </el-table-column>
+      <el-table-column label="服务费率(%)" width="120">
+        <template slot-scope="{ row }">
+          {{ row.platformServiceRate != null ? row.platformServiceRate + '%' : '-' }}
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" width="80">
+        <template slot-scope="{ row }">
+          <el-switch
+            v-model="row.isActive"
+            :disabled="statusLoading === row.id"
+            @change="(val) => handleStatusChange(row, val)"
+          />
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" width="150" fixed="right">
+        <template slot-scope="{ row }">
+          <el-button type="primary" size="small" @click="handleEdit(row)">编辑</el-button>
+          <el-button type="danger" size="small" @click="handleDelete(row)">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <el-pagination
+      @size-change="onPageChange"
+      @current-change="onPageChange"
+      :current-page="page"
+      :page-size="size"
+      :total="total"
+      layout="total, prev, pager, next"
+      style="margin-top: 20px; text-align: right;"
+    />
+
+    <!-- 新增/编辑规则弹窗 -->
+    <el-dialog :title="isEdit ? '编辑规则' : '新增规则'" :visible.sync="dialogVisible" width="600px">
+      <el-form :model="form" label-width="140px">
+        <el-form-item label="规则名称">
+          <el-input v-model="form.ruleName" placeholder="请输入规则名称" />
+        </el-form-item>
+        <el-form-item label="规则类型">
+          <el-select v-model="form.ruleType" placeholder="请选择规则类型" style="width: 100%;" @change="onRuleTypeChange">
+            <el-option label="商品分类" value="product_category" />
+            <el-option label="供应商等级" value="vendor_level" />
+            <el-option label="全局" value="global" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="关联目标" v-if="form.ruleType === 'product_category'">
+          <el-select v-model="form.targetId" placeholder="请选择商品分类" clearable style="width: 100%;">
+            <el-option
+              v-for="cat in categoryOptions"
+              :key="cat.id"
+              :label="cat.name"
+              :value="cat.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="关联目标" v-if="form.ruleType === 'vendor_level'">
+          <el-input v-model="form.targetName" placeholder="请输入供应商等级名称" />
+          <input type="hidden" v-model="form.targetId" />
+        </el-form-item>
+        <el-form-item label="平台利润率(%)">
+          <el-input-number
+            v-model="form.platformProfitRate"
+            :min="0"
+            :max="100"
+            :precision="2"
+            style="width: 200px;"
+          />
+          <span style="margin-left: 8px;">%</span>
+        </el-form-item>
+        <el-form-item label="L1推荐人比例(%)">
+          <el-input-number
+            v-model="form.referrerL1Rate"
+            :min="0"
+            :max="100"
+            :precision="2"
+            style="width: 200px;"
+          />
+          <span style="margin-left: 8px;">%</span>
+        </el-form-item>
+        <el-form-item label="L2推荐人比例(%)">
+          <el-input-number
+            v-model="form.referrerL2Rate"
+            :min="0"
+            :max="100"
+            :precision="2"
+            style="width: 200px;"
+          />
+          <span style="margin-left: 8px;">%</span>
+        </el-form-item>
+        <el-form-item label="平台服务费率(%)">
+          <el-input-number
+            v-model="form.platformServiceRate"
+            :min="0"
+            :max="100"
+            :precision="2"
+            style="width: 200px;"
+          />
+          <span style="margin-left: 8px;">%</span>
+        </el-form-item>
+        <el-form-item label="启用状态">
+          <el-switch v-model="form.isActive" />
+        </el-form-item>
+      </el-form>
+      <span slot="footer">
+        <el-button @click="dialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="handleSubmit" :loading="submitLoading">保存</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { danshopProfitRuleList, danshopProfitRuleSave, danshopProfitRuleDelete } from '@/api/danshop'
+import { danshopCategoryList } from '@/api/danshop'
+
+export default {
+  name: 'DanShopProfitRule',
+  data() {
+    return {
+      list: [],
+      loading: false,
+      page: 1,
+      size: 20,
+      total: 0,
+      searchName: '',
+      statusLoading: null,
+      dialogVisible: false,
+      isEdit: false,
+      submitLoading: false,
+      form: {
+        id: null,
+        ruleName: '',
+        ruleType: 'global',
+        targetId: null,
+        targetName: '',
+        platformProfitRate: 0,
+        referrerL1Rate: 0,
+        referrerL2Rate: 0,
+        platformServiceRate: 0,
+        isActive: true
+      },
+      categoryOptions: []
+    }
+  },
+  mounted() {
+    this.loadList()
+    this.loadCategories()
+  },
+  methods: {
+    async loadList() {
+      this.loading = true
+      try {
+        const res = await danshopProfitRuleList({
+          page: this.page,
+          size: this.size,
+          ruleName: this.searchName || undefined
+        })
+        this.list = (res.data && res.data.list) || []
+        this.total = (res.data && res.data.total) || 0
+      } catch (e) {
+        this.$message.error('加载分润规则失败')
+      } finally {
+        this.loading = false
+      }
+    },
+    async loadCategories() {
+      try {
+        const res = await danshopCategoryList({ page: 1, size: 999 })
+        this.categoryOptions = (res.data && res.data.list) || []
+      } catch (e) {
+        // silently fail, categories are optional for the form
+      }
+    },
+    onPageChange(val) {
+      this.page = val
+      this.loadList()
+    },
+    handleSearch() {
+      this.page = 1
+      this.loadList()
+    },
+    onRuleTypeChange() {
+      this.form.targetId = null
+      this.form.targetName = ''
+    },
+    handleCreate() {
+      this.isEdit = false
+      this.form = {
+        id: null,
+        ruleName: '',
+        ruleType: 'global',
+        targetId: null,
+        targetName: '',
+        platformProfitRate: 0,
+        referrerL1Rate: 0,
+        referrerL2Rate: 0,
+        platformServiceRate: 0,
+        isActive: true
+      }
+      this.dialogVisible = true
+    },
+    handleEdit(row) {
+      this.isEdit = true
+      this.form = {
+        id: row.id,
+        ruleName: row.ruleName || '',
+        ruleType: row.ruleType || 'global',
+        targetId: row.targetId || null,
+        targetName: row.targetName || '',
+        platformProfitRate: row.platformProfitRate != null ? row.platformProfitRate : 0,
+        referrerL1Rate: row.referrerL1Rate != null ? row.referrerL1Rate : 0,
+        referrerL2Rate: row.referrerL2Rate != null ? row.referrerL2Rate : 0,
+        platformServiceRate: row.platformServiceRate != null ? row.platformServiceRate : 0,
+        isActive: row.isActive !== undefined ? row.isActive : true
+      }
+      this.dialogVisible = true
+    },
+    async handleSubmit() {
+      if (!this.form.ruleName.trim()) {
+        return this.$message.warning('请输入规则名称')
+      }
+      this.submitLoading = true
+      try {
+        await danshopProfitRuleSave({
+          id: this.form.id || undefined,
+          ruleName: this.form.ruleName,
+          ruleType: this.form.ruleType,
+          targetId: this.form.ruleType === 'global' ? undefined : (this.form.targetId || undefined),
+          platformProfitRate: this.form.platformProfitRate,
+          referrerL1Rate: this.form.referrerL1Rate,
+          referrerL2Rate: this.form.referrerL2Rate,
+          platformServiceRate: this.form.platformServiceRate,
+          isActive: this.form.isActive
+        })
+        this.$message.success(this.isEdit ? '规则已更新' : '规则已创建')
+        this.dialogVisible = false
+        this.loadList()
+      } catch (e) {
+        this.$message.error('保存失败')
+      } finally {
+        this.submitLoading = false
+      }
+    },
+    async handleDelete(row) {
+      try {
+        await this.$confirm(`确认删除规则「${row.ruleName}」?删除后不可恢复。`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+        await danshopProfitRuleDelete({ id: row.id })
+        this.$message.success('删除成功')
+        this.loadList()
+      } catch (e) {
+        if (e !== 'cancel') {
+          this.$message.error('删除失败')
+        }
+      }
+    },
+    async handleStatusChange(row, val) {
+      this.statusLoading = row.id
+      try {
+        await danshopProfitRuleSave({
+          id: row.id,
+          ruleName: row.ruleName,
+          ruleType: row.ruleType,
+          targetId: row.targetId || undefined,
+          platformProfitRate: row.platformProfitRate,
+          referrerL1Rate: row.referrerL1Rate,
+          referrerL2Rate: row.referrerL2Rate,
+          platformServiceRate: row.platformServiceRate,
+          isActive: val
+        })
+        this.$message.success(val ? '已启用' : '已停用')
+      } catch (e) {
+        row.isActive = !val
+        this.$message.error('状态更新失败')
+      } finally {
+        this.statusLoading = null
+      }
+    },
+    ruleTypeLabel(type) {
+      const map = { product_category: '商品分类', vendor_level: '供应商等级', global: '全局' }
+      return map[type] || type || '-'
+    },
+    ruleTypeTag(type) {
+      const map = { product_category: 'primary', vendor_level: 'warning', global: 'success' }
+      return map[type] || 'info'
+    },
+    formatTime(time) {
+      if (!time) return '-'
+      return new Date(time).toLocaleString()
+    }
+  }
+}
+</script>
+
+<style scoped>
+.profit-rule-config {
+  padding: 20px;
+}
+.header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 20px;
+}
+.header h2 {
+  margin: 0;
+}
+.header-actions {
+  display: flex;
+  align-items: center;
+}
+</style>

+ 160 - 32
cfc-web/src/views/admin/OrderManage.vue

@@ -2,14 +2,29 @@
   <div class="order-manage">
     <div class="header">
       <h2>订单管理</h2>
-      <el-select v-model="statusFilter" placeholder="订单状态" @change="loadList" style="width: 150px;">
-        <el-option label="全部" value="" />
-        <el-option label="待支付" value="pending" />
-        <el-option label="已支付" value="paid" />
-        <el-option label="已完成" value="completed" />
-        <el-option label="已取消" value="cancelled" />
-        <el-option label="已退款" value="refunded" />
-      </el-select>
+      <div class="filters">
+        <el-radio-group v-model="sourceTab" size="small" @change="onSourceChange" style="margin-right: 10px;">
+          <el-radio-button label="cfc">平台订单</el-radio-button>
+          <el-radio-button label="danshop">DanShop订单</el-radio-button>
+        </el-radio-group>
+        <el-select v-model="statusFilter" placeholder="订单状态" @change="loadList" style="width: 150px;">
+          <el-option label="全部" value="" />
+          <template v-if="sourceTab === 'cfc'">
+            <el-option label="待支付" value="pending" />
+            <el-option label="已支付" value="paid" />
+            <el-option label="已完成" value="completed" />
+            <el-option label="已取消" value="cancelled" />
+            <el-option label="已退款" value="refunded" />
+          </template>
+          <template v-if="sourceTab === 'danshop'">
+            <el-option label="待支付" value="0" />
+            <el-option label="待发货" value="1" />
+            <el-option label="待收货" value="2" />
+            <el-option label="已完成" value="3" />
+            <el-option label="已取消" value="4" />
+          </template>
+        </el-select>
+      </div>
     </div>
 
     <el-table :data="list" v-loading="loading" border stripe>
@@ -17,6 +32,9 @@
       <el-table-column label="商品" min-width="180">
         <template slot-scope="{ row }">
           <div v-if="row.productName">{{ row.productName }}</div>
+          <div v-else-if="row.items && row.items.length">
+            <span v-for="(item, idx) in row.items" :key="idx">{{ item.productName }} x{{ item.quantity }}<span v-if="idx < row.items.length - 1">,</span></span>
+          </div>
           <div v-else>-</div>
         </template>
       </el-table-column>
@@ -32,27 +50,32 @@
       </el-table-column>
       <el-table-column label="订单金额" width="100">
         <template slot-scope="{ row }">
-          ¥{{ row.amount ? (row.amount / 100).toFixed(2) : '0.00' }}
+          <template v-if="sourceTab === 'danshop'">¥{{ row.totalAmount || '0.00' }}</template>
+          <template v-else>¥{{ row.amount ? (row.amount / 100).toFixed(2) : '0.00' }}</template>
         </template>
       </el-table-column>
       <el-table-column label="订单状态" width="100">
         <template slot-scope="{ row }">
-          <el-tag :type="statusType(row.status)">{{ statusLabel(row.status) }}</el-tag>
+          <el-tag :type="sourceTab === 'danshop' ? danShopStatusType(row.status) : statusType(row.status)">
+            {{ sourceTab === 'danshop' ? danShopStatusLabel(row.status) : statusLabel(row.status) }}
+          </el-tag>
         </template>
       </el-table-column>
       <el-table-column label="支付方式" width="100">
         <template slot-scope="{ row }">
-          {{ payMethodLabel(row.payMethod) }}
+          {{ sourceTab === 'danshop' ? danShopPayLabel(row.paymentMethod) : payMethodLabel(row.payMethod) }}
         </template>
       </el-table-column>
       <el-table-column prop="createTime" label="下单时间" width="160">
         <template slot-scope="{ row }">
-          {{ formatTime(row.createTime) }}
+          {{ formatTime(row.createTime || row.createdAt) }}
         </template>
       </el-table-column>
-      <el-table-column label="操作" width="100" fixed="right">
+      <el-table-column label="操作" width="200" fixed="right">
         <template slot-scope="{ row }">
           <el-button type="info" size="small" @click="viewDetail(row)">详情</el-button>
+          <el-button v-if="sourceTab === 'danshop' && (row.status === 1)" type="primary" size="small" @click="showShipDialog(row)">发货</el-button>
+          <el-button v-if="sourceTab === 'danshop' && (row.status === 2)" type="success" size="small" @click="handleTrack(row)">物流</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -67,41 +90,69 @@
       style="margin-top: 20px; text-align: right;"
     />
 
-    <!-- 订单详情弹窗 -->
     <el-dialog title="订单详情" :visible.sync="detailDialogVisible" width="600px">
       <el-descriptions :column="2" border v-if="detail">
         <el-descriptions-item label="订单ID">{{ detail.id }}</el-descriptions-item>
         <el-descriptions-item label="订单编号">{{ detail.orderNo || '-' }}</el-descriptions-item>
         <el-descriptions-item label="商品名称">{{ detail.productName || '-' }}</el-descriptions-item>
-        <el-descriptions-item label="商品类型">{{ typeLabel(detail.productType) }}</el-descriptions-item>
-        <el-descriptions-item label="订单金额">¥{{ detail.amount ? (detail.amount / 100).toFixed(2) : '0.00' }}</el-descriptions-item>
-        <el-descriptions-item label="实际支付">¥{{ detail.paidAmount ? (detail.paidAmount / 100).toFixed(2) : '0.00' }}</el-descriptions-item>
+        <el-descriptions-item label="商品类型">{{ sourceTab === 'danshop' ? (detail.productType || '-') : typeLabel(detail.productType) }}</el-descriptions-item>
+        <el-descriptions-item label="订单金额">
+          <template v-if="sourceTab === 'danshop'">¥{{ detail.totalAmount || '0.00' }}</template>
+          <template v-else>¥{{ detail.amount ? (detail.amount / 100).toFixed(2) : '0.00' }}</template>
+        </el-descriptions-item>
+        <el-descriptions-item label="实际支付">
+          <template v-if="sourceTab === 'danshop'">¥{{ detail.totalAmount || '0.00' }}</template>
+          <template v-else>¥{{ detail.paidAmount ? (detail.paidAmount / 100).toFixed(2) : '0.00' }}</template>
+        </el-descriptions-item>
         <el-descriptions-item label="买家昵称">{{ detail.buyerNickname || '-' }}</el-descriptions-item>
         <el-descriptions-item label="买家手机">{{ detail.buyerPhone || '-' }}</el-descriptions-item>
         <el-descriptions-item label="供应商">{{ detail.vendorName || '-' }}</el-descriptions-item>
         <el-descriptions-item label="供应商手机">{{ detail.vendorPhone || '-' }}</el-descriptions-item>
         <el-descriptions-item label="订单状态">
-          <el-tag :type="statusType(detail.status)">{{ statusLabel(detail.status) }}</el-tag>
+          <el-tag :type="sourceTab === 'danshop' ? danShopStatusType(detail.status) : statusType(detail.status)">
+            {{ sourceTab === 'danshop' ? danShopStatusLabel(detail.status) : statusLabel(detail.status) }}
+          </el-tag>
         </el-descriptions-item>
-        <el-descriptions-item label="支付方式">{{ payMethodLabel(detail.payMethod) }}</el-descriptions-item>
-        <el-descriptions-item label="支付时间" :span="2">{{ detail.paidTime ? formatTime(detail.paidTime) : '-' }}</el-descriptions-item>
-        <el-descriptions-item label="收货地址" :span="2">{{ detail.shippingAddress || '-' }}</el-descriptions-item>
-        <el-descriptions-item label="买家留言">{{ detail.buyerNote || '-' }}</el-descriptions-item>
-        <el-descriptions-item label="下单时间" :span="2">{{ formatTime(detail.createTime) }}</el-descriptions-item>
+        <el-descriptions-item label="支付方式">
+          {{ sourceTab === 'danshop' ? danShopPayLabel(detail.paymentMethod) : payMethodLabel(detail.payMethod) }}
+        </el-descriptions-item>
+        <el-descriptions-item label="收货人">{{ detail.receiverName || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="收货电话">{{ detail.receiverPhone || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="收货地址" :span="2">{{ detail.shippingAddress || detail.receiverAddress || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="支付时间" :span="2">{{ detail.paidTime || detail.paymentTime ? formatTime(detail.paidTime || detail.paymentTime) : '-' }}</el-descriptions-item>
+        <el-descriptions-item label="买家留言">{{ detail.buyerNote || detail.remark || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="下单时间">{{ formatTime(detail.createTime || detail.createdAt) }}</el-descriptions-item>
       </el-descriptions>
       <span slot="footer">
         <el-button @click="detailDialogVisible = false">关闭</el-button>
       </span>
     </el-dialog>
+
+    <el-dialog title="发货" :visible.sync="shipDialogVisible" width="450px">
+      <el-form :model="shipForm" label-width="100px">
+        <el-form-item label="物流公司">
+          <el-input v-model="shipForm.company" placeholder="如:顺丰、中通" />
+        </el-form-item>
+        <el-form-item label="物流单号">
+          <el-input v-model="shipForm.trackingNo" placeholder="请输入物流单号" />
+        </el-form-item>
+      </el-form>
+      <span slot="footer">
+        <el-button @click="shipDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="confirmShip" :loading="shipLoading">确认发货</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import { getOrderList } from '@/api/admin'
+import { danshopOrderList, danshopLogisticsShip, danshopLogisticsQuery } from '@/api/danshop'
 
 export default {
   data() {
     return {
+      sourceTab: 'cfc',
       list: [],
       loading: false,
       page: 1,
@@ -109,19 +160,40 @@ export default {
       total: 0,
       statusFilter: '',
       detailDialogVisible: false,
-      detail: null
+      detail: null,
+      shipDialogVisible: false,
+      shipTarget: null,
+      shipLoading: false,
+      shipForm: { company: '', trackingNo: '' }
     }
   },
   mounted() {
     this.loadList()
   },
   methods: {
+    onSourceChange() {
+      this.page = 1
+      this.list = []
+      this.statusFilter = ''
+      this.loadList()
+    },
     async loadList() {
       this.loading = true
       try {
-        const res = await getOrderList({ status: this.statusFilter })
-        this.list = res.data || []
-        this.total = (res.data || []).length
+        if (this.sourceTab === 'cfc') {
+          var res = await getOrderList({ status: this.statusFilter })
+          this.list = res.data || []
+          this.total = (res.data || []).length
+        } else {
+          var params = { page: this.page, size: this.size }
+          if (this.statusFilter !== '') {
+            params.status = parseInt(this.statusFilter)
+          }
+          var res2 = await danshopOrderList(params)
+          var data = res2.data || {}
+          this.list = data.records || data || []
+          this.total = data.total || this.list.length
+        }
       } catch (e) {
         this.$message.error('加载失败')
       } finally {
@@ -133,19 +205,31 @@ export default {
       this.loadList()
     },
     statusType(status) {
-      const map = { pending: 'warning', paid: 'primary', completed: 'success', cancelled: 'info', refunded: 'danger' }
+      var map = { pending: 'warning', paid: 'primary', completed: 'success', cancelled: 'info', refunded: 'danger' }
       return map[status] || 'info'
     },
     statusLabel(status) {
-      const map = { pending: '待支付', paid: '已支付', completed: '已完成', cancelled: '已取消', refunded: '已退款' }
+      var map = { pending: '待支付', paid: '已支付', completed: '已完成', cancelled: '已取消', refunded: '已退款' }
+      return map[status] || status
+    },
+    danShopStatusType(status) {
+      var map = { 0: 'warning', 1: 'primary', 2: '', 3: 'success', 4: 'info', 5: 'danger', 6: 'danger' }
+      return map[status] || 'info'
+    },
+    danShopStatusLabel(status) {
+      var map = { 0: '待支付', 1: '待发货', 2: '待收货', 3: '已完成', 4: '已取消', 5: '退款中', 6: '已退款' }
       return map[status] || status
     },
     payMethodLabel(method) {
-      const map = { wechat: '微信支付', balance: '余额支付', points: '积分兑换', test: '测试支付' }
+      var map = { wechat: '微信支付', balance: '余额支付', points: '积分兑换', test: '测试支付' }
       return map[method] || method || '-'
     },
+    danShopPayLabel(method) {
+      var map = { 1: '微信支付', 2: '余额支付' }
+      return map[method] || (method != null ? method : '-')
+    },
     typeLabel(type) {
-      const map = { physical: '实物商品', virtual: '虚拟商品', coupon: '优惠券' }
+      var map = { physical: '实物商品', virtual: '虚拟商品', coupon: '优惠券' }
       return map[type] || type || '-'
     },
     formatTime(time) {
@@ -155,6 +239,44 @@ export default {
     viewDetail(row) {
       this.detail = row
       this.detailDialogVisible = true
+    },
+    showShipDialog(row) {
+      this.shipTarget = row
+      this.shipForm.company = ''
+      this.shipForm.trackingNo = ''
+      this.shipDialogVisible = true
+    },
+    async confirmShip() {
+      if (!this.shipForm.company.trim() || !this.shipForm.trackingNo.trim()) {
+        return this.$message.warning('请填写物流公司和物流单号')
+      }
+      this.shipLoading = true
+      try {
+        await danshopLogisticsShip({
+          orderId: this.shipTarget.id,
+          company: this.shipForm.company,
+          trackingNo: this.shipForm.trackingNo
+        })
+        this.$message.success('发货成功')
+        this.shipDialogVisible = false
+        this.loadList()
+      } catch (e) {
+        this.$message.error('发货失败')
+      } finally {
+        this.shipLoading = false
+      }
+    },
+    async handleTrack(row) {
+      try {
+        var res = await danshopLogisticsQuery({ orderId: row.id })
+        if (res.data) {
+          this.$alert(JSON.stringify(res.data, null, 2), '物流信息', { customClass: 'logistics-detail' })
+        } else {
+          this.$message.info('暂无物流信息')
+        }
+      } catch (e) {
+        this.$message.error('查询物流失败')
+      }
     }
   }
 }
@@ -169,8 +291,14 @@ export default {
   justify-content: space-between;
   align-items: center;
   margin-bottom: 20px;
+  flex-wrap: wrap;
 }
 .header h2 {
   margin: 0;
 }
-</style>
+.filters {
+  display: flex;
+  gap: 10px;
+  align-items: center;
+}
+</style>

+ 83 - 29
cfc-web/src/views/admin/ProductManage.vue

@@ -3,6 +3,10 @@
     <div class="header">
       <h2>商品管理</h2>
       <div class="filters">
+        <el-radio-group v-model="sourceTab" size="small" @change="onSourceChange" style="margin-right: 10px;">
+          <el-radio-button label="cfc">平台商品</el-radio-button>
+          <el-radio-button label="danshop">DanShop商品</el-radio-button>
+        </el-radio-group>
         <el-select v-model="statusFilter" placeholder="商品状态" @change="loadList" style="width: 140px;">
           <el-option label="全部" value="" />
           <el-option label="待审核" value="pending" />
@@ -10,12 +14,16 @@
           <el-option label="已拒绝" value="rejected" />
           <el-option label="已下架" value="shelved" />
         </el-select>
-        <el-select v-model="typeFilter" placeholder="商品类型" @change="loadList" style="width: 140px;">
+        <el-select v-if="sourceTab === 'cfc'" v-model="typeFilter" placeholder="商品类型" @change="loadList" style="width: 140px;">
           <el-option label="全部类型" value="" />
           <el-option label="实物商品" value="physical" />
           <el-option label="虚拟商品" value="virtual" />
           <el-option label="优惠券" value="coupon" />
         </el-select>
+        <el-select v-if="sourceTab === 'danshop'" v-model="danshopCategoryFilter" placeholder="DanShop分类" @change="loadList" style="width: 140px;">
+          <el-option label="全部分类" value="" />
+          <el-option v-for="cat in danshopCategories" :key="cat.id" :label="cat.name" :value="cat.id" />
+        </el-select>
       </div>
     </div>
 
@@ -30,18 +38,18 @@
       <el-table-column prop="name" label="商品名称" min-width="150" show-overflow-tooltip />
       <el-table-column label="类型" width="90">
         <template slot-scope="{ row }">
-          {{ typeLabel(row.productType) }}
+          {{ sourceTab === 'danshop' ? danShopTypeLabel(row.productType) : typeLabel(row.productType) }}
         </template>
       </el-table-column>
-      <el-table-column prop="price" label="售价(元)" width="90">
+      <el-table-column label="售价(元)" width="90">
         <template slot-scope="{ row }">
-          ¥{{ (row.price / 100).toFixed(2) }}
+          {{ sourceTab === 'danshop' ? ('¥' + (row.price || '0.00')) : ('¥' + (row.price / 100).toFixed(2)) }}
         </template>
       </el-table-column>
       <el-table-column prop="stock" label="库存" width="70" />
       <el-table-column label="供应商" width="120" show-overflow-tooltip>
         <template slot-scope="{ row }">
-          {{ row.vendorName || '-' }}
+          {{ row.vendorName || row.brandName || '-' }}
         </template>
       </el-table-column>
       <el-table-column label="状态" width="90">
@@ -51,15 +59,21 @@
       </el-table-column>
       <el-table-column prop="createTime" label="创建时间" width="160">
         <template slot-scope="{ row }">
-          {{ formatTime(row.createTime) }}
+          {{ formatTime(row.createTime || row.createdAt) }}
         </template>
       </el-table-column>
       <el-table-column label="操作" width="220" fixed="right">
         <template slot-scope="{ row }">
-          <el-button v-if="row.status === 'pending'" type="success" size="small" @click="handleReview(row, 'approve')">通过</el-button>
-          <el-button v-if="row.status === 'pending'" type="danger" size="small" @click="showRejectDialog(row)">拒绝</el-button>
-          <el-button v-if="row.status === 'approved'" type="warning" size="small" @click="handleShelve(row, false)">下架</el-button>
-          <el-button v-if="row.status === 'shelved'" type="primary" size="small" @click="handleShelve(row, true)">上架</el-button>
+          <template v-if="sourceTab === 'cfc'">
+            <el-button v-if="row.status === 'pending'" type="success" size="small" @click="handleReview(row, 'approve')">通过</el-button>
+            <el-button v-if="row.status === 'pending'" type="danger" size="small" @click="showRejectDialog(row)">拒绝</el-button>
+            <el-button v-if="row.status === 'approved'" type="warning" size="small" @click="handleShelve(row, false)">下架</el-button>
+            <el-button v-if="row.status === 'shelved'" type="primary" size="small" @click="handleShelve(row, true)">上架</el-button>
+          </template>
+          <template v-if="sourceTab === 'danshop'">
+            <el-button v-if="row.status === 0 || row.status === 'pending'" type="success" size="small" @click="handleDanShopShelve(row, true)">上架</el-button>
+            <el-button v-if="row.status === 1 || row.status === 'approved'" type="warning" size="small" @click="handleDanShopShelve(row, false)">下架</el-button>
+          </template>
           <el-button type="info" size="small" @click="viewDetail(row)">详情</el-button>
         </template>
       </el-table-column>
@@ -75,7 +89,6 @@
       style="margin-top: 20px; text-align: right;"
     />
 
-    <!-- 拒绝原因弹窗 -->
     <el-dialog title="拒绝原因" :visible.sync="rejectDialogVisible" width="400px">
       <el-input v-model="rejectReason" type="textarea" :rows="3" placeholder="请输入拒绝原因" />
       <span slot="footer">
@@ -84,23 +97,22 @@
       </span>
     </el-dialog>
 
-    <!-- 商品详情弹窗 -->
     <el-dialog title="商品详情" :visible.sync="detailDialogVisible" width="600px">
       <el-descriptions :column="2" border v-if="detail">
         <el-descriptions-item label="商品名称">{{ detail.name }}</el-descriptions-item>
-        <el-descriptions-item label="商品类型">{{ typeLabel(detail.productType) }}</el-descriptions-item>
-        <el-descriptions-item label="售价">¥{{ (detail.price / 100).toFixed(2) }}</el-descriptions-item>
-        <el-descriptions-item label="会员价">¥{{ detail.memberPrice ? (detail.memberPrice / 100).toFixed(2) : '-' }}</el-descriptions-item>
+        <el-descriptions-item label="商品类型">{{ sourceTab === 'danshop' ? danShopTypeLabel(detail.productType) : typeLabel(detail.productType) }}</el-descriptions-item>
+        <el-descriptions-item label="售价">{{ sourceTab === 'danshop' ? ('¥' + (detail.price || '0.00')) : ('¥' + (detail.price / 100).toFixed(2)) }}</el-descriptions-item>
+        <el-descriptions-item label="会员价">{{ detail.memberPrice ? (sourceTab === 'danshop' ? ('¥' + detail.memberPrice) : ('¥' + (detail.memberPrice / 100).toFixed(2))) : '-' }}</el-descriptions-item>
         <el-descriptions-item label="库存">{{ detail.stock }}</el-descriptions-item>
         <el-descriptions-item label="销量">{{ detail.salesCount || 0 }}</el-descriptions-item>
-        <el-descriptions-item label="供应商">{{ detail.vendorName || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="供应商">{{ detail.vendorName || detail.brandName || '-' }}</el-descriptions-item>
         <el-descriptions-item label="供应商手机">{{ detail.vendorPhone || '-' }}</el-descriptions-item>
         <el-descriptions-item label="状态">
           <el-tag :type="statusType(detail.status)">{{ statusLabel(detail.status) }}</el-tag>
         </el-descriptions-item>
         <el-descriptions-item label="拒绝原因" v-if="detail.rejectReason">{{ detail.rejectReason }}</el-descriptions-item>
         <el-descriptions-item label="商品描述" :span="2">{{ detail.description || '-' }}</el-descriptions-item>
-        <el-descriptions-item label="创建时间" :span="2">{{ formatTime(detail.createTime) }}</el-descriptions-item>
+        <el-descriptions-item label="创建时间" :span="2">{{ formatTime(detail.createTime || detail.createdAt) }}</el-descriptions-item>
       </el-descriptions>
     </el-dialog>
   </div>
@@ -108,10 +120,12 @@
 
 <script>
 import { getProductList, reviewProduct, shelveProduct } from '@/api/admin'
+import { danshopCategoryList, danshopProductList } from '@/api/danshop'
 
 export default {
   data() {
     return {
+      sourceTab: 'cfc',
       list: [],
       loading: false,
       page: 1,
@@ -119,6 +133,8 @@ export default {
       total: 0,
       statusFilter: '',
       typeFilter: '',
+      danshopCategoryFilter: '',
+      danshopCategories: [],
       rejectDialogVisible: false,
       rejectTarget: null,
       rejectReason: '',
@@ -128,34 +144,66 @@ export default {
   },
   mounted() {
     this.loadList()
+    this.loadDanShopCategories()
   },
   methods: {
+    onSourceChange() {
+      this.page = 1
+      this.list = []
+      this.statusFilter = ''
+      this.typeFilter = ''
+      this.danshopCategoryFilter = ''
+      this.loadList()
+    },
     async loadList() {
       this.loading = true
       try {
-        const res = await getProductList({ status: this.statusFilter })
-        this.list = res.data || []
-        this.total = (res.data || []).length
+        if (this.sourceTab === 'cfc') {
+          var res = await getProductList({ status: this.statusFilter })
+          this.list = res.data || []
+          this.total = (res.data || []).length
+        } else {
+          var params = { page: this.page, size: this.size }
+          if (this.danshopCategoryFilter) {
+            params.categoryId = this.danshopCategoryFilter
+          }
+          var res2 = await danshopProductList(params)
+          var data = res2.data || {}
+          this.list = data.records || data || []
+          this.total = data.total || this.list.length
+        }
       } catch (e) {
         this.$message.error('加载失败')
       } finally {
         this.loading = false
       }
     },
+    async loadDanShopCategories() {
+      try {
+        var res = await danshopCategoryList({})
+        this.danshopCategories = res.data || []
+      } catch (e) {}
+    },
     onPageChange(val) {
       this.page = val
       this.loadList()
     },
     statusType(status) {
-      const map = { pending: 'warning', approved: 'success', rejected: 'danger', shelved: 'info' }
-      return map[status] || 'info'
+      var s = String(status)
+      var map = { pending: 'warning', '0': 'warning', approved: 'success', '1': 'success', rejected: 'danger', shelved: 'info' }
+      return map[s] || 'info'
     },
     statusLabel(status) {
-      const map = { pending: '待审核', approved: '已上架', rejected: '已拒绝', shelved: '已下架' }
-      return map[status] || status
+      var s = String(status)
+      var map = { pending: '待审核', '0': '待审核', approved: '已上架', '1': '已上架', rejected: '已拒绝', shelved: '已下架' }
+      return map[s] || status
     },
     typeLabel(type) {
-      const map = { physical: '实物商品', virtual: '虚拟商品', coupon: '优惠券' }
+      var map = { physical: '实物商品', virtual: '虚拟商品', coupon: '优惠券' }
+      return map[type] || type
+    },
+    danShopTypeLabel(type) {
+      var map = { physical: '实物', digital: '数字', service: '服务', virtual: '虚拟' }
       return map[type] || type
     },
     formatTime(time) {
@@ -164,7 +212,7 @@ export default {
     },
     async handleReview(row, action) {
       try {
-        await this.$confirm(`确认通过该商品审核?`, '提示')
+        await this.$confirm('确认通过该商品审核?', '提示')
         await reviewProduct(row.id, { action })
         this.$message.success('操作成功')
         this.loadList()
@@ -192,7 +240,7 @@ export default {
     },
     async handleShelve(row, shelve) {
       try {
-        await this.$confirm(`确认${shelve ? '上架' : '下架'}该商品?`, '提示')
+        await this.$confirm('确认' + (shelve ? '上架' : '下架') + '该商品?', '提示')
         await shelveProduct(row.id, { shelve })
         this.$message.success('操作成功')
         this.loadList()
@@ -200,13 +248,16 @@ export default {
         if (e !== 'cancel') this.$message.error('操作失败')
       }
     },
+    async handleDanShopShelve(row, shelve) {
+      this.$message.info('DanShop商品上下架请前往DanShop管理端操作')
+    },
     viewDetail(row) {
       this.detail = row
       this.detailDialogVisible = true
     },
     previewImage(url) {
       if (!url) return
-      this.$alert(`<img src="${url}" style="max-width:100%;" />`, '商品图片', {
+      this.$alert('<img src="' + url + '" style="max-width:100%;" />', '商品图片', {
         dangerouslyUseHTMLString: true,
         closeOnClickModal: true
       })
@@ -224,6 +275,7 @@ export default {
   justify-content: space-between;
   align-items: center;
   margin-bottom: 20px;
+  flex-wrap: wrap;
 }
 .header h2 {
   margin: 0;
@@ -231,6 +283,8 @@ export default {
 .filters {
   display: flex;
   gap: 10px;
+  flex-wrap: wrap;
+  align-items: center;
 }
 .product-thumb {
   width: 50px;
@@ -239,4 +293,4 @@ export default {
   border-radius: 4px;
   cursor: pointer;
 }
-</style>
+</style>

+ 34 - 34
dan/danshop/.project

@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>danshop</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.m2e.core.maven2Builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>org.eclipse.m2e.core.maven2Nature</nature>
-	</natures>
-	<filteredResources>
-		<filter>
-			<id>1781272892739</id>
-			<name></name>
-			<type>30</type>
-			<matcher>
-				<id>org.eclipse.core.resources.regexFilterMatcher</id>
-				<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
-			</matcher>
-		</filter>
-	</filteredResources>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>danshop</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+	<filteredResources>
+		<filter>
+			<id>1781272892739</id>
+			<name></name>
+			<type>30</type>
+			<matcher>
+				<id>org.eclipse.core.resources.regexFilterMatcher</id>
+				<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
+			</matcher>
+		</filter>
+	</filteredResources>
+</projectDescription>

+ 4 - 4
dan/danshop/.settings/org.eclipse.core.resources.prefs

@@ -1,4 +1,4 @@
-eclipse.preferences.version=1
-encoding//src/main/java=UTF-8
-encoding//src/main/resources=UTF-8
-encoding/<project>=UTF-8
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding/<project>=UTF-8

+ 4 - 4
dan/danshop/.settings/org.eclipse.jdt.apt.core.prefs

@@ -1,4 +1,4 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.apt.aptEnabled=true
-org.eclipse.jdt.apt.genSrcDir=target/generated-sources/annotations
-org.eclipse.jdt.apt.genTestSrcDir=target/generated-test-sources/test-annotations
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=true
+org.eclipse.jdt.apt.genSrcDir=target/generated-sources/annotations
+org.eclipse.jdt.apt.genTestSrcDir=target/generated-test-sources/test-annotations

+ 10 - 10
dan/danshop/.settings/org.eclipse.jdt.core.prefs

@@ -1,10 +1,10 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.processAnnotations=enabled
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
+org.eclipse.jdt.core.compiler.processAnnotations=enabled
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8

+ 4 - 4
dan/danshop/.settings/org.eclipse.m2e.core.prefs

@@ -1,4 +1,4 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1

+ 41 - 0
dan/danshop/src/main/java/com/etotem/danshop/controller/seller/SellerProfitController.java

@@ -0,0 +1,41 @@
+package com.etotem.danshop.controller.seller;
+
+import com.etotem.danshop.common.Result;
+import com.etotem.danshop.entity.ProfitLog;
+import com.etotem.danshop.service.ProfitService;
+import com.etotem.danshop.service.ProfitSettlementService;
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/api/shop/seller/profit")
+public class SellerProfitController {
+
+    @Resource
+    private ProfitService profitService;
+    @Resource
+    private ProfitSettlementService profitSettlementService;
+
+    @PostMapping("/logs")
+    public Result<List<ProfitLog>> listLogs(
+            @RequestAttribute("userId") Long userId,
+            @RequestBody(required = false) Map<String, Object> params) {
+        int page = params != null && params.get("page") != null ? ((Number) params.get("page")).intValue() : 1;
+        int size = params != null && params.get("size") != null ? ((Number) params.get("size")).intValue() : 20;
+        return profitService.listByVendor(userId, page, size);
+    }
+
+    @PostMapping("/summary")
+    public Result<Map<String, Object>> getSummary(@RequestAttribute("userId") Long userId) {
+        return Result.success(profitSettlementService.getProfitSummary(userId));
+    }
+
+    @PostMapping("/settle")
+    public Result<Void> settleOrder(@RequestBody Map<String, Object> params) {
+        Long orderId = ((Number) params.get("orderId")).longValue();
+        profitSettlementService.settleOrder(orderId);
+        return Result.success(null);
+    }
+}

+ 15 - 0
dan/danshop/src/main/java/com/etotem/danshop/dto/ProductQueryDTO.java

@@ -0,0 +1,15 @@
+package com.etotem.danshop.dto;
+
+import lombok.Data;
+import java.io.Serializable;
+
+@Data
+public class ProductQueryDTO implements Serializable {
+    private Long categoryId;
+    private String keyword;
+    /** pending/approved/rejected/shelved */
+    private String status;
+    private Long vendorId;
+    private Integer page = 1;
+    private Integer pageSize = 20;
+}

+ 9 - 71
dan/danshop/src/main/java/com/etotem/danshop/service/PaymentService.java

@@ -1,102 +1,40 @@
 package com.etotem.danshop.service;
 
-import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.etotem.danshop.common.Result;
 import com.etotem.danshop.entity.Order;
 import com.etotem.danshop.mapper.OrderMapper;
-import com.etotem.danshop.util.OrderNoGenerator;
-import okhttp3.*;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
-import java.util.UUID;
 
 @Service
 public class PaymentService {
 
-    private static final MediaType JSON_TYPE = MediaType.parse("application/json; charset=utf-8");
-    private static final OkHttpClient CLIENT = new OkHttpClient();
-
     @Resource
     private OrderMapper orderMapper;
     @Resource
     private OrderService orderService;
     @Resource
-    private OrderNoGenerator orderNoGenerator;
-
-    @Value("${danshop.payment.wechat.app-id:}")
-    private String appId;
-    @Value("${danshop.payment.wechat.mch-id:}")
-    private String mchId;
-    @Value("${danshop.payment.wechat.api-v3-key:}")
-    private String apiV3Key;
-    @Value("${danshop.payment.wechat.notify-url:}")
-    private String notifyUrl;
+    private WechatPayService wechatPayService;
 
     public Result<JSONObject> createWxPayOrder(Long userId, String orderNo, BigDecimal amount, String openId) {
-        if (appId == null || appId.isEmpty()) {
-            return Result.error("支付未配置");
-        }
-
-        String payOrderNo = "PAY" + orderNoGenerator.generate();
-        JSONObject body = new JSONObject();
-        body.put("mchid", mchId);
-        body.put("appid", appId);
-        body.put("description", "浠艾福商品订单");
-        body.put("notify_url", notifyUrl);
-        body.put("out_trade_no", payOrderNo);
-
-        JSONObject amountObj = new JSONObject();
-        amountObj.put("total", amount.multiply(new BigDecimal("100")).intValue());
-        amountObj.put("currency", "CNY");
-        body.put("amount", amountObj);
-
-        JSONObject payer = new JSONObject();
-        payer.put("openid", openId);
-        body.put("payer", payer);
-
-        try {
-            Request request = new Request.Builder()
-                .url("https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi")
-                .post(RequestBody.create(JSON_TYPE, body.toJSONString()))
-                .header("Authorization", "WECHATPAY2-SHA256-RSA2048 nonce_str=" + UUID.randomUUID())
-                .build();
-
-            try (Response response = CLIENT.newCall(request).execute()) {
-                String respBody = response.body().string();
-                if (!response.isSuccessful()) {
-                    return Result.error("支付下单失败:" + respBody);
-                }
-                JSONObject resp = JSON.parseObject(respBody);
-                JSONObject result = new JSONObject();
-                result.put("prepayId", resp.getString("prepay_id"));
-                result.put("payOrderNo", payOrderNo);
-                return Result.success(result);
-            }
-        } catch (Exception e) {
-            return Result.error("支付异常:" + e.getMessage());
-        }
+        return wechatPayService.createJsapiOrder(orderNo, amount, openId);
     }
 
     @Transactional
     public Result<Void> handleWxPayNotify(String notifyData) {
         try {
-            JSONObject notify = JSON.parseObject(notifyData);
-            JSONObject resource = notify.getJSONObject("resource");
-            String orderNo = resource.getString("out_trade_no");
-            String tradeState = resource.getString("trade_state");
-
-            if ("SUCCESS".equals(tradeState)) {
-                String payOrderNo = orderNo.substring(4); // 去掉PAY前缀
-                return orderService.paySuccess(payOrderNo, resource.getString("transaction_id"));
+            JSONObject result = wechatPayService.parseNotify(notifyData);
+            if (result == null || !result.getBooleanValue("success")) {
+                return Result.success(null);
             }
+            String payOrderNo = result.getString("payOrderNo");
+            String transactionId = result.getString("transactionId");
+            return orderService.paySuccess(payOrderNo, transactionId);
         } catch (Exception e) {
             return Result.error("处理失败");
         }
-        return Result.success(null);
     }
-}
+}

+ 67 - 0
dan/danshop/src/main/java/com/etotem/danshop/service/ProfitSettlementService.java

@@ -0,0 +1,67 @@
+package com.etotem.danshop.service;
+
+import com.etotem.danshop.entity.Order;
+import com.etotem.danshop.entity.OrderItem;
+import com.etotem.danshop.entity.ProfitLog;
+import com.etotem.danshop.entity.ProfitRule;
+import com.etotem.danshop.mapper.OrderMapper;
+import com.etotem.danshop.mapper.ProfitLogMapper;
+import com.etotem.danshop.mapper.ProfitRuleMapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class ProfitSettlementService {
+
+    @Resource
+    private ProfitRuleMapper profitRuleMapper;
+    @Resource
+    private ProfitLogMapper profitLogMapper;
+    @Resource
+    private OrderMapper orderMapper;
+    @Resource
+    private ProfitService profitService;
+
+    @Transactional
+    public void settleOrder(Long orderId) {
+        Order order = orderMapper.selectById(orderId);
+        if (order == null) return;
+        profitService.distributeProfit(order);
+    }
+
+    public Map<String, Object> getProfitSummary(Long vendorId) {
+        Map<String, Object> summary = new HashMap<>();
+
+        LambdaQueryWrapper<ProfitLog> allWrapper = new LambdaQueryWrapper<ProfitLog>()
+                .eq(ProfitLog::getRuleId, vendorId);
+        List<ProfitLog> allLogs = profitLogMapper.selectList(allWrapper);
+
+        BigDecimal totalProfit = BigDecimal.ZERO;
+        BigDecimal totalPlatform = BigDecimal.ZERO;
+        BigDecimal totalVendor = BigDecimal.ZERO;
+        BigDecimal totalL1 = BigDecimal.ZERO;
+        BigDecimal totalL2 = BigDecimal.ZERO;
+
+        for (ProfitLog log : allLogs) {
+            if (log.getProfitAmount() != null) totalProfit = totalProfit.add(log.getProfitAmount());
+            if (log.getPlatformRetained() != null) totalPlatform = totalPlatform.add(log.getPlatformRetained());
+            if (log.getVendorIncome() != null) totalVendor = totalVendor.add(log.getVendorIncome());
+            if (log.getCommissionL1() != null) totalL1 = totalL1.add(log.getCommissionL1());
+            if (log.getCommissionL2() != null) totalL2 = totalL2.add(log.getCommissionL2());
+        }
+
+        summary.put("totalProfit", totalProfit);
+        summary.put("platformRetained", totalPlatform);
+        summary.put("vendorIncome", totalVendor);
+        summary.put("commissionL1", totalL1);
+        summary.put("commissionL2", totalL2);
+        summary.put("orderCount", allLogs.size());
+        return summary;
+    }
+}

+ 93 - 0
dan/danshop/src/main/java/com/etotem/danshop/service/WechatPayService.java

@@ -0,0 +1,93 @@
+package com.etotem.danshop.service;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.etotem.danshop.common.Result;
+import com.etotem.danshop.config.WechatPayConfig;
+import com.etotem.danshop.util.OrderNoGenerator;
+import okhttp3.*;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.UUID;
+
+@Service
+public class WechatPayService {
+
+    private static final MediaType JSON_TYPE = MediaType.parse("application/json; charset=utf-8");
+    private static final OkHttpClient CLIENT = new OkHttpClient();
+
+    @Resource
+    private WechatPayConfig wechatPayConfig;
+
+    @Resource
+    private OrderNoGenerator orderNoGenerator;
+
+    public Result<JSONObject> createJsapiOrder(String orderNo, BigDecimal amount, String openId) {
+        if (wechatPayConfig.getAppId() == null || wechatPayConfig.getAppId().isEmpty()) {
+            return Result.error("支付未配置");
+        }
+
+        String payOrderNo = "PAY" + orderNoGenerator.generate();
+        JSONObject body = new JSONObject();
+        body.put("mchid", wechatPayConfig.getMchId());
+        body.put("appid", wechatPayConfig.getAppId());
+        body.put("description", "浠艾福商品订单");
+        body.put("notify_url", wechatPayConfig.getNotifyUrl());
+        body.put("out_trade_no", payOrderNo);
+
+        JSONObject amountObj = new JSONObject();
+        amountObj.put("total", amount.multiply(new BigDecimal("100")).intValue());
+        amountObj.put("currency", "CNY");
+        body.put("amount", amountObj);
+
+        JSONObject payer = new JSONObject();
+        payer.put("openid", openId);
+        body.put("payer", payer);
+
+        try {
+            Request request = new Request.Builder()
+                .url("https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi")
+                .post(RequestBody.create(JSON_TYPE, body.toJSONString()))
+                .header("Authorization", "WECHATPAY2-SHA256-RSA2048 nonce_str=" + UUID.randomUUID())
+                .build();
+
+            try (Response response = CLIENT.newCall(request).execute()) {
+                String respBody = response.body().string();
+                if (!response.isSuccessful()) {
+                    return Result.error("支付下单失败:" + respBody);
+                }
+                JSONObject resp = JSON.parseObject(respBody);
+                JSONObject result = new JSONObject();
+                result.put("prepayId", resp.getString("prepay_id"));
+                result.put("payOrderNo", payOrderNo);
+                return Result.success(result);
+            }
+        } catch (Exception e) {
+            return Result.error("支付异常:" + e.getMessage());
+        }
+    }
+
+    public JSONObject parseNotify(String notifyData) {
+        try {
+            JSONObject notify = JSON.parseObject(notifyData);
+            JSONObject resource = notify.getJSONObject("resource");
+            String payOrderNo = resource.getString("out_trade_no");
+            String tradeState = resource.getString("trade_state");
+            String transactionId = resource.getString("transaction_id");
+
+            JSONObject result = new JSONObject();
+            result.put("payOrderNo", payOrderNo);
+            result.put("tradeState", tradeState);
+            result.put("transactionId", transactionId);
+            result.put("success", "SUCCESS".equals(tradeState));
+            return result;
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    public String getAppId() {
+        return wechatPayConfig.getAppId();
+    }
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов