All checks were successful
Build and Deploy Front / deploy (push) Successful in 5m56s
- 支付弹窗(PC/H5)支持选券与批量支付体验优化,运单管理复用我的订单支付弹窗;立即支付仅允许待支付订单 - 订单详情费用明细展示优惠券抵扣/会员折扣负数行与「含优惠」;价格配置与手工加费过滤抵扣费用项 - 申报明细新增产品标识编码/非标产品标识编码/标准产品标识编码(PC/H5 下单、改单、详情、开放接口文档、公式目录、Excel 模板) - 9610 页「批量申报」改为「创建9610订单」:选运单并补充出口资质备案、电商平台 - 店铺订单批量按钮按动作独立 loading,获取面单限并发并显示进度 - 另含:国家管理、登录门户切换、监控与工作台、公告弹窗、nginx/vite 配置等改动
3523 lines
104 KiB
Vue
3523 lines
104 KiB
Vue
<template>
|
||
<DrawerPro
|
||
:footer="false"
|
||
padding-bottom="16px"
|
||
@register="register"
|
||
@cancel="handleCancel"
|
||
>
|
||
<div
|
||
class="order-detail-drawer order-detail-drawer-shell"
|
||
:class="{ 'has-action-bar': showActionBar }"
|
||
>
|
||
<div class="drawer-tabs">
|
||
<div class="tabs-slot">
|
||
<SlidingTabs
|
||
v-model="activeTab"
|
||
:items="slidingTabItems"
|
||
@change="handleTabChange"
|
||
/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="drawer-tab-content">
|
||
<!-- 基本信息 -->
|
||
<div v-if="activeTab === 'basic'" class="tab-panel basic-info">
|
||
<div v-if="predeclareFailGuide" class="predeclare-fail-guide">
|
||
<p class="predeclare-fail-guide__reason">{{ predeclareFailGuide.reason }}</p>
|
||
<p v-if="predeclareFailGuide.tips?.[0]" class="predeclare-fail-guide__tip">
|
||
<span class="predeclare-fail-guide__tip-label">
|
||
{{ $t('order.myOrders.drawer.failGuideTip') }}
|
||
</span>
|
||
{{ predeclareFailGuide.tips[0] }}
|
||
</p>
|
||
<details
|
||
v-if="predeclareFailGuide.rawReason !== predeclareFailGuide.reason"
|
||
class="predeclare-fail-guide__details"
|
||
>
|
||
<summary>{{ $t('order.myOrders.drawer.failGuideRaw') }}</summary>
|
||
<p class="predeclare-fail-guide__raw">{{ predeclareFailGuide.rawReason }}</p>
|
||
</details>
|
||
<div v-if="canEditOrderDetail" class="predeclare-fail-guide__actions">
|
||
<a-button class="app-btn-search" @click="startBasicEdit">
|
||
{{ $t('order.myOrders.drawer.failGuideEdit') }}
|
||
</a-button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="basic-view-switch">
|
||
<SlidingTabs
|
||
v-model="basicViewMode"
|
||
size="mini"
|
||
class="basic-view-tabs"
|
||
:items="basicViewTabs"
|
||
:aria-label="$t('order.myOrders.drawer.tabs.basic')"
|
||
/>
|
||
</div>
|
||
|
||
<template v-for="section in visibleBasicSections" :key="section.key">
|
||
<div class="detail-section" :class="section.key">
|
||
<div
|
||
class="detail-section-header"
|
||
:class="{ 'is-collapsible': isCollapsibleSection(section.key) }"
|
||
@click="toggleSectionCollapse(section.key)"
|
||
>
|
||
<div class="detail-section-title-wrap">
|
||
<span class="detail-section-dot" />
|
||
<span class="detail-section-title">{{ $t(section.labelKey) }}</span>
|
||
<a-tag
|
||
v-if="section.key === 'declaration'"
|
||
size="small"
|
||
color="arcoblue"
|
||
>
|
||
{{ displayDeclarationRows.length }}
|
||
</a-tag>
|
||
<div
|
||
v-if="section.key === 'declaration'"
|
||
class="declaration-header-sum"
|
||
:class="{ 'is-editable': basicEditing }"
|
||
@click.stop
|
||
>
|
||
<template v-if="basicEditing">
|
||
<a-select
|
||
v-model="basicEditForm.declaredCurrency"
|
||
size="mini"
|
||
allow-search
|
||
allow-clear
|
||
:loading="currencyOptionsLoading"
|
||
:placeholder="$t('order.myOrders.drawer.declaredCurrency')"
|
||
class="declaration-header-currency"
|
||
>
|
||
<a-option
|
||
v-for="opt in currencyOptions"
|
||
:key="opt.value"
|
||
:value="opt.value"
|
||
>
|
||
{{ opt.label }}
|
||
</a-option>
|
||
</a-select>
|
||
<a-input-number
|
||
v-model="basicEditForm.declaredSum"
|
||
size="mini"
|
||
:min="0"
|
||
:precision="2"
|
||
hide-button
|
||
class="declaration-header-amount"
|
||
:placeholder="$t('order.myOrders.drawer.declaredSum')"
|
||
/>
|
||
</template>
|
||
<span v-else class="declaration-header-sum-text">
|
||
{{ getOrderValue('declaredSum') }}
|
||
</span>
|
||
</div>
|
||
</div>
|
||
<div class="detail-section-header-actions">
|
||
<icon-down v-if="isCollapsibleSection(section.key) && isSectionCollapsed(section.key)" />
|
||
<icon-up v-else-if="isCollapsibleSection(section.key)" />
|
||
<a-button
|
||
v-if="section.key === 'declaration' && basicEditing"
|
||
class="app-btn-search"
|
||
@click.stop="addDeclarationRow"
|
||
>
|
||
{{ $t('order.myOrders.drawer.declaration.addRow') }}
|
||
</a-button>
|
||
</div>
|
||
</div>
|
||
|
||
<div v-show="!isSectionCollapsed(section.key)" class="detail-section-body">
|
||
<!-- 订单基本信息 -->
|
||
<template v-if="section.key === 'basic'">
|
||
<div
|
||
v-for="group in orderBasicFieldGroups"
|
||
:key="group.key"
|
||
class="detail-field-group"
|
||
>
|
||
<div class="detail-field-group-title">{{ $t(group.labelKey) }}</div>
|
||
<div class="detail-fields-grid">
|
||
<div
|
||
v-for="fieldKey in group.fields"
|
||
:key="fieldKey"
|
||
class="detail-field-item"
|
||
:class="{ 'is-editable': basicEditing && isOrderFieldEditable(fieldKey) }"
|
||
>
|
||
<span class="detail-field-label">{{ $t(getOrderFieldLabelKey(fieldKey)) }}</span>
|
||
<div class="detail-field-value">
|
||
<template v-if="basicEditing && isOrderFieldEditable(fieldKey)">
|
||
<a-select
|
||
v-if="fieldKey === 'warehouse'"
|
||
v-model="basicEditForm.warehouseId"
|
||
allow-clear
|
||
allow-search
|
||
size="small"
|
||
:loading="warehouseOptionsLoading"
|
||
:placeholder="$t('order.myOrders.drawer.warehouse')"
|
||
>
|
||
<a-option
|
||
v-for="opt in warehouseOptions"
|
||
:key="opt.value"
|
||
:value="opt.value"
|
||
>
|
||
{{ opt.label }}
|
||
</a-option>
|
||
</a-select>
|
||
<a-select
|
||
v-else-if="getOrderEditMeta(fieldKey)?.inputType === 'select'"
|
||
v-model="basicEditForm[fieldKey]"
|
||
allow-clear
|
||
size="small"
|
||
>
|
||
<a-option
|
||
v-for="opt in getOrderEditMeta(fieldKey)?.options"
|
||
:key="opt.value"
|
||
:value="opt.value"
|
||
>
|
||
{{ $t(opt.labelKey) }}
|
||
</a-option>
|
||
</a-select>
|
||
<a-switch
|
||
v-else-if="getOrderEditMeta(fieldKey)?.inputType === 'switch'"
|
||
v-model="basicEditForm[fieldKey]"
|
||
size="small"
|
||
/>
|
||
<a-input-number
|
||
v-else-if="getOrderEditMeta(fieldKey)?.inputType === 'number'"
|
||
v-model="basicEditForm[fieldKey]"
|
||
:min="0"
|
||
size="small"
|
||
style="width: 100%"
|
||
/>
|
||
<a-input
|
||
v-else
|
||
v-model="basicEditForm[fieldKey]"
|
||
allow-clear
|
||
size="small"
|
||
/>
|
||
</template>
|
||
<template v-else-if="fieldKey === 'orderStatus' && currentOrderStatusMeta">
|
||
<a-tag
|
||
size="small"
|
||
:style="getOrderStatusTagStyle(currentOrderStatusMeta)"
|
||
>
|
||
{{ getOrderValue(fieldKey) }}
|
||
</a-tag>
|
||
</template>
|
||
<template v-else-if="isOrderBooleanField(fieldKey)">
|
||
<a-tag
|
||
size="small"
|
||
:style="getOrderBooleanTagStyle(fieldKey)"
|
||
>
|
||
{{ getOrderValue(fieldKey) }}
|
||
</a-tag>
|
||
</template>
|
||
<template v-else-if="fieldKey === 'additionalServices'">
|
||
<a-space v-if="orderAdditionalServiceCodes.length" wrap :size="4">
|
||
<a-tag
|
||
v-for="code in orderAdditionalServiceCodes"
|
||
:key="code"
|
||
size="small"
|
||
>
|
||
{{ labelAdditionalService(code) }}
|
||
</a-tag>
|
||
</a-space>
|
||
<span v-else class="detail-field-text">--</span>
|
||
</template>
|
||
<span v-else class="detail-field-text">{{ getOrderValue(fieldKey) }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<!-- 发件人 -->
|
||
<template v-else-if="section.key === 'sender'">
|
||
<a-empty
|
||
v-if="!basicEditing && !hasSender"
|
||
:description="$t('order.myOrders.drawer.sender.empty')"
|
||
:image-style="{ height: '48px' }"
|
||
class="detail-section-empty"
|
||
/>
|
||
<div v-else class="detail-fields-grid">
|
||
<div
|
||
v-for="field in senderFields"
|
||
:key="field.key"
|
||
class="detail-field-item"
|
||
:class="{ 'is-editable': basicEditing && isSenderFieldEditable(field.key) }"
|
||
>
|
||
<span class="detail-field-label">{{ $t(field.labelKey) }}</span>
|
||
<div class="detail-field-value">
|
||
<template v-if="basicEditing && isSenderFieldEditable(field.key)">
|
||
<a-input
|
||
v-model="senderEditForm[getSenderFormKey(field.key)]"
|
||
allow-clear
|
||
size="small"
|
||
/>
|
||
</template>
|
||
<template v-else-if="field.key === 'isDefault'">
|
||
<a-tag
|
||
size="small"
|
||
:style="getBooleanTagStyle(getSenderValue(field.key) === $t('order.myOrders.drawer.yes'))"
|
||
>
|
||
{{ getSenderValue(field.key) }}
|
||
</a-tag>
|
||
</template>
|
||
<span v-else class="detail-field-text">{{ getSenderValue(field.key) }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<!-- 收件人 -->
|
||
<template v-else-if="section.key === 'recipient'">
|
||
<div class="detail-fields-grid">
|
||
<div
|
||
v-for="field in recipientFields"
|
||
:key="field.key"
|
||
class="detail-field-item"
|
||
:class="{ 'is-editable': basicEditing && isRecipientFieldEditable(field.key) }"
|
||
>
|
||
<span class="detail-field-label">{{ $t(field.labelKey) }}</span>
|
||
<div class="detail-field-value">
|
||
<template v-if="basicEditing && isRecipientFieldEditable(field.key)">
|
||
<a-input
|
||
v-model="receiverEditForm[getRecipientFormKey(field.key)]"
|
||
allow-clear
|
||
size="small"
|
||
/>
|
||
</template>
|
||
<span v-else class="detail-field-text">{{ getRecipientValue(field.key) }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<!-- 申报信息 -->
|
||
<template v-else-if="section.key === 'declaration'">
|
||
<div v-if="displayDeclarationRows.length" class="declaration-table-wrap">
|
||
<OrderDeclarationHotTable
|
||
:data="displayDeclarationRows"
|
||
:editing="basicEditing"
|
||
@remove-row="removeDeclarationRow"
|
||
@preview-sku-image="openDeclarationSkuPreview"
|
||
/>
|
||
</div>
|
||
<a-empty
|
||
v-else
|
||
:description="$t('order.myOrders.drawer.declaration.empty')"
|
||
:image-style="{ height: '48px' }"
|
||
class="detail-section-empty"
|
||
/>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
|
||
<!-- 重量&费用:预报/收货件重尺 + 应收 -->
|
||
<div v-if="activeTab === 'weightFee'" class="tab-panel weight-fee-panel">
|
||
<section class="weight-fee-block">
|
||
<div class="weight-fee-block-title">{{ $t('order.myOrders.drawer.weightFee.weightTitle') }}</div>
|
||
<div class="weight-summary">
|
||
<button
|
||
v-for="section in customerWeightTypeDefs"
|
||
:key="section.key"
|
||
type="button"
|
||
class="weight-summary-card"
|
||
:class="[section.key, { active: weightViewMode === section.key }]"
|
||
@click="setWeightViewMode(section.key)"
|
||
>
|
||
<span class="weight-summary-label">{{ $t(section.labelKey) }}</span>
|
||
<span class="weight-summary-value">
|
||
{{ formatWeightChargeable(getWeightRowByType(section.key)) }}
|
||
</span>
|
||
<span class="weight-summary-meta">
|
||
{{ $t('order.myOrders.drawer.weight.actualMeta', {
|
||
value: formatWeightNumber(getWeightRowByType(section.key)?.actualWeight),
|
||
}) }}
|
||
</span>
|
||
</button>
|
||
</div>
|
||
|
||
<div class="weight-view-switch">
|
||
<a-radio-group v-model="weightViewMode" type="button" size="small">
|
||
<a-radio value="all">{{ $t('order.myOrders.drawer.weight.viewAll') }}</a-radio>
|
||
<a-radio
|
||
v-for="section in customerWeightTypeDefs"
|
||
:key="section.key"
|
||
:value="section.key"
|
||
>
|
||
{{ $t(section.labelKey) }}
|
||
</a-radio>
|
||
</a-radio-group>
|
||
</div>
|
||
|
||
<template v-for="section in visibleCustomerWeightSections" :key="section.key">
|
||
<div class="weight-section" :class="section.key">
|
||
<div class="weight-section-header">
|
||
<div class="weight-section-title-wrap">
|
||
<span class="weight-section-dot" />
|
||
<span class="weight-section-title">{{ $t(section.labelKey) }}</span>
|
||
</div>
|
||
<span class="weight-section-total">
|
||
{{ formatWeightChargeable(section.row) }}
|
||
</span>
|
||
</div>
|
||
<div v-if="section.hasData" class="weight-metrics-grid">
|
||
<div
|
||
v-for="field in weightMetricFields"
|
||
:key="field.key"
|
||
class="weight-metric-item"
|
||
:class="{ highlight: field.highlight }"
|
||
>
|
||
<span class="metric-label">{{ $t(field.labelKey) }}</span>
|
||
<div class="metric-value-wrap">
|
||
<span
|
||
class="metric-value"
|
||
:class="{ 'metric-value-highlight': field.highlight }"
|
||
>
|
||
{{ formatWeightCellValue(section.row, field.key) }}
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<a-empty
|
||
v-else
|
||
:description="$t(section.emptyKey)"
|
||
:image-style="{ height: '48px' }"
|
||
class="weight-section-empty"
|
||
/>
|
||
</div>
|
||
</template>
|
||
|
||
<a-empty
|
||
v-if="!hasCustomerWeightData"
|
||
:description="$t('order.myOrders.drawer.weight.emptyAll')"
|
||
:image-style="{ height: '60px' }"
|
||
class="weight-empty-all"
|
||
/>
|
||
</section>
|
||
|
||
<section class="weight-fee-block">
|
||
<div class="weight-fee-block-title">{{ $t('order.myOrders.drawer.weightFee.feeTitle') }}</div>
|
||
<div class="fee-summary fee-summary--single">
|
||
<div class="fee-summary-card receivable">
|
||
<span class="fee-summary-label">{{ $t('finance.receivablePayable.feeType.receivable') }}</span>
|
||
<span class="fee-summary-amount">{{ formatFeeTotals(receivableTotals) }}</span>
|
||
<span class="fee-summary-meta">
|
||
{{ $t('order.myOrders.drawer.fee.itemCount', { count: receivableFeeList.length }) }}
|
||
</span>
|
||
<span v-if="receivableDiscountTotals.size" class="fee-summary-discount">
|
||
{{ $t('order.myOrders.drawer.fee.includesDiscount', { amount: formatFeeTotals(receivableDiscountTotals) }) }}
|
||
</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div v-if="receivableFeeList.length" class="fee-table-wrap">
|
||
<div class="fee-table">
|
||
<div class="table-header">
|
||
<div
|
||
v-for="col in feeDetailColumns"
|
||
:key="col.key"
|
||
class="header-cell"
|
||
:class="col.key"
|
||
>
|
||
{{ $t(col.labelKey) }}
|
||
</div>
|
||
</div>
|
||
<div
|
||
v-for="(row, idx) in receivableFeeList"
|
||
:key="`receivable-${idx}`"
|
||
class="table-row"
|
||
>
|
||
<div
|
||
v-for="col in feeDetailColumns"
|
||
:key="col.key"
|
||
class="table-cell"
|
||
:class="col.key"
|
||
>
|
||
<template v-if="col.key === 'amount'">
|
||
<span
|
||
class="fee-amount"
|
||
:class="isDiscountFeeRow(row) ? 'amount-discount' : 'amount-receivable'"
|
||
>
|
||
{{ formatFeeAmount(row.amount) }}
|
||
</span>
|
||
</template>
|
||
<template v-else-if="col.key === 'chargingStage'">
|
||
<a-tag
|
||
v-if="getChargingStage(row)"
|
||
size="small"
|
||
:color="getChargingStageColor(getChargingStage(row))"
|
||
>
|
||
{{ getChargingStageLabel(getChargingStage(row)) }}
|
||
</a-tag>
|
||
<span v-else>--</span>
|
||
</template>
|
||
<template v-else>
|
||
{{ getFeeCellValue(row, col) }}
|
||
</template>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<a-empty
|
||
v-else
|
||
:description="$t('order.myOrders.drawer.fee.emptyReceivable')"
|
||
:image-style="{ height: '48px' }"
|
||
class="fee-section-empty"
|
||
/>
|
||
</section>
|
||
</div>
|
||
|
||
<!-- 轨迹 -->
|
||
<div v-if="activeTab === 'track'" class="tab-panel track-info">
|
||
<a-spin :loading="trackLoading" class="track-spin">
|
||
<div v-if="displayTrackTimeline.length" class="track-timeline">
|
||
<div
|
||
v-for="(item, i) in displayTrackTimeline"
|
||
:key="i"
|
||
class="track-item"
|
||
:class="{ active: isTrackNodeActive(item, i) }"
|
||
>
|
||
<div class="track-left">
|
||
<span class="track-dot" :class="{ active: isTrackNodeActive(item, i) }" />
|
||
<span
|
||
v-if="i < displayTrackTimeline.length - 1"
|
||
class="track-line"
|
||
:class="{ active: isTrackNodeActive(item, i) }"
|
||
/>
|
||
</div>
|
||
<div class="track-right">
|
||
<div class="track-row-head">
|
||
<span class="track-status">{{ getTrackStatusLabel(item) }}</span>
|
||
<a-tag v-if="isTrackNodeActive(item, i)" size="small" color="green">
|
||
{{ $t('order.myOrders.drawer.track.latest') }}
|
||
</a-tag>
|
||
</div>
|
||
<div v-if="getTrackZhDetail(item)" class="track-content track-content--zh">
|
||
{{ getTrackZhDetail(item) }}
|
||
</div>
|
||
<div v-if="getTrackEnDetail(item)" class="track-content track-content--en">
|
||
{{ getTrackEnDetail(item) }}
|
||
</div>
|
||
<div class="track-meta-row">
|
||
<span v-if="formatTrackTimeDisplay(item)" class="track-meta-time">
|
||
{{ item.trackTimePrefix || '' }}{{ formatTrackTimeDisplay(item) }}
|
||
</span>
|
||
<span v-if="formatTrackPlace(item)" class="track-meta-place">
|
||
{{ formatTrackPlace(item) }}
|
||
</span>
|
||
<span v-if="item.trackTimeZone" class="track-meta-zone">
|
||
{{ item.trackTimeZone }}
|
||
</span>
|
||
<span v-if="item.trackCode" class="track-meta-code">{{ item.trackCode }}</span>
|
||
</div>
|
||
<div v-if="item.remark" class="track-remark">
|
||
{{ $t('order.myOrders.drawer.track.remark') }}:{{ item.remark }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<a-empty
|
||
v-else-if="!trackLoading"
|
||
:description="$t('order.myOrders.drawer.track.empty')"
|
||
:image-style="{ height: '60px' }"
|
||
class="track-empty"
|
||
/>
|
||
</a-spin>
|
||
</div>
|
||
|
||
<!-- 附件 -->
|
||
<div v-if="activeTab === 'attachments'" class="tab-panel attachments-info">
|
||
<OrderAttachmentsTab
|
||
:order-id="orderId"
|
||
:active="activeTab === 'attachments'"
|
||
customer-view
|
||
read-only
|
||
/>
|
||
</div>
|
||
|
||
<!-- 绑定包裹/库存 -->
|
||
<div v-if="activeTab === 'stockBind'" class="tab-panel stock-bind-info">
|
||
<OrderStockBindTab
|
||
ref="stockBindTabRef"
|
||
:order-id="orderId"
|
||
:active="activeTab === 'stockBind'"
|
||
hide-refresh
|
||
/>
|
||
</div>
|
||
|
||
<!-- 操作日志 -->
|
||
<div v-if="activeTab === 'operationLog'" class="tab-panel operation-log-info">
|
||
<a-spin :loading="operationLogLoading" class="operation-log-spin">
|
||
<div v-if="operationLogList.length" class="operation-log-list">
|
||
<div
|
||
v-for="item in operationLogList"
|
||
:key="item.id"
|
||
class="operation-log-item"
|
||
>
|
||
<div class="operation-log-head" @click="toggleOperationLogExpand(item.id)">
|
||
<div class="operation-log-head-main">
|
||
<span class="operation-log-action">{{ item.actionName || item.action }}</span>
|
||
<a-tag v-if="item.changes?.length" size="small" color="orangered">
|
||
{{ item.changes.length }}
|
||
</a-tag>
|
||
</div>
|
||
<div class="operation-log-head-meta">
|
||
<span>{{ item.operatorName || $t('order.myOrders.drawer.operationLog.operator') }}</span>
|
||
<span>{{ formatOperationLogTime(item.createTime) }}</span>
|
||
<IconDown v-if="!isOperationLogExpanded(item.id)" />
|
||
<IconUp v-else />
|
||
</div>
|
||
</div>
|
||
<div v-if="isOperationLogExpanded(item.id)" class="operation-log-body">
|
||
<p v-if="item.remark" class="operation-log-remark">{{ item.remark }}</p>
|
||
<div v-if="item.changes?.length" class="operation-log-changes">
|
||
<div class="operation-log-changes-header">
|
||
<span>{{ $t('order.myOrders.drawer.operationLog.field') }}</span>
|
||
<span>{{ $t('order.myOrders.drawer.operationLog.before') }}</span>
|
||
<span>{{ $t('order.myOrders.drawer.operationLog.after') }}</span>
|
||
</div>
|
||
<div
|
||
v-for="(change, idx) in item.changes"
|
||
:key="`${item.id}-${change.path}-${idx}`"
|
||
class="operation-log-changes-row"
|
||
>
|
||
<span>{{ change.label || change.path }}</span>
|
||
<span>{{ change.before ?? '--' }}</span>
|
||
<span class="operation-log-after">{{ change.after ?? '--' }}</span>
|
||
</div>
|
||
</div>
|
||
<a-empty
|
||
v-else
|
||
:description="$t('order.myOrders.drawer.operationLog.noChanges')"
|
||
:image-style="{ height: '40px' }"
|
||
/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<a-empty
|
||
v-else-if="!operationLogLoading"
|
||
:description="$t('order.myOrders.drawer.operationLog.empty')"
|
||
:image-style="{ height: '60px' }"
|
||
/>
|
||
</a-spin>
|
||
</div>
|
||
</div>
|
||
|
||
<div v-if="showActionBar" class="drawer-action-bar">
|
||
<div class="drawer-action-bar__meta">
|
||
<template v-if="activeTab === 'track' && !showEditFooter">
|
||
<span class="action-bar-meta">
|
||
<span class="action-bar-meta-label">{{ $t('order.myOrders.drawer.trackNo') }}</span>
|
||
<span class="action-bar-meta-value">{{ trackOrderNumber || '--' }}</span>
|
||
</span>
|
||
<a-tag
|
||
v-if="currentOrderStatusMeta"
|
||
size="small"
|
||
:style="getOrderStatusTagStyle(currentOrderStatusMeta)"
|
||
>
|
||
{{ $t(currentOrderStatusMeta.labelKey) }}
|
||
</a-tag>
|
||
<a-tag v-if="trackTimeline.length" size="small" color="arcoblue">
|
||
{{ $t('order.myOrders.drawer.track.count', { count: trackTimeline.length }) }}
|
||
</a-tag>
|
||
</template>
|
||
<a-tag
|
||
v-else-if="activeTab === 'operationLog' && !showEditFooter && operationLogList.length"
|
||
size="small"
|
||
color="arcoblue"
|
||
>
|
||
{{ $t('order.myOrders.drawer.operationLog.count', { count: operationLogList.length }) }}
|
||
</a-tag>
|
||
</div>
|
||
<div class="drawer-action-bar__actions">
|
||
<template v-if="showEditFooter">
|
||
<a-button @click="cancelBasicEdit">
|
||
{{ $t('order.myOrders.drawer.actions.cancel') }}
|
||
</a-button>
|
||
<a-button
|
||
type="primary"
|
||
class="app-btn-primary-soft"
|
||
:loading="basicSaving"
|
||
@click="handleBasicEditSave"
|
||
>
|
||
{{ $t('order.myOrders.drawer.actions.save') }}
|
||
</a-button>
|
||
</template>
|
||
<template v-else-if="activeTab === 'basic'">
|
||
<a-button
|
||
v-if="canEditOrderDetail"
|
||
class="app-btn-search"
|
||
@click="startBasicEdit"
|
||
>
|
||
{{ $t('order.myOrders.drawer.actions.edit') }}
|
||
</a-button>
|
||
<a-button class="app-btn-search" @click="handleAskAdvisor">
|
||
{{ $t('nanaAssistant.askAboutWaybill') }}
|
||
</a-button>
|
||
</template>
|
||
<template v-else-if="activeTab === 'track'">
|
||
<a-button
|
||
class="app-btn-search"
|
||
:loading="trackLoading"
|
||
@click="loadTrackTimeline"
|
||
>{{ $t('order.myOrders.drawer.track.refresh') }}
|
||
</a-button>
|
||
</template>
|
||
<template v-else-if="activeTab === 'stockBind'">
|
||
<a-button
|
||
class="app-btn-search"
|
||
:loading="stockBindLoading"
|
||
@click="reloadStockBind"
|
||
>{{ $t('order.myOrders.drawer.track.refresh') }}
|
||
</a-button>
|
||
</template>
|
||
<template v-else-if="activeTab === 'operationLog'">
|
||
<a-button
|
||
class="app-btn-search"
|
||
:loading="operationLogLoading"
|
||
@click="loadOperationLogs"
|
||
>{{ $t('order.myOrders.drawer.operationLog.refresh') }}
|
||
</a-button>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</DrawerPro>
|
||
|
||
<AddOrderFeeModal
|
||
v-model:visible="addFeeModalVisible"
|
||
:order-id="orderId"
|
||
:default-type="addFeeDefaultType"
|
||
@success="handleAddFeeSuccess"
|
||
/>
|
||
|
||
<a-modal
|
||
v-model:visible="declarationSkuPreviewVisible"
|
||
:title="$t('order.myOrders.drawer.declarationSkuImage')"
|
||
:footer="false"
|
||
width="640px"
|
||
unmount-on-close
|
||
>
|
||
<div class="declaration-sku-preview">
|
||
<img
|
||
v-if="declarationSkuPreviewUrl"
|
||
:src="declarationSkuPreviewUrl"
|
||
:alt="$t('order.myOrders.drawer.declarationSkuImage')"
|
||
referrerpolicy="no-referrer"
|
||
/>
|
||
</div>
|
||
</a-modal>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { ref, computed, watch, reactive, nextTick } from 'vue';
|
||
import { useRouter } from 'vue-router';
|
||
import { useI18n } from 'vue-i18n';
|
||
import { Message } from '@arco-design/web-vue';
|
||
import { IconRefresh, IconRobot, IconDown, IconUp } from '@arco-design/web-vue/es/icon';
|
||
import useDrawer from '@/components/DrawerPro/useDrawer';
|
||
import { postGetDetailTimeline } from '@/api/TrackOrder/trackOrder';
|
||
import {
|
||
postOrderUpdate,
|
||
postOrderWeightUpdate,
|
||
postOrderRecalculateReceivable,
|
||
postOrderRecalculatePayable,
|
||
getOrderOperationLogList,
|
||
type OrderOperationLogItem,
|
||
} from '@/api/order';
|
||
import { getDictListAll, type DictDto } from '@/api/system/dict';
|
||
import { getWarehouseList } from '@/api/system/warehouse';
|
||
import { getOrderStatusMeta, getOrderStatusTagStyle, resolveOrderStatusCode } from '@/constants/orderStatus';
|
||
import { isDiscountCostItem } from '@/constants/feeCostItems';
|
||
import { getBooleanTagStyle } from '@/utils/statusTag';
|
||
import { resolveOmsAssetUrl } from '@/api/oms/common';
|
||
import { useRbacUserStore } from '@/store/modules/rbac-user';
|
||
import { openAskAdvisor } from '@/composables/useAskAdvisor';
|
||
import { buildFailGuideFromReason } from '@/utils/parcelCreateFailGuide';
|
||
import SlidingTabs from '@/components/SlidingTabs/index.vue';
|
||
import OrderAttachmentsTab from '../../components/OrderAttachmentsTab.vue';
|
||
import AddOrderFeeModal from './AddOrderFeeModal.vue';
|
||
import OrderStockBindTab from './OrderStockBindTab.vue';
|
||
import OrderDeclarationHotTable from '../../components/OrderDeclarationHotTable.vue';
|
||
import {
|
||
ORDER_DETAIL_VALUE_FIELD_MAP,
|
||
buildDeclarationPayloadFromRows,
|
||
cloneDeclarationItemRows,
|
||
formatOrderDetailExtendedValue,
|
||
mergeOrderBasicFields,
|
||
parseAdditionalServiceCodes,
|
||
patchOrderBasicFieldGroups,
|
||
} from '../../components/orderDetailFieldConfig';
|
||
import {
|
||
filterMyOrdersColumns,
|
||
filterMyOrdersFieldKeys,
|
||
} from '../customerFieldMask';
|
||
|
||
const { t } = useI18n();
|
||
const router = useRouter();
|
||
const rbacUserStore = useRbacUserStore();
|
||
/** 客户账号:详情抽屉仅保留「订单详情 + 轨迹」 */
|
||
const isCustomerPortal = computed(() => rbacUserStore.isCustomerPortal());
|
||
|
||
interface OrderRow {
|
||
id?: number;
|
||
waybillNo?: string;
|
||
customerOrderNo?: string;
|
||
trackingNo?: string;
|
||
[key: string]: any;
|
||
}
|
||
|
||
interface Props {
|
||
order?: OrderRow | null;
|
||
}
|
||
|
||
const props = withDefaults(defineProps<Props>(), {
|
||
order: null,
|
||
});
|
||
|
||
const emit = defineEmits<{
|
||
cancel: [];
|
||
updated: [order: OrderRow];
|
||
}>();
|
||
|
||
const detail = ref<OrderRow | null>(null);
|
||
const exportCustomsDictRows = ref<DictDto[]>([]);
|
||
const additionalServiceDictRows = ref<DictDto[]>([]);
|
||
const basicEditing = ref(false);
|
||
const weightEditing = ref(false);
|
||
const basicSaving = ref(false);
|
||
const weightSaving = ref(false);
|
||
const recalcReceivableLoading = ref(false);
|
||
const recalcPayableLoading = ref(false);
|
||
const addFeeModalVisible = ref(false);
|
||
const addFeeDefaultType = ref<'receivable' | 'payable'>('receivable');
|
||
const stockBindTabRef = ref<{ reload?: () => Promise<void> | void } | null>(null);
|
||
const stockBindLoading = ref(false);
|
||
|
||
async function reloadStockBind() {
|
||
stockBindLoading.value = true;
|
||
try {
|
||
await stockBindTabRef.value?.reload?.();
|
||
} finally {
|
||
stockBindLoading.value = false;
|
||
}
|
||
}
|
||
|
||
type BasicViewMode = 'all' | 'basic' | 'sender' | 'recipient' | 'declaration';
|
||
const basicViewMode = ref<BasicViewMode>('all');
|
||
|
||
const basicSectionDefs = [
|
||
{ key: 'basic' as const, labelKey: 'order.myOrders.drawer.orderBasic' },
|
||
{ key: 'sender' as const, labelKey: 'order.myOrders.drawer.sender' },
|
||
{ key: 'recipient' as const, labelKey: 'order.myOrders.drawer.recipient' },
|
||
{ key: 'declaration' as const, labelKey: 'order.myOrders.drawer.declaration' },
|
||
];
|
||
|
||
const basicViewTabs = computed(() => [
|
||
{ key: 'all', label: t('order.myOrders.drawer.basic.viewAll') },
|
||
...basicSectionDefs.map((section) => ({
|
||
key: section.key,
|
||
label: t(section.labelKey),
|
||
})),
|
||
]);
|
||
|
||
const COLLAPSIBLE_BASIC_SECTIONS = new Set<BasicViewMode>(['sender']);
|
||
const sectionCollapsed = reactive<Partial<Record<BasicViewMode, boolean>>>({
|
||
sender: true,
|
||
});
|
||
|
||
function isCollapsibleSection(key: BasicViewMode) {
|
||
return COLLAPSIBLE_BASIC_SECTIONS.has(key);
|
||
}
|
||
|
||
function isSectionCollapsed(key: BasicViewMode) {
|
||
return Boolean(sectionCollapsed[key]);
|
||
}
|
||
|
||
function toggleSectionCollapse(key: BasicViewMode) {
|
||
if (!isCollapsibleSection(key)) return;
|
||
sectionCollapsed[key] = !sectionCollapsed[key];
|
||
}
|
||
|
||
function resetSectionCollapse() {
|
||
sectionCollapsed.sender = true;
|
||
}
|
||
|
||
const visibleBasicSections = computed(() => {
|
||
if (basicViewMode.value === 'all') return basicSectionDefs;
|
||
return basicSectionDefs.filter((section) => section.key === basicViewMode.value);
|
||
});
|
||
|
||
const currentOrderStatusMeta = computed(() => {
|
||
const code = resolveOrderStatusCode(detail.value);
|
||
return code ? getOrderStatusMeta(code) : null;
|
||
});
|
||
|
||
const predeclareFailGuide = computed(() => {
|
||
const status = resolveOrderStatusCode(detail.value);
|
||
if (status !== 'draft') return null;
|
||
const reason = String(getOrderValue('predeclareFailReason') || '').trim();
|
||
if (!reason) return null;
|
||
return buildFailGuideFromReason(reason);
|
||
});
|
||
|
||
type FieldInputType = 'text' | 'number' | 'select' | 'switch';
|
||
|
||
interface FormFieldDef {
|
||
key: string;
|
||
labelKey: string;
|
||
inputType?: FieldInputType;
|
||
span?: 2;
|
||
options?: Array<{ value: string; labelKey: string }>;
|
||
}
|
||
|
||
/** 我的订单可编辑字段:跟踪号不开放;入库后整单不可编辑 */
|
||
const orderEditFieldDefs: FormFieldDef[] = [
|
||
{ key: 'clientNo', labelKey: 'order.myOrders.drawer.clientNo' },
|
||
{ key: 'downstreamServiceNo', labelKey: 'order.myOrders.drawer.downstreamServiceNo' },
|
||
{ key: 'warehouse', labelKey: 'order.myOrders.drawer.warehouse', inputType: 'select' },
|
||
{
|
||
key: 'cargoAttribute',
|
||
labelKey: 'order.myOrders.drawer.cargoAttribute',
|
||
inputType: 'select',
|
||
options: [
|
||
{ value: 'general', labelKey: 'order.myOrders.drawer.cargoAttribute.general' },
|
||
{ value: 'electronics', labelKey: 'order.myOrders.drawer.cargoAttribute.electronics' },
|
||
{ value: 'sensitive', labelKey: 'order.myOrders.drawer.cargoAttribute.sensitive' },
|
||
],
|
||
},
|
||
{ key: 'isCod', labelKey: 'order.myOrders.drawer.isCod', inputType: 'switch' },
|
||
{ key: 'codCurrency', labelKey: 'order.myOrders.drawer.codCurrency' },
|
||
{ key: 'codSum', labelKey: 'order.myOrders.drawer.codSum', inputType: 'number' },
|
||
];
|
||
|
||
/** 入库前(草稿/已预报)才允许客户编辑 */
|
||
const MY_ORDERS_EDITABLE_STATUSES = new Set(['draft', 'predeclared']);
|
||
|
||
const orderEditMetaMap = Object.fromEntries(
|
||
orderEditFieldDefs.map((def) => [def.key, def])
|
||
) as Record<string, FormFieldDef>;
|
||
|
||
const SENDER_READONLY_KEYS = new Set(['isDefault']);
|
||
const SENDER_FORM_KEY_MAP: Record<string, string> = { country: 'countryCode' };
|
||
const RECIPIENT_FORM_KEY_MAP: Record<string, string> = { country: 'countryCode' };
|
||
|
||
function isOrderFieldEditable(key: string) {
|
||
return key in orderEditMetaMap;
|
||
}
|
||
|
||
function getOrderEditMeta(key: string) {
|
||
return orderEditMetaMap[key];
|
||
}
|
||
|
||
function isSenderFieldEditable(key: string) {
|
||
return !SENDER_READONLY_KEYS.has(key);
|
||
}
|
||
|
||
function getSenderFormKey(key: string) {
|
||
return SENDER_FORM_KEY_MAP[key] ?? key;
|
||
}
|
||
|
||
function isRecipientFieldEditable(_key: string) {
|
||
return true;
|
||
}
|
||
|
||
function getRecipientFormKey(key: string) {
|
||
return RECIPIENT_FORM_KEY_MAP[key] ?? key;
|
||
}
|
||
|
||
const basicEditForm = reactive({
|
||
clientNo: '',
|
||
downstreamServiceNo: '',
|
||
warehouseId: undefined as number | undefined,
|
||
cargoAttribute: 'general',
|
||
isCod: false,
|
||
codSum: undefined as number | undefined,
|
||
codCurrency: '',
|
||
declaredCurrency: '',
|
||
declaredSum: undefined as number | undefined,
|
||
});
|
||
|
||
const currencyOptions = ref<Array<{ value: string; label: string }>>([]);
|
||
const currencyOptionsLoading = ref(false);
|
||
const warehouseOptions = ref<Array<{ value: number; label: string }>>([]);
|
||
const warehouseOptionsLoading = ref(false);
|
||
|
||
async function ensureWarehouseOptions(preferred?: {
|
||
id?: number;
|
||
name?: string;
|
||
}) {
|
||
warehouseOptionsLoading.value = true;
|
||
try {
|
||
if (warehouseOptions.value.length === 0) {
|
||
const { items } = await getWarehouseList({ page: 1, pageSize: 200 });
|
||
warehouseOptions.value = (items || [])
|
||
.map((row: any) => {
|
||
const id = Number(row?.id ?? row?.Id);
|
||
if (!Number.isFinite(id) || id <= 0) return null;
|
||
const name = String(row?.warehouseName ?? row?.WarehouseName ?? '').trim();
|
||
return { value: id, label: name || `#${id}` };
|
||
})
|
||
.filter((item): item is { value: number; label: string } => !!item);
|
||
}
|
||
const id = preferred?.id != null && preferred.id > 0 ? preferred.id : undefined;
|
||
const name = String(preferred?.name ?? '').trim();
|
||
if (id && !warehouseOptions.value.some((opt) => opt.value === id)) {
|
||
warehouseOptions.value = [
|
||
...warehouseOptions.value,
|
||
{ value: id, label: name || `#${id}` },
|
||
];
|
||
}
|
||
} catch {
|
||
if (warehouseOptions.value.length === 0) warehouseOptions.value = [];
|
||
} finally {
|
||
warehouseOptionsLoading.value = false;
|
||
}
|
||
}
|
||
|
||
async function ensureCurrencyOptions(preferredCode?: string) {
|
||
currencyOptionsLoading.value = true;
|
||
try {
|
||
if (currencyOptions.value.length === 0) {
|
||
const rows = await getDictListAll({ dictType: 'currency' });
|
||
currencyOptions.value = (Array.isArray(rows) ? rows : [])
|
||
.map((row: DictDto | Record<string, any>) => {
|
||
const code = String((row as any).dictCode ?? (row as any).DictCode ?? '').trim();
|
||
if (!code) return null;
|
||
return { value: code, label: code };
|
||
})
|
||
.filter((item): item is { value: string; label: string } => !!item)
|
||
.sort((a, b) => a.value.localeCompare(b.value));
|
||
}
|
||
const code = String(preferredCode ?? '').trim();
|
||
if (code && !currencyOptions.value.some((opt) => opt.value === code)) {
|
||
currencyOptions.value = [...currencyOptions.value, { value: code, label: code }].sort((a, b) =>
|
||
a.value.localeCompare(b.value)
|
||
);
|
||
}
|
||
} catch {
|
||
if (currencyOptions.value.length === 0) currencyOptions.value = [];
|
||
} finally {
|
||
currencyOptionsLoading.value = false;
|
||
}
|
||
}
|
||
|
||
const senderEditForm = reactive<Record<string, string>>({
|
||
senderName: '',
|
||
company: '',
|
||
countryCode: '',
|
||
province: '',
|
||
city: '',
|
||
zipCode: '',
|
||
streetAddress1: '',
|
||
streetAddress2: '',
|
||
streetAddress3: '',
|
||
houseNumber: '',
|
||
phone: '',
|
||
telePhone: '',
|
||
email: '',
|
||
});
|
||
|
||
const receiverEditForm = reactive<Record<string, string>>({
|
||
recipientsName: '',
|
||
companyName: '',
|
||
countryCode: '',
|
||
phone: '',
|
||
telePhone: '',
|
||
zipCode: '',
|
||
province: '',
|
||
city: '',
|
||
streetNumber: '',
|
||
streetAddress1: '',
|
||
streetAddress2: '',
|
||
streetAddress3: '',
|
||
email: '',
|
||
taxType: '',
|
||
taxNo: '',
|
||
certificateType: '',
|
||
certificateNo: '',
|
||
eori: '',
|
||
vat: '',
|
||
});
|
||
|
||
const declarationEditList = ref<any[]>([]);
|
||
|
||
const weightEditForm = ref<
|
||
Array<{
|
||
type: string;
|
||
length?: number;
|
||
width?: number;
|
||
height?: number;
|
||
actualWeight?: number;
|
||
}>
|
||
>([]);
|
||
|
||
const hasSender = computed(() => Object.keys(sender.value).length > 0);
|
||
const orderId = computed(() => detail.value?.id);
|
||
|
||
const displayDeclarationRows = computed(() =>
|
||
basicEditing.value ? declarationEditList.value : declarationList.value
|
||
);
|
||
|
||
function getOrderFieldLabelKey(fieldKey: string) {
|
||
return orderBasicFields.find((field) => field.key === fieldKey)?.labelKey ?? fieldKey;
|
||
}
|
||
|
||
function isOrderBooleanField(fieldKey: string) {
|
||
return ['isCod', 'isIntercept', 'isRemote', 'isPaid'].includes(fieldKey);
|
||
}
|
||
|
||
function getOrderBooleanTagStyle(fieldKey: string) {
|
||
const val = getOrderValue(fieldKey);
|
||
const yes = t('order.myOrders.drawer.yes');
|
||
return getBooleanTagStyle(val === yes);
|
||
}
|
||
|
||
const declarationSkuPreviewVisible = ref(false);
|
||
const declarationSkuPreviewUrl = ref('');
|
||
|
||
function openDeclarationSkuPreview(raw?: string | null) {
|
||
const value = String(raw ?? '').trim();
|
||
if (!value || value === '0' || value === '--') return;
|
||
const src = resolveOmsAssetUrl(value) || value;
|
||
if (!src) return;
|
||
declarationSkuPreviewUrl.value = src;
|
||
declarationSkuPreviewVisible.value = true;
|
||
}
|
||
|
||
function cloneDeclarationRows(rows: any[]) {
|
||
return cloneDeclarationItemRows(rows);
|
||
}
|
||
|
||
function addDeclarationRow() {
|
||
declarationEditList.value.push({
|
||
cnName: '',
|
||
enName: '',
|
||
sku: '',
|
||
unit: '',
|
||
quantity: 1,
|
||
isMagnetic: false,
|
||
});
|
||
}
|
||
|
||
function removeDeclarationRow(index: number) {
|
||
declarationEditList.value.splice(index, 1);
|
||
}
|
||
|
||
function buildDeclarationPayload() {
|
||
return buildDeclarationPayloadFromRows(declarationEditList.value);
|
||
}
|
||
|
||
function parseOptionalInt(value: string) {
|
||
const trimmed = String(value ?? '').trim();
|
||
if (!trimmed) return undefined;
|
||
const num = Number(trimmed);
|
||
return Number.isNaN(num) ? undefined : num;
|
||
}
|
||
|
||
const displayWeightRows = computed(() => {
|
||
if (!weightEditing.value) {
|
||
return weightList.value;
|
||
}
|
||
return weightEditForm.value.map((row) => {
|
||
const orig = weightList.value.find((w: any) => w.type === row.type) || {};
|
||
return { ...orig, ...row };
|
||
});
|
||
});
|
||
|
||
function resetEditState() {
|
||
basicEditing.value = false;
|
||
weightEditing.value = false;
|
||
}
|
||
|
||
const [register, { openDrawer: innerOpenDrawer, setDrawerProps, closeDrawer }] = useDrawer();
|
||
|
||
const activeTab = ref('basic');
|
||
|
||
const canEditOrderDetail = computed(() => {
|
||
const code = resolveOrderStatusCode(detail.value);
|
||
return !!code && MY_ORDERS_EDITABLE_STATUSES.has(code);
|
||
});
|
||
|
||
const showEditFooter = computed(
|
||
() => activeTab.value === 'basic' && basicEditing.value,
|
||
);
|
||
|
||
const showActionBar = computed(() =>
|
||
['basic', 'track', 'stockBind', 'operationLog'].includes(activeTab.value),
|
||
);
|
||
const CUSTOMER_WEIGHT_TYPE_KEYS = ['forecast', 'receive'] as const;
|
||
|
||
const tabList = computed(() => [
|
||
{ key: 'basic', label: t('order.myOrders.drawer.tabs.basic') },
|
||
{ key: 'weightFee', label: t('order.myOrders.drawer.tabs.weightFee') },
|
||
{ key: 'track', label: t('order.myOrders.drawer.tabs.track') },
|
||
{ key: 'attachments', label: t('order.myOrders.drawer.tabs.attachments') },
|
||
{ key: 'stockBind', label: t('order.myOrders.drawer.tabs.stockBind') },
|
||
]);
|
||
|
||
const operationLogList = ref<OrderOperationLogItem[]>([]);
|
||
const operationLogLoading = ref(false);
|
||
const operationLogExpandedIds = ref<Set<number>>(new Set());
|
||
|
||
const slidingTabItems = computed(() =>
|
||
tabList.value.map((tab) => ({ key: tab.key, label: tab.label })),
|
||
);
|
||
|
||
function resolveDrawerTab(tab?: string) {
|
||
const next = tab || 'basic';
|
||
if (next === 'weight' || next === 'fee') return 'weightFee';
|
||
// 我的运单不展示操作日志(管理端运单管理保留)
|
||
if (next === 'operationLog') return 'basic';
|
||
return next;
|
||
}
|
||
|
||
// 订单基本信息字段 (t_order) - 按文档表结构
|
||
const orderBasicFields = filterMyOrdersColumns(
|
||
mergeOrderBasicFields([
|
||
{ key: 'serviceNo', labelKey: 'order.myOrders.drawer.serviceNo' },
|
||
{ key: 'clientNo', labelKey: 'order.myOrders.drawer.clientNo' },
|
||
{ key: 'trackNo', labelKey: 'order.myOrders.drawer.trackNo' },
|
||
{ key: 'downstreamServiceNo', labelKey: 'order.myOrders.drawer.downstreamServiceNo' },
|
||
{ key: 'productCode', labelKey: 'order.myOrders.drawer.productCode' },
|
||
{ key: 'productName', labelKey: 'order.myOrders.drawer.productName' },
|
||
{ key: 'consigneeCountry', labelKey: 'order.myOrders.drawer.consigneeCountry' },
|
||
{ key: 'consigneeCountryName', labelKey: 'order.myOrders.drawer.consigneeCountryName' },
|
||
{ key: 'cargoAttribute', labelKey: 'order.myOrders.drawer.cargoAttribute' },
|
||
{ key: 'orderStatus', labelKey: 'order.myOrders.drawer.orderStatus' },
|
||
{ key: 'predeclareFailReason', labelKey: 'order.myOrders.drawer.predeclareFailReason' },
|
||
{ key: 'allocationPendingReason', labelKey: 'order.myOrders.drawer.allocationPendingReason' },
|
||
{ key: 'warehouse', labelKey: 'order.myOrders.drawer.warehouse' },
|
||
{ key: 'receiveTime', labelKey: 'order.myOrders.drawer.receiveTime' },
|
||
{ key: 'shipTime', labelKey: 'order.myOrders.drawer.shipTime' },
|
||
{ key: 'payTime', labelKey: 'order.myOrders.drawer.payTime' },
|
||
{ key: 'isPaid', labelKey: 'order.myOrders.drawer.isPaid' },
|
||
{ key: 'signTime', labelKey: 'order.myOrders.drawer.signTime' },
|
||
{ key: 'isCod', labelKey: 'order.myOrders.drawer.isCod' },
|
||
{ key: 'codCurrency', labelKey: 'order.myOrders.drawer.codCurrency' },
|
||
{ key: 'codSum', labelKey: 'order.myOrders.drawer.codSum' },
|
||
{ key: 'isIntercept', labelKey: 'order.myOrders.drawer.isIntercept' },
|
||
{ key: 'isRemote', labelKey: 'order.myOrders.drawer.isRemote' },
|
||
{ key: 'createTime', labelKey: 'order.myOrders.drawer.createTime' },
|
||
{ key: 'createBy', labelKey: 'order.myOrders.drawer.createBy' },
|
||
{ key: 'updateTime', labelKey: 'order.myOrders.drawer.updateTime' },
|
||
{ key: 'updateBy', labelKey: 'order.myOrders.drawer.updateBy' },
|
||
]),
|
||
);
|
||
|
||
const orderBasicFieldGroups = patchOrderBasicFieldGroups(
|
||
[
|
||
{
|
||
key: 'identity',
|
||
labelKey: 'order.myOrders.drawer.basic.group.identity',
|
||
fields: ['serviceNo', 'clientNo', 'trackNo'],
|
||
},
|
||
{
|
||
key: 'product',
|
||
labelKey: 'order.myOrders.drawer.basic.group.product',
|
||
fields: [
|
||
'productCode',
|
||
'productName',
|
||
'warehouse',
|
||
'consigneeCountry',
|
||
'consigneeCountryName',
|
||
'cargoAttribute',
|
||
],
|
||
},
|
||
{
|
||
key: 'timeline',
|
||
labelKey: 'order.myOrders.drawer.basic.group.timeline',
|
||
fields: ['orderStatus', 'predeclareFailReason', 'receiveTime', 'shipTime', 'signTime', 'payTime', 'isPaid'],
|
||
},
|
||
{
|
||
key: 'flags',
|
||
labelKey: 'order.myOrders.drawer.basic.group.flags',
|
||
fields: ['isCod', 'codCurrency', 'codSum', 'isIntercept', 'isRemote'],
|
||
},
|
||
{
|
||
key: 'audit',
|
||
labelKey: 'order.myOrders.drawer.basic.group.audit',
|
||
fields: ['createTime', 'createBy', 'updateTime', 'updateBy'],
|
||
},
|
||
],
|
||
{ includeChannel: false },
|
||
).map((group) => ({
|
||
...group,
|
||
fields: filterMyOrdersFieldKeys(group.fields),
|
||
}));
|
||
|
||
// 发件人表单字段 (t_order_sender) - 补齐全部字段
|
||
const senderFields = [
|
||
{ key: 'senderName', labelKey: 'order.myOrders.drawer.senderName' },
|
||
{ key: 'company', labelKey: 'order.myOrders.drawer.company' },
|
||
{ key: 'country', labelKey: 'order.myOrders.drawer.country' },
|
||
{ key: 'province', labelKey: 'order.myOrders.drawer.province' },
|
||
{ key: 'city', labelKey: 'order.myOrders.drawer.city' },
|
||
{ key: 'zipCode', labelKey: 'order.myOrders.drawer.zipCode' },
|
||
{ key: 'streetAddress1', labelKey: 'order.myOrders.drawer.streetAddress1' },
|
||
{ key: 'streetAddress2', labelKey: 'order.myOrders.drawer.streetAddress2' },
|
||
{ key: 'streetAddress3', labelKey: 'order.myOrders.drawer.streetAddress3' },
|
||
{ key: 'houseNumber', labelKey: 'order.myOrders.drawer.houseNumber' },
|
||
{ key: 'phone', labelKey: 'order.myOrders.drawer.phone' },
|
||
{ key: 'telePhone', labelKey: 'order.myOrders.drawer.telePhone' },
|
||
{ key: 'email', labelKey: 'order.myOrders.drawer.email' },
|
||
{ key: 'isDefault', labelKey: 'order.myOrders.drawer.isDefault' },
|
||
];
|
||
|
||
// 收件人表单字段 (t_order_recipient) - 补齐全部字段
|
||
const recipientFields = [
|
||
{ key: 'recipientsName', labelKey: 'order.myOrders.drawer.recipientsName' },
|
||
{ key: 'companyName', labelKey: 'order.myOrders.drawer.companyName' },
|
||
{ key: 'country', labelKey: 'order.myOrders.drawer.recipientCountry' },
|
||
{ key: 'phone', labelKey: 'order.myOrders.drawer.recipientPhone' },
|
||
{ key: 'telePhone', labelKey: 'order.myOrders.drawer.recipientTelePhone' },
|
||
{ key: 'zipCode', labelKey: 'order.myOrders.drawer.recipientZipCode' },
|
||
{ key: 'province', labelKey: 'order.myOrders.drawer.province' },
|
||
{ key: 'city', labelKey: 'order.myOrders.drawer.city' },
|
||
{ key: 'streetNumber', labelKey: 'order.myOrders.drawer.streetNumber' },
|
||
{ key: 'streetAddress1', labelKey: 'order.myOrders.drawer.streetAddress1' },
|
||
{ key: 'streetAddress2', labelKey: 'order.myOrders.drawer.streetAddress2' },
|
||
{ key: 'streetAddress3', labelKey: 'order.myOrders.drawer.streetAddress3' },
|
||
{ key: 'email', labelKey: 'order.myOrders.drawer.email' },
|
||
{ key: 'taxType', labelKey: 'order.myOrders.drawer.taxType' },
|
||
{ key: 'taxNo', labelKey: 'order.myOrders.drawer.taxNo' },
|
||
{ key: 'certificateType', labelKey: 'order.myOrders.drawer.certificateType' },
|
||
{ key: 'certificateNo', labelKey: 'order.myOrders.drawer.certificateNo' },
|
||
{ key: 'eori', labelKey: 'order.myOrders.drawer.eori' },
|
||
{ key: 'vat', labelKey: 'order.myOrders.drawer.vat' },
|
||
];
|
||
|
||
// 申报信息列表列 (t_order_declaration) - 补齐全部字段
|
||
// 件重尺:类型独立展示,明细区不再含类型列
|
||
type WeightViewMode = 'all' | 'forecast' | 'receive' | 'ship' | 'downstream';
|
||
const weightViewMode = ref<WeightViewMode>('all');
|
||
|
||
const weightTypeDefs = [
|
||
{
|
||
key: 'forecast' as const,
|
||
labelKey: 'order.myOrders.drawer.weightType.forecast',
|
||
emptyKey: 'order.myOrders.drawer.weight.empty.forecast',
|
||
},
|
||
{
|
||
key: 'receive' as const,
|
||
labelKey: 'order.myOrders.drawer.weightType.receive',
|
||
emptyKey: 'order.myOrders.drawer.weight.empty.receive',
|
||
},
|
||
{
|
||
key: 'ship' as const,
|
||
labelKey: 'order.myOrders.drawer.weightType.ship',
|
||
emptyKey: 'order.myOrders.drawer.weight.empty.ship',
|
||
},
|
||
{
|
||
key: 'downstream' as const,
|
||
labelKey: 'order.myOrders.drawer.weightType.downstream',
|
||
emptyKey: 'order.myOrders.drawer.weight.empty.downstream',
|
||
},
|
||
];
|
||
|
||
const weightMetricFields = [
|
||
{ key: 'length', labelKey: 'order.myOrders.drawer.weightLength', editable: true, highlight: false },
|
||
{ key: 'width', labelKey: 'order.myOrders.drawer.weightWidth', editable: true, highlight: false },
|
||
{ key: 'height', labelKey: 'order.myOrders.drawer.weightHeight', editable: true, highlight: false },
|
||
{ key: 'actualWeight', labelKey: 'order.myOrders.drawer.actualWeight', editable: true, highlight: false },
|
||
{ key: 'volumetricWeight', labelKey: 'order.myOrders.drawer.volumetricWeight', editable: false, highlight: false },
|
||
{ key: 'chargeableWeight', labelKey: 'order.myOrders.drawer.chargeableWeight', editable: false, highlight: true },
|
||
{ key: 'cubic', labelKey: 'order.myOrders.drawer.cubic', editable: false, highlight: false },
|
||
];
|
||
|
||
// 应收费用明细列(不含下游服务商)
|
||
const feeDetailColumns = [
|
||
{ key: 'costItem', labelKey: 'order.myOrders.drawer.costItem' },
|
||
{ key: 'amount', labelKey: 'order.myOrders.drawer.amount' },
|
||
{ key: 'currency', labelKey: 'order.myOrders.drawer.currency' },
|
||
{ key: 'chargingStage', labelKey: 'order.myOrders.drawer.chargingStage' },
|
||
{ key: 'priceNo', labelKey: 'order.myOrders.drawer.priceNo' },
|
||
{ key: 'priceEffectiveTime', labelKey: 'order.myOrders.drawer.priceEffectiveTime' },
|
||
];
|
||
|
||
type FeeViewMode = 'all' | 'receivable' | 'payable';
|
||
const feeViewMode = ref<FeeViewMode>('all');
|
||
|
||
// 详情数据(从 order 或 API 获取)
|
||
const sender = ref<Record<string, any>>({});
|
||
const recipient = ref<Record<string, any>>({});
|
||
const declarationList = ref<any[]>([]);
|
||
const weightList = ref<any[]>([]);
|
||
const feeList = ref<any[]>([]);
|
||
const feeItemDictRows = ref<DictDto[]>([]);
|
||
let feeItemDictLoadPromise: Promise<void> | null = null;
|
||
const trackTimeline = ref<any[]>([]);
|
||
const trackLoading = ref(false);
|
||
|
||
const trackOrderNumber = computed(
|
||
() =>
|
||
detail.value?.trackNo ||
|
||
detail.value?.trackingNo ||
|
||
detail.value?.waybillNo ||
|
||
detail.value?.customerOrderNo ||
|
||
''
|
||
);
|
||
|
||
function getWeightRowByType(type: string) {
|
||
return displayWeightRows.value.find((row) => row.type === type);
|
||
}
|
||
|
||
function hasWeightRow(type: string) {
|
||
return displayWeightRows.value.some((row) => row.type === type);
|
||
}
|
||
|
||
function hasWeightData(row: any) {
|
||
if (!row) return false;
|
||
return weightMetricFields.some((field) => {
|
||
const val = row[field.key];
|
||
return val != null && val !== '';
|
||
});
|
||
}
|
||
|
||
const visibleWeightSections = computed(() => {
|
||
const sections = weightTypeDefs.map((def) => {
|
||
const row = getWeightRowByType(def.key) ?? { type: def.key };
|
||
return {
|
||
...def,
|
||
row,
|
||
hasData: hasWeightData(row),
|
||
};
|
||
});
|
||
if (weightViewMode.value === 'all') return sections;
|
||
return sections.filter((section) => section.key === weightViewMode.value);
|
||
});
|
||
|
||
const customerWeightTypeDefs = computed(() =>
|
||
weightTypeDefs.filter((def) =>
|
||
(CUSTOMER_WEIGHT_TYPE_KEYS as readonly string[]).includes(def.key),
|
||
),
|
||
);
|
||
|
||
const visibleCustomerWeightSections = computed(() => {
|
||
const sections = customerWeightTypeDefs.value.map((def) => {
|
||
const row = getWeightRowByType(def.key) ?? { type: def.key };
|
||
return {
|
||
...def,
|
||
row,
|
||
hasData: hasWeightData(row),
|
||
};
|
||
});
|
||
if (weightViewMode.value === 'all') return sections;
|
||
if ((CUSTOMER_WEIGHT_TYPE_KEYS as readonly string[]).includes(weightViewMode.value)) {
|
||
return sections.filter((section) => section.key === weightViewMode.value);
|
||
}
|
||
return sections;
|
||
});
|
||
|
||
const hasCustomerWeightData = computed(() =>
|
||
customerWeightTypeDefs.value.some((def) => hasWeightData(getWeightRowByType(def.key))),
|
||
);
|
||
|
||
function setWeightViewMode(mode: WeightViewMode) {
|
||
weightViewMode.value = weightViewMode.value === mode ? 'all' : mode;
|
||
}
|
||
|
||
function formatWeightNumber(value: unknown) {
|
||
const num = Number(value);
|
||
return Number.isFinite(num) ? num.toFixed(3).replace(/\.?0+$/, '') : '--';
|
||
}
|
||
|
||
function formatWeightChargeable(row?: { chargeableWeight?: number | string | null }) {
|
||
const val = row?.chargeableWeight;
|
||
if (val == null || val === '') return '--';
|
||
return `${formatWeightNumber(val)} kg`;
|
||
}
|
||
|
||
function formatWeightCellValue(row: any, key: string) {
|
||
const val = row?.[key];
|
||
if (val == null || val === '') return '--';
|
||
if (['length', 'width', 'height'].includes(key)) return `${formatWeightNumber(val)} cm`;
|
||
if (['actualWeight', 'volumetricWeight', 'chargeableWeight'].includes(key)) {
|
||
return `${formatWeightNumber(val)} kg`;
|
||
}
|
||
if (key === 'cubic') return `${formatWeightNumber(val)} m³`;
|
||
return String(val);
|
||
}
|
||
|
||
function handleAskAdvisor() {
|
||
const pick = (key: string) => {
|
||
const text = getOrderValue(key);
|
||
return text && text !== '--' ? text : undefined;
|
||
};
|
||
|
||
openAskAdvisor(router, {
|
||
orderId: orderId.value != null ? String(orderId.value) : undefined,
|
||
waybillNo: pick('serviceNo'),
|
||
trackingNo: pick('trackNo'),
|
||
customerOrderNo: pick('clientNo'),
|
||
from: 'myOrders',
|
||
orderStatus: resolveOrderStatusCode(detail.value) || undefined,
|
||
});
|
||
}
|
||
|
||
function getOrderDetailFormatContext() {
|
||
return {
|
||
t,
|
||
resolveOrderStatusCode,
|
||
getOrderStatusMeta,
|
||
exportCustomsDict: exportCustomsDictRows.value,
|
||
additionalServiceDict: additionalServiceDictRows.value,
|
||
};
|
||
}
|
||
|
||
const orderAdditionalServiceCodes = computed(() =>
|
||
parseAdditionalServiceCodes(
|
||
detail.value?.additionalServices ?? detail.value?.AdditionalServices,
|
||
),
|
||
);
|
||
|
||
function labelAdditionalService(code: string) {
|
||
const hit = additionalServiceDictRows.value.find((r) => r.dictCode === code);
|
||
return hit?.dictName || code;
|
||
}
|
||
|
||
async function ensureDetailDictsLoaded() {
|
||
const tasks: Promise<void>[] = [];
|
||
if (!exportCustomsDictRows.value.length) {
|
||
tasks.push(
|
||
getDictListAll({ dictType: 'export_customs_mode' })
|
||
.then((rows) => {
|
||
exportCustomsDictRows.value = rows;
|
||
})
|
||
.catch(() => {
|
||
exportCustomsDictRows.value = [];
|
||
}),
|
||
);
|
||
}
|
||
if (!additionalServiceDictRows.value.length) {
|
||
tasks.push(
|
||
getDictListAll({ dictType: 'additional_service' })
|
||
.then((rows) => {
|
||
additionalServiceDictRows.value = rows;
|
||
})
|
||
.catch(() => {
|
||
additionalServiceDictRows.value = [];
|
||
}),
|
||
);
|
||
}
|
||
if (tasks.length) {
|
||
await Promise.all(tasks);
|
||
}
|
||
}
|
||
|
||
// 订单基本信息取值(兼容 API 驼峰与 mock 字段名)
|
||
function getOrderValue(key: string) {
|
||
const o = detail.value;
|
||
if (!o) return '--';
|
||
const fieldMap: Record<string, string[]> = {
|
||
serviceNo: ['serviceNo', 'waybillNo'],
|
||
clientNo: ['clientNo', 'customerOrderNo'],
|
||
trackNo: ['trackNo', 'trackingNo'],
|
||
downstreamServiceNo: ['downstreamServiceNo', 'DownstreamServiceNo'],
|
||
productCode: ['productCode'],
|
||
productName: ['productName', 'shippingMethod'],
|
||
channelCode: ['channelCode'],
|
||
channelName: ['channelName', 'serviceChannel'],
|
||
consigneeCountry: ['consigneeCountry'],
|
||
consigneeCountryName: ['consigneeCountryName'],
|
||
cargoAttribute: ['cargoAttribute'],
|
||
orderStatus: ['status', 'orderStatus'],
|
||
predeclareFailReason: ['predeclareFailReason', 'PredeclareFailReason'],
|
||
allocationPendingReason: ['allocationPendingReason', 'AllocationPendingReason'],
|
||
warehouse: ['warehouse', 'warehouseName'],
|
||
receiveTime: ['receiveTime'],
|
||
shipTime: ['shipTime'],
|
||
payTime: ['payTime'],
|
||
signTime: ['signTime'],
|
||
isPaid: ['isPaid', 'IsPaid'],
|
||
isCod: ['isCod'],
|
||
codCurrency: ['codCurrency'],
|
||
codSum: ['codSum'],
|
||
isIntercept: ['isIntercept'],
|
||
isRemote: ['isRemote'],
|
||
createTime: ['createTime'],
|
||
createBy: ['createBy'],
|
||
updateTime: ['updateTime'],
|
||
updateBy: ['updateBy'],
|
||
...ORDER_DETAIL_VALUE_FIELD_MAP,
|
||
};
|
||
const keys = fieldMap[key] || [key];
|
||
let val: any;
|
||
for (const k of keys) {
|
||
if (o[k] != null && o[k] !== '') {
|
||
val = o[k];
|
||
break;
|
||
}
|
||
}
|
||
if (val == null || val === '') return '--';
|
||
if (key === 'isCod' || key === 'isIntercept' || key === 'isRemote' || key === 'isPaid') {
|
||
return val ? t('order.myOrders.drawer.yes') : t('order.myOrders.drawer.no');
|
||
}
|
||
if (key === 'orderStatus') {
|
||
const code = resolveOrderStatusCode(o);
|
||
const meta = getOrderStatusMeta(code);
|
||
if (meta) return t(meta.labelKey);
|
||
const statusKey = `order.myOrders.status.${val}`;
|
||
const translated = t(statusKey);
|
||
return translated !== statusKey ? translated : String(val);
|
||
}
|
||
if (key === 'cargoAttribute') {
|
||
const cargoKey = `order.myOrders.drawer.cargoAttribute.${val}`;
|
||
const translated = t(cargoKey);
|
||
return translated !== cargoKey ? translated : String(val);
|
||
}
|
||
const extended = formatOrderDetailExtendedValue(key, val, o, getOrderDetailFormatContext());
|
||
if (extended != null) return extended;
|
||
return String(val);
|
||
}
|
||
|
||
function getSenderValue(key: string) {
|
||
if (key === 'country') {
|
||
return sender.value.country ?? sender.value.countryCode ?? '--';
|
||
}
|
||
const val = sender.value[key];
|
||
if (key === 'isDefault') {
|
||
return val == null ? '--' : (val ? t('order.myOrders.drawer.yes') : t('order.myOrders.drawer.no'));
|
||
}
|
||
return val ?? '--';
|
||
}
|
||
|
||
function getRecipientValue(key: string) {
|
||
if (key === 'country') {
|
||
return recipient.value.country ?? recipient.value.countryCode ?? '--';
|
||
}
|
||
return recipient.value[key] ?? '--';
|
||
}
|
||
|
||
function formatTrackTime(timestamp?: number | string) {
|
||
if (timestamp == null || timestamp === '') return '';
|
||
const raw = typeof timestamp === 'string' ? Number(timestamp) : timestamp;
|
||
if (!Number.isFinite(raw)) return String(timestamp);
|
||
const d = new Date(raw);
|
||
if (Number.isNaN(d.getTime())) return String(timestamp);
|
||
return d.toLocaleString('zh-CN', {
|
||
year: 'numeric',
|
||
month: '2-digit',
|
||
day: '2-digit',
|
||
hour: '2-digit',
|
||
minute: '2-digit',
|
||
second: '2-digit',
|
||
hour12: false,
|
||
});
|
||
}
|
||
|
||
function formatTrackTimeDisplay(item: any) {
|
||
return formatTrackTime(item?.trackTime);
|
||
}
|
||
|
||
function normalizeTrackText(value: unknown) {
|
||
const text = value == null ? '' : String(value).trim();
|
||
return !text || text === '--' ? '' : text;
|
||
}
|
||
|
||
function formatTrackPlace(item: any) {
|
||
const structured = [item?.trackPlaceNation, item?.trackPlaceProvince, item?.trackPlaceCity]
|
||
.map(normalizeTrackText)
|
||
.filter(Boolean);
|
||
if (structured.length) return structured.join(' · ');
|
||
return normalizeTrackText(item?.trackPlace);
|
||
}
|
||
|
||
function getTrackStatusLabel(item: any) {
|
||
return (
|
||
normalizeTrackText(item?.trackStatus) ||
|
||
normalizeTrackText(item?.content) ||
|
||
t('order.myOrders.drawer.track.statusUnknown')
|
||
);
|
||
}
|
||
|
||
/** 有独立状态时,中文内容作为详情;否则中文已作标题 */
|
||
function getTrackZhDetail(item: any) {
|
||
const status = normalizeTrackText(item?.trackStatus);
|
||
const zh = normalizeTrackText(item?.content);
|
||
if (!zh || !status || zh === status) return '';
|
||
return zh;
|
||
}
|
||
|
||
/** 英文内容;与标题/中文相同则不重复展示 */
|
||
function getTrackEnDetail(item: any) {
|
||
const en = normalizeTrackText(item?.enContent);
|
||
if (!en) return '';
|
||
const zh = normalizeTrackText(item?.content);
|
||
const status = normalizeTrackText(item?.trackStatus);
|
||
if (en === zh || en === status) return '';
|
||
return en;
|
||
}
|
||
|
||
const displayTrackTimeline = computed(() => {
|
||
const list = [...trackTimeline.value];
|
||
if (!list.length) return [];
|
||
// 与顺丰/京东一致:最新在上
|
||
return list.sort((a, b) => Number(b?.trackTime || 0) - Number(a?.trackTime || 0));
|
||
});
|
||
|
||
function isTrackNodeActive(item: any, index: number) {
|
||
if (item?.isHighlight) return true;
|
||
const list = displayTrackTimeline.value;
|
||
if (list.some((node) => node?.isHighlight)) return false;
|
||
return index === 0;
|
||
}
|
||
|
||
function normalizeFeeType(row: any): 'receivable' | 'payable' | '' {
|
||
const raw = String(row?.type ?? row?.feeType ?? row?.FeeType ?? '').toLowerCase();
|
||
if (raw === 'receivable' || raw === 'payable') return raw;
|
||
return '';
|
||
}
|
||
|
||
function getChargingStageRank(stage?: string) {
|
||
const s = String(stage ?? '').toLowerCase();
|
||
if (s === 'outbound') return 3;
|
||
if (s === 'inbound') return 2;
|
||
if (s === 'forecast') return 1;
|
||
return 0;
|
||
}
|
||
|
||
/** 同费用项只保留最高计费阶段,避免预报+入库叠算 */
|
||
function filterEffectiveStageFees(list: any[]) {
|
||
const winners = new Map<string, any>();
|
||
for (const row of list) {
|
||
const feeType = normalizeFeeType(row) || 'unknown';
|
||
const costItem = String(row?.costItem ?? row?.CostItem ?? '').trim() || '_';
|
||
const key = `${feeType}|${costItem}`;
|
||
const current = winners.get(key);
|
||
if (!current) {
|
||
winners.set(key, row);
|
||
continue;
|
||
}
|
||
const rowStage = String(row?.chargingStage ?? row?.ChargingStage ?? '');
|
||
const curStage = String(current?.chargingStage ?? current?.ChargingStage ?? '');
|
||
if (getChargingStageRank(rowStage) > getChargingStageRank(curStage)) {
|
||
winners.set(key, row);
|
||
}
|
||
}
|
||
return [...winners.values()];
|
||
}
|
||
|
||
function sumFeesByCurrency(list: any[]) {
|
||
const totals = new Map<string, number>();
|
||
for (const row of list) {
|
||
const currency = String(row?.currency ?? 'CNY').trim() || 'CNY';
|
||
const amount = Number(row?.amount);
|
||
if (!Number.isFinite(amount)) continue;
|
||
totals.set(currency, (totals.get(currency) ?? 0) + amount);
|
||
}
|
||
return totals;
|
||
}
|
||
|
||
const receivableFeeList = computed(() =>
|
||
filterEffectiveStageFees(feeList.value.filter((row) => normalizeFeeType(row) === 'receivable'))
|
||
);
|
||
|
||
const payableFeeList = computed(() =>
|
||
filterEffectiveStageFees(feeList.value.filter((row) => normalizeFeeType(row) === 'payable'))
|
||
);
|
||
|
||
const receivableTotals = computed(() => sumFeesByCurrency(receivableFeeList.value));
|
||
|
||
function isDiscountFeeRow(row: any) {
|
||
return isDiscountCostItem(row?.costItem ?? row?.CostItem);
|
||
}
|
||
|
||
/** 支付写入的优惠券抵扣 / 会员折扣(负数),用于应收卡片「含优惠」提示 */
|
||
const receivableDiscountTotals = computed(() =>
|
||
sumFeesByCurrency(receivableFeeList.value.filter(isDiscountFeeRow)),
|
||
);
|
||
const payableTotals = computed(() => sumFeesByCurrency(payableFeeList.value));
|
||
|
||
function calcGrossProfitTotals(
|
||
receivable: Map<string, number>,
|
||
payable: Map<string, number>
|
||
) {
|
||
const currencies = new Set([...receivable.keys(), ...payable.keys()]);
|
||
const result = new Map<string, number>();
|
||
for (const currency of currencies) {
|
||
result.set(currency, (receivable.get(currency) ?? 0) - (payable.get(currency) ?? 0));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
const feeGrossProfitTotals = computed(() =>
|
||
calcGrossProfitTotals(receivableTotals.value, payableTotals.value)
|
||
);
|
||
|
||
const grossProfitMarginText = computed(() => {
|
||
const margins: string[] = [];
|
||
for (const [currency, recv] of receivableTotals.value) {
|
||
if (!recv) continue;
|
||
const profit = feeGrossProfitTotals.value.get(currency) ?? 0;
|
||
margins.push(
|
||
t('order.myOrders.drawer.fee.grossMargin', {
|
||
value: `${((profit / recv) * 100).toFixed(1)}%`,
|
||
})
|
||
);
|
||
}
|
||
return margins.length ? margins.join(' / ') : t('order.myOrders.drawer.fee.grossMarginEmpty');
|
||
});
|
||
|
||
const visibleFeeSections = computed(() => {
|
||
const sections = [
|
||
{
|
||
key: 'receivable' as const,
|
||
titleKey: 'order.myOrders.drawer.fee.receivableTitle',
|
||
emptyKey: 'order.myOrders.drawer.fee.emptyReceivable',
|
||
list: receivableFeeList.value,
|
||
totals: receivableTotals.value,
|
||
tagColor: 'green',
|
||
amountClass: 'amount-receivable',
|
||
},
|
||
{
|
||
key: 'payable' as const,
|
||
titleKey: 'order.myOrders.drawer.fee.payableTitle',
|
||
emptyKey: 'order.myOrders.drawer.fee.emptyPayable',
|
||
list: payableFeeList.value,
|
||
totals: payableTotals.value,
|
||
tagColor: 'red',
|
||
amountClass: 'amount-payable',
|
||
},
|
||
];
|
||
if (feeViewMode.value === 'all') return sections;
|
||
return sections.filter((section) => section.key === feeViewMode.value);
|
||
});
|
||
|
||
function setFeeViewMode(mode: FeeViewMode) {
|
||
feeViewMode.value = feeViewMode.value === mode ? 'all' : mode;
|
||
}
|
||
|
||
function openAddFeeModal() {
|
||
if (orderId.value == null) return;
|
||
addFeeDefaultType.value =
|
||
feeViewMode.value === 'payable'
|
||
? 'payable'
|
||
: feeViewMode.value === 'receivable'
|
||
? 'receivable'
|
||
: 'receivable';
|
||
addFeeModalVisible.value = true;
|
||
}
|
||
|
||
function handleAddFeeSuccess(order: OrderRow) {
|
||
applyDetailFromApi(order);
|
||
void ensureFeeItemDictLoaded();
|
||
}
|
||
|
||
function formatFeeAmount(value: unknown) {
|
||
const num = Number(value);
|
||
return Number.isFinite(num) ? num.toFixed(2) : '--';
|
||
}
|
||
|
||
function formatFeeTotals(totals: Map<string, number>) {
|
||
if (!totals.size) return '--';
|
||
return [...totals.entries()]
|
||
.map(([currency, amount]) => `${currency} ${amount.toFixed(2)}`)
|
||
.join(' + ');
|
||
}
|
||
|
||
function formatGrossProfitTotals(totals: Map<string, number>) {
|
||
if (!totals.size) return '--';
|
||
return [...totals.entries()]
|
||
.map(([currency, amount]) => {
|
||
const sign = amount > 0 ? '+' : '';
|
||
return `${sign}${currency} ${amount.toFixed(2)}`;
|
||
})
|
||
.join(' + ');
|
||
}
|
||
|
||
function getChargingStage(row: any) {
|
||
const stage = row?.chargingStage ?? row?.ChargingStage;
|
||
return stage != null && stage !== '' ? String(stage) : '';
|
||
}
|
||
|
||
function getChargingStageLabel(stage: string) {
|
||
const key = `finance.receivablePayable.chargingStage.${stage}`;
|
||
const translated = t(key);
|
||
return translated !== key ? translated : stage;
|
||
}
|
||
|
||
function getChargingStageColor(stage: string) {
|
||
const map: Record<string, string> = {
|
||
forecast: 'arcoblue',
|
||
inbound: 'orange',
|
||
outbound: 'purple',
|
||
};
|
||
return map[stage] || 'gray';
|
||
}
|
||
|
||
async function ensureFeeItemDictLoaded() {
|
||
if (feeItemDictRows.value.length) return;
|
||
if (feeItemDictLoadPromise) {
|
||
await feeItemDictLoadPromise;
|
||
return;
|
||
}
|
||
feeItemDictLoadPromise = (async () => {
|
||
try {
|
||
feeItemDictRows.value = await getDictListAll({ dictType: 'fee_item' });
|
||
} catch {
|
||
feeItemDictRows.value = [];
|
||
}
|
||
})();
|
||
await feeItemDictLoadPromise;
|
||
}
|
||
|
||
function getCostItemLabel(row: any) {
|
||
const fromApi = row?.costItemName ?? row?.CostItemName;
|
||
if (fromApi != null && fromApi !== '') return String(fromApi);
|
||
|
||
const code = row?.costItem ?? row?.CostItem;
|
||
if (code == null || code === '') return '--';
|
||
|
||
const c = String(code).trim();
|
||
const hit = feeItemDictRows.value.find(
|
||
(r) => String(r.dictCode ?? (r as any).DictCode ?? '').trim() === c
|
||
);
|
||
if (hit?.dictName) return hit.dictName;
|
||
|
||
const byName = feeItemDictRows.value.find(
|
||
(r) => String(r.dictName ?? (r as any).DictName ?? '').trim() === c
|
||
);
|
||
return byName?.dictName || c;
|
||
}
|
||
|
||
function getFeeCellValue(row: any, col: { key: string }) {
|
||
if (col.key === 'costItem') return getCostItemLabel(row);
|
||
if (col.key === 'priceEffectiveTime') {
|
||
const v = row[col.key];
|
||
if (v == null) return '--';
|
||
if (typeof v === 'number') return formatTrackTime(v);
|
||
return String(v);
|
||
}
|
||
return row[col.key] ?? '--';
|
||
}
|
||
|
||
// 加载轨迹(复用 track/order 的接口)
|
||
async function loadTrackTimeline() {
|
||
const orderNumber = detail.value?.waybillNo;
|
||
if (!orderNumber) {
|
||
trackTimeline.value = [];
|
||
return;
|
||
}
|
||
trackLoading.value = true;
|
||
try {
|
||
const res: any = await postGetDetailTimeline({ orderNumber });
|
||
trackTimeline.value = res?.data || res || [];
|
||
} catch {
|
||
trackTimeline.value = [];
|
||
} finally {
|
||
trackLoading.value = false;
|
||
}
|
||
}
|
||
|
||
// 加载详情数据(优先使用 list 接口返回的 sender/receiver/items/weightList,与 parcel/create 对应)
|
||
function loadDetailData() {
|
||
const o = detail.value;
|
||
if (!o) return;
|
||
|
||
// 发件人
|
||
if (o.sender && typeof o.sender === 'object') {
|
||
sender.value = { ...o.sender, country: o.sender.country ?? o.sender.countryCode };
|
||
} else {
|
||
sender.value = {};
|
||
}
|
||
|
||
// 收件人:优先使用 list 返回的 receiver
|
||
if (o.receiver && typeof o.receiver === 'object') {
|
||
recipient.value = { ...o.receiver, country: o.receiver.country ?? o.receiver.countryCode };
|
||
} else {
|
||
recipient.value = {
|
||
recipientsName: o.consignee || '',
|
||
companyName: '',
|
||
country: o.consigneeCountry || '',
|
||
phone: o.consigneePhone || '',
|
||
telePhone: '',
|
||
zipCode: o.consigneePostcode || '',
|
||
province: o.consigneeState || '',
|
||
city: o.consigneeCity || '',
|
||
streetNumber: '',
|
||
streetAddress1: o.consigneeAddress || '',
|
||
streetAddress2: '',
|
||
streetAddress3: '',
|
||
email: '',
|
||
taxType: '',
|
||
taxNo: '',
|
||
certificateType: '',
|
||
certificateNo: '',
|
||
eori: o.eori || '',
|
||
vat: '',
|
||
};
|
||
}
|
||
|
||
// 申报信息
|
||
declarationList.value = Array.isArray(o.items) && o.items.length > 0
|
||
? cloneDeclarationItemRows(o.items)
|
||
: [];
|
||
|
||
// 件重尺
|
||
weightList.value = Array.isArray(o.weightList) && o.weightList.length > 0 ? o.weightList : [];
|
||
|
||
// 费用:接口字段可为 feeList / orderFees / FeeList
|
||
const fees = o.feeList ?? o.FeeList ?? o.orderFees ?? o.fees;
|
||
feeList.value = Array.isArray(fees) ? fees : [];
|
||
}
|
||
|
||
function applyDetailFromApi(raw: any) {
|
||
if (!raw || typeof raw !== 'object') return;
|
||
detail.value = { ...(detail.value || {}), ...raw };
|
||
loadDetailData();
|
||
emit('updated', detail.value as OrderRow);
|
||
}
|
||
|
||
function fillBasicEditForm() {
|
||
const o = detail.value;
|
||
if (!o?.id) return;
|
||
basicEditForm.clientNo = String(o.clientNo ?? o.customerOrderNo ?? '');
|
||
basicEditForm.downstreamServiceNo = String(o.downstreamServiceNo ?? o.DownstreamServiceNo ?? '');
|
||
const warehouseIdRaw = o.warehouseId ?? o.WarehouseId;
|
||
const warehouseIdNum = warehouseIdRaw != null ? Number(warehouseIdRaw) : NaN;
|
||
basicEditForm.warehouseId =
|
||
Number.isFinite(warehouseIdNum) && warehouseIdNum > 0 ? warehouseIdNum : undefined;
|
||
basicEditForm.cargoAttribute = String(o.cargoAttribute ?? 'general');
|
||
basicEditForm.isCod = !!(o.isCod ?? o.IsCod);
|
||
basicEditForm.codSum = o.codSum != null ? Number(o.codSum) : undefined;
|
||
basicEditForm.codCurrency = String(o.codCurrency ?? '');
|
||
basicEditForm.declaredCurrency = String(o.declaredCurrency ?? o.DeclaredCurrency ?? '');
|
||
const declaredSumRaw = o.declaredSum ?? o.DeclaredSum;
|
||
basicEditForm.declaredSum =
|
||
declaredSumRaw != null && declaredSumRaw !== '' && Number.isFinite(Number(declaredSumRaw))
|
||
? Number(declaredSumRaw)
|
||
: undefined;
|
||
|
||
senderEditForm.senderName = String(sender.value.senderName ?? '');
|
||
senderEditForm.company = String(sender.value.company ?? '');
|
||
senderEditForm.countryCode = String(sender.value.countryCode ?? sender.value.country ?? '');
|
||
senderEditForm.province = String(sender.value.province ?? '');
|
||
senderEditForm.city = String(sender.value.city ?? '');
|
||
senderEditForm.zipCode = String(sender.value.zipCode ?? '');
|
||
senderEditForm.streetAddress1 = String(sender.value.streetAddress1 ?? '');
|
||
senderEditForm.streetAddress2 = String(sender.value.streetAddress2 ?? '');
|
||
senderEditForm.streetAddress3 = String(sender.value.streetAddress3 ?? '');
|
||
senderEditForm.houseNumber = String(sender.value.houseNumber ?? '');
|
||
senderEditForm.phone = String(sender.value.phone ?? '');
|
||
senderEditForm.telePhone = String(sender.value.telePhone ?? '');
|
||
senderEditForm.email = String(sender.value.email ?? '');
|
||
|
||
receiverEditForm.recipientsName = String(recipient.value.recipientsName ?? o.consignee ?? '');
|
||
receiverEditForm.companyName = String(recipient.value.companyName ?? '');
|
||
receiverEditForm.countryCode = String(
|
||
recipient.value.countryCode ?? recipient.value.country ?? o.consigneeCountry ?? ''
|
||
);
|
||
receiverEditForm.phone = String(recipient.value.phone ?? o.consigneePhone ?? '');
|
||
receiverEditForm.telePhone = String(recipient.value.telePhone ?? '');
|
||
receiverEditForm.zipCode = String(recipient.value.zipCode ?? o.consigneePostcode ?? '');
|
||
receiverEditForm.province = String(recipient.value.province ?? o.consigneeState ?? '');
|
||
receiverEditForm.city = String(recipient.value.city ?? o.consigneeCity ?? '');
|
||
receiverEditForm.streetNumber = String(recipient.value.streetNumber ?? '');
|
||
receiverEditForm.streetAddress1 = String(recipient.value.streetAddress1 ?? o.consigneeAddress ?? '');
|
||
receiverEditForm.streetAddress2 = String(recipient.value.streetAddress2 ?? '');
|
||
receiverEditForm.streetAddress3 = String(recipient.value.streetAddress3 ?? '');
|
||
receiverEditForm.email = String(recipient.value.email ?? '');
|
||
receiverEditForm.taxType = recipient.value.taxType != null ? String(recipient.value.taxType) : '';
|
||
receiverEditForm.taxNo = String(recipient.value.taxNo ?? '');
|
||
receiverEditForm.certificateType =
|
||
recipient.value.certificateType != null ? String(recipient.value.certificateType) : '';
|
||
receiverEditForm.certificateNo = String(recipient.value.certificateNo ?? '');
|
||
receiverEditForm.eori = String(recipient.value.eori ?? o.eori ?? '');
|
||
receiverEditForm.vat = String(recipient.value.vat ?? '');
|
||
|
||
declarationEditList.value = cloneDeclarationRows(declarationList.value);
|
||
}
|
||
|
||
async function focusFirstEditableField(rootSelector: string) {
|
||
await nextTick();
|
||
await nextTick();
|
||
const root = document.querySelector(rootSelector);
|
||
if (!root) return;
|
||
const el = root.querySelector(
|
||
'.is-editable input:not([disabled]), .is-editable textarea:not([disabled]), .is-editable .arco-select-view',
|
||
) as HTMLElement | null;
|
||
el?.focus?.();
|
||
}
|
||
|
||
function startBasicEdit() {
|
||
if (!canEditOrderDetail.value) {
|
||
Message.warning(t('order.myOrders.drawer.editAfterInboundForbidden'));
|
||
return;
|
||
}
|
||
fillBasicEditForm();
|
||
void ensureCurrencyOptions(basicEditForm.declaredCurrency);
|
||
void ensureWarehouseOptions({
|
||
id: basicEditForm.warehouseId,
|
||
name: String(detail.value?.warehouse ?? detail.value?.warehouseName ?? ''),
|
||
});
|
||
basicEditing.value = true;
|
||
void focusFirstEditableField('.order-detail-drawer .basic-info');
|
||
}
|
||
|
||
function cancelBasicEdit() {
|
||
basicEditing.value = false;
|
||
declarationEditList.value = [];
|
||
loadDetailData();
|
||
}
|
||
|
||
function startWeightEdit() {
|
||
weightEditForm.value = (weightList.value || []).map((row: any) => ({
|
||
type: row.type,
|
||
length: row.length != null ? Number(row.length) : undefined,
|
||
width: row.width != null ? Number(row.width) : undefined,
|
||
height: row.height != null ? Number(row.height) : undefined,
|
||
actualWeight: row.actualWeight != null ? Number(row.actualWeight) : undefined,
|
||
}));
|
||
weightEditing.value = true;
|
||
}
|
||
|
||
function cancelWeightEdit() {
|
||
weightEditing.value = false;
|
||
loadDetailData();
|
||
}
|
||
|
||
async function handleBasicEditSave() {
|
||
const id = orderId.value;
|
||
if (id == null) return;
|
||
basicSaving.value = true;
|
||
try {
|
||
const result = await postOrderUpdate({
|
||
id,
|
||
clientNo: basicEditForm.clientNo,
|
||
downstreamServiceNo: basicEditForm.downstreamServiceNo,
|
||
warehouseId: basicEditForm.warehouseId ?? 0,
|
||
cargoAttribute: basicEditForm.cargoAttribute,
|
||
isCod: basicEditForm.isCod,
|
||
codSum: basicEditForm.codSum,
|
||
codCurrency: basicEditForm.codCurrency,
|
||
declaredCurrency: basicEditForm.declaredCurrency,
|
||
declaredSum: basicEditForm.declaredSum,
|
||
sender: hasSender.value
|
||
? {
|
||
senderName: senderEditForm.senderName,
|
||
company: senderEditForm.company,
|
||
countryCode: senderEditForm.countryCode,
|
||
province: senderEditForm.province,
|
||
city: senderEditForm.city,
|
||
zipCode: senderEditForm.zipCode,
|
||
streetAddress1: senderEditForm.streetAddress1,
|
||
streetAddress2: senderEditForm.streetAddress2,
|
||
streetAddress3: senderEditForm.streetAddress3,
|
||
houseNumber: senderEditForm.houseNumber,
|
||
phone: senderEditForm.phone,
|
||
telePhone: senderEditForm.telePhone,
|
||
email: senderEditForm.email,
|
||
}
|
||
: undefined,
|
||
receiver: {
|
||
recipientsName: receiverEditForm.recipientsName,
|
||
companyName: receiverEditForm.companyName,
|
||
countryCode: receiverEditForm.countryCode,
|
||
phone: receiverEditForm.phone,
|
||
telePhone: receiverEditForm.telePhone,
|
||
zipCode: receiverEditForm.zipCode,
|
||
province: receiverEditForm.province,
|
||
city: receiverEditForm.city,
|
||
streetNumber: receiverEditForm.streetNumber,
|
||
streetAddress1: receiverEditForm.streetAddress1,
|
||
streetAddress2: receiverEditForm.streetAddress2,
|
||
streetAddress3: receiverEditForm.streetAddress3,
|
||
email: receiverEditForm.email,
|
||
taxType: parseOptionalInt(receiverEditForm.taxType),
|
||
taxNo: receiverEditForm.taxNo,
|
||
certificateType: parseOptionalInt(receiverEditForm.certificateType),
|
||
certificateNo: receiverEditForm.certificateNo,
|
||
eori: receiverEditForm.eori,
|
||
vat: receiverEditForm.vat,
|
||
},
|
||
items: buildDeclarationPayload(),
|
||
});
|
||
applyDetailFromApi(result);
|
||
basicEditing.value = false;
|
||
Message.success(t('order.myOrders.drawer.message.saveSuccess'));
|
||
} catch (e: any) {
|
||
Message.error(e?.message || '保存失败');
|
||
} finally {
|
||
basicSaving.value = false;
|
||
}
|
||
}
|
||
|
||
async function handleWeightEditSave() {
|
||
const id = orderId.value;
|
||
if (id == null) return;
|
||
weightSaving.value = true;
|
||
try {
|
||
const result = await postOrderWeightUpdate({
|
||
id,
|
||
weights: weightEditForm.value.map((row) => ({
|
||
type: row.type,
|
||
length: row.length,
|
||
width: row.width,
|
||
height: row.height,
|
||
actualWeight: row.actualWeight,
|
||
})),
|
||
});
|
||
applyDetailFromApi(result);
|
||
weightEditing.value = false;
|
||
Message.success(t('order.myOrders.drawer.message.saveSuccess'));
|
||
} catch (e: any) {
|
||
Message.error(e?.message || '保存失败');
|
||
} finally {
|
||
weightSaving.value = false;
|
||
}
|
||
}
|
||
|
||
async function handleRecalculateReceivable() {
|
||
const id = orderId.value;
|
||
if (id == null) return;
|
||
recalcReceivableLoading.value = true;
|
||
try {
|
||
const result = await postOrderRecalculateReceivable({ id });
|
||
applyDetailFromApi(result);
|
||
Message.success(t('order.myOrders.drawer.message.recalculateSuccess'));
|
||
} catch (e: any) {
|
||
Message.error(e?.message || '重算应收失败');
|
||
} finally {
|
||
recalcReceivableLoading.value = false;
|
||
}
|
||
}
|
||
|
||
async function handleRecalculatePayable() {
|
||
const id = orderId.value;
|
||
if (id == null) return;
|
||
recalcPayableLoading.value = true;
|
||
try {
|
||
const result = await postOrderRecalculatePayable({ id });
|
||
applyDetailFromApi(result);
|
||
Message.success(t('order.myOrders.drawer.message.recalculateSuccess'));
|
||
} catch (e: any) {
|
||
Message.error(e?.message || '重算应付失败');
|
||
} finally {
|
||
recalcPayableLoading.value = false;
|
||
}
|
||
}
|
||
|
||
async function loadOperationLogs() {
|
||
const id = orderId.value;
|
||
if (!id) {
|
||
operationLogList.value = [];
|
||
return;
|
||
}
|
||
operationLogLoading.value = true;
|
||
try {
|
||
const res = await getOrderOperationLogList(id);
|
||
operationLogList.value = res.items || [];
|
||
operationLogExpandedIds.value = new Set(
|
||
operationLogList.value.slice(0, 3).map((x) => x.id),
|
||
);
|
||
} catch {
|
||
operationLogList.value = [];
|
||
} finally {
|
||
operationLogLoading.value = false;
|
||
}
|
||
}
|
||
|
||
function isOperationLogExpanded(id: number) {
|
||
return operationLogExpandedIds.value.has(id);
|
||
}
|
||
|
||
function toggleOperationLogExpand(id: number) {
|
||
const next = new Set(operationLogExpandedIds.value);
|
||
if (next.has(id)) next.delete(id);
|
||
else next.add(id);
|
||
operationLogExpandedIds.value = next;
|
||
}
|
||
|
||
function formatOperationLogTime(value?: string) {
|
||
if (!value) return '--';
|
||
const d = new Date(value);
|
||
if (Number.isNaN(d.getTime())) return String(value);
|
||
const pad = (n: number) => String(n).padStart(2, '0');
|
||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
||
}
|
||
|
||
function handleTabChange(tabKey: string) {
|
||
const next = resolveDrawerTab(tabKey);
|
||
if (next !== tabKey) {
|
||
activeTab.value = next;
|
||
}
|
||
resetEditState();
|
||
if (next === 'basic') {
|
||
basicViewMode.value = 'all';
|
||
}
|
||
if (next === 'track') {
|
||
loadTrackTimeline();
|
||
}
|
||
if (next === 'weightFee') {
|
||
weightViewMode.value = 'all';
|
||
void ensureFeeItemDictLoaded();
|
||
}
|
||
if (next === 'operationLog') {
|
||
void loadOperationLogs();
|
||
}
|
||
}
|
||
|
||
function handleCancel() {
|
||
resetEditState();
|
||
emit('cancel');
|
||
}
|
||
|
||
watch(
|
||
() => props.order,
|
||
(newOrder) => {
|
||
detail.value = newOrder ? { ...newOrder } : null;
|
||
resetEditState();
|
||
if (newOrder) {
|
||
void ensureDetailDictsLoaded();
|
||
loadDetailData();
|
||
if (activeTab.value === 'track') {
|
||
loadTrackTimeline();
|
||
}
|
||
if (activeTab.value === 'weightFee') {
|
||
void ensureFeeItemDictLoaded();
|
||
}
|
||
if (activeTab.value === 'operationLog') {
|
||
void loadOperationLogs();
|
||
}
|
||
}
|
||
},
|
||
{ immediate: true, deep: true }
|
||
);
|
||
|
||
defineExpose({
|
||
openDrawer: (opts?: { tab?: 'basic' | 'weightFee' | 'weight' | 'fee' | 'track' | 'attachments' | 'stockBind' }) => {
|
||
const tab = resolveDrawerTab(opts?.tab);
|
||
activeTab.value = tab;
|
||
basicViewMode.value = 'all';
|
||
resetSectionCollapse();
|
||
resetEditState();
|
||
setDrawerProps({
|
||
content: '',
|
||
placement: 'right',
|
||
width: 1000,
|
||
title: '',
|
||
});
|
||
innerOpenDrawer();
|
||
if (tab === 'track') {
|
||
void loadTrackTimeline();
|
||
}
|
||
},
|
||
startBasicEdit,
|
||
setDrawerProps,
|
||
closeDrawer,
|
||
});
|
||
</script>
|
||
|
||
<style lang="less" scoped>
|
||
:deep(.arco-drawer-header) {
|
||
display: none;
|
||
}
|
||
|
||
.order-detail-drawer {
|
||
display: flex;
|
||
flex-direction: column;
|
||
height: 100%;
|
||
min-height: 0;
|
||
}
|
||
|
||
.drawer-tabs {
|
||
margin-bottom: 12px;
|
||
flex-shrink: 0;
|
||
min-width: 0;
|
||
|
||
.tabs-slot {
|
||
min-width: 0;
|
||
overflow: hidden;
|
||
}
|
||
}
|
||
|
||
.drawer-action-bar {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
flex-shrink: 0;
|
||
margin-top: 8px;
|
||
padding-top: 12px;
|
||
border-top: 1px solid var(--color-border-2);
|
||
background: #fff;
|
||
}
|
||
|
||
.drawer-action-bar__meta {
|
||
display: flex;
|
||
align-items: center;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
min-width: 0;
|
||
flex: 1;
|
||
}
|
||
|
||
.drawer-action-bar__actions {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
flex-shrink: 0;
|
||
margin-left: auto;
|
||
}
|
||
|
||
.action-bar-meta {
|
||
display: inline-flex;
|
||
align-items: baseline;
|
||
gap: 6px;
|
||
}
|
||
|
||
.action-bar-meta-label {
|
||
font-size: 13px;
|
||
color: var(--color-text-3);
|
||
}
|
||
|
||
.action-bar-meta-value {
|
||
font-size: 13px;
|
||
font-weight: 500;
|
||
color: var(--color-text-1);
|
||
}
|
||
|
||
/* 编辑态:仅高亮输入控件本身 */
|
||
.detail-field-item.is-editable,
|
||
.declaration-header-sum.is-editable {
|
||
:deep(.arco-input-wrapper),
|
||
:deep(.arco-select-view-single),
|
||
:deep(.arco-input-number),
|
||
:deep(.arco-textarea-wrapper) {
|
||
background: #fff;
|
||
border-color: var(--app-primary-color, #1d7281);
|
||
box-shadow: 0 0 0 1px color-mix(in srgb, var(--app-primary-color, #1d7281) 25%, transparent);
|
||
}
|
||
|
||
:deep(.arco-input-wrapper:hover),
|
||
:deep(.arco-select-view-single:hover),
|
||
:deep(.arco-input-number:hover),
|
||
:deep(.arco-textarea-wrapper:hover),
|
||
:deep(.arco-input-wrapper.arco-input-focus),
|
||
:deep(.arco-select-view-single.arco-select-view-focus),
|
||
:deep(.arco-input-number.arco-input-number-focus),
|
||
:deep(.arco-textarea-wrapper.arco-input-focus) {
|
||
border-color: var(--app-primary-color, #1d7281);
|
||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-primary-color, #1d7281) 18%, transparent);
|
||
}
|
||
}
|
||
|
||
.drawer-tab-content {
|
||
flex: 1;
|
||
overflow-y: auto;
|
||
min-height: 0;
|
||
padding-bottom: 8px;
|
||
}
|
||
|
||
.tab-panel {
|
||
padding: 0 4px;
|
||
}
|
||
|
||
.inline-edit-form {
|
||
:deep(.arco-form-item) {
|
||
margin-bottom: 12px;
|
||
}
|
||
|
||
:deep(.arco-form-item-label) {
|
||
font-size: 13px;
|
||
color: var(--color-text-3);
|
||
}
|
||
}
|
||
|
||
.edit-field {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 4px;
|
||
min-width: 0;
|
||
margin-bottom: 12px;
|
||
|
||
.edit-field-label {
|
||
font-size: 13px;
|
||
color: var(--color-text-3);
|
||
line-height: 20px;
|
||
}
|
||
|
||
:deep(.arco-input),
|
||
:deep(.arco-select),
|
||
:deep(.arco-input-number) {
|
||
width: 100%;
|
||
}
|
||
}
|
||
|
||
.readonly-field {
|
||
.readonly-value {
|
||
min-height: 32px;
|
||
padding: 4px 0;
|
||
font-size: 13px;
|
||
color: var(--color-text-1);
|
||
word-break: break-all;
|
||
}
|
||
}
|
||
|
||
.form-grid-empty {
|
||
grid-column: 1 / -1;
|
||
}
|
||
|
||
.declaration-toolbar {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
margin-bottom: 8px;
|
||
}
|
||
|
||
.readonly-inline {
|
||
align-items: flex-start;
|
||
}
|
||
|
||
.edit-form-grid {
|
||
display: grid;
|
||
grid-template-columns: 1fr 1fr;
|
||
gap: 0 16px;
|
||
}
|
||
|
||
.edit-form-span-2 {
|
||
grid-column: span 2;
|
||
}
|
||
|
||
.basic-info {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 12px;
|
||
}
|
||
|
||
.predeclare-fail-guide {
|
||
margin-top: 12px;
|
||
padding: 12px 14px;
|
||
border-radius: 8px;
|
||
background: #fff7f7;
|
||
border-left: 3px solid #f53f3f;
|
||
border-top: 1px solid #ffd8d2;
|
||
border-right: 1px solid #ffd8d2;
|
||
border-bottom: 1px solid #ffd8d2;
|
||
|
||
&__reason {
|
||
margin: 0;
|
||
font-size: 15px;
|
||
font-weight: 600;
|
||
line-height: 1.45;
|
||
color: var(--color-text-1);
|
||
}
|
||
|
||
&__tip {
|
||
margin: 8px 0 0;
|
||
font-size: 13px;
|
||
line-height: 1.5;
|
||
color: var(--color-text-2);
|
||
}
|
||
|
||
&__tip-label {
|
||
margin-right: 4px;
|
||
color: var(--app-primary-color, #2d8c8c);
|
||
font-weight: 500;
|
||
}
|
||
|
||
&__details {
|
||
margin-top: 8px;
|
||
font-size: 12px;
|
||
color: var(--color-text-3);
|
||
|
||
summary {
|
||
cursor: pointer;
|
||
user-select: none;
|
||
}
|
||
}
|
||
|
||
&__raw {
|
||
margin: 6px 0 0;
|
||
font-size: 12px;
|
||
color: var(--color-text-3);
|
||
word-break: break-word;
|
||
}
|
||
|
||
&__actions {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
gap: 8px;
|
||
margin-top: 10px;
|
||
}
|
||
}
|
||
|
||
.basic-view-switch {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.basic-view-tabs {
|
||
width: fit-content;
|
||
max-width: 100%;
|
||
}
|
||
|
||
.detail-section {
|
||
border: 1px solid var(--color-border-2);
|
||
border-radius: 6px;
|
||
overflow: hidden;
|
||
background: var(--app-card-bg);
|
||
|
||
&.basic .detail-section-dot {
|
||
background: var(--app-primary-color, #2d8c8c);
|
||
}
|
||
|
||
&.sender .detail-section-dot {
|
||
background: #165dff;
|
||
}
|
||
|
||
&.recipient .detail-section-dot {
|
||
background: #00b42a;
|
||
}
|
||
|
||
&.declaration .detail-section-dot {
|
||
background: #ff7d00;
|
||
}
|
||
}
|
||
|
||
.detail-section-header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
padding: 10px 12px;
|
||
background: var(--color-fill-2);
|
||
border-bottom: 1px solid var(--color-border-2);
|
||
|
||
&.is-collapsible {
|
||
cursor: pointer;
|
||
user-select: none;
|
||
|
||
&:hover .detail-section-title {
|
||
color: var(--app-primary-color, #2d8c8c);
|
||
}
|
||
}
|
||
}
|
||
|
||
.detail-section-header-actions {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
color: var(--color-text-3);
|
||
font-size: 14px;
|
||
}
|
||
|
||
.detail-section-body {
|
||
min-width: 0;
|
||
}
|
||
|
||
.detail-section-title-wrap {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.detail-section-dot {
|
||
width: 6px;
|
||
height: 6px;
|
||
border-radius: 50%;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.detail-section-title {
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
color: var(--color-text-1);
|
||
}
|
||
|
||
.detail-field-group {
|
||
padding: 12px 12px 0;
|
||
|
||
&:last-child {
|
||
padding-bottom: 12px;
|
||
}
|
||
}
|
||
|
||
.detail-field-group-title {
|
||
margin-bottom: 8px;
|
||
font-size: 12px;
|
||
font-weight: 500;
|
||
color: var(--color-text-3);
|
||
line-height: 20px;
|
||
}
|
||
|
||
.detail-fields-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||
gap: 10px;
|
||
padding: 12px;
|
||
}
|
||
|
||
.detail-field-item {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 4px;
|
||
min-width: 0;
|
||
padding: 8px 10px;
|
||
border: 1px solid var(--color-border-2);
|
||
border-radius: 4px;
|
||
background: var(--color-fill-2);
|
||
}
|
||
|
||
.detail-field-label {
|
||
font-size: 12px;
|
||
color: var(--color-text-3);
|
||
line-height: 18px;
|
||
}
|
||
|
||
.detail-field-value {
|
||
min-height: 24px;
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
:deep(.arco-input),
|
||
:deep(.arco-select),
|
||
:deep(.arco-input-number) {
|
||
width: 100%;
|
||
}
|
||
}
|
||
|
||
.detail-field-text {
|
||
font-size: 13px;
|
||
color: var(--color-text-1);
|
||
font-weight: 500;
|
||
word-break: break-all;
|
||
line-height: 20px;
|
||
}
|
||
|
||
.detail-section-empty {
|
||
padding: 16px 12px;
|
||
}
|
||
|
||
.declaration-header-sum {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
margin-left: 4px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.declaration-header-sum-text {
|
||
font-size: 12px;
|
||
font-weight: 500;
|
||
color: var(--color-text-2);
|
||
line-height: 20px;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.declaration-header-currency {
|
||
width: 96px;
|
||
}
|
||
|
||
.declaration-header-amount {
|
||
width: 120px;
|
||
}
|
||
|
||
.declaration-table-wrap {
|
||
max-height: 280px;
|
||
overflow: hidden;
|
||
padding: 12px;
|
||
}
|
||
|
||
.declaration-sku-preview {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-height: 200px;
|
||
|
||
img {
|
||
max-width: 100%;
|
||
max-height: 70vh;
|
||
object-fit: contain;
|
||
}
|
||
}
|
||
|
||
@media (max-width: 900px) {
|
||
.detail-fields-grid {
|
||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||
}
|
||
}
|
||
|
||
.weight-fee-panel {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 20px;
|
||
}
|
||
|
||
.weight-fee-block {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 12px;
|
||
}
|
||
|
||
.weight-fee-block-title {
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
color: var(--color-text-1);
|
||
}
|
||
|
||
.fee-summary--single {
|
||
grid-template-columns: minmax(0, 280px);
|
||
}
|
||
|
||
.weight-info {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 12px;
|
||
}
|
||
|
||
.weight-summary {
|
||
display: grid;
|
||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||
gap: 10px;
|
||
}
|
||
|
||
.weight-summary-card {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 4px;
|
||
padding: 10px 12px;
|
||
border: 1px solid var(--color-border-2);
|
||
border-radius: 6px;
|
||
background: var(--app-card-bg);
|
||
text-align: left;
|
||
cursor: pointer;
|
||
transition: border-color 0.2s, box-shadow 0.2s;
|
||
min-width: 0;
|
||
|
||
&:hover {
|
||
border-color: var(--app-primary-color, #2d8c8c);
|
||
}
|
||
|
||
&.active {
|
||
border-color: var(--app-primary-color, #2d8c8c);
|
||
box-shadow: 0 0 0 1px var(--app-primary-color, #2d8c8c);
|
||
}
|
||
|
||
&.forecast .weight-summary-value {
|
||
color: #165dff;
|
||
}
|
||
|
||
&.receive .weight-summary-value {
|
||
color: #ff7d00;
|
||
}
|
||
|
||
&.ship .weight-summary-value {
|
||
color: #00b42a;
|
||
}
|
||
|
||
&.downstream .weight-summary-value {
|
||
color: #722ed1;
|
||
}
|
||
}
|
||
|
||
.weight-summary-label {
|
||
font-size: 12px;
|
||
color: var(--color-text-3);
|
||
line-height: 20px;
|
||
}
|
||
|
||
.weight-summary-value {
|
||
font-size: 16px;
|
||
font-weight: 600;
|
||
line-height: 24px;
|
||
word-break: break-all;
|
||
}
|
||
|
||
.weight-summary-meta {
|
||
font-size: 12px;
|
||
color: var(--color-text-2);
|
||
line-height: 20px;
|
||
}
|
||
|
||
.weight-view-switch {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.weight-section {
|
||
border: 1px solid var(--color-border-2);
|
||
border-radius: 6px;
|
||
overflow: hidden;
|
||
background: var(--app-card-bg);
|
||
|
||
&.forecast .weight-section-dot {
|
||
background: #165dff;
|
||
}
|
||
|
||
&.receive .weight-section-dot {
|
||
background: #ff7d00;
|
||
}
|
||
|
||
&.ship .weight-section-dot {
|
||
background: #00b42a;
|
||
}
|
||
|
||
&.downstream .weight-section-dot {
|
||
background: #722ed1;
|
||
}
|
||
}
|
||
|
||
.weight-section-header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
padding: 10px 12px;
|
||
background: var(--color-fill-2);
|
||
border-bottom: 1px solid var(--color-border-2);
|
||
}
|
||
|
||
.weight-section-title-wrap {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.weight-section-dot {
|
||
width: 6px;
|
||
height: 6px;
|
||
border-radius: 50%;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.weight-section-title {
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
color: var(--color-text-1);
|
||
}
|
||
|
||
.weight-section-total {
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
color: var(--color-text-1);
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.weight-metrics-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||
gap: 12px;
|
||
padding: 12px;
|
||
}
|
||
|
||
.weight-metric-item {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 4px;
|
||
min-width: 0;
|
||
padding: 8px 10px;
|
||
border: 1px solid var(--color-border-2);
|
||
border-radius: 4px;
|
||
background: var(--color-fill-2);
|
||
|
||
&.highlight {
|
||
border-color: #b9f0c2;
|
||
background: #f6ffed;
|
||
}
|
||
}
|
||
|
||
.metric-label {
|
||
font-size: 12px;
|
||
color: var(--color-text-3);
|
||
line-height: 18px;
|
||
}
|
||
|
||
.metric-value-wrap {
|
||
min-height: 24px;
|
||
}
|
||
|
||
.metric-value {
|
||
font-size: 13px;
|
||
color: var(--color-text-1);
|
||
font-weight: 500;
|
||
font-variant-numeric: tabular-nums;
|
||
word-break: break-all;
|
||
|
||
&.metric-value-highlight {
|
||
color: #00b42a;
|
||
font-weight: 600;
|
||
}
|
||
}
|
||
|
||
.weight-section-empty {
|
||
padding: 16px 0;
|
||
}
|
||
|
||
.weight-empty-all {
|
||
margin-top: 8px;
|
||
}
|
||
|
||
@media (max-width: 900px) {
|
||
.weight-summary {
|
||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||
}
|
||
|
||
.weight-metrics-grid {
|
||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||
}
|
||
}
|
||
|
||
.fee-info {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 12px;
|
||
}
|
||
|
||
.fee-summary {
|
||
display: grid;
|
||
grid-template-columns: 1fr 1fr 1fr;
|
||
gap: 12px;
|
||
}
|
||
|
||
.fee-summary-card {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 4px;
|
||
padding: 12px 16px;
|
||
border: 1px solid var(--color-border-2);
|
||
border-radius: 6px;
|
||
background: var(--app-card-bg);
|
||
text-align: left;
|
||
cursor: pointer;
|
||
transition: border-color 0.2s, box-shadow 0.2s;
|
||
|
||
&:hover {
|
||
border-color: var(--app-primary-color, #2d8c8c);
|
||
}
|
||
|
||
&.active {
|
||
border-color: var(--app-primary-color, #2d8c8c);
|
||
box-shadow: 0 0 0 1px var(--app-primary-color, #2d8c8c);
|
||
}
|
||
|
||
&.receivable .fee-summary-amount {
|
||
color: #00b42a;
|
||
}
|
||
|
||
&.payable .fee-summary-amount {
|
||
color: #f53f3f;
|
||
}
|
||
|
||
&.gross-profit {
|
||
cursor: default;
|
||
|
||
&:hover {
|
||
border-color: var(--color-border-2);
|
||
}
|
||
|
||
.fee-summary-amount,
|
||
.fee-summary-meta {
|
||
color: #ff7d00;
|
||
}
|
||
}
|
||
}
|
||
|
||
.fee-profit-formula {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
padding: 10px 12px;
|
||
border: 1px dashed var(--color-border-2);
|
||
border-radius: 6px;
|
||
background: var(--color-fill-2);
|
||
font-size: 12px;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.fee-profit-formula-label {
|
||
color: var(--color-text-3);
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.fee-profit-formula-value {
|
||
display: flex;
|
||
align-items: center;
|
||
flex-wrap: wrap;
|
||
gap: 6px;
|
||
font-weight: 500;
|
||
color: var(--color-text-1);
|
||
}
|
||
|
||
.fee-profit-operator {
|
||
color: var(--color-text-3);
|
||
}
|
||
|
||
.fee-profit-result {
|
||
font-weight: 600;
|
||
color: #ff7d00;
|
||
}
|
||
|
||
.fee-summary-label {
|
||
font-size: 12px;
|
||
color: var(--color-text-3);
|
||
line-height: 20px;
|
||
}
|
||
|
||
.fee-summary-amount {
|
||
font-size: 18px;
|
||
font-weight: 600;
|
||
line-height: 26px;
|
||
word-break: break-all;
|
||
}
|
||
|
||
.fee-summary-meta {
|
||
font-size: 12px;
|
||
color: var(--color-text-2);
|
||
line-height: 20px;
|
||
}
|
||
|
||
.fee-summary-discount {
|
||
font-size: 12px;
|
||
color: #ff7d00;
|
||
line-height: 20px;
|
||
}
|
||
|
||
.fee-view-switch {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.fee-section {
|
||
border: 1px solid var(--color-border-2);
|
||
border-radius: 6px;
|
||
overflow: hidden;
|
||
background: var(--app-card-bg);
|
||
|
||
&.receivable {
|
||
.fee-section-dot {
|
||
background: #00b42a;
|
||
}
|
||
}
|
||
|
||
&.payable {
|
||
.fee-section-dot {
|
||
background: #f53f3f;
|
||
}
|
||
}
|
||
}
|
||
|
||
.fee-section-header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
padding: 10px 12px;
|
||
background: var(--color-fill-2);
|
||
border-bottom: 1px solid var(--color-border-2);
|
||
}
|
||
|
||
.fee-section-title-wrap {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.fee-section-dot {
|
||
width: 6px;
|
||
height: 6px;
|
||
border-radius: 50%;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.fee-section-title {
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
color: var(--color-text-1);
|
||
}
|
||
|
||
.fee-section-total {
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
color: var(--color-text-1);
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.fee-table-wrap {
|
||
max-height: 220px;
|
||
overflow: auto;
|
||
|
||
&::-webkit-scrollbar {
|
||
width: 6px;
|
||
height: 6px;
|
||
}
|
||
|
||
&::-webkit-scrollbar-thumb {
|
||
background: #c9cdd4;
|
||
border-radius: 3px;
|
||
}
|
||
}
|
||
|
||
.fee-table {
|
||
min-width: 100%;
|
||
|
||
.table-header,
|
||
.table-row {
|
||
display: grid;
|
||
grid-template-columns: 1.2fr 0.9fr 0.6fr 0.8fr 1fr 1fr 1.3fr;
|
||
align-items: center;
|
||
}
|
||
|
||
.table-header {
|
||
position: sticky;
|
||
top: 0;
|
||
z-index: 1;
|
||
background: var(--color-fill-2);
|
||
font-size: 12px;
|
||
font-weight: 500;
|
||
color: var(--color-text-3);
|
||
border-bottom: 1px solid var(--color-border-2);
|
||
}
|
||
|
||
.table-row {
|
||
font-size: 12px;
|
||
color: var(--color-text-2);
|
||
border-bottom: 1px solid var(--color-border-2);
|
||
|
||
&:last-child {
|
||
border-bottom: none;
|
||
}
|
||
|
||
&:hover {
|
||
background: var(--color-fill-2);
|
||
}
|
||
}
|
||
|
||
.header-cell,
|
||
.table-cell {
|
||
padding: 8px 12px;
|
||
min-width: 0;
|
||
word-break: break-all;
|
||
|
||
&.amount {
|
||
text-align: right;
|
||
}
|
||
|
||
&.priceEffectiveTime {
|
||
min-width: 152px;
|
||
white-space: nowrap;
|
||
word-break: normal;
|
||
}
|
||
}
|
||
|
||
.header-cell.amount {
|
||
text-align: right;
|
||
}
|
||
}
|
||
|
||
.fee-amount {
|
||
font-weight: 600;
|
||
font-variant-numeric: tabular-nums;
|
||
|
||
&.amount-receivable {
|
||
color: #00b42a;
|
||
}
|
||
|
||
&.amount-discount {
|
||
color: #ff7d00;
|
||
}
|
||
|
||
&.amount-payable {
|
||
color: #f53f3f;
|
||
}
|
||
}
|
||
|
||
.fee-section-empty {
|
||
padding: 16px 0;
|
||
}
|
||
|
||
.fee-empty-all {
|
||
margin-top: 8px;
|
||
}
|
||
|
||
.track-info {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 12px;
|
||
min-height: 200px;
|
||
}
|
||
|
||
.track-toolbar {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
padding: 10px 12px;
|
||
border: 1px solid var(--color-border-2);
|
||
border-radius: 6px;
|
||
background: var(--color-fill-2);
|
||
}
|
||
|
||
.track-toolbar-left {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.track-toolbar-label {
|
||
font-size: 12px;
|
||
color: var(--color-text-3);
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.track-toolbar-value {
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
color: var(--color-text-1);
|
||
word-break: break-all;
|
||
}
|
||
|
||
.track-toolbar-right {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.track-spin {
|
||
width: 100%;
|
||
min-height: 160px;
|
||
}
|
||
|
||
.track-empty {
|
||
padding: 24px 0;
|
||
}
|
||
|
||
.track-timeline {
|
||
padding: 4px 0 8px;
|
||
|
||
.track-item {
|
||
display: flex;
|
||
margin-bottom: 0;
|
||
|
||
&.active {
|
||
.track-status {
|
||
color: var(--app-primary-color, #2d8c8c);
|
||
}
|
||
|
||
.track-content {
|
||
color: var(--color-text-1);
|
||
}
|
||
}
|
||
|
||
.track-left {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
width: 16px;
|
||
margin-right: 14px;
|
||
flex-shrink: 0;
|
||
padding-top: 5px;
|
||
|
||
.track-dot {
|
||
width: 10px;
|
||
height: 10px;
|
||
border-radius: 50%;
|
||
background: var(--color-fill-3);
|
||
border: 2px solid var(--color-border-2);
|
||
box-sizing: border-box;
|
||
flex-shrink: 0;
|
||
|
||
&.active {
|
||
width: 12px;
|
||
height: 12px;
|
||
background: var(--app-primary-color, #2d8c8c);
|
||
border-color: color-mix(in srgb, var(--app-primary-color, #2d8c8c) 35%, #fff);
|
||
box-shadow: 0 0 0 3px color-mix(in srgb, var(--app-primary-color, #2d8c8c) 18%, transparent);
|
||
}
|
||
}
|
||
|
||
.track-line {
|
||
width: 2px;
|
||
flex: 1;
|
||
min-height: 18px;
|
||
background: var(--color-fill-3);
|
||
margin: 4px 0 0;
|
||
|
||
&.active {
|
||
background: color-mix(in srgb, var(--app-primary-color, #2d8c8c) 45%, var(--color-fill-3));
|
||
}
|
||
}
|
||
}
|
||
|
||
.track-right {
|
||
flex: 1;
|
||
min-width: 0;
|
||
padding-bottom: 18px;
|
||
}
|
||
|
||
.track-row-head {
|
||
display: flex;
|
||
align-items: center;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
}
|
||
|
||
.track-status {
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
color: var(--color-text-2);
|
||
line-height: 22px;
|
||
word-break: break-word;
|
||
}
|
||
|
||
.track-content {
|
||
margin-top: 4px;
|
||
font-size: 13px;
|
||
line-height: 20px;
|
||
color: var(--color-text-2);
|
||
word-break: break-word;
|
||
|
||
&--en {
|
||
margin-top: 2px;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
color: var(--color-text-3);
|
||
}
|
||
}
|
||
|
||
.track-meta-row {
|
||
display: flex;
|
||
align-items: center;
|
||
flex-wrap: wrap;
|
||
gap: 4px 10px;
|
||
margin-top: 6px;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
color: var(--color-text-3);
|
||
}
|
||
|
||
.track-meta-place {
|
||
color: var(--color-text-2);
|
||
}
|
||
|
||
.track-meta-code {
|
||
padding: 0 6px;
|
||
border-radius: 3px;
|
||
background: var(--color-fill-2);
|
||
color: var(--color-text-3);
|
||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||
font-size: 11px;
|
||
line-height: 18px;
|
||
}
|
||
|
||
.track-remark {
|
||
margin-top: 4px;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
color: var(--color-text-3);
|
||
word-break: break-word;
|
||
}
|
||
}
|
||
|
||
.track-item:last-child .track-right {
|
||
padding-bottom: 0;
|
||
}
|
||
}
|
||
|
||
.operation-log-spin {
|
||
width: 100%;
|
||
}
|
||
|
||
.operation-log-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 10px;
|
||
}
|
||
|
||
.operation-log-item {
|
||
border: 1px solid var(--color-border-2);
|
||
border-radius: 4px;
|
||
background: #fff;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.operation-log-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
padding: 10px 12px;
|
||
cursor: pointer;
|
||
user-select: none;
|
||
|
||
&:hover {
|
||
background: var(--color-fill-1);
|
||
}
|
||
}
|
||
|
||
.operation-log-head-main {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.operation-log-action {
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
color: var(--color-text-1);
|
||
}
|
||
|
||
.operation-log-head-meta {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
flex-shrink: 0;
|
||
font-size: 12px;
|
||
color: var(--color-text-3);
|
||
}
|
||
|
||
.operation-log-body {
|
||
padding: 0 12px 12px;
|
||
border-top: 1px solid var(--color-border-2);
|
||
}
|
||
|
||
.operation-log-remark {
|
||
margin: 10px 0 0;
|
||
font-size: 12px;
|
||
color: var(--color-text-3);
|
||
word-break: break-word;
|
||
}
|
||
|
||
.operation-log-changes {
|
||
margin-top: 10px;
|
||
border: 1px solid var(--color-border-2);
|
||
border-radius: 4px;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.operation-log-changes-header,
|
||
.operation-log-changes-row {
|
||
display: grid;
|
||
grid-template-columns: 1.1fr 1fr 1fr;
|
||
gap: 8px;
|
||
padding: 8px 10px;
|
||
font-size: 12px;
|
||
}
|
||
|
||
.operation-log-changes-header {
|
||
background: var(--color-fill-2);
|
||
color: var(--color-text-3);
|
||
font-weight: 500;
|
||
}
|
||
|
||
.operation-log-changes-row {
|
||
color: var(--color-text-2);
|
||
border-top: 1px solid var(--color-border-2);
|
||
word-break: break-all;
|
||
}
|
||
|
||
.operation-log-after {
|
||
color: var(--app-primary-color);
|
||
font-weight: 500;
|
||
}
|
||
</style>
|