index.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168
  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 '@/pages/wealth/components/WealthEnergyRing.vue'
  215. import WealthSubScores from '@/pages/wealth/components/WealthSubScores.vue'
  216. import BodyWealthAlert from '@/pages/wealth/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. // 所有人统一以家长身份进入,不再进行角色分流
  353. this.role = currentRole
  354. this.loadChildren()
  355. this.loadWealthDetail()
  356. this.loadWealthData()
  357. this.loadChildData()
  358. this.loadFamilyMembersVisible()
  359. this.loadInsuranceList()
  360. this.loadSandboxData()
  361. this.loadEnergyData()
  362. this._watchPageReady()
  363. },
  364. /** 每月引导语 */
  365. monthlyGuidance: function() {
  366. var month = new Date().getMonth()
  367. var messages = [
  368. '一月:理财从记账开始,养习惯',
  369. '二月:新年规划,梳理家庭收支',
  370. '三月:春耕时节,播种财富种子',
  371. '四月:清明踏青,规划家庭支出',
  372. '五月:劳动节后,复盘收支状况',
  373. '六月:年中复盘,调整财富目标',
  374. '七月:暑期规划,优化家庭消费',
  375. '八月:开学季,教育专项规划',
  376. '九月:金秋收获,检视推广收益',
  377. '十月:国庆消费,理性理财',
  378. '十一月:年终冲刺,盘点年度收益',
  379. '十二月:年度总结,规划来年财富'
  380. ]
  381. return messages[month] || messages[0]
  382. },
  383. methods: {
  384. getInsightKey(prefix, idx) { return prefix + idx },
  385. onFamilyMemberSelect(member) {
  386. this.selectedMemberId = member.id
  387. },
  388. loadFamilyMembersVisible() {
  389. var self = this
  390. getFamilyMemberList({ visibleOnly: true }).then(function(res) {
  391. self.familyMembersVisible = res.data || []
  392. }).catch(function(e) {
  393. console.log('获取可见家庭成员失败', e)
  394. self.familyMembersVisible = []
  395. })
  396. },
  397. loadInsuranceList() {
  398. var self = this
  399. this.insuranceLoaded = false
  400. getInsuranceList({}).then(function(res) {
  401. if (res && res.code === 200) {
  402. self.insuranceList = (res.data || []).slice(0, 3)
  403. }
  404. self.insuranceLoaded = true
  405. }).catch(function() {
  406. self.insuranceLoaded = true
  407. })
  408. },
  409. getPolicyStatusLabel: function(status) {
  410. var map = { active: '有效', expired: '已过期', cancelled: '已取消' }
  411. return map[status] || status || '未知'
  412. },
  413. goLogin() {
  414. uni.navigateTo({ url: '/pages/login/login' })
  415. },
  416. _watchPageReady() {
  417. var self = this
  418. this.$nextTick(function() {
  419. if (self.$refs.tabTransition) self.$refs.tabTransition.markReady()
  420. })
  421. },
  422. async loadChildren() {
  423. try {
  424. var res = await getChildren()
  425. this.children = res.data || []
  426. } catch (e) {
  427. console.error('获取孩子列表失败', e)
  428. }
  429. },
  430. async loadWealthDetail() {
  431. var memberId = null
  432. var memberType = this.role
  433. if (this.role === 'child') {
  434. memberId = uni.getStorageSync('currentChildId')
  435. if (!memberId && this.children.length > 0) {
  436. memberId = this.children[0].id
  437. }
  438. } else {
  439. memberId = uni.getStorageSync('userId')
  440. }
  441. if (!memberId) return
  442. try {
  443. var res = await getWealthDetail(memberId, memberType)
  444. if (res && res.data) {
  445. var d = res.data
  446. this.wealthScore = d.wealthScore || 0
  447. // 利他创富四子维度(家长/孩子共用字段)
  448. this.wealthSkill = d.wealthSkill
  449. this.wealthAltruism = d.wealthAltruism
  450. this.wealthIncome = d.wealthIncome
  451. this.wealthFx = d.wealthFx
  452. // 身克富杠杆状态
  453. this.bodyWealthStatus = d.bodyWealthStatus || 'normal'
  454. this.bodyWealthMessage = d.bodyWealthMessage || ''
  455. // 子维度汇总(供 DimensionSubDims 使用)
  456. if (memberType === 'parent') {
  457. this.wealthSubDims = [
  458. { label: '个人能力', score: this.wealthSkill || 0, desc: '服务商资质与成长学习' },
  459. { label: '利他贡献', score: this.wealthAltruism || 0, desc: '邀请分享帮助他人' },
  460. { label: 'CF值积累', score: this.wealthIncome || 0, desc: '家庭第二收入曲线' },
  461. { label: '财务素养', score: this.wealthFx || 0, desc: '记账理财储蓄习惯' }
  462. ]
  463. } else {
  464. this.wealthSubDims = [
  465. { label: '学业能力', score: this.wealthSkill || 0, desc: '测评成绩与进步趋势' },
  466. { label: '利他贡献', score: this.wealthAltruism || 0, desc: '帮助他人与分享' },
  467. { label: '积分积累', score: this.wealthIncome || 0, desc: '完成任务获取积分' },
  468. { label: '财务素养', score: this.wealthFx || 0, desc: '财商学习与储蓄习惯' }
  469. ]
  470. }
  471. }
  472. } catch (e) {
  473. console.error('获取富维度详情失败', e)
  474. }
  475. },
  476. loadSandboxData: function() {
  477. var self = this
  478. getFamilyEnergySandbox().then(function(res) {
  479. if (res && res.data) self.sandboxData = res.data
  480. }).catch(function() {})
  481. },
  482. loadEnergyData: function() {
  483. var self = this
  484. var memberId = uni.getStorageSync('userId') || null
  485. if (!memberId) return
  486. getEnergyOverview(memberId).then(function(res) {
  487. if (res && res.data) {
  488. var dims = res.data.dimensions
  489. if (dims && dims.length > 0) {
  490. for (var i = 0; i < dims.length; i++) {
  491. if (dims[i].code === 'wealth') {
  492. self.dualDimension = dims[i]
  493. break
  494. }
  495. }
  496. }
  497. }
  498. }).catch(function() {})
  499. },
  500. goToMemberDetail: function(memberId) {
  501. uni.navigateTo({ url: '/pages/wealth-detail/member-wealth-detail?memberId=' + memberId })
  502. },
  503. async loadWealthData() {
  504. if (this.role !== 'parent') return
  505. try {
  506. var codeRes = await getReferralCode()
  507. this.wealthData.referralCode = extractReferralCode(codeRes)
  508. } catch (e) {
  509. console.error('获取邀请码失败', e)
  510. }
  511. try {
  512. var summaryRes = await getReferralSummary()
  513. if (summaryRes && summaryRes.code === 200 && summaryRes.data) {
  514. this.wealthData.referralCount = summaryRes.data.invitedCount || 0
  515. }
  516. } catch (e) {
  517. console.error('获取邀请统计失败', e)
  518. }
  519. try {
  520. var commissionRes = await getCommissionSummary()
  521. if (commissionRes && commissionRes.code === 200 && commissionRes.data) {
  522. this.wealthData.totalEarnings = commissionRes.data.totalEarnings || 0
  523. this.wealthData.availableAmount = commissionRes.data.availableAmount || 0
  524. }
  525. } catch (e) {
  526. console.error('获取佣金统计失败', e)
  527. }
  528. },
  529. async loadChildData() {
  530. if (this.role !== 'child') return
  531. var memberId = uni.getStorageSync('currentChildId')
  532. if (!memberId && this.children.length > 0) {
  533. memberId = this.children[0].id
  534. }
  535. if (!memberId) return
  536. try {
  537. var badgeRes = await getChildBadgeStats(memberId)
  538. if (badgeRes && badgeRes.code === 200 && badgeRes.data) {
  539. this.badgeCount = badgeRes.data.active || 0
  540. }
  541. } catch (e) {
  542. console.error('获取徽章统计失败', e)
  543. }
  544. try {
  545. var taskRes = await getDailyTaskOverview({ memberId: memberId })
  546. if (taskRes && taskRes.code === 200 && taskRes.data && taskRes.data.tasks) {
  547. var done = taskRes.data.tasks.doneToday || 0
  548. var todo = taskRes.data.tasks.todoToday || 0
  549. var total = done + todo
  550. this.taskPercent = total > 0 ? Math.round(done / total * 100) : 0
  551. }
  552. } catch (e) {
  553. console.error('获取任务概览失败', e)
  554. }
  555. },
  556. logout() {
  557. uni.showModal({
  558. title: '退出登录',
  559. content: '确定要退出登录吗?',
  560. success: function(res) {
  561. if (res.confirm) {
  562. uni.clearStorageSync()
  563. uni.reLaunch({ url: '/pages/login/login' })
  564. }
  565. }
  566. })
  567. },
  568. goToCheckin() {
  569. uni.navigateTo({ url: '/pages/wealth-sub/checkin' })
  570. },
  571. goToInsurance() {
  572. uni.navigateTo({ url: '/pages/wealth-sub/insurance-list' })
  573. },
  574. goToInsuranceList: function() {
  575. uni.navigateTo({ url: '/pages/wealth-sub/insurance-list' })
  576. },
  577. goToCreator() {
  578. uni.navigateTo({ url: '/pages/promotion/index' })
  579. },
  580. goToShop() {
  581. uni.navigateTo({ url: '/pages/shop/index/index' })
  582. },
  583. goToOrders() {
  584. uni.navigateTo({ url: '/pages/shop/order-list/order-list' })
  585. },
  586. goToAfterSales() {
  587. uni.navigateTo({ url: '/pages/shop/after-sales/after-sales' })
  588. },
  589. goToIncome() {
  590. uni.navigateTo({ url: '/pages/promotion/commission' })
  591. },
  592. goToFamilyCf() {
  593. uni.navigateTo({ url: '/pages/wealth-cf/index' })
  594. },
  595. goToAchievements() {
  596. uni.navigateTo({ url: '/pages/rewards/badge' })
  597. },
  598. goToNetwork() {
  599. uni.navigateTo({ url: '/pages/promotion/team' })
  600. },
  601. goToCart() {
  602. uni.navigateTo({ url: '/pages/shop/cart/cart' })
  603. },
  604. loadGuestProducts() {
  605. var self = this
  606. productList({ page: 1, size: 4, sort: 'sales' }).then(function(res) {
  607. if (res.code === 200 && res.data && res.data.records) {
  608. self.guestProducts = res.data.records.slice(0, 4)
  609. }
  610. }).catch(function() {})
  611. },
  612. goProductDetail(id) {
  613. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + id })
  614. },
  615. getImageUrl: function(path) {
  616. return config.API_BASE_URL + path
  617. },
  618. onServiceClick(action) {
  619. if (this[action]) {
  620. this[action]()
  621. }
  622. }
  623. }
  624. }
  625. </script>
  626. .view-toggle {
  627. display: flex;
  628. margin: 20rpx 30rpx;
  629. background: rgba(255,255,255,0.12);
  630. border-radius: 12rpx;
  631. padding: 6rpx;
  632. }
  633. .toggle-btn {
  634. flex: 1;
  635. text-align: center;
  636. padding: 12rpx 0;
  637. border-radius: 8rpx;
  638. font-size: 26rpx;
  639. color: rgba(255,255,255,0.65);
  640. }
  641. .toggle-btn.active {
  642. background: rgba(255,255,255,0.22);
  643. color: #fff;
  644. font-weight: 600;
  645. }
  646. /* 页面说明 */
  647. .section-sub {
  648. font-size: 22rpx;
  649. color: rgba(255,255,255,0.55);
  650. margin-top: 6rpx;
  651. display: block;
  652. }
  653. /* 得分解读卡片 */
  654. .score-explain-card {
  655. margin: 20rpx 30rpx;
  656. padding: 28rpx 24rpx;
  657. background: rgba(255,255,255,0.1);
  658. border-radius: 20rpx;
  659. border: 1rpx solid rgba(255,255,255,0.15);
  660. }
  661. .explain-header {
  662. display: flex;
  663. align-items: center;
  664. margin-bottom: 14rpx;
  665. }
  666. .explain-icon {
  667. font-size: 36rpx;
  668. margin-right: 10rpx;
  669. }
  670. .explain-title {
  671. font-size: 28rpx;
  672. font-weight: 600;
  673. color: #fff;
  674. }
  675. .explain-text {
  676. font-size: 26rpx;
  677. color: rgba(255,255,255,0.8);
  678. line-height: 1.6;
  679. }
  680. <style scoped>
  681. .container {
  682. min-height: 100vh;
  683. background: #f5f7fa;
  684. padding-bottom: 120rpx;
  685. }
  686. .section {
  687. margin: 20rpx 30rpx;
  688. }
  689. .section-header {
  690. display: flex;
  691. justify-content: space-between;
  692. align-items: center;
  693. margin-bottom: 20rpx;
  694. }
  695. .section-title {
  696. font-size: 30rpx;
  697. font-weight: bold;
  698. color: #333;
  699. }
  700. .section-more {
  701. font-size: 24rpx;
  702. color: #999;
  703. }
  704. /* 财富成长 */
  705. .stream-section {
  706. background: #fff;
  707. border-radius: 20rpx;
  708. padding: 24rpx;
  709. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  710. }
  711. .stream-stages {
  712. display: flex;
  713. justify-content: space-between;
  714. margin-bottom: 20rpx;
  715. }
  716. .stage-card {
  717. flex: 1;
  718. margin: 0 8rpx;
  719. padding: 20rpx;
  720. border-radius: 16rpx;
  721. background: #F5F9FC;
  722. display: flex;
  723. flex-direction: column;
  724. align-items: center;
  725. }
  726. .stage-card.active {
  727. background: #FFF7ED;
  728. border: 2rpx solid #FBBF24;
  729. }
  730. .stage-icon {
  731. font-size: 44rpx;
  732. }
  733. .stage-name {
  734. font-size: 26rpx;
  735. font-weight: bold;
  736. color: #333;
  737. margin-top: 8rpx;
  738. }
  739. .stage-desc {
  740. font-size: 20rpx;
  741. color: #999;
  742. margin-top: 4rpx;
  743. }
  744. .stage-range {
  745. font-size: 20rpx;
  746. color: #F59E0B;
  747. margin-top: 4rpx;
  748. }
  749. .stream-water {
  750. height: 20rpx;
  751. border-radius: 10rpx;
  752. background: #FEF3C7;
  753. overflow: hidden;
  754. }
  755. .stream-water-fill {
  756. height: 100%;
  757. border-radius: 10rpx;
  758. background: linear-gradient(90deg, #F59E0B, #FBBF24);
  759. transition: width 0.8s ease;
  760. }
  761. .stream-percent {
  762. display: block;
  763. text-align: right;
  764. font-size: 22rpx;
  765. color: #F59E0B;
  766. margin-top: 8rpx;
  767. }
  768. .stream-tip {
  769. display: block;
  770. text-align: center;
  771. font-size: 24rpx;
  772. color: #92400E;
  773. margin-top: 12rpx;
  774. }
  775. /* 财富数据主卡 */
  776. .disc-card {
  777. background: linear-gradient(135deg, #FFF7ED, #FEF3C7);
  778. border-radius: 20rpx;
  779. padding: 30rpx;
  780. margin-bottom: 16rpx;
  781. display: flex;
  782. flex-direction: column;
  783. }
  784. .disc-label {
  785. font-size: 26rpx;
  786. color: #92400E;
  787. }
  788. .disc-value {
  789. font-size: 56rpx;
  790. font-weight: bold;
  791. color: #F59E0B;
  792. margin-top: 8rpx;
  793. }
  794. .disc-sub {
  795. font-size: 24rpx;
  796. color: #B45309;
  797. margin-top: 8rpx;
  798. }
  799. .disc-sub-row {
  800. display: flex;
  801. margin-bottom: 16rpx;
  802. }
  803. .disc-sub-card {
  804. flex: 1;
  805. background: #fff;
  806. border-radius: 16rpx;
  807. padding: 24rpx;
  808. display: flex;
  809. flex-direction: column;
  810. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  811. }
  812. .disc-sub-card:first-child {
  813. margin-right: 8rpx;
  814. }
  815. .disc-sub-card:last-child {
  816. margin-left: 8rpx;
  817. }
  818. .disc-sub-label {
  819. font-size: 24rpx;
  820. color: #999;
  821. }
  822. .disc-sub-value {
  823. font-size: 36rpx;
  824. font-weight: bold;
  825. color: #333;
  826. margin-top: 8rpx;
  827. }
  828. .disc-sub-action {
  829. font-size: 22rpx;
  830. color: #F59E0B;
  831. margin-top: 8rpx;
  832. }
  833. /* 孩子财富卡 */
  834. .child-wealth-card {
  835. display: flex;
  836. background: #fff;
  837. border-radius: 20rpx;
  838. padding: 24rpx 0;
  839. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  840. }
  841. .child-wealth-item {
  842. flex: 1;
  843. display: flex;
  844. flex-direction: column;
  845. align-items: center;
  846. }
  847. .child-wealth-icon {
  848. font-size: 44rpx;
  849. }
  850. .child-wealth-value {
  851. font-size: 36rpx;
  852. font-weight: bold;
  853. color: #F59E0B;
  854. margin-top: 8rpx;
  855. }
  856. .child-wealth-label {
  857. font-size: 22rpx;
  858. color: #999;
  859. margin-top: 4rpx;
  860. }
  861. .child-trend {
  862. margin-top: 16rpx;
  863. background: #fff;
  864. border-radius: 20rpx;
  865. padding: 24rpx;
  866. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  867. }
  868. .child-trend-title {
  869. font-size: 26rpx;
  870. color: #333;
  871. font-weight: bold;
  872. }
  873. .child-trend-bars {
  874. display: flex;
  875. align-items: flex-end;
  876. height: 120rpx;
  877. margin-top: 16rpx;
  878. }
  879. .trend-bar {
  880. flex: 1;
  881. margin: 0 6rpx;
  882. background: linear-gradient(180deg, #FBBF24, #F59E0B);
  883. border-radius: 6rpx 6rpx 0 0;
  884. }
  885. .child-trend-days {
  886. display: flex;
  887. margin-top: 8rpx;
  888. }
  889. .trend-day {
  890. flex: 1;
  891. text-align: center;
  892. font-size: 20rpx;
  893. color: #999;
  894. }
  895. /* 服务入口 */
  896. .service-grid {
  897. display: flex;
  898. flex-wrap: wrap;
  899. background: #fff;
  900. border-radius: 20rpx;
  901. padding: 24rpx 16rpx;
  902. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  903. }
  904. .service-item {
  905. width: 25%;
  906. display: flex;
  907. flex-direction: column;
  908. align-items: center;
  909. padding: 16rpx 0;
  910. }
  911. .service-icon-wrap {
  912. width: 88rpx;
  913. height: 88rpx;
  914. border-radius: 24rpx;
  915. background: #FFF7ED;
  916. display: flex;
  917. align-items: center;
  918. justify-content: center;
  919. margin-bottom: 8rpx;
  920. }
  921. .service-icon {
  922. font-size: 40rpx;
  923. }
  924. .service-label {
  925. font-size: 22rpx;
  926. color: #666;
  927. }
  928. .logout-item {
  929. color: #EF4444;
  930. }
  931. /* 未登录 */
  932. .login-guide-section {
  933. display: flex;
  934. flex-direction: column;
  935. align-items: center;
  936. padding: 60rpx 40rpx;
  937. margin: 30rpx;
  938. background: #fff;
  939. border-radius: 20rpx;
  940. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  941. }
  942. .login-guide-text {
  943. font-size: 26rpx;
  944. color: #999;
  945. text-align: center;
  946. margin-bottom: 30rpx;
  947. line-height: 1.6;
  948. }
  949. .login-guide-section .login-btn {
  950. width: 60%;
  951. height: 80rpx;
  952. line-height: 80rpx;
  953. background: linear-gradient(135deg, #5B9BD5, #3A7CC4);
  954. color: #fff;
  955. font-size: 30rpx;
  956. font-weight: bold;
  957. border-radius: 40rpx;
  958. text-align: center;
  959. border: none;
  960. }
  961. .login-prompt .login-btn::after {
  962. border: none;
  963. }
  964. /* 品牌定位语 */
  965. .brand-strap {
  966. margin: 16rpx 30rpx 0;
  967. padding: 20rpx 28rpx;
  968. background: linear-gradient(135deg, #FFFBEB, rgba(245,158,11,0.12));
  969. border-radius: 16rpx;
  970. border-left: 4rpx solid #F59E0B;
  971. }
  972. .brand-strap-text {
  973. font-size: 26rpx;
  974. color: #92400E;
  975. font-weight: 500;
  976. }
  977. /* 商城精选预览 */
  978. .product-scroll {
  979. white-space: nowrap;
  980. padding: 0 30rpx;
  981. }
  982. .product-list {
  983. display: inline-flex;
  984. gap: 20rpx;
  985. }
  986. .product-card {
  987. width: 220rpx;
  988. flex-shrink: 0;
  989. background: #fff;
  990. border-radius: 16rpx;
  991. overflow: hidden;
  992. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  993. }
  994. .product-img {
  995. width: 220rpx;
  996. height: 220rpx;
  997. background: #f5f5f5;
  998. }
  999. .product-name {
  1000. display: block;
  1001. padding: 12rpx 12rpx 4rpx;
  1002. font-size: 24rpx;
  1003. color: #333;
  1004. overflow: hidden;
  1005. text-overflow: ellipsis;
  1006. white-space: nowrap;
  1007. }
  1008. .product-price {
  1009. display: block;
  1010. padding: 4rpx 12rpx 12rpx;
  1011. font-size: 26rpx;
  1012. font-weight: bold;
  1013. color: #F59E0B;
  1014. }
  1015. /* 保单管理 */
  1016. .insurance-card {
  1017. background: #fff;
  1018. border-radius: 20rpx;
  1019. padding: 24rpx;
  1020. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  1021. }
  1022. .insurance-empty {
  1023. display: flex;
  1024. flex-direction: column;
  1025. align-items: center;
  1026. padding: 40rpx 0;
  1027. }
  1028. .insurance-empty-icon { font-size: 60rpx; }
  1029. .insurance-empty-text { font-size: 24rpx; color: #999; margin-top: 12rpx; }
  1030. .insurance-item {
  1031. padding: 16rpx 0;
  1032. border-bottom: 1rpx solid #f5f5f5;
  1033. }
  1034. .insurance-item:last-child { border-bottom: none; }
  1035. .insurance-item-header {
  1036. display: flex;
  1037. justify-content: space-between;
  1038. align-items: center;
  1039. margin-bottom: 8rpx;
  1040. }
  1041. .insurance-item-name {
  1042. font-size: 26rpx;
  1043. font-weight: 600;
  1044. color: #333;
  1045. }
  1046. .insurance-item-status {
  1047. font-size: 20rpx;
  1048. padding: 4rpx 12rpx;
  1049. border-radius: 8rpx;
  1050. }
  1051. .insurance-item-status.status-active { background: #DCFCE7; color: #16A34A; }
  1052. .insurance-item-status.status-expired { background: #FEF2F2; color: #DC2626; }
  1053. .insurance-item-status.status-cancelled { background: #F5F5F5; color: #999; }
  1054. .insurance-item-row {
  1055. display: flex;
  1056. justify-content: space-between;
  1057. padding: 4rpx 0;
  1058. }
  1059. .insurance-item-label { font-size: 22rpx; color: #999; }
  1060. .insurance-item-value { font-size: 22rpx; color: #666; }
  1061. /* ===== 财富强项与提升卡片 ===== */
  1062. .wealth-insight {
  1063. background: #fff;
  1064. border-radius: 20rpx;
  1065. padding: 24rpx;
  1066. }
  1067. .insight-group {
  1068. margin-bottom: 16rpx;
  1069. }
  1070. .insight-group-title {
  1071. font-size: 26rpx;
  1072. font-weight: 600;
  1073. color: #333;
  1074. margin-bottom: 10rpx;
  1075. display: block;
  1076. }
  1077. .insight-item {
  1078. display: flex;
  1079. align-items: center;
  1080. padding: 12rpx 16rpx;
  1081. background: #FFFBEB;
  1082. border-radius: 12rpx;
  1083. margin-bottom: 8rpx;
  1084. }
  1085. .insight-item-name {
  1086. flex: 1;
  1087. font-size: 26rpx;
  1088. color: #333;
  1089. }
  1090. .insight-item-score {
  1091. font-size: 24rpx;
  1092. color: #666;
  1093. margin-right: 12rpx;
  1094. }
  1095. .insight-item-tag {
  1096. font-size: 20rpx;
  1097. padding: 4rpx 16rpx;
  1098. border-radius: 8rpx;
  1099. font-weight: 500;
  1100. }
  1101. .insight-item-tag.tag-strong {
  1102. background: #D1FAE5;
  1103. color: #059669;
  1104. }
  1105. .insight-item-tag.tag-improve {
  1106. background: #FEF3C7;
  1107. color: #D97706;
  1108. }
  1109. .insight-tip {
  1110. padding: 12rpx 16rpx;
  1111. background: #FFFBEB;
  1112. border-radius: 12rpx;
  1113. }
  1114. .insight-tip-text {
  1115. font-size: 22rpx;
  1116. color: #F59E0B;
  1117. }
  1118. </style>
  1119. /* 月度引导语 */
  1120. .monthly-guidance {
  1121. margin: 0 30rpx 20rpx;
  1122. background: linear-gradient(135deg, #FFFBEB, rgba(245,158,11,0.1));
  1123. border-radius: 16rpx;
  1124. padding: 20rpx 24rpx;
  1125. display: flex;
  1126. align-items: center;
  1127. gap: 12rpx;
  1128. }
  1129. .guidance-icon { font-size: 32rpx; flex-shrink: 0; }
  1130. .guidance-text { font-size: 26rpx; color: #F59E0B; font-weight: 500; }