profile.vue 53 KB

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