This commit is contained in:
yin 2026-06-25 18:12:26 +08:00
parent bf0eba0f3d
commit 84daac9220
31 changed files with 2822 additions and 571 deletions

Binary file not shown.

View File

@ -24,8 +24,39 @@ export const DEFAULT_AUTO_OUTBOUND_RULES: Required<SettingWarehouseAutoOutboundR
require_pick: true
}
/** 仓库默认发件人/地址(subject_config 内,文档默认空字符串) */
export type SettingWarehouseSenderConfig = {
sender_name?: string
sender_tel?: string
province_name?: string
city_name?: string
district_name?: string
town_name?: string
address?: string
}
export const WAREHOUSE_SENDER_FIELD_KEYS = [
'sender_name',
'sender_tel',
'province_name',
'city_name',
'district_name',
'town_name',
'address'
] as const
export const DEFAULT_WAREHOUSE_SENDER_FIELDS: Required<SettingWarehouseSenderConfig> = {
sender_name: '',
sender_tel: '',
province_name: '',
city_name: '',
district_name: '',
town_name: '',
address: ''
}
/** 与 module setting.warehouse 文档 subject_config 对齐 */
export type SettingWarehouseSubjectConfig = {
export type SettingWarehouseSubjectConfig = SettingWarehouseSenderConfig & {
enable_external_express_code?: boolean
auto_outbound_rules?: SettingWarehouseAutoOutboundRules
max_wave_quantity?: number
@ -82,6 +113,12 @@ export function normalizeWarehouseSubjectConfig(
)
} as SettingWarehouseAutoOutboundRules
for (const key of WAREHOUSE_SENDER_FIELD_KEYS) {
if (typeof base[key] !== 'string') {
base[key] = DEFAULT_WAREHOUSE_SENDER_FIELDS[key]
}
}
return base as SettingWarehouseSubjectConfig
}

View File

@ -8,7 +8,15 @@ export type StorageEntryListPagination = {
pageSize?: number
}
export type StorageEntryListWhere = Record<string, unknown>
export type StorageEntryListWhere = Record<string, unknown> & {
/** 虚拟字段:true 仅已绑定收货单,false 仅未绑定 */
hasReceiving?: boolean
}
export type StorageEntryListItem = Record<string, unknown> & {
hasReceiving?: boolean
receivingBindings?: EntryOrderReceivingBinding[]
}
export type StorageEntryListSort = {
sortField?: string
@ -24,7 +32,7 @@ export type StorageEntryListParams = {
export type StorageEntryListResponse = {
code?: number
message?: string
list?: Record<string, unknown>[]
list?: StorageEntryListItem[]
pagination?: {
page?: number
pageSize?: number
@ -74,6 +82,25 @@ export type EntryDetailBinding = {
[key: string]: unknown
}
export type EntryAvailableReceivingDetail = {
receiving_detail_id?: number
receiving_id?: number
receiving_number?: string
product_name?: string
actual_quantity?: number
stored_quantity?: number
allocated_quantity?: number
receiving_allocated?: number
available_quantity?: number
binding_id?: number
binding_status?: string
status?: string
batch_number?: string
production_date?: string
expiry_date?: string
[key: string]: unknown
}
export type EntryDetailItemBarcode = {
id?: number
barcode?: string
@ -107,6 +134,8 @@ export type EntryDetailItem = {
total_planned?: number
/** pending 绑定列表 */
bindings?: EntryDetailBinding[]
/** 可绑定/已绑定的收货明细(含可用量) */
available_receiving_details?: EntryAvailableReceivingDetail[]
[key: string]: unknown
}
@ -233,6 +262,55 @@ export function detailChange(data:any): Promise<any> {
return Promise.reject(new Error('storage.entry.detailChange 已下线,入库单明细不再对外编辑'))
}
export type BindReceivingParams = {
/** 入库单ID */
entry_order_id: number
/** 要绑定的收货单ID列表 */
receiving_ids: number[]
}
export type BindReceivingSuccessItem = {
receiving_id?: number
receiving_number?: string
[key: string]: unknown
}
export type BindReceivingFailedItem = {
receiving_id?: number
error_code?: string
message?: string
[key: string]: unknown
}
export type BindReceivingResponse = {
code?: number
message?: string
success?: BindReceivingSuccessItem[]
failed?: BindReceivingFailedItem[]
success_count?: number
failed_count?: number
data?: {
success?: BindReceivingSuccessItem[]
failed?: BindReceivingFailedItem[]
success_count?: number
failed_count?: number
}
}
/** 将收货单绑定到入库单(主表级关联) */
export function bindReceiving(data: BindReceivingParams): Promise<BindReceivingResponse> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.entry.bindReceiving',
v,
timestamp: new Date().getTime()
},
data
})
}
export type BindReceivingDetailsBinding = {
entry_item_id: number
receiving_detail_id: number
@ -621,6 +699,7 @@ export type ReceivingCompareRow = {
receiving_quantity?: number
actual_quantity?: number
box_quantity?: number
receiving_allocated?: number
match_status?: ReceivingCompareMatchStatus
[key: string]: unknown
}
@ -665,6 +744,7 @@ export type ReceivingCompareResponse = {
receiving_id?: number
receiving_number?: string
comparison?: ReceivingCompareRow[]
entry_only?: ReceivingCompareRow[]
receiving_only?: ReceivingCompareRow[]
summary?: ReceivingCompareSummary
data?: Partial<Omit<ReceivingCompareResponse, 'data'>>

View File

@ -69,8 +69,8 @@
:sort-orders="column.sortOrders"
:resizable="column.resizable"
:show-overflow-tooltip="column.showOverflowTooltip !== false"
:align="column.align || 'left'"
:header-align="column.headerAlign || column.align || 'left'"
:align="column.align || defaultAlign"
:header-align="column.headerAlign || column.align || defaultAlign"
:class-name="column.className"
:label-class-name="column.labelClassName"
:filters="column.filters"
@ -85,7 +85,36 @@
</template>
<template v-else>
<slot :name="`column-${column.prop}`" :row="scope.row" :index="scope.$index">
<template v-if="column.formatter">
<template v-if="column.copyAction">
<div v-if="getCopyActionCodes(scope.row, column).length" class="click-copy-list">
<template
v-for="(code, codeIndex) in getVisibleCopyActionCodes(scope.row, column)"
:key="`${getMultiCopyCellKey(scope.row, column)}-${codeIndex}-${code}`"
>
<span
class="click-copy-link"
role="button"
tabindex="0"
:title="getCopyActionTitle(column)"
@click.stop="handleCopyActionClick(code, column)"
@keydown.enter.prevent="handleCopyActionClick(code, column)"
>
{{ code }}
</span>
</template>
<button
v-if="shouldShowCopyCollapseToggle(scope.row, column)"
type="button"
class="click-copy-toggle"
:title="isCopyCellExpanded(scope.row, column) ? '收起' : '展开查看全部'"
@click.stop="toggleCopyCellExpand(scope.row, column)"
>
{{ isCopyCellExpanded(scope.row, column) ? '收起' : `+${getHiddenCopyActionCount(scope.row, column)}` }}
</button>
</div>
<span v-else style="color:#909399">—</span>
</template>
<template v-else-if="column.formatter">
<span v-html="column.formatter(scope.row, scope.column, scope.row[scope.column.property], scope.$index)"></span>
</template>
<template v-else-if="column.prop === 'order_flag'">
@ -305,6 +334,8 @@
<el-button @click="columnConfigDialogVisible = false">关闭</el-button>
</template>
</el-dialog>
<qrcode-dialog v-model:visible="waybillQrVisible" :code="waybillQrCode" />
</div>
</template>
@ -314,6 +345,7 @@ import { Box } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import type { UploadFile } from 'element-plus'
import { useUserStore } from '@/stores/modules/user'
import QrcodeDialog from '@/components/QR/qrcode.vue'
defineOptions({
name: 'UpperTable'
@ -476,6 +508,11 @@ const props = defineProps({
type: Number,
default: 12,
},
defaultAlign: {
type: String,
default: 'left',
validator: (value: string) => ['left', 'center', 'right'].includes(value),
},
})
const emit = defineEmits([
@ -545,6 +582,9 @@ const virtualScrollTop = ref(0)
const virtualViewportHeight = ref(0)
const dragAutoScrollStep = ref(0)
let dragAutoScrollRaf: number | null = null
const waybillQrVisible = ref(false)
const waybillQrCode = ref('')
const expandedMultiCopyCells = ref<Set<string>>(new Set())
type VirtualSpacerRow = {
__virtualSpacer: true
@ -766,6 +806,7 @@ const selectedCount = computed(() => {
// Watchers
watch(() => props.data, () => {
clearSelection()
expandedMultiCopyCells.value = new Set()
syncVirtualViewport()
}, { deep: true })
@ -890,6 +931,150 @@ function rebuildColumnConfig() {
}
}
function resolveCopyRawValue(row: any, column: ColumnItem): unknown {
if (typeof column.copyValue === 'function') {
return column.copyValue(row)
}
if (Array.isArray(column.copyValueKeys) && column.copyValueKeys.length) {
for (const key of column.copyValueKeys) {
const val = row?.[key]
const text = getCopyableCellText(val)
if (text) return text
}
return ''
}
return row?.[column.prop || '']
}
function getCopyActionCodes(row: any, column: ColumnItem): string[] {
if (typeof column.copyValue === 'function') {
const result = column.copyValue(row)
if (Array.isArray(result)) {
return result.map((item) => String(item ?? '').trim()).filter(Boolean)
}
const text = getCopyableCellText(result)
return text ? [text] : []
}
const raw = resolveCopyRawValue(row, column)
if (column.copyAction === 'copy') {
const text = getCopyableCellText(raw)
return text ? [text] : []
}
return parseMultiValueCodes(raw)
}
function getCopyActionTitle(column: ColumnItem) {
if (column.copyAction === 'copyQr') return '点击复制并查看快递单号二维码'
return `点击复制${column.label || ''}`
}
async function handleCopyActionClick(code: string, column: ColumnItem) {
const label = String(column.label || '内容').trim() || '内容'
await copyCellText(code, label)
if (column.copyAction === 'copyQr') {
waybillQrCode.value = code
waybillQrVisible.value = true
}
}
function isCopyMultiCollapseEnabled(column: ColumnItem) {
return column.copyMultiCollapse !== false
}
function getMultiCopyCellKey(row: any, column: ColumnItem) {
return `${String(getRowKey(row))}::${String(column.prop || '')}`
}
function isCopyCellExpanded(row: any, column: ColumnItem) {
return expandedMultiCopyCells.value.has(getMultiCopyCellKey(row, column))
}
function toggleCopyCellExpand(row: any, column: ColumnItem) {
const key = getMultiCopyCellKey(row, column)
const next = new Set(expandedMultiCopyCells.value)
if (next.has(key)) {
next.delete(key)
} else {
next.add(key)
}
expandedMultiCopyCells.value = next
}
function getHiddenCopyActionCount(row: any, column: ColumnItem) {
const total = getCopyActionCodes(row, column).length
return Math.max(0, total - 1)
}
function shouldShowCopyCollapseToggle(row: any, column: ColumnItem) {
if (!isCopyMultiCollapseEnabled(column)) return false
return getCopyActionCodes(row, column).length > 1
}
function getVisibleCopyActionCodes(row: any, column: ColumnItem) {
const codes = getCopyActionCodes(row, column)
if (codes.length <= 1 || !isCopyMultiCollapseEnabled(column)) return codes
if (isCopyCellExpanded(row, column)) return codes
return codes.slice(0, 1)
}
function getCopyableCellText(value: unknown) {
if (value === undefined || value === null) return ''
return String(value).trim()
}
function parseMultiValueCodes(raw: unknown): string[] {
if (Array.isArray(raw)) {
return raw.map((item) => String(item ?? '').trim()).filter(Boolean)
}
const text = String(raw ?? '').trim()
if (!text) return []
if (text.startsWith('[') && text.endsWith(']')) {
try {
const parsed = JSON.parse(text)
if (Array.isArray(parsed)) {
return parsed.map((item) => String(item ?? '').trim()).filter(Boolean)
}
} catch {
// ignore invalid json
}
}
if (text.includes(',')) {
return text.split(',').map((item) => item.trim()).filter(Boolean)
}
return [text]
}
async function copyCellText(value: unknown, label: string) {
const text = getCopyableCellText(value)
if (!text) {
ElMessage.warning(`当前行无${label}可复制`)
return
}
try {
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(text)
} else {
throw new Error('no clipboard api')
}
ElMessage.success(`${label}已复制到剪贴板`)
} catch {
try {
const textarea = document.createElement('textarea')
textarea.value = text
textarea.setAttribute('readonly', 'readonly')
textarea.style.position = 'fixed'
textarea.style.left = '-9999px'
document.body.appendChild(textarea)
textarea.select()
document.execCommand('copy')
document.body.removeChild(textarea)
ElMessage.success(`${label}已复制到剪贴板`)
} catch {
ElMessage.error('复制失败,请手动复制')
}
}
}
function getDefaultCellTextClass(prop: string | undefined, value: unknown) {
if (prop === 'order_flag' && value !== undefined && value !== null && String(value).trim() !== '') {
return 'order-flag-text order-flag-copyable'
@ -1889,6 +2074,54 @@ watch(
cursor: pointer;
}
.click-copy-list {
display: flex;
flex-direction: column;
gap: 2px;
align-items: center;
width: 100%;
}
.click-copy-toggle {
border: none;
background: none;
padding: 0;
margin: 0;
color: var(--el-text-color-secondary);
font-size: 12px;
line-height: 1.4;
cursor: pointer;
flex-shrink: 0;
&:hover {
color: var(--el-color-primary);
}
&:focus-visible {
outline: 2px solid var(--el-color-primary-light-3);
outline-offset: 2px;
border-radius: 2px;
}
}
.click-copy-link {
color: var(--el-color-primary);
cursor: pointer;
word-break: break-all;
line-height: 1.4;
max-width: 100%;
&:hover {
color: var(--el-color-primary-dark-2);
}
&:focus-visible {
outline: 2px solid var(--el-color-primary-light-3);
outline-offset: 2px;
border-radius: 2px;
}
}
/* 表格尺寸样式 */
.upper-table-container.small :deep(.el-table) {
font-size: 12px;

View File

@ -36,6 +36,7 @@
<upper-table
ref="upperTable"
title="归档订单列表"
default-align="center"
:enable-column-config="true"
table-id="order-management-archive-order"
:data="list"

View File

@ -3,8 +3,8 @@
<template v-if="orderId">
<div class="toolbar">
<el-button size="small" :loading="loading" @click="loadDetail">刷新运单</el-button>
<el-button size="small" type="primary" plain @click="openQuickBindDialog">按运单绑定包材</el-button>
<el-tag v-if="waybillCodesText" size="small" type="info">运单汇总:{{ waybillCodesText }}</el-tag>
<!-- <el-button size="small" type="primary" plain @click="openQuickBindDialog">按运单绑定包材</el-button> -->
<!-- <el-tag v-if="waybillCodesText" size="small" type="info">运单汇总:{{ waybillCodesText }}</el-tag> -->
</div>
<el-table :data="expressRows" border stripe size="small" empty-text="暂无运单信息">

View File

@ -227,8 +227,6 @@ onBeforeUnmount(() => {
<style scoped lang="scss">
.pending-order-detail {
height: 100%;
overflow-y: auto;
padding: 10px;
box-sizing: border-box;
}
@ -245,6 +243,17 @@ onBeforeUnmount(() => {
}
.detail-descriptions {
width: 100%;
:deep(.el-descriptions__body) {
width: 100%;
}
:deep(.el-descriptions__table) {
table-layout: fixed;
width: 100%;
}
:deep(.el-descriptions__label) {
width: 110px;
min-width: 110px;
@ -252,6 +261,7 @@ onBeforeUnmount(() => {
:deep(.el-descriptions__content) {
word-break: break-word;
min-width: 0;
}
}

View File

@ -107,7 +107,8 @@ export const COMMON_TRANSLATIONS: Record<string, Record<string, string>> = {
},
recheck_status: {
'none': '未复核',
'fin': '已复核'
'fin': '已复核',
'error': '错误'
},
lock_status: {
none: '未锁定',
@ -218,7 +219,8 @@ export const COMMON_TAG_TYPES: Record<string, Record<string, string>> = {
},
recheck_status: {
'none': 'info',
'fin': 'success'
'fin': 'success',
'error': 'danger'
},
lock_status: {
none: 'info',
@ -329,7 +331,7 @@ export const ORDER_TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
allocateExpress: { key: 'allocateExpress', label: '分配快递号', size: 'small', type: 'success', loadingKey: 'allocateLoading', disabledKey: 'hasNoSelection', action: 'openAllocateExpressDialog' },
batchQuickRecheck: {
key: 'batchQuickRecheck',
label: '批量复核',
label: '批量发货',
size: 'small',
type: 'success',
plain: true,
@ -716,10 +718,10 @@ export const pendingOrderDetailSections: OrderDetailSectionConfig[] = [
{ prop: 'step', label: '流程步骤' },
{ prop: 'sync_status', label: '同步状态', tag: true },
{ prop: 'inspection_status', label: '审核状态', tag: true },
{ prop: 'recheck_status', label: '复核', tag: true },
{ prop: 'recheck_status', label: '复核状态', tag: true },
{ prop: 'outbound_status', label: '出库状态', tag: true },
{ prop: 'storage_status', label: '储位', tag: true },
{ prop: 'post_status', label: '快递', tag: true },
{ prop: 'storage_status', label: '储位状态', tag: true },
{ prop: 'post_status', label: '快递状态', tag: true },
{ prop: 'pick_status', label: '拣货状态', tag: true },
{ prop: 'pack_status', label: '打包状态', tag: true },
{ prop: 'print_status', label: '打印状态', tag: true },
@ -799,6 +801,7 @@ export const orderDetailCompactSections: OrderDetailSectionConfig[] = [
{ prop: 'status', label: '订单状态', tag: true },
{ prop: 'source_order_codes', label: '平台交易单号' },
{ prop: 'is_urgency', label: '是否紧急', tag: true },
{ prop: 'seller_nick', label: '卖家昵称' },
{ prop: 'order_flag', label: '订单标记', span: 3, multiline: true }
]
},
@ -808,14 +811,16 @@ export const orderDetailCompactSections: OrderDetailSectionConfig[] = [
fields: [
{ prop: 'sync_status', label: '同步状态', tag: true },
{ prop: 'inspection_status', label: '审核状态', tag: true },
{ prop: 'recheck_status', label: '复核', tag: true },
{ prop: 'storage_status', label: '储位', tag: true },
{ prop: 'post_status', label: '快递', tag: true },
{ prop: 'recheck_status', label: '复核状态', tag: true },
{ prop: 'storage_status', label: '储位状态', tag: true },
{ prop: 'post_status', label: '快递状态', tag: true },
{ prop: 'outbound_status', label: '出库状态', tag: true },
{ prop: 'wave_no', label: '波次号' },
{ prop: 'pick_status', label: '拣货状态', tag: true },
{ prop: 'pack_status', label: '打包状态', tag: true },
{ prop: 'print_status', label: '打印状态', tag: true }
{ prop: 'print_status', label: '打印状态', tag: true },
{ prop: 'intercept_status', label: '拦截状态', tag: true },
{ prop: 'lock_status', label: '锁定状态', tag: true }
]
},
{
@ -834,7 +839,7 @@ export const orderDetailCompactSections: OrderDetailSectionConfig[] = [
},
{
title: '金额汇总',
column: 4,
column: 3,
fields: [
{ prop: 'total_amount', label: '订单总金额', amount: true },
{ prop: 'item_amount', label: '商品金额', amount: true },
@ -846,12 +851,14 @@ export const orderDetailCompactSections: OrderDetailSectionConfig[] = [
},
{
title: '时间信息',
column: 4,
column: 3,
fields: [
{ prop: 'place_order_time', label: '下单时间', time: true },
{ prop: 'pay_time', label: '支付时间', time: true },
{ prop: 'delivery_time', label: '配送时间', time: true },
{ prop: 'create_at', label: '创建时间', time: true },
{ prop: 'updated_at', label: '更新时间', time: true }
{ prop: 'updated_at', label: '更新时间', time: true },
{ prop: 'recheck_time', label: '复核时间', time: true }
]
}
]
@ -934,7 +941,7 @@ export const simpleListToolbarButtons = pickToolbarButtons(simpleListToolbarButt
/** ScanBox 筛选字段分组:基础信息 + 工作流程(工作流程字段以 label 为分组名) */
export const SCAN_BASIC_INFO_GROUP = '订单基础信息'
export const SCAN_BASIC_INFO_GROUP = '基础信息'
/** 为 ScanBox 基础信息字段附加分组标签 */
export function scanBasicField(field: Record<string, any>) {
@ -960,6 +967,7 @@ export const buyerMessageHasFilterOptions = [
export const syncStatusFilterOptionsBasic = [
{ label: '待同步', value: 'padding' },
{ label: '已同步', value: 'fin' },
{ label: '错误', value: 'error' },
]
export const syncStatusFilterOptionsExtended = [
@ -973,12 +981,14 @@ export const storageStatusFilterOptions = [
{ label: '未分配', value: 'none' },
// { label: '分配中', value: 'padding' },
{ label: '已完成', value: 'fin' },
{ label: '错误', value: 'error' },
]
export const postStatusFilterOptions = [
{ label: '未分配', value: 'none' },
// { label: '分配中', value: 'padding' },
{ label: '已分配', value: 'fin' },
{ label: '错误', value: 'error' },
]
export const postStatusFilterOptionsExtended = [
@ -990,17 +1000,20 @@ export const pickStatusFilterOptions = [
{ label: '未拣货', value: 'none' },
// { label: '拣货中', value: 'padding' },
{ label: '已完成', value: 'fin' },
{ label: '错误', value: 'error' },
]
export const packStatusFilterOptions = [
{ label: '未打包', value: 'none' },
// { label: '打包中', value: 'padding' },
{ label: '已完成', value: 'fin' },
{ label: '错误', value: 'error' },
]
export const printStatusFilterOptions = [
{ label: '未打印', value: 'none' },
{ label: '已完成', value: 'fin' },
{ label: '错误', value: 'error' },
]
export const outboundStatusFilterOptions = [
@ -1025,6 +1038,8 @@ export const pendingOrderStatusFilterOptions = [
{ label: '已归档', value: 'archived' },
]
/** 待审核与待处理等页面不共用订单状态筛选项 */
export const reviewOrderStatusFilterOptions = [
{ label: '待审核', value: 'pedding' },
{ label: '已创建', value: 'created' },
@ -1047,7 +1062,27 @@ export const archiveOrderStatusFilterOptions = [
export const recheckStatusFilterOptions = [
{ label: '未复核', value: 'none' },
{ label: '已复核', value: 'fin' }
{ label: '已复核', value: 'fin' },
{ label: '错误', value: 'error' },
]
export const inspectionStatusFilterOptions = [
{ label: '未审核', value: 'none' },
{ label: '待审核', value: 'pending' },
{ label: '审核中', value: 'padding' },
{ label: '审核通过', value: 'fin' },
{ label: '审核驳回', value: 'reject' },
{ label: '审核异常', value: 'error' },
]
export const claimStatusFilterOptions = [
{ label: '未认领', value: 'none' },
{ label: '已认领', value: 'fin' },
]
export const lockStatusFilterOptions = [
{ label: '未锁定', value: 'none' },
{ label: '仓库锁定', value: 'warehouse' },
]
/** 单号类字段:支持 IN(逗号分隔)批量查询 */
@ -1059,6 +1094,7 @@ export const orderIdScanField = scanBasicField({ label: '订单ID', value: 'id',
export const orderFlagScanField = scanBasicField({ label: '订单标记', value: 'order_flag', type: 'text', operators: ['like', 'notlike'], defaultOperator: 'like' })
export const waveNoScanField = scanBasicField({ label: '波次号', value: 'wave_no', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
export const deliveryOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'delivery_order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
export const sourceOrderCodesScanField = scanBasicField({ label: '平台交易单号', value: 'source_order_codes', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
export const pendingOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
export const exceptionOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
export const shopNickScanField = scanBasicField({ label: '店铺名称', value: 'shop_nick', type: 'text' })
@ -1085,13 +1121,16 @@ export const buyerMessageScanField = scanBasicField({ label: '买家留言', val
export const orderStatusScanField = (options: Array<{ label: string; value: string }>) =>
scanWorkflowField({ label: '订单状态', value: 'status', type: 'select', options })
export const syncStatusScanField = scanWorkflowField({ label: '同步状态', value: 'sync_status', type: 'select', options: syncStatusFilterOptionsBasic })
export const recheckStatusScanField = scanWorkflowField({ label: '复核', value: 'recheck_status', type: 'select', options: recheckStatusFilterOptions })
export const storageStatusScanField = scanWorkflowField({ label: '储位', value: 'storage_status', type: 'select', options: storageStatusFilterOptions })
export const postStatusScanField = scanWorkflowField({ label: '快递', value: 'post_status', type: 'select', options: postStatusFilterOptions })
export const inspectionStatusScanField = scanWorkflowField({ label: '审核状态', value: 'inspection_status', type: 'select', options: inspectionStatusFilterOptions })
export const recheckStatusScanField = scanWorkflowField({ label: '复核状态', value: 'recheck_status', type: 'select', options: recheckStatusFilterOptions })
export const storageStatusScanField = scanWorkflowField({ label: '储位状态', value: 'storage_status', type: 'select', options: storageStatusFilterOptions })
export const postStatusScanField = scanWorkflowField({ label: '快递状态', value: 'post_status', type: 'select', options: postStatusFilterOptions })
export const pickStatusScanField = scanWorkflowField({ label: '拣货状态', value: 'pick_status', type: 'select', options: pickStatusFilterOptions })
export const packStatusScanField = scanWorkflowField({ label: '打包状态', value: 'pack_status', type: 'select', options: packStatusFilterOptions })
export const printStatusScanField = scanWorkflowField({ label: '打印状态', value: 'print_status', type: 'select', options: printStatusFilterOptions })
export const outboundStatusScanField = scanWorkflowField({ label: '出库状态', value: 'outbound_status', type: 'select', options: outboundStatusFilterOptions })
export const claimStatusScanField = scanWorkflowField({ label: '认领状态', value: 'claim_status', type: 'select', options: claimStatusFilterOptions })
export const lockStatusScanField = scanWorkflowField({ label: '锁定状态', value: 'lock_status', type: 'select', options: lockStatusFilterOptions })
export const interceptStatusScanField = scanWorkflowField({ label: '拦截状态', value: 'intercept_status', type: 'select', options: interceptStatusFilterOptions })
/** ScanBox:波次分配 → where.wave_id 为 { operator: 'eq'|'ne', value: 0 } */
@ -1182,10 +1221,11 @@ export function fillStoreScanFieldOptions(availableFields: any[], rawStores: any
// deliveryOrder相关配置
export const deliveryAvailableFields = [
// 订单基础信息
// 基础信息
storeScanField,
orderIdScanField,
deliveryOrderCodeScanField,
sourceOrderCodesScanField,
orderFlagScanField,
waveAssignmentScanField,
waveNoScanField,
@ -1202,13 +1242,47 @@ export const deliveryAvailableFields = [
createAtRangeScanField,
payTimeRangeScanField,
deliveryTimeRangeScanField,
// 工作流程(按订单作业顺序)
// 工作流程(按订单作业顺序,对齐 deliveryColumns 状态列)
orderStatusScanField(pendingOrderStatusFilterOptions),
syncStatusScanField,
inspectionStatusScanField,
recheckStatusScanField,
storageStatusScanField,
postStatusScanField,
outboundStatusScanField,
pickStatusScanField,
packStatusScanField,
printStatusScanField,
claimStatusScanField,
lockStatusScanField,
interceptStatusScanField,
]
export const deliveryColumns = [
/** upper-table 列点击复制:`copy` 仅复制;`copyQr` 复制并弹出快递单号二维码 */
export type UpperTableCopyAction = 'copy' | 'copyQr'
const ORDER_LIST_COPY_ACTIONS: Record<string, UpperTableCopyAction> = {
delivery_order_code: 'copy',
order_code: 'copy',
source_order_codes: 'copy',
express_numbers: 'copyQr',
waybill_codes: 'copyQr',
express_code: 'copyQr',
}
export function applyOrderListCopyActions<T extends { prop: string; formatter?: unknown }>(columns: T[]): T[] {
return columns.map((col) => {
const copyAction = ORDER_LIST_COPY_ACTIONS[col.prop]
if (!copyAction) return col
if (copyAction === 'copyQr') {
const { formatter: _formatter, ...rest } = col
return { ...rest, copyAction } as unknown as T
}
return { ...col, copyAction } as T
})
}
export const deliveryColumns = applyOrderListCopyActions([
{ prop: 'id', label: '订单ID', width: '80' },
{ prop: 'delivery_order_code', label: '发货单号', width: '170', fixed: 'left' },
{ prop: 'pre_delivery_order_code', label: '前置单号', width: '150' },
@ -1231,9 +1305,9 @@ export const deliveryColumns = [
{ prop: 'outbound_status', label: '出库状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'inspection_status', label: '审核状态', width: '100' },
{ prop: 'recheck_status', label: '复核', width: '100' },
{ prop: 'storage_status', label: '储位', width: '90' },
{ prop: 'post_status', label: '快递', width: '90' },
{ prop: 'recheck_status', label: '复核状态', width: '100' },
{ prop: 'storage_status', label: '储位状态', width: '90' },
{ prop: 'post_status', label: '快递状态', width: '90' },
{ prop: 'print_status', label: '打印状态', width: '100' },
{ prop: 'pick_status', label: '拣货状态', width: '90' },
{ prop: 'pack_status', label: '打包状态', width: '90' },
@ -1242,7 +1316,7 @@ export const deliveryColumns = [
{ prop: 'intercept_status', label: '拦截状态', width: '100', tag: true },
{ prop: 'logistics_name', label: '快递', width: '120' },
{ prop: 'sys_logistics_name', label: '系统快递', width: '120' },
{ prop: 'express_numbers', label: '运单号', width: '160', formatter: waybillCodesFormatter },
// { prop: 'express_numbers', label: '运单号', width: '160', formatter: waybillCodesFormatter },
{ prop: 'waybill_codes', label: '运单号', width: '150', formatter: waybillCodesFormatter },
{ prop: 'source_order_codes', label: '平台交易单号', width: '140' },
{ prop: 'is_urgency', label: '是否紧急', width: '80' },
@ -1263,7 +1337,7 @@ export const deliveryColumns = [
{ prop: 'operate_time', label: '操作时间', width: '160', formatter: orderTimeFormatter },
{ prop: 'place_order_time', label: '时效', width: '160', formatter: orderTimeFormatter },
{ prop: 'create_at', label: '创建时间', width: '160', formatter: orderTimeFormatter },
]
])
function appendOrderDetailSectionFields(
sections: OrderDetailSectionConfig[],
@ -1362,10 +1436,11 @@ export const deliveryOrderToolbarButtons = pickToolbarButtons(deliveryOrderToolb
// revieworder相关配置
export const reviewAvailableFields = [
// 订单基础信息
// 基础信息
storeScanField,
orderIdScanField,
deliveryOrderCodeScanField,
sourceOrderCodesScanField,
waveAssignmentScanField,
waveNoScanField,
shopNickScanField,
@ -1383,7 +1458,7 @@ export const reviewAvailableFields = [
recheckStatusScanField,
]
export const reviewColums = [
export const reviewColums = applyOrderListCopyActions([
{ prop: 'id', label: '订单ID', width: '80' },
{ prop: 'delivery_order_code', label: '发货单号', width: '170' },
{ prop: 'wave_no', label: '波次号', width: '170' },
@ -1393,7 +1468,7 @@ export const reviewColums = [
{ prop: 'name', label: '收件人', width: '110' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'recheck_status', label: '复核', width: '100' },
{ prop: 'recheck_status', label: '复核状态', width: '100' },
{ prop: 'is_urgency', label: '是否紧急', width: '80' },
{ prop: 'logistics_name', label: '快递', width: '120' },
{ prop: 'items_total', label: '商品总数', width: '100' },
@ -1405,7 +1480,7 @@ export const reviewColums = [
{ prop: 'operate_time', label: '审核时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'create_at', label: '创建时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'buyer_message', label: '买家留言', minWidth: '180' },
]
])
export const reviewOrderDetail = [
// 基础信息
@ -1507,10 +1582,11 @@ export const outboundToolbarButtons = pickToolbarButtons(outboundToolbarButtonKe
// pendingOrder相关配置
export const pendingAvailableFields = [
// 订单基础信息
// 基础信息
storeScanField,
orderIdScanField,
pendingOrderCodeScanField,
sourceOrderCodesScanField,
orderFlagScanField,
waveAssignmentScanField,
waveNoScanField,
@ -1552,8 +1628,8 @@ export const pendingCloums = [
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'storage_status', label: '储位', width: '100' },
{ prop: 'post_status', label: '快递', width: '100' },
{ prop: 'storage_status', label: '储位状态', width: '100' },
{ prop: 'post_status', label: '快递状态', width: '100' },
{ prop: 'pick_status', label: '拣货状态', width: '100' },
{ prop: 'pack_status', label: '打包状态', width: '100' },
{ prop: 'intercept_status', label: '拦截状态', width: '100', tag: true },
@ -1574,7 +1650,7 @@ export const pendingCloums = [
/** 列表字段显示名(以待处理订单 pendingCloums 为准,含动态插入列) */
export const ORDER_LIST_FIELD_LABELS: Record<string, string> = {
...Object.fromEntries(pendingCloums.map((col) => [col.prop, col.label])),
recheck_status: '复核',
recheck_status: '复核状态',
print_status: '打印状态',
outbound_status: '出库状态',
inspection_status: '审核状态',
@ -1620,7 +1696,7 @@ export function buildPendingStyleColumns(baseColumns: ReadonlyArray<{ prop: stri
source.push(printColumn)
}
}
return source
return applyOrderListCopyActions(source)
}
export const pendingOrderDetail = [
@ -1770,9 +1846,10 @@ export const workbenchStatusOptions = [
]
export const workbenchAvailableFields = [
// 订单基础信息
// 基础信息
orderIdScanField,
deliveryOrderCodeScanField,
sourceOrderCodesScanField,
waveAssignmentScanField,
waveNoScanField,
buyerNickScanField,
@ -1783,7 +1860,7 @@ export const workbenchAvailableFields = [
orderStatusScanField(workbenchStatusOptions),
]
export const workbenchColumns = [
export const workbenchColumns = applyOrderListCopyActions([
{ prop: 'id', label: '订单ID', width: '80' },
{ prop: 'delivery_order_code', label: '发货单号', minWidth: 160 },
{ prop: 'wave_no', label: '波次号', minWidth: 160 },
@ -1806,7 +1883,7 @@ export const workbenchColumns = [
{ prop: 'total_amount', label: '订单金额', minWidth: 110 },
{ prop: 'create_at', label: '创建时间', minWidth: 170, formatter: orderTimeFormatter },
{ prop: 'updated_at', label: '更新时间', minWidth: 170, formatter: orderTimeFormatter }
]
])
export const workbenchBadgeItems = [
{ key: 'reviewOrder', label: '待审核' },
@ -1827,11 +1904,12 @@ export const workbenchBadgeItems = [
// expectionOrder相关配置
export const expectionOrderAvailableFields = [
// 订单基础信息
// 基础信息
storeScanField,
orderIdScanField,
exceptionOrderCodeScanField,
deliveryOrderCodeScanField,
sourceOrderCodesScanField,
orderFlagScanField,
waveAssignmentScanField,
waveNoScanField,
@ -1845,6 +1923,7 @@ export const expectionOrderAvailableFields = [
// 工作流程(按订单作业顺序)
orderStatusScanField(exceptionOrderStatusFilterOptions),
syncStatusScanField,
recheckStatusScanField,
storageStatusScanField,
postStatusScanField,
pickStatusScanField,
@ -1862,8 +1941,8 @@ export const expectionColumns = [
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'storage_status', label: '储位', width: '100' },
{ prop: 'post_status', label: '快递', width: '100' },
{ prop: 'storage_status', label: '储位状态', width: '100' },
{ prop: 'post_status', label: '快递状态', width: '100' },
{ prop: 'pick_status', label: '拣货状态', width: '100' },
{ prop: 'pack_status', label: '打包状态', width: '100' },
{ prop: 'intercept_status', label: '拦截状态', width: '100', tag: true },
@ -1895,7 +1974,7 @@ export const expectionOrderDetail = [
{ prop: 'order_flag', label: '订单标记', span: 3 },
{ prop: 'lock_status', label: '锁定状态' },
{ prop: 'sync_status', label: '同步状态' },
{ prop: 'post_status', label: '快递' },
{ prop: 'post_status', label: '快递状态' },
// 收货信息
{ prop: 'name', label: '收件人' },
@ -1935,11 +2014,12 @@ export const expectionOrderbuttonList: any[] = [
// deliveryException相关配置
export const archiveAvailableFields = [
// 订单基础信息
// 基础信息
storeScanField,
orderIdScanField,
exceptionOrderCodeScanField,
deliveryOrderCodeScanField,
sourceOrderCodesScanField,
waveAssignmentScanField,
waveNoScanField,
shopNickScanField,
@ -1957,7 +2037,7 @@ export const archiveAvailableFields = [
packStatusScanField,
]
export const archiveColumns = [
export const archiveColumns = applyOrderListCopyActions([
{ prop: 'id', label: '订单ID', width: '80' },
{ prop: 'order_code', label: '发货单号', width: '180' },
{ prop: 'delivery_order_code', label: '发货单号', width: '160' },
@ -1972,7 +2052,7 @@ export const archiveColumns = [
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'create_at', label: '创建时间', width: '160' },
{ prop: 'updated_at', label: '归档时间', width: '160' },
]
])
export const archiveOrderDetail = [
// 基础信息

View File

@ -36,6 +36,7 @@
<upper-table
ref="upperTable"
title="配送异常列表"
default-align="center"
:enable-column-config="true"
table-id="order-management-delivery-exception"
:data="list"

View File

@ -42,6 +42,7 @@
<upper-table
ref="upperTable"
title="配送订单列表"
default-align="center"
:enable-column-config="true"
table-id="order-management-delivery-order"
:data="list"

View File

@ -36,6 +36,7 @@
<upper-table
ref="upperTable"
title="委托外仓列表"
default-align="center"
:enable-column-config="true"
table-id="order-management-entrust-warehouse"
:data="list"

View File

@ -81,6 +81,7 @@
<upper-table
ref="upperTable"
title="待处理异常订单列表"
default-align="center"
:enable-column-config="true"
table-id="order-management-exception-order"
:data="list"
@ -122,6 +123,12 @@
</el-tag>
</template>
<template #column-recheck_status="{ row }">
<el-tag :type="getTagType('recheck_status', resolveOrderRecheckStatus(row))" size="small">
{{ translateOrderField('recheck_status', resolveOrderRecheckStatus(row)) }}
</el-tag>
</template>
<template #column-storage_status="{ row }">
<el-tag :type="getTagType('storage_status', row.storage_status)" size="small">
{{ translateOrderField('storage_status', row.storage_status) }}
@ -159,40 +166,6 @@
</el-tag>
</template>
<template #column-express_numbers="{ row }">
<div v-if="extractWaybillCodes(row).length" class="waybill-list">
<span
v-for="code in extractWaybillCodes(row)"
:key="code"
class="waybill-link"
role="button"
tabindex="0"
@click.stop="openWaybillQr(code)"
@keydown.enter.prevent="openWaybillQr(code)"
>
{{ code }}
</span>
</div>
<span v-else>-</span>
</template>
<template #column-express_code="{ row }">
<div v-if="extractWaybillCodes(row).length" class="waybill-list">
<span
v-for="code in extractWaybillCodes(row)"
:key="code"
class="waybill-link"
role="button"
tabindex="0"
@click.stop="openWaybillQr(code)"
@keydown.enter.prevent="openWaybillQr(code)"
>
{{ code }}
</span>
</div>
<span v-else>-</span>
</template>
<template #column-order_flag="{ row }">
<el-tooltip
:content="orderFlagFullText(row)"
@ -377,8 +350,6 @@
</template>
</el-dialog>
<qrcode-dialog v-model:visible="qrDialogVisible" :code="currentWaybillCode" />
<wave-platform-print-preview-dialog
v-model="batchPrintDialogVisible"
:error-message="batchPrintErrorMessage"
@ -442,13 +413,12 @@ import UpdateAddressForm from './form/UpdateAddressForm.vue'
import BatchAsyncTaskForm from './form/BatchAsyncTaskForm.vue'
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
import { createOrderPageExport } from './utils/order-page-export'
import { buildOrderWhereConditions, parseOrderListResponse } from './utils/order-index-helpers'
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from './utils/order-index-helpers'
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
import { createPendingToolbarController } from './utils/toolbar-actions'
import { safeInvoke } from '@/utils/safe-invoke'
import QrcodeDialog from '@/components/QR/qrcode.vue'
import WavePlatformPrintPreviewDialog from '@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'
import { getOrderPrintData } from '@/api/order.print/orderprint'
import type { WavePlatformPrintDataPayload } from '@/api/order.print/orderprint'
@ -504,8 +474,6 @@ const handleStorageAssignFilterChange = () => {
loadData()
}
const toolbarButtons = exceptionToolbarButtons
const qrDialogVisible = ref(false)
const currentWaybillCode = ref('')
const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedOrderId.value) || null
@ -1119,39 +1087,6 @@ async function handleBatchPrintRefresh() {
function onBatchPrintSuccess() {
loadData()
}
function parseWaybillCodes(raw: unknown): string[] {
if (Array.isArray(raw)) {
return raw.map((item) => String(item ?? '').trim()).filter(Boolean)
}
const text = String(raw ?? '').trim()
if (!text) return []
if (text.startsWith('[') && text.endsWith(']')) {
try {
const parsed = JSON.parse(text)
if (Array.isArray(parsed)) {
return parsed.map((item) => String(item ?? '').trim()).filter(Boolean)
}
} catch {
// ignore invalid json
}
}
if (text.includes(',')) {
return text.split(',').map((item) => item.trim()).filter(Boolean)
}
return [text]
}
function extractWaybillCodes(row: any): string[] {
const raw = row?.express_numbers ?? row?.waybill_codes ?? row?.express_code
return parseWaybillCodes(raw)
}
function openWaybillQr(code: string) {
if (!code) return
currentWaybillCode.value = code
qrDialogVisible.value = true
}
</script>
<style scoped lang="scss">
@ -1203,17 +1138,6 @@ function openWaybillQr(code: string) {
word-break: break-all;
}
.waybill-link {
color: var(--el-color-primary);
cursor: pointer;
}
.waybill-list {
display: flex;
flex-direction: column;
gap: 2px;
}
.clone-order-meta {
margin-top: 12px;
color: #606266;

View File

@ -1,7 +1,7 @@
<template>
<el-dialog
v-model="visible"
title="批量快捷复核"
title="批量发货"
width="720px"
align-center
destroy-on-close
@ -14,8 +14,8 @@
:closable="false"
show-icon
class="batch-recheck-alert"
title="批量快捷复核说明"
description="对每个订单执行前置检查(已分配储位、已分配快递、已同步且未被拦截),必要时自动完成拣货后标记复核。各订单独立事务,支持部分失败。"
title="批量发货说明"
description="对每个订单执行前置检查(已分配储位、已分配快递、已同步且未被拦截),必要时自动完成拣货后标记发货。各订单独立事务,支持部分失败。"
/> -->
<el-form ref="formRef" :model="form" :rules="rules" label-width="96px" class="batch-recheck-form">
@ -90,7 +90,7 @@
<template #footer>
<el-button :disabled="submitting" @click="visible = false">关闭</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">执行复核</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">执行发货</el-button>
</template>
</el-dialog>
</template>
@ -243,11 +243,11 @@ async function handleSubmit() {
try {
const res: any = await batchQuickRecheck({ ids })
if (!isRecheckApiSuccess(res)) {
throw new Error(res?.message || '批量快捷复核失败')
throw new Error(res?.message || '批量发货失败')
}
const payload = unwrapBatchResult(res)
if (!payload) {
throw new Error('未获取到复核结果')
throw new Error('未获取到发货结果')
}
result.value = {
success: Array.isArray(payload.success) ? payload.success : [],
@ -259,14 +259,14 @@ async function handleSubmit() {
emit('success', result.value)
if (result.value.failed_count === 0) {
ElMessage.success(`批量复核完成,成功 ${result.value.success_count} 单`)
ElMessage.success(`批量发货完成,成功 ${result.value.success_count} 单`)
} else {
ElMessage.warning(
`复核完成:成功 ${result.value.success_count} 单,失败 ${result.value.failed_count} 单`
`发货完成:成功 ${result.value.success_count} 单,失败 ${result.value.failed_count} 单`
)
}
} catch (error: any) {
ElMessage.error(error?.message || '批量快捷复核失败')
ElMessage.error(error?.message || '批量发货失败')
} finally {
submitting.value = false
}

View File

@ -41,6 +41,7 @@
<upper-table
ref="upperTable"
title="待出库订单列表"
default-align="center"
:enable-column-config="true"
table-id="order-management-outbound-order"
:data="list"

View File

@ -49,6 +49,7 @@
<upper-table
ref="upperTable"
title="待处理订单列表"
default-align="center"
:enable-column-config="true"
table-id="order-management-pending-order"
:data="list"
@ -121,34 +122,6 @@
</el-tag>
</template>
<template #column-express_numbers="{ row }">
<div v-if="extractWaybillCodes(row).length" class="waybill-cell">
<div class="waybill-list">
<span
v-for="code in extractWaybillCodes(row)"
:key="code"
class="waybill-link"
role="button"
tabindex="0"
@click.stop="openWaybillQr(code)"
@keydown.enter.prevent="openWaybillQr(code)"
>
{{ code }}
</span>
</div>
<el-tooltip content="复制快递单号" placement="top">
<el-button
link
type="primary"
:icon="CopyDocument"
class="waybill-copy-btn"
@click.stop="copyWaybillCodes(row)"
/>
</el-tooltip>
</div>
<span v-else>-</span>
</template>
<template #column-sync_status="{ row }">
<el-tag :type="getTagType('sync_status', row.sync_status)" size="small">
{{ translateOrderField('sync_status', row.sync_status) }}
@ -347,8 +320,6 @@
</template>
</el-dialog>
<qrcode-dialog v-model:visible="qrDialogVisible" :code="currentWaybillCode" />
<wave-platform-print-preview-dialog
v-model="batchPrintDialogVisible"
:error-message="batchPrintErrorMessage"
@ -376,7 +347,6 @@
import { ref, reactive, onMounted, onUnmounted, computed } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import { CopyDocument } from '@element-plus/icons-vue'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
@ -420,7 +390,6 @@ import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
import { createPendingToolbarController } from './utils/toolbar-actions'
import { safeInvoke } from '@/utils/safe-invoke'
import QrcodeDialog from '@/components/QR/qrcode.vue'
import WavePlatformPrintPreviewDialog from '@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'
const scanBox = ref<any>(null)
@ -466,8 +435,6 @@ const handleStorageAssignFilterChange = () => {
loadData()
}
const toolbarButtons = pendingToolbarButtons
const qrDialogVisible = ref(false)
const currentWaybillCode = ref('')
const initialConditions = computed(() => {
const waveNo = String(route.query.wave_no || '').trim()
if (!waveNo) return undefined
@ -905,74 +872,6 @@ function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
safeInvoke(() => handler())
}
function parseWaybillCodes(raw: unknown): string[] {
if (Array.isArray(raw)) {
return raw.map((item) => String(item ?? '').trim()).filter(Boolean)
}
const text = String(raw ?? '').trim()
if (!text) return []
if (text.startsWith('[') && text.endsWith(']')) {
try {
const parsed = JSON.parse(text)
if (Array.isArray(parsed)) {
return parsed.map((item) => String(item ?? '').trim()).filter(Boolean)
}
} catch {
// ignore invalid json
}
}
if (text.includes(',')) {
return text.split(',').map((item) => item.trim()).filter(Boolean)
}
return [text]
}
function extractWaybillCodes(row: any): string[] {
const raw = row?.express_numbers ?? row?.waybill_codes ?? row?.express_code
return parseWaybillCodes(raw)
}
function openWaybillQr(code: string) {
if (!code) return
currentWaybillCode.value = code
qrDialogVisible.value = true
}
function waybillCodesText(row: any): string {
return extractWaybillCodes(row).join(',')
}
async function copyWaybillCodes(row: any) {
const text = waybillCodesText(row)
if (!text) {
ElMessage.warning('当前行无快递单号可复制')
return
}
try {
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(text)
} else {
throw new Error('no clipboard api')
}
ElMessage.success('快递单号已复制到剪贴板')
} catch {
try {
const ta = document.createElement('textarea')
ta.value = text
ta.setAttribute('readonly', 'readonly')
ta.style.position = 'fixed'
ta.style.left = '-9999px'
document.body.appendChild(ta)
ta.select()
document.execCommand('copy')
document.body.removeChild(ta)
ElMessage.success('快递单号已复制到剪贴板')
} catch {
ElMessage.error('复制失败,请手动复制')
}
}
}
function normalizeCode(value: unknown) {
return String(value ?? '').trim()
}
@ -1076,32 +975,6 @@ function getSelectedIds(): number[] {
height: 100%;
}
.waybill-cell {
display: flex;
align-items: flex-start;
gap: 4px;
min-width: 0;
}
.waybill-link {
color: var(--el-color-primary);
cursor: pointer;
}
.waybill-list {
display: flex;
flex: 1;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.waybill-copy-btn {
flex-shrink: 0;
padding: 0;
height: auto;
}
.resolve-exception-form {
margin-top: 12px;
}

View File

@ -37,6 +37,7 @@
<upper-table
ref="upperTable"
title="待审核订单列表"
default-align="center"
:enable-column-config="true"
table-id="order-management-review-order"
:data="list"

View File

@ -204,9 +204,16 @@
.detail-container {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
padding: 0;
height: 100%;
overflow: hidden;
> .detail-page {
flex: 1;
min-height: 0;
}
}
}

View File

@ -816,7 +816,7 @@ export function createPendingToolbarController(params: {
function openBatchQuickRecheckDialog() {
const rows = params.getSelectedRows()
if (!rows.length) {
ElMessage.warning('请先勾选需要批量复核的订单')
ElMessage.warning('请先勾选需要批量发货的订单')
return
}
const ids = params.getSelectedIds()

View File

@ -0,0 +1,299 @@
<template>
<el-dialog
v-model="visible"
title="运单称重"
width="480px"
align-center
destroy-on-close
@closed="handleClosed"
>
<!-- <el-alert
type="info"
:closable="false"
show-icon
class="weighing-form-alert"
>
<template #title>
支持运单号模式(order_id=0)与订单模式(order_id 为正整数)。称重重量单位为 kg,须大于 0,最多 3 位小数。
</template>
</el-alert> -->
<el-form
ref="formRef"
:model="formModel"
:rules="rules"
label-width="96px"
class="weighing-form"
@submit.prevent
>
<el-form-item label="称重方式" prop="weighing_mode">
<el-radio-group v-model="formModel.weighing_mode">
<el-radio value="waybill">运单号模式</el-radio>
<el-radio value="order">订单模式</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="formModel.weighing_mode === 'waybill'" label="运单号" prop="waybill_code">
<el-input
v-model="formModel.waybill_code"
placeholder="请输入运单号"
clearable
maxlength="64"
@keyup.enter="handleSubmit"
/>
</el-form-item>
<template v-else>
<el-form-item label="订单 ID" prop="order_id">
<el-input-number
v-model="formModel.order_id"
:min="1"
:precision="0"
:step="1"
controls-position="right"
placeholder="请输入订单 ID"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="运单号" prop="order_waybill_code">
<el-input
v-model="formModel.order_waybill_code"
placeholder="单运单订单可不填;多运单订单必填"
clearable
maxlength="64"
@keyup.enter="handleSubmit"
/>
</el-form-item>
</template>
<el-form-item label="重量单位">
<el-radio-group v-model="formModel.weight_unit">
<el-radio value="kg">kg</el-radio>
<el-radio value="g">g</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="称重重量" prop="weighing_weight">
<el-input-number
v-model="formModel.weighing_weight"
:min="formModel.weight_unit === 'g' ? 1 : 0.001"
:precision="formModel.weight_unit === 'g' ? 0 : 3"
:step="formModel.weight_unit === 'g' ? 1 : 0.1"
controls-position="right"
placeholder="请输入称重重量"
style="width: 100%"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" :loading="loading" @click="handleSubmit">保存</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { reactive, ref, watch } from 'vue'
import type { FormInstance, FormRules } from 'element-plus'
import { ElMessage } from 'element-plus'
import { orderUpdateExpressWeighingWeight } from '@/api/order.index/orderindex'
import type { UpdateExpressWeighingWeightParams } from '@/api/order.index/orderindex'
import {
isOrderIndexApiSuccess,
parseUpdateExpressWeighingWeightResponse
} from '@/views/order/orderManagement/utils/order-index-helpers'
export type ExpressWeighingFormResult = ReturnType<typeof parseUpdateExpressWeighingWeightResponse> & {
waybill?: string
}
const visible = defineModel<boolean>({ default: false })
const props = defineProps<{
initialWaybillCode?: string
}>()
const emit = defineEmits<{
(e: 'success', payload: ExpressWeighingFormResult): void
}>()
const loading = ref(false)
const formRef = ref<FormInstance>()
const formModel = reactive({
weighing_mode: 'waybill' as 'waybill' | 'order',
waybill_code: '',
order_id: undefined as number | undefined,
order_waybill_code: '',
weight_unit: 'kg' as 'kg' | 'g',
weighing_weight: undefined as number | undefined
})
function validateWeighingWeight(_rule: unknown, value: unknown, callback: (error?: Error) => void) {
const num = Number(value)
if (!Number.isFinite(num) || num <= 0) {
callback(new Error('称重重量须大于 0'))
return
}
if (formModel.weight_unit === 'kg') {
const rounded = Number(num.toFixed(3))
if (Math.abs(num - rounded) > 1e-9) {
callback(new Error('kg 单位最多 3 位小数'))
return
}
}
callback()
}
const rules: FormRules = {
weighing_mode: [{ required: true, message: '请选择称重方式', trigger: 'change' }],
waybill_code: [
{
validator: (_rule, value, callback) => {
if (formModel.weighing_mode !== 'waybill') {
callback()
return
}
if (!String(value ?? '').trim()) {
callback(new Error('运单号模式下运单号必填'))
return
}
callback()
},
trigger: 'blur'
}
],
order_id: [
{
validator: (_rule, value, callback) => {
if (formModel.weighing_mode !== 'order') {
callback()
return
}
const id = Number(value)
if (!Number.isFinite(id) || id <= 0 || !Number.isInteger(id)) {
callback(new Error('订单 ID 须为正整数'))
return
}
callback()
},
trigger: 'blur'
}
],
weighing_weight: [
{ required: true, message: '请输入称重重量', trigger: 'blur' },
{ validator: validateWeighingWeight, trigger: 'blur' }
]
}
function resetForm() {
formModel.weighing_mode = 'waybill'
formModel.waybill_code = props.initialWaybillCode?.trim() || ''
formModel.order_id = undefined
formModel.order_waybill_code = ''
formModel.weight_unit = loadWeightUnit()
formModel.weighing_weight = undefined
formRef.value?.clearValidate()
}
function loadWeightUnit(): 'kg' | 'g' {
try {
const unit = localStorage.getItem('order_weighing_unit')
return unit === 'g' ? 'g' : 'kg'
} catch {
return 'kg'
}
}
function saveWeightUnit(unit: 'kg' | 'g') {
try {
localStorage.setItem('order_weighing_unit', unit)
} catch {
/* ignore */
}
}
function buildPayload(): UpdateExpressWeighingWeightParams {
const rawWeight = Number(formModel.weighing_weight)
const weighingWeight =
formModel.weight_unit === 'g'
? Number((rawWeight / 1000).toFixed(3))
: Number(rawWeight.toFixed(3))
if (formModel.weighing_mode === 'waybill') {
return {
order_id: 0,
waybill_code: formModel.waybill_code.trim(),
weighing_weight: weighingWeight
}
}
const payload: UpdateExpressWeighingWeightParams = {
order_id: Number(formModel.order_id),
weighing_weight: weighingWeight
}
const waybill = formModel.order_waybill_code.trim()
if (waybill) payload.waybill_code = waybill
return payload
}
function applySuccessResult(payload: UpdateExpressWeighingWeightParams, detail: ExpressWeighingFormResult) {
emit('success', {
...detail,
waybill: detail.waybill_code || payload.waybill_code || ''
})
}
async function handleSubmit() {
if (!formRef.value || loading.value) return
const valid = await formRef.value.validate().catch(() => false)
if (!valid) return
const payload = buildPayload()
loading.value = true
try {
const res: any = await orderUpdateExpressWeighingWeight(payload)
if (!isOrderIndexApiSuccess(res)) {
throw new Error(res?.message || '称重保存失败')
}
saveWeightUnit(formModel.weight_unit)
const detail = parseUpdateExpressWeighingWeightResponse(res)
ElMessage.success(res?.message || '称重保存成功')
applySuccessResult(payload, detail)
visible.value = false
} catch (error: any) {
ElMessage.error(error?.message || '称重保存失败')
} finally {
loading.value = false
}
}
function handleClosed() {
resetForm()
}
watch(
() => visible.value,
(open) => {
if (open) resetForm()
}
)
watch(
() => formModel.weighing_mode,
() => {
formRef.value?.clearValidate(['waybill_code', 'order_id', 'order_waybill_code'])
}
)
</script>
<style scoped lang="scss">
.weighing-form-alert {
margin-bottom: 16px;
}
.weighing-form {
padding-top: 4px;
}
</style>

View File

@ -1,28 +1,11 @@
<template>
<div class="weighing-container" :style="{ height: containerHeight }">
<div class="weighing-panel">
<div class="panel-settings">
<span class="setting-label">单位</span>
<el-select v-model="weighingUnit" size="small" style="width:65px">
<el-option label="kg" value="kg" />
<el-option label="g" value="g" />
</el-select>
<span class="setting-label">分隔符</span>
<el-input v-model="weighingDelimiter" size="small" style="width:60px" maxlength="3" />
</div>
<div class="panel-input">
<el-input
ref="searchInput"
v-model="searchKeyword"
:placeholder="`运单号${weighingDelimiter}重量,回车保存`"
clearable
size="small"
:loading="quickSaving"
@keyup.enter="handleQuickSave"
/>
<div class="panel-header">
<span class="panel-title">最近称重</span>
</div>
<div class="panel-result" v-if="lastResult">
<div v-if="lastResult" class="panel-result">
<div class="result-title">{{ lastResult.wave_no || lastResult.waybill || '称重结果' }}</div>
<div class="result-weights">
<div class="weight-row">
@ -34,6 +17,9 @@
<span class="weight-label">系统</span>
</div>
</div>
<div class="result-meta" v-if="lastResult.order_id">
<span>订单 ID {{ lastResult.order_id }}</span>
</div>
<div class="result-meta" v-if="lastResult.wave_id">
<span>波次 {{ lastResult.wave_no }}</span>
<span class="meta-divider">|</span>
@ -60,12 +46,17 @@
</div>
</div>
</div>
<div v-else class="panel-empty">
点击右侧「运单称重」录入重量
</div>
</div>
<div class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" :loading="loading" @click="loadList">刷新</el-button>
<el-button size="small" type="success" @click="openWeighingForm">运单称重</el-button>
<el-tag size="small" type="info">共 {{ pagination.total }} 条</el-tag>
</div>
<el-input
@ -107,24 +98,26 @@
</upper-table>
</div>
</div>
<ExpressWeighingForm
v-model="weighingFormVisible"
:initial-waybill-code="filterWaybill"
@success="handleWeighingSuccess"
/>
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, reactive, ref, watch, nextTick } from 'vue'
import { computed, onMounted, reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import UpperTable from '@/components/UpperTable/index.vue'
import { useSettingsStore } from '@/stores/modules/settings'
import { orderUpdateExpressWeighingWeight } from '@/api/order.index/orderindex'
import { orderPendingOrderList } from '@/api/order.pendingorder/orderpendingOrder'
import {
isOrderIndexApiSuccess,
parseUpdateExpressWeighingWeightResponse
} from '@/views/order/orderManagement/utils/order-index-helpers'
import { isOrderIndexApiSuccess } from '@/views/order/orderManagement/utils/order-index-helpers'
import ExpressWeighingForm, { type ExpressWeighingFormResult } from './ExpressWeighingForm.vue'
const settingsStore = useSettingsStore()
const upperTable = ref<any>(null)
const searchInput = ref<any>(null)
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
@ -146,10 +139,8 @@ const tableSize = ref<'small' | 'default' | 'large'>('small')
const filterWaybill = ref('')
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
// 左侧输入
const searchKeyword = ref('')
const lastResult = ref<any>(null)
const quickSaving = ref(false)
const weighingFormVisible = ref(false)
const weightWarnType = computed(() => {
const actual = Number(lastResult.value?.weighing_weight)
@ -161,19 +152,6 @@ const weightWarnType = computed(() => {
return 'success'
})
// 设置
const DELIMITER_KEY = 'order_weighing_delimiter'
const UNIT_KEY = 'order_weighing_unit'
const weighingDelimiter = ref(loadSetting(DELIMITER_KEY, '|'))
const weighingUnit = ref(loadSetting(UNIT_KEY, 'kg'))
function loadSetting(key: string, fallback: string): string {
try { return localStorage.getItem(key) || fallback } catch { return fallback }
}
function saveSetting(key: string, val: string) {
try { localStorage.setItem(key, val) } catch { /* ignore */ }
}
function isSuccess(res: any) {
return isOrderIndexApiSuccess(res)
}
@ -222,64 +200,31 @@ async function loadList() {
}
}
async function handleQuickSave() {
const text = searchKeyword.value.trim()
if (!text || quickSaving.value) return
const delimiter = weighingDelimiter.value || '|'
const parts = text.split(delimiter)
if (parts.length < 2) {
ElMessage.warning(`格式: 运单号${delimiter}重量`)
return
}
const waybill = parts[0]?.trim() ?? ''
const weight = parseFloat(parts[1]?.trim() ?? '')
if (!waybill) { ElMessage.warning('运单号为空'); return }
if (isNaN(weight) || weight <= 0) { ElMessage.warning('重量无效'); return }
const finalWeight = weighingUnit.value === 'g' ? weight / 1000 : weight
function openWeighingForm() {
weighingFormVisible.value = true
}
quickSaving.value = true
try {
// order_id=0 + waybill_code 直接称重,无需先查订单
const res: any = await orderUpdateExpressWeighingWeight({
order_id: 0,
waybill_code: waybill,
weighing_weight: Number(finalWeight.toFixed(3))
})
if (isSuccess(res)) {
ElMessage.success(`运单 ${waybill} 称重 ${finalWeight}kg 保存成功`)
const detail = parseUpdateExpressWeighingWeightResponse(res)
lastResult.value = {
waybill: detail.waybill_code || waybill,
weighing_weight: detail.weighing_weight ?? finalWeight,
wave_id: detail.wave_id,
wave_no: detail.wave_no,
business_key: detail.business_key || '',
total_weight: detail.total_weight,
split_count: detail.split_count ?? 0,
splits: detail.splits || [],
store_name: detail.store_name || '',
sys_logistics_name: detail.sys_logistics_name || ''
}
searchKeyword.value = ''
void nextTick(() => searchInput.value?.focus?.())
loadList()
} else {
ElMessage.error(res?.message || '保存失败')
}
} catch (e: any) {
ElMessage.error(e?.message || '保存失败')
} finally {
quickSaving.value = false
function handleWeighingSuccess(detail: ExpressWeighingFormResult) {
lastResult.value = {
waybill: detail.waybill || detail.waybill_code || '',
order_id: detail.order_id,
weighing_weight: detail.weighing_weight,
wave_id: detail.wave_id,
wave_no: detail.wave_no,
business_key: detail.business_key || '',
total_weight: detail.total_weight,
split_count: detail.split_count ?? 0,
splits: detail.splits || [],
store_name: detail.store_name || '',
sys_logistics_name: detail.sys_logistics_name || ''
}
loadList()
}
function handlePageChange(page: number) { pagination.currentPage = page; loadList() }
function handlePageSizeChange(size: number) { pagination.pageSize = size; pagination.currentPage = 1; loadList() }
watch(weighingDelimiter, (v) => saveSetting(DELIMITER_KEY, v))
watch(weighingUnit, (v) => saveSetting(UNIT_KEY, v))
onMounted(() => { loadList(); void nextTick(() => searchInput.value?.focus?.()) })
onMounted(() => { loadList() })
</script>
<style scoped lang="scss">
@ -298,23 +243,25 @@ onMounted(() => { loadList(); void nextTick(() => searchInput.value?.focus?.())
padding: 10px;
gap: 10px;
.panel-settings {
display: flex;
align-items: center;
gap: 6px;
.setting-label { font-size: 12px; color: #909399; white-space: nowrap; }
.panel-header {
.panel-title {
font-size: 13px;
font-weight: 600;
color: #303133;
}
}
.panel-current {
border: 1px solid #ebeef5;
.panel-empty {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
font-size: 12px;
color: #909399;
padding: 16px;
border: 1px dashed #e4e7ed;
border-radius: 4px;
padding: 8px;
.current-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.current-item { display: flex; gap: 8px; font-size: 12px; margin-bottom: 4px;
.current-label { color: #909399; min-width: 50px; }
code { font-size: 12px; }
strong { font-size: 13px; color: #67c23a; }
}
}
.panel-result {

View File

@ -35,6 +35,7 @@
<upper-table
ref="upperTable"
title="不符合波次策略订单列表"
default-align="center"
:enable-column-config="true"
:column-config-schema-version="1"
:table-id="tableListId"
@ -52,14 +53,6 @@
@refresh="loadData"
@selection-change="handleSelectionChange"
>
<template #column-delivery_no="{ row }">
<span>{{ row.delivery_no || row.delivery_order_code || row.order_sn || '—' }}</span>
</template>
<template #column-tracking_no="{ row }">
<span>{{ row.tracking_no || row.tracking_number || '—' }}</span>
</template>
<template #column-store_name="{ row }">
<span>{{ row.store_name || row.shop_name || row.shop || '—' }}</span>
</template>

View File

@ -46,6 +46,7 @@
<upper-table
ref="upperTable"
:title="waveUpperTableDefaults.title"
default-align="center"
:enable-column-config="waveUpperTableDefaults.enableColumnConfig"
:column-config-schema-version="3"
:table-id="tableListId"
@ -69,10 +70,6 @@
<span>{{ row.wave_id ?? row.id ?? '—' }}</span>
</template>
<template #column-wave_no="{ row }">
<span>{{ getWaveCode(row) }}</span>
</template>
<template #column-wave_type="{ row }">
<el-tag size="small" type="info">
{{ getWaveTypeText(row) }}

View File

@ -46,6 +46,7 @@
<upper-table
ref="upperTable"
:title="waveUpperTableDefaults.title"
default-align="center"
:enable-column-config="waveUpperTableDefaults.enableColumnConfig"
:column-config-schema-version="3"
:table-id="tableListId"
@ -69,10 +70,6 @@
<span>{{ row.wave_id ?? row.id ?? '—' }}</span>
</template>
<template #column-wave_no="{ row }">
<span>{{ getWaveCode(row) }}</span>
</template>
<template #column-wave_type="{ row }">
<el-tag size="small" type="info">
{{ getWaveTypeText(row) }}

View File

@ -32,163 +32,114 @@
<div class="split-stack" ref="splitStackRef">
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
<div class="upper-table-container small">
<div class="table-container">
<el-table
v-loading="loading"
:data="list"
style="width: 100%"
size="small"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
border
stripe
height="100%"
>
<el-table-column type="selection" width="52" align="center" fixed="left" />
<el-table-column prop="task_id" label="任务ID" width="90" align="center" />
<el-table-column prop="task_no" label="任务编号" min-width="220" show-overflow-tooltip />
<el-table-column label="波次号" min-width="180" show-overflow-tooltip>
<template #default="{ row }">
<template v-if="Array.isArray(row.wave_list) && row.wave_list.length">
{{ row.wave_list.map((w: any) => w.wave_no).join('、') }}
<upper-table
ref="upperTable"
:title="pickTaskWaveListDefaults.listTitle"
default-align="center"
:enable-column-config="true"
table-id="wave-pick-task-list"
:data="list"
:row-key="getTaskRowKey"
:columns="columns"
table-size="small"
:pagination="pagination"
:page-sizes="[...pickTaskWavePaginationPageSizes]"
:pagination-layout="pickTaskWavePaginationDefaults.layout"
:show-index="false"
:show-selection="true"
:loading="loading"
:queryTime="queryTime"
@current-change="handleRowClick"
@row-click="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@selection-change="handleSelectionChange"
>
<template #column-status="{ row }">
<el-tag size="small" :type="getPickTaskStatusTagType(row.status)">
{{ formatPickTaskStatus(row.status) }}
</el-tag>
</template>
<span v-else class="wave-no-empty">—</span>
</template>
</el-table-column>
<el-table-column label="任务状态" width="110" align="center">
<template #default="{ row }">
<el-tag size="small" :type="getPickTaskStatusTagType(row.status)">
{{ formatPickTaskStatus(row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="复核状态" width="100" align="center">
<template #default="{ row }">
<el-tag size="small" :type="getPickTaskReviewStatusTagType(row.review_status)">
{{ formatPickTaskReviewStatus(row.review_status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="拣货模式" width="100" align="center">
<template #default="{ row }">
<el-tag size="small" type="info">
{{ formatPickTaskPickMode(row.pick_mode) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="来源" width="90" align="center">
<template #default="{ row }">
<el-tag size="small" :type="getPickTaskSourceTagType(row.source)">
{{ formatPickTaskSource(row.source) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="wave_count" label="波次数" width="90" align="right" />
<el-table-column prop="order_count" label="订单数" width="90" align="right" />
<el-table-column label="箱数" width="110" align="right">
<template #default="{ row }">
<el-tooltip v-if="row.box_count === 0" content="可能未统计" placement="top">
<span>{{ row.box_count }}</span>
</el-tooltip>
<span v-else>{{ row.box_count }}</span>
</template>
</el-table-column>
<el-table-column label="操作人" min-width="120" show-overflow-tooltip>
<template #default="{ row }">
{{ row.operator_name || row.operator_id || '-' }}
</template>
</el-table-column>
<el-table-column label="拣货员" min-width="120" show-overflow-tooltip>
<template #default="{ row }">
{{ row.pick_user_name || row.pick_user_id || '-' }}
</template>
</el-table-column>
<el-table-column label="复核人" min-width="120" show-overflow-tooltip>
<template #default="{ row }">
{{ row.review_user_name || row.review_user_id || '-' }}
</template>
</el-table-column>
<el-table-column prop="current_cart_id" label="当前车ID" width="100" align="center" />
<el-table-column prop="current_cart_code_snapshot" label="当前车编码" min-width="140" show-overflow-tooltip />
<el-table-column prop="device_id" label="设备ID" min-width="140" show-overflow-tooltip />
<el-table-column label="开始时间" min-width="168" show-overflow-tooltip>
<template #default="{ row }">
{{ formatDateTime(row.start_at || row.start_time) }}
</template>
</el-table-column>
<el-table-column label="完成时间" min-width="168" show-overflow-tooltip>
<template #default="{ row }">
{{ formatDateTime(row.finish_at || row.finish_time) }}
</template>
</el-table-column>
<el-table-column label="复核开始" min-width="168" show-overflow-tooltip>
<template #default="{ row }">
{{ formatDateTime(row.review_start_time) }}
</template>
</el-table-column>
<el-table-column label="复核完成" min-width="168" show-overflow-tooltip>
<template #default="{ row }">
{{ formatDateTime(row.review_finish_time) }}
</template>
</el-table-column>
<el-table-column label="创建时间" min-width="168" show-overflow-tooltip>
<template #default="{ row }">
{{ formatDateTime(row.created_at || row.create_time) }}
</template>
</el-table-column>
<el-table-column label="更新时间" min-width="168" show-overflow-tooltip>
<template #default="{ row }">
{{ formatDateTime(row.update_time) }}
</template>
</el-table-column>
<el-table-column label="操作" width="220" fixed="right" align="center">
<template #default="{ row }">
<!-- <el-button
v-if="isSelfCreatedTask(row)"
type="warning"
link
:loading="cancelSelfTaskId === getTaskId(row)"
:disabled="!getTaskId(row) || isPickTaskCancelled(row)"
@click="handleCancelSelfTask(row)"
>
取消本人任务
</el-button> -->
<el-button
v-if="!isPickTaskCancelled(row) && !isPickTaskPickFinished(row)"
type="danger"
link
:loading="cancelingTaskId === getTaskId(row)"
:disabled="!getTaskId(row)"
@click="handleCancelTask(row)"
>
取消任务
</el-button>
</template>
</el-table-column>
<template #empty>
<div class="empty-tip">{{ emptyText }}</div>
</template>
</el-table>
</div>
<div class="pagination-container">
<div class="pagination-info">
已选 {{ selectedTaskRows.length }} 条,查询用时 {{ (queryTime / 1000).toFixed(2) }} 秒
</div>
<el-pagination
:current-page="pagination.currentPage"
:page-size="pagination.pageSize"
:page-sizes="pickTaskWavePaginationPageSizes"
:total="pagination.total"
:layout="pickTaskWavePaginationDefaults.layout"
background
size="small"
@size-change="handlePageSizeChange"
@current-change="handlePageChange"
/>
</div>
</div>
<template #column-review_status="{ row }">
<el-tag size="small" :type="getPickTaskReviewStatusTagType(row.review_status)">
{{ formatPickTaskReviewStatus(row.review_status) }}
</el-tag>
</template>
<template #column-pick_mode="{ row }">
<el-tag size="small" type="info">
{{ formatPickTaskPickMode(row.pick_mode) }}
</el-tag>
</template>
<template #column-source="{ row }">
<el-tag size="small" :type="getPickTaskSourceTagType(row.source)">
{{ formatPickTaskSource(row.source) }}
</el-tag>
</template>
<template #column-box_count="{ row }">
<el-tooltip v-if="row.box_count === 0" content="可能未统计" placement="top">
<span>{{ row.box_count }}</span>
</el-tooltip>
<span v-else>{{ row.box_count }}</span>
</template>
<template #column-operator_name="{ row }">
{{ row.operator_name || row.operator_id || '—' }}
</template>
<template #column-pick_user_name="{ row }">
{{ row.pick_user_name || row.pick_user_id || '—' }}
</template>
<template #column-review_user_name="{ row }">
{{ row.review_user_name || row.review_user_id || '—' }}
</template>
<template #column-start_at="{ row }">
{{ formatDateTime(row.start_at || row.start_time) }}
</template>
<template #column-finish_at="{ row }">
{{ formatDateTime(row.finish_at || row.finish_time) }}
</template>
<template #column-review_start_time="{ row }">
{{ formatDateTime(row.review_start_time) }}
</template>
<template #column-review_finish_time="{ row }">
{{ formatDateTime(row.review_finish_time) }}
</template>
<template #column-created_at="{ row }">
{{ formatDateTime(row.created_at || row.create_time) }}
</template>
<template #column-update_time="{ row }">
{{ formatDateTime(row.update_time) }}
</template>
<template #column-operation="{ row }">
<el-button
v-if="!isPickTaskCancelled(row) && !isPickTaskPickFinished(row)"
type="danger"
link
:loading="cancelingTaskId === getTaskId(row)"
:disabled="!getTaskId(row)"
@click.stop="handleCancelTask(row)"
>
取消任务
</el-button>
</template>
<template #empty>
<div class="empty-tip">{{ emptyText }}</div>
</template>
</upper-table>
</div>
<template v-if="detailVisible">
@ -253,6 +204,7 @@
import { computed, onMounted, reactive, ref, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { safeInvoke } from '@/utils/safe-invoke'
@ -271,6 +223,7 @@ import {
pickTaskWavePaginationDefaults,
pickTaskWavePaginationPageSizes,
pickTaskWaveToolbarButtons,
pickTaskWaveColumns,
formatPickTaskStatus,
formatPickTaskReviewStatus,
formatPickTaskPickMode,
@ -291,6 +244,8 @@ const props = withDefaults(
)
const userStore = useUserStore()
const upperTable = ref<any>(null)
const columns = ref([...pickTaskWaveColumns])
const loading = ref(false)
const list = ref<Array<Record<string, any>>>([])
const emptyText = ref(pickTaskWaveListDefaults.emptyText)
@ -541,6 +496,10 @@ function getTaskId(row: Record<string, any>): number | string | null {
return taskId
}
function getTaskRowKey(row: Record<string, any>) {
return getTaskId(row) ?? row.task_id ?? row.id ?? ''
}
function getValidTaskIds(rows: Array<Record<string, any>>): Array<number | string> {
return rows
.map((row) => getTaskId(row))

View File

@ -9,7 +9,7 @@
<el-descriptions-item label="波次类型">
<el-tag size="small" type="info">{{ getWaveTypeText(row) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="状态">
<el-descriptions-item label="波次状态">
<el-tag size="small" :type="getStatusTagType(row)">{{ getStatusText(row) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="仓库ID">{{ row.warehouse_id ?? '—' }}</el-descriptions-item>

View File

@ -2,7 +2,8 @@ import {
buyerMessageHasFilterOptions,
scanBasicField,
scanWorkflowField,
type ToolbarButtonConfig
type ToolbarButtonConfig,
type UpperTableCopyAction
} from '@/views/order/orderManagement/config/order-common-config'
import type { WavePlatformPrintDataPayload } from '@/api/order.print/orderprint'
import type { WaveStrategyCreateParams, WaveStrategyUpdateParams } from '@/api/order.wave/orderwave'
@ -38,10 +39,10 @@ export function waveScanField<G extends WaveScanFieldGroupKey>(
}
/** 波次列表 ScanBox:基础信息分组(对齐待处理订单「订单基础信息」排版) */
export const WAVE_SCAN_BASIC_INFO_GROUP = '波次基础信息'
export const WAVE_SCAN_BASIC_INFO_GROUP = '基础信息'
/** 拣货任务 ScanBox:基础信息分组 */
export const PICK_TASK_SCAN_BASIC_INFO_GROUP = '任务基础信息'
export const PICK_TASK_SCAN_BASIC_INFO_GROUP = '基础信息'
/** 波次列表 ScanBox 基础信息字段 */
export function waveScanBasicField(field: Record<string, any>) {
@ -123,6 +124,8 @@ export const waveAvailableFields = [
options: [
{ label: '未分配', value: '未分配' },
{ label: '已分配', value: '已分配' },
// { label: '错误', value: '错误' },
{ label:'部分分配', value: 'partial' },
]
}),
scanWorkflowField({
@ -174,8 +177,51 @@ export const fallbackOrderAvailableFields = [
scanBasicField({ label: '买家留言', value: 'buyer_message', type: 'text' }),
]
const WAVE_LIST_COPY_ACTIONS: Record<string, UpperTableCopyAction> = {
wave_no: 'copy',
delivery_no: 'copy',
tracking_no: 'copyQr',
task_no: 'copy',
}
const WAVE_LIST_COPY_VALUE_KEYS: Record<string, string[]> = {
wave_no: ['wave_no', 'wave_code', 'batch_code', 'batch_no', 'code'],
delivery_no: ['delivery_no', 'delivery_order_code', 'order_sn'],
tracking_no: ['tracking_no', 'tracking_number'],
}
export function applyWaveListCopyActions<
T extends { prop: string; formatter?: unknown; copyAction?: UpperTableCopyAction; copyValueKeys?: string[] }
>(columns: T[]): T[] {
return columns.map((col) => {
const copyAction = col.copyAction ?? WAVE_LIST_COPY_ACTIONS[col.prop]
if (!copyAction) return col
const copyValueKeys = col.copyValueKeys ?? WAVE_LIST_COPY_VALUE_KEYS[col.prop]
if (copyAction === 'copyQr') {
const { formatter, ...rest } = col
return {
...rest,
copyAction,
...(copyValueKeys ? { copyValueKeys } : {})
} as unknown as T
}
return {
...col,
copyAction,
...(copyValueKeys ? { copyValueKeys } : {})
} as T
})
}
export function getPickTaskWaveNos(row: any): string[] {
if (!Array.isArray(row?.wave_list) || !row.wave_list.length) return []
return row.wave_list
.map((wave: any) => String(wave?.wave_no ?? '').trim())
.filter(Boolean)
}
/** 不符合波次策略订单列表:UpperTable 列配置 */
export const fallbackOrderColumns = [
export const fallbackOrderColumns = applyWaveListCopyActions([
{ prop: 'delivery_no', label: '订单号', minWidth: 180, fixed: 'left' },
{ prop: 'tracking_no', label: '物流单号', minWidth: 160 },
{ prop: 'store_name', label: '店铺', minWidth: 140 },
@ -189,7 +235,7 @@ export const fallbackOrderColumns = [
{ prop: 'wave_scan_result', label: '扫描结果', minWidth: 110, align: 'center' },
{ prop: 'buyer_message', label: '买家留言', minWidth: 180 },
{ prop: 'updated_at', label: '更新时间', minWidth: 170 }
]
])
/** 波次策略:左侧筛选可用字段 */
export const waveStrategyAvailableFields = [
@ -254,11 +300,11 @@ export const waveStrategyColumns = [
]
/** 主表列配置 */
export const waveBatchColumns = [
export const waveBatchColumns = applyWaveListCopyActions([
// { prop: 'wave_id', label: '波次ID', minWidth: 160, fixed: 'left' },
{ prop: 'wave_no', label: '波次编号', minWidth: 180, fixed: 'left' },
{ prop: 'wave_type', label: '波次类型', minWidth: 96 },
{ prop: 'wave_status', label: '状态', minWidth: 110 },
{ prop: 'wave_status', label: '波次状态', minWidth: 110 },
{ prop: 'total_orders', label: '总订单数', minWidth: 110, align: 'right' },
{ prop: 'order_count', label: '订单数量', minWidth: 100, align: 'right' },
{ prop: 'processed_orders', label: '已处理订单', minWidth: 108, align: 'right' },
@ -278,7 +324,7 @@ export const waveBatchColumns = [
{ prop: 'create_time', label: '创建时间', minWidth: 168 },
{ prop: 'update_time', label: '更新时间', minWidth: 168 },
{ prop: 'operation', label: '操作', minWidth: 110, fixed: 'right' }
]
])
/** 列表查询 where 白名单(与 sanitizeWaveWhere 一致) */
export const waveWhereAllowedFieldList = [
@ -934,6 +980,39 @@ export const pickTaskWaveAvailableFields = [
}),
]
/** 拣货任务列表:UpperTable 列配置 */
export const pickTaskWaveColumns = applyWaveListCopyActions([
{ prop: 'task_id', label: '任务ID', width: 90 },
{ prop: 'task_no', label: '任务编号', minWidth: 220 },
{
prop: 'wave_list',
label: '波次号',
minWidth: 180,
copyAction: 'copy',
copyValue: getPickTaskWaveNos
},
{ prop: 'status', label: '任务状态', width: 110 },
{ prop: 'review_status', label: '复核状态', width: 100 },
{ prop: 'pick_mode', label: '拣货模式', width: 100 },
{ prop: 'source', label: '来源', width: 90 },
{ prop: 'wave_count', label: '波次数', width: 90 },
{ prop: 'order_count', label: '订单数', width: 90 },
{ prop: 'box_count', label: '箱数', width: 110 },
{ prop: 'operator_name', label: '操作人', minWidth: 120 },
{ prop: 'pick_user_name', label: '拣货员', minWidth: 120 },
{ prop: 'review_user_name', label: '复核人', minWidth: 120 },
{ prop: 'current_cart_id', label: '当前车ID', width: 100 },
{ prop: 'current_cart_code_snapshot', label: '当前车编码', minWidth: 140 },
{ prop: 'device_id', label: '设备ID', minWidth: 140 },
{ prop: 'start_at', label: '开始时间', minWidth: 168 },
{ prop: 'finish_at', label: '完成时间', minWidth: 168 },
{ prop: 'review_start_time', label: '复核开始', minWidth: 168 },
{ prop: 'review_finish_time', label: '复核完成', minWidth: 168 },
{ prop: 'created_at', label: '创建时间', minWidth: 168 },
{ prop: 'update_time', label: '更新时间', minWidth: 168 },
{ prop: 'operation', label: '操作', width: 220, fixed: 'right' }
])
export function formatPickTaskStatus(value: unknown): string {
const num = Number(value)
if (num === 0) return '待开始'

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,496 @@
<template>
<div class="entry-binding-relations">
<div class="header-actions">
<div class="left-actions">
<el-button size="small" :loading="loading" @click="loadBindingData">刷新</el-button>
</div>
<div class="right-actions">
<span class="summary-text">已绑定收货单 {{ receivingBindings.length }} 个</span>
<span class="summary-text">明细绑定 {{ itemBindingRows.length }} 条</span>
</div>
</div>
<div v-loading="loading" class="binding-content">
<section class="binding-section">
<div class="section-title">绑定的收货单</div>
<el-table
:data="receivingBindings"
border
stripe
size="small"
row-key="rowKey"
empty-text="暂无绑定的收货单"
max-height="220"
>
<el-table-column
v-for="col in entryReceivingBindingColumns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:min-width="col.minWidth"
show-overflow-tooltip
/>
<el-table-column label="操作" width="90" fixed="right" align="center">
<template #default="{ row }">
<el-button
link
type="primary"
size="small"
:loading="compareLoading && activeCompareReceivingId === row.receiving_id"
@click="loadComparePreview(row.receiving_id)"
>
对照
</el-button>
</template>
</el-table-column>
</el-table>
</section>
<!-- <section class="binding-section">
<div class="section-title">明细绑定关系</div>
<el-table
:data="itemBindingRows"
border
stripe
size="small"
row-key="rowKey"
empty-text="暂无明细绑定关系"
max-height="280"
>
<el-table-column
v-for="col in entryItemBindingDetailColumns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:min-width="col.minWidth"
:align="col.align"
show-overflow-tooltip
/>
</el-table>
</section> -->
<section v-if="comparePreview" v-loading="compareLoading" class="binding-section">
<div class="section-title">
对照预览
<span v-if="comparePreview.receiving_number" class="section-subtitle">
{{ comparePreview.receiving_number }}
</span>
</div>
<div v-if="compareSummaryItems.length" class="summary-grid">
<div
v-for="item in compareSummaryItems"
:key="item.key"
class="summary-card"
:class="`summary-card--${item.cardType}`"
>
<div class="summary-value">{{ item.value }}</div>
<div class="summary-label">{{ item.label }}</div>
</div>
</div>
<el-table
:data="compareRows"
border
stripe
size="small"
row-key="rowKey"
empty-text="暂无对照数据"
max-height="260"
>
<el-table-column
v-for="col in entryBindingCompareColumns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:min-width="col.minWidth"
:align="col.align"
show-overflow-tooltip
>
<template v-if="col.prop === 'match_status_label'" #default="{ row }">
<el-tag size="small" :type="getReceivingCompareStatusTagType(row.match_status)">
{{ row.match_status_label }}
</el-tag>
</template>
</el-table-column>
</el-table>
</section>
</div>
</div>
</template>
<script setup lang="ts">
import { computed, ref, watch, onActivated } from 'vue'
import { ElMessage } from 'element-plus'
import {
getEntryDetail,
receivingCompare,
type EntryAvailableReceivingDetail,
type EntryDetailItem,
type EntryOrderReceivingBinding,
type ReceivingCompareResponse,
type ReceivingCompareRow,
} from '@/api/storage.entry/entry'
import { formatDateTime } from '@/views/storage/receiving/receiving-config'
import {
buildReceivingCompareSummaryItems,
entryBindingCompareColumns,
entryItemBindingDetailColumns,
entryReceivingBindingColumns,
formatEntryBindingStatus,
formatReceivingCompareStatus,
formatReceivingOrderStatusLabel,
getReceivingCompareStatusTagType,
} from '../entry-config'
type ReceivingBindingRow = {
rowKey: string
receiving_id?: number
receiving_number: string
status_label: string
created_at: string
}
type ItemBindingRow = {
rowKey: string
warehouse_item_code: string
warehouse_item_name: string
entry_plan_qty: string | number
receiving_number: string
product_name: string
actual_quantity: string | number
receiving_allocated: string | number
available_quantity: string | number
binding_status_label: string
}
type ComparePreviewRow = {
rowKey: string
match_status?: string
match_status_label: string
item_name: string
entry_plan_qty: string | number
receiving_qty: string | number
receiving_allocated: string | number
}
const props = defineProps<{
id?: string | number
row?: Record<string, unknown> | null
entryDetailRefreshTick?: number
}>()
const loading = ref(false)
const compareLoading = ref(false)
const receivingBindings = ref<ReceivingBindingRow[]>([])
const itemBindingRows = ref<ItemBindingRow[]>([])
const comparePreview = ref<ReceivingCompareResponse | null>(null)
const activeCompareReceivingId = ref<number | null>(null)
const compareSummaryItems = computed(() =>
buildReceivingCompareSummaryItems(comparePreview.value?.summary as Record<string, unknown> | undefined)
)
const compareRows = computed<ComparePreviewRow[]>(() => {
if (!comparePreview.value) return []
const records = [
...(comparePreview.value.comparison ?? []),
...(comparePreview.value.entry_only ?? []),
...(comparePreview.value.receiving_only ?? []),
]
return records.map((record, index) => mapCompareRow(record, index))
})
watch(
() => [props.id, props.entryDetailRefreshTick] as const,
() => {
comparePreview.value = null
activeCompareReceivingId.value = null
if (props.id) {
void loadBindingData()
} else {
receivingBindings.value = []
itemBindingRows.value = []
}
},
{ immediate: true }
)
onActivated(() => {
if (props.id) {
void loadBindingData()
}
})
function isApiSuccess(res: { code?: number; flag?: string } | null | undefined): boolean {
if (!res) return false
if (res.code === 200 || res.code === 1) return true
return res.flag === 'success'
}
function pickText(row: Record<string, unknown>, keys: string[], fallback = '—'): string {
for (const key of keys) {
const val = row[key]
if (val !== null && val !== undefined && val !== '') return String(val)
}
return fallback
}
function pickQty(row: Record<string, unknown>, keys: string[]): string | number {
for (const key of keys) {
const val = row[key]
if (val !== null && val !== undefined && val !== '') return val as string | number
}
return '—'
}
function formatCell(value: unknown): string | number {
if (value === null || value === undefined || value === '') return '—'
return value as string | number
}
function mapReceivingBindingRow(binding: EntryOrderReceivingBinding, index: number): ReceivingBindingRow {
const receiving = (binding.receiving ?? {}) as Record<string, unknown>
const receivingId = Number(binding.receiving_id ?? receiving.id)
const status = receiving.status ?? receiving.storage_status
return {
rowKey: `recv-${binding.id ?? receivingId ?? index}`,
receiving_id: Number.isFinite(receivingId) && receivingId > 0 ? receivingId : undefined,
receiving_number: pickText(receiving, ['receiving_number'], `#${binding.receiving_id ?? index + 1}`),
status_label: formatReceivingOrderStatusLabel(status) || '—',
created_at: receiving.created_at ? formatDateTime(receiving.created_at) : '—',
}
}
function mapItemBindingRow(
item: EntryDetailItem,
detail: EntryAvailableReceivingDetail,
itemIndex: number,
detailIndex: number
): ItemBindingRow {
const raw = detail as Record<string, unknown>
const allocated = raw.receiving_allocated ?? raw.allocated_quantity
const bindingStatus = raw.binding_status ?? raw.status
return {
rowKey: `${item.id ?? itemIndex}-${raw.receiving_detail_id ?? detailIndex}`,
warehouse_item_code: pickText(item as Record<string, unknown>, ['warehouse_item_code']),
warehouse_item_name: pickText(item as Record<string, unknown>, ['warehouse_item_name', 'item_name']),
entry_plan_qty: formatCell(item.count ?? item.total_planned),
receiving_number: pickText(raw, ['receiving_number']),
product_name: pickText(raw, ['product_name', 'warehouse_item_name', 'item_name']),
actual_quantity: formatCell(raw.actual_quantity),
receiving_allocated: formatCell(allocated),
available_quantity: formatCell(raw.available_quantity),
binding_status_label: formatEntryBindingStatus(bindingStatus),
}
}
function buildItemBindingRows(items: EntryDetailItem[]): ItemBindingRow[] {
const rows: ItemBindingRow[] = []
items.forEach((item, itemIndex) => {
const details = Array.isArray(item.available_receiving_details)
? item.available_receiving_details
: []
details.forEach((detail, detailIndex) => {
rows.push(mapItemBindingRow(item, detail, itemIndex, detailIndex))
})
})
return rows
}
function mapCompareRow(record: ReceivingCompareRow, index: number): ComparePreviewRow {
const raw = record as Record<string, unknown>
const matchStatus = String(raw.match_status ?? '').trim().toLowerCase()
return {
rowKey: `cmp-${index}-${matchStatus || 'row'}`,
match_status: matchStatus,
match_status_label: formatReceivingCompareStatus(raw.match_status),
item_name: pickText(raw, ['item_name', 'warehouse_item_name', 'product_name']),
entry_plan_qty: pickQty(raw, ['entry_plan_qty', 'plan_qty', 'count']),
receiving_qty: pickQty(raw, ['receiving_qty', 'receiving_quantity', 'actual_quantity', 'quantity']),
receiving_allocated: pickQty(raw, ['receiving_allocated', 'allocated_quantity']),
}
}
async function loadBindingData() {
const entryOrderId = Number(props.id)
if (!Number.isFinite(entryOrderId) || entryOrderId <= 0) {
receivingBindings.value = []
itemBindingRows.value = []
return
}
loading.value = true
try {
const res = await getEntryDetail({ id: entryOrderId })
if (!isApiSuccess(res)) {
throw new Error(res?.message || '获取绑定关系失败')
}
const entryOrder = res.entryOrder ?? res.data?.entryOrder
if (!entryOrder) {
throw new Error('入库单数据为空')
}
const bindings = Array.isArray(entryOrder.receivingBindings) ? entryOrder.receivingBindings : []
receivingBindings.value = bindings.map(mapReceivingBindingRow)
itemBindingRows.value = buildItemBindingRows(
Array.isArray(entryOrder.items) ? entryOrder.items : []
)
} catch (error) {
console.error('获取绑定关系失败:', error)
ElMessage.error('获取绑定关系失败')
receivingBindings.value = []
itemBindingRows.value = []
} finally {
loading.value = false
}
}
async function loadComparePreview(receivingId?: number) {
const entryOrderId = Number(props.id)
const normalizedReceivingId = Number(receivingId)
if (!Number.isFinite(entryOrderId) || entryOrderId <= 0) return
if (!Number.isFinite(normalizedReceivingId) || normalizedReceivingId <= 0) return
activeCompareReceivingId.value = normalizedReceivingId
compareLoading.value = true
try {
const res = await receivingCompare({
entry_order_id: entryOrderId,
receiving_id: normalizedReceivingId,
})
if (!isApiSuccess(res)) {
throw new Error(res?.message || '加载对照预览失败')
}
comparePreview.value =
res.data && typeof res.data === 'object' ? ({ ...res, ...res.data } as ReceivingCompareResponse) : res
} catch (error) {
console.error('加载对照预览失败:', error)
ElMessage.error('加载对照预览失败')
comparePreview.value = null
} finally {
compareLoading.value = false
}
}
defineExpose({
reload: loadBindingData,
})
</script>
<style scoped lang="scss">
.entry-binding-relations {
display: flex;
flex-direction: column;
height: 100%;
background: #fff;
.header-actions {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 10px;
border-bottom: 1px solid #ebeef5;
margin-bottom: 10px;
.left-actions {
display: flex;
gap: 8px;
}
.right-actions {
display: flex;
align-items: center;
gap: 12px;
}
.summary-text {
font-size: 12px;
color: #606266;
}
}
.binding-content {
flex: 1;
min-height: 0;
overflow: auto;
display: flex;
flex-direction: column;
gap: 14px;
-ms-overflow-style: none;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
.binding-section {
.section-title {
margin-bottom: 8px;
font-size: 13px;
font-weight: 600;
color: #303133;
line-height: 1.4;
}
.section-subtitle {
margin-left: 8px;
font-size: 12px;
font-weight: 400;
color: #909399;
}
}
.summary-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: 8px;
margin-bottom: 10px;
}
.summary-card {
padding: 8px 10px;
border: 1px solid #ebeef5;
border-radius: 4px;
background: #fafafa;
.summary-value {
font-size: 16px;
font-weight: 600;
line-height: 1.2;
color: #303133;
}
.summary-label {
margin-top: 4px;
font-size: 11px;
color: #909399;
}
&--success {
background: #f0f9eb;
border-color: #e1f3d8;
}
&--warning {
background: #fdf6ec;
border-color: #faecd8;
}
&--danger {
background: #fef0f0;
border-color: #fde2e2;
}
&--primary {
background: #ecf5ff;
border-color: #d9ecff;
}
}
}
</style>

View File

@ -172,6 +172,15 @@ export const availableFields: EntryScanFieldConfig[] = [
{ label: '失败', value: 'FAIL' },
]
}) as EntryScanFieldConfig,
scanWorkflowField({
label: '收货绑定',
value: 'hasReceiving',
type: 'select',
options: [
{ label: '已绑定', value: true },
{ label: '未绑定', value: false },
]
}) as EntryScanFieldConfig,
]
export const entryColums = [
@ -183,6 +192,8 @@ export const entryColums = [
{ prop: 'purchase_order_code',label:'单据编号 ',width:'160' },
{ prop: 'total_order_lines',label:'商品数',width:'160', sortable: 'custom' },
{ prop: 'order_status',label:'订单状态',width:'160' },
{ prop: 'hasReceiving', label: '收货绑定', width: '100', align: 'center' },
{ prop: 'receivingBindings', label: '绑定收货单', minWidth: '180' },
{ prop: 'sync_status',label:'入库状态',width:'160' },
{ prop: 'supplier_code',label:'供应商编码',width:'160' },
{ prop: 'supplier_name',label:'供应商名称',width:'160' },
@ -200,6 +211,7 @@ export const entryColums = [
{ prop: 'remark',label:'备注',width:'160' },
// { prop: '',label:'',width:'160',fixed: 'left' },
// { prop: '',label:'',width:'160',fixed: 'left' },
{ prop: 'row_action', label: '操作', width: '80', fixed: 'right' },
]
const entryInventoryTypeLabelMap: Record<string, string> = {
@ -306,6 +318,143 @@ export function canDirectInboundOperate(status: unknown): boolean {
return !['COMPLETED', 'CANCELLED'].includes(upper) && upper !== '已完成' && upper !== '已作废'
}
/** 是否允许绑定收货(未完成、未作废) */
export function canBindEntryOrder(status: unknown): boolean {
return canDirectInboundOperate(status)
}
/** storage.entry.list 虚拟 where 字段(需原样传 boolean,不能包 operator) */
export const entryListVirtualWhereFields = ['hasReceiving'] as const
export function parseEntryListVirtualBoolean(value: unknown): boolean | undefined {
if (value === true || value === false) return value
if (value === 'true' || value === 1 || value === '1') return true
if (value === 'false' || value === 0 || value === '0') return false
if (value && typeof value === 'object' && 'value' in (value as object)) {
return parseEntryListVirtualBoolean((value as { value: unknown }).value)
}
return undefined
}
export function finalizeEntryListWhere(where: Record<string, unknown>): Record<string, unknown> {
const result = { ...where }
entryListVirtualWhereFields.forEach((key) => {
if (!(key in result)) return
const parsed = parseEntryListVirtualBoolean(result[key])
if (parsed === undefined) {
delete result[key]
} else {
result[key] = parsed
}
})
return result
}
export function resolveEntryHasReceiving(row: {
hasReceiving?: boolean
receivingBindings?: unknown
}): boolean {
if (typeof row.hasReceiving === 'boolean') return row.hasReceiving
return Array.isArray(row.receivingBindings) && row.receivingBindings.length > 0
}
export function formatEntryHasReceiving(
value: unknown,
row?: { hasReceiving?: boolean; receivingBindings?: unknown }
): string {
if (typeof value === 'boolean') return value ? '已绑定' : '未绑定'
if (row) return resolveEntryHasReceiving(row) ? '已绑定' : '未绑定'
return '未绑定'
}
export function getEntryHasReceivingTagType(
value: unknown,
row?: { hasReceiving?: boolean; receivingBindings?: unknown }
): string {
const hasBound =
typeof value === 'boolean' ? value : row ? resolveEntryHasReceiving(row) : false
return hasBound ? 'success' : 'info'
}
export function formatReceivingBindingsSummary(bindings: unknown): string {
if (!Array.isArray(bindings) || !bindings.length) return '—'
const numbers = bindings
.map((item) => {
const binding = item as Record<string, unknown>
const receiving = (binding.receiving ?? {}) as Record<string, unknown>
const number = receiving.receiving_number ?? binding.receiving_number
return number ? String(number) : ''
})
.filter(Boolean)
if (!numbers.length) return `${bindings.length} 个`
if (numbers.length <= 2) return numbers.join('、')
return `${numbers.slice(0, 2).join('、')} 等 ${numbers.length} 个`
}
/** 货单绑定弹窗 — 收货单列表展示列 */
export const entryBindReceivingListColumns = [
{ prop: 'receiving_number', label: '收货单号', minWidth: 140 },
{ prop: 'created_at', label: '创建时间', width: 160 },
]
/** 货单绑定弹窗 — 对照表分组表头(名称 / 数量) */
export const entryBindCompareGroupHeaders = [
{ key: 'name_group', label: '名称', span: 2 },
{ key: 'qty_group', label: '数量', span: 2 },
] as const
/** 货单绑定弹窗 — 四列对照表头(名称组:入库/收货,数量组:入库/收货) */
export const entryBindCompareColumnHeaders = [
{ key: 'entry_name', label: '入库单 · 名称' },
{ key: 'receiving_name', label: '收货单 · 名称' },
{ key: 'entry_qty', label: '入库单 · 数量' },
{ key: 'receiving_qty', label: '收货单 · 数量' },
] as const
/** 绑定关系 — 主表已绑定收货单 */
export const entryReceivingBindingColumns = [
{ prop: 'receiving_number', label: '收货单号', minWidth: 150 },
{ prop: 'status_label', label: '状态', width: 100 },
{ prop: 'created_at', label: '创建时间', width: 160 },
] as const
/** 绑定关系 — 明细级 available_receiving_details */
export const entryItemBindingDetailColumns = [
{ prop: 'warehouse_item_code', label: '商品编码', minWidth: 120 },
{ prop: 'warehouse_item_name', label: '商品名称', minWidth: 140 },
{ prop: 'entry_plan_qty', label: '计划数量', width: 90, align: 'right' },
{ prop: 'receiving_number', label: '收货单号', minWidth: 130 },
{ prop: 'product_name', label: '收货商品', minWidth: 130 },
{ prop: 'actual_quantity', label: '收货数量', width: 90, align: 'right' },
{ prop: 'receiving_allocated', label: '已分配', width: 90, align: 'right' },
{ prop: 'available_quantity', label: '可用量', width: 90, align: 'right' },
{ prop: 'binding_status_label', label: '绑定状态', width: 100 },
] as const
/** 绑定关系 — receivingCompare 对照预览 */
export const entryBindingCompareColumns = [
{ prop: 'match_status_label', label: '匹配', width: 90, align: 'center' },
{ prop: 'item_name', label: '商品名称', minWidth: 140 },
{ prop: 'entry_plan_qty', label: '入库应收', width: 90, align: 'right' },
{ prop: 'receiving_qty', label: '收货数量', width: 90, align: 'right' },
{ prop: 'receiving_allocated', label: '已分配', width: 90, align: 'right' },
] as const
export function formatEntryBindingStatus(status: unknown): string {
if (status === null || status === undefined || status === '') return '—'
const key = String(status).trim().toLowerCase()
const map: Record<string, string> = {
pending: '待入库',
bound: '已绑定',
allocated: '已分配',
completed: '已完成',
cancelled: '已作废',
canceled: '已作废',
active: '有效',
}
return map[key] || String(status)
}
export function formatDirectInboundDateTime(
row: unknown,
_col?: unknown,

View File

@ -59,7 +59,6 @@
:table-size="tableSize"
:pagination="pagination"
:show-index="true"
:show-actions="true"
:show-selection="true"
:loading="loading"
:queryTime="queryTime"
@ -76,6 +75,18 @@
</el-tag>
</template>
<template #column-hasReceiving="{ row }">
<el-tag size="small" :type="getEntryHasReceivingTagType(row.hasReceiving, row)">
{{ formatEntryHasReceiving(row.hasReceiving, row) }}
</el-tag>
</template>
<template #column-receivingBindings="{ row }">
<span :title="formatReceivingBindingsSummary(row.receivingBindings)">
{{ formatReceivingBindingsSummary(row.receivingBindings) }}
</span>
</template>
<template #column-order_type="{ row }">
<span>{{ translateEntryField('order_type', row.order_type) }}</span>
</template>
@ -104,6 +115,18 @@
</el-tag>
</template>
<template #column-row_action="{ row }">
<el-button
v-if="canBindEntryOrder(row.order_status)"
link
type="primary"
size="small"
@click.stop="openBindDialog(row)"
>
绑定
</el-button>
</template>
<template #empty>
<div class="empty-tip">暂无入库单</div>
</template>
@ -119,8 +142,9 @@
<div v-if="selectedEntryId" class="lower-level" :class="tableSize" :style="lowerPaneStyle">
<div class="detail-header">
<el-tabs v-model="activeTab" class="detail-tab">
<el-tab-pane label="收货对照" name="operate" />
<!-- <el-tab-pane label="收货对照" name="operate" /> -->
<el-tab-pane label="入库明细" name="details" />
<el-tab-pane label="绑定关系" name="bindingRelations" />
<el-tab-pane label="入库记录" name="directInboundLogs" />
<el-tab-pane label="操作日志" name="logs" />
</el-tabs>
@ -167,6 +191,13 @@
/>
</el-dialog>
<BindReceivingToEntryDialog
v-model="bindDialogVisible"
:row="bindTargetRow"
@closed="handleBindDialogClosed"
@success="handleBindDialogSuccess"
/>
<!-- 新建入库单对话框 -->
<el-dialog
v-model="createDialogVisible"
@ -215,6 +246,11 @@ import {
getEntryOrderStatusTagType,
isPendingEntryOrderStatus,
canQuickInbound,
canBindEntryOrder,
finalizeEntryListWhere,
formatEntryHasReceiving,
formatReceivingBindingsSummary,
getEntryHasReceivingTagType,
translateEntryField
} from './entry-config'
@ -222,7 +258,9 @@ import entrydetail from './component/entrydetail.vue'
import log from './component/log.vue'
import entryoperate from './component/entryoperate.vue'
import QuickInboundForm from './component/QuickInboundForm.vue'
import BindReceivingToEntryDialog from './component/BindReceivingToEntryDialog.vue'
import DirectInboundLogs from './component/DirectInboundLogs.vue'
import EntryBindingRelations from './component/EntryBindingRelations.vue'
import ExportModeDropdown from '@/components/ExportModeDropdown.vue'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { useSettingsStore } from '@/stores/modules/settings'
@ -304,6 +342,7 @@ const currentSort = reactive({ prop: '', order: '' })
const componentMap: Record<string, any> = {
details: entrydetail,
bindingRelations: EntryBindingRelations,
directInboundLogs: DirectInboundLogs,
logs: log,
operate: entryoperate
@ -318,6 +357,26 @@ const selectedRow = computed(() => {
const quickInboundDialogVisible = ref(false)
const quickInboundTarget = ref<any>(null)
const bindDialogVisible = ref(false)
const bindTargetRow = ref<any>(null)
function openBindDialog(row: any) {
if (!canBindEntryOrder(row?.order_status)) return
bindTargetRow.value = row
bindDialogVisible.value = true
}
function handleBindDialogClosed() {
bindTargetRow.value = null
}
async function handleBindDialogSuccess() {
bindDialogVisible.value = false
bindTargetRow.value = null
await loadData()
entryDetailRefreshTick.value += 1
}
function translateField(fieldValue: string, value: any) {
return translateEntryField(fieldValue, value)
}
@ -389,7 +448,7 @@ function normalizeToWhere(condition: any) {
const result = processConditionValue(k, condition.conditions[k])
if (result) where[k] = result
})
return where
return finalizeEntryListWhere(where)
}
// 普通自定义条件对象
@ -399,10 +458,10 @@ function normalizeToWhere(condition: any) {
const result = processConditionValue(k, condition[k])
if (result) where[k] = result
})
return where
return finalizeEntryListWhere(where)
}
return {}
return finalizeEntryListWhere({})
}
function getSyncStatusType(status: string) {

View File

@ -323,6 +323,13 @@ const FALLBACK_FIELDS: NormalizedField[] = [
description:
'开启后允许按外部系统传入的快递编码进行处理(如无匹配仍以业务校验为准);默认关闭。'
},
{ key: 'sender_name', label: '默认发件人姓名', type: 'string', maxLength: 50 },
{ key: 'sender_tel', label: '默认发件人联系电话', type: 'string', maxLength: 20 },
{ key: 'province_name', label: '默认发件省份', type: 'string', maxLength: 50 },
{ key: 'city_name', label: '默认发件城市', type: 'string', maxLength: 50 },
{ key: 'district_name', label: '默认发件区/县', type: 'string', maxLength: 50 },
{ key: 'town_name', label: '默认发件镇/街道', type: 'string', maxLength: 50 },
{ key: 'address', label: '默认发件详细地址', type: 'string', maxLength: 200 },
{
key: 'auto_outbound_rules',
label: '自动出库规则',