Просмотр исходного кода

feat: 个人中心添加会员中心/服务商中心入口及状态检测

User 3 месяцев назад
Родитель
Сommit
c5a02993e9
1 измененных файлов с 29 добавлено и 3 удалено
  1. 29 3
      zxyj-frontend/pages/profile/profile.vue

+ 29 - 3
zxyj-frontend/pages/profile/profile.vue

@@ -49,6 +49,16 @@
         <text>👨‍🏫 邀请规划师</text>
         <text>👨‍🏫 邀请规划师</text>
         <text class="arrow">›</text>
         <text class="arrow">›</text>
       </button>
       </button>
+      <!-- 会员中心(溪福俱乐部) -->
+      <view class="menu-item" @click="goToMembership">
+        <text>👑 会员中心</text>
+        <text class="arrow">›</text>
+      </view>
+      <!-- 服务商中心(仅已通过服务商可见) -->
+      <view class="menu-item" v-if="isVendor" @click="goToVendorCenter">
+        <text>🏪 服务商中心</text>
+        <text class="arrow">›</text>
+      </view>
       <view class="menu-item" @click="logout">
       <view class="menu-item" @click="logout">
         <text>🚪 退出登录</text>
         <text>🚪 退出登录</text>
         <text class="arrow">›</text>
         <text class="arrow">›</text>
@@ -78,7 +88,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { setPassword, verifyPassword, getChildren } from '../../utils/api.js'
+import { setPassword, verifyPassword, getChildren, vendorStatus } from '../../utils/api.js'
 
 
 export default {
 export default {
   data() {
   data() {
@@ -92,7 +102,8 @@ export default {
       confirmPassword: '',
       confirmPassword: '',
       children: [],
       children: [],
       isSwitchedChild: false,
       isSwitchedChild: false,
-      shareData: null
+      shareData: null,
+      isVendor: false
     }
     }
   },
   },
   onShareAppMessage() {
   onShareAppMessage() {
@@ -116,8 +127,9 @@ export default {
     this.role = currentRole
     this.role = currentRole
     this.hasPassword = !!uni.getStorageSync('passwordSet')
     this.hasPassword = !!uni.getStorageSync('passwordSet')
     // 获取切换标记
     // 获取切换标记
-    this.isSwitchedChild = uni.getStorageSync('isSwitchedChild') || false
+    this.isSwitchedChild = uni.getStorageSync('isSwitchedChild') || false
     this.loadChildren()
     this.loadChildren()
+    this.checkVendorStatus()
   },
   },
   methods: {
   methods: {
     async loadChildren() {
     async loadChildren() {
@@ -300,6 +312,20 @@ export default {
         uni.showToast({ title: e.message || '生成邀请失败', icon: 'none' })
         uni.showToast({ title: e.message || '生成邀请失败', icon: 'none' })
       }
       }
     },
     },
+    goToMembership() {
+      uni.showToast({ title: '即将上线', icon: 'none' })
+    },
+    goToVendorCenter() {
+      uni.navigateTo({ url: '/pages/vendor/center' })
+    },
+    async checkVendorStatus() {
+      try {
+        const res = await vendorStatus()
+        this.isVendor = res.data && res.data.vendorStatus === 'approved'
+      } catch (e) {
+        this.isVendor = false
+      }
+    },
     exitSwitch() {
     exitSwitch() {
       if (!this.isSwitchedChild) return
       if (!this.isSwitchedChild) return
       uni.showModal({
       uni.showModal({