profile.vue 54 KB

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