|
@@ -20,9 +20,9 @@
|
|
<NotifyFriendsDialog :info="tellInfo" :visible="showNotifyFriendsDialog" @update:visible="showNotifyFriendsDialog = false" />
|
|
<NotifyFriendsDialog :info="tellInfo" :visible="showNotifyFriendsDialog" @update:visible="showNotifyFriendsDialog = false" />
|
|
</div>
|
|
</div>
|
|
<Empty v-else class="record-container">
|
|
<Empty v-else class="record-container">
|
|
- <div>{{ giftEmptyInfo.defaultText }}</div>
|
|
|
|
|
|
+ <div>{{ computedGiftEmptyInfo.defaultText }}</div>
|
|
<button slot="button" class="btn-primary">
|
|
<button slot="button" class="btn-primary">
|
|
- {{ giftEmptyInfo.buttonText }}
|
|
|
|
|
|
+ {{ computedGiftEmptyInfo.buttonText }}
|
|
</button>
|
|
</button>
|
|
</Empty>
|
|
</Empty>
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
@@ -44,26 +44,79 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { onMounted, reactive, ref } from 'vue'
|
|
|
|
|
|
+import { computed, onMounted, reactive, ref } from 'vue'
|
|
import vueWaterfallEasy from 'vue-waterfall-easy'
|
|
import vueWaterfallEasy from 'vue-waterfall-easy'
|
|
import MyGiftRecord from './components/MyGiftRecord.vue'
|
|
import MyGiftRecord from './components/MyGiftRecord.vue'
|
|
import MyReceiveRecord from './components/MyReceiveRecord.vue'
|
|
import MyReceiveRecord from './components/MyReceiveRecord.vue'
|
|
import Empty from '@/components/common/Empty.vue'
|
|
import Empty from '@/components/common/Empty.vue'
|
|
import NotifyFriendsDialog from '@/components/dialog/NotifyFriendsDialog.vue'
|
|
import NotifyFriendsDialog from '@/components/dialog/NotifyFriendsDialog.vue'
|
|
-import { getGiftRecordList } from '@/api/modules/'
|
|
|
|
|
|
+import { getGiftRecordList, getUserAccountShow } from '@/api/modules/'
|
|
|
|
+import store from '@/store'
|
|
|
|
|
|
|
|
+const storeUser = store.state.user
|
|
|
|
+const { info } = storeUser
|
|
|
|
+const vipTime = ref({})
|
|
const activeName = ref('gift')
|
|
const activeName = ref('gift')
|
|
const showNotifyFriendsDialog = ref(false)
|
|
const showNotifyFriendsDialog = ref(false)
|
|
const giftList = ref([])
|
|
const giftList = ref([])
|
|
const receiveList = ref([])
|
|
const receiveList = ref([])
|
|
const tellInfo = ref({})
|
|
const tellInfo = ref({})
|
|
-const giftEmptyInfo = reactive({
|
|
|
|
- defaultText: '您当前不是超级订阅用户,需购买后赠送好友。',
|
|
|
|
- buttonText: '去购买'
|
|
|
|
|
|
+
|
|
|
|
+const computedGiftEmptyInfo = computed(() => {
|
|
|
|
+ let endTime = ''
|
|
|
|
+ if (vipTime.value.list && vipTime.value.list.length) {
|
|
|
|
+ vipTime.value.list.forEach((item) => {
|
|
|
|
+ if (item.name === '超级订阅') {
|
|
|
|
+ endTime = item.endTime
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if (info.vipStatus > 0) {
|
|
|
|
+ // 判断endTime与当前时间对比,是否小于一个月,如果小于一个月,则提示用户续费
|
|
|
|
+ if (endTime) {
|
|
|
|
+ const isOneMonthPassed = oneMonthPassed(endTime * 1000)
|
|
|
|
+ if (isOneMonthPassed) {
|
|
|
|
+ return {
|
|
|
|
+ defaultText: '您当前超级订阅即将到期,请续费后赠送好友。',
|
|
|
|
+ buttonText: '去续费'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ return {
|
|
|
|
+ defaultText: '您当前是超级订阅用户,立即去赠送好友。',
|
|
|
|
+ buttonText: '去赠送'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ return {
|
|
|
|
+ defaultText: '您当前不是超级订阅用户,需购买后赠送好友。',
|
|
|
|
+ buttonText: '去购买'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ return {
|
|
|
|
+ defaultText: '您当前不是超级订阅用户,需购买后赠送好友。',
|
|
|
|
+ buttonText: '去购买'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
+
|
|
const receiveEmptyInfo = reactive({
|
|
const receiveEmptyInfo = reactive({
|
|
defaultText: '暂无好友赠送记录'
|
|
defaultText: '暂无好友赠送记录'
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+function oneMonthPassed(givenDateString) {
|
|
|
|
+ const givenDate = new Date(givenDateString).getTime()
|
|
|
|
+ let currentDate = new Date()
|
|
|
|
+ // 增加一个月
|
|
|
|
+ currentDate.setMonth(currentDate.getMonth() + 1)
|
|
|
|
+ currentDate = new Date(currentDate).getTime()
|
|
|
|
+ // 比较增加一个月后的当前日期和给定日期
|
|
|
|
+ return currentDate >= givenDate
|
|
|
|
+}
|
|
|
|
+
|
|
function handleClick(tab, event) {
|
|
function handleClick(tab, event) {
|
|
console.log(tab, event)
|
|
console.log(tab, event)
|
|
}
|
|
}
|
|
@@ -104,9 +157,21 @@ async function getRecordList(type) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 获取超级订阅到期时间
|
|
|
|
+async function getSuperSubscriptionTime() {
|
|
|
|
+ const { error_code: code, error_msg: msg, data } = await getUserAccountShow()
|
|
|
|
+ if (code === 0) {
|
|
|
|
+ vipTime.value = data || {}
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this.$toast(msg)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
getRecordList('1')
|
|
getRecordList('1')
|
|
getRecordList('2')
|
|
getRecordList('2')
|
|
|
|
+ getSuperSubscriptionTime()
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
|
|
|