mirror of
https://github.com/certd/certd.git
synced 2026-04-24 12:27:25 +08:00
chore: order count
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="mt-10 vip-active-modal">
|
<div class="mt-10 vip-active-modal">
|
||||||
<div v-if="todayOrderCount.enabled" class="order-count hidden md:flex">
|
<div v-if="todayOrderCount.enabled" class="order-count hidden md:flex">
|
||||||
<div class="status-item status-show">
|
<div v-for="(stage, index) in todayOrderCount.stages" :key="index" class="status-item" :class="{ 'status-show': TodayVipOrderCountRef.current === index }">
|
||||||
<div class="background">
|
<div class="background">
|
||||||
<img :src="todayOrderCount.bg" alt="" />
|
<img :src="stage.bg" alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col order-count-text weight-bold">
|
<div class="flex flex-col order-count-text weight-bold">
|
||||||
<div class="count-text ml-4 flex items-center">
|
<div class="count-text ml-4 flex items-center">
|
||||||
<fs-icon icon="noto:fire" class="fs-20 mr-2"></fs-icon>
|
<fs-icon icon="noto:fire" class="fs-20 mr-2"></fs-icon>
|
||||||
<span> 今日赞助 </span>
|
<span> 今日赞助 </span>
|
||||||
<span class="count-number color-red font-bold text-2xl ml-1 mr-1"> {{ todayOrderCount.orderCount }} </span>人,
|
<span class="count-number color-red font-bold text-2xl ml-1 mr-1"> {{ stage.orderCount }} </span>人,
|
||||||
<span> {{ todayOrderCount.title }} </span>
|
<span> {{ stage.title }} </span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -109,13 +109,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, reactive, ref } from "vue";
|
import { computed, nextTick, onMounted, reactive, Ref, ref } from "vue";
|
||||||
import { message, Modal } from "ant-design-vue";
|
import { message, Modal } from "ant-design-vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { useSettingStore } from "/@/store/settings";
|
import { useSettingStore } from "/@/store/settings";
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
|
import { utils } from "/@/utils";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -229,7 +230,7 @@ const vipTypeDefine: any = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const TodayVipOrderCountRef = ref();
|
const TodayVipOrderCountRef: Ref = ref({});
|
||||||
|
|
||||||
async function getTodayVipOrderCount() {
|
async function getTodayVipOrderCount() {
|
||||||
const res = await api.getTodayVipOrderCount();
|
const res = await api.getTodayVipOrderCount();
|
||||||
@@ -242,18 +243,35 @@ const todayOrderCount = computed(() => {
|
|||||||
const countInfo = TodayVipOrderCountRef.value;
|
const countInfo = TodayVipOrderCountRef.value;
|
||||||
const enabled = countInfo?.enabled || false;
|
const enabled = countInfo?.enabled || false;
|
||||||
const orderCount = countInfo?.orderCount || 0;
|
const orderCount = countInfo?.orderCount || 0;
|
||||||
const title = countInfo?.stage?.title || "";
|
for (const stage of countInfo?.stages) {
|
||||||
const bg = countInfo?.stage?.bg || "";
|
stage.orderCount = stage.countGe || 0;
|
||||||
|
}
|
||||||
|
const lastStage = countInfo?.stages?.[countInfo?.stages?.length - 1] || {};
|
||||||
|
lastStage.orderCount = orderCount;
|
||||||
return {
|
return {
|
||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
orderCount: orderCount,
|
orderCount: orderCount,
|
||||||
bg: bg,
|
title: lastStage.title || "",
|
||||||
title: title,
|
stages: countInfo?.stages,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function scrollOrderCount() {
|
||||||
|
const stages = todayOrderCount.value.stages;
|
||||||
|
if (!stages.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let index = 0;
|
||||||
|
for (const stage of stages) {
|
||||||
|
TodayVipOrderCountRef.value.current = index;
|
||||||
|
await utils.sleep(500);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
getTodayVipOrderCount();
|
await getTodayVipOrderCount();
|
||||||
|
await scrollOrderCount();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -313,7 +331,7 @@ onMounted(async () => {
|
|||||||
|
|
||||||
.status-item {
|
.status-item {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: all 0.5s ease-in-out;
|
transition: all 0.7s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-show {
|
.status-show {
|
||||||
|
|||||||
Reference in New Issue
Block a user