diff --git a/components/order-actions.tsx b/components/order-actions.tsx index e3506ba..af354e7 100644 --- a/components/order-actions.tsx +++ b/components/order-actions.tsx @@ -10,17 +10,15 @@ import { XCircle, } from "lucide-react" import Link from "next/link" -import { useCallback, useEffect } from "react" +import { useCallback } from "react" import { Button } from "@/components/ui/button" import { acceptOrder, - acceptOrderAsActor, cancelPreAccept, confirmClose, payOrder, requestClose, } from "@/lib/api/orders" -import type { Actor } from "@/lib/policy/actor" import { notifyInfo, notifySuccess } from "@/lib/toast" import type { OrderStatus } from "@/lib/types" import { useAuthStore } from "@/store/auth" @@ -58,6 +56,8 @@ export default function OrderActions({ sessions.find((session) => session.type === "order" && session.orderId === orderId)?.id const status = order?.status ?? initialStatus + const isConsumer = order?.consumerId === currentUserId + const isPlayer = order?.playerId === currentUserId const handleDecision = useCallback( (okMessage: string, result: { decision: { ok: boolean; message?: string } }) => { @@ -71,28 +71,9 @@ export default function OrderActions({ [], ) - useEffect(() => { - if (!order) return - if (order.status !== "pending_accept") return - if (!order.shopId) return - if (dispatchMode !== "auto") return - - const timer = setTimeout(() => { - const systemActor: Actor = { - userId: order.playerId, - role: "player", - shopId: order.shopId, - } - const result = acceptOrderAsActor(orderId, systemActor) - handleDecision("系统已自动派单", result) - }, 3000) - - return () => clearTimeout(timer) - }, [dispatchMode, handleDecision, order, orderId]) - return (