index.vue 32 KB

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