feat(mini): v4.0.8 客服卡片主包落地、定位误报修复,合伙人微信内预览保存海报
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '杜康好客',
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useLoad } from '@tarojs/taro';
|
||||
import PageShell from '../../components/PageShell';
|
||||
import { goLogin } from '../../lib/auth-nav';
|
||||
import { isLoggedIn } from '../../lib/api';
|
||||
|
||||
function goHome() {
|
||||
Taro.switchTab({ url: '/pages/home/index' }).catch(() => {
|
||||
Taro.reLaunch({ url: '/pages/home/index' });
|
||||
});
|
||||
}
|
||||
|
||||
function openOrder(orderId: string) {
|
||||
const detail = `/pages/order-detail/index?id=${encodeURIComponent(orderId)}`;
|
||||
if (!isLoggedIn()) {
|
||||
goLogin(detail);
|
||||
return;
|
||||
}
|
||||
Taro.redirectTo({ url: detail }).catch(() => {
|
||||
Taro.reLaunch({ url: detail });
|
||||
});
|
||||
}
|
||||
|
||||
/** 主包落地:客服卡片 / 外链打开分包页(订单详情)前先落到这里,避免白屏 */
|
||||
export default function OpenPage() {
|
||||
useLoad((query?: Record<string, string | undefined>) => {
|
||||
const orderId = String(query?.id || query?.orderId || '').trim();
|
||||
if (!orderId) {
|
||||
goHome();
|
||||
return;
|
||||
}
|
||||
openOrder(orderId);
|
||||
});
|
||||
|
||||
return (
|
||||
<PageShell variant="plain">
|
||||
<View className="u-empty">
|
||||
<Text>正在打开…</Text>
|
||||
</View>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
@@ -116,6 +116,7 @@ export default function OrderDetailPage() {
|
||||
const orderId = router.params.id ?? '';
|
||||
usePageView('order_detail_view', orderId ? { orderId } : undefined);
|
||||
const [order, setOrder] = useState<OrderDetail | null>(null);
|
||||
const [loadError, setLoadError] = useState('');
|
||||
const [confirming, setConfirming] = useState(false);
|
||||
const [latestTrack, setLatestTrack] = useState<OrderTrackNode | null>(null);
|
||||
const [estimatedArrival, setEstimatedArrival] = useState<OrderTrackEstimatedArrival | null>(null);
|
||||
@@ -147,14 +148,18 @@ export default function OrderDetailPage() {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!orderId) return;
|
||||
if (!orderId) {
|
||||
setLoadError('订单信息缺失');
|
||||
return;
|
||||
}
|
||||
request<OrderDetail>(`/trade/orders/${orderId}`)
|
||||
.then((data) => {
|
||||
setOrder(data);
|
||||
setLoadError('');
|
||||
void loadOrderTrack(data.delivery, data.status);
|
||||
applyLocalDeliveryHint(data, setLocalHintHtml);
|
||||
})
|
||||
.catch((e) => toast(e instanceof Error ? e.message : '加载失败'));
|
||||
.catch((e) => setLoadError(e instanceof Error ? e.message : '加载失败'));
|
||||
}, [orderId]);
|
||||
|
||||
useDidShow(() => {
|
||||
@@ -293,7 +298,9 @@ export default function OrderDetailPage() {
|
||||
/>
|
||||
<View className="sub-page-body">
|
||||
{!order ? (
|
||||
<View className="u-empty">加载中…</View>
|
||||
<View className="u-empty" onClick={loadError ? () => Taro.switchTab({ url: '/pages/home/index' }) : undefined}>
|
||||
<Text>{loadError || '加载中…'}</Text>
|
||||
</View>
|
||||
) : (
|
||||
<>
|
||||
<View className="order-card">
|
||||
|
||||
Reference in New Issue
Block a user