feat(盘点): 优化盘点录入体验并升级版本至 1.0.124

- 版本号: package.json 与 manifest.json 同步升级 1.0.123 → 1.0.124
- 盘点录入弹窗(CountRecordAddPopup): 打开后自动聚焦实盘数量输入框并弹出软键盘;
  键盘弹出时仅上移弹窗自身、且仅在数量输入框聚焦时上移, 不推整页;
  搜索框右侧新增"搜索"按钮与分隔线; 新增 locationName 属性, 副标题显示库位名称; 整体字号调大
- 库位录入弹窗(CountSpaceEntryPopup): 搜索框右侧新增"搜索"按钮; 副标题改为显示库位条码;
  键盘弹出仅数量输入框聚焦时上移; 查询无结果时语音播报"无记录"; 头部布局改为纵向居中
- 宫格列表(CountLocationGrid): 库位模式格子改为两行布局(库位名换行/数量+状态), 样式微调
- 库位明细(CountLocationDetail): zebra 行副标题颜色与区块数量字号调大
- 工作卡片(CountWorkCard): 子级标签 margin 微调
- countModel: 库位作业副标题仅显示条码; 库存搜索条码优先取 barcodes 数组、规格优先取 sku_property;
  库位搜索新增 customBarcode 字段
- 盘点明细页(inventoryCountDetail): recordAddTarget 新增 locationName; tab 切换文字字号调大
- 盘点商品页(inventoryCountGoods): 删除成功/失败增加语音播报
- 盘点库位页(inventoryCountLocation): 移除冗余"库位"行仅保留库位名称; 删除成功/失败增加语音播报
- 盘点库位作业页(inventoryCountSpace): 盲盘接口不返回数量时本地记录上报数量并在重拉后回填;
  未找到商品时语音播报"无记录"
- 分页组件(pagination): 总数信息字号调大
This commit is contained in:
zm2000 2026-10-10 18:02:01 +08:00
parent 2119e9dfc9
commit 88a034553d
13 changed files with 351 additions and 77 deletions

View File

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

View File

@ -219,7 +219,7 @@ export default {
.total-info {
margin-left: 40rpx;
color: #909399;
font-size: 24rpx;
font-size: 30rpx;
}

View File

@ -2,7 +2,7 @@
"name" : "WMS_PDA",
"appid" : "__UNI__0B3DAD3",
"description" : "多平台快速开发的UI框架",
"versionName" : "1.0.123",
"versionName" : "1.0.124",
"versionCode" : 1000123,
"transformPx" : false,
"app-plus" : {

View File

@ -216,7 +216,7 @@ export default {
margin-bottom: 8rpx;
padding: 6rpx 14rpx;
border-radius: 8rpx;
font-size: 24rpx;
font-size: 36rpx;
line-height: 1;
color: #909399;
background: #f5f7fa;
@ -280,8 +280,8 @@ export default {
.loc-detail__section-count {
margin-left: auto;
font-size: 30rpx;
color: #909399;
font-size: 36rpx;
color: #606266;
}
.loc-detail__section-unknown {
@ -394,6 +394,10 @@ export default {
word-break: break-all;
}
.loc-detail__row--zebra .loc-detail__row-sub {
color: #606266;
}
/* 账面 / 实盘 / 盈亏 */
.loc-detail__row-amounts {
margin-top: 8rpx;

View File

@ -25,10 +25,10 @@
<template v-else>
<view class="loc-grid__main">
<text class="loc-grid__code">{{ row.gridText || row.title || '--' }}</text>
</view>
<view class="loc-grid__side">
<text class="loc-grid__flag" :class="flagClass(row)">{{ flagText(row) }}</text>
<text class="loc-grid__count">{{ countText(row) }}</text>
<view class="loc-grid__status">
<text class="loc-grid__count">{{ countText(row) }}</text>
<text class="loc-grid__flag" :class="flagClass(row)">{{ flagText(row) }}</text>
</view>
</view>
</template>
</view>
@ -40,7 +40,7 @@
<script>
/**
* 库位宫格列表(2 列,每页 20 个 → 2 列 10 行,随页面滚动)
* mode=location:行=任务库位,点击格子进入库位明细页;格子单行(左库位名 / 右状态+数量)
* mode=location:行=任务库位,点击格子进入库位明细页;两行:库位名(放不下自动换行)/ 数量「N 项」+状态
* mode=space:行=库位(商品任务按库位聚合),三行:库位名 / 商品数+状态 / 已盘未盘进度
* 行数据来自 countModel.normalizeWorkRows(rows, view, mode)
* 格子显示完整库位名(缺失时回退库位编码)
@ -78,8 +78,7 @@ export default {
this.$emit('select', row.key);
},
cellClass(row) {
const classes = [];
if (this.isSpace) classes.push('loc-grid__inner--stack');
const classes = ['loc-grid__inner--stack'];
if (row.checked) classes.push('loc-grid__inner--done');
if (row.empty) classes.push('loc-grid__inner--empty');
if (row.hasUnknown) classes.push('loc-grid__inner--unknown');
@ -245,7 +244,6 @@ export default {
}
.loc-grid__count {
margin-top: 4rpx;
font-size: 28rpx;
line-height: 1;
color: #909399;

View File

@ -1,5 +1,5 @@
<template>
<u-popup :show="show" mode="bottom" round="20" :closeable="true" :safeAreaInsetBottom="true" @close="handleClose">
<u-popup :show="show" mode="bottom" round="20" :closeable="true" :safeAreaInsetBottom="true" :customStyle="popupKeyboardStyle" @open="handleOpen" @close="handleClose">
<view class="record-add">
<view class="record-add__header">
<text class="record-add__title">添加商品</text>
@ -7,15 +7,23 @@
</view>
<view class="record-add__search">
<u-search
v-model="keyword"
placeholder="扫描/输入商品条码或名称"
bg-color="#f5f5f5"
shape="round"
:show-action="false"
@search="handleSearch"
@clear="handleClear"
></u-search>
<view class="record-add__search-box">
<u-search
v-model="keyword"
placeholder="扫描/输入商品条码或名称"
bg-color="#f5f5f5"
shape="round"
:show-action="false"
@search="handleSearch"
@clear="handleClear"
></u-search>
<view class="record-add__search-actions">
<view class="record-add__search-divider"></view>
<view class="record-add__search-btn" @click="handleSearch">
<text class="record-add__search-btn-text">搜索</text>
</view>
</view>
</view>
</view>
<scroll-view class="record-add__scroll" scroll-y>
@ -86,6 +94,10 @@
v-model="quantity"
placeholder="请输入数量"
placeholder-style="color: #c0c4cc;"
:focus="quantityFocus"
:adjust-position="false"
@focus="onQuantityFocus"
@blur="onQuantityBlur"
/>
</view>
@ -121,6 +133,11 @@ export default {
type: String,
default: ''
},
// 库位名称(副标题展示用;缺失时回退库位编码)
locationName: {
type: String,
default: ''
},
storeId: {
type: [Number, String],
default: null
@ -139,13 +156,17 @@ export default {
unknownName: '',
quantity: '',
loading: false,
searched: false
searched: false,
quantityFocus: false,
quantityFocused: false,
keyboardHeight: 0
}
},
computed: {
subtitle() {
const parts = [];
if (this.location) parts.push(`库位 ${this.location}`);
const locText = this.locationName || this.location;
if (locText) parts.push(`库位名称 ${locText}`);
if (this.detailId) parts.push(`明细 #${this.detailId}`);
return parts.join(' · ') || '按库位盘点录入商品';
},
@ -162,6 +183,10 @@ export default {
const value = Number(raw);
if (!Number.isInteger(value) || value < 0) return false;
return !!(this.selected || this.useUnknown);
},
// 键盘弹出时只上移弹窗自身,不推整页(仅在实盘数量输入框聚焦时上移,聚焦顶部搜索框不上移)
popupKeyboardStyle() {
return (this.keyboardHeight && this.quantityFocused) ? { transform: `translateY(-${this.keyboardHeight}px)` } : {};
}
},
watch: {
@ -173,7 +198,68 @@ export default {
}
}
},
created() {
this.initKeyboardHeightListener();
},
beforeDestroy() {
this.destroyKeyboardHeightListener();
},
methods: {
initKeyboardHeightListener() {
// H5 端:监听 visualViewport 高度变化,差值即键盘高度(仅垫高弹窗,不整页上推)
// #ifdef H5
if (typeof window !== 'undefined' && window.visualViewport) {
this._baseViewportHeight = window.visualViewport.height;
this._onViewportResize = () => {
const vh = window.visualViewport ? window.visualViewport.height : window.innerHeight;
const diff = this._baseViewportHeight - vh;
this.keyboardHeight = diff > 0 ? Math.round(diff) : 0;
};
window.visualViewport.addEventListener('resize', this._onViewportResize);
}
// #endif
// #ifndef H5
this._keyboardHeightCb = (res) => {
this.keyboardHeight = (res && res.height) || 0;
};
if (typeof uni.onKeyboardHeightChange === 'function') {
uni.onKeyboardHeightChange(this._keyboardHeightCb);
}
// #endif
},
destroyKeyboardHeightListener() {
// #ifdef H5
if (typeof window !== 'undefined' && window.visualViewport && this._onViewportResize) {
window.visualViewport.removeEventListener('resize', this._onViewportResize);
this._onViewportResize = null;
}
// #endif
// #ifndef H5
if (this._keyboardHeightCb && typeof uni.offKeyboardHeightChange === 'function') {
uni.offKeyboardHeightChange(this._keyboardHeightCb);
this._keyboardHeightCb = null;
}
// #endif
},
/** 弹窗打开动画结束后聚焦实盘数量输入框,自动弹出软键盘 */
handleOpen() {
this.focusQuantity();
},
focusQuantity() {
this.quantityFocus = false;
this.$nextTick(() => {
// 延时确保输入框渲染完成、弹窗动画结束,软键盘能稳定弹出
setTimeout(() => {
this.quantityFocus = true;
}, 100);
});
},
onQuantityFocus() {
this.quantityFocused = true;
},
onQuantityBlur() {
this.quantityFocused = false;
},
/** 清空搜索词/选中项/名称/数量(提交成功后由父级调用,便于连续录入) */
resetForm() {
this.keyword = '';
@ -183,6 +269,8 @@ export default {
this.quantity = '';
this.loading = false;
this.searched = false;
this.quantityFocus = false;
this.quantityFocused = false;
},
/** 外部(扫码)直接带关键字查询;弹窗已打开时同样生效 */
applyKeyword(keyword) {
@ -279,7 +367,6 @@ export default {
max-height: 80vh;
padding: 32rpx 24rpx calc(24rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
background: #ffffff;
}
.record-add__header {
@ -289,14 +376,15 @@ export default {
}
.record-add__title {
font-size: 36rpx;
flex-shrink: 0;
font-size: 38rpx;
font-weight: 600;
color: #303133;
}
.record-add__subtitle {
margin-top: 8rpx;
font-size: 26rpx;
font-size: 32rpx;
color: #909399;
}
@ -304,6 +392,55 @@ export default {
margin-top: 24rpx;
}
.record-add__search-box {
position: relative;
::v-deep .u-search {
width: 100%;
}
::v-deep .u-search__content {
padding-right: 140rpx;
}
}
.record-add__search-actions {
position: absolute;
right: 24rpx;
top: 50%;
transform: translateY(-50%);
height: 68rpx;
display: flex;
align-items: center;
}
.record-add__search-divider {
width: 1rpx;
height: 28rpx;
background: #dcdfe6;
margin: 0 16rpx 0 10rpx;
}
.record-add__search-btn {
height: 68rpx;
padding: 0 8rpx;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
&:active {
opacity: 0.88;
}
}
.record-add__search-btn-text {
font-size: 34rpx;
font-weight: 500;
color: #2979ff;
line-height: 1;
}
.record-add__scroll {
flex: 1;
min-height: 240rpx;
@ -314,7 +451,7 @@ export default {
.record-add__empty {
padding: 70rpx 0;
text-align: center;
font-size: 30rpx;
font-size: 38rpx;
color: #c0c4cc;
}
@ -390,14 +527,14 @@ export default {
}
.record-add__item-title {
font-size: 32rpx;
font-size: 36rpx;
color: #303133;
word-break: break-all;
}
.record-add__item-subtitle {
margin-top: 6rpx;
font-size: 26rpx;
font-size: 34rpx;
color: #909399;
word-break: break-all;
}
@ -428,7 +565,7 @@ export default {
}
.record-add__unknown-tip {
font-size: 28rpx;
font-size: 36rpx;
color: #ff9800;
}
@ -439,7 +576,7 @@ export default {
}
.record-add__unknown-code {
font-size: 30rpx;
font-size: 36rpx;
color: #303133;
word-break: break-all;
}
@ -452,7 +589,7 @@ export default {
background: #ffffff;
border: 1rpx solid #ebeef5;
border-radius: 10rpx;
font-size: 30rpx;
font-size: 36rpx;
box-sizing: border-box;
}
@ -463,12 +600,22 @@ export default {
color: #8a9099;
}
.record-add__unknown .record-add__label {
font-size: 36rpx;
}
.record-add__qty {
margin-top: 24rpx;
display: flex;
align-items: center;
}
.record-add__qty .record-add__label {
font-size: 42rpx;
width: auto;
margin-right: 20rpx;
}
.record-add__qty-input {
flex: 1;
min-width: 0;
@ -477,7 +624,7 @@ export default {
background: #f5f7fa;
border: 1rpx solid #ebeef5;
border-radius: 10rpx;
font-size: 34rpx;
font-size: 42rpx;
box-sizing: border-box;
}
@ -486,25 +633,20 @@ export default {
}
.record-add__btn {
height: 88rpx;
border-radius: 44rpx;
background: #2979ff;
height: 84rpx;
display: flex;
align-items: center;
justify-content: center;
&:active {
opacity: 0.9;
}
background: #2979ff;
border-radius: 12rpx;
}
.record-add__btn--disabled {
background: #c8d6f0;
opacity: 0.5;
}
.record-add__btn-text {
font-size: 34rpx;
font-weight: 600;
font-size: 36rpx;
color: #ffffff;
}
</style>

View File

@ -8,15 +8,23 @@
<!-- 扫描/输入库位码 → 查询库位 -->
<view class="space-entry__search">
<u-search
v-model="keyword"
placeholder="扫描/输入库位编码、自定义名称"
bg-color="#f5f5f5"
shape="round"
:show-action="false"
@search="handleSearch"
@clear="handleSearch"
></u-search>
<view class="space-entry__search-box">
<u-search
v-model="keyword"
placeholder="扫描/输入库位编码、自定义名称"
bg-color="#f5f5f5"
shape="round"
:show-action="false"
@search="handleSearch"
@clear="handleSearch"
></u-search>
<view class="space-entry__search-actions">
<view class="space-entry__search-divider"></view>
<view class="space-entry__search-btn" @click="handleSearch">
<text class="space-entry__search-btn-text">搜索</text>
</view>
</view>
</view>
</view>
<scroll-view class="space-entry__scroll" scroll-y>
@ -33,7 +41,7 @@
>
<view class="space-item__main">
<text class="space-item__title">{{ item.title }}</text>
<text v-if="item.subtitle" class="space-item__subtitle">{{ item.subtitle }}</text>
<text v-if="item.customBarcode" class="space-item__subtitle">条码:{{ item.customBarcode }}</text>
</view>
<view class="space-item__radio" :class="{ 'space-item__radio--checked': selectedKey === item.key }">
<u-icon v-if="selectedKey === item.key" name="checkmark" size="24rpx" color="#ffffff"></u-icon>
@ -53,6 +61,8 @@
:adjust-position="false"
confirm-type="done"
@confirm="handleConfirm"
@focus="onQuantityFocus"
@blur="onQuantityBlur"
/>
</view>
@ -104,6 +114,7 @@ export default {
loading: false,
searched: false,
quantityFocus: false,
quantityFocused: false,
keyboardHeight: 0
};
},
@ -117,9 +128,9 @@ export default {
canConfirm() {
return !!this.selectedKey && String(this.quantity).trim() !== '';
},
// 键盘弹出时只上移弹窗自身,不推整页(paddingBottom 会与 max-height 冲突导致底部溢出)
// 键盘弹出时只上移弹窗自身,不推整页(仅在实盘数量输入框聚焦时上移,聚焦顶部搜索框不上移)
popupKeyboardStyle() {
return this.keyboardHeight ? { transform: `translateY(-${this.keyboardHeight}px)` } : {};
return (this.keyboardHeight && this.quantityFocused) ? { transform: `translateY(-${this.keyboardHeight}px)` } : {};
}
},
watch: {
@ -176,6 +187,21 @@ export default {
handleClose() {
this.$emit('close');
},
/** 语音播报(复用全局 $tools.speakText,受 voice.enabled 开关控制) */
speakMessage(message, options = {}) {
const text = String(message || '').trim();
if (!text) return;
const tools = this.$tools;
if (!tools || typeof tools.speakText !== 'function') return;
try {
const task = tools.speakText(text, options);
if (task && typeof task.catch === 'function') {
task.catch(error => console.warn('[CountSpaceEntryPopup] 语音播报失败:', error));
}
} catch (error) {
console.warn('[CountSpaceEntryPopup] 语音播报异常:', error);
}
},
resetForm() {
this.keyword = '';
this.list = [];
@ -184,6 +210,7 @@ export default {
this.loading = false;
this.searched = false;
this.quantityFocus = false;
this.quantityFocused = false;
},
/** 清空后用指定关键字重新查询(扫码/重复扫码时由父页调用) */
applyKeyword(code) {
@ -211,6 +238,9 @@ export default {
this.selectItem(this.list[0]);
} else {
this.selectedKey = '';
if (!this.list.length) {
this.speakMessage('无记录', { force: true, minInterval: 0 });
}
}
} catch (error) {
console.error('[CountSpaceEntryPopup] 库位查询失败:', error);
@ -235,6 +265,12 @@ export default {
}, 100);
});
},
onQuantityFocus() {
this.quantityFocused = true;
},
onQuantityBlur() {
this.quantityFocused = false;
},
/** 弹窗上滑动画结束后:扫码自动选中库位时,再自动聚焦一次保证软键盘弹出 */
handleOpen() {
if (this.selectedKey) {
@ -276,9 +312,8 @@ export default {
.space-entry__header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding-right: 60rpx;
}
.space-entry__title {
@ -289,16 +324,64 @@ export default {
}
.space-entry__subtitle {
margin-left: 20rpx;
margin-top: 8rpx;
font-size: 32rpx;
color: #909399;
text-align: right;
}
.space-entry__search {
margin-top: 24rpx;
}
.space-entry__search-box {
position: relative;
::v-deep .u-search {
width: 100%;
}
::v-deep .u-search__content {
padding-right: 140rpx;
}
}
.space-entry__search-actions {
position: absolute;
right: 24rpx;
top: 50%;
transform: translateY(-50%);
height: 68rpx;
display: flex;
align-items: center;
}
.space-entry__search-divider {
width: 1rpx;
height: 28rpx;
background: #dcdfe6;
margin: 0 16rpx 0 10rpx;
}
.space-entry__search-btn {
height: 68rpx;
padding: 0 8rpx;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
&:active {
opacity: 0.88;
}
}
.space-entry__search-btn-text {
font-size: 34rpx;
font-weight: 500;
color: #2979ff;
line-height: 1;
}
.space-entry__scroll {
flex: 1;
min-height: 200rpx;
@ -309,7 +392,7 @@ export default {
.space-entry__empty {
padding: 60rpx 0;
text-align: center;
font-size: 30rpx;
font-size: 38rpx;
color: #c0c4cc;
}

View File

@ -379,6 +379,10 @@ export default {
flex-wrap: wrap;
}
.work-child__side .work-card__tag {
margin-left: 0;
}
.work-child__amount {
margin-left: 16rpx;
font-size: 36rpx;

View File

@ -643,10 +643,9 @@ function normalizeSpaceWorkRow(item, index, open) {
return {
key: `space-${firstValue(source, ['id']) || spaceCode}`,
view: 'space',
// 标题优先显示库位名称,副标题显示库位编码(库位/库位名称互换)
// 标题优先显示库位名称,副标题仅显示库位条码
title: spaceName || spaceCode,
subtitle: joinText([
spaceName && spaceName !== spaceCode ? spaceCode : '',
firstValue(source, ['custom_barcode', 'customBarcode'])
]),
statusText: '',
@ -1088,10 +1087,10 @@ export function normalizeStockSearchRows(response) {
const source = row && typeof row === 'object' ? row : {};
const name = source.item_name || source.product_name || source.name || source.goods_name || '未命名商品';
const barcodeList = Array.isArray(source.barcodes) ? source.barcodes.filter(Boolean) : [];
const barcode = source.barcode || source.goods_code || source.item_code || barcodeList.join(';');
const barcode = barcodeList.length ? barcodeList.join(';') : (source.barcode || source.goods_code || source.item_code || '');
const storeStock = source.store_stock || {};
const storeName = storeStock.store_remask || storeStock.store_name || source.store_name || '';
const spec = source.spec || source.specification || '';
const spec = source.sku_property || source.spec || source.specification || '';
return {
key: `goods-${source.id || index}`,
id: source.id === undefined || source.id === null ? '' : source.id,
@ -1114,6 +1113,7 @@ export function normalizeSpaceSearchRows(response) {
id: source.id === undefined || source.id === null ? '' : source.id,
code,
title: name || code || `库位 #${index + 1}`,
customBarcode: source.custom_barcode ? String(source.custom_barcode) : '',
subtitle: [name ? code : '', source.custom_barcode ? `条码:${source.custom_barcode}` : ''].filter(Boolean).join(' · ')
};
}).filter(item => item.id !== '');

View File

@ -123,6 +123,7 @@
:show="showRecordAdd"
:detail-id="recordAddTarget.detailId"
:location="recordAddTarget.location"
:location-name="recordAddTarget.locationName"
:store-id="taskInfo.storeId"
@close="showRecordAdd = false"
@confirm="handleRecordAddConfirm"
@ -249,7 +250,7 @@ export default {
markEmptyTarget: null,
showDetailPicker: false,
showRecordAdd: false,
recordAddTarget: { detailId: '', location: '' },
recordAddTarget: { detailId: '', location: '', locationName: '' },
currentTab: 0,
// 作业数据(stock.check.workData)
workList: [],
@ -701,7 +702,7 @@ export default {
const key = payload && payload.key;
if (!row || !this.canEdit) return;
if (key === 'add-goods') {
this.recordAddTarget = { detailId: row.detailId || '', location: row.location || '' };
this.recordAddTarget = { detailId: row.detailId || '', location: row.location || '', locationName: row.locationName || '' };
this.showRecordAdd = true;
return;
}
@ -1024,7 +1025,7 @@ export default {
}
.tabs-container__switch-text {
font-size: 24rpx;
font-size: 30rpx;
line-height: 1;
color: #2979ff;
white-space: nowrap;

View File

@ -502,6 +502,7 @@ export default {
});
if (response?.flag === 'failure') {
uni.showToast({ title: response.message || '删除失败', icon: 'none' });
this.speakMessage('删除失败', { force: true, minInterval: 0 });
return false;
}
const payload = extractObjectPayload(response);
@ -511,11 +512,13 @@ export default {
if (Number.isFinite(deleted)) title = `已删除 ${deleted} 条`;
if (skipped) title += `,跳过 ${skipped} 条`;
uni.showToast({ title, icon: 'none', duration: 1600 });
this.speakMessage('已删除', { force: true, minInterval: 0 });
await this.loadInfo();
return true;
} catch (error) {
console.error('[inventoryCountGoods] 删除作业记录失败:', error);
uni.showToast({ title: '删除失败', icon: 'none' });
this.speakMessage('删除失败', { force: true, minInterval: 0 });
return false;
} finally {
this.submitting = false;

View File

@ -34,10 +34,6 @@
<text class="inv-loc-card__label">盘点单号</text>
<text class="inv-loc-card__value">{{ checkNo || '--' }}</text>
</view>
<view class="inv-loc-card__row">
<text class="inv-loc-card__label">库位</text>
<text class="inv-loc-card__value">{{ locationCode || '--' }}</text>
</view>
<view v-if="showLocationName" class="inv-loc-card__row">
<text class="inv-loc-card__label">库位名称</text>
<text class="inv-loc-card__value">{{ locationName }}</text>
@ -76,6 +72,7 @@
:show="showRecordAdd"
:detail-id="detailId"
:location="locationCode"
:location-name="locationName"
:store-id="storeId"
:prefill-keyword="pendingBarcode"
@close="closeAddPopup"
@ -388,6 +385,7 @@ export default {
});
if (response?.flag === 'failure') {
uni.showToast({ title: response.message || '删除失败', icon: 'none' });
this.speakMessage('删除失败', { force: true, minInterval: 0 });
return false;
}
const payload = extractObjectPayload(response);
@ -397,11 +395,13 @@ export default {
if (Number.isFinite(deleted)) title = `已删除 ${deleted} 条`;
if (skipped) title += `,跳过 ${skipped} 条`;
uni.showToast({ title, icon: 'none', duration: 1600 });
this.speakMessage('已删除', { force: true, minInterval: 0 });
await this.loadRow();
return true;
} catch (error) {
console.error('[inventoryCountLocation] 删除作业记录失败:', error);
uni.showToast({ title: '删除失败', icon: 'none' });
this.speakMessage('删除失败', { force: true, minInterval: 0 });
return false;
} finally {
this.submitting = false;
@ -563,14 +563,14 @@ export default {
.inv-loc-card__label {
flex-shrink: 0;
width: 160rpx;
font-size: 28rpx;
font-size: 30rpx;
color: #8a9099;
}
.inv-loc-card__value {
flex: 1;
min-width: 0;
font-size: 30rpx;
font-size: 32rpx;
color: #303133;
word-break: break-all;
}

View File

@ -89,7 +89,9 @@ export default {
scanKeyword: '',
focusChildKey: '',
scrollIntoViewId: '',
submitting: false
submitting: false,
// 盲盘接口不返回数量:记录本次会话已上报的数量(detailId → 数量),刷新后回填
reportedQuantities: {}
};
},
computed: {
@ -182,6 +184,21 @@ export default {
this.scanKeyword = '';
this.focusChildKey = '';
},
/** 语音播报(复用全局 $tools.speakText,受 voice.enabled 开关控制) */
speakMessage(message, options = {}) {
const text = String(message || '').trim();
if (!text) return;
const tools = this.$tools;
if (!tools || typeof tools.speakText !== 'function') return;
try {
const task = tools.speakText(text, options);
if (task && typeof task.catch === 'function') {
task.catch(error => console.warn('[inventoryCountSpace] 语音播报失败:', error));
}
} catch (error) {
console.warn('[inventoryCountSpace] 语音播报异常:', error);
}
},
/** 在本库位商品里定位(先精确后模糊),命中后高亮并滚动到该行 */
locateItem(keyword) {
const children = this.row && Array.isArray(this.row.children) ? this.row.children : [];
@ -195,6 +212,7 @@ export default {
if (!target) {
this.focusChildKey = '';
uni.showToast({ title: '本库位未找到该商品', icon: 'none' });
this.speakMessage('无记录', { force: true, minInterval: 0 });
return;
}
this.focusChildKey = target.key;
@ -249,6 +267,8 @@ export default {
return false;
}
uni.showToast({ title: successText || '已记录', icon: 'success', duration: 600 });
// 盲盘接口不返回数量:先记录本次上报数量,重拉后回填输入框与已盘数
this.reportedQuantities[String(payload.detailId)] = String(quantity);
// 上报后重拉该库位单行数据(状态/已盘数量以服务端口径为准)
await this.loadRow();
return true;
@ -300,6 +320,24 @@ export default {
}
},
// ===== 单库位作业数据(stock.check.workDataSpaceDetails:id + location_id)=====
/** 盲盘下接口不返回数量:把本会话已上报的数量回填到对应商品行(输入框 + 已盘数) */
applyLocalQuantities() {
const row = this.row;
if (!row || !Array.isArray(row.children)) return;
row.children.forEach(child => {
if (!child || !child.unit || !child.unit.detailId) return;
const value = this.reportedQuantities[String(child.unit.detailId)];
if (value === undefined || value === null || String(value) === '') return;
const text = String(value);
child.unit.reported = true;
child.unit.inputValue = text;
child.unit.original = text;
child.statusText = '已盘';
child.statusClass = 'work-card__tag--done';
// 盲盘无账面数量,用 quantityText 显示「实盘 X」
child.quantityText = text;
});
},
async loadRow() {
const id = Number(this.taskId);
const locationId = Number(this.locationId);
@ -329,6 +367,7 @@ export default {
const payload = extractObjectPayload(response);
const rows = extractListPayload(payload, response);
this.row = normalizeSpaceWorkDetail(rows, this.taskInfo.mode);
this.applyLocalQuantities();
this.loadError = this.row ? '' : '该库位暂无任务商品';
return this.row;
} catch (error) {