profile.vue 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596
  1. <template>
  2. <view class="container" :style="{ '--font-scale': fontScale }">
  3. <!-- 登录浮层(全局组件,页面内弹出底部登录) -->
  4. <login-sheet ref="loginSheet" @success="onSheetLoginSuccess" />
  5. <!-- 未登录 -->
  6. <view v-if="!isLoggedIn">
  7. <view class="gp-page">
  8. <!-- 登录大卡 -->
  9. <view class="gp-login">
  10. <view class="gp-logo"><view class="gp-logo-heart"></view></view>
  11. <text class="gp-login-title">登录浠艾福</text>
  12. <text class="gp-login-desc">登录后查看个人资料、管理积分与家庭。</text>
  13. <view class="gp-login-btn" @click="goLogin">
  14. <view class="gp-login-btn-ic"></view>
  15. <text class="gp-login-btn-text">登录 / 注册</text>
  16. </view>
  17. <text class="gp-skip" @click="goSkip">暂不登录,先逛逛 ›</text>
  18. </view>
  19. <!-- 登录后开启 -->
  20. <view class="gp-block">
  21. <text class="gp-tag">登录后开启</text>
  22. <view class="gp-rows">
  23. <view class="gp-row">
  24. <view class="gp-ic gp-ic-wisdom"><text class="gp-glyph">智</text></view>
  25. <view class="gp-row-info">
  26. <text class="gp-row-name">个人身份档案</text>
  27. <text class="gp-row-sub">资料、角色标签与会员状态</text>
  28. </view>
  29. <view class="gp-lock"></view>
  30. </view>
  31. <view class="gp-row">
  32. <view class="gp-ic gp-ic-action"><text class="gp-glyph">行</text></view>
  33. <view class="gp-row-info">
  34. <text class="gp-row-name">我的家庭</text>
  35. <text class="gp-row-sub">成员档案、家庭报告与关系管理</text>
  36. </view>
  37. <view class="gp-lock"></view>
  38. </view>
  39. <view class="gp-row">
  40. <view class="gp-ic gp-ic-wealth"><text class="gp-glyph">富</text></view>
  41. <view class="gp-row-info">
  42. <text class="gp-row-name">积分与能量</text>
  43. <text class="gp-row-sub">积分记录、能量数据与健康资产</text>
  44. </view>
  45. <view class="gp-lock"></view>
  46. </view>
  47. </view>
  48. </view>
  49. <!-- 理念卡 -->
  50. <view class="gp-philosophy">
  51. <text class="gp-philosophy-title">照顾家庭,从照顾好自己开始</text>
  52. <text class="gp-philosophy-desc">你的状态,就是家的状态。先安顿好自己,才有余力温暖家人。</text>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 已登录 -->
  57. <template v-else>
  58. <!-- 退出切换 -->
  59. <view class="exit-switch" v-if="isSwitchedChild" @click="onExitSwitch">
  60. <text>🔄 退出切换</text>
  61. </view>
  62. <!-- 身份卡 -->
  63. <view class="user-card">
  64. <view class="user-card-left">
  65. <view class="avatar-wrap" @click="goToEditInfo">
  66. <image v-if="userInfo.avatar" class="avatar-img" :src="userInfo.avatar" mode="aspectFill" />
  67. <text v-else class="avatar-text">{{ nickname.charAt(0) || '👤' }}</text>
  68. </view>
  69. <view class="user-meta">
  70. <view class="user-name-row">
  71. <text class="nickname">{{ nickname || '未设置昵称' }}</text>
  72. <text v-if="roleLabel" class="role-tag">{{ roleLabel }}</text>
  73. </view>
  74. <view class="user-sub" v-if="memberLevel">
  75. <view class="level-badge" :class="'level-' + memberLevel">{{ memberLevelText }}</view>
  76. <text v-if="isLifetime" class="days-left">永久有效</text>
  77. <text v-else-if="membershipDays > 0 && membershipDays <= 30" class="days-left">剩余 {{ membershipDays }} 天</text>
  78. <view v-if="hasUpgradeSpace" class="upgrade-btn" @click="goUpgrade">
  79. <text class="upgrade-btn-text">{{ upgradeBtnText }}</text>
  80. </view>
  81. </view>
  82. <view class="user-sub" v-else>
  83. <text class="days-left">开通会员解锁更多权益</text>
  84. <view class="upgrade-btn" @click="goUpgrade">
  85. <text class="upgrade-btn-text">立即开通</text>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="user-card-right" @click="goToPoints">
  91. <text class="points-num">{{ totalPoints }}</text>
  92. <text class="points-label">积分</text>
  93. </view>
  94. </view>
  95. <!-- 我的分享海报浮动按钮(纯 CSS 二维码图标,避免 emoji 渲染成计算器) -->
  96. <view class="share-qr-float" @click="showShareQr">
  97. <view class="qr-glyph">
  98. <view class="qr-eye qr-eye-tl"></view>
  99. <view class="qr-eye qr-eye-tr"></view>
  100. <view class="qr-eye qr-eye-bl"></view>
  101. <view class="qr-mid"></view>
  102. <view class="qr-cluster">
  103. <view class="qr-pip"></view>
  104. <view class="qr-pip"></view>
  105. <view class="qr-pip"></view>
  106. <view class="qr-pip"></view>
  107. </view>
  108. </view>
  109. </view>
  110. <!-- 家族成员速览 -->
  111. <view class="family-strip" v-if="familyMembers.length > 0">
  112. <view class="family-strip-header">
  113. <text class="family-strip-title">我的家庭</text>
  114. <text class="family-strip-count">{{ familyMembers.length }} 位成员</text>
  115. </view>
  116. <view class="family-avatars">
  117. <view
  118. v-for="member in familyMembers"
  119. :key="member.id"
  120. class="family-avatar-item"
  121. @click="goMemberDetail(member)"
  122. >
  123. <view class="family-avatar-wrap">
  124. <image v-if="member.avatar" class="family-avatar-img" :src="member.avatar" mode="aspectFill" />
  125. <text v-else class="family-avatar-text">{{ member.nickname ? member.nickname.charAt(0) : '?' }}</text>
  126. <view class="family-avatar-tag" :class="'tag-' + (member.effectiveRole || member.source || 'member')">{{ member.roleLabel || memberRoleLabel(member.effectiveRole) }}</view>
  127. </view>
  128. <text class="family-avatar-name">{{ member.nickname || member.realName || '成员' }}</text>
  129. </view>
  130. <view class="family-avatar-item" @click="goToFamily">
  131. <view class="family-avatar-wrap family-avatar-add">
  132. <text class="family-avatar-plus">+</text>
  133. </view>
  134. <text class="family-avatar-name">添加</text>
  135. </view>
  136. </view>
  137. </view>
  138. <!-- 我的成就(纯成就指标) -->
  139. <view class="achievement-section">
  140. <view class="section-header-row">
  141. <text class="section-title">🏆 我的成就</text>
  142. <text class="section-sub">持续成长,看见改变</text>
  143. </view>
  144. <view class="achievement-grid cols-5">
  145. <view class="ach-item" @click="goToStreak">
  146. <view class="ach-icon-wrap" style="background:rgba(255,140,66,0.12)">
  147. <text class="ach-icon">🔥</text>
  148. </view>
  149. <text class="ach-num">{{ streakDays }}</text>
  150. <text class="ach-label">连续打卡</text>
  151. </view>
  152. <view class="ach-item" @click="goToTaskHistory">
  153. <view class="ach-icon-wrap" style="background:rgba(99,102,241,0.12)">
  154. <text class="ach-icon">✅</text>
  155. </view>
  156. <text class="ach-num">{{ completedTasks }}</text>
  157. <text class="ach-label">完成任务</text>
  158. </view>
  159. <view class="ach-item" @click="goToBadges">
  160. <view class="ach-icon-wrap" style="background:rgba(236,72,153,0.12)">
  161. <text class="ach-icon">🏅</text>
  162. </view>
  163. <text class="ach-num">{{ badgesCollected }}</text>
  164. <text class="ach-label">收集勋章</text>
  165. </view>
  166. <view class="ach-item" @click="goToGrowth">
  167. <view class="ach-icon-wrap" style="background:rgba(16,185,129,0.12)">
  168. <text class="ach-icon">📈</text>
  169. </view>
  170. <text class="ach-num">{{ growthRecords }}</text>
  171. <text class="ach-label">成长记录</text>
  172. </view>
  173. <view class="ach-item" @click="goToChallenges">
  174. <view class="ach-icon-wrap" style="background:rgba(255,107,157,0.12)">
  175. <text class="ach-icon">🎯</text>
  176. </view>
  177. <text class="ach-num">{{ challengesJoined }}</text>
  178. <text class="ach-label">参加挑战</text>
  179. </view>
  180. </view>
  181. </view>
  182. <!-- 我的团队(团队管理 + 推广收益 + 邀请成员) -->
  183. <view class="achievement-section">
  184. <view class="section-header-row">
  185. <text class="section-title">👥 我的团队</text>
  186. <text class="section-sub">团队网络与推广收益</text>
  187. </view>
  188. <view class="achievement-grid team-grid">
  189. <view class="ach-item" @click="goTeamTree">
  190. <view class="ach-icon-wrap" style="background:rgba(16,185,129,0.12)">
  191. <text class="ach-icon">🌳</text>
  192. </view>
  193. <text class="ach-num">{{ teamMembers }}</text>
  194. <text class="ach-label">我的团队</text>
  195. </view>
  196. <view class="ach-item" @click="goToWealthCenter">
  197. <view class="ach-icon-wrap" style="background:rgba(245,158,11,0.12)">
  198. <text class="ach-icon">💰</text>
  199. </view>
  200. <text class="ach-num">{{ referralEarnings }}</text>
  201. <text class="ach-label">推广收益</text>
  202. </view>
  203. <view class="ach-item" @click="showShareQr">
  204. <view class="ach-icon-wrap" style="background:rgba(99,102,241,0.12)">
  205. <text class="ach-icon">🤝</text>
  206. </view>
  207. <text class="ach-num">+</text>
  208. <text class="ach-label">邀请成员</text>
  209. </view>
  210. </view>
  211. </view>
  212. <!-- 我的订单(电商风格) -->
  213. <view class="order-section">
  214. <view class="order-section-header">
  215. <text class="section-title">🛒 我的订单</text>
  216. <text class="order-all-link" @click="goToOrders">全部订单 ›</text>
  217. </view>
  218. <view class="order-card">
  219. <view class="order-grid">
  220. <view class="order-grid-item" @click="goToOrderStatus('pending')">
  221. <view class="order-icon-wrap">
  222. <text class="order-icon">💳</text>
  223. <text class="order-badge" v-if="orderPending > 0">{{ orderPending }}</text>
  224. </view>
  225. <text class="order-grid-text">待付款</text>
  226. </view>
  227. <view class="order-grid-item" @click="goToOrderStatus('paid')">
  228. <view class="order-icon-wrap">
  229. <text class="order-icon">📦</text>
  230. <text class="order-badge" v-if="orderUnpaid > 0">{{ orderUnpaid }}</text>
  231. </view>
  232. <text class="order-grid-text">待发货</text>
  233. </view>
  234. <view class="order-grid-item" @click="goToOrderStatus('shipped')">
  235. <view class="order-icon-wrap">
  236. <text class="order-icon">🚚</text>
  237. <text class="order-badge" v-if="orderShipped > 0">{{ orderShipped }}</text>
  238. </view>
  239. <text class="order-grid-text">待收货</text>
  240. </view>
  241. <view class="order-grid-item" @click="goToOrderStatus('refunding')">
  242. <view class="order-icon-wrap">
  243. <text class="order-icon">🔧</text>
  244. <text class="order-badge" v-if="orderAfterSale > 0">{{ orderAfterSale }}</text>
  245. </view>
  246. <text class="order-grid-text">售后</text>
  247. </view>
  248. <view class="order-grid-item" @click="goToOrders">
  249. <view class="order-icon-wrap">
  250. <text class="order-icon">📋</text>
  251. </view>
  252. <text class="order-grid-text">全部</text>
  253. </view>
  254. </view>
  255. <view class="order-extra-row">
  256. <view class="order-extra-item" @click="goToCart">
  257. <text class="order-extra-icon">🛒</text>
  258. <text class="order-extra-text">购物车</text>
  259. <text class="order-extra-badge" v-if="cartCount > 0">{{ cartCount > 99 ? '99+' : cartCount }}</text>
  260. </view>
  261. <view class="order-extra-divider"></view>
  262. <view class="order-extra-item" @click="goToAddress">
  263. <text class="order-extra-icon">📍</text>
  264. <text class="order-extra-text">收货地址</text>
  265. </view>
  266. </view>
  267. </view>
  268. </view>
  269. <!-- 卡券中心(我的优惠券 + 获得奖励) -->
  270. <view class="achievement-section">
  271. <view class="section-header-row">
  272. <text class="section-title">🎫 卡券中心</text>
  273. <text class="section-sub">优惠券与权益</text>
  274. </view>
  275. <view class="achievement-grid">
  276. <view class="ach-item" @click="goToCoupons">
  277. <view class="ach-icon-wrap" style="background:rgba(245,158,11,0.12)">
  278. <text class="ach-icon">🎟️</text>
  279. </view>
  280. <text class="ach-num">{{ couponCount }}</text>
  281. <text class="ach-label">我的优惠券</text>
  282. </view>
  283. <view class="ach-item" @click="goToWishes">
  284. <view class="ach-icon-wrap" style="background:rgba(245,158,11,0.12)">
  285. <text class="ach-icon">🎁</text>
  286. </view>
  287. <text class="ach-num">{{ rewardsEarned }}</text>
  288. <text class="ach-label">获得奖励</text>
  289. </view>
  290. </view>
  291. </view>
  292. <!-- 健康档案(上传报告) -->
  293. <view class="menu-row" @click="goToHealthReports">
  294. <text class="menu-row-icon">📋</text>
  295. <text class="menu-row-text">我的健康报告</text>
  296. <text class="menu-row-sub">{{ healthReports }} 份</text>
  297. <text class="menu-row-arrow">›</text>
  298. </view>
  299. <!-- 规划师服务中心入口(仅规划师可见) -->
  300. <view class="service-center-section" v-if="isTeacherUser && teacherStatus === 'approved'">
  301. <view class="service-center-card" @click="goToServiceCenter">
  302. <view class="service-center-icon">👨‍🏫</view>
  303. <view class="service-center-info">
  304. <text class="service-center-title">服务中心</text>
  305. <text class="service-center-desc">待处理任务:{{ pendingTasks }} 条 · 消息:{{ unreadMessages }} 条</text>
  306. </view>
  307. <text class="service-center-arrow">›</text>
  308. </view>
  309. </view>
  310. <!-- 规划师待审核提示 -->
  311. <view class="service-center-section" v-if="isTeacherUser && teacherStatus !== 'approved'">
  312. <view class="service-center-card disabled-card">
  313. <view class="service-center-icon">👨‍🏫</view>
  314. <view class="service-center-info">
  315. <text class="service-center-title">服务中心</text>
  316. <text class="service-center-desc">{{ teacherStatus === 'pending' ? '申请审核中,暂未开放' : teacherStatus === 'rejected' ? '申请未通过,请联系管理员' : '规划师服务' }}</text>
  317. </view>
  318. </view>
  319. </view>
  320. <!-- 设置 + 退出 -->
  321. <view class="bottom-menu-section">
  322. <view class="menu-row" @click="goToMessageHistory">
  323. <text class="menu-row-icon">📨</text>
  324. <text class="menu-row-text">历史消息</text>
  325. <text class="menu-row-arrow">›</text>
  326. </view>
  327. <view class="menu-row" @click="goToSettings">
  328. <text class="menu-row-icon">⚙️</text>
  329. <text class="menu-row-text">设置</text>
  330. <text class="menu-row-arrow">›</text>
  331. </view>
  332. <view class="logout-btn" @click="logout">
  333. <text class="logout-text">退出登录</text>
  334. </view>
  335. </view>
  336. </template>
  337. <!-- 我的分享海报:复用文章/活动/商品同一套 ContentSharePoster 组件(canvas 绘制 + 保存到相册) -->
  338. <ContentSharePoster
  339. :show="showSharePoster"
  340. :title="shareHeadline"
  341. :energyData="posterEnergyData"
  342. :brandFallback="true"
  343. :qrCodeBase64="posterQrCode || ''"
  344. typeLabel="邀友加入"
  345. :summary="posterSummary"
  346. ctaText="长按识别二维码 · 加入浠艾福"
  347. :inviteText="posterInviteText"
  348. @close="closeSharePoster"
  349. />
  350. <FloatingAvatar />
  351. </view>
  352. </template>
  353. <script>
  354. import FloatingAvatar from '../../components/AIFloatingAvatar.vue'
  355. import ContentSharePoster from '../../components/ContentSharePoster.vue'
  356. import {
  357. getChildren, getFamilyMemberList,
  358. getTodayTasksByCategory, getChallengeList, getMyMembership,
  359. verifyPassword, getPointsBalance, getUserInfo,
  360. cartCount, getOrderCounts, getCfSummary,
  361. getProfileStats, getMyReferrer, getVendorTeamList, getVendorHierarchyInfo, getMyCoupons,
  362. getTeacherInfo, getTeacherPendingTasks, getTeacherUnreadCount, getUserRoles,
  363. getReferralCode, extractReferralCode, getShareQrCode, getEnergySandbox,
  364. vendorStatus
  365. } from '../../utils/api.js'
  366. import { BrandColors } from '../../utils/brand-colors.js'
  367. import { isApprovedActivityProvider } from '../../utils/activity-role.js'
  368. import fontScaleMixin from '@/mixins/font-scale.js'
  369. import shareMixin from '../../components/share-mixin.js'
  370. export default {
  371. mixins: [fontScaleMixin, shareMixin],
  372. components: { FloatingAvatar, ContentSharePoster },
  373. data() {
  374. return {
  375. nickname: '',
  376. role: 'parent',
  377. isSwitchedChild: false,
  378. userRoles: [],
  379. isTeacherUser: false,
  380. userInfo: {},
  381. memberLevel: null,
  382. membershipDays: 0,
  383. totalPoints: 0,
  384. referralEarnings: 0,
  385. teamMembers: 0,
  386. // 个人成就
  387. completedTasks: 0,
  388. streakDays: 0,
  389. rewardsEarned: 0,
  390. badgesCollected: 0,
  391. growthRecords: 0,
  392. challengesJoined: 0,
  393. healthReports: 0,
  394. // 家庭
  395. familyMembers: [],
  396. // 商城
  397. orderPending: 0,
  398. orderUnpaid: 0,
  399. orderShipped: 0,
  400. orderAfterSale: 0,
  401. cartCount: 0,
  402. couponCount: 0,
  403. // 待办
  404. pendingTasks: 0,
  405. unreadMessages: 0,
  406. teacherStatus: 'pending',
  407. isVendor: false,
  408. profileProgress: 0,
  409. myReferrer: null,
  410. // 分享推广码
  411. showSharePoster: false,
  412. referralCode: '',
  413. posterQrCode: '',
  414. posterEnergyData: null,
  415. referralCodeLoaded: false,
  416. // 登录态:响应式字段(非 computed)。computed 依赖非响应式的 Storage 读取,
  417. // 登录成功写入 token 后不会触发重算,导致页面仍显示登录前状态。
  418. // 改为 data 字段并在 onShow / 登录成功回调中重新赋值,登录后页面即时刷新。
  419. isLoggedIn: !!uni.getStorageSync('token'),
  420. }
  421. },
  422. computed: {
  423. roleLabel() {
  424. var map = { parent: '', child: '成员', teacher: '规划师' }
  425. return map[this.role] || '用户'
  426. },
  427. memberLevelText() {
  428. var map = { FREE: '免费用户', BASIC: '体验会员', FAMILY: '家庭会员', PREMIUM: '高级会员', LIFETIME: '终身会员' }
  429. return map[this.memberLevel] || this.memberLevel || ''
  430. },
  431. isLifetime() {
  432. return this.memberLevel === 'LIFETIME'
  433. },
  434. hasUpgradeSpace() {
  435. return this.memberLevel === 'FREE' || this.memberLevel === 'FAMILY'
  436. },
  437. upgradeBtnText() {
  438. return this.hasUpgradeSpace ? '升级' : '立即开通'
  439. },
  440. // 分享海报标题:XXX邀请你关注家庭健康(昵称过长自动截断)
  441. shareHeadline() {
  442. var name = (this.nickname || '').trim()
  443. if (!name) return '邀请你关注家庭健康'
  444. if (name.length > 8) name = name.substring(0, 8) + '…'
  445. return name + '邀请你关注家庭健康'
  446. },
  447. posterSummary() {
  448. return '身体 · 心理 · 智慧 · 行动 · 财富,一家专注全家健康的成长平台'
  449. },
  450. posterInviteText() {
  451. var name = (this.nickname || '').trim()
  452. if (!name) return '扫码加入浠艾福,一起照顾好这个家'
  453. if (name.length > 8) name = name.substring(0, 8) + '…'
  454. return '「' + name + '」邀请你加入浠艾福'
  455. }
  456. },
  457. onShow() {
  458. // 重新读取登录态(登录浮层成功后 mixin 会触发 onShow),驱动页面切换到已登录视图
  459. this.isLoggedIn = !!uni.getStorageSync('token')
  460. if (!this.isLoggedIn) {
  461. return
  462. }
  463. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent'
  464. this.role = role
  465. this.isSwitchedChild = uni.getStorageSync('isSwitchedChild') || false
  466. this.nickname = (uni.getStorageSync('userInfo') || {}).nickname || ''
  467. // 服务商身份判断(成就区「我的团队」入口按此分发)
  468. this.checkVendorStatus()
  469. // 规划师身份探测(主角色 teacher 或 roles 含 teacher 均生效),并加载其待办/消息数据
  470. this.loadTeacherIdentity()
  471. // 主角色为 parent 时加载本人/家庭数据;教师主角色保持原逻辑(不加载家庭区块)
  472. if (role !== 'teacher') {
  473. this.loadAllData()
  474. this.loadMyReferrer()
  475. }
  476. },
  477. methods: {
  478. // 服务商身份:兼容两条申请/审核链路(vendor 入驻 / 服务角色申请)
  479. // 用 isApprovedActivityProvider 统一判定,避免只认 vendorStatus 漏掉服务角色申请链路
  480. checkVendorStatus() {
  481. var self = this
  482. vendorStatus().then(function(res) {
  483. self.isVendor = isApprovedActivityProvider((res && res.data) || {})
  484. }).catch(function() {
  485. self.isVendor = false
  486. })
  487. },
  488. loadTeacherStatus() {
  489. var self = this
  490. getTeacherInfo().then(function(res) {
  491. if (res && res.code === 200 && res.data) {
  492. self.teacherStatus = res.data.verificationStatus || res.data.status || 'pending'
  493. }
  494. }).catch(function() {})
  495. },
  496. loadTeacherIdentity() {
  497. var self = this
  498. var rolesP = (typeof getUserRoles === 'function' ? getUserRoles() : Promise.resolve({ data: [] }))
  499. .catch(function() { return { data: [] } })
  500. rolesP.then(function(res) {
  501. var rolesData = (res && res.data) || []
  502. self.userRoles = Array.isArray(rolesData) ? rolesData : []
  503. uni.setStorageSync('userRoles', self.userRoles)
  504. self.isTeacherUser = self.role === 'teacher' || self.userRoles.indexOf('teacher') > -1
  505. // 仅对规划师拉取认证状态与待办/消息,避免普通家长额外请求
  506. if (self.isTeacherUser) {
  507. var teacherP = (typeof getTeacherInfo === 'function' ? getTeacherInfo() : Promise.resolve({}))
  508. .catch(function() { return {} })
  509. teacherP.then(function(tres) {
  510. var t = (tres && tres.data) || {}
  511. self.teacherStatus = t.verificationStatus || t.status || 'pending'
  512. uni.setStorageSync('teacherStatus', self.teacherStatus)
  513. if (self.teacherStatus === 'approved') {
  514. self.loadTeacherData()
  515. }
  516. })
  517. }
  518. })
  519. },
  520. loadTeacherData() {
  521. var self = this
  522. // 并行加载待处理任务和未读消息
  523. getTeacherPendingTasks().then(function(res) {
  524. if (res && res.data && Array.isArray(res.data)) {
  525. self.pendingTasks = res.data.length
  526. } else if (res && res.data && res.data.pendingCount != null) {
  527. self.pendingTasks = res.data.pendingCount
  528. } else if (res && res.data && res.data.pendingReviewTasks != null) {
  529. self.pendingTasks = res.data.pendingReviewTasks
  530. }
  531. }).catch(function() {})
  532. getTeacherUnreadCount().then(function(res) {
  533. if (res && res.data != null) {
  534. self.unreadMessages = res.data
  535. }
  536. }).catch(function() {})
  537. },
  538. loadAllData() {
  539. this.loadUserInfo()
  540. this.loadMembership()
  541. this.loadPoints()
  542. this.loadFamily()
  543. this.loadTasks()
  544. this.loadChallenges()
  545. this.loadOrderCounts()
  546. this.loadCartCount()
  547. this.loadProfileStats()
  548. this.loadReferralEarnings()
  549. this.loadTeamInfo()
  550. this.loadCoupons()
  551. },
  552. loadUserInfo() {
  553. var self = this
  554. getUserInfo().then(function(res) {
  555. if (res && res.code === 200 && res.data) {
  556. self.userInfo = res.data
  557. if (!self.nickname) self.nickname = res.data.nickname || ''
  558. }
  559. }).catch(function() {})
  560. },
  561. loadMembership() {
  562. var self = this
  563. getMyMembership().then(function(res) {
  564. if (res && res.data) {
  565. self.memberLevel = res.data.memberLevel || res.data.levelCode || null
  566. self.membershipDays = res.data.membershipDays || res.data.daysRemaining || 0
  567. }
  568. }).catch(function() {})
  569. },
  570. loadPoints() {
  571. // 累计积分由 loadProfileStats 汇总家庭成员积分,此处不再单独覆盖
  572. },
  573. loadFamily() {
  574. var self = this
  575. getFamilyMemberList({ visibleOnly: true }).then(function(res) {
  576. var data = res && res.data ? res.data : []
  577. self.familyMembers = Array.isArray(data) ? data : []
  578. }).catch(function() {
  579. self.familyMembers = []
  580. })
  581. },
  582. loadTasks() {
  583. var self = this
  584. var memberId = uni.getStorageSync('currentChildId') || uni.getStorageSync('userId')
  585. if (!memberId) return
  586. getTodayTasksByCategory(memberId, 'action').then(function(res) {
  587. if (res && res.data) {
  588. self.pendingTasks = Array.isArray(res.data) ? res.data.length : 0
  589. }
  590. }).catch(function() {})
  591. // fallback to storage
  592. if (!self.pendingTasks) {
  593. self.pendingTasks = parseInt(uni.getStorageSync('pendingTaskCount') || 0)
  594. }
  595. },
  596. loadChallenges() {
  597. var self = this
  598. getChallengeList({}).then(function(res) {
  599. if (res && res.data) {
  600. // 不在此处使用,仅确保请求
  601. }
  602. }).catch(function() {})
  603. },
  604. loadOrderCounts() {
  605. var self = this
  606. getOrderCounts().then(function(res) {
  607. if (res && res.data) {
  608. self.orderPending = res.data.pending || 0
  609. self.orderUnpaid = res.data.paid || 0
  610. self.orderShipped = res.data.shipped || 0
  611. self.orderAfterSale = res.data.refunding || 0
  612. }
  613. }).catch(function() {})
  614. },
  615. loadCartCount() {
  616. var self = this
  617. cartCount().then(function(res) {
  618. if (res && res.data != null) {
  619. self.cartCount = res.data || 0
  620. }
  621. }).catch(function() {})
  622. },
  623. loadProfileStats() {
  624. var self = this
  625. getProfileStats().then(function(res) {
  626. if (res && res.code === 200 && res.data) {
  627. var d = res.data
  628. if (d.totalPoints != null) self.totalPoints = d.totalPoints
  629. if (d.streakDays != null) self.streakDays = d.streakDays
  630. if (d.completedTasks != null) self.completedTasks = d.completedTasks
  631. if (d.rewardsEarned != null) self.rewardsEarned = d.rewardsEarned
  632. if (d.badgesCollected != null) self.badgesCollected = d.badgesCollected
  633. if (d.growthRecords != null) self.growthRecords = d.growthRecords
  634. if (d.challengesJoined != null) self.challengesJoined = d.challengesJoined
  635. if (d.healthReports != null) self.healthReports = d.healthReports
  636. }
  637. }).catch(function() {})
  638. },
  639. loadReferralEarnings() {
  640. var self = this
  641. // CF 总览口径:与推广中心 promotion/index.vue 收益总览("累计获取CF")保持一致。
  642. // promotion 用 cfVal(summary.totalEarned) 直接展示原始值(cfVal 不做分→元换算),
  643. // 因此这里也不除 100,保证"我的团队"推广收益 = 推广中心"累计获取CF"数字一致。
  644. getCfSummary().then(function(res) {
  645. if (res && res.code === 200 && res.data) {
  646. self.referralEarnings = res.data.totalEarned || 0
  647. }
  648. }).catch(function() {})
  649. },
  650. loadTeamInfo() {
  651. var self = this
  652. getVendorTeamList().then(function(res) {
  653. var teams = (res && res.data) || []
  654. if (!teams.length) {
  655. self.teamMembers = 0
  656. return
  657. }
  658. var reqs = teams.map(function(t) {
  659. return getVendorHierarchyInfo(t.id).then(function(h) {
  660. return (h && h.data && h.data.totalChildren) || 0
  661. }).catch(function() {
  662. return 0
  663. })
  664. })
  665. Promise.all(reqs).then(function(counts) {
  666. self.teamMembers = counts.reduce(function(a, b) { return a + b }, 0)
  667. }).catch(function() {
  668. self.teamMembers = 0
  669. })
  670. }).catch(function() {
  671. self.teamMembers = 0
  672. })
  673. },
  674. loadCoupons() {
  675. var self = this
  676. getMyCoupons().then(function(res) {
  677. if (res && res.code === 200 && res.data) {
  678. var list = Array.isArray(res.data) ? res.data : (res.data.list || [])
  679. self.couponCount = list.length
  680. }
  681. }).catch(function() {})
  682. },
  683. async loadMyReferrer() {
  684. try {
  685. var memberId = uni.getStorageSync('currentMemberId') || uni.getStorageSync('currentChildId') || 0
  686. var res = await getMyReferrer(memberId)
  687. if (res && res.code === 200 && res.data && res.data.hasReferrer) {
  688. this.myReferrer = res.data
  689. }
  690. } catch (e) {
  691. console.error('获取推荐人失败', e)
  692. }
  693. },
  694. // ===== 分享海报(复用 ContentSharePoster,与文章/活动/商品同一套生成逻辑)=====
  695. async showShareQr() {
  696. uni.showLoading({ title: '生成海报中...' })
  697. try {
  698. if (!this.referralCodeLoaded) {
  699. await this.loadReferralCode()
  700. }
  701. var scene = 'ref=' + (this.referralCode || '')
  702. if (scene.length > 32) {
  703. scene = scene.substring(0, 32)
  704. }
  705. // 首页路径,扫码后进入首页并绑定推荐人
  706. // 注意:微信 getwxacodeunlimit 的 page 不能带前导斜杠,否则报 errcode 41030 invalid page rid
  707. var res = await getShareQrCode('pages/index-home/index', scene)
  708. if (res && res.code === 200 && res.data && res.data.qrCodeBase64) {
  709. this.posterQrCode = res.data.qrCodeBase64
  710. // 必须在 showSharePoster=true 之前取到数据:组件 watch 到 show 后 300ms 即开始绘制
  711. await this.loadPosterEnergy()
  712. this.showSharePoster = true
  713. } else {
  714. uni.showToast({ title: '生成失败,请重试', icon: 'none' })
  715. }
  716. } catch (e) {
  717. console.error('生成分享海报失败', e)
  718. uni.showToast({ title: '生成失败,请重试', icon: 'none' })
  719. } finally {
  720. uni.hideLoading()
  721. }
  722. },
  723. closeSharePoster() {
  724. this.showSharePoster = false
  725. },
  726. // 五维能量数据卡数据(方案C):家庭聚合视角;未解锁全景/取数失败时置空,海报降级为品牌卡
  727. loadPosterEnergy() {
  728. var self = this
  729. return getEnergySandbox('family').then(function(res) {
  730. self.posterEnergyData = self.mapPosterEnergy(res)
  731. }).catch(function(e) {
  732. console.error('获取五维能量失败,海报降级为品牌卡', e)
  733. self.posterEnergyData = null
  734. })
  735. },
  736. mapPosterEnergy(res) {
  737. if (!res || res.code !== 200 || !res.data) return null
  738. // locked=true 表示用户未解锁全景,此时不展示任何数据,改为品牌卡
  739. if (res.data.locked) return null
  740. // 只认家庭聚合视角;仅当接口返回的是裸 DTO(无 personalData/familyData 包装)时才直接取 res.data
  741. var d = res.data.familyData || null
  742. if (!d) {
  743. if (res.data.personalData) return null
  744. d = res.data
  745. }
  746. if (!d || typeof d !== 'object') return null
  747. var defs = [
  748. { key: 'body', label: '身', color: BrandColors.body },
  749. { key: 'mind', label: '心', color: BrandColors.mind },
  750. { key: 'wisdom', label: '智', color: BrandColors.wisdom },
  751. { key: 'action', label: '行', color: BrandColors.action },
  752. { key: 'wealth', label: '富', color: BrandColors.wealth }
  753. ]
  754. var dims = []
  755. var sum = 0
  756. for (var i = 0; i < defs.length; i++) {
  757. var raw = d[defs[i].key + 'Score']
  758. if (raw === null || raw === undefined || raw === '' || isNaN(raw)) continue
  759. var n = Number(raw)
  760. if (n < 0) n = 0
  761. if (n > 100) n = 100
  762. sum += n
  763. dims.push({ key: defs[i].key, label: defs[i].label, score: n, color: defs[i].color })
  764. }
  765. if (dims.length === 0) return null
  766. var overall = d.overallScore
  767. if (overall === null || overall === undefined || overall === '' || isNaN(overall)) {
  768. overall = Math.round(sum / dims.length)
  769. }
  770. return { label: '我们家的能量', overall: Number(overall), dims: dims }
  771. },
  772. async loadReferralCode() {
  773. if (this.referralCodeLoaded) return
  774. var self = this
  775. try {
  776. var res = await getReferralCode()
  777. self.referralCode = extractReferralCode(res) || ''
  778. } catch (e) {
  779. console.error('获取推广码失败', e)
  780. } finally {
  781. self.referralCodeLoaded = true
  782. }
  783. },
  784. goToServiceCenter() {
  785. uni.navigateTo({ url: '/pages/service-center/index' })
  786. },
  787. goTeamTree() {
  788. // 服务商 → 服务商团队;非服务商 → 引导申请
  789. if (this.isVendor) {
  790. uni.navigateTo({ url: '/pages/vendor/team-system/team-system' })
  791. return
  792. }
  793. uni.showModal({
  794. title: '提示',
  795. content: '您尚未申请任何服务角色,是否立即申请?',
  796. confirmText: '去申请',
  797. cancelText: '取消',
  798. success: function(res) {
  799. if (res.confirm) {
  800. uni.navigateTo({ url: '/pages/profile/service-role-apply' })
  801. }
  802. }
  803. })
  804. },
  805. goLogin: function() {
  806. this.openLoginSheet()
  807. },
  808. // 登录浮层成功回调:立即切换到已登录视图并刷新个人资料与登录后数据
  809. onLoginSuccess: function() {
  810. this.isLoggedIn = true
  811. if (this.loadUserInfo) this.loadUserInfo()
  812. },
  813. goSkip: function() {
  814. uni.switchTab({ url: '/pages/index-home/index' })
  815. },
  816. goToEditInfo: function() {
  817. uni.navigateTo({ url: '/pages/user-edit/user-edit' })
  818. },
  819. goToPoints: function() {
  820. uni.navigateTo({ url: '/pages/points/points' })
  821. },
  822. goToStreak: function() {
  823. var memberId = uni.getStorageSync('currentMemberId') || uni.getStorageSync('currentChildId')
  824. var url = '/pages/stats/completion-rate'
  825. if (memberId) {
  826. url += '?memberId=' + memberId
  827. } else {
  828. url += '?familyView=1'
  829. }
  830. uni.navigateTo({ url: url })
  831. },
  832. goToTasks: function() {
  833. uni.navigateTo({ url: '/pages/tasks/tasks' })
  834. },
  835. goToTaskHistory: function() {
  836. uni.navigateTo({ url: '/pages/tasks/history' })
  837. },
  838. goToWishes: function() {
  839. uni.navigateTo({ url: '/pages/wishes/index' })
  840. },
  841. goToBadges: function() {
  842. uni.navigateTo({ url: '/pages/rewards/badge' })
  843. },
  844. goToGrowth: function() {
  845. uni.navigateTo({ url: '/pages/growth/history' })
  846. },
  847. goToChallenges: function() {
  848. uni.navigateTo({ url: '/pages/health/challenge-manage' })
  849. },
  850. goToHealthReports: function() {
  851. uni.navigateTo({ url: '/pages/health/report-list' })
  852. },
  853. goToWealthCenter: function() {
  854. uni.navigateTo({ url: '/pages/promotion/index' })
  855. },
  856. goToCoupons: function() {
  857. uni.navigateTo({ url: '/pages/profile-extra/coupons' })
  858. },
  859. goUpgrade: function() {
  860. uni.navigateTo({ url: '/pages/membership/upgrade' })
  861. },
  862. goToFamily: function() {
  863. uni.navigateTo({ url: '/pages/profile-extra/family-members' })
  864. },
  865. goMemberDetail: function(member) {
  866. uni.navigateTo({ url: '/pages/home-pages/member-home-detail?memberId=' + member.id })
  867. },
  868. goToAppointments: function() {
  869. uni.navigateTo({ url: '/pages/parent/appointments' })
  870. },
  871. goToOrders: function() {
  872. uni.navigateTo({ url: '/pages/shop/order-list/order-list' })
  873. },
  874. goToOrderStatus: function(status) {
  875. uni.navigateTo({ url: '/pages/shop/order-list/order-list?status=' + status })
  876. },
  877. goToCart: function() {
  878. uni.navigateTo({ url: '/pages/shop/cart/cart' })
  879. },
  880. goToAddress: function() {
  881. uni.navigateTo({ url: '/pages/shop/address/address' })
  882. },
  883. goToMessageHistory: function() {
  884. uni.navigateTo({ url: '/pages/profile/message-history' })
  885. },
  886. goToSettings: function() {
  887. uni.showActionSheet({
  888. itemList: ['完善信息', '家庭成员', '隐私政策', '用户协议', '我的画像', '提醒设置'],
  889. success: function(res) {
  890. var urls = {
  891. 0: '/pages/user-edit/user-edit',
  892. 1: '/pages/profile-extra/family-members',
  893. 2: '/pages/policy/privacy',
  894. 3: '/pages/policy/agreement',
  895. 4: '/pages/profile/portrait-edit',
  896. 5: '/pages/reminder-config/index'
  897. }
  898. if (urls[res.tapIndex]) {
  899. uni.navigateTo({ url: urls[res.tapIndex] })
  900. }
  901. }
  902. })
  903. },
  904. memberRoleLabel: function(role) {
  905. var map = { parent: '本人', child: '成员', teacher: '规划师' }
  906. return map[role] || '成员'
  907. },
  908. onExitSwitch: function() {
  909. var self = this
  910. uni.showModal({
  911. title: '退出切换',
  912. content: '请输入家庭主账号密码以确认退出',
  913. editable: true,
  914. success: function(res) {
  915. if (res.confirm && res.content) {
  916. verifyPassword(res.content).then(function(result) {
  917. if (result.code === 200) {
  918. self.$store.commit('switchBackToParent')
  919. self.isSwitchedChild = false
  920. self.role = 'parent'
  921. uni.showToast({ title: '已退出切换', icon: 'success' })
  922. uni.reLaunch({ url: '/pages/index-home/index' })
  923. } else {
  924. uni.showToast({ title: '密码错误', icon: 'none' })
  925. }
  926. }).catch(function() {
  927. uni.showToast({ title: '验证失败', icon: 'none' })
  928. })
  929. }
  930. }
  931. })
  932. },
  933. logout: function() {
  934. uni.showModal({
  935. title: '确认退出',
  936. content: '确定要退出登录吗?',
  937. success: function(res) {
  938. if (res.confirm) {
  939. this.$store.commit('logout')
  940. uni.reLaunch({ url: '/pages/index-home/index' })
  941. }
  942. }.bind(this)
  943. })
  944. }
  945. }
  946. }
  947. </script>
  948. <style scoped lang="scss">
  949. // ===== 页面级局部调色板(单页专有色阶;同值才映射全局令牌,约定见 uni.scss §14) =====
  950. $c-text-gray-400: $facade-text-gray-400;
  951. $c-fill-2b: #F2F2F2;
  952. .container {
  953. min-height: 100vh;
  954. background: $facade-fill-warm-gray;
  955. padding-bottom: calc(160rpx + env(safe-area-inset-bottom));
  956. }
  957. /* ===== 访客态(新暖调配色 · 令牌化) ===== */
  958. $gp-white: str-slice('#{$app-surface}', 2);
  959. $gp-brand-hex: '#{$brand-primary}';
  960. $gp-brand: str-slice($gp-brand-hex, 2);
  961. $gp-ghost-hex: '#{$facade-text-ghost}';
  962. $gp-ghost: str-slice($gp-ghost-hex, 2);
  963. .gp-page { background: $app-bg; min-height: 100vh; padding: 28rpx 0 40rpx; }
  964. /* 登录大卡 */
  965. .gp-login { margin: 0 32rpx 24rpx; background: $app-surface; border-radius: 24rpx; padding: 48rpx 32rpx 40rpx; border: 1rpx solid $app-border-subtle; display: flex; flex-direction: column; align-items: center; box-shadow: 0 8rpx 24rpx rgba($brand-primary, 0.06); }
  966. .gp-logo { width: 112rpx; height: 112rpx; border-radius: 28rpx; background: linear-gradient(135deg, $brand-primary, $brand-primary-dark); display: flex; flex-direction: row; align-items: center; justify-content: center; box-shadow: 0 8rpx 20rpx rgba($brand-primary, 0.22); }
  967. .gp-logo-heart {
  968. width: 56rpx; height: 56rpx;
  969. background-repeat: no-repeat;
  970. background-position: center;
  971. background-size: 56rpx 56rpx;
  972. background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23#{$gp-white}' d='M12 20.6 4.6 13.2a4.8 4.8 0 0 1 6.8-6.8l.6.6.6-.6a4.8 4.8 0 0 1 6.8 6.8z'/%3E%3C/svg%3E");
  973. }
  974. .gp-login-title { font-size: calc(38rpx * var(--font-scale, 1)); font-weight: 700; color: $facade-text-strong; margin-top: 24rpx; }
  975. .gp-login-desc { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-body; line-height: 1.65; margin-top: 12rpx; text-align: center; }
  976. .gp-login-btn { margin-top: 32rpx; width: 100%; display: flex; flex-direction: row; align-items: center; justify-content: center; padding: 26rpx 0; border-radius: 999rpx; background: linear-gradient(135deg, $brand-primary, $brand-primary-dark); box-shadow: 0 10rpx 24rpx rgba($brand-primary, 0.22); }
  977. .gp-login-btn:active { opacity: 0.9; }
  978. .gp-login-btn-ic {
  979. width: 36rpx; height: 36rpx; flex-shrink: 0;
  980. background-repeat: no-repeat;
  981. background-position: center;
  982. background-size: 36rpx 36rpx;
  983. background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23#{$gp-white}' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='3.6'/%3E%3Cpath d='M4.8 20.4a7.2 7.2 0 0 1 14.4 0'/%3E%3C/svg%3E");
  984. }
  985. .gp-login-btn-text { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 600; color: $app-surface; margin-left: 12rpx; }
  986. .gp-skip { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-muted; margin-top: 24rpx; }
  987. /* 登录后开启 */
  988. .gp-block { margin: 0 32rpx 24rpx; background: $app-surface; border-radius: 24rpx; padding: 24rpx; border: 1rpx solid $app-border-subtle; }
  989. .gp-tag { font-size: calc(24rpx * var(--font-scale, 1)); font-weight: 700; color: $brand-primary; letter-spacing: 1rpx; }
  990. .gp-rows { margin-top: 8rpx; display: flex; flex-direction: column; }
  991. .gp-row { display: flex; flex-direction: row; align-items: center; padding: 20rpx 0; border-top: 1rpx solid $app-border-subtle; }
  992. .gp-row:first-child { border-top: none; }
  993. .gp-ic { width: 76rpx; height: 76rpx; border-radius: 20rpx; display: flex; flex-direction: row; align-items: center; justify-content: center; flex-shrink: 0; }
  994. .gp-ic-wisdom { background: $dim-wisdom-tint; }
  995. .gp-ic-action { background: $dim-action-tint; }
  996. .gp-ic-wealth { background: $dim-wealth-tint; }
  997. .gp-glyph { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 700; }
  998. .gp-ic-wisdom .gp-glyph { color: $dim-wisdom-deep; }
  999. .gp-ic-action .gp-glyph { color: $dim-action-deep; }
  1000. .gp-ic-wealth .gp-glyph { color: $dim-wealth-deep; }
  1001. .gp-row-info { flex: 1; min-width: 0; margin-left: 20rpx; display: flex; flex-direction: column; }
  1002. .gp-row-name { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; }
  1003. .gp-row-sub { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-body; margin-top: 6rpx; }
  1004. .gp-lock {
  1005. width: 32rpx; height: 32rpx; flex-shrink: 0; margin-left: 12rpx;
  1006. background-repeat: no-repeat;
  1007. background-position: center;
  1008. background-size: 32rpx 32rpx;
  1009. background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23#{$gp-ghost}' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='10' width='16' height='10.5' rx='2.5'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
  1010. }
  1011. /* 理念卡 */
  1012. .gp-philosophy { margin: 0 32rpx 8rpx; background: $facade-brand-tint; border-radius: 24rpx; padding: 28rpx 24rpx; border-left: 6rpx solid $brand-primary; }
  1013. .gp-philosophy-title { display: block; font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 700; color: $facade-text-strong; }
  1014. .gp-philosophy-desc { display: block; font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-body; line-height: 1.65; margin-top: 10rpx; }
  1015. /* 退出切换 */
  1016. .exit-switch {
  1017. margin: 0 $uni-space-lg 16rpx;
  1018. background: linear-gradient(135deg, $brand-primary, $brand-primary-light);
  1019. color: $app-surface;
  1020. padding: 16rpx;
  1021. border-radius: 16rpx;
  1022. text-align: center;
  1023. font-size: calc(26rpx * var(--font-scale, 1));
  1024. }
  1025. /* 身份卡 */
  1026. .user-card {
  1027. margin: 24rpx $uni-space-lg 20rpx;
  1028. background: linear-gradient(135deg, $brand-primary 0%, $brand-primary-light 100%);
  1029. border-radius: 24rpx;
  1030. padding: 32rpx 32rpx;
  1031. display: flex;
  1032. justify-content: space-between;
  1033. align-items: center;
  1034. box-shadow: 0 8rpx 32rpx rgba($accent-indigo, 0.3);
  1035. }
  1036. .user-card-left {
  1037. display: flex;
  1038. align-items: center;
  1039. flex: 1;
  1040. }
  1041. .avatar-wrap {
  1042. width: 100rpx;
  1043. height: 100rpx;
  1044. border-radius: 50%;
  1045. background: rgba($app-surface, 0.2);
  1046. display: flex;
  1047. align-items: center;
  1048. justify-content: center;
  1049. margin-right: 20rpx;
  1050. overflow: hidden;
  1051. border: 3rpx solid rgba($app-surface, 0.3);
  1052. }
  1053. .avatar-img {
  1054. width: 100rpx;
  1055. height: 100rpx;
  1056. border-radius: 50%;
  1057. }
  1058. .avatar-text {
  1059. font-size: calc(44rpx * var(--font-scale, 1));
  1060. color: $app-surface;
  1061. }
  1062. .user-meta { flex: 1; }
  1063. .user-name-row {
  1064. display: flex;
  1065. align-items: center;
  1066. gap: 12rpx;
  1067. margin-bottom: 8rpx;
  1068. }
  1069. .nickname {
  1070. font-size: calc(34rpx * var(--font-scale, 1));
  1071. font-weight: bold;
  1072. color: $app-surface;
  1073. }
  1074. .role-tag {
  1075. font-size: calc(20rpx * var(--font-scale, 1));
  1076. background: rgba($app-surface, 0.2);
  1077. color: $app-surface;
  1078. padding: 4rpx 14rpx;
  1079. border-radius: 24rpx;
  1080. }
  1081. .referrer-line {
  1082. font-size: calc(24rpx * var(--font-scale, 1));
  1083. color: rgba($app-surface, 0.7);
  1084. margin-bottom: 6rpx;
  1085. }
  1086. .user-sub {
  1087. display: flex;
  1088. align-items: center;
  1089. gap: 12rpx;
  1090. }
  1091. .level-badge {
  1092. font-size: calc(22rpx * var(--font-scale, 1));
  1093. padding: 6rpx 20rpx;
  1094. border-radius: 24rpx;
  1095. font-weight: bold;
  1096. border: 2rpx solid rgba($app-surface, 0.35);
  1097. display: flex;
  1098. align-items: center;
  1099. gap: 6rpx;
  1100. box-sizing: border-box;
  1101. height: 40rpx;
  1102. }
  1103. .level-badge::before {
  1104. content: '👑';
  1105. font-size: calc(18rpx * var(--font-scale, 1));
  1106. }
  1107. .level-FREE { background: linear-gradient(135deg, $c-text-gray-400, $facade-text-slate); color: $app-surface; }
  1108. .level-FREE::before { content: ''; }
  1109. .level-FAMILY { background: linear-gradient(135deg, $dim-wealth, $status-warning-deep); color: $app-surface; }
  1110. .level-PREMIUM { background: linear-gradient(135deg, $dim-wisdom, $dim-wisdom-deep); color: $app-surface; }
  1111. .level-LIFETIME {
  1112. background: linear-gradient(135deg, $accent-pink, $accent-pink-deep);
  1113. color: $app-surface;
  1114. box-shadow: 0 4rpx 16rpx rgba($accent-pink, 0.45);
  1115. border-color: rgba($app-surface, 0.55);
  1116. }
  1117. .days-left {
  1118. font-size: calc(20rpx * var(--font-scale, 1));
  1119. color: rgba($app-surface, 0.85);
  1120. }
  1121. .upgrade-btn {
  1122. background: rgba($app-surface, 0.22);
  1123. border: 2rpx solid rgba($app-surface, 0.6);
  1124. border-radius: 24rpx;
  1125. padding: 6rpx 20rpx;
  1126. flex-shrink: 0;
  1127. box-sizing: border-box;
  1128. height: 40rpx;
  1129. display: flex;
  1130. align-items: center;
  1131. }
  1132. .upgrade-btn-text {
  1133. font-size: calc(20rpx * var(--font-scale, 1));
  1134. font-weight: bold;
  1135. color: $app-surface;
  1136. line-height: 1;
  1137. }
  1138. .user-card-right {
  1139. display: flex;
  1140. flex-direction: column;
  1141. align-items: center;
  1142. gap: 6rpx;
  1143. background: rgba($app-surface, 0.15);
  1144. padding: 12rpx 24rpx;
  1145. border-radius: 16rpx;
  1146. }
  1147. .points-num {
  1148. font-size: calc(36rpx * var(--font-scale, 1));
  1149. font-weight: bold;
  1150. color: $app-surface;
  1151. }
  1152. .points-label {
  1153. font-size: calc(20rpx * var(--font-scale, 1));
  1154. color: rgba($app-surface, 0.7);
  1155. }
  1156. /* 家庭成员速览 */
  1157. .family-strip {
  1158. margin: 0 $uni-space-lg 20rpx;
  1159. background: $app-surface;
  1160. border-radius: 24rpx;
  1161. padding: 20rpx 24rpx 16rpx;
  1162. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1163. }
  1164. .family-strip-header {
  1165. display: flex;
  1166. justify-content: space-between;
  1167. align-items: center;
  1168. margin-bottom: 14rpx;
  1169. }
  1170. .family-strip-title {
  1171. font-size: calc(26rpx * var(--font-scale, 1));
  1172. font-weight: bold;
  1173. color: $facade-text-strong;
  1174. }
  1175. .family-strip-count {
  1176. font-size: calc(22rpx * var(--font-scale, 1));
  1177. color: $facade-text-muted;
  1178. }
  1179. .family-avatars {
  1180. display: flex;
  1181. flex-direction: row;
  1182. align-items: center;
  1183. gap: 16rpx;
  1184. overflow-x: auto;
  1185. padding-bottom: 4rpx;
  1186. }
  1187. .family-avatar-item {
  1188. display: flex;
  1189. flex-direction: column;
  1190. align-items: center;
  1191. gap: 6rpx;
  1192. flex-shrink: 0;
  1193. }
  1194. .family-avatar-wrap {
  1195. width: 72rpx;
  1196. height: 72rpx;
  1197. border-radius: 50%;
  1198. background: $facade-fill;
  1199. display: flex;
  1200. align-items: center;
  1201. justify-content: center;
  1202. overflow: hidden;
  1203. position: relative;
  1204. }
  1205. .family-avatar-img {
  1206. width: 72rpx;
  1207. height: 72rpx;
  1208. border-radius: 50%;
  1209. }
  1210. .family-avatar-text {
  1211. font-size: calc(28rpx * var(--font-scale, 1));
  1212. color: $facade-text-body;
  1213. }
  1214. .family-avatar-wrap.family-avatar-add {
  1215. background: $facade-fill-warm-gray;
  1216. border: 2rpx dashed $facade-text-ghost;
  1217. }
  1218. .family-avatar-plus {
  1219. font-size: calc(36rpx * var(--font-scale, 1));
  1220. color: $facade-text-muted;
  1221. }
  1222. .family-avatar-tag {
  1223. position: absolute;
  1224. bottom: -4rpx;
  1225. right: -4rpx;
  1226. font-size: calc(14rpx * var(--font-scale, 1));
  1227. padding: 2rpx 6rpx;
  1228. border-radius: 8rpx;
  1229. color: $app-surface;
  1230. }
  1231. .family-avatar-tag.tag-parent { background: $dim-wisdom; }
  1232. .family-avatar-tag.tag-child { background: $brand-primary; }
  1233. .family-avatar-tag.tag-teacher { background: $dim-action; }
  1234. .family-avatar-tag.tag-member { background: $c-text-gray-400; }
  1235. .family-avatar-name {
  1236. font-size: calc(20rpx * var(--font-scale, 1));
  1237. color: $facade-text-body;
  1238. white-space: nowrap;
  1239. }
  1240. /* 个人成就 */
  1241. .achievement-section {
  1242. margin: 0 $uni-space-lg 20rpx;
  1243. background: $app-surface;
  1244. border-radius: 24rpx;
  1245. padding: 24rpx;
  1246. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1247. }
  1248. .section-header-row {
  1249. display: flex;
  1250. justify-content: space-between;
  1251. align-items: baseline;
  1252. margin-bottom: 16rpx;
  1253. }
  1254. .section-title {
  1255. font-size: calc(28rpx * var(--font-scale, 1));
  1256. font-weight: bold;
  1257. color: $facade-text-strong;
  1258. }
  1259. .section-sub {
  1260. font-size: calc(22rpx * var(--font-scale, 1));
  1261. color: $facade-text-muted;
  1262. }
  1263. .achievement-grid {
  1264. display: flex;
  1265. flex-wrap: wrap;
  1266. gap: 0;
  1267. }
  1268. .ach-item {
  1269. width: 25%;
  1270. display: flex;
  1271. flex-direction: column;
  1272. align-items: center;
  1273. gap: 6rpx;
  1274. padding: 10rpx 0;
  1275. }
  1276. .ach-icon-wrap {
  1277. width: 64rpx;
  1278. height: 64rpx;
  1279. border-radius: 50%;
  1280. display: flex;
  1281. align-items: center;
  1282. justify-content: center;
  1283. margin-bottom: 4rpx;
  1284. }
  1285. .ach-icon {
  1286. font-size: calc(32rpx * var(--font-scale, 1));
  1287. line-height: 1;
  1288. }
  1289. .ach-num {
  1290. font-size: calc(28rpx * var(--font-scale, 1));
  1291. font-weight: bold;
  1292. color: $facade-text-strong;
  1293. line-height: 1;
  1294. }
  1295. .ach-label {
  1296. font-size: calc(20rpx * var(--font-scale, 1));
  1297. color: $facade-text-muted;
  1298. line-height: 1;
  1299. }
  1300. /* 我的团队网格:3 列(我的团队 / 推广收益 / 邀请成员)等宽,保持既有视觉协调 */
  1301. .achievement-grid.team-grid .ach-item {
  1302. width: 33.33%;
  1303. }
  1304. /* 我的成就网格:5 列固定等分(连续打卡/完成任务/收集勋章/成长记录/参加挑战) */
  1305. .achievement-grid.cols-5 .ach-item {
  1306. width: 20%;
  1307. }
  1308. /* 我的订单(电商风格) */
  1309. .order-section {
  1310. margin: 0 $uni-space-lg 20rpx;
  1311. }
  1312. .order-section-header {
  1313. display: flex;
  1314. align-items: center;
  1315. justify-content: space-between;
  1316. margin-bottom: 14rpx;
  1317. }
  1318. .order-all-link {
  1319. font-size: calc(24rpx * var(--font-scale, 1));
  1320. color: $facade-text-muted;
  1321. }
  1322. .order-card {
  1323. background: $app-surface;
  1324. border-radius: 24rpx;
  1325. padding: 24rpx 12rpx;
  1326. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1327. }
  1328. .order-grid {
  1329. display: flex;
  1330. flex-wrap: wrap;
  1331. }
  1332. .order-grid-item {
  1333. width: 20%;
  1334. display: flex;
  1335. flex-direction: column;
  1336. align-items: center;
  1337. gap: 10rpx;
  1338. padding: 8rpx 0;
  1339. }
  1340. .order-icon-wrap {
  1341. position: relative;
  1342. width: 64rpx;
  1343. height: 64rpx;
  1344. display: flex;
  1345. align-items: center;
  1346. justify-content: center;
  1347. }
  1348. .order-icon {
  1349. font-size: calc(40rpx * var(--font-scale, 1));
  1350. line-height: 1;
  1351. }
  1352. .order-badge {
  1353. position: absolute;
  1354. top: -8rpx;
  1355. right: -14rpx;
  1356. min-width: 30rpx;
  1357. height: 30rpx;
  1358. line-height: 30rpx;
  1359. border-radius: 16rpx;
  1360. background: $status-danger-2;
  1361. color: $app-surface;
  1362. font-size: calc(18rpx * var(--font-scale, 1));
  1363. text-align: center;
  1364. padding: 0 6rpx;
  1365. }
  1366. .order-grid-text {
  1367. font-size: calc(22rpx * var(--font-scale, 1));
  1368. color: $facade-text-body;
  1369. line-height: 1;
  1370. }
  1371. .order-extra-row {
  1372. display: flex;
  1373. align-items: center;
  1374. margin-top: 20rpx;
  1375. padding-top: 20rpx;
  1376. border-top: 1rpx solid $c-fill-2b;
  1377. }
  1378. .order-extra-item {
  1379. flex: 1;
  1380. display: flex;
  1381. align-items: center;
  1382. justify-content: center;
  1383. gap: 8rpx;
  1384. }
  1385. .order-extra-icon {
  1386. font-size: calc(28rpx * var(--font-scale, 1));
  1387. }
  1388. .order-extra-text {
  1389. font-size: calc(24rpx * var(--font-scale, 1));
  1390. color: $facade-text-strong;
  1391. }
  1392. .order-extra-badge {
  1393. min-width: 30rpx;
  1394. height: 30rpx;
  1395. line-height: 30rpx;
  1396. border-radius: 16rpx;
  1397. background: $brand-primary;
  1398. color: $app-surface;
  1399. font-size: calc(18rpx * var(--font-scale, 1));
  1400. text-align: center;
  1401. padding: 0 6rpx;
  1402. }
  1403. .order-extra-divider {
  1404. width: 1rpx;
  1405. height: 30rpx;
  1406. background: $c-fill-2b;
  1407. }
  1408. /* 规划师服务中心入口 */
  1409. .service-center-section {
  1410. margin: 0 $uni-space-lg 20rpx;
  1411. }
  1412. .service-center-card {
  1413. background: linear-gradient(135deg, $brand-primary 0%, $brand-primary-light 100%);
  1414. border-radius: 24rpx;
  1415. padding: 24rpx;
  1416. display: flex;
  1417. align-items: center;
  1418. gap: 20rpx;
  1419. box-shadow: 0 4rpx 16rpx rgba($brand-primary, 0.25);
  1420. }
  1421. .service-center-card.disabled-card {
  1422. background: linear-gradient(135deg, $uni-border-color-light, $app-text-subtle);
  1423. box-shadow: none;
  1424. opacity: 0.8;
  1425. }
  1426. .service-center-icon {
  1427. font-size: calc(48rpx * var(--font-scale, 1));
  1428. }
  1429. .service-center-info {
  1430. flex: 1;
  1431. }
  1432. .service-center-title {
  1433. font-size: calc(30rpx * var(--font-scale, 1));
  1434. font-weight: bold;
  1435. color: $app-surface;
  1436. display: block;
  1437. }
  1438. .service-center-desc {
  1439. font-size: calc(22rpx * var(--font-scale, 1));
  1440. color: rgba($app-surface, 0.8);
  1441. margin-top: 6rpx;
  1442. display: block;
  1443. }
  1444. .service-center-card.disabled-card .service-center-title {
  1445. color: $app-surface;
  1446. }
  1447. .service-center-card.disabled-card .service-center-desc {
  1448. color: rgba($app-surface, 0.9);
  1449. }
  1450. .service-center-arrow {
  1451. font-size: calc(40rpx * var(--font-scale, 1));
  1452. color: $app-surface;
  1453. }
  1454. /* 设置 + 退出 */
  1455. .bottom-menu-section {
  1456. margin: 0 $uni-space-lg;
  1457. padding-bottom: 20rpx;
  1458. }
  1459. .menu-row {
  1460. width: 100%;
  1461. background: $app-surface;
  1462. border-radius: 16rpx;
  1463. padding: 24rpx;
  1464. display: flex;
  1465. align-items: center;
  1466. gap: 14rpx;
  1467. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  1468. margin-bottom: 20rpx;
  1469. }
  1470. .menu-row-icon {
  1471. font-size: calc(30rpx * var(--font-scale, 1));
  1472. }
  1473. .menu-row-text {
  1474. flex: 1;
  1475. font-size: calc(26rpx * var(--font-scale, 1));
  1476. color: $facade-text-strong;
  1477. }
  1478. .menu-row-sub {
  1479. font-size: calc(24rpx * var(--font-scale, 1));
  1480. color: $facade-text-muted;
  1481. margin-right: 8rpx;
  1482. }
  1483. .menu-row-arrow {
  1484. font-size: calc(28rpx * var(--font-scale, 1));
  1485. color: $facade-text-ghost;
  1486. }
  1487. .logout-btn {
  1488. width: 100%;
  1489. background: $app-surface;
  1490. border-radius: 16rpx;
  1491. padding: 24rpx;
  1492. text-align: center;
  1493. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  1494. }
  1495. .logout-text {
  1496. font-size: calc(26rpx * var(--font-scale, 1));
  1497. color: $status-danger-2;
  1498. font-weight: 500;
  1499. }
  1500. /* 分享推广码浮动按钮 */
  1501. .share-qr-float {
  1502. position: fixed;
  1503. top: 180rpx;
  1504. right: 30rpx;
  1505. width: 80rpx;
  1506. height: 80rpx;
  1507. border-radius: 50%;
  1508. background: $app-surface;
  1509. box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.15);
  1510. display: flex;
  1511. align-items: center;
  1512. justify-content: center;
  1513. z-index: 99;
  1514. }
  1515. /* 二维码图标(纯 CSS 绘制,不依赖 emoji 字体) */
  1516. .qr-glyph {
  1517. position: relative;
  1518. width: 46rpx;
  1519. height: 46rpx;
  1520. }
  1521. .qr-eye {
  1522. position: absolute;
  1523. width: 16rpx;
  1524. height: 16rpx;
  1525. border: 4rpx solid $uni-text-color;
  1526. border-radius: 8rpx;
  1527. box-sizing: border-box;
  1528. }
  1529. .qr-eye-tl { left: 0; top: 0; }
  1530. .qr-eye-tr { right: 0; top: 0; }
  1531. .qr-eye-bl { left: 0; bottom: 0; }
  1532. .qr-mid {
  1533. position: absolute;
  1534. left: 20rpx;
  1535. top: 20rpx;
  1536. width: 7rpx;
  1537. height: 7rpx;
  1538. background: $uni-text-color;
  1539. border-radius: 8rpx;
  1540. }
  1541. .qr-cluster {
  1542. position: absolute;
  1543. right: 0;
  1544. bottom: 0;
  1545. width: 18rpx;
  1546. display: flex;
  1547. flex-wrap: wrap;
  1548. }
  1549. .qr-pip {
  1550. width: 7rpx;
  1551. height: 7rpx;
  1552. margin: 1rpx;
  1553. background: $uni-text-color;
  1554. border-radius: 8rpx;
  1555. }
  1556. </style>