index.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171
  1. <template>
  2. <view class="container">
  3. <!-- TabTransition overlay -->
  4. <tab-transition v-if="showTabTransition" dimCode="wealth" ref="tabTransition" @close="showTabTransition = false" />
  5. <!-- 未登录时显示精简内容 -->
  6. <template v-if="!isLoggedIn">
  7. <!-- 品牌定位语 -->
  8. <view class="brand-strap">
  9. <text class="brand-strap-text">分享价值,收获财富</text>
  10. </view>
  11. <!-- 月度引导语 -->
  12. <view class="monthly-guidance" v-if="!isLoggedIn">
  13. <text class="guidance-icon">💧</text>
  14. <text class="guidance-text">{{ monthlyGuidance }}</text>
  15. </view>
  16. <!-- 登录引导 -->
  17. <view class="login-guide-section">
  18. <LoginGuideCard
  19. title="解锁财富能量与推广收益"
  20. :items="[
  21. '查看家庭财富能量仪表盘与推广收益',
  22. '管理邀请返利,开通会员享专属折扣',
  23. '浏览商城精选商品,一键加入购物车'
  24. ]" />
  25. </view>
  26. <!-- 商城精选预览(无需登录) -->
  27. <view class="section">
  28. <view class="section-header">
  29. <text class="section-title">🛍️ 商城精选</text>
  30. <text class="section-more" @click="goToShop">查看全部 ›</text>
  31. </view>
  32. <scroll-view scroll-x class="product-scroll" show-scrollbar="false">
  33. <view class="product-list">
  34. <view class="product-card" v-for="(item, idx) in guestProducts" :key="idx" @click="goProductDetail(item.id)">
  35. <image class="product-img" :src="getImageUrl(item.coverImage || item.image) || '/static/default-product.png'" mode="aspectFill" />
  36. <text class="product-name">{{ item.name }}</text>
  37. <text class="product-price">¥{{ item.price || 0 }}</text>
  38. </view>
  39. </view>
  40. </scroll-view>
  41. </view>
  42. </template>
  43. <template v-else>
  44. <!-- 家庭成员选择条 -->
  45. <FamilyMemberStrip
  46. v-if="currentView === 'self' && isLoggedIn"
  47. :members="familyMembersVisible"
  48. :selectedMemberId="selectedMemberId"
  49. @select="onFamilyMemberSelect"
  50. @removed="loadFamilyMembersVisible" />
  51. <!-- 五维能量条 -->
  52. <FamilyEnergyBar
  53. v-if="isLoggedIn && sandboxData"
  54. dimensionCode="wealth"
  55. :sandboxData="sandboxData"
  56. :dualDimension="dualDimension" />
  57. <!-- 身克富杠杆警告 -->
  58. <body-wealth-alert
  59. :status="bodyWealthStatus"
  60. :message="bodyWealthMessage"
  61. :showTip="true" />
  62. <!-- 财富能量环 -->
  63. <WealthEnergyRing
  64. :score="wealthScore"
  65. :delta="deltaPercent" />
  66. <!-- 财富成长 -->
  67. <view class="section stream-section">
  68. <view class="section-header">
  69. <text class="section-title">💰 财富成长</text>
  70. <text class="section-sub">记录家庭财富积累过程,看到每月的成长变化</text>
  71. </view>
  72. <view class="stream-stages">
  73. <view
  74. class="stage-card"
  75. :class="{ active: stage.key === currentStage }"
  76. v-for="stage in streamStages"
  77. :key="stage.key">
  78. <text class="stage-icon">{{ stage.icon }}</text>
  79. <text class="stage-name">{{ stage.name }}</text>
  80. <text class="stage-desc">{{ stage.desc }}</text>
  81. <text class="stage-range">{{ stage.range }}</text>
  82. </view>
  83. </view>
  84. <view class="stream-water">
  85. <view class="stream-water-fill" :style="{ width: wealthScore + '%' }"></view>
  86. </view>
  87. <text class="stream-percent">水位 {{ wealthScore }}%</text>
  88. <text class="stream-tip">{{ streamTip }}</text>
  89. </view>
  90. <!-- 子维度水滴 -->
  91. <wealth-sub-scores
  92. :role="role"
  93. :skill="wealthSkill"
  94. :altruism="wealthAltruism"
  95. :income="wealthIncome"
  96. :fx="wealthFx" />
  97. <!-- 子维度评分表 -->
  98. <dimension-sub-dims
  99. v-if="isLoggedIn && wealthSubDims.length > 0"
  100. title="💧 财富维度构成"
  101. subtitle="家庭财富能量的各个方面"
  102. accent-color="#F59E0B"
  103. :dims="wealthSubDims" />
  104. <!-- 财富强项与提升 -->
  105. <view class="section wealth-insight" v-if="isLoggedIn && wealthSubDims.length > 0 && (wealthStrengths.length > 0 || wealthImproves.length > 0)">
  106. <view class="section-header">
  107. <text class="section-title">📈 财富强项与提升</text>
  108. </view>
  109. <view class="insight-group" v-if="wealthStrengths.length > 0">
  110. <text class="insight-group-title">💪 财富强项</text>
  111. <view class="insight-item" v-for="(item, idx) in wealthStrengths" :key="getInsightKey('s', idx)">
  112. <text class="insight-item-name">{{ item.label }}</text>
  113. <text class="insight-item-score">{{ item.score }}分</text>
  114. <text class="insight-item-tag tag-strong">强项</text>
  115. </view>
  116. </view>
  117. <view class="insight-group" v-if="wealthImproves.length > 0">
  118. <text class="insight-group-title">🌱 提升空间</text>
  119. <view class="insight-item" v-for="(item, idx) in wealthImproves" :key="getInsightKey('i', idx)">
  120. <text class="insight-item-name">{{ item.label }}</text>
  121. <text class="insight-item-score">{{ item.score }}分</text>
  122. <text class="insight-item-tag tag-improve">待提升</text>
  123. </view>
  124. </view>
  125. <view class="insight-tip" v-if="wealthStrengths.length > 0 && wealthImproves.length > 0">
  126. <text class="insight-tip-text">保持优势项,薄弱项可通过参与活动与任务逐步积累</text>
  127. </view>
  128. </view>
  129. <!-- 财富数据卡(家长) -->
  130. <view class="section" v-if="role === 'parent'">
  131. <view class="disc-card">
  132. <text class="disc-label">💰 累计收益</text>
  133. <text class="disc-value">¥{{ wealthData.totalEarnings || 0 }}</text>
  134. <text class="disc-sub" v-if="deltaPercent > 0">较上月 ↑ {{ deltaPercent }}%</text>
  135. </view>
  136. <view class="disc-sub-row">
  137. <view class="disc-sub-card" @click="goToIncome">
  138. <text class="disc-sub-label">可提现</text>
  139. <text class="disc-sub-value">¥{{ wealthData.availableAmount || 0 }}</text>
  140. <text class="disc-sub-action">提现 →</text>
  141. </view>
  142. <view class="disc-sub-card" @click="goToAchievements">
  143. <text class="disc-sub-label">邀请人数</text>
  144. <text class="disc-sub-value">{{ wealthData.referralCount || 0 }}人</text>
  145. <text class="disc-sub-action">邀请 →</text>
  146. </view>
  147. </view>
  148. </view>
  149. <!-- 财富数据卡(孩子) -->
  150. <view class="section" v-else>
  151. <view class="child-wealth-card">
  152. <view class="child-wealth-item">
  153. <text class="child-wealth-icon">⭐</text>
  154. <text class="child-wealth-value">{{ wealthIncome || 0 }}</text>
  155. <text class="child-wealth-label">累计积分</text>
  156. </view>
  157. <view class="child-wealth-item">
  158. <text class="child-wealth-icon">📝</text>
  159. <text class="child-wealth-value">{{ taskPercent }}%</text>
  160. <text class="child-wealth-label">任务完成</text>
  161. </view>
  162. <view class="child-wealth-item">
  163. <text class="child-wealth-icon">🏆</text>
  164. <text class="child-wealth-value">{{ badgeCount }}</text>
  165. <text class="child-wealth-label">已获徽章</text>
  166. </view>
  167. </view>
  168. <view class="child-trend">
  169. <text class="child-trend-title">📊 本周成长趋势</text>
  170. <view class="child-trend-bars">
  171. <view class="trend-bar" v-for="(h, i) in weekTrend" :key="i" :style="{ height: h + '%' }"></view>
  172. </view>
  173. <view class="child-trend-days">
  174. <text class="trend-day" v-for="(d, i) in weekDays" :key="i">{{ d }}</text>
  175. </view>
  176. </view>
  177. </view>
  178. <!-- 保单管理 -->
  179. <view class="section" v-if="insuranceLoaded">
  180. <view class="section-header">
  181. <text class="section-title">🛡️ 保单管理</text>
  182. <text class="section-more" @click="goToInsuranceList">查看更多 ›</text>
  183. </view>
  184. <view class="insurance-card" v-if="insuranceList.length === 0">
  185. <view class="insurance-empty">
  186. <text class="insurance-empty-icon">📋</text>
  187. <text class="insurance-empty-text">暂无保单</text>
  188. </view>
  189. </view>
  190. <view class="insurance-card" v-else>
  191. <view class="insurance-item" v-for="(item, idx) in insuranceList" :key="idx" @click="goToInsuranceList">
  192. <view class="insurance-item-header">
  193. <text class="insurance-item-name">{{ item.policyName }}</text>
  194. <text class="insurance-item-status" :class="'status-' + item.status">{{ getPolicyStatusLabel(item.status) }}</text>
  195. </view>
  196. <view class="insurance-item-row">
  197. <text class="insurance-item-label">保险公司</text>
  198. <text class="insurance-item-value">{{ item.insuranceCompany || '未知' }}</text>
  199. </view>
  200. <view class="insurance-item-row">
  201. <text class="insurance-item-label">被保人</text>
  202. <text class="insurance-item-value">{{ item.insuredPerson }}</text>
  203. </view>
  204. </view>
  205. </view>
  206. </view>
  207. <!-- 富维度介绍卡片 -->
  208. <DimensionIntroCard dimCode="wealth" v-if="isLoggedIn" learn-more-url="/pages/wealth/dimension-intro" />
  209. </template>
  210. </view>
  211. </template>
  212. <script>
  213. import TabTransition from '../../components/tab-transition.vue'
  214. import WealthEnergyRing from '../../components/WealthEnergyRing.vue'
  215. import WealthSubScores from '../../components/WealthSubScores.vue'
  216. import BodyWealthAlert from '../../components/BodyWealthAlert.vue'
  217. import FamilyMemberStrip from '../../components/FamilyMemberStrip.vue'
  218. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  219. import DimensionIntroCard from '../../components/DimensionIntroCard.vue'
  220. import DimensionSubDims from '../../components/DimensionSubDims.vue'
  221. import {
  222. getChildren,
  223. getWealthDetail,
  224. getReferralCode,
  225. getReferralSummary,
  226. getCommissionSummary,
  227. getFamilyMemberList,
  228. getInsuranceList,
  229. getFamilyEnergySandbox,
  230. getEnergyOverview,
  231. productList,
  232. extractReferralCode,
  233. getChildBadgeStats,
  234. getDailyTaskOverview, reportAppEnter
  235. } from '../../utils/api.js'
  236. import nav from '../../utils/nav.js'
  237. import config from '../../config.js'
  238. export default {
  239. components: { TabTransition, WealthEnergyRing, WealthSubScores, BodyWealthAlert, FamilyMemberStrip, FamilyEnergyBar, DimensionIntroCard, DimensionSubDims },
  240. data() {
  241. return {
  242. showTabTransition: true,
  243. isLoggedIn: false,
  244. role: 'parent',
  245. // 五维评分
  246. wealthScore: 0,
  247. // 子维度 - 利他创富四维(家长/孩子共用字段)
  248. wealthSkill: null,
  249. wealthAltruism: null,
  250. wealthIncome: null,
  251. wealthFx: null,
  252. // 子维度汇总(DimensionSubDims 用)
  253. wealthSubDims: [],
  254. // 身克富杠杆
  255. bodyWealthStatus: 'normal',
  256. bodyWealthMessage: '',
  257. // 财富数据
  258. wealthData: {
  259. totalEarnings: 0,
  260. availableAmount: 0,
  261. referralCount: 0,
  262. referralCode: ''
  263. },
  264. // 财富成长
  265. deltaPercent: 0,
  266. streamStages: [
  267. { key: 'start', icon: '💧', name: '起步', desc: '新人阶段', range: '0-30%' },
  268. { key: 'mid', icon: '🌊', name: '汇流', desc: '成长阶段', range: '30-70%' },
  269. { key: 'surge', icon: '🌊🌊', name: '奔涌', desc: '达人阶段', range: '70-100%' }
  270. ],
  271. // 孩子数据
  272. taskPercent: 0,
  273. badgeCount: 0,
  274. weekTrend: [30, 40, 35, 50, 60, 55, 70],
  275. weekDays: ['一', '二', '三', '四', '五', '六', '日'],
  276. // 服务列表
  277. serviceList: [
  278. { icon: '📝', label: '记账', action: 'goToCheckin' },
  279. { icon: '🛡️', label: '保单管理', action: 'goToInsurance' },
  280. { icon: '🎨', label: '创客中心', action: 'goToCreator' },
  281. { icon: '🏪', label: '商城首页', action: 'goToShop' },
  282. { icon: '🛒', label: '购物车', action: 'goToCart' },
  283. { icon: '📋', label: '我的订单', action: 'goToOrders' },
  284. { icon: '🔄', label: '售后服务', action: 'goToAfterSales' },
  285. { icon: '📊', label: '收益中心', action: 'goToIncome' },
  286. { icon: '💎', label: '家庭CF值', action: 'goToFamilyCf' }
  287. ],
  288. children: [],
  289. familyMembersVisible: [],
  290. selectedMemberId: null,
  291. guestProducts: [],
  292. // 五维能量条数据
  293. sandboxData: null,
  294. dualDimension: null,
  295. // 保单列表
  296. insuranceList: [],
  297. insuranceLoaded: false,
  298. }
  299. },
  300. computed: {
  301. activeChildId() {
  302. if (this.role === 'child') {
  303. return uni.getStorageSync('currentChildId')
  304. }
  305. return ''
  306. },
  307. currentStage() {
  308. var s = this.wealthScore
  309. if (s >= 70) return 'surge'
  310. if (s >= 30) return 'mid'
  311. return 'start'
  312. },
  313. streamTip() {
  314. var s = this.wealthScore
  315. if (s >= 70) return '🎉 已是富足达人,继续引领全家成长!'
  316. if (s >= 30) return '💡 坚持分享,下一阶段"奔涌"在望'
  317. return '🌱 从今天开始,迈出创富第一步'
  318. },
  319. /** 财富强项:wealthSubDims 中得分 ≥75 的维度 */
  320. wealthStrengths() {
  321. var result = []
  322. for (var i = 0; i < this.wealthSubDims.length; i++) {
  323. var d = this.wealthSubDims[i]
  324. var s = Number(d.score)
  325. if (s >= 75) result.push({ label: d.label, score: s })
  326. }
  327. return result
  328. },
  329. /** 财富提升空间:wealthSubDims 中 0<得分<60 的维度 */
  330. wealthImproves() {
  331. var result = []
  332. for (var i = 0; i < this.wealthSubDims.length; i++) {
  333. var d = this.wealthSubDims[i]
  334. var s = Number(d.score)
  335. if (s > 0 && s < 60) result.push({ label: d.label, score: s })
  336. }
  337. return result
  338. }
  339. },
  340. onShow() {
  341. reportAppEnter('wealth');
  342. this.showTabTransition = true
  343. var token = uni.getStorageSync('token')
  344. if (!token) {
  345. this.isLoggedIn = false
  346. this.loadGuestProducts()
  347. this._watchPageReady()
  348. return
  349. }
  350. this.isLoggedIn = true
  351. var currentRole = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent'
  352. if (currentRole === 'teacher') {
  353. uni.redirectTo({ url: '/pages/teacher/teacher-profile' })
  354. return
  355. }
  356. this.role = currentRole
  357. this.loadChildren()
  358. this.loadWealthDetail()
  359. this.loadWealthData()
  360. this.loadChildData()
  361. this.loadFamilyMembersVisible()
  362. this.loadInsuranceList()
  363. this.loadSandboxData()
  364. this.loadEnergyData()
  365. this._watchPageReady()
  366. },
  367. /** 每月引导语 */
  368. monthlyGuidance: function() {
  369. var month = new Date().getMonth()
  370. var messages = [
  371. '一月:理财从记账开始,养习惯',
  372. '二月:新年规划,梳理家庭收支',
  373. '三月:春耕时节,播种财富种子',
  374. '四月:清明踏青,规划家庭支出',
  375. '五月:劳动节后,复盘收支状况',
  376. '六月:年中复盘,调整财富目标',
  377. '七月:暑期规划,优化家庭消费',
  378. '八月:开学季,教育专项规划',
  379. '九月:金秋收获,检视推广收益',
  380. '十月:国庆消费,理性理财',
  381. '十一月:年终冲刺,盘点年度收益',
  382. '十二月:年度总结,规划来年财富'
  383. ]
  384. return messages[month] || messages[0]
  385. },
  386. methods: {
  387. getInsightKey(prefix, idx) { return prefix + idx },
  388. onFamilyMemberSelect(member) {
  389. this.selectedMemberId = member.id
  390. },
  391. loadFamilyMembersVisible() {
  392. var self = this
  393. getFamilyMemberList({ visibleOnly: true }).then(function(res) {
  394. self.familyMembersVisible = res.data || []
  395. }).catch(function(e) {
  396. console.log('获取可见家庭成员失败', e)
  397. self.familyMembersVisible = []
  398. })
  399. },
  400. loadInsuranceList() {
  401. var self = this
  402. this.insuranceLoaded = false
  403. getInsuranceList({}).then(function(res) {
  404. if (res && res.code === 200) {
  405. self.insuranceList = (res.data || []).slice(0, 3)
  406. }
  407. self.insuranceLoaded = true
  408. }).catch(function() {
  409. self.insuranceLoaded = true
  410. })
  411. },
  412. getPolicyStatusLabel: function(status) {
  413. var map = { active: '有效', expired: '已过期', cancelled: '已取消' }
  414. return map[status] || status || '未知'
  415. },
  416. goLogin() {
  417. uni.navigateTo({ url: '/pages/login/login' })
  418. },
  419. _watchPageReady() {
  420. var self = this
  421. this.$nextTick(function() {
  422. if (self.$refs.tabTransition) self.$refs.tabTransition.markReady()
  423. })
  424. },
  425. async loadChildren() {
  426. try {
  427. var res = await getChildren()
  428. this.children = res.data || []
  429. } catch (e) {
  430. console.error('获取孩子列表失败', e)
  431. }
  432. },
  433. async loadWealthDetail() {
  434. var memberId = null
  435. var memberType = this.role
  436. if (this.role === 'child') {
  437. memberId = uni.getStorageSync('currentChildId')
  438. if (!memberId && this.children.length > 0) {
  439. memberId = this.children[0].id
  440. }
  441. } else {
  442. memberId = uni.getStorageSync('userId')
  443. }
  444. if (!memberId) return
  445. try {
  446. var res = await getWealthDetail(memberId, memberType)
  447. if (res && res.data) {
  448. var d = res.data
  449. this.wealthScore = d.wealthScore || 0
  450. // 利他创富四子维度(家长/孩子共用字段)
  451. this.wealthSkill = d.wealthSkill
  452. this.wealthAltruism = d.wealthAltruism
  453. this.wealthIncome = d.wealthIncome
  454. this.wealthFx = d.wealthFx
  455. // 身克富杠杆状态
  456. this.bodyWealthStatus = d.bodyWealthStatus || 'normal'
  457. this.bodyWealthMessage = d.bodyWealthMessage || ''
  458. // 子维度汇总(供 DimensionSubDims 使用)
  459. if (memberType === 'parent') {
  460. this.wealthSubDims = [
  461. { label: '个人能力', score: this.wealthSkill || 0, desc: '服务商资质与成长学习' },
  462. { label: '利他贡献', score: this.wealthAltruism || 0, desc: '邀请分享帮助他人' },
  463. { label: 'CF值积累', score: this.wealthIncome || 0, desc: '家庭第二收入曲线' },
  464. { label: '财务素养', score: this.wealthFx || 0, desc: '记账理财储蓄习惯' }
  465. ]
  466. } else {
  467. this.wealthSubDims = [
  468. { label: '学业能力', score: this.wealthSkill || 0, desc: '测评成绩与进步趋势' },
  469. { label: '利他贡献', score: this.wealthAltruism || 0, desc: '帮助他人与分享' },
  470. { label: '积分积累', score: this.wealthIncome || 0, desc: '完成任务获取积分' },
  471. { label: '财务素养', score: this.wealthFx || 0, desc: '财商学习与储蓄习惯' }
  472. ]
  473. }
  474. }
  475. } catch (e) {
  476. console.error('获取富维度详情失败', e)
  477. }
  478. },
  479. loadSandboxData: function() {
  480. var self = this
  481. getFamilyEnergySandbox().then(function(res) {
  482. if (res && res.data) self.sandboxData = res.data
  483. }).catch(function() {})
  484. },
  485. loadEnergyData: function() {
  486. var self = this
  487. var memberId = uni.getStorageSync('userId') || null
  488. if (!memberId) return
  489. getEnergyOverview(memberId).then(function(res) {
  490. if (res && res.data) {
  491. var dims = res.data.dimensions
  492. if (dims && dims.length > 0) {
  493. for (var i = 0; i < dims.length; i++) {
  494. if (dims[i].code === 'wealth') {
  495. self.dualDimension = dims[i]
  496. break
  497. }
  498. }
  499. }
  500. }
  501. }).catch(function() {})
  502. },
  503. goToMemberDetail: function(memberId) {
  504. uni.navigateTo({ url: '/pages/wealth-detail/member-wealth-detail?memberId=' + memberId })
  505. },
  506. async loadWealthData() {
  507. if (this.role !== 'parent') return
  508. try {
  509. var codeRes = await getReferralCode()
  510. this.wealthData.referralCode = extractReferralCode(codeRes)
  511. } catch (e) {
  512. console.error('获取邀请码失败', e)
  513. }
  514. try {
  515. var summaryRes = await getReferralSummary()
  516. if (summaryRes && summaryRes.code === 200 && summaryRes.data) {
  517. this.wealthData.referralCount = summaryRes.data.invitedCount || 0
  518. }
  519. } catch (e) {
  520. console.error('获取邀请统计失败', e)
  521. }
  522. try {
  523. var commissionRes = await getCommissionSummary()
  524. if (commissionRes && commissionRes.code === 200 && commissionRes.data) {
  525. this.wealthData.totalEarnings = commissionRes.data.totalEarnings || 0
  526. this.wealthData.availableAmount = commissionRes.data.availableAmount || 0
  527. }
  528. } catch (e) {
  529. console.error('获取佣金统计失败', e)
  530. }
  531. },
  532. async loadChildData() {
  533. if (this.role !== 'child') return
  534. var memberId = uni.getStorageSync('currentChildId')
  535. if (!memberId && this.children.length > 0) {
  536. memberId = this.children[0].id
  537. }
  538. if (!memberId) return
  539. try {
  540. var badgeRes = await getChildBadgeStats(memberId)
  541. if (badgeRes && badgeRes.code === 200 && badgeRes.data) {
  542. this.badgeCount = badgeRes.data.active || 0
  543. }
  544. } catch (e) {
  545. console.error('获取徽章统计失败', e)
  546. }
  547. try {
  548. var taskRes = await getDailyTaskOverview({ memberId: memberId })
  549. if (taskRes && taskRes.code === 200 && taskRes.data && taskRes.data.tasks) {
  550. var done = taskRes.data.tasks.doneToday || 0
  551. var todo = taskRes.data.tasks.todoToday || 0
  552. var total = done + todo
  553. this.taskPercent = total > 0 ? Math.round(done / total * 100) : 0
  554. }
  555. } catch (e) {
  556. console.error('获取任务概览失败', e)
  557. }
  558. },
  559. logout() {
  560. uni.showModal({
  561. title: '退出登录',
  562. content: '确定要退出登录吗?',
  563. success: function(res) {
  564. if (res.confirm) {
  565. uni.clearStorageSync()
  566. uni.reLaunch({ url: '/pages/login/login' })
  567. }
  568. }
  569. })
  570. },
  571. goToCheckin() {
  572. uni.navigateTo({ url: '/pages/wealth-sub/checkin' })
  573. },
  574. goToInsurance() {
  575. uni.navigateTo({ url: '/pages/wealth-sub/insurance-list' })
  576. },
  577. goToInsuranceList: function() {
  578. uni.navigateTo({ url: '/pages/wealth-sub/insurance-list' })
  579. },
  580. goToCreator() {
  581. uni.navigateTo({ url: '/pages/promotion/index' })
  582. },
  583. goToShop() {
  584. uni.navigateTo({ url: '/pages/shop/index/index' })
  585. },
  586. goToOrders() {
  587. uni.navigateTo({ url: '/pages/shop/order-list/order-list' })
  588. },
  589. goToAfterSales() {
  590. uni.navigateTo({ url: '/pages/shop/after-sales/after-sales' })
  591. },
  592. goToIncome() {
  593. uni.navigateTo({ url: '/pages/promotion/commission' })
  594. },
  595. goToFamilyCf() {
  596. uni.navigateTo({ url: '/pages/wealth-cf/index' })
  597. },
  598. goToAchievements() {
  599. uni.navigateTo({ url: '/pages/rewards/badge' })
  600. },
  601. goToNetwork() {
  602. uni.navigateTo({ url: '/pages/promotion/team' })
  603. },
  604. goToCart() {
  605. uni.navigateTo({ url: '/pages/shop/cart/cart' })
  606. },
  607. loadGuestProducts() {
  608. var self = this
  609. productList({ page: 1, size: 4, sort: 'sales' }).then(function(res) {
  610. if (res.code === 200 && res.data && res.data.records) {
  611. self.guestProducts = res.data.records.slice(0, 4)
  612. }
  613. }).catch(function() {})
  614. },
  615. goProductDetail(id) {
  616. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + id })
  617. },
  618. getImageUrl: function(path) {
  619. return config.API_BASE_URL + path
  620. },
  621. onServiceClick(action) {
  622. if (this[action]) {
  623. this[action]()
  624. }
  625. }
  626. }
  627. }
  628. </script>
  629. .view-toggle {
  630. display: flex;
  631. margin: 20rpx 30rpx;
  632. background: rgba(255,255,255,0.12);
  633. border-radius: 12rpx;
  634. padding: 6rpx;
  635. }
  636. .toggle-btn {
  637. flex: 1;
  638. text-align: center;
  639. padding: 12rpx 0;
  640. border-radius: 8rpx;
  641. font-size: 26rpx;
  642. color: rgba(255,255,255,0.65);
  643. }
  644. .toggle-btn.active {
  645. background: rgba(255,255,255,0.22);
  646. color: #fff;
  647. font-weight: 600;
  648. }
  649. /* 页面说明 */
  650. .section-sub {
  651. font-size: 22rpx;
  652. color: rgba(255,255,255,0.55);
  653. margin-top: 6rpx;
  654. display: block;
  655. }
  656. /* 得分解读卡片 */
  657. .score-explain-card {
  658. margin: 20rpx 30rpx;
  659. padding: 28rpx 24rpx;
  660. background: rgba(255,255,255,0.1);
  661. border-radius: 20rpx;
  662. border: 1rpx solid rgba(255,255,255,0.15);
  663. }
  664. .explain-header {
  665. display: flex;
  666. align-items: center;
  667. margin-bottom: 14rpx;
  668. }
  669. .explain-icon {
  670. font-size: 36rpx;
  671. margin-right: 10rpx;
  672. }
  673. .explain-title {
  674. font-size: 28rpx;
  675. font-weight: 600;
  676. color: #fff;
  677. }
  678. .explain-text {
  679. font-size: 26rpx;
  680. color: rgba(255,255,255,0.8);
  681. line-height: 1.6;
  682. }
  683. <style scoped>
  684. .container {
  685. min-height: 100vh;
  686. background: #f5f7fa;
  687. padding-bottom: 120rpx;
  688. }
  689. .section {
  690. margin: 20rpx 30rpx;
  691. }
  692. .section-header {
  693. display: flex;
  694. justify-content: space-between;
  695. align-items: center;
  696. margin-bottom: 20rpx;
  697. }
  698. .section-title {
  699. font-size: 30rpx;
  700. font-weight: bold;
  701. color: #333;
  702. }
  703. .section-more {
  704. font-size: 24rpx;
  705. color: #999;
  706. }
  707. /* 财富成长 */
  708. .stream-section {
  709. background: #fff;
  710. border-radius: 20rpx;
  711. padding: 24rpx;
  712. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  713. }
  714. .stream-stages {
  715. display: flex;
  716. justify-content: space-between;
  717. margin-bottom: 20rpx;
  718. }
  719. .stage-card {
  720. flex: 1;
  721. margin: 0 8rpx;
  722. padding: 20rpx;
  723. border-radius: 16rpx;
  724. background: #F5F9FC;
  725. display: flex;
  726. flex-direction: column;
  727. align-items: center;
  728. }
  729. .stage-card.active {
  730. background: #FFF7ED;
  731. border: 2rpx solid #FBBF24;
  732. }
  733. .stage-icon {
  734. font-size: 44rpx;
  735. }
  736. .stage-name {
  737. font-size: 26rpx;
  738. font-weight: bold;
  739. color: #333;
  740. margin-top: 8rpx;
  741. }
  742. .stage-desc {
  743. font-size: 20rpx;
  744. color: #999;
  745. margin-top: 4rpx;
  746. }
  747. .stage-range {
  748. font-size: 20rpx;
  749. color: #F59E0B;
  750. margin-top: 4rpx;
  751. }
  752. .stream-water {
  753. height: 20rpx;
  754. border-radius: 10rpx;
  755. background: #FEF3C7;
  756. overflow: hidden;
  757. }
  758. .stream-water-fill {
  759. height: 100%;
  760. border-radius: 10rpx;
  761. background: linear-gradient(90deg, #F59E0B, #FBBF24);
  762. transition: width 0.8s ease;
  763. }
  764. .stream-percent {
  765. display: block;
  766. text-align: right;
  767. font-size: 22rpx;
  768. color: #F59E0B;
  769. margin-top: 8rpx;
  770. }
  771. .stream-tip {
  772. display: block;
  773. text-align: center;
  774. font-size: 24rpx;
  775. color: #92400E;
  776. margin-top: 12rpx;
  777. }
  778. /* 财富数据主卡 */
  779. .disc-card {
  780. background: linear-gradient(135deg, #FFF7ED, #FEF3C7);
  781. border-radius: 20rpx;
  782. padding: 30rpx;
  783. margin-bottom: 16rpx;
  784. display: flex;
  785. flex-direction: column;
  786. }
  787. .disc-label {
  788. font-size: 26rpx;
  789. color: #92400E;
  790. }
  791. .disc-value {
  792. font-size: 56rpx;
  793. font-weight: bold;
  794. color: #F59E0B;
  795. margin-top: 8rpx;
  796. }
  797. .disc-sub {
  798. font-size: 24rpx;
  799. color: #B45309;
  800. margin-top: 8rpx;
  801. }
  802. .disc-sub-row {
  803. display: flex;
  804. margin-bottom: 16rpx;
  805. }
  806. .disc-sub-card {
  807. flex: 1;
  808. background: #fff;
  809. border-radius: 16rpx;
  810. padding: 24rpx;
  811. display: flex;
  812. flex-direction: column;
  813. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  814. }
  815. .disc-sub-card:first-child {
  816. margin-right: 8rpx;
  817. }
  818. .disc-sub-card:last-child {
  819. margin-left: 8rpx;
  820. }
  821. .disc-sub-label {
  822. font-size: 24rpx;
  823. color: #999;
  824. }
  825. .disc-sub-value {
  826. font-size: 36rpx;
  827. font-weight: bold;
  828. color: #333;
  829. margin-top: 8rpx;
  830. }
  831. .disc-sub-action {
  832. font-size: 22rpx;
  833. color: #F59E0B;
  834. margin-top: 8rpx;
  835. }
  836. /* 孩子财富卡 */
  837. .child-wealth-card {
  838. display: flex;
  839. background: #fff;
  840. border-radius: 20rpx;
  841. padding: 24rpx 0;
  842. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  843. }
  844. .child-wealth-item {
  845. flex: 1;
  846. display: flex;
  847. flex-direction: column;
  848. align-items: center;
  849. }
  850. .child-wealth-icon {
  851. font-size: 44rpx;
  852. }
  853. .child-wealth-value {
  854. font-size: 36rpx;
  855. font-weight: bold;
  856. color: #F59E0B;
  857. margin-top: 8rpx;
  858. }
  859. .child-wealth-label {
  860. font-size: 22rpx;
  861. color: #999;
  862. margin-top: 4rpx;
  863. }
  864. .child-trend {
  865. margin-top: 16rpx;
  866. background: #fff;
  867. border-radius: 20rpx;
  868. padding: 24rpx;
  869. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  870. }
  871. .child-trend-title {
  872. font-size: 26rpx;
  873. color: #333;
  874. font-weight: bold;
  875. }
  876. .child-trend-bars {
  877. display: flex;
  878. align-items: flex-end;
  879. height: 120rpx;
  880. margin-top: 16rpx;
  881. }
  882. .trend-bar {
  883. flex: 1;
  884. margin: 0 6rpx;
  885. background: linear-gradient(180deg, #FBBF24, #F59E0B);
  886. border-radius: 6rpx 6rpx 0 0;
  887. }
  888. .child-trend-days {
  889. display: flex;
  890. margin-top: 8rpx;
  891. }
  892. .trend-day {
  893. flex: 1;
  894. text-align: center;
  895. font-size: 20rpx;
  896. color: #999;
  897. }
  898. /* 服务入口 */
  899. .service-grid {
  900. display: flex;
  901. flex-wrap: wrap;
  902. background: #fff;
  903. border-radius: 20rpx;
  904. padding: 24rpx 16rpx;
  905. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  906. }
  907. .service-item {
  908. width: 25%;
  909. display: flex;
  910. flex-direction: column;
  911. align-items: center;
  912. padding: 16rpx 0;
  913. }
  914. .service-icon-wrap {
  915. width: 88rpx;
  916. height: 88rpx;
  917. border-radius: 24rpx;
  918. background: #FFF7ED;
  919. display: flex;
  920. align-items: center;
  921. justify-content: center;
  922. margin-bottom: 8rpx;
  923. }
  924. .service-icon {
  925. font-size: 40rpx;
  926. }
  927. .service-label {
  928. font-size: 22rpx;
  929. color: #666;
  930. }
  931. .logout-item {
  932. color: #EF4444;
  933. }
  934. /* 未登录 */
  935. .login-guide-section {
  936. display: flex;
  937. flex-direction: column;
  938. align-items: center;
  939. padding: 60rpx 40rpx;
  940. margin: 30rpx;
  941. background: #fff;
  942. border-radius: 20rpx;
  943. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  944. }
  945. .login-guide-text {
  946. font-size: 26rpx;
  947. color: #999;
  948. text-align: center;
  949. margin-bottom: 30rpx;
  950. line-height: 1.6;
  951. }
  952. .login-guide-section .login-btn {
  953. width: 60%;
  954. height: 80rpx;
  955. line-height: 80rpx;
  956. background: linear-gradient(135deg, #5B9BD5, #3A7CC4);
  957. color: #fff;
  958. font-size: 30rpx;
  959. font-weight: bold;
  960. border-radius: 40rpx;
  961. text-align: center;
  962. border: none;
  963. }
  964. .login-prompt .login-btn::after {
  965. border: none;
  966. }
  967. /* 品牌定位语 */
  968. .brand-strap {
  969. margin: 16rpx 30rpx 0;
  970. padding: 20rpx 28rpx;
  971. background: linear-gradient(135deg, #FFFBEB, rgba(245,158,11,0.12));
  972. border-radius: 16rpx;
  973. border-left: 4rpx solid #F59E0B;
  974. }
  975. .brand-strap-text {
  976. font-size: 26rpx;
  977. color: #92400E;
  978. font-weight: 500;
  979. }
  980. /* 商城精选预览 */
  981. .product-scroll {
  982. white-space: nowrap;
  983. padding: 0 30rpx;
  984. }
  985. .product-list {
  986. display: inline-flex;
  987. gap: 20rpx;
  988. }
  989. .product-card {
  990. width: 220rpx;
  991. flex-shrink: 0;
  992. background: #fff;
  993. border-radius: 16rpx;
  994. overflow: hidden;
  995. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  996. }
  997. .product-img {
  998. width: 220rpx;
  999. height: 220rpx;
  1000. background: #f5f5f5;
  1001. }
  1002. .product-name {
  1003. display: block;
  1004. padding: 12rpx 12rpx 4rpx;
  1005. font-size: 24rpx;
  1006. color: #333;
  1007. overflow: hidden;
  1008. text-overflow: ellipsis;
  1009. white-space: nowrap;
  1010. }
  1011. .product-price {
  1012. display: block;
  1013. padding: 4rpx 12rpx 12rpx;
  1014. font-size: 26rpx;
  1015. font-weight: bold;
  1016. color: #F59E0B;
  1017. }
  1018. /* 保单管理 */
  1019. .insurance-card {
  1020. background: #fff;
  1021. border-radius: 20rpx;
  1022. padding: 24rpx;
  1023. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  1024. }
  1025. .insurance-empty {
  1026. display: flex;
  1027. flex-direction: column;
  1028. align-items: center;
  1029. padding: 40rpx 0;
  1030. }
  1031. .insurance-empty-icon { font-size: 60rpx; }
  1032. .insurance-empty-text { font-size: 24rpx; color: #999; margin-top: 12rpx; }
  1033. .insurance-item {
  1034. padding: 16rpx 0;
  1035. border-bottom: 1rpx solid #f5f5f5;
  1036. }
  1037. .insurance-item:last-child { border-bottom: none; }
  1038. .insurance-item-header {
  1039. display: flex;
  1040. justify-content: space-between;
  1041. align-items: center;
  1042. margin-bottom: 8rpx;
  1043. }
  1044. .insurance-item-name {
  1045. font-size: 26rpx;
  1046. font-weight: 600;
  1047. color: #333;
  1048. }
  1049. .insurance-item-status {
  1050. font-size: 20rpx;
  1051. padding: 4rpx 12rpx;
  1052. border-radius: 8rpx;
  1053. }
  1054. .insurance-item-status.status-active { background: #DCFCE7; color: #16A34A; }
  1055. .insurance-item-status.status-expired { background: #FEF2F2; color: #DC2626; }
  1056. .insurance-item-status.status-cancelled { background: #F5F5F5; color: #999; }
  1057. .insurance-item-row {
  1058. display: flex;
  1059. justify-content: space-between;
  1060. padding: 4rpx 0;
  1061. }
  1062. .insurance-item-label { font-size: 22rpx; color: #999; }
  1063. .insurance-item-value { font-size: 22rpx; color: #666; }
  1064. /* ===== 财富强项与提升卡片 ===== */
  1065. .wealth-insight {
  1066. background: #fff;
  1067. border-radius: 20rpx;
  1068. padding: 24rpx;
  1069. }
  1070. .insight-group {
  1071. margin-bottom: 16rpx;
  1072. }
  1073. .insight-group-title {
  1074. font-size: 26rpx;
  1075. font-weight: 600;
  1076. color: #333;
  1077. margin-bottom: 10rpx;
  1078. display: block;
  1079. }
  1080. .insight-item {
  1081. display: flex;
  1082. align-items: center;
  1083. padding: 12rpx 16rpx;
  1084. background: #FFFBEB;
  1085. border-radius: 12rpx;
  1086. margin-bottom: 8rpx;
  1087. }
  1088. .insight-item-name {
  1089. flex: 1;
  1090. font-size: 26rpx;
  1091. color: #333;
  1092. }
  1093. .insight-item-score {
  1094. font-size: 24rpx;
  1095. color: #666;
  1096. margin-right: 12rpx;
  1097. }
  1098. .insight-item-tag {
  1099. font-size: 20rpx;
  1100. padding: 4rpx 16rpx;
  1101. border-radius: 8rpx;
  1102. font-weight: 500;
  1103. }
  1104. .insight-item-tag.tag-strong {
  1105. background: #D1FAE5;
  1106. color: #059669;
  1107. }
  1108. .insight-item-tag.tag-improve {
  1109. background: #FEF3C7;
  1110. color: #D97706;
  1111. }
  1112. .insight-tip {
  1113. padding: 12rpx 16rpx;
  1114. background: #FFFBEB;
  1115. border-radius: 12rpx;
  1116. }
  1117. .insight-tip-text {
  1118. font-size: 22rpx;
  1119. color: #F59E0B;
  1120. }
  1121. </style>
  1122. /* 月度引导语 */
  1123. .monthly-guidance {
  1124. margin: 0 30rpx 20rpx;
  1125. background: linear-gradient(135deg, #FFFBEB, rgba(245,158,11,0.1));
  1126. border-radius: 16rpx;
  1127. padding: 20rpx 24rpx;
  1128. display: flex;
  1129. align-items: center;
  1130. gap: 12rpx;
  1131. }
  1132. .guidance-icon { font-size: 32rpx; flex-shrink: 0; }
  1133. .guidance-text { font-size: 26rpx; color: #F59E0B; font-weight: 500; }