feat: 库位查询新增筛选与首页临时库位待移库统计

- 库位查询页新增筛选功能(全部/库存>0/可移库存>0/两者),并新增底部合计栏
- 库位查询支持 ?space_id 直接按库位ID查询、?filter_type 预置筛选条件
- 优化库存/可移库存展示:库存=可用数量+锁定数量,字段缺失时回退原始库存字段
- 首页新增「未移库临时库位 / 未移库临时库位可分配储位」待移库商品种类数统计
- 顶部统计面板仅展示看板类统计,临时库位两项仅在走马灯与通知弹窗展示
- 通知弹窗临时库位项支持点击跳转库位查询(带库位ID并预置库存>0筛选)
- 修复 u-popup 圆角属性(border-radius 改为 round)
- 版本号升级 1.0.147 → 1.0.148
This commit is contained in:
zm2000 2026-11-23 15:04:24 +08:00
parent 28f7dc412b
commit 79d410680b
4 changed files with 449 additions and 32 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "wms-pda", "name": "wms-pda",
"version": "1.0.147", "version": "1.0.148",
"private": true, "private": true,
"description": "天豹云仓 WMS_PDA(uni-app Vue2 + @vue/cli 4.5)", "description": "天豹云仓 WMS_PDA(uni-app Vue2 + @vue/cli 4.5)",
"scripts": { "scripts": {

View File

@ -2,8 +2,8 @@
"name" : "WMS_PDA", "name" : "WMS_PDA",
"appid" : "__UNI__0B3DAD3", "appid" : "__UNI__0B3DAD3",
"description" : "多平台快速开发的UI框架", "description" : "多平台快速开发的UI框架",
"versionName" : "1.0.147", "versionName" : "1.0.148",
"versionCode" : 1000147, "versionCode" : 1000148,
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {
"statusbar" : { "statusbar" : {

View File

@ -3,9 +3,9 @@
<view class="status_bar"> <view class="status_bar">
</view> </view>
<view class="compact-header"> <view class="compact-header">
<!-- 通知数据:与「通知信息」弹窗同源(noticeStatItems) --> <!-- 顶部面板:仅展示看板类统计(不含临时库位两项) -->
<view class="stat-strip" v-if="noticeStatItems.length" @click="openNoticePopup"> <view class="stat-strip" v-if="panelStatItems.length" @click="openNoticePopup">
<view class="stat-item" v-for="item in noticeStatItems" :key="item.label"> <view class="stat-item" v-for="item in panelStatItems" :key="item.label">
<text class="stat-item__value">{{ item.value }}</text> <text class="stat-item__value">{{ item.value }}</text>
<text class="stat-item__label">{{ item.label }}</text> <text class="stat-item__label">{{ item.label }}</text>
</view> </view>
@ -176,8 +176,14 @@
</view> </view>
<scroll-view scroll-y class="notice-popup__body"> <scroll-view scroll-y class="notice-popup__body">
<view class="notice-popup__grid"> <view class="notice-popup__grid">
<view v-for="item in noticeStatItems" :key="item.label" class="notice-popup__item"> <view
<text class="notice-popup__value">{{ item.value }}</text> v-for="item in noticeStatItems"
:key="item.label"
class="notice-popup__item"
:class="{ 'notice-popup__item--link': item.spaceId }"
@click="item.spaceId && goLocationInquiry(item.spaceId)"
>
<text class="notice-popup__value" :class="{ 'notice-popup__value--link': item.spaceId }">{{ item.value }}</text>
<text class="notice-popup__label">{{ item.label }}</text> <text class="notice-popup__label">{{ item.label }}</text>
</view> </view>
</view> </view>
@ -216,6 +222,12 @@
'#8338EC', '#2EC4B6' '#8338EC', '#2EC4B6'
] ]
// 未移库临时库位 / 未移库临时库位可分配储位 的库位ID
const TEMP_SPACE_IDS = {
temp: 26937,
assignable: 26938
}
// 看板统计相关的菜单识别(后台菜单名可能调整,保留关键字兜底) // 看板统计相关的菜单识别(后台菜单名可能调整,保留关键字兜底)
const isReviewShippingMenuName = name => name === '散单复核发货' || const isReviewShippingMenuName = name => name === '散单复核发货' ||
name === '订单复核' || name === '订单复核' ||
@ -270,6 +282,8 @@
hasOrderPickingMenu: false, hasOrderPickingMenu: false,
hasClaimShippingMenu: false, hasClaimShippingMenu: false,
unclaimedWaveCount: 0, unclaimedWaveCount: 0,
tempSpaceItemKindCount: 0,
tempSpaceAssignableCount: 0,
showNoticePopup: false, showNoticePopup: false,
quickActions: [], quickActions: [],
// 每页 9 个:3 列 × 3 行 // 每页 9 个:3 列 × 3 行
@ -391,9 +405,6 @@
noticeStats() { noticeStats() {
const stats = this.dashboardStats || null; const stats = this.dashboardStats || null;
const showUnclaimed = this.hasClaimShippingMenu && this.hasOrderPickingMenu; const showUnclaimed = this.hasClaimShippingMenu && this.hasOrderPickingMenu;
if (!stats && !showUnclaimed) {
return [];
}
const f = this.formatStatNumber; const f = this.formatStatNumber;
const items = []; const items = [];
@ -409,6 +420,9 @@
if (stats && this.hasReviewShippingMenu) { if (stats && this.hasReviewShippingMenu) {
items.push({ label: '已复核', value: f(stats.recheckedOrders) }); items.push({ label: '已复核', value: f(stats.recheckedOrders) });
} }
// 临时库位 / 临时库位可分配储位 的待移库商品种类数(仅走马灯与通知信息弹窗展示,顶部面板不展示)
items.push({ label: '未移库临时库位', value: f(this.tempSpaceItemKindCount), panel: false, spaceId: TEMP_SPACE_IDS.temp });
items.push({ label: '未移库临时库位可分配储位', value: f(this.tempSpaceAssignableCount), panel: false, spaceId: TEMP_SPACE_IDS.assignable });
return items; return items;
}, },
@ -426,6 +440,11 @@
return `${Math.max(8, len * 0.4)}s`; return `${Math.max(8, len * 0.4)}s`;
}, },
// 顶部面板数据源:仅看板类统计,不含临时库位两项
panelStatItems() {
return this.noticeStats.filter(item => item.panel !== false);
},
noticeStatItems() { noticeStatItems() {
return this.noticeStats; return this.noticeStats;
} }
@ -655,10 +674,11 @@
async loadUserInfo({ silent = false } = {}) { async loadUserInfo({ silent = false } = {}) {
// 菜单加载会决定看板统计是否展示,必须先完成 // 菜单加载会决定看板统计是否展示,必须先完成
await this.refreshQuickActions({ silent }); await this.refreshQuickActions({ silent });
// 两个统计接口互不依赖,并行请求 // 各统计接口互不依赖,并行请求
await Promise.all([ await Promise.all([
this.loadDashboardStats(), this.loadDashboardStats(),
this.loadUnclaimedWaveCount() this.loadUnclaimedWaveCount(),
this.loadTempSpaceStockCounts()
]); ]);
}, },
@ -804,6 +824,73 @@
} }
}, },
// 加载临时库位 / 临时库位可分配储位 的待移库商品种类数
// 接口 storage.inventory.listBySpaceId,统计「库存 > 0」的商品种类数
async loadTempSpaceStockCounts() {
const [tempCount, assignableCount] = await Promise.all([
this.fetchSpaceStockKindCount(TEMP_SPACE_IDS.temp),
this.fetchSpaceStockKindCount(TEMP_SPACE_IDS.assignable)
]);
this.tempSpaceItemKindCount = tempCount;
this.tempSpaceAssignableCount = assignableCount;
},
async fetchSpaceStockKindCount(spaceId) {
try {
const res = await this.$http(
'storage.inventory.listBySpaceId',
{ space_id: spaceId },
'',
false
);
const data = res && res.data && typeof res.data === 'object' ? res.data : {};
const list = Array.isArray(data.list) ? data.list : [];
return list.filter(item => this.stockQuantityOf(item) > 0).length;
} catch (error) {
console.warn('[index] 临时库位待移库商品种类数加载失败:', error);
return 0;
}
},
// 库存 = 可用数量 + 锁定数量,都取不到时回退原始库存字段
stockQuantityOf(item) {
if (!item || typeof item !== 'object') {
return null;
}
const locked = this.stockToNumberOrNull(
item.locked_quantity
?? item.lock_quantity
?? item.frozen_quantity
?? item.freeze_quantity
);
const available = this.stockToNumberOrNull(
item.available_quantity
?? item.movable_quantity
?? item.moveable_quantity
?? item.can_move_quantity
?? item.free_quantity
?? item.usable_quantity
);
if (available !== null || locked !== null) {
return (available === null ? 0 : available) + (locked === null ? 0 : locked);
}
return this.stockToNumberOrNull(
item.quantity
?? item.actual_quantity
?? item.stock
?? item.total_quantity
?? item.qty
);
},
stockToNumberOrNull(value) {
if (value === null || value === undefined || value === '') {
return null;
}
const num = Number(value);
return Number.isNaN(num) ? null : num;
},
formatStatNumber(value) { formatStatNumber(value) {
const num = Number(value); const num = Number(value);
return Number.isFinite(num) ? num : '--'; return Number.isFinite(num) ? num : '--';
@ -1594,6 +1681,17 @@
this.showNoticePopup = false; this.showNoticePopup = false;
}, },
// 点击通知项跳转库位查询(带库位ID,并预置「库存>0」筛选)
goLocationInquiry(spaceId) {
const id = Number(spaceId);
if (!Number.isInteger(id) || id <= 0) {
return;
}
uni.navigateTo({
url: `/pages/warehouse/locationInquiry?space_id=${encodeURIComponent(id)}&filter_type=stock`
});
},
toEditPage() { toEditPage() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/home/edit-quick-actions' url: '/pages/home/edit-quick-actions'
@ -2359,6 +2457,17 @@
font-size: 34rpx; font-size: 34rpx;
color: #909399; color: #909399;
} }
&__value--link {
border-bottom: 4rpx solid #2979ff;
padding-bottom: 6rpx;
}
&__item--link {
&:active {
background: #eef3ff;
}
}
} }
/* 退出应用确认弹窗 */ /* 退出应用确认弹窗 */

View File

@ -9,7 +9,9 @@
<u-icon name="arrow-left" size="36rpx" color="#303133"></u-icon> <u-icon name="arrow-left" size="36rpx" color="#303133"></u-icon>
</view> </view>
<text class="header__title">库位查询</text> <text class="header__title">库位查询</text>
<view class="header__placeholder"></view> <view class="header__filter" @click="openFilter">
<text class="header__filter-text">筛选</text>
</view>
</view> </view>
<!-- 内容区 --> <!-- 内容区 -->
@ -36,7 +38,7 @@
<!-- 商品列表滚动区 --> <!-- 商品列表滚动区 -->
<scroll-view class="scroll_box" scroll-y> <scroll-view class="scroll_box" scroll-y>
<view <view
v-for="(goods, index) in goodsList" v-for="(goods, index) in displayGoodsList"
:key="goodsItemKey(goods, index)" :key="goodsItemKey(goods, index)"
class="listBox" class="listBox"
> >
@ -72,11 +74,11 @@
</view> </view>
<view class="line line--count" @click="goRelocation(goods)"> <view class="line line--count" @click="goRelocation(goods)">
<view class="line--count__half line--count__half--left"> <view class="line--count__half line--count__half--left">
<text class="line__label">总数量</text> <text class="line__label">库存</text>
<text class="line__value">{{ goodsCount(goods) }}</text> <text class="line__value">{{ goodsCount(goods) }}</text>
</view> </view>
<view class="line--count__half line--count__half--right"> <view class="line--count__half line--count__half--right">
<text class="line__label">可移数量</text> <text class="line__label">可移库存</text>
<text class="line__value">{{ goodsCopyCount(goods) }}</text> <text class="line__value">{{ goodsCopyCount(goods) }}</text>
</view> </view>
</view> </view>
@ -93,8 +95,17 @@
</scroll-view> </scroll-view>
</view> </view>
<!-- 底部合计商品种类数 -->
<view class="total-bar">
<view class="total-bar__left">
<text class="total-bar__label">合计</text>
<text v-if="activeFilterLabel" class="total-bar__filter">({{ activeFilterLabel }})</text>
</view>
<text class="total-bar__value">{{ displayGoodsList.length }}</text>
</view>
<!-- 库位选择弹窗 --> <!-- 库位选择弹窗 -->
<u-popup :show="selectorVisible" mode="bottom" :closeable="true" border-radius="20" :z-index="10090" @close="selectorVisible = false"> <u-popup :show="selectorVisible" mode="bottom" :closeable="true" round="20" :z-index="10090" @close="selectorVisible = false">
<view class="space-selector"> <view class="space-selector">
<view class="space-selector__header"> <view class="space-selector__header">
<text class="space-selector__title">请选择库位</text> <text class="space-selector__title">请选择库位</text>
@ -113,6 +124,40 @@
</scroll-view> </scroll-view>
</view> </view>
</u-popup> </u-popup>
<!-- 筛选弹窗 -->
<u-popup :show="filterVisible" mode="bottom" :closeable="true" round="20" :z-index="10091" @close="filterVisible = false">
<view class="filter-panel">
<view class="filter-panel__header">
<text class="filter-panel__title">筛选</text>
</view>
<view class="filter-panel__options">
<view
class="filter-panel__option"
:class="{ 'filter-panel__option--active': filterType === '' }"
@click="applyFilterType('')"
>全部</view>
<view
class="filter-panel__option"
:class="{ 'filter-panel__option--active': filterType === 'stock' }"
@click="applyFilterType('stock')"
>库存 &gt; 0</view>
<view
class="filter-panel__option"
:class="{ 'filter-panel__option--active': filterType === 'available' }"
@click="applyFilterType('available')"
>可移库存 &gt; 0</view>
<view
class="filter-panel__option"
:class="{ 'filter-panel__option--active': filterType === 'both' }"
@click="applyFilterType('both')"
>库存 &gt; 0 且 可移库存 &gt; 0</view>
</view>
<view class="filter-panel__actions">
<view class="filter-panel__btn filter-panel__btn--close" @click="filterVisible = false">关闭</view>
</view>
</view>
</u-popup>
</view> </view>
</template> </template>
@ -130,7 +175,10 @@ export default {
querying: false, querying: false,
queried: false, queried: false,
spaceInfo: null, spaceInfo: null,
goodsList: [] goodsList: [],
// 筛选(仅支持:可移库存 > 0 / 库存 > 0)
filterVisible: false,
filterType: ''
} }
}, },
computed: { computed: {
@ -139,14 +187,55 @@ export default {
const s = this.spaceInfo; const s = this.spaceInfo;
if (!s) return '--'; if (!s) return '--';
return String(s.custom_name ?? s.customName ?? s.space_code ?? s.spaceCode ?? s.name ?? '--').trim() || '--'; return String(s.custom_name ?? s.customName ?? s.space_code ?? s.spaceCode ?? s.name ?? '--').trim() || '--';
},
// 过滤后的商品列表(不改动原始 goodsList)
displayGoodsList() {
if (!this.filterType) {
return this.goodsList;
}
if (this.filterType === 'both') {
return this.goodsList.filter(goods => {
const available = this.sortQuantityOf(goods, false);
const stock = this.sortQuantityOf(goods, true);
return available !== null && available > 0 && stock !== null && stock > 0;
});
}
const isStock = this.filterType === 'stock';
return this.goodsList.filter(goods => {
const v = this.sortQuantityOf(goods, isStock);
return v !== null && v > 0;
});
},
activeFilterLabel() {
if (this.filterType === 'available') {
return '可移库存 大于 0';
}
if (this.filterType === 'stock') {
return '库存 大于 0';
}
if (this.filterType === 'both') {
return '库存 大于 0 且 可移库存 大于 0';
}
return '';
} }
}, },
onLoad(options = {}) { onLoad(options = {}) {
// 支持通过 ?keyword=xxx 预填库位编码/条码并自动查询 // 支持 ?space_id=xxx 直接按库位ID查询
const preset = String(options.keyword || '').trim(); const presetId = String(options.space_id || '').trim();
if (preset) { if (presetId) {
this.keyword = preset; this.$nextTick(() => this.querySpace(presetId));
this.$nextTick(() => this.handleQuery()); } else {
// 支持通过 ?keyword=xxx 预填库位编码/条码并自动查询
const preset = String(options.keyword || '').trim();
if (preset) {
this.keyword = preset;
this.$nextTick(() => this.handleQuery());
}
}
// 支持 ?filter_type=xxx 预置筛选条件(stock=库存>0 等)
const presetFilter = String(options.filter_type || '').trim();
if (presetFilter) {
this.filterType = presetFilter;
} }
this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult }); this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
this.safeDispatchBroadcast('start'); this.safeDispatchBroadcast('start');
@ -200,6 +289,42 @@ export default {
toast(title, icon = 'none') { toast(title, icon = 'none') {
uni.showToast({ title, icon }); uni.showToast({ title, icon });
}, },
// 提取用于筛选的数值:stock=库存(可用 + 锁定),available=可移库存
sortQuantityOf(goods, isStock) {
if (!goods || typeof goods !== 'object') {
return null;
}
if (isStock) {
// 库存 = 可用数量 + 锁定数量,都取不到时回退原始库存字段
const locked = this.goodsLockedQuantity(goods);
const available = this.goodsAvailableQuantity(goods, locked);
if (available !== null || locked !== null) {
return (available === null ? 0 : available) + (locked === null ? 0 : locked);
}
return this.goodsToNumberOrNull(
goods.quantity
?? goods.actual_quantity
?? goods.stock
?? goods.total_quantity
?? goods.qty
);
}
return this.goodsToNumberOrNull(
goods.available_quantity
?? goods.movable_quantity
?? goods.moveable_quantity
?? goods.can_move_quantity
?? goods.free_quantity
?? goods.usable_quantity
);
},
openFilter() {
this.filterVisible = true;
},
applyFilterType(type) {
this.filterType = type;
this.filterVisible = false;
},
handleBack() { handleBack() {
const pages = getCurrentPages(); const pages = getCurrentPages();
if (pages.length > 1) { if (pages.length > 1) {
@ -236,13 +361,88 @@ export default {
goodsStoreName(goods) { goodsStoreName(goods) {
return String(goods?.store_name ?? '').trim() || '--'; return String(goods?.store_name ?? '').trim() || '--';
}, },
// 总数量:参考商品查询页,库存 = 可用数量 + 锁定数量,都取不到时回退原始库存字段
goodsCount(goods) { goodsCount(goods) {
const v = goods?.quantity; if (!goods || typeof goods !== 'object') {
return v === null || v === undefined || v === '' ? '--' : String(v); return '--';
}
const locked = this.goodsLockedQuantity(goods);
const available = this.goodsAvailableQuantity(goods, locked);
if (available !== null || locked !== null) {
return String((available === null ? 0 : available) + (locked === null ? 0 : locked));
}
return this.goodsValueOrDash(
goods.quantity
?? goods.actual_quantity
?? goods.stock
?? goods.total_quantity
?? goods.qty
);
}, },
// 可移数量:参考商品查询页,直接取可用数量字段
goodsCopyCount(goods) { goodsCopyCount(goods) {
const v = goods?.available_quantity; if (!goods || typeof goods !== 'object') {
return v === null || v === undefined || v === '' ? '--' : String(v); return '--';
}
return this.goodsValueOrDash(
goods.available_quantity
?? goods.movable_quantity
?? goods.moveable_quantity
?? goods.can_move_quantity
?? goods.free_quantity
?? goods.usable_quantity
);
},
goodsLockedQuantity(goods) {
if (!goods || typeof goods !== 'object') {
return null;
}
return this.goodsToNumberOrNull(
goods.locked_quantity
?? goods.lock_quantity
?? goods.frozen_quantity
?? goods.freeze_quantity
);
},
goodsAvailableQuantity(goods, locked = null) {
if (!goods || typeof goods !== 'object') {
return null;
}
const available = this.goodsToNumberOrNull(
goods.available_quantity
?? goods.movable_quantity
?? goods.moveable_quantity
?? goods.can_move_quantity
?? goods.free_quantity
?? goods.usable_quantity
);
if (available !== null) {
return available;
}
const quantity = this.goodsToNumberOrNull(
goods.quantity
?? goods.actual_quantity
?? goods.stock
?? goods.total_quantity
?? goods.qty
);
if (quantity !== null && locked !== null) {
return quantity - locked;
}
return null;
},
goodsToNumberOrNull(value) {
if (value === null || value === undefined || value === '') {
return null;
}
const num = Number(value);
return Number.isNaN(num) ? null : num;
},
goodsValueOrDash(value) {
if (value === null || value === undefined || value === '') {
return '--';
}
return String(value);
}, },
// 商品图片:优先取已拉取的 images 列表,其次商品/库存对象上的单图字段 // 商品图片:优先取已拉取的 images 列表,其次商品/库存对象上的单图字段
goodsImage(goods) { goodsImage(goods) {
@ -581,8 +781,18 @@ export default {
color: #333; color: #333;
} }
.header__placeholder { .header__filter {
width: 80rpx; display: flex;
align-items: center;
justify-content: center;
background: #2979ff;
border-radius: 8rpx;
}
.header__filter-text {
font-size: 36rpx;
color: #ffffff;
padding: 8rpx 20rpx;
} }
.content_box { .content_box {
@ -812,8 +1022,106 @@ export default {
/* 底部安全区 */ /* 底部安全区 */
.safe-area-bottom { .safe-area-bottom {
height: constant(safe-area-inset-bottom); height: calc(40rpx + constant(safe-area-inset-bottom));
height: env(safe-area-inset-bottom); height: calc(40rpx + env(safe-area-inset-bottom));
}
/* 底部合计栏 */
.total-bar {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 24rpx;
padding-bottom: calc(20rpx + constant(safe-area-inset-bottom));
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
background: #ffffff;
border-top: 1rpx solid #f0f0f0;
}
.total-bar__label {
font-size: 36rpx;
color: #606266;
}
.total-bar__left {
display: flex;
align-items: center;
}
.total-bar__filter {
margin-left: 8rpx;
font-size: 34rpx;
color: #FF8C42;
}
.total-bar__value {
font-size: 38rpx;
font-weight: bold;
color: #2979ff;
}
/* 筛选弹窗 */
.filter-panel {
background: #ffffff;
border-radius: 20px 20px 0 0;
overflow: hidden;
padding: 32rpx 24rpx 40rpx;
box-sizing: border-box;
}
.filter-panel__header {
text-align: center;
padding-bottom: 20rpx;
}
.filter-panel__title {
font-size: 40rpx;
font-weight: 600;
color: #333;
}
.filter-panel__options {
display: flex;
flex-wrap: wrap;
margin: -8rpx;
}
.filter-panel__option {
flex: 0 0 calc(50% - 16rpx);
margin: 8rpx;
box-sizing: border-box;
padding: 24rpx 0;
text-align: center;
background: #f6f8fb;
border-radius: 12rpx;
font-size: 36rpx;
color: #606266;
}
.filter-panel__option--active {
background: #eaf2ff;
color: #2979ff;
font-weight: 600;
}
.filter-panel__actions {
display: flex;
margin-top: 32rpx;
}
.filter-panel__btn {
flex: 1;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 12rpx;
font-size: 36rpx;
}
.filter-panel__btn--close {
background: #f6f8fb;
color: #606266;
} }
/* 库位选择弹窗 */ /* 库位选择弹窗 */