event for notice bar
This commit is contained in:
@@ -1,25 +1,45 @@
|
|||||||
<template>
|
<template>
|
||||||
<t-notice-bar
|
<t-notice-bar
|
||||||
v-if="noticeContent"
|
v-if="noticeContent.length"
|
||||||
:key="noticeContent"
|
:key="noticeContent.join(',')"
|
||||||
class="pending-notice"
|
class="pending-notice"
|
||||||
theme="warning"
|
theme="warning"
|
||||||
:visible="true"
|
:visible="true"
|
||||||
direction="horizontal"
|
direction="vertical"
|
||||||
marquee
|
:content="1 < noticeContent.length ? noticeContent : noticeContent[0]"
|
||||||
:content="noticeContent"
|
@change="currentIndex = $event"
|
||||||
/>
|
@click="openNotice"
|
||||||
|
>
|
||||||
|
<template #suffix-icon>
|
||||||
|
<t-icon name="chevron-right" />
|
||||||
|
</template>
|
||||||
|
</t-notice-bar>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { usePendingNoticeStore } from "@/store/pendingNoticeStore";
|
import { usePendingNoticeStore } from "@/store/pendingNoticeStore";
|
||||||
|
|
||||||
const pendingNoticeStore = usePendingNoticeStore();
|
const pendingNoticeStore = usePendingNoticeStore();
|
||||||
const noticeContent = computed(() => pendingNoticeStore.pendingNoticeList.join(","));
|
const router = useRouter();
|
||||||
|
const currentIndex = ref(0);
|
||||||
|
const noticeContent = computed(() => pendingNoticeStore.pendingNoticeList.map(notice => notice.content));
|
||||||
|
|
||||||
|
watch(noticeContent, () => { currentIndex.value = 0; });
|
||||||
|
|
||||||
|
async function openNotice(): Promise<void> {
|
||||||
|
const notice = pendingNoticeStore.pendingNoticeList[currentIndex.value];
|
||||||
|
if (notice) {
|
||||||
|
await router.push({ name: notice.name, query: notice.query });
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.pending-notice {
|
.pending-notice {
|
||||||
margin-top: -1rem;
|
margin-top: -1rem;
|
||||||
|
|
||||||
|
:deep(.t-swiper-nav__dots) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -13,19 +13,19 @@ export const usePendingNoticeStore = defineStore("pendingNotice", () => {
|
|||||||
const currentStoreStore = useCurrentStoreStore();
|
const currentStoreStore = useCurrentStoreStore();
|
||||||
const pendingCounts = reactive({ fulfillment: 0, stock: 0, fund: 0, event: 0 });
|
const pendingCounts = reactive({ fulfillment: 0, stock: 0, fund: 0, event: 0 });
|
||||||
let pendingRequestId = 0;
|
let pendingRequestId = 0;
|
||||||
const pendingNoticeList = computed<string[]>(() => {
|
const pendingNoticeList = computed(() => {
|
||||||
const notices: string[] = [];
|
const notices: { content: string; name: string; query: Record<string, string> }[] = [];
|
||||||
if (pendingCounts.fulfillment) {
|
if (pendingCounts.fulfillment) {
|
||||||
notices.push(`有 ${pendingCounts.fulfillment} 条履约待核销`);
|
notices.push({ content: `有 ${pendingCounts.fulfillment} 条履约待核销`, name: "OrderFulfillmentList", query: { status: "PENDING" } });
|
||||||
}
|
}
|
||||||
if (pendingCounts.fund) {
|
if (pendingCounts.fund) {
|
||||||
notices.push(`有 ${pendingCounts.fund} 条资金流水待核销`);
|
notices.push({ content: `有 ${pendingCounts.fund} 条资金流水待核销`, name: "FundRecordList", query: { status: "PENDING" } });
|
||||||
}
|
}
|
||||||
if (pendingCounts.stock) {
|
if (pendingCounts.stock) {
|
||||||
notices.push(`有 ${pendingCounts.stock} 条履约等待库存`);
|
notices.push({ content: `有 ${pendingCounts.stock} 条履约等待库存`, name: "OrderFulfillmentList", query: { status: "WAITING_STOCK" } });
|
||||||
}
|
}
|
||||||
if (pendingCounts.event) {
|
if (pendingCounts.event) {
|
||||||
notices.push(`有 ${pendingCounts.event} 条事件待核销`);
|
notices.push({ content: `有 ${pendingCounts.event} 条事件待核销`, name: "EventRecordList", query: { verificationStatus: "PENDING", dateType: "all" } });
|
||||||
}
|
}
|
||||||
return notices;
|
return notices;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user