用户端“补发货”的bug修复

This commit is contained in:
2026-07-10 11:10:04 +08:00
parent 9c5cb69730
commit 7988a10241
2 changed files with 24 additions and 14 deletions
+2 -3
View File
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useState } from 'react';
import { Link, useNavigate, useParams, useSearchParams } from 'react-router-dom';
import { Link, useNavigate, useParams } from 'react-router-dom';
import AppImage from '@dukang/shared-ui/AppImage';
import AppToast from '../components/AppToast';
import { request } from '../lib/api';
@@ -118,7 +118,6 @@ function fullReceiverAddress(order: Order) {
export default function OrderDetailPage() {
const { id } = useParams();
const [params] = useSearchParams();
const navigate = useNavigate();
const [order, setOrder] = useState<Order | null>(null);
const [showCs, setShowCs] = useState(false);
@@ -126,7 +125,7 @@ export default function OrderDetailPage() {
const [shareToast, setShareToast] = useState('');
const [confirming, setConfirming] = useState(false);
const isReship = order?.orderType === 'RESHIPMENT' || params.get('type') === 'reship';
const isReship = order?.orderType === 'RESHIPMENT';
async function loadOrder() {
if (!id) return;
+22 -11
View File
@@ -20,9 +20,17 @@ const STATUS_LABEL: Record<string, string> = {
SHIPPING: '配送中',
PENDING_RECEIVE: '待收货',
COMPLETED: '已完成',
RESHIP: '补发中',
};
function isReshipOrder(order: Record<string, unknown>) {
return String(order.orderType) === 'RESHIPMENT';
}
function orderStatusLabel(order: Record<string, unknown>) {
if (isReshipOrder(order)) return '补发中';
return STATUS_LABEL[String(order.status)] || String(order.status);
}
export default function OrderListPage() {
const [params, setParams] = useSearchParams();
const tab = params.get('tab') || 'all';
@@ -38,18 +46,24 @@ export default function OrderListPage() {
<PageHeader title="我的订单" onBack={() => navigate('/mine')} />
<OrderStatusTabs tabs={TABS} active={tab} onChange={(key) => setParams({ tab: key })} />
{data.list.length === 0 && <div className="empty"></div>}
{data.list.map((o, i) => {
{data.list.map((o) => {
const items = (o.items as Array<Record<string, unknown>>) || [];
const item = items[0];
const isReshipDemo = i === 0 && tab === 'all';
const isReship = isReshipOrder(o);
const isPendingPay = String(o.status) === 'PENDING_PAY';
return (
<div key={String(o.id)} className="card">
<div className="card-row" style={{ marginBottom: 8 }}>
<span className="label-md text-muted">: {String(o.orderNo)}</span>
<span className="status-tag">{STATUS_LABEL[String(o.status)] || String(o.status)}</span>
<span className="label-md text-muted">
: {String(o.orderNo)}
{isReship && (
<span className="tag-reship" style={{ marginLeft: 8 }}>
</span>
)}
</span>
<span className="status-tag">{orderStatusLabel(o)}</span>
</div>
{isReshipDemo && <span className="tag-reship" style={{ marginBottom: 8, display: 'inline-block' }}></span>}
{item && (
<div className="card-row">
<AppImage
@@ -74,11 +88,8 @@ export default function OrderListPage() {
</button>
)}
<Link
to={`/orders/${o.id}${isReshipDemo ? '?type=reship' : ''}`}
className="btn btn-outline btn-pill"
>
{isReshipDemo ? '查看进度' : '查看详情'}
<Link to={`/orders/${o.id}`} className="btn btn-outline btn-pill">
</Link>
</div>
</div>