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

fix(US-4.3): wave7 profile VIP status and renewal reminder - respect isVip for card display, add renewal banner when expiry within 7 days

liaoxg 5 месяцев назад
Родитель
Сommit
94ea34cc2a
1 измененных файлов с 48 добавлено и 11 удалено
  1. 48 11
      client/pages/profile/index.vue

+ 48 - 11
client/pages/profile/index.vue

@@ -6,6 +6,12 @@
       <text class="banner-arrow">›</text>
     </view>
 
+    <!-- US-4.3: Renewal reminder -->
+    <view v-if="isExpiringSoon" class="renewal-banner" @click="goPayment">
+      <text class="renewal-text">⏰ 您的会员即将到期,请及时续费</text>
+      <text class="renewal-arrow">›</text>
+    </view>
+
     <!-- User info card -->
     <view class="user-card" @click="goLogin">
       <view class="avatar">
@@ -17,7 +23,7 @@
     </view>
 
     <!-- VIP status -->
-    <view v-if="userStore.vipType === 'practitioner'" class="vip-card pro" @click="goPayment">
+    <view v-if="userStore.vipType === 'practitioner' && userStore.isVip" class="vip-card pro" @click="goPayment">
       <view class="vip-info">
         <text class="vip-title">能量师会员</text>
         <text class="vip-desc">
@@ -26,7 +32,7 @@
       </view>
       <text class="vip-action">续费</text>
     </view>
-    <view v-else-if="userStore.vipType === 'annual'" class="vip-card annual" @click="goUpgradePractitioner">
+    <view v-else-if="userStore.vipType === 'annual' && userStore.isVip" class="vip-card annual" @click="goUpgradePractitioner">
       <view class="vip-info">
         <text class="vip-title">C端会员</text>
         <text class="vip-desc">
@@ -88,11 +94,20 @@
 </template>
 
 <script setup>
-import { onShow } from '@dcloudio/uni-app'
+import { computed, onShow } from '@dcloudio/uni-app'
 import { useUserStore } from '@/stores/user'
 
 const userStore = useUserStore()
 
+// US-4.3: Renewal reminder if expiry within 7 days
+const isExpiringSoon = computed(() => {
+  if (!userStore.vipEndTime) return false
+  const expiry = new Date(userStore.vipEndTime)
+  const now = new Date()
+  const diffHours = (expiry - now) / (1000 * 60 * 60)
+  return diffHours > 0 && diffHours <= 7 * 24
+})
+
 onShow(() => {
   if (userStore.isLoggedIn) {
     userStore.fetchProfile()
@@ -206,12 +221,34 @@ function handleLogout() {
 .quota-value { font-size: 20px; font-weight: 700; color: #1F2937; }
 .quota-divider { width: 1px; height: 36px; background: #E5E7EB; }
 
-/* US-5.1 §13 profile incomplete banner */
-.banner {
-  background: #FEF3C7; border: 1px solid #FDE68A; border-radius: 10px;
-  padding: 10px 14px; margin-bottom: 12px;
-  display: flex; justify-content: space-between; align-items: center;
-}
-.banner-text { font-size: 13px; color: #92400E; flex: 1; }
-.banner-arrow { font-size: 18px; color: #92400E; margin-left: 8px; }
+  /* US-5.1 §13 profile incomplete banner */
+  .banner {
+    background: #FEF3C7; border: 1px solid #FDE68A; border-radius: 10px;
+    padding: 10px 14px; margin-bottom: 12px;
+    display: flex; justify-content: space-between; align-items: center;
+  }
+  .banner-text { font-size: 13px; color: #92400E; flex: 1; }
+  .banner-arrow { font-size: 18px; color: #92400E; margin-left: 8px; }
+
+  /* US-4.3 Renewal reminder */
+  .renewal-banner {
+    background: #FEF3C7;
+    border: 1px solid #FDE68A;
+    border-radius: 10px;
+    padding: 10px 14px;
+    margin-bottom: 12px;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+  }
+  .renewal-text {
+    font-size: 13px;
+    color: #92400E;
+    flex: 1;
+  }
+  .renewal-arrow {
+    font-size: 18px;
+    color: #92400E;
+    margin-left: 8px;
+  }
 </style>