Browse Source

fix: 赠送记录时间判断

Signed-off-by: tangshizhe <48740614+tangshizhe@users.noreply.github.com>
tangshizhe 4 months ago
parent
commit
1d6ddfa1a6
1 changed files with 11 additions and 2 deletions
  1. 11 2
      apps/bigmember_pc/src/views/gift-record/index.vue

+ 11 - 2
apps/bigmember_pc/src/views/gift-record/index.vue

@@ -51,7 +51,7 @@ import MyGiftRecord from './components/MyGiftRecord.vue'
 import MyReceiveRecord from './components/MyReceiveRecord.vue'
 import Empty from '@/components/common/Empty.vue'
 import NotifyFriendsDialog from '@/components/dialog/NotifyFriendsDialog.vue'
-import { getGiftRecordList, getUserAccountShow } from '@/api/modules/'
+import { getGiftRecordList, getSubDuration, getUserAccountShow } from '@/api/modules/'
 import store from '@/store'
 import examplePng from '@/assets/images/icon/sujudaochu.png'
 
@@ -71,6 +71,7 @@ const tellInfo = ref({})
 const maxCols = ref(3) // 初始化 maxCols 为 3
 const timer = ref(null)
 const lastWidth = ref(null) // 存储上一次的宽度值
+const subduration = ref({})
 
 const computedGiftEmptyInfo = computed(() => {
   let endTime = ''
@@ -84,7 +85,7 @@ const computedGiftEmptyInfo = computed(() => {
   if (info.vipStatus > 0) {
     // 判断endTime与当前时间对比,是否小于一个月,如果小于一个月,则提示用户续费
     if (endTime) {
-      const isOneMonthPassed = oneMonthPassed(endTime * 1000)
+      const isOneMonthPassed = !subduration.value?.gifted
       if (isOneMonthPassed) {
         return {
           defaultText: '您当前超级订阅即将到期,请续费后赠送好友。',
@@ -214,6 +215,13 @@ async function getRecordList(type) {
   }
 }
 
+async function getSubDurationEvent() {
+  const { error_code: code, data } = await getSubDuration()
+  if (code === 0) {
+    subduration.value = data || {}
+  }
+}
+
 // 获取超级订阅到期时间
 async function getSuperSubscriptionTime() {
   const { error_code: code, error_msg: msg, data } = await getUserAccountShow()
@@ -229,6 +237,7 @@ onMounted(() => {
   getRecordList('1')
   getRecordList('2')
   getSuperSubscriptionTime()
+  getSubDurationEvent()
 
   const resizeObserver = new ResizeObserver((entries) => {
     for (const entry of entries) {