1
This commit is contained in:
parent
9c1ba8d5a2
commit
e2f09a9bc3
@ -26,6 +26,22 @@ export function loadStores(type:any) {
|
|||||||
isSystemApi: true
|
isSystemApi: true
|
||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 查询仓库列表(无需鉴权,需登录) */
|
||||||
|
export function loadWarehouses(data?: Record<string, unknown>) {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'index.loadWarehouses',
|
||||||
|
v: '1.0',
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data: data ?? {},
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
export function getCOSUploadConfig(data:any){
|
export function getCOSUploadConfig(data:any){
|
||||||
return request({
|
return request({
|
||||||
url: '/system',
|
url: '/system',
|
||||||
|
|||||||
@ -30,6 +30,31 @@ export function stockWarehouse(pagination: any, data: any, sort?: StockWarehouse
|
|||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 外仓商品列表 */
|
||||||
|
export function stockWarehouseExternalList(params: {
|
||||||
|
warehouse_id?: number | string
|
||||||
|
pagination?: { page?: number; pageSize?: number }
|
||||||
|
where?: Record<string, any>
|
||||||
|
sort?: StockWarehouseListSort
|
||||||
|
}) {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'stock.warehouse.externalList',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
warehouse_id: params.warehouse_id,
|
||||||
|
pagination: params.pagination,
|
||||||
|
where: params.where,
|
||||||
|
sort: params.sort
|
||||||
|
},
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
export function getProhibitedType() {
|
export function getProhibitedType() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system',
|
url: '/system',
|
||||||
|
|||||||
@ -18,6 +18,22 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolbar-right">
|
<div class="toolbar-right">
|
||||||
|
<el-select
|
||||||
|
v-model="queryForm.warehouse_id"
|
||||||
|
placeholder="全部仓库"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
size="small"
|
||||||
|
style="width: 200px; margin-right: 8px"
|
||||||
|
@change="handleWarehouseChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="wh in warehouseList"
|
||||||
|
:key="wh.warehouse_id"
|
||||||
|
:label="wh.warehouse_name"
|
||||||
|
:value="wh.warehouse_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryForm.keyword"
|
v-model="queryForm.keyword"
|
||||||
placeholder="搜索商品编码/名称/条码"
|
placeholder="搜索商品编码/名称/条码"
|
||||||
@ -33,6 +49,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 库存汇总 -->
|
||||||
|
<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 class="upper-wrapper">
|
<div class="upper-wrapper">
|
||||||
<upper-table
|
<upper-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
@ -45,6 +70,12 @@
|
|||||||
@page-change="handlePageChange"
|
@page-change="handlePageChange"
|
||||||
@page-size-change="handleSizeChange"
|
@page-size-change="handleSizeChange"
|
||||||
>
|
>
|
||||||
|
<template #column-warehouse_name="{ row }">
|
||||||
|
<span>{{ row['store_stock.warehouse.company_name'] || '—' }}</span>
|
||||||
|
</template>
|
||||||
|
<template #column-available_qty="{ row }">
|
||||||
|
<span>{{ row.available_quantity ?? '—' }}</span>
|
||||||
|
</template>
|
||||||
<template #column-is_sn_mgmt="{ row }">
|
<template #column-is_sn_mgmt="{ row }">
|
||||||
<el-tag size="small" :type="row.is_sn_mgmt === 'Y' ? 'success' : 'info'">
|
<el-tag size="small" :type="row.is_sn_mgmt === 'Y' ? 'success' : 'info'">
|
||||||
{{ row.is_sn_mgmt === 'Y' ? '是' : '否' }}
|
{{ row.is_sn_mgmt === 'Y' ? '是' : '否' }}
|
||||||
@ -60,6 +91,9 @@
|
|||||||
{{ row.is_batch_mgmt === 'Y' ? '是' : '否' }}
|
{{ row.is_batch_mgmt === 'Y' ? '是' : '否' }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-update_at_display="{ row }">
|
||||||
|
<span>{{ row.update_at_display || '—' }}</span>
|
||||||
|
</template>
|
||||||
<template #empty>
|
<template #empty>
|
||||||
<el-empty description="暂无商品数据" :image-size="60" />
|
<el-empty description="暂无商品数据" :image-size="60" />
|
||||||
</template>
|
</template>
|
||||||
@ -78,10 +112,21 @@
|
|||||||
<el-descriptions v-if="activeTab === 'info'" :column="2" border size="small">
|
<el-descriptions v-if="activeTab === 'info'" :column="2" border size="small">
|
||||||
<el-descriptions-item label="商品编码">{{ selectedRow.item_code || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="商品编码">{{ selectedRow.item_code || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="商品名称">{{ selectedRow.item_name || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="商品名称">{{ selectedRow.item_name || '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="商家编码">{{ selectedRow.goods_code || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="品牌">{{ selectedRow.brand_name || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="品牌">{{ selectedRow.brand_name || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="规格型号">{{ selectedRow.spec || '—' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="库存单位">{{ selectedRow.stock_unit || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="库存单位">{{ selectedRow.stock_unit || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="条码">{{ selectedRow.barcode || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="毛重">{{ selectedRow.gross_weight ?? '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="条码" :span="2">
|
||||||
|
<template v-if="selectedRow.barcodes && selectedRow.barcodes.length">
|
||||||
|
<el-tag
|
||||||
|
v-for="(bc, idx) in selectedRow.barcodes"
|
||||||
|
:key="idx"
|
||||||
|
size="small"
|
||||||
|
style="margin-right: 4px; margin-bottom: 2px"
|
||||||
|
>{{ bc }}</el-tag>
|
||||||
|
</template>
|
||||||
|
<span v-else>—</span>
|
||||||
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="SN管理">
|
<el-descriptions-item label="SN管理">
|
||||||
<el-tag size="small" :type="selectedRow.is_sn_mgmt === 'Y' ? 'success' : 'info'">
|
<el-tag size="small" :type="selectedRow.is_sn_mgmt === 'Y' ? 'success' : 'info'">
|
||||||
{{ selectedRow.is_sn_mgmt === 'Y' ? '是' : '否' }}
|
{{ selectedRow.is_sn_mgmt === 'Y' ? '是' : '否' }}
|
||||||
@ -97,17 +142,18 @@
|
|||||||
{{ selectedRow.is_batch_mgmt === 'Y' ? '是' : '否' }}
|
{{ selectedRow.is_batch_mgmt === 'Y' ? '是' : '否' }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="毛重">{{ selectedRow.gross_weight ?? '—' }}</el-descriptions-item>
|
<el-descriptions-item label="打包要求" :span="2">{{ selectedRow.packing_requirements || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="打包要求">{{ selectedRow.packing_requirements || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="创建时间">{{ selectedRow.create_at_display || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="创建时间" :span="2">{{ formatDate(selectedRow.created_at) }}</el-descriptions-item>
|
<el-descriptions-item label="更新时间">{{ selectedRow.update_at_display || '—' }}</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
|
|
||||||
<el-descriptions v-else-if="activeTab === 'storage'" :column="2" border size="small">
|
<el-descriptions v-else-if="activeTab === 'storage'" :column="2" border size="small">
|
||||||
<el-descriptions-item label="仓库名称">{{ selectedRow.warehouse_name || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="仓库名称">{{ selectedRow['store_stock.warehouse.company_name'] || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="可用库存">{{ selectedRow.available_qty ?? '—' }}</el-descriptions-item>
|
<el-descriptions-item label="货主备注">{{ selectedRow['store_stock.store_remask'] || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="锁定库存">{{ selectedRow.locked_qty ?? '—' }}</el-descriptions-item>
|
<el-descriptions-item label="总库存">{{ selectedRow.quantity ?? '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="总库存">{{ selectedRow.total_qty ?? '—' }}</el-descriptions-item>
|
<el-descriptions-item label="锁定库存">{{ selectedRow.locked_quantity ?? '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="在途库存">{{ selectedRow.in_transit_qty ?? '—' }}</el-descriptions-item>
|
<el-descriptions-item label="可用库存">{{ selectedRow.available_quantity ?? '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="锁定率">{{ selectedRow.lock_rate_display || '—' }}</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -122,7 +168,8 @@
|
|||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
import { Search, Refresh } from '@element-plus/icons-vue'
|
||||||
import { stockWarehouse } from '@/api/stock/stock'
|
import { stockWarehouseExternalList } from '@/api/stock/stock'
|
||||||
|
import { loadWarehouses } from '@/api/index/index'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
import UpperTable from '@/components/UpperTable/index.vue'
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
|
|
||||||
@ -130,15 +177,17 @@ import UpperTable from '@/components/UpperTable/index.vue'
|
|||||||
const columns = [
|
const columns = [
|
||||||
{ prop: 'item_code', label: '商品编码', minWidth: 130 },
|
{ prop: 'item_code', label: '商品编码', minWidth: 130 },
|
||||||
{ prop: 'item_name', label: '商品名称', minWidth: 150 },
|
{ prop: 'item_name', label: '商品名称', minWidth: 150 },
|
||||||
|
{ prop: 'goods_code', label: '商家编码', width: 120 },
|
||||||
{ prop: 'brand_name', label: '品牌', width: 100 },
|
{ prop: 'brand_name', label: '品牌', width: 100 },
|
||||||
{ prop: 'spec', label: '规格型号', width: 120 },
|
|
||||||
{ prop: 'stock_unit', label: '库存单位', width: 90 },
|
{ prop: 'stock_unit', label: '库存单位', width: 90 },
|
||||||
{ prop: 'warehouse_name', label: '所属仓库', minWidth: 130 },
|
{ prop: 'warehouse_name', label: '所属仓库', minWidth: 140 },
|
||||||
|
{ prop: 'quantity', label: '总库存', width: 90 },
|
||||||
|
{ prop: 'locked_quantity', label: '锁定库存', width: 90 },
|
||||||
{ prop: 'available_qty', label: '可用库存', width: 90 },
|
{ prop: 'available_qty', label: '可用库存', width: 90 },
|
||||||
|
{ prop: 'lock_rate_display', label: '锁定率', width: 90 },
|
||||||
{ prop: 'is_sn_mgmt', label: 'SN管理', width: 80 },
|
{ prop: 'is_sn_mgmt', label: 'SN管理', width: 80 },
|
||||||
{ prop: 'is_shelf_life_mgmt', label: '效期管理', width: 80 },
|
|
||||||
{ prop: 'is_batch_mgmt', label: '批次管理', width: 80 },
|
{ prop: 'is_batch_mgmt', label: '批次管理', width: 80 },
|
||||||
{ prop: 'updated_at', label: '更新时间', width: 160 }
|
{ prop: 'update_at_display', label: '更新时间', width: 160 }
|
||||||
]
|
]
|
||||||
|
|
||||||
// ─── 筛选字段配置 ─────────────────────────────────────────────────────────
|
// ─── 筛选字段配置 ─────────────────────────────────────────────────────────
|
||||||
@ -186,8 +235,28 @@ const scanBox = ref<any>(null)
|
|||||||
const activeTab = ref('info')
|
const activeTab = ref('info')
|
||||||
|
|
||||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||||
const queryForm = reactive({ keyword: '' })
|
const queryForm = reactive({ keyword: '', warehouse_id: undefined as number | string | undefined })
|
||||||
const currentCondition = ref<any>({})
|
const currentCondition = ref<any>({})
|
||||||
|
const summary = ref<any>(null)
|
||||||
|
|
||||||
|
// ─── 仓库列表 ──────────────────────────────────────────────────────────────
|
||||||
|
const warehouseList = ref<any[]>([])
|
||||||
|
|
||||||
|
async function loadWarehouseList() {
|
||||||
|
try {
|
||||||
|
const res = await loadWarehouses() as any
|
||||||
|
if (res?.data) {
|
||||||
|
warehouseList.value = res.data.list || res.data || []
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// 仓库列表加载失败不影响主流程
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleWarehouseChange() {
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadList()
|
||||||
|
}
|
||||||
|
|
||||||
// ─── 加载列表 ──────────────────────────────────────────────────────────────
|
// ─── 加载列表 ──────────────────────────────────────────────────────────────
|
||||||
async function loadList() {
|
async function loadList() {
|
||||||
@ -204,13 +273,18 @@ async function loadList() {
|
|||||||
params.where.keyword = queryForm.keyword
|
params.where.keyword = queryForm.keyword
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await stockWarehouse(params.pagination, params.where) as any
|
const res = await stockWarehouseExternalList({
|
||||||
|
warehouse_id: queryForm.warehouse_id,
|
||||||
|
pagination: params.pagination,
|
||||||
|
where: params.where
|
||||||
|
}) as any
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
const payload = res.data
|
const payload = res.data
|
||||||
list.value = payload.list || []
|
list.value = payload.list || []
|
||||||
pagination.total = payload.pagination?.total || payload.total || 0
|
pagination.total = payload.pagination?.total || payload.total || 0
|
||||||
pagination.currentPage = payload.pagination?.page || payload.page || pagination.currentPage
|
pagination.currentPage = payload.pagination?.page || payload.page || pagination.currentPage
|
||||||
pagination.pageSize = payload.pagination?.pageSize || payload.page_size || pagination.pageSize
|
pagination.pageSize = payload.pagination?.pageSize || payload.page_size || pagination.pageSize
|
||||||
|
summary.value = payload.summary || null
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ElMessage.error('获取商品列表失败')
|
ElMessage.error('获取商品列表失败')
|
||||||
@ -246,6 +320,7 @@ function handleSearch() {
|
|||||||
|
|
||||||
function handleReset() {
|
function handleReset() {
|
||||||
queryForm.keyword = ''
|
queryForm.keyword = ''
|
||||||
|
queryForm.warehouse_id = undefined
|
||||||
currentCondition.value = {}
|
currentCondition.value = {}
|
||||||
if (scanBox.value?.reset) {
|
if (scanBox.value?.reset) {
|
||||||
scanBox.value.reset()
|
scanBox.value.reset()
|
||||||
@ -270,14 +345,9 @@ function handleRowClick(row: any) {
|
|||||||
selectedRow.value = row
|
selectedRow.value = row
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── 工具函数 ──────────────────────────────────────────────────────────────
|
|
||||||
function formatDate(dateStr: string | null | undefined) {
|
|
||||||
if (!dateStr) return ''
|
|
||||||
return new Date(dateStr).toLocaleString('zh-CN', { hour12: false }).replace(/\//g, '-')
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── 初始化 ────────────────────────────────────────────────────────────────
|
// ─── 初始化 ────────────────────────────────────────────────────────────────
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
loadWarehouseList()
|
||||||
loadList()
|
loadList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@ -322,6 +392,28 @@ onMounted(() => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.summary-bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
background: #f0f9eb;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #606266;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
b {
|
||||||
|
color: #303133;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-divider {
|
||||||
|
color: #dcdfe6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.lower-level {
|
.lower-level {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
border: 1px solid #ebeef5;
|
border: 1px solid #ebeef5;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user