add: recycle product

This commit is contained in:
Timi
2026-11-08 20:06:15 +08:00
parent 585d8956bc
commit ad1787a035
22 changed files with 4284 additions and 8 deletions
+9 -2
View File
@@ -2,6 +2,7 @@ import { useUserStore } from "timi-web-api";
import EventRecordAPI from "@/api/EventRecordAPI";
import FulfillmentAPI from "@/api/FulfillmentAPI";
import RecycleAPI from "@/api/RecycleAPI";
import SalesOrderAPI from "@/api/SalesOrderAPI";
import { pendingNoticeEvents } from "@/utils/pendingNoticeEvents";
import { permissionCodes } from "@/utils/permission";
@@ -11,13 +12,16 @@ import { useCurrentStoreStore } from "./currentStoreStore";
export const usePendingNoticeStore = defineStore("pendingNotice", () => {
const userStore = useUserStore();
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, recycle: 0 });
let pendingRequestId = 0;
const pendingNoticeList = computed(() => {
const notices: { content: string; name: string; query: Record<string, string> }[] = [];
if (pendingCounts.fulfillment) {
notices.push({ content: `有 ${pendingCounts.fulfillment} 条履约待核销`, name: "OrderFulfillmentList", query: { status: "PENDING" } });
}
if (pendingCounts.recycle) {
notices.push({ content: `有 ${pendingCounts.recycle} 条回收兑换待核销`, name: "RecycleExchangeList", query: { status: "PENDING" } });
}
if (pendingCounts.fund) {
notices.push({ content: `有 ${pendingCounts.fund} 条资金流水待核销`, name: "FundRecordList", query: { status: "PENDING" } });
}
@@ -55,6 +59,9 @@ export const usePendingNoticeStore = defineStore("pendingNotice", () => {
if (userStore.hasPermissions(permissionCodes.eventRecord.read)) {
tasks.push(load("event", () => EventRecordAPI.list({ index: 0, size: 1, verificationStatus: "PENDING" })));
}
if (userStore.hasPermissions(permissionCodes.recycleExchange.query)) {
tasks.push(load("recycle", () => RecycleAPI.page({ index: 0, size: 1, status: "PENDING" })));
}
await Promise.all(tasks);
}
@@ -62,7 +69,7 @@ export const usePendingNoticeStore = defineStore("pendingNotice", () => {
() => [currentStoreStore.currentStoreId, userStore.loginUser.user?.id || userStore.loginUser.id || ""],
([, userId]) => {
pendingRequestId++;
Object.assign(pendingCounts, { fulfillment: 0, stock: 0, fund: 0, event: 0 });
Object.assign(pendingCounts, { fulfillment: 0, stock: 0, fund: 0, event: 0, recycle: 0 });
if (userId) {
void refreshPendingNotices();
}