This commit is contained in:
2026-09-02 10:43:43 +08:00
parent 96467b9468
commit 28acf1174a
5 changed files with 54 additions and 7 deletions
@@ -177,11 +177,14 @@ onBeforeUnmount(() => {
<el-tab-pane label="其他记录" name="records" lazy>
<InboundHistoryPanel
:pallet-locations="detail.palletLocations"
:dropship-pallets="detail.dropshipPallets"
:customer-id="customerId"
:inbound-id="inboundId"
:files="detail.files"
:internal-notes="detail.internalNotes"
:status-history="[]"
:public-remark="detail.publicRemark"
:sections="['allocations', 'files', 'notes', 'remark']"
:sections="['dropship', 'allocations', 'files', 'notes', 'remark']"
/>
</el-tab-pane>
</el-tabs>
@@ -1,19 +1,25 @@
<script setup lang="ts">
import type { InboundFileSummary, InboundInternalNote, InboundPalletLocation, InboundStatusHistory } from './types'
import type { InboundDropshipPallet, InboundFileSummary, InboundInternalNote, InboundPalletLocation, InboundStatusHistory } from './types'
import { inboundHistoryActionLabel, inboundProcessStatusLabels, inboundStatusLabel } from '../status'
import { downloadDropshipPalletLabel } from './api'
import { ElMessage } from 'element-plus'
const props = withDefaults(defineProps<{
palletLocations: InboundPalletLocation[]
dropshipPallets?: InboundDropshipPallet[]
customerId?: string
inboundId?: string
files: InboundFileSummary[]
internalNotes: InboundInternalNote[]
statusHistory: InboundStatusHistory[]
publicRemark: string | null
sections?: Array<'allocations' | 'files' | 'notes' | 'history' | 'remark'>
sections?: Array<'dropship' | 'allocations' | 'files' | 'notes' | 'history' | 'remark'>
}>(), {
sections: () => ['allocations', 'files', 'notes', 'history', 'remark'],
dropshipPallets: () => [],
sections: () => ['dropship', 'allocations', 'files', 'notes', 'history', 'remark'],
})
function shows(section: 'allocations' | 'files' | 'notes' | 'history' | 'remark') {
function shows(section: 'dropship' | 'allocations' | 'files' | 'notes' | 'history' | 'remark') {
return props.sections.includes(section)
}
@@ -24,10 +30,24 @@ function date(value: string | null) {
const parsed = new Date(value)
return Number.isNaN(parsed.getTime()) ? value : parsed.toLocaleString('zh-CN', { hour12: false })
}
async function printPallet(pallet: InboundDropshipPallet) {
if (!props.customerId || !props.inboundId || !pallet.palletNo) return
try {
const blob = await downloadDropshipPalletLabel(props.customerId, props.inboundId, pallet.palletId)
const url = URL.createObjectURL(blob)
const link = document.createElement('a'); link.href = url; link.download = `${pallet.palletNo}-托盘唛.pdf`; link.click()
URL.revokeObjectURL(url)
} catch { ElMessage.error('托盘唛下载失败,请稍后重试') }
}
</script>
<template>
<div class="history-panel">
<section v-if="shows('dropship')" class="history-section">
<div class="section-heading"><h3>一件代发绑定托盘</h3><span>{{ dropshipPallets.length }} 个托盘</span></div>
<div v-if="dropshipPallets.length" class="simple-list"><div v-for="pallet in dropshipPallets" :key="pallet.palletId"><strong>{{ value(pallet.palletNo) }} · {{ pallet.cartonCount }} 箱 <el-button v-if="pallet.palletNo" link type="primary" @click="printPallet(pallet)">打印托盘唛</el-button></strong><span v-for="item in pallet.items" :key="`${pallet.palletId}-${item.inboundDetailId}`">{{ item.inboundCode }} · SKU {{ item.skuCode }} · {{ item.cartonCount }} 箱</span></div></div>
<p v-else class="muted-empty">暂无一件代发托盘绑定</p>
</section>
<section v-if="shows('allocations')" class="history-section">
<div class="section-heading"><h3>托盘与库位</h3><span>{{ palletLocations.length }} 条分配</span></div>
<div v-if="palletLocations.length" class="allocation-list">
+12
View File
@@ -99,6 +99,11 @@ function normalizeDetail(raw: InboundOrderDetail): InboundOrderDetail {
return {
...raw,
summary: normalizeInboundSummary(raw.summary),
dropshipPallets: (raw.dropshipPallets || []).map((pallet) => ({
...pallet,
palletId: id(pallet.palletId) || '',
items: (pallet.items || []).map((item) => ({ ...item, inboundId: id(item.inboundId) || '', inboundDetailId: id(item.inboundDetailId) || '' })),
})),
palletLocations: (raw.palletLocations || []).map(normalizePallet),
files: (raw.files || []).map(normalizeFile),
internalNotes: (raw.internalNotes || []).map(normalizeNote),
@@ -147,3 +152,10 @@ export async function downloadInboundCartonLabels(tenantId: string, inboundId: s
}
return response
}
export async function downloadDropshipPalletLabel(tenantId: string, inboundId: string, palletId: string) {
return http.get<Blob, Blob>(
`/platform/v1/first-leg/pda-dropship/inbound-orders/${encodeURIComponent(inboundId)}/pallets/${encodeURIComponent(palletId)}/print`,
{ params: { accountId: tenantId }, responseType: 'blob', timeout: 60_000 },
)
}
+12
View File
@@ -117,12 +117,24 @@ export interface InboundStatusHistory {
export interface InboundOrderDetail {
summary: InboundOrderSummary
publicRemark: string | null
dropshipPallets: InboundDropshipPallet[]
palletLocations: InboundPalletLocation[]
files: InboundFileSummary[]
internalNotes: InboundInternalNote[]
statusHistory: InboundStatusHistory[]
}
export interface InboundDropshipPallet {
palletId: string
palletNo: string | null
palletStatus: string
cartonCount: number
skuCount: number
version: number
items: Array<{ inboundId: string; inboundCode: string; inboundDetailId: string; skuCode: string; cargoName: string | null; cartonCount: number; cartonMarks: string[] }>
completedAt: string | null
}
export interface InboundPageResult {
records: InboundOrderSummary[]
page: number
+2 -2
View File
@@ -1,12 +1,12 @@
export const inboundProcessStatusLabels: Record<string, string> = {
WAIT_MEASURE: '待测量', MEASURING: '测量中', MEASURE_PENDING: '待测量审核', MEASURE_REJECTED: '测量已驳回',
WAIT_PRICING: '待计费', FEE_CONFIRMING: '费用处理中', INBOUNDING: '入库处理中', WAIT_SPLIT: '待分柜', VOIDED: '已作废',
WAIT_PRICING: '待计费', FEE_CONFIRMING: '费用处理中', INBOUNDING: '入库处理中', WAIT_PALLETIZE: '待一件代发合托', WAIT_SPLIT: '待分柜', VOIDED: '已作废',
}
export const inboundOrderStatusLabels: Record<string, string> = {
DRAFT: '草稿', SUBMITTED: '待审核', APPROVED: '已审核', ACCEPTED: '已受理', REJECTED: '已驳回',
PROCESSING: '处理中', COMPLETED: '已完成', CANCELLED: '已取消', PENDING_REVIEW: '待审核',
WAIT_MEASURE: '待测量', WAIT_SPLIT: '待分柜', LOADING: '装柜中',
WAIT_MEASURE: '待测量', WAIT_PALLETIZE: '待一件代发合托', WAIT_SPLIT: '待分柜', LOADING: '装柜中',
LOADED: '装柜完成', DELIVERED: '派送完成',
}