index.vue 33 KB

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