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
@@ -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">