Parcourir la source

feat(profile): add 推广收益 icon to achievement grid, navigate to wealth center

asus il y a 1 mois
Parent
commit
c2e06f1dc7
1 fichiers modifiés avec 20 ajouts et 0 suppressions
  1. 20 0
      cfc-frontend/pages/profile-main/profile.vue

+ 20 - 0
cfc-frontend/pages/profile-main/profile.vue

@@ -150,6 +150,13 @@
             <text class="ach-num">{{ healthReports }}</text>
             <text class="ach-label">上传报告</text>
           </view>
+          <view class="ach-item" @click="goToWealthCenter">
+            <view class="ach-icon-wrap" style="background:rgba(245,158,11,0.12)">
+              <text class="ach-icon">💰</text>
+            </view>
+            <text class="ach-num">{{ referralEarnings }}</text>
+            <text class="ach-label">推广收益</text>
+          </view>
         </view>
       </view>
 
@@ -264,6 +271,7 @@ export default {
       memberLevel: null,
       membershipDays: 0,
       totalPoints: 0,
+      referralEarnings: 0,
       // 个人成就
       completedTasks: 0,
       streakDays: 0,
@@ -343,6 +351,7 @@ export default {
       this.loadOrderCounts()
       this.loadCartCount()
       this.loadProfileStats()
+      this.loadReferralEarnings()
     },
     loadUserInfo() {
       var self = this
@@ -438,6 +447,14 @@ export default {
         }
       }).catch(function() {})
     },
+    loadReferralEarnings() {
+      var self = this
+      getReferralSummary().then(function(res) {
+        if (res && res.code === 200 && res.data) {
+          self.referralEarnings = res.data.totalEarnings || 0
+        }
+      }).catch(function() {})
+    },
     loadUserIntent() {
       var self = this
       getUserIntent().then(function(res) {
@@ -500,6 +517,9 @@ export default {
     goToHealthReports: function() {
       uni.navigateTo({ url: '/pages/health/report-list' })
     },
+    goToWealthCenter: function() {
+      uni.navigateTo({ url: '/pages/promotion/index' })
+    },
     goUpgrade: function() {
       uni.navigateTo({ url: '/pages/membership/upgrade' })
     },