feat(worker-hall): 接单大厅支持内部打手可见订单已发布时长标签
This commit is contained in:
@@ -62,6 +62,7 @@ import {
|
||||
resolveHallRemainingQuantity,
|
||||
resolveHallRewardAmount,
|
||||
} from '@/utils/worker-product-name'
|
||||
import { formatDateTime, formatPublishedElapsedTime } from '@/utils/date-time'
|
||||
|
||||
type HallSummary = {
|
||||
pendingAcceptanceCount: number
|
||||
@@ -88,8 +89,16 @@ export default function WorkerHallPage() {
|
||||
const [failedImageKeys, setFailedImageKeys] = useState<Record<string | number, boolean>>({})
|
||||
const [confirmOpen, setConfirmOpen] = useState(false)
|
||||
const [grabConfirmEnabled, setGrabConfirmEnabled] = useState(isGrabConfirmEnabled)
|
||||
const [nowMs, setNowMs] = useState(() => Date.now())
|
||||
const loadMoreRef = useRef<HTMLDivElement | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setInterval(() => {
|
||||
setNowMs(Date.now())
|
||||
}, 30_000)
|
||||
return () => clearInterval(timer)
|
||||
}, [])
|
||||
|
||||
const categoriesQuery = useQuery({
|
||||
queryKey: ['worker-hall-categories'],
|
||||
queryFn: () => fetchWorkerHallCategories(),
|
||||
@@ -227,6 +236,7 @@ export default function WorkerHallPage() {
|
||||
setFailedImageKeys({})
|
||||
}, [allCategories.length, allIconUrl])
|
||||
const worker = profileQuery.data?.data.worker
|
||||
const isInternalWorker = worker?.workerType === 'internal'
|
||||
const activeCount = Number(profileQuery.data?.data.summary.activeOrderCount || 0)
|
||||
const pendingAcceptanceCount = hallSummaryQuery.data?.pendingAcceptanceCount || 0
|
||||
const problemCount = hallSummaryQuery.data?.problemCount || 0
|
||||
@@ -623,6 +633,16 @@ export default function WorkerHallPage() {
|
||||
: order.categoryName}
|
||||
</Tag>
|
||||
) : null}
|
||||
{isInternalWorker && order.publishedAt ? (
|
||||
<Tooltip title={`发布时间: ${formatDateTime(order.publishedAt)}`}>
|
||||
<Tag
|
||||
icon={<ClockCircleOutlined />}
|
||||
className="worker-hall-published-tag"
|
||||
>
|
||||
{formatPublishedElapsedTime(order.publishedAt, nowMs)}
|
||||
</Tag>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
{order.sharing?.enabled ? (
|
||||
<Tag color="purple" className="worker-hall-mobile-tag">
|
||||
拼单 {order.sharingProgress?.joinedQuantity || 0}/
|
||||
@@ -1047,6 +1067,16 @@ export default function WorkerHallPage() {
|
||||
? `${order.parentCategoryName} · ${order.categoryName}`
|
||||
: order.categoryName || '默认分类'}
|
||||
</Tag>
|
||||
{isInternalWorker && order.publishedAt ? (
|
||||
<Tooltip title={`发布时间: ${formatDateTime(order.publishedAt)}`}>
|
||||
<Tag
|
||||
icon={<ClockCircleOutlined />}
|
||||
className="worker-hall-published-tag"
|
||||
>
|
||||
{formatPublishedElapsedTime(order.publishedAt, nowMs)}
|
||||
</Tag>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
{order.sharing?.enabled ? <Tag color="purple">拼单</Tag> : null}
|
||||
{Number(order.timeoutMinutes || 0) > 0 ? (
|
||||
<Tag color="orange" icon={<ClockCircleOutlined />}>
|
||||
|
||||
Reference in New Issue
Block a user