All checks were successful
Build and Deploy Front / deploy (push) Successful in 6m37s
将站点/API 默认值收敛到配置,避免再次全局改域名;同步 H5/PC 支付充值与助手浮层交互调整。 Co-authored-by: Cursor <cursoragent@cursor.com>
2633 lines
69 KiB
Vue
2633 lines
69 KiB
Vue
<template>
|
||
<div
|
||
class="h5-orders-page"
|
||
:class="{
|
||
'is-selection-mode': selectionMode,
|
||
'is-batch-mode': isBatchSelection,
|
||
'is-enter-anim': animateEnter,
|
||
'is-pulling': pullY > 0 || (loading && pullArmed),
|
||
}"
|
||
:style="{ '--pull-y': `${pullY}px` }"
|
||
@touchstart.passive="onTouchStart"
|
||
@touchmove.passive="onTouchMove"
|
||
@touchend="onTouchEnd"
|
||
>
|
||
<div
|
||
class="h5-orders-pull"
|
||
:class="{ 'is-ready': pullY > 48, 'is-loading': loading && pullArmed }"
|
||
>
|
||
{{ pullHint }}
|
||
</div>
|
||
|
||
<section v-if="isPickupSelection" class="h5-pickup-hero h5-enter">
|
||
<div class="h5-pickup-hero__top">
|
||
<button type="button" class="h5-pickup-hero__cancel" @click="exitSelectionMode">
|
||
<icon-left />
|
||
{{ t('h5.orders.mergePickup.cancel') }}
|
||
</button>
|
||
<div class="h5-pickup-hero__steps" aria-hidden="true">
|
||
<template v-if="selectionKind === 'create'">
|
||
<span class="is-active">{{ t('h5.orders.mergePickup.stepSelect') }}</span>
|
||
<i />
|
||
<span>{{ t('h5.orders.mergePickup.stepForm') }}</span>
|
||
</template>
|
||
<template v-else>
|
||
<span class="is-active">{{ t('h5.pickup.rebind.stepAdd') }}</span>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
<div class="h5-pickup-hero__body">
|
||
<img :src="iconOrderPickup" alt="" class="h5-pickup-hero__icon" draggable="false" />
|
||
<div class="h5-pickup-hero__text">
|
||
<h2>
|
||
{{
|
||
selectionKind === 'rebind'
|
||
? t('h5.pickup.rebind.heroTitle')
|
||
: t('h5.orders.mergePickup.heroTitle')
|
||
}}
|
||
</h2>
|
||
<p>
|
||
{{
|
||
selectionKind === 'rebind'
|
||
? t('h5.pickup.rebind.hint', { warehouse: rebindWarehouseName || '-' })
|
||
: t('h5.orders.mergePickup.hint')
|
||
}}
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="h5-pickup-hero__stats">
|
||
<span class="h5-pickup-hero__chip">
|
||
{{ t('h5.orders.mergePickup.selectableCount', { count: selectableCountOnPage }) }}
|
||
</span>
|
||
<span v-if="selectedCount > 0" class="h5-pickup-hero__chip is-primary">
|
||
{{ t('h5.orders.mergePickup.selected', { count: selectedCount }) }}
|
||
</span>
|
||
</div>
|
||
</section>
|
||
|
||
<template v-if="isLoggedIn">
|
||
<div
|
||
class="h5-orders-toolbar h5-orders-enter"
|
||
:class="{ 'is-pickup-mode': selectionMode }"
|
||
style="--h5-orders-delay: 0ms"
|
||
>
|
||
<div class="h5-orders-search">
|
||
<icon-search class="h5-orders-search__icon" />
|
||
<input
|
||
v-model="keyword"
|
||
class="h5-orders-search__input"
|
||
type="search"
|
||
enterkeyhint="search"
|
||
:placeholder="t('h5.orders.searchPlaceholder')"
|
||
@keyup.enter="reload"
|
||
/>
|
||
<button
|
||
v-if="keyword"
|
||
type="button"
|
||
class="h5-orders-search__clear"
|
||
aria-label="clear"
|
||
@click="keyword = ''; reload()"
|
||
>
|
||
×
|
||
</button>
|
||
</div>
|
||
<button type="button" class="h5-orders-search-btn" @click="reload">
|
||
{{ t('h5.orders.search') }}
|
||
</button>
|
||
<button
|
||
v-if="!isPickupSelection"
|
||
type="button"
|
||
class="h5-orders-batch-entry"
|
||
:class="{ 'is-on': isBatchSelection }"
|
||
@click="isBatchSelection ? exitSelectionMode() : enterBatchMode()"
|
||
>
|
||
{{ isBatchSelection ? t('h5.orders.batch.done') : t('h5.orders.batch.entry') }}
|
||
</button>
|
||
</div>
|
||
|
||
<div
|
||
v-if="!isPickupSelection"
|
||
class="h5-orders-tabs h5-orders-enter"
|
||
style="--h5-orders-delay: 40ms"
|
||
>
|
||
<button
|
||
v-for="group in groups"
|
||
:key="group.key"
|
||
type="button"
|
||
class="h5-orders-tab"
|
||
:class="{
|
||
'is-active': activeGroup === group.key,
|
||
'is-alert':
|
||
(group.key === 'actionNeeded' || group.key === 'issue') &&
|
||
groupCount(group) > 0,
|
||
}"
|
||
@click="activeGroup = group.key"
|
||
>
|
||
{{ t(group.labelKey) }}
|
||
<em v-if="groupCount(group) > 0">{{ groupCount(group) }}</em>
|
||
</button>
|
||
</div>
|
||
</template>
|
||
|
||
<div v-if="isBatchSelection" class="h5-batch-hint h5-enter">
|
||
<p>{{ t('h5.orders.batch.hint') }}</p>
|
||
<button type="button" class="h5-batch-hint__all" @click="toggleSelectAllPage">
|
||
{{ allPageSelected ? t('h5.orders.batch.unselectAll') : t('h5.orders.batch.selectAll') }}
|
||
</button>
|
||
</div>
|
||
|
||
<H5EmptyState v-if="loading && !orders.length" mode="loading" />
|
||
|
||
<a-spin :loading="loading && orders.length > 0" class="h5-orders-spin">
|
||
<H5EmptyState
|
||
v-if="!loading && !orders.length"
|
||
:icon="isLoggedIn ? IconTabPackage : IconLock"
|
||
:text="
|
||
!isLoggedIn
|
||
? t('h5.orders.guestEmpty')
|
||
: isPickupSelection
|
||
? t('h5.orders.mergePickup.emptyPredeclared')
|
||
: t('h5.orders.emptyLead')
|
||
"
|
||
>
|
||
<template v-if="!isLoggedIn">
|
||
<H5GuestAuthCta
|
||
:register-label="t('h5.orders.guestRegister')"
|
||
:login-label="t('h5.orders.guestLogin')"
|
||
:extra-label="t('h5.orders.emptyGoPrice')"
|
||
@register="promptGuestRegister"
|
||
@login="promptGuestLogin"
|
||
@extra="h5Navigate(router, '/h5/price')"
|
||
/>
|
||
</template>
|
||
<a-button
|
||
v-else-if="!selectionMode"
|
||
type="primary"
|
||
class="app-btn-primary-soft"
|
||
@click="h5Navigate(router, '/h5/price')"
|
||
>
|
||
{{ t('h5.orders.emptyGoPrice') }}
|
||
</a-button>
|
||
<a-button v-else @click="exitSelectionMode">
|
||
{{ t('h5.orders.mergePickup.cancel') }}
|
||
</a-button>
|
||
</H5EmptyState>
|
||
|
||
<template
|
||
v-for="(row, index) in orders"
|
||
:key="selectionMode ? `pick-${row.id || row.waybillNo}` : row.id || row.waybillNo"
|
||
>
|
||
<article
|
||
v-if="selectionMode"
|
||
class="h5-pickup-card h5-enter"
|
||
:class="{
|
||
'is-selected': isRowSelected(row),
|
||
'is-disabled': !rowSelectable(row).ok,
|
||
}"
|
||
:style="{ animationDelay: `${70 + Math.min(index, 6) * 36}ms` }"
|
||
@click="onCardClick(row)"
|
||
>
|
||
<span
|
||
class="h5-pickup-card__check"
|
||
:class="{
|
||
'is-checked': isRowSelected(row),
|
||
'is-disabled': !rowSelectable(row).ok,
|
||
}"
|
||
>
|
||
<icon-check v-if="isRowSelected(row)" />
|
||
</span>
|
||
<div class="h5-pickup-card__main">
|
||
<div class="h5-pickup-card__row">
|
||
<strong>{{ row.waybillNo || row.customerOrderNo || '-' }}</strong>
|
||
<span class="h5-pickup-card__status" :style="statusStyle(row)">{{ statusLabel(row) }}</span>
|
||
</div>
|
||
<p v-if="isBatchSelection || pickupSelectable(row).ok" class="h5-pickup-card__meta">
|
||
{{ warehouseLabel(row) }}
|
||
<i aria-hidden="true">→</i>
|
||
{{ countryLabel(row) || countryCode(row) || '-' }}
|
||
</p>
|
||
<p v-else class="h5-pickup-card__reason">{{ pickupReasonLabel(row) }}</p>
|
||
</div>
|
||
</article>
|
||
|
||
<article
|
||
v-else
|
||
class="h5-order-card h5-enter"
|
||
:style="{ animationDelay: `${70 + Math.min(index, 6) * 36}ms` }"
|
||
@click="onCardClick(row)"
|
||
>
|
||
<!-- 顶栏:渠道 + 单号(左上) -->
|
||
<div class="h5-order-top">
|
||
<button
|
||
type="button"
|
||
class="h5-order-no"
|
||
@click.stop="copyText(row.waybillNo || row.customerOrderNo)"
|
||
>
|
||
<span class="h5-order-no__text">
|
||
<template v-if="channelLabel(row)">{{ channelLabel(row) }}: </template>{{
|
||
row.waybillNo || row.customerOrderNo || row.trackingNo || '-'
|
||
}}
|
||
</span>
|
||
<icon-copy class="h5-order-no__copy" />
|
||
</button>
|
||
</div>
|
||
|
||
<!-- 主视觉:发件 → 进度 → 收件 -->
|
||
<div class="h5-order-route">
|
||
<div class="h5-order-route__end">
|
||
<strong>{{ senderCityLabel(row) }}</strong>
|
||
<em>{{ senderNameLabel(row) }}</em>
|
||
</div>
|
||
<div class="h5-order-route__mid">
|
||
<span class="h5-order-route__progress" aria-hidden="true">
|
||
<i :class="{ 'is-done': routeProgress(row) >= 1 }" />
|
||
<i :class="{ 'is-done': routeProgress(row) >= 2 }" />
|
||
<i :class="{ 'is-done': routeProgress(row) >= 3 }" />
|
||
</span>
|
||
<em class="h5-order-route__status" :style="statusTextStyle(row)">{{
|
||
isFulfillOrder(row) && fulfillProgressText(row)
|
||
? fulfillProgressText(row)
|
||
: statusLabel(row)
|
||
}}</em>
|
||
<span
|
||
v-if="isFulfillOrder(row) && row.domesticTrackingNos"
|
||
class="h5-order-route__domestic"
|
||
>
|
||
{{ t('h5.orders.fulfill.domestic') }} {{ row.domesticTrackingNos }}
|
||
</span>
|
||
</div>
|
||
<div class="h5-order-route__end h5-order-route__end--dest">
|
||
<strong>{{ countryLabel(row) || countryCode(row) || '-' }}</strong>
|
||
<em>{{ consigneeLabel(row) || '-' }}</em>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 底栏:时间(左下) + 金额/主操作(右下) -->
|
||
<div class="h5-order-foot">
|
||
<div class="h5-order-foot__time">
|
||
<span v-if="routeTimeText(row)" class="h5-order-time">{{ routeTimeText(row) }}</span>
|
||
<span
|
||
v-if="signVsEtaTip(row)"
|
||
class="h5-order-eta-tip"
|
||
:class="'is-' + (signVsEtaTip(row)?.tone || '')"
|
||
>
|
||
{{ signVsEtaTip(row)?.text }}
|
||
</span>
|
||
</div>
|
||
<div class="h5-order-foot__action" @click.stop>
|
||
<span v-if="isPendingPay(row)" class="h5-order-amount">
|
||
<small>{{ t('h5.orders.payable') }}</small>
|
||
<em>¥{{ formatMoney(row.receivableAmount) }}</em>
|
||
</span>
|
||
<span v-else-if="row.isPaid" class="h5-order-amount is-paid">
|
||
{{ t('h5.orders.paid') }}
|
||
</span>
|
||
<button
|
||
v-if="isPendingPay(row)"
|
||
type="button"
|
||
class="primary-btn primary-btn--danger"
|
||
@click="openPay(row)"
|
||
>
|
||
{{ t('h5.orders.pay') }}
|
||
</button>
|
||
<button
|
||
v-else-if="isShipping(row)"
|
||
type="button"
|
||
class="primary-btn"
|
||
@click="goDetail(row, 'track')"
|
||
>
|
||
{{ t('h5.orders.track') }}
|
||
</button>
|
||
<button
|
||
v-else-if="isIssue(row)"
|
||
type="button"
|
||
class="primary-btn primary-btn--warn"
|
||
@click="askAdvisor(row)"
|
||
>
|
||
{{ t('h5.orders.askAdvisor') }}
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</article>
|
||
</template>
|
||
|
||
<a-button
|
||
v-if="hasMore"
|
||
long
|
||
class="h5-orders-more"
|
||
:loading="loadingMore"
|
||
@click="loadMore"
|
||
>
|
||
{{ t('h5.orders.loadMore') }}
|
||
</a-button>
|
||
</a-spin>
|
||
|
||
<H5OrderPaySheet
|
||
v-model:visible="payVisible"
|
||
:orders="payOrders"
|
||
:oauth-code="payOauthCode"
|
||
@success="onPaySuccess"
|
||
@fail="onPayFail"
|
||
/>
|
||
|
||
<H5OrderDetailSheet
|
||
v-if="detailVisible"
|
||
v-model:visible="detailVisible"
|
||
:order-id="detailOrderId"
|
||
:initial-tab="detailTab"
|
||
@paid="onPaySuccess"
|
||
@edit="openEditFromDetail"
|
||
/>
|
||
|
||
<H5PlaceOrderSheet
|
||
v-if="editVisible"
|
||
v-model:visible="editVisible"
|
||
:order-id="editOrderId"
|
||
@success="onEditSuccess"
|
||
/>
|
||
|
||
<div v-if="isPickupSelection" class="h5-orders-pickup-bar">
|
||
<div class="h5-orders-pickup-bar__summary">
|
||
<span class="h5-orders-pickup-bar__count">{{ selectedCount }}</span>
|
||
<div class="h5-orders-pickup-bar__text">
|
||
<strong>
|
||
{{
|
||
selectedWarehouseLabel
|
||
? t('h5.orders.mergePickup.selectedWithWarehouse', {
|
||
count: selectedCount,
|
||
warehouse: selectedWarehouseLabel,
|
||
})
|
||
: t('h5.orders.mergePickup.selected', { count: selectedCount })
|
||
}}
|
||
</strong>
|
||
<em>
|
||
{{
|
||
selectionKind === 'rebind'
|
||
? t('h5.pickup.rebind.stepAdd')
|
||
: t('h5.orders.mergePickup.stepForm')
|
||
}}
|
||
</em>
|
||
</div>
|
||
</div>
|
||
<button
|
||
type="button"
|
||
class="h5-orders-pickup-bar__btn"
|
||
:disabled="selectedCount === 0 || rebindSubmitting"
|
||
@click="selectionKind === 'rebind' ? submitRebindAdd() : openCreatePickup()"
|
||
>
|
||
{{
|
||
selectionKind === 'rebind'
|
||
? rebindSubmitting
|
||
? t('h5.pickup.loading')
|
||
: t('h5.pickup.rebind.confirmAdd')
|
||
: t('h5.orders.mergePickup.next')
|
||
}}
|
||
</button>
|
||
</div>
|
||
|
||
<div v-if="isBatchSelection" class="h5-orders-batch-bar">
|
||
<div class="h5-orders-batch-bar__summary">
|
||
<span class="h5-orders-batch-bar__count">{{ selectedCount }}</span>
|
||
<strong>{{ t('h5.orders.batch.selected', { count: selectedCount }) }}</strong>
|
||
</div>
|
||
<div class="h5-orders-batch-bar__actions">
|
||
<button
|
||
type="button"
|
||
class="h5-orders-batch-bar__btn is-pay"
|
||
:disabled="!batchPayRows.length || batchActing"
|
||
@click="runBatchPay"
|
||
>
|
||
{{ t('h5.orders.pay') }}
|
||
<em v-if="batchPayRows.length">{{ batchPayRows.length }}</em>
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="h5-orders-batch-bar__btn"
|
||
:disabled="!batchPredeclareRows.length || batchActing"
|
||
@click="runBatchPredeclare"
|
||
>
|
||
{{ t('h5.orders.actions.predeclare') }}
|
||
<em v-if="batchPredeclareRows.length">{{ batchPredeclareRows.length }}</em>
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="h5-orders-batch-bar__btn"
|
||
:disabled="!batchInterceptRows.length || batchActing"
|
||
@click="runBatchIntercept"
|
||
>
|
||
{{ t('h5.orders.actions.intercept') }}
|
||
<em v-if="batchInterceptRows.length">{{ batchInterceptRows.length }}</em>
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="h5-orders-batch-bar__btn"
|
||
:disabled="!batchCancelInterceptRows.length || batchActing"
|
||
@click="runBatchCancelIntercept"
|
||
>
|
||
{{ t('h5.orders.actions.cancelIntercept') }}
|
||
<em v-if="batchCancelInterceptRows.length">{{ batchCancelInterceptRows.length }}</em>
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="h5-orders-batch-bar__btn"
|
||
:disabled="!batchPickupRows.length || batchActing"
|
||
@click="runBatchMergePickup"
|
||
>
|
||
{{ t('h5.orders.mergePickup.entry') }}
|
||
<em v-if="batchPickupRows.length">{{ batchPickupRows.length }}</em>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<H5CreatePickupFromOrdersSheet ref="createPickupSheetRef" @success="onCreatePickupSuccess" />
|
||
<H5PickupOrderDetailSheet ref="pickupDetailRef" />
|
||
</div>
|
||
</template>
|
||
|
||
<script lang="ts" setup>
|
||
import {
|
||
computed,
|
||
defineAsyncComponent,
|
||
inject,
|
||
onActivated,
|
||
onBeforeUnmount,
|
||
ref,
|
||
watch,
|
||
} from 'vue';
|
||
import { useRoute, useRouter } from 'vue-router';
|
||
import { useI18n } from 'vue-i18n';
|
||
import dayjs from 'dayjs';
|
||
import { Message, Modal } from '@arco-design/web-vue';
|
||
import { IconCheck, IconCopy, IconLeft, IconLock, IconSearch } from '@arco-design/web-vue/es/icon';
|
||
import { h5Navigate } from '@/utils/device';
|
||
import { isLogin } from '@/utils/auth';
|
||
import iconOrderPickup from '@/assets/icons/h5/order-pickup.svg?url';
|
||
import IconTabPackage from '@/assets/icons/h5/tab-package.svg';
|
||
import H5EmptyState from '../components/H5EmptyState.vue';
|
||
import H5GuestAuthCta from '../components/H5GuestAuthCta.vue';
|
||
import { ensureH5Login } from '../composables/useH5LoginGate';
|
||
import { startH5WeChatRegister } from '../composables/useH5WeChatRegister';
|
||
import { H5_HIDE_CREATE_FAB_KEY } from '../composables/h5TabBarUi';
|
||
import { useH5TabEnterOnce } from '@/views/h5/composables/useH5TabEnterOnce';
|
||
import { useH5PullRefresh } from '@/views/h5/composables/useH5PullRefresh';
|
||
import {
|
||
formatBatchJobFailureMessage,
|
||
formatBatchJobSummaryMessage,
|
||
getOrderStatusCounts,
|
||
isOrderBatchQueueDisabledError,
|
||
postOrderBatchJob,
|
||
postOrderCancelIntercept,
|
||
postOrderIntercept,
|
||
postOrderList,
|
||
postOrderPreDeclare,
|
||
resolveBatchJobItemRowLabel,
|
||
waitOrderBatchJob,
|
||
} from '@/api/order';
|
||
import {
|
||
getOrderStatusMeta,
|
||
getOrderStatusTagStyle,
|
||
isOrderNotShipped,
|
||
resolveOrderStatusCode,
|
||
type OrderStatusCode,
|
||
} from '@/constants/orderStatus';
|
||
import {
|
||
H5_ORDER_GROUPS,
|
||
sumStatusCounts,
|
||
type H5OrderGroup,
|
||
type H5OrderGroupKey,
|
||
} from '@/constants/h5OrderStatus';
|
||
import {
|
||
buildAskAdvisorQuery,
|
||
buildWaybillContextFromRow,
|
||
} from '@/composables/useAskAdvisor';
|
||
import { addPickupOrderOrders, getPickupOrderDetail } from '@/api/order/pickupOrder';
|
||
import { consumeOrderPayOauthResume } from '../utils/orderPayOauth';
|
||
import H5OrderPaySheet from '../components/H5OrderPaySheet.vue';
|
||
|
||
const H5OrderDetailSheet = defineAsyncComponent(
|
||
() => import('../components/H5OrderDetailSheet.vue'),
|
||
);
|
||
const H5PlaceOrderSheet = defineAsyncComponent(
|
||
() => import('../components/H5PlaceOrderSheet.vue'),
|
||
);
|
||
const H5CreatePickupFromOrdersSheet = defineAsyncComponent(
|
||
() => import('../components/H5CreatePickupFromOrdersSheet.vue'),
|
||
);
|
||
const H5PickupOrderDetailSheet = defineAsyncComponent(
|
||
() => import('../components/H5PickupOrderDetailSheet.vue'),
|
||
);
|
||
|
||
const PICKUP_SELECTABLE_STATUS = 'predeclared' as const;
|
||
type PickupRejectReason = 'notPredeclared' | 'alreadyBound' | 'noWarehouse' | 'differentWarehouse';
|
||
type PickupSelectionKind = 'create' | 'rebind' | 'batch';
|
||
|
||
defineOptions({ name: 'H5Orders' });
|
||
|
||
const { animateEnter } = useH5TabEnterOnce();
|
||
const { t } = useI18n();
|
||
const route = useRoute();
|
||
const router = useRouter();
|
||
const hideCreateFab = inject(H5_HIDE_CREATE_FAB_KEY, null);
|
||
/** 避免首次 mount 与 onActivated 重复拉数 */
|
||
let didBootstrap = false;
|
||
let softRefreshing = false;
|
||
|
||
const groups = H5_ORDER_GROUPS;
|
||
|
||
function resolveInitialGroup(): H5OrderGroupKey {
|
||
const raw = String(route.query.group || '');
|
||
if (groups.some((g) => g.key === raw)) return raw as H5OrderGroupKey;
|
||
return 'all';
|
||
}
|
||
|
||
const activeGroup = ref<H5OrderGroupKey>(resolveInitialGroup());
|
||
const keyword = ref('');
|
||
const loading = ref(false);
|
||
const loadingMore = ref(false);
|
||
const page = ref(1);
|
||
const pageSize = 20;
|
||
const total = ref(0);
|
||
const orders = ref<any[]>([]);
|
||
const statusCounts = ref<Record<string, number>>({});
|
||
const fulfillOrderCount = ref(0);
|
||
|
||
const payVisible = ref(false);
|
||
const payOrders = ref<{ id: number | string; waybillNo?: string }[]>([]);
|
||
const payOauthCode = ref<string | undefined>();
|
||
const detailVisible = ref(false);
|
||
const detailOrderId = ref<number | string>('');
|
||
const detailTab = ref<'overview' | 'track' | 'fee'>('overview');
|
||
const editVisible = ref(false);
|
||
const editOrderId = ref<number | string | null>(null);
|
||
|
||
const selectionMode = ref(false);
|
||
const selectionKind = ref<PickupSelectionKind>('create');
|
||
const selectedOrderIds = ref<Array<number | string>>([]);
|
||
const rebindPickupId = ref<number | string>('');
|
||
const rebindWarehouseId = ref(0);
|
||
const rebindWarehouseName = ref('');
|
||
const rebindSubmitting = ref(false);
|
||
const batchActing = ref(false);
|
||
const createPickupSheetRef = ref<{ open: (payload?: any) => void } | null>(null);
|
||
const pickupDetailRef = ref<{ open: (id: number | string) => void } | null>(null);
|
||
|
||
const isBatchSelection = computed(
|
||
() => selectionMode.value && selectionKind.value === 'batch',
|
||
);
|
||
const isPickupSelection = computed(
|
||
() => selectionMode.value && (selectionKind.value === 'create' || selectionKind.value === 'rebind'),
|
||
);
|
||
|
||
watch(
|
||
selectionMode,
|
||
(on) => {
|
||
if (hideCreateFab) hideCreateFab.value = on;
|
||
},
|
||
{ immediate: true },
|
||
);
|
||
|
||
onBeforeUnmount(() => {
|
||
if (hideCreateFab) hideCreateFab.value = false;
|
||
});
|
||
|
||
const selectedCount = computed(() => selectedOrderIds.value.length);
|
||
const selectedRows = computed(() => orders.value.filter((row) => isRowSelected(row)));
|
||
const selectedWarehouseId = computed(() => {
|
||
if (!selectedOrderIds.value.length) return 0;
|
||
const first = orders.value.find((row) => isRowSelected(row));
|
||
return getRowWarehouseId(first);
|
||
});
|
||
const selectedWarehouseLabel = computed(() => {
|
||
if (!selectedWarehouseId.value) return '';
|
||
const first = orders.value.find((row) => isRowSelected(row));
|
||
return warehouseLabel(first);
|
||
});
|
||
const selectableCountOnPage = computed(() =>
|
||
orders.value.filter((row) => pickupSelectable(row).ok).length,
|
||
);
|
||
const batchPayRows = computed(() => selectedRows.value.filter((row) => isPendingPay(row)));
|
||
const batchPredeclareRows = computed(() => selectedRows.value.filter((row) => canPredeclare(row)));
|
||
const batchInterceptRows = computed(() => selectedRows.value.filter((row) => canIntercept(row)));
|
||
const batchCancelInterceptRows = computed(() =>
|
||
selectedRows.value.filter((row) => canCancelIntercept(row)),
|
||
);
|
||
/** 合并揽收:已预报、未绑揽收单、同仓(以首个可揽收票的仓库为准) */
|
||
const batchPickupRows = computed(() => {
|
||
const candidates = selectedRows.value.filter((row) => {
|
||
if (resolveOrderStatusCode(row) !== PICKUP_SELECTABLE_STATUS) return false;
|
||
if (getRowPickupOrderId(row)) return false;
|
||
return !!getRowWarehouseId(row);
|
||
});
|
||
if (!candidates.length) return [];
|
||
const warehouseId = getRowWarehouseId(candidates[0]);
|
||
return candidates.filter((row) => getRowWarehouseId(row) === warehouseId);
|
||
});
|
||
const allPageSelected = computed(() => {
|
||
const selectable = orders.value.filter((row) => rowSelectable(row).ok);
|
||
return (
|
||
selectable.length > 0 && selectable.every((row) => isRowSelected(row))
|
||
);
|
||
});
|
||
|
||
const hasMore = computed(() => orders.value.length < total.value);
|
||
/** 首次进入页时抑制 activeGroup watch,避免与 bootstrap reload 重复请求 */
|
||
let bootstrapping = true;
|
||
|
||
function pick(raw: Record<string, any> | undefined, ...keys: string[]) {
|
||
if (!raw) return undefined;
|
||
for (const k of keys) {
|
||
const v = raw[k];
|
||
if (v !== undefined && v !== null && v !== '') return v;
|
||
}
|
||
return undefined;
|
||
}
|
||
|
||
function cargoLabel(raw: any) {
|
||
const value = String(pick(raw, 'cargoAttribute', 'CargoAttribute') ?? '').trim();
|
||
if (!value) return '';
|
||
const map: Record<string, string> = {
|
||
general: 'order.myOrders.drawer.cargoAttribute.general',
|
||
electronics: 'order.myOrders.drawer.cargoAttribute.electronics',
|
||
'3c': 'order.myOrders.drawer.cargoAttribute.electronics',
|
||
sensitive: 'order.myOrders.drawer.cargoAttribute.sensitive',
|
||
};
|
||
const key = map[value.toLowerCase()];
|
||
if (key) {
|
||
const label = t(key);
|
||
if (label && label !== key) return label;
|
||
}
|
||
return value;
|
||
}
|
||
|
||
function normalizeOrderRow(raw: any) {
|
||
const r = raw?.receiver || raw?.Receiver || {};
|
||
const s = raw?.sender || raw?.Sender || {};
|
||
const serviceNo = pick(raw, 'serviceNo', 'ServiceNo', 'waybillNo', 'WaybillNo');
|
||
const clientNo = pick(raw, 'clientNo', 'ClientNo', 'customerOrderNo', 'CustomerOrderNo');
|
||
const trackNo = pick(raw, 'trackNo', 'TrackNo', 'trackingNo', 'TrackingNo');
|
||
const isPaidRaw = pick(raw, 'isPaid', 'IsPaid');
|
||
const warehouse = String(
|
||
pick(raw, 'warehouse', 'Warehouse', 'warehouseName', 'WarehouseName') ?? '',
|
||
).trim();
|
||
return {
|
||
...raw,
|
||
id: pick(raw, 'id', 'Id'),
|
||
waybillNo: serviceNo ?? '',
|
||
customerOrderNo: clientNo ?? '',
|
||
trackingNo: trackNo ?? '',
|
||
productName: pick(raw, 'productName', 'ProductName', 'productCode', 'ProductCode') ?? '',
|
||
channelName: pick(raw, 'channelName', 'ChannelName', 'channelCode', 'ChannelCode') ?? '',
|
||
isPaid: isPaidRaw === true || isPaidRaw === 1 || isPaidRaw === '1',
|
||
isIntercept: (() => {
|
||
const v = pick(raw, 'isIntercept', 'IsIntercept');
|
||
return v === true || v === 1 || v === '1';
|
||
})(),
|
||
consigneeCountry: pick(raw, 'consigneeCountry', 'ConsigneeCountry') ?? pick(r, 'country', 'Country') ?? '',
|
||
consigneeCountryName:
|
||
pick(raw, 'consigneeCountryName', 'ConsigneeCountryName', 'chineseName', 'ChineseName') ??
|
||
pick(r, 'countryName', 'CountryName', 'chineseName', 'ChineseName') ??
|
||
'',
|
||
consignee:
|
||
pick(raw, 'consignee', 'Consignee') ?? pick(r, 'recipientsName', 'RecipientsName') ?? '',
|
||
senderName: pick(s, 'senderName', 'SenderName') ?? '',
|
||
senderCity: pick(s, 'city', 'City') ?? '',
|
||
receivableAmount: pick(raw, 'receivableAmount', 'ReceivableAmount') ?? '',
|
||
status: resolveOrderStatusCode(raw),
|
||
createTime: pick(raw, 'createTime', 'CreateTime') ?? '',
|
||
signTime: pick(raw, 'signTime', 'SignTime') ?? '',
|
||
shipTime: pick(raw, 'shipTime', 'ShipTime') ?? '',
|
||
maxTimeliness: (() => {
|
||
const n = Number(pick(raw, 'maxTimeliness', 'MaxTimeliness'));
|
||
return Number.isFinite(n) && n > 0 ? n : undefined;
|
||
})(),
|
||
warehouse,
|
||
warehouseId: Number(pick(raw, 'warehouseId', 'WarehouseId') || 0) || undefined,
|
||
pickupOrderId: pick(raw, 'pickupOrderId', 'PickupOrderId'),
|
||
cargoAttributeLabel: cargoLabel(raw),
|
||
fulfillmentType: pick(raw, 'fulfillmentType', 'FulfillmentType') ?? 'direct',
|
||
fulfillProgress: pick(raw, 'fulfillProgress', 'FulfillProgress') ?? '',
|
||
stockBindStatus: pick(raw, 'stockBindStatus', 'StockBindStatus') ?? 'none',
|
||
domesticTrackingNos: pick(raw, 'domesticTrackingNos', 'DomesticTrackingNos') ?? '',
|
||
stockBindQtyTotal: pick(raw, 'stockBindQtyTotal', 'StockBindQtyTotal') ?? 0,
|
||
};
|
||
}
|
||
|
||
function currentGroup(): H5OrderGroup {
|
||
return groups.find((g) => g.key === activeGroup.value) || groups[0];
|
||
}
|
||
|
||
function groupCount(group: H5OrderGroup) {
|
||
if (group.key === 'fulfill') {
|
||
return fulfillOrderCount.value;
|
||
}
|
||
if (group.key === 'all') {
|
||
return Object.values(statusCounts.value).reduce((s, n) => s + (Number(n) || 0), 0);
|
||
}
|
||
return sumStatusCounts(statusCounts.value, group.statuses);
|
||
}
|
||
|
||
function isFulfillOrder(row: any) {
|
||
return String(row?.fulfillmentType || '').trim() === 'warehouse';
|
||
}
|
||
|
||
function fulfillProgressText(row: any) {
|
||
const code = String(row?.fulfillProgress || '').trim();
|
||
if (!code) return '';
|
||
const key = `order.fulfillOrders.progress.${code}`;
|
||
const text = t(key);
|
||
return text === key ? code : text;
|
||
}
|
||
|
||
function statusLabel(row: any) {
|
||
const code = resolveOrderStatusCode(row);
|
||
const meta = getOrderStatusMeta(code);
|
||
if (!meta) return code || '-';
|
||
return t(meta.labelKey);
|
||
}
|
||
|
||
function statusStyle(row: any) {
|
||
return getOrderStatusTagStyle(getOrderStatusMeta(resolveOrderStatusCode(row)));
|
||
}
|
||
|
||
function statusTextStyle(row: any) {
|
||
const meta = getOrderStatusMeta(resolveOrderStatusCode(row));
|
||
return { color: meta?.tagColor || '#86909c' };
|
||
}
|
||
|
||
/** 三段进度:仓内 → 运输 → 签收完成(走完全绿) */
|
||
function routeProgress(row: any) {
|
||
const code = resolveOrderStatusCode(row);
|
||
if (code === 'deliverySuccess') return 3;
|
||
if (code === 'shipping' || code === 'pendingOnline' || code === 'deliveryFailed') return 2;
|
||
if (
|
||
code === 'predeclared' ||
|
||
code === 'pendingAllocation' ||
|
||
code === 'pendingPayment' ||
|
||
code === 'pendingShip' ||
|
||
code === 'problematic' ||
|
||
code === 'claimed'
|
||
) {
|
||
return 1;
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
function channelLabel(row: any) {
|
||
return String(row.channelName || row.productName || '').trim();
|
||
}
|
||
|
||
function consigneeLabel(row: any) {
|
||
const r = row?.receiver || row?.Receiver || {};
|
||
return String(
|
||
row?.consignee ||
|
||
pick(row, 'consignee', 'Consignee') ||
|
||
pick(r, 'recipientsName', 'RecipientsName') ||
|
||
'',
|
||
).trim();
|
||
}
|
||
|
||
function senderCityLabel(row: any) {
|
||
const s = row?.sender || row?.Sender || {};
|
||
return String(row?.senderCity || pick(s, 'city', 'City') || '').trim() || '-';
|
||
}
|
||
|
||
function senderNameLabel(row: any) {
|
||
const s = row?.sender || row?.Sender || {};
|
||
return String(row?.senderName || pick(s, 'senderName', 'SenderName') || '').trim() || '-';
|
||
}
|
||
|
||
function formatDateTimeLabel(raw: unknown) {
|
||
if (raw == null || raw === '') return '';
|
||
const d = dayjs(raw);
|
||
return d.isValid() ? d.format('YYYY-MM-DD HH:mm') : String(raw);
|
||
}
|
||
|
||
function signTimeLabel(row: any) {
|
||
return formatDateTimeLabel(row?.signTime || pick(row, 'signTime', 'SignTime'));
|
||
}
|
||
|
||
function createTimeLabel(row: any) {
|
||
return formatDateTimeLabel(row?.createTime || pick(row, 'createTime', 'CreateTime'));
|
||
}
|
||
|
||
/** 路线区底部时间文案:签收 > 预计签收 > 创建 */
|
||
function routeTimeText(row: any) {
|
||
if (signTimeLabel(row)) return `${t('h5.orders.signTime')}${signTimeLabel(row)}`;
|
||
if (etaSignTimeLabel(row)) return `${t('h5.orders.etaSignTime')}${etaSignTimeLabel(row)}`;
|
||
if (createTimeLabel(row)) return `${t('h5.orders.createTime')}${createTimeLabel(row)}`;
|
||
return '';
|
||
}
|
||
|
||
function resolveMaxTimelinessDays(row: any) {
|
||
const n = Number(row?.maxTimeliness ?? pick(row, 'maxTimeliness', 'MaxTimeliness'));
|
||
return Number.isFinite(n) && n > 0 ? n : 0;
|
||
}
|
||
|
||
function getEtaSignTime(row: any) {
|
||
const shipRaw = row?.shipTime || pick(row, 'shipTime', 'ShipTime');
|
||
const maxDays = resolveMaxTimelinessDays(row);
|
||
if (shipRaw == null || shipRaw === '' || !maxDays) return null;
|
||
const ship = dayjs(shipRaw);
|
||
if (!ship.isValid()) return null;
|
||
return ship.add(maxDays, 'day');
|
||
}
|
||
|
||
function etaSignTimeLabel(row: any) {
|
||
const eta = getEtaSignTime(row);
|
||
return eta ? eta.format('YYYY-MM-DD HH:mm') : '';
|
||
}
|
||
|
||
function signVsEtaTip(row: any): { text: string; tone: 'early' | 'late' | 'ontime' } | null {
|
||
const signRaw = row?.signTime || pick(row, 'signTime', 'SignTime');
|
||
const eta = getEtaSignTime(row);
|
||
if (signRaw == null || signRaw === '' || !eta) return null;
|
||
const sign = dayjs(signRaw);
|
||
if (!sign.isValid()) return null;
|
||
const diffHours = Math.round(sign.diff(eta, 'hour', true));
|
||
if (diffHours === 0) {
|
||
return { text: t('h5.orders.signOnTime'), tone: 'ontime' };
|
||
}
|
||
if (diffHours < 0) {
|
||
return {
|
||
text: t('h5.orders.signEarly', { hours: Math.abs(diffHours) }),
|
||
tone: 'early',
|
||
};
|
||
}
|
||
return {
|
||
text: t('h5.orders.signLate', { hours: diffHours }),
|
||
tone: 'late',
|
||
};
|
||
}
|
||
|
||
function getRowWarehouseId(row: any) {
|
||
return Number(row?.warehouseId || pick(row, 'warehouseId', 'WarehouseId') || 0);
|
||
}
|
||
|
||
function getRowPickupOrderId(row: any) {
|
||
const v = row?.pickupOrderId ?? pick(row, 'pickupOrderId', 'PickupOrderId');
|
||
const id = Number(v);
|
||
return Number.isFinite(id) && id > 0 ? id : 0;
|
||
}
|
||
|
||
function pickupSelectable(row: any): { ok: boolean; reason?: PickupRejectReason } {
|
||
const status = resolveOrderStatusCode(row);
|
||
if (status !== PICKUP_SELECTABLE_STATUS) {
|
||
return { ok: false, reason: 'notPredeclared' };
|
||
}
|
||
if (getRowPickupOrderId(row)) {
|
||
return { ok: false, reason: 'alreadyBound' };
|
||
}
|
||
const whId = getRowWarehouseId(row);
|
||
if (!whId) {
|
||
return { ok: false, reason: 'noWarehouse' };
|
||
}
|
||
const lockWarehouseId =
|
||
selectionKind.value === 'rebind'
|
||
? rebindWarehouseId.value
|
||
: selectedWarehouseId.value;
|
||
if (lockWarehouseId > 0 && whId !== lockWarehouseId) {
|
||
return { ok: false, reason: 'differentWarehouse' };
|
||
}
|
||
return { ok: true };
|
||
}
|
||
|
||
function pickupReasonLabel(row: any) {
|
||
const reason = pickupSelectable(row).reason;
|
||
if (!reason) return '';
|
||
return t(`h5.orders.mergePickup.reason.${reason}`);
|
||
}
|
||
|
||
function isRowSelected(row: any) {
|
||
const id = row?.id;
|
||
return id != null && selectedOrderIds.value.some((x) => String(x) === String(id));
|
||
}
|
||
|
||
function resolvePickupSelectFromQuery() {
|
||
const raw = route.query.pickupSelect;
|
||
const value = Array.isArray(raw) ? raw[0] : raw;
|
||
return value === '1' || value === 'true';
|
||
}
|
||
|
||
function resolvePickupRebindFromQuery() {
|
||
const raw = route.query.pickupRebind;
|
||
const value = Array.isArray(raw) ? raw[0] : raw;
|
||
return value === '1' || value === 'true';
|
||
}
|
||
|
||
function resolveRebindPickupIdFromQuery() {
|
||
const raw = route.query.pickupId;
|
||
const value = Array.isArray(raw) ? raw[0] : raw;
|
||
const id = Number(value);
|
||
return Number.isFinite(id) && id > 0 ? id : 0;
|
||
}
|
||
|
||
async function loadRebindPickupContext(pickupId: number | string) {
|
||
try {
|
||
const raw = await getPickupOrderDetail(pickupId);
|
||
rebindWarehouseId.value = Number(raw?.warehouseId ?? raw?.WarehouseId) || 0;
|
||
rebindWarehouseName.value = String(raw?.warehouseName ?? raw?.WarehouseName ?? '');
|
||
} catch {
|
||
rebindWarehouseId.value = 0;
|
||
rebindWarehouseName.value = '';
|
||
}
|
||
}
|
||
|
||
async function syncSelectionModeFromQuery() {
|
||
if (resolvePickupSelectFromQuery()) {
|
||
selectionKind.value = 'create';
|
||
rebindPickupId.value = '';
|
||
rebindWarehouseId.value = 0;
|
||
rebindWarehouseName.value = '';
|
||
if (!selectionMode.value) {
|
||
selectionMode.value = true;
|
||
selectedOrderIds.value = [];
|
||
activeGroup.value = 'warehouse';
|
||
}
|
||
return;
|
||
}
|
||
if (resolvePickupRebindFromQuery()) {
|
||
const pickupId = resolveRebindPickupIdFromQuery();
|
||
if (!pickupId) return;
|
||
selectionKind.value = 'rebind';
|
||
rebindPickupId.value = pickupId;
|
||
if (!selectionMode.value) {
|
||
selectionMode.value = true;
|
||
selectedOrderIds.value = [];
|
||
activeGroup.value = 'warehouse';
|
||
}
|
||
await loadRebindPickupContext(pickupId);
|
||
return;
|
||
}
|
||
// 仅退出揽收勾选;批量模式不受 query 影响
|
||
if (selectionMode.value && selectionKind.value !== 'batch') {
|
||
selectionMode.value = false;
|
||
selectedOrderIds.value = [];
|
||
selectionKind.value = 'create';
|
||
rebindPickupId.value = '';
|
||
rebindWarehouseId.value = 0;
|
||
rebindWarehouseName.value = '';
|
||
}
|
||
}
|
||
|
||
function enterBatchMode() {
|
||
selectionKind.value = 'batch';
|
||
selectionMode.value = true;
|
||
selectedOrderIds.value = [];
|
||
rebindPickupId.value = '';
|
||
rebindWarehouseId.value = 0;
|
||
rebindWarehouseName.value = '';
|
||
}
|
||
|
||
function exitSelectionMode() {
|
||
const wasBatch = selectionKind.value === 'batch';
|
||
selectionMode.value = false;
|
||
selectedOrderIds.value = [];
|
||
selectionKind.value = 'create';
|
||
rebindPickupId.value = '';
|
||
rebindWarehouseId.value = 0;
|
||
rebindWarehouseName.value = '';
|
||
batchActing.value = false;
|
||
const nextQuery = { ...route.query } as Record<string, unknown>;
|
||
let changed = false;
|
||
if (resolvePickupSelectFromQuery()) {
|
||
delete nextQuery.pickupSelect;
|
||
changed = true;
|
||
}
|
||
if (resolvePickupRebindFromQuery()) {
|
||
delete nextQuery.pickupRebind;
|
||
delete nextQuery.pickupId;
|
||
changed = true;
|
||
}
|
||
if (changed) {
|
||
void router.replace({ query: nextQuery });
|
||
}
|
||
if (!wasBatch) {
|
||
void reload();
|
||
}
|
||
}
|
||
|
||
function onCreatePickupSuccess(payload?: { pickupNo?: string; id?: number | string }) {
|
||
exitSelectionMode();
|
||
if (payload?.id != null) {
|
||
pickupDetailRef.value?.open(payload.id);
|
||
}
|
||
}
|
||
|
||
function rowSelectable(row: any): { ok: boolean; reason?: PickupRejectReason } {
|
||
if (selectionKind.value === 'batch') {
|
||
return { ok: row?.id != null };
|
||
}
|
||
return pickupSelectable(row);
|
||
}
|
||
|
||
function toggleSelect(row: any) {
|
||
const check = rowSelectable(row);
|
||
if (!check.ok) {
|
||
if (selectionKind.value !== 'batch') {
|
||
Message.warning(pickupReasonLabel(row));
|
||
}
|
||
return;
|
||
}
|
||
const id = row?.id;
|
||
if (id == null) return;
|
||
const key = String(id);
|
||
if (isRowSelected(row)) {
|
||
selectedOrderIds.value = selectedOrderIds.value.filter((x) => String(x) !== key);
|
||
} else {
|
||
selectedOrderIds.value = [...selectedOrderIds.value, id];
|
||
}
|
||
}
|
||
|
||
function toggleSelectAllPage() {
|
||
const selectable = orders.value.filter((row) => rowSelectable(row).ok);
|
||
if (!selectable.length) return;
|
||
if (allPageSelected.value) {
|
||
const pageKeys = new Set(selectable.map((row) => String(row.id)));
|
||
selectedOrderIds.value = selectedOrderIds.value.filter((id) => !pageKeys.has(String(id)));
|
||
return;
|
||
}
|
||
const merged = new Map(selectedOrderIds.value.map((id) => [String(id), id]));
|
||
selectable.forEach((row) => {
|
||
if (row?.id != null) merged.set(String(row.id), row.id);
|
||
});
|
||
selectedOrderIds.value = [...merged.values()];
|
||
}
|
||
|
||
function onCardClick(row: any) {
|
||
if (selectionMode.value) {
|
||
toggleSelect(row);
|
||
return;
|
||
}
|
||
goDetail(row);
|
||
}
|
||
|
||
function openCreatePickup() {
|
||
const rows = orders.value.filter((row) => isRowSelected(row));
|
||
if (!rows.length) {
|
||
Message.warning(t('h5.orders.mergePickup.needSelect'));
|
||
return;
|
||
}
|
||
const invalid = rows.find((row) => !pickupSelectable(row).ok);
|
||
if (invalid) {
|
||
Message.warning(pickupReasonLabel(invalid));
|
||
return;
|
||
}
|
||
createPickupSheetRef.value?.open(
|
||
rows.map((row) => ({
|
||
id: row.id,
|
||
serviceNo: row.waybillNo || row.customerOrderNo,
|
||
warehouseId: getRowWarehouseId(row),
|
||
})),
|
||
);
|
||
}
|
||
|
||
async function submitRebindAdd() {
|
||
if (!rebindPickupId.value) return;
|
||
if (!selectedOrderIds.value.length) {
|
||
Message.warning(t('h5.orders.mergePickup.needSelect'));
|
||
return;
|
||
}
|
||
const invalid = orders.value
|
||
.filter((row) => isRowSelected(row))
|
||
.find((row) => !pickupSelectable(row).ok);
|
||
if (invalid) {
|
||
Message.warning(pickupReasonLabel(invalid));
|
||
return;
|
||
}
|
||
rebindSubmitting.value = true;
|
||
try {
|
||
await addPickupOrderOrders({
|
||
id: rebindPickupId.value,
|
||
orderIds: selectedOrderIds.value,
|
||
});
|
||
Message.success(t('order.pickupOrder.message.rebindOk'));
|
||
const pickupId = rebindPickupId.value;
|
||
exitSelectionMode();
|
||
pickupDetailRef.value?.open(pickupId);
|
||
} catch (e: any) {
|
||
Message.error(e?.message || t('order.pickupOrder.message.actionFailed'));
|
||
} finally {
|
||
rebindSubmitting.value = false;
|
||
}
|
||
}
|
||
|
||
function warehouseLabel(row: any) {
|
||
return String(row.warehouse || '').trim() || t('h5.price.originAny');
|
||
}
|
||
|
||
function countryLabel(row: any) {
|
||
return String(row.consigneeCountryName || '').trim();
|
||
}
|
||
|
||
function countryCode(row: any) {
|
||
return String(row.consigneeCountry || '').trim().toUpperCase();
|
||
}
|
||
|
||
function isPendingPay(row: any) {
|
||
return resolveOrderStatusCode(row) === 'pendingPayment';
|
||
}
|
||
|
||
function isShipping(row: any) {
|
||
return resolveOrderStatusCode(row) === 'shipping';
|
||
}
|
||
|
||
function isIssue(row: any) {
|
||
const code = resolveOrderStatusCode(row) as OrderStatusCode;
|
||
return ['deliveryFailed', 'problematic', 'claimed'].includes(code);
|
||
}
|
||
|
||
function isRowIntercepted(row: any) {
|
||
const v = row?.isIntercept ?? pick(row, 'isIntercept', 'IsIntercept');
|
||
return v === true || v === 1 || v === '1';
|
||
}
|
||
|
||
/** 草稿可重新预报 */
|
||
function canPredeclare(row: any) {
|
||
return resolveOrderStatusCode(row) === 'draft';
|
||
}
|
||
|
||
function openEditFromDetail(orderId: number | string) {
|
||
if (orderId == null || orderId === '') return;
|
||
detailVisible.value = false;
|
||
editOrderId.value = orderId;
|
||
editVisible.value = true;
|
||
}
|
||
|
||
function onEditSuccess() {
|
||
editVisible.value = false;
|
||
editOrderId.value = null;
|
||
void reload();
|
||
}
|
||
|
||
/** 未发货且未拦截:已预报~待发货可拦截 */
|
||
function canIntercept(row: any) {
|
||
const code = resolveOrderStatusCode(row);
|
||
if (!isOrderNotShipped(row) || isRowIntercepted(row)) return false;
|
||
return ['predeclared', 'pendingAllocation', 'pendingPayment', 'pendingShip'].includes(code);
|
||
}
|
||
|
||
/** 未发货且已拦截:可取消拦截 */
|
||
function canCancelIntercept(row: any) {
|
||
return isOrderNotShipped(row) && isRowIntercepted(row);
|
||
}
|
||
|
||
async function runH5OrderBatch(options: {
|
||
action: string;
|
||
rows: any[];
|
||
successMessage: string;
|
||
syncRunner: () => Promise<void>;
|
||
}) {
|
||
const orderIds = options.rows.map((row) => row.id).filter((id) => id != null);
|
||
if (!orderIds.length) return;
|
||
try {
|
||
const job = await postOrderBatchJob({
|
||
action: options.action,
|
||
orderIds,
|
||
});
|
||
const result = await waitOrderBatchJob(job.jobId);
|
||
if (result.timedOut) {
|
||
Message.warning(
|
||
formatBatchJobSummaryMessage(result.job, { timedOut: true, jobId: job.jobId }),
|
||
);
|
||
await reload();
|
||
return;
|
||
}
|
||
if (result.job.failCount > 0) {
|
||
Message.warning(
|
||
formatBatchJobFailureMessage(result.job, result.items, options.rows, (row, item) =>
|
||
resolveBatchJobItemRowLabel(row, item),
|
||
),
|
||
);
|
||
} else {
|
||
Message.success(options.successMessage);
|
||
}
|
||
selectedOrderIds.value = [];
|
||
await reload();
|
||
return;
|
||
} catch (e: any) {
|
||
if (!isOrderBatchQueueDisabledError(e)) {
|
||
throw e;
|
||
}
|
||
}
|
||
await options.syncRunner();
|
||
selectedOrderIds.value = [];
|
||
await reload();
|
||
}
|
||
|
||
function requireBatchRows(rows: any[], emptyKey: string) {
|
||
if (!rows.length) {
|
||
Message.warning(t(emptyKey));
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
function runBatchPay() {
|
||
const rows = batchPayRows.value;
|
||
if (!requireBatchRows(rows, 'h5.orders.batch.needPay')) return;
|
||
payOauthCode.value = undefined;
|
||
payOrders.value = rows.map((row) => ({
|
||
id: row.id,
|
||
waybillNo: row.waybillNo || row.customerOrderNo,
|
||
}));
|
||
payVisible.value = true;
|
||
}
|
||
|
||
async function runBatchPredeclare() {
|
||
const rows = batchPredeclareRows.value;
|
||
if (!requireBatchRows(rows, 'h5.orders.batch.needPredeclare')) return;
|
||
if (batchActing.value) return;
|
||
batchActing.value = true;
|
||
try {
|
||
await runH5OrderBatch({
|
||
action: 'pre-declare',
|
||
rows,
|
||
successMessage: t('h5.orders.predeclareOk'),
|
||
syncRunner: async () => {
|
||
for (const row of rows) {
|
||
await postOrderPreDeclare({ id: row.id });
|
||
}
|
||
Message.success(t('h5.orders.predeclareOk'));
|
||
},
|
||
});
|
||
} catch (e: any) {
|
||
Message.error(e?.message || t('h5.orders.predeclareFailed'));
|
||
} finally {
|
||
batchActing.value = false;
|
||
}
|
||
}
|
||
|
||
function runBatchIntercept() {
|
||
const rows = batchInterceptRows.value;
|
||
if (!requireBatchRows(rows, 'h5.orders.batch.needIntercept')) return;
|
||
Modal.confirm({
|
||
title: t('h5.orders.intercept.confirmTitle'),
|
||
content: t('h5.orders.batch.interceptConfirm', { count: rows.length }),
|
||
okText: t('h5.orders.intercept.confirmOk'),
|
||
cancelText: t('h5.orders.mergePickup.cancel'),
|
||
onOk: async () => {
|
||
if (batchActing.value) return;
|
||
batchActing.value = true;
|
||
try {
|
||
await runH5OrderBatch({
|
||
action: 'intercept',
|
||
rows,
|
||
successMessage: t('h5.orders.intercept.submitSuccess'),
|
||
syncRunner: async () => {
|
||
for (const row of rows) {
|
||
await postOrderIntercept({ id: row.id });
|
||
}
|
||
Message.success(t('h5.orders.intercept.submitSuccess'));
|
||
},
|
||
});
|
||
} catch (e: any) {
|
||
Message.error(e?.message || t('h5.orders.intercept.submitFailed'));
|
||
throw e;
|
||
} finally {
|
||
batchActing.value = false;
|
||
}
|
||
},
|
||
});
|
||
}
|
||
|
||
function runBatchCancelIntercept() {
|
||
const rows = batchCancelInterceptRows.value;
|
||
if (!requireBatchRows(rows, 'h5.orders.batch.needCancelIntercept')) return;
|
||
Modal.confirm({
|
||
title: t('h5.orders.intercept.cancelConfirmTitle'),
|
||
content: t('h5.orders.batch.cancelInterceptConfirm', { count: rows.length }),
|
||
okText: t('h5.orders.intercept.cancelConfirmOk'),
|
||
cancelText: t('h5.orders.mergePickup.cancel'),
|
||
onOk: async () => {
|
||
if (batchActing.value) return;
|
||
batchActing.value = true;
|
||
try {
|
||
await runH5OrderBatch({
|
||
action: 'cancel-intercept',
|
||
rows,
|
||
successMessage: t('h5.orders.intercept.cancelSuccess'),
|
||
syncRunner: async () => {
|
||
for (const row of rows) {
|
||
await postOrderCancelIntercept({ id: row.id });
|
||
}
|
||
Message.success(t('h5.orders.intercept.cancelSuccess'));
|
||
},
|
||
});
|
||
} catch (e: any) {
|
||
Message.error(e?.message || t('h5.orders.intercept.cancelFailed'));
|
||
throw e;
|
||
} finally {
|
||
batchActing.value = false;
|
||
}
|
||
},
|
||
});
|
||
}
|
||
|
||
function runBatchMergePickup() {
|
||
const rows = batchPickupRows.value;
|
||
if (!requireBatchRows(rows, 'h5.orders.batch.needPickup')) return;
|
||
const skipped = selectedCount.value - rows.length;
|
||
if (skipped > 0) {
|
||
Message.info(t('h5.orders.batch.pickupSkipped', { count: skipped }));
|
||
}
|
||
// 合并揽收需同仓:交给 openCreatePickup 校验,先只勾选可揽收票
|
||
selectedOrderIds.value = rows.map((row) => row.id);
|
||
const invalid = rows.find((row) => !pickupSelectable(row).ok);
|
||
if (invalid) {
|
||
Message.warning(pickupReasonLabel(invalid));
|
||
return;
|
||
}
|
||
createPickupSheetRef.value?.open(
|
||
rows.map((row) => ({
|
||
id: row.id,
|
||
serviceNo: row.waybillNo || row.customerOrderNo,
|
||
warehouseId: getRowWarehouseId(row),
|
||
})),
|
||
);
|
||
}
|
||
|
||
function formatMoney(val: unknown) {
|
||
const n = Number(val);
|
||
if (!Number.isFinite(n)) return String(val ?? '-');
|
||
return n.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||
}
|
||
|
||
async function copyText(text?: string) {
|
||
if (!text) return;
|
||
try {
|
||
await navigator.clipboard.writeText(text);
|
||
Message.success(t('h5.orders.copySuccess'));
|
||
} catch {
|
||
Message.error(t('h5.orders.copyFailed'));
|
||
}
|
||
}
|
||
|
||
async function fetchCounts() {
|
||
try {
|
||
const res = await getOrderStatusCounts();
|
||
statusCounts.value = res.counts || {};
|
||
const fulfillRes = await getOrderStatusCounts({ fulfillmentType: 'warehouse' });
|
||
fulfillOrderCount.value = Number(fulfillRes.total) || 0;
|
||
} catch {
|
||
statusCounts.value = {};
|
||
fulfillOrderCount.value = 0;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 多状态分组:优先用单状态接口;多状态时拉 all 后在前端过滤(一期可行,量大再改后端 in 查询)
|
||
*/
|
||
async function fetchPage(pageNo: number, append: boolean) {
|
||
const group = currentGroup();
|
||
const fulfillType = group.fulfillmentType;
|
||
let singleStatus: string;
|
||
if (selectionMode.value) {
|
||
singleStatus = PICKUP_SELECTABLE_STATUS;
|
||
} else if (fulfillType) {
|
||
singleStatus = 'all';
|
||
} else if (group.statuses.length === 1) {
|
||
singleStatus = group.statuses[0];
|
||
} else {
|
||
singleStatus = 'all';
|
||
}
|
||
|
||
const res = await postOrderList({
|
||
page: pageNo,
|
||
pageSize: selectionMode.value || (!fulfillType && group.statuses.length > 1) ? Math.max(pageSize, 50) : pageSize,
|
||
status: singleStatus,
|
||
fulfillmentType: fulfillType || undefined,
|
||
keyword: keyword.value.trim(),
|
||
});
|
||
|
||
let items = (res.items || []).map(normalizeOrderRow);
|
||
if (!selectionMode.value && !fulfillType && group.statuses.length > 1) {
|
||
const set = new Set(group.statuses);
|
||
items = items.filter((row) => set.has(resolveOrderStatusCode(row) as OrderStatusCode));
|
||
}
|
||
|
||
if (append) {
|
||
orders.value = [...orders.value, ...items];
|
||
} else {
|
||
orders.value = items;
|
||
if (selectionMode.value) {
|
||
const visible = new Set(items.map((row) => String(row.id)));
|
||
selectedOrderIds.value = selectedOrderIds.value.filter((id) => visible.has(String(id)));
|
||
}
|
||
}
|
||
total.value =
|
||
selectionMode.value
|
||
? res.total || items.length
|
||
: fulfillType
|
||
? res.total || items.length
|
||
: group.statuses.length > 1
|
||
? groupCount(group) || items.length
|
||
: res.total || items.length;
|
||
page.value = pageNo;
|
||
}
|
||
|
||
async function reload(opts?: { silent?: boolean }) {
|
||
if (!isLogin()) {
|
||
// 访客:仅展示空态营销,不因 Tab/搜索自动弹登录
|
||
orders.value = [];
|
||
loading.value = false;
|
||
return;
|
||
}
|
||
const silent = Boolean(opts?.silent) && orders.value.length > 0;
|
||
if (!silent) {
|
||
loading.value = true;
|
||
}
|
||
try {
|
||
await Promise.all([fetchCounts(), fetchPage(1, false)]);
|
||
} catch (e: any) {
|
||
Message.error(e?.message || t('h5.orders.empty'));
|
||
if (!silent) {
|
||
orders.value = [];
|
||
}
|
||
} finally {
|
||
loading.value = false;
|
||
}
|
||
}
|
||
|
||
async function softRefresh() {
|
||
if (!isLogin() || softRefreshing || loading.value) return;
|
||
softRefreshing = true;
|
||
try {
|
||
await reload({ silent: true });
|
||
} finally {
|
||
softRefreshing = false;
|
||
}
|
||
}
|
||
|
||
const { pullY, pullArmed, pullHint, onTouchStart, onTouchMove, onTouchEnd } = useH5PullRefresh({
|
||
scrollSelector: '.h5-center-main',
|
||
loading,
|
||
onRefresh: () => reload(),
|
||
labels: () => ({
|
||
hint: t('h5.orders.pull.hint'),
|
||
release: t('h5.orders.pull.release'),
|
||
refreshing: t('h5.orders.pull.refreshing'),
|
||
}),
|
||
});
|
||
|
||
async function loadMore() {
|
||
if (!hasMore.value || loadingMore.value) return;
|
||
loadingMore.value = true;
|
||
try {
|
||
await fetchPage(page.value + 1, true);
|
||
} finally {
|
||
loadingMore.value = false;
|
||
}
|
||
}
|
||
|
||
function goDetail(row: any, tab?: string) {
|
||
detailOrderId.value = row.id;
|
||
detailTab.value =
|
||
tab === 'track' || tab === 'fee' || tab === 'overview' ? tab : 'overview';
|
||
detailVisible.value = true;
|
||
}
|
||
|
||
function openPay(row: any) {
|
||
payOauthCode.value = undefined;
|
||
payOrders.value = [{ id: row.id, waybillNo: row.waybillNo }];
|
||
payVisible.value = true;
|
||
}
|
||
|
||
function resumeOrderPayOauthIfNeeded() {
|
||
const resume = consumeOrderPayOauthResume();
|
||
if (!resume) return;
|
||
payOrders.value = resume.orders;
|
||
payOauthCode.value = resume.oauthCode;
|
||
payVisible.value = true;
|
||
}
|
||
|
||
resumeOrderPayOauthIfNeeded();
|
||
|
||
function onPaySuccess() {
|
||
payOauthCode.value = undefined;
|
||
if (isBatchSelection.value) {
|
||
selectedOrderIds.value = [];
|
||
}
|
||
void reload();
|
||
}
|
||
|
||
function isBalanceLowError(error: unknown) {
|
||
const msg = String((error as any)?.message || (error as any)?.Message || error || '');
|
||
return /余额不足|balance|insufficient/i.test(msg);
|
||
}
|
||
|
||
function onPayFail(error: unknown) {
|
||
if (!isBalanceLowError(error)) return;
|
||
Modal.confirm({
|
||
title: t('h5.pay.balanceLowTitle'),
|
||
content: t('h5.pay.balanceLow'),
|
||
okText: t('h5.pay.goRecharge'),
|
||
cancelText: t('h5.pay.later'),
|
||
onOk: () => {
|
||
h5Navigate(router, '/h5/recharge');
|
||
},
|
||
});
|
||
}
|
||
|
||
function askAdvisor(row: any) {
|
||
const ctx = buildWaybillContextFromRow(row, 'h5Orders');
|
||
h5Navigate(router, {
|
||
path: '/h5/assistant',
|
||
query: buildAskAdvisorQuery(ctx),
|
||
});
|
||
}
|
||
|
||
watch(
|
||
() => [route.query.pickupSelect, route.query.pickupRebind, route.query.pickupId],
|
||
async () => {
|
||
const prev = selectionMode.value;
|
||
await syncSelectionModeFromQuery();
|
||
if (
|
||
selectionMode.value !== prev ||
|
||
resolvePickupSelectFromQuery() ||
|
||
resolvePickupRebindFromQuery()
|
||
) {
|
||
void reload();
|
||
}
|
||
},
|
||
);
|
||
|
||
watch(
|
||
() => route.query.group,
|
||
(g) => {
|
||
const raw = String(g || '');
|
||
if (groups.some((item) => item.key === raw)) {
|
||
activeGroup.value = raw as H5OrderGroupKey;
|
||
}
|
||
},
|
||
);
|
||
|
||
watch(activeGroup, () => {
|
||
if (selectionMode.value || bootstrapping) return;
|
||
void reload();
|
||
});
|
||
|
||
async function tryOpenOrderFromQuery() {
|
||
const rawId = route.query.orderId;
|
||
const idStr = Array.isArray(rawId) ? rawId[0] : rawId;
|
||
const id = Number(idStr);
|
||
if (!Number.isFinite(id) || id <= 0) return;
|
||
goDetail({ id });
|
||
const nextQuery = { ...route.query } as Record<string, any>;
|
||
delete nextQuery.orderId;
|
||
await router.replace({ query: nextQuery });
|
||
}
|
||
|
||
const ISSUE_STATUSES = ['deliveryFailed', 'problematic', 'claimed'] as const;
|
||
|
||
/** 进入运单:待支付 → 异常 → 全部(显式 group / 揽收选择模式除外) */
|
||
async function resolveEntryGroup() {
|
||
if (selectionMode.value) return;
|
||
const raw = String(route.query.group || '');
|
||
if (groups.some((g) => g.key === raw)) {
|
||
activeGroup.value = raw as H5OrderGroupKey;
|
||
return;
|
||
}
|
||
await fetchCounts();
|
||
const payCount = sumStatusCounts(statusCounts.value, ['pendingPayment']);
|
||
if (payCount > 0) {
|
||
activeGroup.value = 'actionNeeded';
|
||
return;
|
||
}
|
||
const issueCount = sumStatusCounts(statusCounts.value, [...ISSUE_STATUSES]);
|
||
if (issueCount > 0) {
|
||
activeGroup.value = 'issue';
|
||
return;
|
||
}
|
||
activeGroup.value = 'all';
|
||
}
|
||
|
||
watch(
|
||
() => route.query.orderId,
|
||
(orderId) => {
|
||
if (!orderId) return;
|
||
void tryOpenOrderFromQuery();
|
||
},
|
||
);
|
||
|
||
const isLoggedIn = computed(() => isLogin());
|
||
|
||
function promptGuestLogin() {
|
||
ensureH5Login({
|
||
reasonKey: 'h5.loginGate.reason.orders',
|
||
redirect: '/h5/orders',
|
||
});
|
||
}
|
||
|
||
function promptGuestRegister() {
|
||
startH5WeChatRegister({ redirect: '/h5/orders' });
|
||
}
|
||
|
||
async function bootstrap() {
|
||
if (!isLogin()) {
|
||
bootstrapping = false;
|
||
didBootstrap = true;
|
||
loading.value = false;
|
||
orders.value = [];
|
||
return;
|
||
}
|
||
await syncSelectionModeFromQuery();
|
||
await resolveEntryGroup();
|
||
bootstrapping = false;
|
||
await reload();
|
||
didBootstrap = true;
|
||
await tryOpenOrderFromQuery();
|
||
}
|
||
|
||
onActivated(() => {
|
||
if (!didBootstrap) return;
|
||
void softRefresh();
|
||
});
|
||
|
||
void bootstrap();
|
||
</script>
|
||
|
||
<style lang="less" scoped>
|
||
.h5-orders-page {
|
||
display: flex;
|
||
flex-direction: column;
|
||
padding: 12px 16px 24px;
|
||
background: #f5f6f8;
|
||
min-height: calc(100dvh - var(--h5-dock-offset, 56px));
|
||
box-sizing: border-box;
|
||
transform: translateY(var(--pull-y, 0px));
|
||
transition: transform 0.12s ease-out;
|
||
|
||
&.is-pulling {
|
||
transition: none;
|
||
}
|
||
|
||
&.is-selection-mode {
|
||
padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
|
||
background: linear-gradient(180deg, #eef6f6 0%, #f5f6f8 220px);
|
||
}
|
||
|
||
&.is-batch-mode {
|
||
padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px));
|
||
background: #f5f6f8;
|
||
}
|
||
|
||
/* 首屏加载 / 无订单:在工具栏下方剩余区域居中 */
|
||
> .h5-empty-state {
|
||
flex: 1;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-height: 0;
|
||
}
|
||
}
|
||
|
||
.h5-orders-pull {
|
||
height: 0;
|
||
overflow: hidden;
|
||
display: flex;
|
||
align-items: flex-end;
|
||
justify-content: center;
|
||
margin: 0;
|
||
padding-bottom: 0;
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
color: var(--h5-text-3, #86909c);
|
||
transition:
|
||
height 0.12s ease-out,
|
||
margin 0.12s ease-out,
|
||
padding-bottom 0.12s ease-out;
|
||
|
||
/* 仅下拉展开时上探,避免常态负 margin 吃掉页面顶 padding */
|
||
&.is-ready,
|
||
&.is-loading {
|
||
height: 28px;
|
||
margin: -4px -16px 4px;
|
||
padding-bottom: 8px;
|
||
color: var(--app-primary-color);
|
||
}
|
||
}
|
||
|
||
.h5-orders-page.is-enter-anim {
|
||
.h5-orders-enter {
|
||
animation: h5-orders-soft-in 0.48s cubic-bezier(0.16, 1, 0.3, 1) both;
|
||
animation-delay: var(--h5-orders-delay, 0ms);
|
||
}
|
||
|
||
.h5-order-card.h5-enter,
|
||
.h5-pickup-card.h5-enter,
|
||
.h5-batch-hint.h5-enter,
|
||
.h5-pickup-hero.h5-enter {
|
||
animation: h5-orders-soft-in 0.48s cubic-bezier(0.16, 1, 0.3, 1) both;
|
||
}
|
||
}
|
||
|
||
@keyframes h5-orders-soft-in {
|
||
from {
|
||
opacity: 0;
|
||
transform: translateY(10px);
|
||
}
|
||
to {
|
||
opacity: 1;
|
||
transform: translateY(0);
|
||
}
|
||
}
|
||
|
||
.h5-pickup-hero {
|
||
margin-bottom: 12px;
|
||
padding: 14px;
|
||
border-radius: 16px;
|
||
background: linear-gradient(135deg, #fff 0%, var(--h5-primary-softer, #f3faf9) 100%);
|
||
box-shadow: var(--h5-shadow, 0 4px 16px rgba(15, 23, 42, 0.05));
|
||
border: 1px solid color-mix(in srgb, var(--app-primary-color) 12%, #fff);
|
||
}
|
||
|
||
.h5-pickup-hero__top {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
margin-bottom: 12px;
|
||
}
|
||
|
||
.h5-pickup-hero__cancel {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 2px;
|
||
border: none;
|
||
background: transparent;
|
||
padding: 0;
|
||
font-size: 14px;
|
||
color: var(--h5-text-2, #4e5969);
|
||
cursor: pointer;
|
||
|
||
:deep(.arco-icon) {
|
||
font-size: 14px;
|
||
}
|
||
}
|
||
|
||
.h5-pickup-hero__steps {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
padding: 4px 10px;
|
||
border-radius: 999px;
|
||
background: #f2f3f5;
|
||
font-size: 11px;
|
||
font-weight: 600;
|
||
color: var(--h5-text-3, #86909c);
|
||
|
||
i {
|
||
width: 16px;
|
||
height: 1px;
|
||
background: #c9cdd4;
|
||
}
|
||
|
||
.is-active {
|
||
color: var(--app-primary-color);
|
||
}
|
||
}
|
||
|
||
.h5-pickup-hero__body {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
gap: 12px;
|
||
}
|
||
|
||
.h5-pickup-hero__icon {
|
||
width: 44px;
|
||
height: 44px;
|
||
flex-shrink: 0;
|
||
object-fit: contain;
|
||
}
|
||
|
||
.h5-pickup-hero__text {
|
||
min-width: 0;
|
||
|
||
h2 {
|
||
margin: 0 0 4px;
|
||
font-size: 16px;
|
||
font-weight: 700;
|
||
color: var(--h5-text, #1d2129);
|
||
line-height: 1.35;
|
||
}
|
||
|
||
p {
|
||
margin: 0;
|
||
font-size: 12px;
|
||
line-height: 1.5;
|
||
color: var(--h5-text-3, #86909c);
|
||
}
|
||
}
|
||
|
||
.h5-pickup-hero__stats {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
margin-top: 12px;
|
||
}
|
||
|
||
.h5-pickup-hero__chip {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
height: 26px;
|
||
padding: 0 10px;
|
||
border-radius: 999px;
|
||
background: #f2f3f5;
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
color: var(--h5-text-2, #4e5969);
|
||
|
||
&.is-primary {
|
||
background: var(--h5-primary-soft, #e6f4f4);
|
||
color: var(--app-primary-color);
|
||
}
|
||
}
|
||
|
||
.h5-orders-toolbar.is-pickup-mode {
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.h5-pickup-card {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
gap: 12px;
|
||
margin-bottom: 10px;
|
||
padding: 14px;
|
||
border-radius: 14px;
|
||
background: #fff;
|
||
border: 1.5px solid transparent;
|
||
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
|
||
cursor: pointer;
|
||
text-align: left;
|
||
transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
|
||
|
||
&.is-selected {
|
||
border-color: var(--app-primary-color);
|
||
box-shadow: 0 4px 14px color-mix(in srgb, var(--app-primary-color) 18%, transparent);
|
||
}
|
||
|
||
&.is-disabled {
|
||
opacity: 0.58;
|
||
cursor: not-allowed;
|
||
}
|
||
|
||
&:active:not(.is-disabled) {
|
||
transform: scale(0.992);
|
||
}
|
||
}
|
||
|
||
.h5-pickup-card__check {
|
||
flex-shrink: 0;
|
||
width: 22px;
|
||
height: 22px;
|
||
margin-top: 2px;
|
||
border-radius: 50%;
|
||
border: 1.5px solid #c9cdd4;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
color: #fff;
|
||
background: #fff;
|
||
|
||
&.is-checked {
|
||
border-color: var(--app-primary-color);
|
||
background: var(--app-primary-color);
|
||
|
||
:deep(.arco-icon) {
|
||
font-size: 12px;
|
||
}
|
||
}
|
||
|
||
&.is-disabled {
|
||
border-color: #e5e6eb;
|
||
background: #f7f8fa;
|
||
}
|
||
}
|
||
|
||
.h5-pickup-card__main {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.h5-pickup-card__row {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 8px;
|
||
margin-bottom: 6px;
|
||
|
||
strong {
|
||
font-size: 14px;
|
||
font-weight: 700;
|
||
color: #1d2129;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
}
|
||
|
||
.h5-pickup-card__status {
|
||
flex-shrink: 0;
|
||
font-size: 11px;
|
||
padding: 2px 7px;
|
||
border-radius: 6px;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.h5-pickup-card__meta {
|
||
margin: 0;
|
||
font-size: 12px;
|
||
color: #86909c;
|
||
line-height: 1.4;
|
||
|
||
i {
|
||
font-style: normal;
|
||
margin: 0 4px;
|
||
color: #c9cdd4;
|
||
}
|
||
}
|
||
|
||
.h5-pickup-card__reason {
|
||
margin: 0;
|
||
font-size: 12px;
|
||
color: #ff7d00;
|
||
line-height: 1.4;
|
||
}
|
||
|
||
.h5-orders-pickup-bar {
|
||
position: fixed;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: var(--h5-dock-offset);
|
||
z-index: 110;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
padding: 12px 16px;
|
||
background: rgba(255, 255, 255, 0.98);
|
||
border-top: 1px solid var(--h5-border-soft, #f2f3f5);
|
||
box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
|
||
backdrop-filter: blur(10px);
|
||
}
|
||
|
||
.h5-orders-pickup-bar__summary {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
}
|
||
|
||
.h5-orders-pickup-bar__count {
|
||
flex-shrink: 0;
|
||
width: 36px;
|
||
height: 36px;
|
||
border-radius: 12px;
|
||
background: var(--h5-primary-soft, #e6f4f4);
|
||
color: var(--app-primary-color);
|
||
font-size: 16px;
|
||
font-weight: 700;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.h5-orders-pickup-bar__text {
|
||
min-width: 0;
|
||
|
||
strong {
|
||
display: block;
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
color: var(--h5-text, #1d2129);
|
||
line-height: 1.35;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
em {
|
||
display: block;
|
||
margin-top: 2px;
|
||
font-style: normal;
|
||
font-size: 11px;
|
||
color: var(--h5-text-3, #86909c);
|
||
}
|
||
}
|
||
|
||
.h5-orders-pickup-bar__btn {
|
||
flex-shrink: 0;
|
||
border: none;
|
||
min-width: 96px;
|
||
height: 44px;
|
||
padding: 0 20px;
|
||
border-radius: 22px;
|
||
background: var(--app-primary-color);
|
||
color: #fff;
|
||
font-size: 15px;
|
||
font-weight: 600;
|
||
cursor: pointer;
|
||
box-shadow: 0 6px 16px color-mix(in srgb, var(--app-primary-color) 28%, transparent);
|
||
|
||
&:disabled {
|
||
opacity: 0.45;
|
||
box-shadow: none;
|
||
cursor: not-allowed;
|
||
}
|
||
}
|
||
|
||
.h5-orders-toolbar {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
margin-bottom: 8px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.h5-orders-search {
|
||
position: relative;
|
||
display: flex;
|
||
align-items: center;
|
||
flex: 1;
|
||
min-width: 0;
|
||
height: 28px;
|
||
padding: 0 10px 0 30px;
|
||
border-radius: 6px;
|
||
background: rgba(255, 255, 255, 0.92);
|
||
box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
|
||
}
|
||
|
||
.h5-orders-search__icon {
|
||
position: absolute;
|
||
left: 10px;
|
||
color: #c9cdd4;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.h5-orders-search__input {
|
||
flex: 1;
|
||
min-width: 0;
|
||
height: 100%;
|
||
border: none;
|
||
outline: none;
|
||
background: transparent;
|
||
font-size: 13px;
|
||
color: #1d2129;
|
||
|
||
&::placeholder {
|
||
color: #c9cdd4;
|
||
}
|
||
}
|
||
|
||
.h5-orders-search__clear {
|
||
border: none;
|
||
background: transparent;
|
||
color: #c9cdd4;
|
||
font-size: 18px;
|
||
line-height: 1;
|
||
padding: 0 2px;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.h5-orders-search-btn {
|
||
flex: 0 0 auto;
|
||
height: 28px;
|
||
padding: 0 10px;
|
||
border: none;
|
||
border-radius: 6px;
|
||
background: var(--app-primary-color);
|
||
color: #fff;
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
white-space: nowrap;
|
||
cursor: pointer;
|
||
|
||
&:active {
|
||
opacity: 0.88;
|
||
}
|
||
}
|
||
|
||
.h5-orders-tabs {
|
||
flex-shrink: 0;
|
||
display: flex;
|
||
gap: 2px;
|
||
overflow-x: auto;
|
||
-webkit-overflow-scrolling: touch;
|
||
padding: 2px 0 10px;
|
||
margin-bottom: 2px;
|
||
|
||
&::-webkit-scrollbar {
|
||
display: none;
|
||
}
|
||
}
|
||
|
||
.h5-orders-tab {
|
||
flex: 0 0 auto;
|
||
height: 28px;
|
||
padding: 0 10px;
|
||
border: none;
|
||
border-radius: 6px;
|
||
background: transparent;
|
||
font-size: 13px;
|
||
font-weight: 500;
|
||
color: #86909c;
|
||
white-space: nowrap;
|
||
cursor: pointer;
|
||
|
||
em {
|
||
margin-left: 3px;
|
||
font-style: normal;
|
||
font-size: 11px;
|
||
font-weight: 600;
|
||
opacity: 0.75;
|
||
}
|
||
|
||
&.is-alert em {
|
||
color: #cf1322;
|
||
opacity: 1;
|
||
}
|
||
|
||
&.is-active {
|
||
color: #4e5969;
|
||
background: rgba(15, 23, 42, 0.05);
|
||
font-weight: 600;
|
||
}
|
||
}
|
||
|
||
.h5-orders-batch-entry {
|
||
flex: 0 0 auto;
|
||
height: 28px;
|
||
padding: 0 10px;
|
||
border: 1px solid #e5e6eb;
|
||
border-radius: 6px;
|
||
background: #fff;
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
color: #4e5969;
|
||
white-space: nowrap;
|
||
cursor: pointer;
|
||
box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
|
||
|
||
&.is-on {
|
||
border-color: color-mix(in srgb, var(--app-primary-color) 35%, #fff);
|
||
background: color-mix(in srgb, var(--app-primary-color) 10%, #fff);
|
||
color: var(--app-primary-color);
|
||
}
|
||
|
||
&:active {
|
||
opacity: 0.85;
|
||
}
|
||
}
|
||
|
||
.h5-batch-hint {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
margin: 0 0 10px;
|
||
padding: 10px 12px;
|
||
border-radius: 12px;
|
||
background: #fff;
|
||
border: 1px solid #eef0f3;
|
||
|
||
p {
|
||
flex: 1;
|
||
margin: 0;
|
||
font-size: 12px;
|
||
line-height: 1.4;
|
||
color: #86909c;
|
||
}
|
||
}
|
||
|
||
.h5-batch-hint__all {
|
||
flex: 0 0 auto;
|
||
height: 28px;
|
||
padding: 0 10px;
|
||
border: none;
|
||
border-radius: 6px;
|
||
background: rgba(15, 23, 42, 0.05);
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
color: var(--app-primary-color);
|
||
cursor: pointer;
|
||
}
|
||
|
||
.h5-orders-batch-bar {
|
||
position: fixed;
|
||
left: 12px;
|
||
right: 12px;
|
||
bottom: var(--h5-dock-offset);
|
||
z-index: 110;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8px;
|
||
padding: 10px 12px 12px;
|
||
border-radius: 16px;
|
||
background: #fff;
|
||
box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
|
||
border: 1px solid #eef0f3;
|
||
}
|
||
|
||
.h5-orders-batch-bar__summary {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
|
||
strong {
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
color: #1d2129;
|
||
}
|
||
}
|
||
|
||
.h5-orders-batch-bar__count {
|
||
min-width: 22px;
|
||
height: 22px;
|
||
padding: 0 6px;
|
||
border-radius: 11px;
|
||
background: var(--app-primary-color);
|
||
color: #fff;
|
||
font-size: 12px;
|
||
font-weight: 700;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.h5-orders-batch-bar__actions {
|
||
display: flex;
|
||
gap: 8px;
|
||
overflow-x: auto;
|
||
-webkit-overflow-scrolling: touch;
|
||
|
||
&::-webkit-scrollbar {
|
||
display: none;
|
||
}
|
||
}
|
||
|
||
.h5-orders-batch-bar__btn {
|
||
flex: 0 0 auto;
|
||
height: 36px;
|
||
padding: 0 12px;
|
||
border-radius: 10px;
|
||
border: 1px solid #e5e6eb;
|
||
background: #fff;
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
color: #4e5969;
|
||
white-space: nowrap;
|
||
cursor: pointer;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 4px;
|
||
|
||
em {
|
||
font-style: normal;
|
||
min-width: 16px;
|
||
height: 16px;
|
||
padding: 0 4px;
|
||
border-radius: 8px;
|
||
background: rgba(15, 23, 42, 0.08);
|
||
font-size: 11px;
|
||
line-height: 16px;
|
||
}
|
||
|
||
&.is-pay {
|
||
border-color: color-mix(in srgb, #f53f3f 30%, #fff);
|
||
background: color-mix(in srgb, #f53f3f 8%, #fff);
|
||
color: #f53f3f;
|
||
|
||
em {
|
||
background: color-mix(in srgb, #f53f3f 16%, #fff);
|
||
}
|
||
}
|
||
|
||
&:disabled {
|
||
opacity: 0.4;
|
||
cursor: not-allowed;
|
||
}
|
||
|
||
&:not(:disabled):active {
|
||
opacity: 0.85;
|
||
}
|
||
}
|
||
|
||
.h5-orders-spin {
|
||
flex: 1;
|
||
width: 100%;
|
||
min-height: 0;
|
||
display: flex !important;
|
||
flex-direction: column;
|
||
|
||
:deep(.h5-empty-state) {
|
||
flex: 1;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-height: 0;
|
||
}
|
||
}
|
||
|
||
.h5-order-card {
|
||
margin-bottom: 12px;
|
||
padding: 18px 16px;
|
||
border-radius: 14px;
|
||
border: none;
|
||
background: #fff;
|
||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
||
cursor: pointer;
|
||
text-align: left;
|
||
transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
|
||
|
||
&:active {
|
||
transform: scale(0.992);
|
||
}
|
||
}
|
||
|
||
/* 顶栏:渠道 + 单号(左上) */
|
||
.h5-order-top {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-start;
|
||
gap: 10px;
|
||
margin-bottom: 18px;
|
||
}
|
||
|
||
.h5-order-no {
|
||
min-width: 0;
|
||
flex: 1;
|
||
margin: 0;
|
||
border: none;
|
||
background: transparent;
|
||
padding: 0;
|
||
font: inherit;
|
||
font-size: 12px;
|
||
font-weight: 500;
|
||
color: #86909c;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: flex-start;
|
||
gap: 3px;
|
||
cursor: pointer;
|
||
text-align: left;
|
||
/* 绕过浏览器最小字号:12×0.83 ≈ 10 */
|
||
zoom: 0.83;
|
||
}
|
||
|
||
.h5-order-no__text {
|
||
min-width: 0;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.h5-order-no__copy {
|
||
flex-shrink: 0;
|
||
color: #c9cdd4;
|
||
font-size: 12px;
|
||
}
|
||
|
||
.h5-order-amount {
|
||
display: inline-flex;
|
||
align-items: baseline;
|
||
gap: 4px;
|
||
color: #f53f3f;
|
||
line-height: 1.15;
|
||
white-space: nowrap;
|
||
|
||
small {
|
||
font-size: 11px;
|
||
font-weight: 500;
|
||
opacity: 0.85;
|
||
}
|
||
|
||
em {
|
||
font-style: normal;
|
||
font-size: 15px;
|
||
font-weight: 700;
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
|
||
&.is-paid {
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
color: #00b42a;
|
||
}
|
||
}
|
||
|
||
/* 主视觉:仓 → 国(直接铺在卡片上) */
|
||
.h5-order-route {
|
||
display: grid;
|
||
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
|
||
align-items: center;
|
||
gap: 8px;
|
||
min-height: 56px;
|
||
margin-bottom: 18px;
|
||
}
|
||
|
||
.h5-order-route__end {
|
||
min-width: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 5px;
|
||
text-align: center;
|
||
|
||
strong {
|
||
max-width: 100%;
|
||
font-size: 16px;
|
||
font-weight: 700;
|
||
color: #1d2129;
|
||
line-height: 1.25;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
em {
|
||
max-width: 100%;
|
||
font-style: normal;
|
||
font-size: 11px;
|
||
color: #86909c;
|
||
line-height: 1.2;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
&--dest {
|
||
strong {
|
||
color: var(--app-primary-color);
|
||
}
|
||
}
|
||
}
|
||
|
||
.h5-order-route__mid {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 6px;
|
||
min-width: 64px;
|
||
padding: 0 4px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.h5-order-route__progress {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 3px;
|
||
width: 40px;
|
||
|
||
i {
|
||
flex: 1;
|
||
height: 2px;
|
||
border-radius: 1px;
|
||
background: #e5e6eb;
|
||
transition: background 0.2s ease;
|
||
|
||
&.is-done {
|
||
background: #00b42a;
|
||
}
|
||
}
|
||
}
|
||
|
||
.h5-order-route__status {
|
||
font-style: normal;
|
||
font-size: 11px;
|
||
font-weight: 600;
|
||
color: #86909c;
|
||
line-height: 1.2;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.h5-order-route__domestic {
|
||
display: block;
|
||
margin-top: 4px;
|
||
font-size: 10px;
|
||
color: #86909c;
|
||
font-family: var(--app-font-mono);
|
||
max-width: 100%;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
/* 底栏:时间左下 + 操作右下 */
|
||
.h5-order-foot {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.h5-order-foot__time {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: flex-start;
|
||
justify-content: center;
|
||
gap: 2px;
|
||
}
|
||
|
||
.h5-order-time {
|
||
margin: 0;
|
||
max-width: 100%;
|
||
font-size: 12px;
|
||
font-weight: 400;
|
||
line-height: 1.35;
|
||
color: #86909c;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
/* 绕过浏览器最小字号:12×0.83 ≈ 10 */
|
||
zoom: 0.83;
|
||
}
|
||
|
||
.h5-order-eta-tip {
|
||
max-width: 100%;
|
||
font-size: 12px;
|
||
font-weight: 500;
|
||
line-height: 1.35;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
zoom: 0.83;
|
||
|
||
&.is-early,
|
||
&.is-ontime {
|
||
color: #00b42a;
|
||
}
|
||
|
||
&.is-late {
|
||
color: #f53f3f;
|
||
}
|
||
}
|
||
|
||
.h5-order-foot__action {
|
||
flex-shrink: 0;
|
||
display: inline-flex;
|
||
flex-wrap: wrap;
|
||
justify-content: flex-end;
|
||
align-items: center;
|
||
gap: 8px;
|
||
margin-left: auto;
|
||
max-width: 70%;
|
||
}
|
||
|
||
.primary-btn {
|
||
border: none;
|
||
height: 26px;
|
||
padding: 0 10px;
|
||
border-radius: 13px;
|
||
background: var(--app-primary-color);
|
||
color: #fff;
|
||
font-size: 12px;
|
||
font-weight: 600;
|
||
cursor: pointer;
|
||
white-space: nowrap;
|
||
box-shadow: 0 2px 8px color-mix(in srgb, var(--app-primary-color) 22%, transparent);
|
||
|
||
&:disabled {
|
||
opacity: 0.55;
|
||
cursor: not-allowed;
|
||
}
|
||
|
||
&--danger {
|
||
background: #f53f3f;
|
||
box-shadow: 0 2px 8px rgba(245, 63, 63, 0.22);
|
||
}
|
||
|
||
&--warn {
|
||
background: #ff7d00;
|
||
box-shadow: 0 2px 8px rgba(255, 125, 0, 0.22);
|
||
}
|
||
|
||
&--ghost {
|
||
background: #f2f3f5;
|
||
color: #4e5969;
|
||
box-shadow: none;
|
||
|
||
&:active:not(:disabled) {
|
||
background: #e5e6eb;
|
||
}
|
||
}
|
||
}
|
||
|
||
.h5-orders-more {
|
||
margin-top: 8px;
|
||
}
|
||
|
||
@media (prefers-reduced-motion: reduce) {
|
||
.h5-orders-page.is-enter-anim .h5-orders-enter,
|
||
.h5-orders-page.is-enter-anim .h5-order-card.h5-enter,
|
||
.h5-orders-page.is-enter-anim .h5-pickup-card.h5-enter,
|
||
.h5-orders-page.is-enter-anim .h5-batch-hint.h5-enter,
|
||
.h5-orders-page.is-enter-anim .h5-pickup-hero.h5-enter {
|
||
animation: none;
|
||
}
|
||
}
|
||
</style>
|