WEB/src/views/order/waveOrder/component/WaveBatchDetailPanel.vue
liufumingren bf9bba5059 feat(order): 波次/订单新增「确认打印状态」「领料状态」,波次页支持扫码确认打印
波次:注册全局扫码事件(src/composables/useBarcodeScan.ts),长度超过 8 位的面单号提交 order.wave.confirmPrintScan 整波确认打印,切页/失活自动摘除监听;tab 区新增「确认打印未领单 N」角标,order.wave.confirmPrintUnclaimedWaveCount 长轮询实时刷新(离开页面停止、回到页面重新轮询);列表新增确认打印状态/领料状态筛选、列与明细展示

订单:列表补齐「确认打印状态」(confirm_print_status) 与「领料状态」(claim_status) 列;ScanBox 流程状态组新增两项筛选(待处理/待出库/待处理异常/配送订单);导出字段白名单新增「领料状态」「确认打印状态」(流程状态分组,52 → 54);claim_status 文案由「认领」统一为「领料」
2026-09-20 05:01:59 +08:00

282 lines
11 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="wave-batch-detail">
<div v-if="!row" class="empty-tip">请从上方列表中选择一项查看波次明细</div>
<template v-else>
<div class="section">
<div class="section-title">基础信息</div>
<el-descriptions :column="4" border size="small" class="detail-descriptions">
<el-descriptions-item label="波次编号">{{ getWaveCode(row) }}</el-descriptions-item>
<el-descriptions-item label="波次类型">
<span :class="getStatusTextClass('info')">{{ getWaveTypeText(row) }}</span>
</el-descriptions-item>
<el-descriptions-item label="波次状态">
<span :class="getStatusTextClass(getStatusTagType(row))">{{ getStatusText(row) }}</span>
</el-descriptions-item>
<el-descriptions-item label="仓库ID">{{ row.warehouse_id ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="总订单数">{{ row.total_orders ?? getOrderCount(row) }}</el-descriptions-item>
<el-descriptions-item label="订单数量">{{ getOrderCount(row) }}</el-descriptions-item>
<el-descriptions-item label="已处理订单">{{ getProcessedOrders(row) }}</el-descriptions-item>
<el-descriptions-item label="快递编码">{{ row.logistics_code || '—' }}</el-descriptions-item>
<el-descriptions-item label="快递">{{ row.logistics_name || '—' }}</el-descriptions-item>
<el-descriptions-item label="区分快递">
<span :class="getStatusTextClass(Number(row?.distinguish_express) ? 'warning' : 'info')">
{{ Number(row?.distinguish_express) ? '是' : '否' }}
</span>
</el-descriptions-item>
<el-descriptions-item label="来源">
<span :class="getStatusTextClass(getWaveSourceTagType(row.source))">
{{ formatWaveSource(row.source) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="创建人">{{ row.creator || row.creator_name || '—' }}</el-descriptions-item>
<el-descriptions-item label="商品类型" :span="2">{{ row.item_part_type || '—' }}</el-descriptions-item>
<el-descriptions-item label="商品部位" :span="2">{{ row.item_part || '—' }}</el-descriptions-item>
<el-descriptions-item label="商品结构" :span="4">{{ row.item_detail_machine || row.item_detail || '—' }}</el-descriptions-item>
</el-descriptions>
</div>
<div class="section">
<div class="section-title">分配状态</div>
<el-descriptions :column="3" border size="small" class="detail-descriptions">
<el-descriptions-item label="库位分配状态">
<span :class="getStatusTextClass(getWaveAssignmentAggregateTagType(getStorageAssignmentStatusText(row)))">
{{ getStorageAssignmentStatusText(row) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="快递分配状态">
<span :class="getStatusTextClass(getWaveAssignmentAggregateTagType(row.express_assignment_status))">
{{ formatWaveExpressAssignmentStatusLabel(row.express_assignment_status) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="打印分配状态">
<span :class="getStatusTextClass(getWaveAssignmentAggregateTagType(row.print_assignment_status))">
{{ formatWavePrintAssignmentStatusLabel(row.print_assignment_status) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="确认打印状态">
<span :class="getStatusTextClass(getWaveAssignmentAggregateTagType(row.confirm_print_assignment_status))">
{{ formatWaveConfirmPrintAssignmentStatusLabel(row.confirm_print_assignment_status) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="领料状态">
<span :class="getStatusTextClass(getWaveAssignmentAggregateTagType(row.claim_assignment_status))">
{{ formatWaveClaimAssignmentStatusLabel(row.claim_assignment_status) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="拣货状态">
<span :class="getStatusTextClass(getWaveAssignmentAggregateTagType(row.pick_assignment_status))">
{{ formatWavePickAssignmentStatusLabel(row.pick_assignment_status) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="复核状态">
<span :class="getStatusTextClass(getWaveAssignmentAggregateTagType(row.review_assignment_status))">
{{ formatWaveReviewAssignmentStatusLabel(row.review_assignment_status) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="同步状态">
<span :class="getStatusTextClass(getWaveAssignmentAggregateTagType(row.sync_assignment_status))">
{{ formatWaveSyncAssignmentStatusLabel(row.sync_assignment_status) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="未复核订单数">{{ row.unreviewed_order_count ?? '—' }}</el-descriptions-item>
</el-descriptions>
</div>
<div class="section">
<div class="section-title">时间信息</div>
<el-descriptions :column="2" border size="small" class="detail-descriptions">
<el-descriptions-item label="创建时间">{{ formatDateTime(row.create_time || row.created_at || row.create_at) }}</el-descriptions-item>
<el-descriptions-item label="更新时间">{{ formatDateTime(row.update_time || row.updated_at || row.update_at) }}</el-descriptions-item>
</el-descriptions>
</div>
<div v-if="parsedItems.length" class="section">
<div class="section-title">商品结构快照</div>
<el-table :data="parsedItems" border size="small" class="snapshot-table">
<el-table-column prop="sku" label="SKU" min-width="100" />
<el-table-column prop="barcode" label="条码" min-width="130" />
<el-table-column prop="name" label="商品名称" min-width="120" show-overflow-tooltip />
<el-table-column prop="quantity" label="数量" width="80" align="center" />
</el-table>
</div>
</template>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import {
waveStatusTextMap,
waveStorageAssignmentStatusTextMap,
waveTypeTextMap,
formatWaveExpressAssignmentStatusLabel,
formatWavePickAssignmentStatusLabel,
formatWavePrintAssignmentStatusLabel,
formatWaveConfirmPrintAssignmentStatusLabel,
formatWaveClaimAssignmentStatusLabel,
formatWaveReviewAssignmentStatusLabel,
formatWaveSyncAssignmentStatusLabel,
formatWaveSource,
getWaveAssignmentAggregateTagType,
getWaveSourceTagType
} from '../config/wave-config'
const props = defineProps<{
row: Record<string, any> | null
}>()
interface SnapshotItem {
sku: string
barcode: string
name: string
quantity: string
}
/** 解析 item_snapshot_key 字段,按 "::" 分隔字段、"|" 分隔商品 */
function parseItemSnapshotKey(raw: string | undefined | null): SnapshotItem[] {
if (!raw || !raw.trim()) return []
// 特殊值:非标准快照格式,直接跳过
if (raw === 'manual_single_ids') return []
const items = raw.split('|')
const result: SnapshotItem[] = []
for (const item of items) {
const parts = item.split('::')
if (parts.length < 5) continue
result.push({
sku: parts[0] || '—',
barcode: parts[1] || '—',
name: parts[2] || '—',
quantity: parts[4] || '—'
})
}
return result
}
const parsedItems = computed<SnapshotItem[]>(() => {
const raw = (props.row as any)?.item_snapshot_key
return parseItemSnapshotKey(raw)
})
function getWaveCode(row: any) {
return row?.wave_code || row?.batch_code || row?.wave_no || row?.batch_no || row?.code || row?.id || '—'
}
function getStatusValue(row: any) {
return row?.status ?? row?.wave_status ?? row?.batch_status
}
function getStatusText(row: any) {
const value = getStatusValue(row)
return waveStatusTextMap[String(value)] || (value ?? '—')
}
function getStatusTagType(row: any) {
const value = String(getStatusValue(row) ?? '')
if (value === '-1' || value === 'cancelled') return 'danger'
if (value === '0' || value === 'pending') return 'warning'
if (value === '1' || value === '2' || value === 'assigned') return 'success'
if (value === '3' || value === '4') return 'primary'
if (value === '5' || value === '6') return 'info'
return 'info'
}
function getWaveTypeText(row: any) {
const value = String(row?.wave_type ?? '')
return waveTypeTextMap[value] || (value || '—')
}
function getOrderCount(row: any) {
return row?.order_count ?? row?.total_orders ?? row?.total_order_count ?? row?.orders_count ?? row?.count ?? 0
}
function getProcessedOrders(row: any) {
return row?.processed_orders ?? row?.done_orders ?? 0
}
function getStorageAssignmentStatusText(row: any) {
const rawValue = row?.storage_assignment_status
const text = String(rawValue ?? '').trim()
if (!text) return '—'
const normalized = text.toLowerCase()
if (waveStorageAssignmentStatusTextMap[normalized] !== undefined) {
return waveStorageAssignmentStatusTextMap[normalized]
}
return text
}
function formatDateTime(value: string | number | null | undefined) {
if (!value) return '—'
let normalizedValue: string | number = value
if (typeof value === 'string' && /^\d+$/.test(value.trim())) {
const numericValue = Number(value.trim())
normalizedValue = value.trim().length <= 10 ? numericValue * 1000 : numericValue
} else if (typeof value === 'number' && Number.isFinite(value) && value > 0 && value < 1000000000000) {
normalizedValue = value * 1000
}
const date = new Date(normalizedValue)
if (Number.isNaN(date.getTime())) return String(value)
const y = date.getFullYear()
const m = String(date.getMonth() + 1).padStart(2, '0')
const d = String(date.getDate()).padStart(2, '0')
const hh = String(date.getHours()).padStart(2, '0')
const mm = String(date.getMinutes()).padStart(2, '0')
const ss = String(date.getSeconds()).padStart(2, '0')
return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
}
</script>
<style scoped lang="scss">
@use "../../orderManagement/styles/order-sub.scss";
/* 面板自带内边距(宿主 .detail-container 已改为 padding: 0 10px),
分区标题 / label 样式对齐 stock/external_stock「基本信息」新设计 */
.wave-batch-detail {
height: 100%;
overflow-y: auto;
padding: 6px 10px 8px;
box-sizing: border-box;
}
.section {
margin-bottom: 12px;
&:last-child {
margin-bottom: 0;
}
}
.section-title {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 10px;
padding-left: 8px;
border-left: 3px solid #409eff;
line-height: 1.4;
}
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 110px;
min-width: 110px;
background: #fafbfc;
font-weight: 500;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
.empty-tip {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
font-size: 13px;
}
</style>