import { useState } from 'react' import { Alert, Button, Card, Empty, Image, Pagination, Segmented, Space, Tag, Typography } from 'antd' import { Link, useNavigate } from 'react-router-dom' import { useCrashCategories, useCrashProducts } from '@/features/crash/api' import { useSessionStore } from '@/stores/session' import { formatMoney } from '@/shared/utils/format' export function CrashListPage() { const navigate = useNavigate() const user = useSessionStore(state => state.user) const [categoryId, setCategoryId] = useState() const [page, setPage] = useState(1) const categoriesQuery = useCrashCategories() const productsQuery = useCrashProducts({ category_id: categoryId, page, page_size: 12 }) const items = productsQuery.data?.items ?? [] return (
JIEYOU · 撞车商城 摸红商城 明码标价、下单即锁库存;支付后由客服接单处理,订单可在「我的撞车订单」查看。
共 {productsQuery.data?.total ?? 0}
({ value: item.id, label: item.name })), ]} onChange={value => { setCategoryId(Number(value) || undefined) setPage(1) }} /> {productsQuery.isError ? : null} {items.length === 0 && !productsQuery.isPending ? ( ) : (
{items.map(item => ( {item.cover_url ? ( {item.title} ) : null}
{item.title} {formatMoney(item.price_cent)} {item.original_price_cent > 0 ? ( {formatMoney(item.original_price_cent)} ) : null} {item.category_name || '未分类'} 0 ? 'blue' : 'default'}> {item.stock < 0 ? '不限量' : `库存 ${item.stock}`}
))}
)} {(productsQuery.data?.total ?? 0) > 12 ? ( setPage(next)} style={{ textAlign: 'center' }} /> ) : null} {!user ? ( 登录后可下单;下单需要完成实名认证。 ) : null}
) }