This commit is contained in:
yin 2026-07-11 18:17:37 +08:00
parent 51416d367e
commit 476f6c20a1
14 changed files with 244 additions and 193 deletions

Binary file not shown.

View File

@ -46,6 +46,7 @@ export type ComboGoodsCreateParams = {
combo_code: string
combo_name: string
warehouse_id?: number
store_id?: number
remark?: string
custom_code?: string
items: ComboGoodsCreateItem[]
@ -62,6 +63,7 @@ export type ComboGoodsUpdateParams = {
id: number
combo_name?: string
warehouse_id?: number
store_id?: number | null
remark?: string
custom_code?: string | null
status?: number

View File

@ -70,6 +70,7 @@ export default {
'shipperSigning':'货主签约',
'Productflow':'商品流水',
'Externalwarehouse':'外部仓库',
'StoreReport':'门店报告',
},
"login": {
"title": "登录",

View File

@ -1,3 +1,12 @@
/** 订单管理页面配置 */
export const ORDER_PAGE_CONFIG = {
/**
* 单页模式:开启后不显示标签切换区域,
* 直接展示默认页签(待处理订单)的内容
*/
singlePage: false
}
// 通用翻译映射
export const COMMON_TRANSLATIONS: Record<string, Record<string, string>> = {
is_urgency: {
@ -937,7 +946,7 @@ export const orderItemCompactColumns: OrderItemColumnConfig[] = [
{ prop: 'actual_price', label: '实付单价', width: 120, align: 'right', amount: true },
{ prop: 'retail_price', label: '零售单价', width: 120, align: 'right', amount: true },
{ prop: 'inventory_type', label: '库存类型', width: 100, align: 'center' },
{ prop: 'stock_id', label: '库存ID', width: 100, align: 'center' }
{ prop: 'stock_id', label: 'SKU', width: 100, align: 'center' }
]
/** 商品明细显示全部:对齐 data.json items 返回字段 */
@ -949,7 +958,7 @@ export const orderItemFullColumns: OrderItemColumnConfig[] = [
{ prop: 'item_code', label: '商品编码', minWidth: 140, showOverflowTooltip: true },
{ prop: 'item_name', label: '商品名称', minWidth: 180, showOverflowTooltip: true },
{ prop: 'item_id', label: '商品ID', width: 100, align: 'center' },
{ prop: 'stock_id', label: '库存ID', width: 100, align: 'center' },
{ prop: 'stock_id', label: 'SKU', width: 100, align: 'center' },
{ prop: 'plan_qty', label: '计划数量', width: 100, align: 'center' },
{ prop: 'actual_price', label: '实付单价', width: 120, align: 'right', amount: true },
{ prop: 'retail_price', label: '零售单价', width: 120, align: 'right', amount: true },

View File

@ -1,39 +1,45 @@
<template>
<div class="order-management-wrapper" :style="{ height: containerHeight }">
<div class="tabs-header-action">
<!-- <el-button size="small" @click="workbenchDialogVisible = true">统一查询</el-button> -->
<!-- <el-button size="small" @click="bindByWaybillDialogVisible = true">按运单绑定包材</el-button> -->
<el-button size="small" :loading="badgeLoading" @click="refreshBadgeCounts">刷新角标</el-button>
</div>
<el-tabs
v-model="activeTab"
@tab-change="handleTabChange"
tab-position="top"
type="border-card"
class="tab-container"
>
<!-- 使用 v-for 动态生成,确保每个标签都被创建 -->
<el-tab-pane
v-for="tab in tabs"
:key="tab.name"
:name="tab.name"
:lazy="false"
<!-- 多标签模式 -->
<template v-if="!singlePage">
<div class="tabs-header-action">
<!-- <el-button size="small" @click="workbenchDialogVisible = true">统一查询</el-button> -->
<!-- <el-button size="small" @click="bindByWaybillDialogVisible = true">按运单绑定包材</el-button> -->
<el-button size="small" :loading="badgeLoading" @click="refreshBadgeCounts">刷新角标</el-button>
</div>
<el-tabs
v-model="activeTab"
@tab-change="handleTabChange"
tab-position="top"
type="border-card"
class="tab-container"
>
<template #label>
<span class="custom-tab-label">
{{ tab.label }}
<el-badge
:value="tab.count"
:max="99"
:hidden="tab.count === 0"
class="tab-badge"
/>
</span>
</template>
<!-- 仅挂载当前标签页,切换时销毁子页以释放内存 -->
<component :is="tab.component" v-if="activeTab === tab.name" />
</el-tab-pane>
</el-tabs>
<el-tab-pane
v-for="tab in tabs"
:key="tab.name"
:name="tab.name"
:lazy="false"
>
<template #label>
<span class="custom-tab-label">
{{ tab.label }}
<el-badge
:value="tab.count"
:max="99"
:hidden="tab.count === 0"
class="tab-badge"
/>
</span>
</template>
<component :is="tab.component" v-if="activeTab === tab.name" />
</el-tab-pane>
</el-tabs>
</template>
<!-- 单页模式:直接渲染默认页签组件 -->
<div v-else class="tab-container single-page-container">
<component :is="defaultTab.component" />
</div>
<order-workbench-list-dialog v-model="workbenchDialogVisible" />
<BindPackageMaterialByWaybillDialog v-model="bindByWaybillDialogVisible" />
@ -56,10 +62,12 @@ import ArchiveOrder from './archiveOrder.vue'
import OrderWorkbenchListDialog from './component/OrderWorkbenchListDialog.vue'
import BindPackageMaterialByWaybillDialog from './component/BindPackageMaterialByWaybillDialog.vue'
import { safeInvoke } from '@/utils/safe-invoke'
import { ORDER_PAGE_CONFIG } from './config/order-common-config'
const route = useRoute()
const router = useRouter()
const settingsStore = useSettingsStore()
const singlePage = ORDER_PAGE_CONFIG.singlePage
const badgeLoading = ref(false)
const workbenchDialogVisible = ref(false)
const bindByWaybillDialogVisible = ref(false)
@ -67,6 +75,9 @@ const bindByWaybillDialogVisible = ref(false)
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
/** 单页模式下使用的默认标签(始终为 tabs 第一项) */
const defaultTab = computed(() => tabs.value[0]!)
const activeTab = ref('pendingOrder')
type OrderTabItem = {
name: string
@ -324,4 +335,20 @@ const handleTabChange = (tabName: string | number) => {
background-color: #f56c6c;
}
}
/* ========== 单页模式 ========== */
.single-page-container {
background: #fff;
border: 1px solid #e8eef7;
border-radius: 6px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
overflow: hidden;
:deep(> *) {
flex: 1;
overflow: auto;
min-height: 0;
}
}
</style>

View File

@ -1,3 +1,12 @@
/** 波次管理页面配置 */
export const WAVE_PAGE_CONFIG = {
/**
* 单页模式:开启后不显示「团购波次」「散单波次」等标签切换区域,
* 直接展示默认页签(团购波次)的内容
*/
singlePage: false
}
import {
buyerMessageHasFilterOptions,
scanBasicField,

View File

@ -1,6 +1,8 @@
<template>
<div class="order-management-wrapper" :style="{ height: containerHeight }">
<!-- 多标签模式 -->
<el-tabs
v-if="!singlePage"
v-model="activeTab"
@tab-change="handleTabChange"
tab-position="top"
@ -26,6 +28,17 @@
</keep-alive>
</el-tab-pane>
</el-tabs>
<!-- 单页模式:直接渲染默认页签组件,复用 .tab-container 样式结构 -->
<div v-else class="tab-container single-page-container">
<keep-alive>
<component
:is="defaultTab.component"
:key="defaultTab.name"
v-bind="defaultTab.props || {}"
/>
</keep-alive>
</div>
</div>
</template>
@ -39,13 +52,21 @@ import FallbackOrderListPanel from './FallbackOrderListPanel.vue'
import WaveStrategyListPanel from './WaveStrategyListPanel.vue'
import WavePickTaskListPanel from './WavePickTaskListPanel.vue'
import { safeInvoke } from '@/utils/safe-invoke'
import { WAVE_PAGE_CONFIG } from './config/wave-config'
const route = useRoute()
const router = useRouter()
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
const singlePage = WAVE_PAGE_CONFIG.singlePage
const containerHeight = computed(() => {
const baseH = shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
return baseH
})
/** 单页模式下使用的默认标签(始终为 tabs 第一项) */
const defaultTab = computed(() => tabs.value[0]!)
const activeTab = ref('groupWave')
@ -216,4 +237,25 @@ const handleTabChange = (tabName: string | number) => {
align-items: center;
gap: 6px;
}
/* ========== 单页模式 ========== */
/*
* 单页模式:复用 .tab-container 的 flex 布局,但不渲染 el-tabs,
* 直接嵌入子组件。该容器模拟 el-tabs--border-card 的卡片外观,
* 保留上下白色分隔线,仅隐藏标签头和灰色标签区域。
*/
.single-page-container {
background: #fff;
border: 1px solid #e8eef7;
border-radius: 6px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
overflow: hidden;
:deep(> *) {
flex: 1;
overflow: auto;
min-height: 0;
}
}
</style>

View File

@ -44,6 +44,24 @@
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="货主" prop="store_id">
<el-select
v-model="formData.store_id"
placeholder="请选择货主"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="store in storeOptions"
:key="store.value"
:label="store.label"
:value="store.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col v-if="mode === 'edit'" :span="12">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="formData.status">
@ -104,7 +122,7 @@
</el-table-column>
</el-table>
<ComboStockPickerDialog v-model="pickerVisible" @confirm="handlePickItems" />
<ComboStockPickerDialog v-model="pickerVisible" :store-id="formData.store_id" @confirm="handlePickItems" />
<template #footer>
<el-button @click="visible = false">取消</el-button>
@ -114,10 +132,11 @@
</template>
<script setup lang="ts">
import { reactive, ref, watch } from 'vue'
import { onMounted, reactive, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
import { comboGoodsCreate, comboGoodsUpdate } from '@/api/combogoods/combogoods'
import * as indexApi from '@/api/index/index'
import ComboStockPickerDialog, {
type ComboStockPickerItem
} from './ComboStockPickerDialog.vue'
@ -127,6 +146,10 @@ import {
type ComboGoodsItemRow,
type ComboGoodsRecord
} from '../combo-stock-config'
import {
extractStoreListFromResponse,
mapStoreListToSelectOptions
} from '@/views/order/orderManagement/config/order-common-config'
const visible = defineModel<boolean>({ default: false })
@ -137,6 +160,17 @@ const props = defineProps<{
const emit = defineEmits<{ success: [] }>()
const storeOptions = ref<Array<{ label: string; value: number | string }>>([])
async function loadStoreOptions() {
try {
const res: any = await indexApi.loadStores({ type: 'stock' })
storeOptions.value = mapStoreListToSelectOptions(extractStoreListFromResponse(res))
} catch {
// 货主列表加载失败不影响主流程
}
}
const formRef = ref<FormInstance>()
const saving = ref(false)
const pickerVisible = ref(false)
@ -148,6 +182,7 @@ const formData = reactive({
combo_name: '',
custom_code: '',
warehouse_id: undefined as number | undefined,
store_id: undefined as number | undefined,
remark: '',
status: 1
})
@ -161,6 +196,7 @@ watch(
() => visible.value,
(opened) => {
if (!opened) return
loadStoreOptions()
if (props.mode === 'edit' && props.record) {
fillFromRecord(props.record)
return
@ -186,6 +222,10 @@ function fillFromRecord(record: ComboGoodsRecord) {
record.warehouse_id != null && Number(record.warehouse_id) > 0
? Number(record.warehouse_id)
: undefined
formData.store_id =
record.store_id != null && Number(record.store_id) > 0
? Number(record.store_id)
: undefined
formData.remark = record.remark || ''
formData.status = record.status === 0 ? 0 : 1
formItems.value = mapComboGoodsItemsFromRecord(record.items)
@ -198,6 +238,7 @@ function resetForm() {
formData.combo_name = ''
formData.custom_code = ''
formData.warehouse_id = undefined
formData.store_id = undefined
formData.remark = ''
formData.status = 1
formItems.value = []
@ -287,6 +328,9 @@ async function submitForm() {
if (formData.warehouse_id != null && formData.warehouse_id > 0) {
payload.warehouse_id = formData.warehouse_id
}
if (formData.store_id != null && formData.store_id > 0) {
payload.store_id = formData.store_id
}
const res = await comboGoodsCreate(payload as any)
if (!isComboGoodsApiSuccess(res)) {
ElMessage.error((res as any)?.message || '新增失败')
@ -309,6 +353,11 @@ async function submitForm() {
} else {
payload.warehouse_id = null
}
if (formData.store_id != null && formData.store_id > 0) {
payload.store_id = formData.store_id
} else {
payload.store_id = null
}
const res = await comboGoodsUpdate(payload as any)
if (!isComboGoodsApiSuccess(res)) {
ElMessage.error((res as any)?.message || '更新失败')

View File

@ -82,6 +82,13 @@ export type ComboStockPickerItem = {
const PICKER_LIST_PAGE_SIZE = 50
const visible = defineModel<boolean>({ default: false })
const props = withDefaults(defineProps<{
storeId?: number
}>(), {
storeId: undefined
})
const emit = defineEmits<{ confirm: [items: ComboStockPickerItem[]] }>()
const loading = ref(false)
@ -128,7 +135,11 @@ function mapRows(rawList: unknown[]): ComboStockPickerItem[] {
async function loadInitialList() {
loading.value = true
try {
const res: any = await stockWarehouse({ page: 1, pageSize: PICKER_LIST_PAGE_SIZE }, {})
const where: Record<string, unknown> = {}
if (props.storeId) {
where.store_id = props.storeId
}
const res: any = await stockWarehouse({ page: 1, pageSize: PICKER_LIST_PAGE_SIZE }, where)
if (!isComboGoodsApiSuccess(res)) {
list.value = []
ElMessage.error(res?.message || '获取商品列表失败')
@ -152,7 +163,11 @@ async function handleSearch() {
}
loading.value = true
try {
const res: any = await warehouseSearch({ keyword: text })
const params: { keyword: string; store_id?: number } = { keyword: text }
if (props.storeId) {
params.store_id = props.storeId
}
const res: any = await warehouseSearch(params)
if (!isStockApiSuccess(res)) {
list.value = []
ElMessage.error(res?.message || '搜索商品失败')

View File

@ -51,13 +51,13 @@
</div>
<!-- 库存汇总 -->
<div class="summary-bar" v-if="summary">
<!-- <div class="summary-bar" v-if="summary">
<span>总库存 <b>{{ summary.total_quantity ?? 0 }}</b></span>
<span class="summary-divider">|</span>
<span>锁定库存 <b>{{ summary.total_locked ?? 0 }}</b></span>
<span class="summary-divider">|</span>
<span>可用库存 <b>{{ summary.total_available ?? 0 }}</b></span>
</div>
</div> -->
<div class="split-stack" ref="splitStackRef">
<div class="upper-wrapper" :style="upperPaneStyle">

View File

@ -123,7 +123,6 @@ const detailColumns = computed(() => {
{ prop: 'production_date', label: '生产日期', width: '140' },
{ prop: 'expiry_date', label: '到期日期', width: '140' },
{ prop: 'space_code', label: '库位', width: '140' },
{ prop: 'inventory_type', label: '库存类型', width: '100' },
{ prop: 'quantity', label: '总数量', width: '100' },
{ prop: 'available_quantity', label: '可用数量', width: '100' },
{ prop: 'locked_quantity', label: '锁定数量', width: '100' }
@ -134,7 +133,6 @@ const detailColumns = computed(() => {
{ prop: 'item_code', label: '商品编码', width: '140' },
{ prop: 'item_name', label: '商品名称', width: '200' },
{ prop: 'space_code', label: '库位', width: '140' },
{ prop: 'inventory_type', label: '库存类型', width: '100' },
{ prop: 'quantity', label: '总数量', width: '100' },
{ prop: 'available_quantity', label: '可用数量', width: '100' },
{ prop: 'locked_quantity', label: '锁定数量', width: '100' },

View File

@ -65,36 +65,6 @@
</span>
</template>
<template #column-expiry_remaining_days="{ row }">
<span :class="{ 'expiry-date-expired': row.is_shelf_life_warning_triggered }">
{{ row.expiry_remaining_days ?? '--' }}
</span>
</template>
<template #column-inventory_warning_level="{ row }">
<span class="inventory-warning-level" :style="{ color: row.inventory_warning_color || '#909399' }">
{{ row.inventory_warning_level || '--' }}
</span>
</template>
<template #column-inventory_warning_tip_text="{ row }">
<span>{{ row.inventory_warning_tip_text || '--' }}</span>
</template>
<template #column-shelf_life_days="{ row }">
<span>{{ row.shelf_life_days ?? '--' }}</span>
</template>
<template #column-sale_ban_period="{ row }">
<span>{{ row.sale_ban_period ?? '--' }}</span>
</template>
<template #column-order_status="{ row }">
<el-tag v-if="row.order_status" size="small" :type="orderStatusTagType(row.order_status)">
{{ orderStatusLabel(row.order_status) }}
</el-tag>
</template>
<template #column-is_batch_mgmt_enabled="{ row }">
<div style="text-align:center">
<el-tag :type="isInventoryFlagEnabled(row.is_batch_mgmt_enabled) ? 'success' : 'info'" size="small">
@ -119,20 +89,10 @@
<span>{{ row.first_inbound_time || '--' }}</span>
</template>
<template #column-inventory_type="{ row }">
<span>{{ formatInventoryTypeLabel(row.inventory_type) }}</span>
</template>
<template #column-batch_count="{ row }">
<div style="text-align:center">{{ row.batch_count || 0 }}</div>
</template>
<template #column-status="{ row }">
<el-tag v-if="row.status" size="small">
{{ row.status }}
</el-tag>
</template>
<template #empty>
<div class="empty-tip">暂无入库单</div>
</template>
@ -195,11 +155,9 @@ import * as inventoryApi from '@/api/storage.inventory/inventory'
import {
availableFields,
formatInventorySpaceLabel,
formatInventoryBarcodes,
formatInventoryFlagLabel,
formatInventoryOptionalText,
formatInventoryTypeLabel,
inventoryExportColumns,
isInventoryFlagEnabled,
productstockColums,
@ -314,19 +272,7 @@ const componentMap: Record<string, any> = {
const activeComponent = computed(() => componentMap[activeTab.value] || componentMap.details)
/** 按批次列表用:根据行标识生成稳定的模拟保质期/禁售期展示 */
function mockBatchShelfLifeFields(rowKey: string) {
let hash = 0
for (let i = 0; i < rowKey.length; i++) {
hash = (hash * 31 + rowKey.charCodeAt(i)) >>> 0
}
const shelfLifeDays = 90 + (hash % 271)
const saleBanDays = 3 + (hash % 28)
return {
shelf_life_days: `${shelfLifeDays}天`,
sale_ban_period: `到期前${saleBanDays}天`
}
}
const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedEntryId.value) || null
@ -343,9 +289,39 @@ async function loadData() {
const start = Date.now()
try {
const rawWhere = scanBox.value?.getConditions?.() || {}
const where: Record<string, unknown> = { ...rawWhere }
// 解析库位关键字 → 库位ID
const rawSpaceVal = where.space_keyword
delete where.space_keyword
const spaceKeyword = rawSpaceVal && typeof rawSpaceVal === 'object'
? String((rawSpaceVal as any).value ?? '').trim()
: String(rawSpaceVal ?? '').trim()
if (spaceKeyword) {
try {
const spaceRes: any = await indexApi.searchSpace({ keyword: spaceKeyword, page: 1, pageSize: 20 })
const spaceData = spaceRes && (spaceRes.data || spaceRes.list || spaceRes)
const spaceList = Array.isArray(spaceData?.list) ? spaceData.list : Array.isArray(spaceData) ? spaceData : []
if (spaceList.length) {
const spaceIds = spaceList.map((s: any) => Number(s.id)).filter((id: number) => Number.isFinite(id) && id > 0)
if (spaceIds.length === 1) {
where.space_id = spaceIds[0]
} else if (spaceIds.length > 1) {
where.space_id = spaceIds
}
} else {
// 未匹配到任何库位,设一个不可能的值使结果为空
where.space_id = -1
}
} catch {
where.space_id = -1
}
}
const params: any = {
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
where: scanBox.value?.getConditions?.() || {},
where,
group_by_batch: groupByBatch.value
}
@ -355,11 +331,7 @@ async function loadData() {
const rows = Array.isArray(data.list) ? data.list : []
list.value = rows.map((item: any) => {
const rowId = groupByBatch.value
? `${item.stock_id}-${item.space_id}-${item.batch_no || item.id || ''}`
: `${item.stock_id}-${item.space_id}`
const mockShelf = groupByBatch.value ? mockBatchShelfLifeFields(rowId) : null
const rowId = `${item.stock_id}`
return {
id: rowId,
stock_id: item.stock_id,
@ -368,16 +340,10 @@ async function loadData() {
barcodes: formatInventoryBarcodes(item.stock?.barcodes),
sku_property: formatInventoryOptionalText(item.stock?.sku_property),
stock_unit: formatInventoryOptionalText(item.stock?.stock_unit),
batch_no: item.batch_no || item.batch?.batch_no || '',
production_date: item.production_date || item.batch?.production_date || '',
expiry_date: item.expiry_date || item.batch?.expiry_date || '',
shelf_life_days: mockShelf?.shelf_life_days ?? '',
sale_ban_period: mockShelf?.sale_ban_period ?? '',
expiry_remaining_days: item.expiry_remaining_days,
production_date: item.production_date || '',
expiry_date: item.expiry_date || '',
is_shelf_life_warning_triggered: Boolean(item.is_shelf_life_warning_triggered),
space_code: formatInventorySpaceLabel(item.space),
store_name: item.store_name || item.store?.store_remask || item.store?.store_name || '',
inventory_type: item.inventory_type,
store_name: item.store_name || item.stock?.store_name || '',
quantity: item.quantity,
available_quantity: item.available_quantity,
locked_quantity: item.locked_quantity,
@ -387,14 +353,10 @@ async function loadData() {
is_shelf_life_mgmt: item.stock?.is_shelf_life_mgmt ?? '',
remaining_threshold_days: item.stock?.remaining_threshold_days ?? '',
is_batch_mgmt_enabled: item.stock?.is_batch_mgmt_enabled,
inventory_warning_level: item.inventory_warning_level || '',
inventory_warning_color: item.inventory_warning_color || '',
inventory_warning_tip_text: item.inventory_warning_tip_text || '',
// preserve original structures for child components that need full network shape
stock: item.stock || null,
space: item.space || null,
// transferLocation 需 wms_storage 主键:接口显式 storage_id,或按批次明细模式下的 id
storage_id: item.storage_id ?? (groupByBatch.value ? item.id : null),
storage_id: item.storage_id ?? null,
space_id: item.space_id ?? item.space?.id ?? null,
__raw: item
}
@ -571,7 +533,6 @@ async function handleExport(mode: 'waybill' | 'item' = 'waybill') {
transformCell: (prop, value) => {
if (prop === 'is_shelf_life_mgmt') return formatInventoryFlagLabel(value)
if (prop === 'remaining_threshold_days') return formatInventoryOptionalText(value)
if (prop === 'inventory_type') return formatInventoryTypeLabel(value)
return value
}
})
@ -593,42 +554,33 @@ async function handleExport(mode: 'waybill' | 'item' = 'waybill') {
const data = res.data || res
const rawRows = Array.isArray(data.list) ? data.list : []
let exportRows = rawRows.map((item: any) => {
const rowId = `${item.stock_id}-${item.space_id}-${item.batch_no || item.id || ''}`
const mockShelf = mockBatchShelfLifeFields(rowId)
return {
stock_id: item.stock_id,
store_name: item.store_name || item.stock?.store_name || '',
item_code: item.stock?.item_code || '',
item_name: item.stock?.item_name || '',
barcodes: formatInventoryBarcodes(item.stock?.barcodes),
sku_property: formatInventoryOptionalText(item.stock?.sku_property),
stock_unit: formatInventoryOptionalText(item.stock?.stock_unit),
batch_no: item.batch_no || item.batch?.batch_no || '',
production_date: item.production_date || item.batch?.production_date || '',
expiry_date: item.expiry_date || item.batch?.expiry_date || '',
shelf_life_days: mockShelf.shelf_life_days,
sale_ban_period: mockShelf.sale_ban_period,
space_code: formatInventorySpaceLabel(item.space),
space_id: item.space_id ?? item.space?.id ?? '',
store_name: item.store_name || item.store?.store_remask || item.store?.store_name || '',
inventory_type: item.inventory_type,
production_date: item.production_date || '',
expiry_date: item.expiry_date || '',
quantity: item.quantity,
available_quantity: item.available_quantity,
locked_quantity: item.locked_quantity,
first_inbound_time: item.first_inbound_time || '',
last_inbound_time: item.last_inbound_time,
batch_count: Number(item.batch_count || 0),
is_shelf_life_mgmt: item.stock?.is_shelf_life_mgmt ?? '',
remaining_threshold_days: item.stock?.remaining_threshold_days ?? '',
is_batch_mgmt_enabled: item.stock?.is_batch_mgmt_enabled,
batch_count: Number(item.batch_count || 0)
is_batch_mgmt_enabled: item.stock?.is_batch_mgmt_enabled
}
})
if (selectionRows.value.length) {
const selectedKeys = new Set(
selectionRows.value.map((row: any) => `${row.stock_id}-${row.space_id}`)
selectionRows.value.map((row: any) => row.stock_id)
)
exportRows = exportRows.filter((row: any) =>
selectedKeys.has(`${row.stock_id}-${row.space_id}`)
selectedKeys.has(row.stock_id)
)
}
@ -646,7 +598,6 @@ async function handleExport(mode: 'waybill' | 'item' = 'waybill') {
return formatInventoryFlagLabel(value)
}
if (prop === 'remaining_threshold_days') return formatInventoryOptionalText(value)
if (prop === 'inventory_type') return formatInventoryTypeLabel(value)
return value
}
})
@ -667,33 +618,6 @@ function handleImport() {
ElMessage.info('导入功能')
}
// 状态翻译映射
const ORDER_STATUS_MAP: Record<string, string> = {
CREATED: '待处理',
CREATING: '创建中',
PARTIAL_RECEIVED: '部分入库',
COMPLETED: '已完成',
CANCELLED: '已取消',
CLOSED: '已关闭',
PENDING: '待处理',
WAITING: '等待中'
}
const ORDER_STATUS_TAG: Record<string, string> = {
COMPLETED: 'success',
PARTIAL_RECEIVED: 'warning',
CREATED: 'info',
CREATING: 'info',
CANCELLED: 'danger',
CLOSED: 'danger'
}
function orderStatusLabel(val: string) {
return ORDER_STATUS_MAP[val] || val
}
function orderStatusTagType(val: string): any {
return ORDER_STATUS_TAG[val] || ''
}
</script>
<style scoped lang="scss">

View File

@ -46,26 +46,9 @@ export const availableFields: InventoryScanFieldConfig[] = [
placeholder: '请输入商品ID',
extraAction: { label: '编码筛选' }
}),
inventoryScanBasicField({ label: '库位', value: 'space_id', type: 'text' }),
inventoryScanBasicField({ label: '货主', value: 'store_id', type: 'select', multiple: true, options: [] }),
inventoryScanBasicField({ label: '批次号', value: 'batch_no', type: 'text' }),
inventoryScanBasicField({ label: '入库单号', value: 'inbound_order_no', type: 'text' }),
inventoryScanBasicField({ label: '库位', value: 'space_keyword', type: 'text', placeholder: '库位名称或编码' }),
inventoryScanBasicField({ label: '创建日期', value: 'created_at', type: 'daterange' }),
// 流程/状态(每项独立分组,对齐收货单 scanWorkflowField 排版)
scanWorkflowField({
label: '库存类型',
value: 'inventory_type',
type: 'select',
options: [
{ label: '正品', value: 'ZP' },
{ label: '次品', value: 'CC' },
{ label: '机损', value: 'JS' },
{ label: '箱损', value: 'XS' },
{ label: '在途', value: 'ZT' },
{ label: '冻结', value: 'DJ' },
{ label: '分配', value: 'FP' }
]
}) as InventoryScanFieldConfig,
]
/** 库位展示名:优先 custom_name,其次 space_code */
export function formatInventorySpaceLabel(space?: Record<string, any> | null, fallback = ''): string {
@ -165,9 +148,6 @@ export const inventoryExportColumns = [
{ ...inventoryBarcodesColumn },
{ prop: 'sku_property', label: '规格' },
{ prop: 'stock_unit', label: '单位' },
{ prop: 'space_code', label: '库位名称' },
{ prop: 'space_id', label: '库位ID' },
{ prop: 'inventory_type', label: '库存类型' },
{ prop: 'quantity', label: '总数量' },
{ prop: 'available_quantity', label: '可用数量' },
{ prop: 'locked_quantity', label: '锁定数量' },
@ -187,12 +167,7 @@ export const productstockColums = [
{ prop: 'stock_unit', label: '单位', width: '80' },
{ prop: 'production_date', label: '生产日期', width: '120' },
{ prop: 'expiry_date', label: '到期日期', width: '120' },
{ prop: 'shelf_life_days', label: '保质期', width: '100' },
{ prop: 'sale_ban_period', label: '禁售期', width: '110' },
{ prop: 'space_code', label: '库位名称', width: '150' },
{ prop: 'space_id', label: '库位ID', width: '90' },
{ prop: 'store_name', label: '货主', width: '120' },
{ prop: 'inventory_type', label: '库存类型', width: '100' },
{ prop: 'quantity', label: '总数量', width: '100' },
{ prop: 'available_quantity', label: '可用数量', width: '100' },
{ prop: 'locked_quantity', label: '锁定数量', width: '100' },

View File

@ -175,8 +175,8 @@
<div class="detail-header">
<el-tabs v-model="activeTab" class="detail-tab">
<!-- <el-tab-pane label="基本详情" name="details" /> -->
<el-tab-pane label="操作日志" name="logs" />
<el-tab-pane label="余额变动" name="balanceLogs" />
<el-tab-pane label="操作日志" name="logs" />
</el-tabs>
</div>
@ -292,7 +292,7 @@
<div v-loading="policyDialog.loading">
<!-- 签约基本信息 -->
<el-descriptions :column="2" size="small" border style="margin-bottom:16px">
<el-descriptions-item label="货主">{{ policyDialog.contractRow?.store_name }}</el-descriptions-item>
<el-descriptions-item label="货主">{{ policyDialog.contractRow?.store_name || policyDialog.contractRow?.counterparty_name }}</el-descriptions-item>
<el-descriptions-item label="面单余额">
<span :style="{ color: (policyDialog.contractRow?.print_quantity ?? 0) <= 0 ? '#f56c6c' : '' }">
@ -949,7 +949,7 @@ const selectedRow = ref<any>(null)
const tableRef = ref<any>(null)
const scanBox = ref<any>(null)
const activeTab = ref('details')
const activeTab = ref('balanceLogs')
const componentMap: Record<string, any> = {
details: Detail,
logs: Log