index.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184
  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. } from '../../utils/api.js'
  238. import nav from '../../utils/nav.js'
  239. import config from '../../config.js'
  240. export default {
  241. components: { TabTransition, WealthEnergyRing, WealthSubScores, BodyWealthAlert, FamilyMemberStrip, FamilyEnergyBar, DimensionIntroCard, DimensionSubDims },
  242. data() {
  243. return {
  244. showTabTransition: true,
  245. isLoggedIn: false,
  246. role: 'parent',
  247. // 五维评分
  248. wealthScore: 0,
  249. // 子维度 - 利他创富四维(家长/孩子共用字段)
  250. wealthSkill: null,
  251. wealthAltruism: null,
  252. wealthIncome: null,
  253. wealthFx: null,
  254. // 子维度汇总(DimensionSubDims 用)
  255. wealthSubDims: [],
  256. // 身克富杠杆
  257. bodyWealthStatus: 'normal',
  258. bodyWealthMessage: '',
  259. // 财富数据
  260. wealthData: {
  261. totalEarnings: 0,
  262. availableAmount: 0,
  263. referralCount: 0,
  264. referralCode: ''
  265. },
  266. // 财富成长
  267. deltaPercent: 5.2,
  268. streamStages: [
  269. { key: 'start', icon: '💧', name: '起步', desc: '新人阶段', range: '0-30%' },
  270. { key: 'mid', icon: '🌊', name: '汇流', desc: '成长阶段', range: '30-70%' },
  271. { key: 'surge', icon: '🌊🌊', name: '奔涌', desc: '达人阶段', range: '70-100%' }
  272. ],
  273. // 孩子数据
  274. taskPercent: 0,
  275. badgeCount: 0,
  276. weekTrend: [30, 40, 35, 50, 60, 55, 70],
  277. weekDays: ['一', '二', '三', '四', '五', '六', '日'],
  278. // 服务列表
  279. serviceList: [
  280. { icon: '📝', label: '记账打卡', action: 'goToCheckin' },
  281. { icon: '🛡️', label: '保单管理', action: 'goToInsurance' },
  282. { icon: '🎨', label: '创客中心', action: 'goToCreator' },
  283. { icon: '🏪', label: '商城首页', action: 'goToShop' },
  284. { icon: '🛒', label: '购物车', action: 'goToCart' },
  285. { icon: '📋', label: '我的订单', action: 'goToOrders' },
  286. { icon: '🔄', label: '售后服务', action: 'goToAfterSales' },
  287. { icon: '📊', label: '收益中心', action: 'goToIncome' },
  288. { icon: '💎', label: '家庭CF值', action: 'goToFamilyCf' }
  289. ],
  290. children: [],
  291. familyMembersVisible: [],
  292. selectedMemberId: null,
  293. guestProducts: [],
  294. // 五维能量条数据
  295. sandboxData: null,
  296. dualDimension: null,
  297. // 保单列表
  298. insuranceList: [],
  299. insuranceLoaded: false,
  300. }
  301. },
  302. computed: {
  303. activeChildId() {
  304. if (this.role === 'child') {
  305. return uni.getStorageSync('currentChildId')
  306. }
  307. return ''
  308. },
  309. currentStage() {
  310. var s = this.wealthScore
  311. if (s >= 70) return 'surge'
  312. if (s >= 30) return 'mid'
  313. return 'start'
  314. },
  315. streamTip() {
  316. var s = this.wealthScore
  317. if (s >= 70) return '🎉 已是富足达人,继续引领全家成长!'
  318. if (s >= 30) return '💡 坚持分享,下一阶段"奔涌"在望'
  319. return '🌱 从今天开始,迈出创富第一步'
  320. },
  321. /** 财富强项:wealthSubDims 中得分 ≥75 的维度 */
  322. wealthStrengths() {
  323. var result = []
  324. for (var i = 0; i < this.wealthSubDims.length; i++) {
  325. var d = this.wealthSubDims[i]
  326. var s = Number(d.score)
  327. if (s >= 75) result.push({ label: d.label, score: s })
  328. }
  329. return result
  330. },
  331. /** 财富提升空间:wealthSubDims 中 0<得分<60 的维度 */
  332. wealthImproves() {
  333. var result = []
  334. for (var i = 0; i < this.wealthSubDims.length; i++) {
  335. var d = this.wealthSubDims[i]
  336. var s = Number(d.score)
  337. if (s > 0 && s < 60) result.push({ label: d.label, score: s })
  338. }
  339. return result
  340. }
  341. },
  342. onShow() {
  343. this.showTabTransition = true
  344. var token = uni.getStorageSync('token')
  345. if (!token) {
  346. this.isLoggedIn = false
  347. this.loadGuestProducts()
  348. this._watchPageReady()
  349. return
  350. }
  351. this.isLoggedIn = true
  352. var currentRole = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent'
  353. if (currentRole === 'teacher') {
  354. uni.redirectTo({ url: '/pages/teacher/teacher-profile' })
  355. return
  356. }
  357. this.role = currentRole
  358. this.loadChildren()
  359. this.loadWealthDetail()
  360. this.loadWealthData()
  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. if (codeRes && codeRes.code === 200 && codeRes.data) {
  511. this.wealthData.referralCode = codeRes.data.code || codeRes.data || ''
  512. }
  513. } catch (e) {
  514. console.error('获取邀请码失败', e)
  515. }
  516. try {
  517. var summaryRes = await getReferralSummary()
  518. if (summaryRes && summaryRes.code === 200 && summaryRes.data) {
  519. this.wealthData.referralCount = summaryRes.data.totalCount || summaryRes.data.count || 0
  520. }
  521. } catch (e) {
  522. console.error('获取邀请统计失败', e)
  523. }
  524. try {
  525. var commissionRes = await getCommissionSummary()
  526. if (commissionRes && commissionRes.code === 200 && commissionRes.data) {
  527. this.wealthData.totalEarnings = commissionRes.data.totalEarnings || 0
  528. this.wealthData.availableAmount = commissionRes.data.availableAmount || 0
  529. }
  530. } catch (e) {
  531. console.error('获取佣金统计失败', e)
  532. }
  533. },
  534. copyReferralCode() {
  535. if (!this.wealthData.referralCode) return
  536. uni.setClipboardData({
  537. data: this.wealthData.referralCode,
  538. success: function() {
  539. uni.showToast({ title: '邀请码已复制', icon: 'success' })
  540. }
  541. })
  542. },
  543. logout() {
  544. uni.showModal({
  545. title: '退出登录',
  546. content: '确定要退出登录吗?',
  547. success: function(res) {
  548. if (res.confirm) {
  549. uni.clearStorageSync()
  550. uni.reLaunch({ url: '/pages/login/login' })
  551. }
  552. }
  553. })
  554. },
  555. goToCheckin() {
  556. uni.navigateTo({ url: '/pages/wealth-sub/checkin' })
  557. },
  558. goToInsurance() {
  559. uni.navigateTo({ url: '/pages/wealth-sub/insurance-list' })
  560. },
  561. goToInsuranceList: function() {
  562. uni.navigateTo({ url: '/pages/wealth-sub/insurance-list' })
  563. },
  564. goToCreator() {
  565. uni.navigateTo({ url: '/pages/promotion/index' })
  566. },
  567. goToShop() {
  568. uni.navigateTo({ url: '/pages/shop/index/index' })
  569. },
  570. goToOrders() {
  571. uni.navigateTo({ url: '/pages/shop/order-list/order-list' })
  572. },
  573. goToAfterSales() {
  574. uni.navigateTo({ url: '/pages/shop/after-sales/after-sales' })
  575. },
  576. goToIncome() {
  577. uni.navigateTo({ url: '/pages/promotion/commission' })
  578. },
  579. goToFamilyCf() {
  580. uni.navigateTo({ url: '/pages/wealth-cf/index' })
  581. },
  582. goToAchievements() {
  583. uni.navigateTo({ url: '/pages/rewards/badge' })
  584. },
  585. goToNetwork() {
  586. uni.navigateTo({ url: '/pages/promotion/team' })
  587. },
  588. goToCart() {
  589. uni.navigateTo({ url: '/pages/shop/cart/cart' })
  590. },
  591. loadGuestProducts() {
  592. var self = this
  593. productList({ page: 1, size: 4, sort: 'sales' }).then(function(res) {
  594. if (res.code === 200 && res.data && res.data.records) {
  595. self.guestProducts = res.data.records.slice(0, 4)
  596. }
  597. }).catch(function() {})
  598. },
  599. goProductDetail(id) {
  600. uni.navigateTo({ url: '/pages/shop/detail/detail?id=' + id })
  601. },
  602. getImageUrl: function(path) {
  603. return config.API_BASE_URL + path
  604. },
  605. onServiceClick(action) {
  606. if (this[action]) {
  607. this[action]()
  608. }
  609. }
  610. }
  611. }
  612. </script>
  613. .view-toggle {
  614. display: flex;
  615. margin: 20rpx 30rpx;
  616. background: rgba(255,255,255,0.12);
  617. border-radius: 12rpx;
  618. padding: 6rpx;
  619. }
  620. .toggle-btn {
  621. flex: 1;
  622. text-align: center;
  623. padding: 12rpx 0;
  624. border-radius: 8rpx;
  625. font-size: 26rpx;
  626. color: rgba(255,255,255,0.65);
  627. }
  628. .toggle-btn.active {
  629. background: rgba(255,255,255,0.22);
  630. color: #fff;
  631. font-weight: 600;
  632. }
  633. /* 页面说明 */
  634. .section-sub {
  635. font-size: 22rpx;
  636. color: rgba(255,255,255,0.55);
  637. margin-top: 6rpx;
  638. display: block;
  639. }
  640. /* 得分解读卡片 */
  641. .score-explain-card {
  642. margin: 20rpx 30rpx;
  643. padding: 28rpx 24rpx;
  644. background: rgba(255,255,255,0.1);
  645. border-radius: 20rpx;
  646. border: 1rpx solid rgba(255,255,255,0.15);
  647. }
  648. .explain-header {
  649. display: flex;
  650. align-items: center;
  651. margin-bottom: 14rpx;
  652. }
  653. .explain-icon {
  654. font-size: 36rpx;
  655. margin-right: 10rpx;
  656. }
  657. .explain-title {
  658. font-size: 28rpx;
  659. font-weight: 600;
  660. color: #fff;
  661. }
  662. .explain-text {
  663. font-size: 26rpx;
  664. color: rgba(255,255,255,0.8);
  665. line-height: 1.6;
  666. }
  667. <style scoped>
  668. .container {
  669. min-height: 100vh;
  670. background: #f5f7fa;
  671. padding-bottom: 120rpx;
  672. }
  673. .section {
  674. margin: 20rpx 30rpx;
  675. }
  676. .section-header {
  677. display: flex;
  678. justify-content: space-between;
  679. align-items: center;
  680. margin-bottom: 20rpx;
  681. }
  682. .section-title {
  683. font-size: 30rpx;
  684. font-weight: bold;
  685. color: #333;
  686. }
  687. .section-more {
  688. font-size: 24rpx;
  689. color: #999;
  690. }
  691. /* 财富成长 */
  692. .stream-section {
  693. background: #fff;
  694. border-radius: 20rpx;
  695. padding: 24rpx;
  696. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  697. }
  698. .stream-stages {
  699. display: flex;
  700. justify-content: space-between;
  701. margin-bottom: 20rpx;
  702. }
  703. .stage-card {
  704. flex: 1;
  705. margin: 0 8rpx;
  706. padding: 20rpx;
  707. border-radius: 16rpx;
  708. background: #F5F9FC;
  709. display: flex;
  710. flex-direction: column;
  711. align-items: center;
  712. }
  713. .stage-card.active {
  714. background: #FFF7ED;
  715. border: 2rpx solid #FBBF24;
  716. }
  717. .stage-icon {
  718. font-size: 44rpx;
  719. }
  720. .stage-name {
  721. font-size: 26rpx;
  722. font-weight: bold;
  723. color: #333;
  724. margin-top: 8rpx;
  725. }
  726. .stage-desc {
  727. font-size: 20rpx;
  728. color: #999;
  729. margin-top: 4rpx;
  730. }
  731. .stage-range {
  732. font-size: 20rpx;
  733. color: #F59E0B;
  734. margin-top: 4rpx;
  735. }
  736. .stream-water {
  737. height: 20rpx;
  738. border-radius: 10rpx;
  739. background: #FEF3C7;
  740. overflow: hidden;
  741. }
  742. .stream-water-fill {
  743. height: 100%;
  744. border-radius: 10rpx;
  745. background: linear-gradient(90deg, #F59E0B, #FBBF24);
  746. transition: width 0.8s ease;
  747. }
  748. .stream-percent {
  749. display: block;
  750. text-align: right;
  751. font-size: 22rpx;
  752. color: #F59E0B;
  753. margin-top: 8rpx;
  754. }
  755. .stream-tip {
  756. display: block;
  757. text-align: center;
  758. font-size: 24rpx;
  759. color: #92400E;
  760. margin-top: 12rpx;
  761. }
  762. /* 财富数据主卡 */
  763. .disc-card {
  764. background: linear-gradient(135deg, #FFF7ED, #FEF3C7);
  765. border-radius: 20rpx;
  766. padding: 30rpx;
  767. margin-bottom: 16rpx;
  768. display: flex;
  769. flex-direction: column;
  770. }
  771. .disc-label {
  772. font-size: 26rpx;
  773. color: #92400E;
  774. }
  775. .disc-value {
  776. font-size: 56rpx;
  777. font-weight: bold;
  778. color: #F59E0B;
  779. margin-top: 8rpx;
  780. }
  781. .disc-sub {
  782. font-size: 24rpx;
  783. color: #B45309;
  784. margin-top: 8rpx;
  785. }
  786. .disc-sub-row {
  787. display: flex;
  788. margin-bottom: 16rpx;
  789. }
  790. .disc-sub-card {
  791. flex: 1;
  792. background: #fff;
  793. border-radius: 16rpx;
  794. padding: 24rpx;
  795. display: flex;
  796. flex-direction: column;
  797. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  798. }
  799. .disc-sub-card:first-child {
  800. margin-right: 8rpx;
  801. }
  802. .disc-sub-card:last-child {
  803. margin-left: 8rpx;
  804. }
  805. .disc-sub-label {
  806. font-size: 24rpx;
  807. color: #999;
  808. }
  809. .disc-sub-value {
  810. font-size: 36rpx;
  811. font-weight: bold;
  812. color: #333;
  813. margin-top: 8rpx;
  814. }
  815. .disc-sub-action {
  816. font-size: 22rpx;
  817. color: #F59E0B;
  818. margin-top: 8rpx;
  819. }
  820. /* 孩子财富卡 */
  821. .child-wealth-card {
  822. display: flex;
  823. background: #fff;
  824. border-radius: 20rpx;
  825. padding: 24rpx 0;
  826. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  827. }
  828. .child-wealth-item {
  829. flex: 1;
  830. display: flex;
  831. flex-direction: column;
  832. align-items: center;
  833. }
  834. .child-wealth-icon {
  835. font-size: 44rpx;
  836. }
  837. .child-wealth-value {
  838. font-size: 36rpx;
  839. font-weight: bold;
  840. color: #F59E0B;
  841. margin-top: 8rpx;
  842. }
  843. .child-wealth-label {
  844. font-size: 22rpx;
  845. color: #999;
  846. margin-top: 4rpx;
  847. }
  848. .child-trend {
  849. margin-top: 16rpx;
  850. background: #fff;
  851. border-radius: 20rpx;
  852. padding: 24rpx;
  853. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  854. }
  855. .child-trend-title {
  856. font-size: 26rpx;
  857. color: #333;
  858. font-weight: bold;
  859. }
  860. .child-trend-bars {
  861. display: flex;
  862. align-items: flex-end;
  863. height: 120rpx;
  864. margin-top: 16rpx;
  865. }
  866. .trend-bar {
  867. flex: 1;
  868. margin: 0 6rpx;
  869. background: linear-gradient(180deg, #FBBF24, #F59E0B);
  870. border-radius: 6rpx 6rpx 0 0;
  871. }
  872. .child-trend-days {
  873. display: flex;
  874. margin-top: 8rpx;
  875. }
  876. .trend-day {
  877. flex: 1;
  878. text-align: center;
  879. font-size: 20rpx;
  880. color: #999;
  881. }
  882. /* 邀请码复制条 */
  883. .referral-code-bar {
  884. display: flex;
  885. align-items: center;
  886. background: #fff;
  887. margin-top: 16rpx;
  888. border-radius: 16rpx;
  889. padding: 24rpx 30rpx;
  890. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  891. }
  892. .referral-code-label {
  893. font-size: 26rpx;
  894. color: #666;
  895. margin-right: 16rpx;
  896. }
  897. .referral-code-value {
  898. flex: 1;
  899. font-size: 30rpx;
  900. font-weight: bold;
  901. color: #F59E0B;
  902. letter-spacing: 2rpx;
  903. }
  904. .referral-code-copy {
  905. font-size: 24rpx;
  906. color: #fff;
  907. background: linear-gradient(135deg, #F59E0B, #FBBF24);
  908. padding: 8rpx 24rpx;
  909. border-radius: 20rpx;
  910. }
  911. /* 服务入口 */
  912. .service-grid {
  913. display: flex;
  914. flex-wrap: wrap;
  915. background: #fff;
  916. border-radius: 20rpx;
  917. padding: 24rpx 16rpx;
  918. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  919. }
  920. .service-item {
  921. width: 25%;
  922. display: flex;
  923. flex-direction: column;
  924. align-items: center;
  925. padding: 16rpx 0;
  926. }
  927. .service-icon-wrap {
  928. width: 88rpx;
  929. height: 88rpx;
  930. border-radius: 24rpx;
  931. background: #FFF7ED;
  932. display: flex;
  933. align-items: center;
  934. justify-content: center;
  935. margin-bottom: 8rpx;
  936. }
  937. .service-icon {
  938. font-size: 40rpx;
  939. }
  940. .service-label {
  941. font-size: 22rpx;
  942. color: #666;
  943. }
  944. .logout-item {
  945. color: #EF4444;
  946. }
  947. /* 未登录 */
  948. .login-guide-section {
  949. display: flex;
  950. flex-direction: column;
  951. align-items: center;
  952. padding: 60rpx 40rpx;
  953. margin: 30rpx;
  954. background: #fff;
  955. border-radius: 20rpx;
  956. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  957. }
  958. .login-guide-text {
  959. font-size: 26rpx;
  960. color: #999;
  961. text-align: center;
  962. margin-bottom: 30rpx;
  963. line-height: 1.6;
  964. }
  965. .login-guide-section .login-btn {
  966. width: 60%;
  967. height: 80rpx;
  968. line-height: 80rpx;
  969. background: linear-gradient(135deg, #5B9BD5, #3A7CC4);
  970. color: #fff;
  971. font-size: 30rpx;
  972. font-weight: bold;
  973. border-radius: 40rpx;
  974. text-align: center;
  975. border: none;
  976. }
  977. .login-prompt .login-btn::after {
  978. border: none;
  979. }
  980. /* 品牌定位语 */
  981. .brand-strap {
  982. margin: 16rpx 30rpx 0;
  983. padding: 20rpx 28rpx;
  984. background: linear-gradient(135deg, #FFFBEB, rgba(245,158,11,0.12));
  985. border-radius: 16rpx;
  986. border-left: 4rpx solid #F59E0B;
  987. }
  988. .brand-strap-text {
  989. font-size: 26rpx;
  990. color: #92400E;
  991. font-weight: 500;
  992. }
  993. /* 商城精选预览 */
  994. .product-scroll {
  995. white-space: nowrap;
  996. padding: 0 30rpx;
  997. }
  998. .product-list {
  999. display: inline-flex;
  1000. gap: 20rpx;
  1001. }
  1002. .product-card {
  1003. width: 220rpx;
  1004. flex-shrink: 0;
  1005. background: #fff;
  1006. border-radius: 16rpx;
  1007. overflow: hidden;
  1008. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  1009. }
  1010. .product-img {
  1011. width: 220rpx;
  1012. height: 220rpx;
  1013. background: #f5f5f5;
  1014. }
  1015. .product-name {
  1016. display: block;
  1017. padding: 12rpx 12rpx 4rpx;
  1018. font-size: 24rpx;
  1019. color: #333;
  1020. overflow: hidden;
  1021. text-overflow: ellipsis;
  1022. white-space: nowrap;
  1023. }
  1024. .product-price {
  1025. display: block;
  1026. padding: 4rpx 12rpx 12rpx;
  1027. font-size: 26rpx;
  1028. font-weight: bold;
  1029. color: #F59E0B;
  1030. }
  1031. /* 保单管理 */
  1032. .insurance-card {
  1033. background: #fff;
  1034. border-radius: 20rpx;
  1035. padding: 24rpx;
  1036. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  1037. }
  1038. .insurance-empty {
  1039. display: flex;
  1040. flex-direction: column;
  1041. align-items: center;
  1042. padding: 40rpx 0;
  1043. }
  1044. .insurance-empty-icon { font-size: 60rpx; }
  1045. .insurance-empty-text { font-size: 24rpx; color: #999; margin-top: 12rpx; }
  1046. .insurance-item {
  1047. padding: 16rpx 0;
  1048. border-bottom: 1rpx solid #f5f5f5;
  1049. }
  1050. .insurance-item:last-child { border-bottom: none; }
  1051. .insurance-item-header {
  1052. display: flex;
  1053. justify-content: space-between;
  1054. align-items: center;
  1055. margin-bottom: 8rpx;
  1056. }
  1057. .insurance-item-name {
  1058. font-size: 26rpx;
  1059. font-weight: 600;
  1060. color: #333;
  1061. }
  1062. .insurance-item-status {
  1063. font-size: 20rpx;
  1064. padding: 4rpx 12rpx;
  1065. border-radius: 8rpx;
  1066. }
  1067. .insurance-item-status.status-active { background: #DCFCE7; color: #16A34A; }
  1068. .insurance-item-status.status-expired { background: #FEF2F2; color: #DC2626; }
  1069. .insurance-item-status.status-cancelled { background: #F5F5F5; color: #999; }
  1070. .insurance-item-row {
  1071. display: flex;
  1072. justify-content: space-between;
  1073. padding: 4rpx 0;
  1074. }
  1075. .insurance-item-label { font-size: 22rpx; color: #999; }
  1076. .insurance-item-value { font-size: 22rpx; color: #666; }
  1077. /* ===== 财富强项与提升卡片 ===== */
  1078. .wealth-insight {
  1079. background: #fff;
  1080. border-radius: 20rpx;
  1081. padding: 24rpx;
  1082. }
  1083. .insight-group {
  1084. margin-bottom: 16rpx;
  1085. }
  1086. .insight-group-title {
  1087. font-size: 26rpx;
  1088. font-weight: 600;
  1089. color: #333;
  1090. margin-bottom: 10rpx;
  1091. display: block;
  1092. }
  1093. .insight-item {
  1094. display: flex;
  1095. align-items: center;
  1096. padding: 12rpx 16rpx;
  1097. background: #FFFBEB;
  1098. border-radius: 12rpx;
  1099. margin-bottom: 8rpx;
  1100. }
  1101. .insight-item-name {
  1102. flex: 1;
  1103. font-size: 26rpx;
  1104. color: #333;
  1105. }
  1106. .insight-item-score {
  1107. font-size: 24rpx;
  1108. color: #666;
  1109. margin-right: 12rpx;
  1110. }
  1111. .insight-item-tag {
  1112. font-size: 20rpx;
  1113. padding: 4rpx 16rpx;
  1114. border-radius: 8rpx;
  1115. font-weight: 500;
  1116. }
  1117. .insight-item-tag.tag-strong {
  1118. background: #D1FAE5;
  1119. color: #059669;
  1120. }
  1121. .insight-item-tag.tag-improve {
  1122. background: #FEF3C7;
  1123. color: #D97706;
  1124. }
  1125. .insight-tip {
  1126. padding: 12rpx 16rpx;
  1127. background: #FFFBEB;
  1128. border-radius: 12rpx;
  1129. }
  1130. .insight-tip-text {
  1131. font-size: 22rpx;
  1132. color: #F59E0B;
  1133. }
  1134. </style>
  1135. /* 月度引导语 */
  1136. .monthly-guidance {
  1137. margin: 0 30rpx 20rpx;
  1138. background: linear-gradient(135deg, #FFFBEB, rgba(245,158,11,0.1));
  1139. border-radius: 16rpx;
  1140. padding: 20rpx 24rpx;
  1141. display: flex;
  1142. align-items: center;
  1143. gap: 12rpx;
  1144. }
  1145. .guidance-icon { font-size: 32rpx; flex-shrink: 0; }
  1146. .guidance-text { font-size: 26rpx; color: #F59E0B; font-weight: 500; }