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", "name": "wms-pda",
"version": "1.0.123", "version": "1.0.124",
"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

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<template> <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">
<view class="record-add__header"> <view class="record-add__header">
<text class="record-add__title">添加商品</text> <text class="record-add__title">添加商品</text>
@ -7,15 +7,23 @@
</view> </view>
<view class="record-add__search"> <view class="record-add__search">
<u-search <view class="record-add__search-box">
v-model="keyword" <u-search
placeholder="扫描/输入商品条码或名称" v-model="keyword"
bg-color="#f5f5f5" placeholder="扫描/输入商品条码或名称"
shape="round" bg-color="#f5f5f5"
:show-action="false" shape="round"
@search="handleSearch" :show-action="false"
@clear="handleClear" @search="handleSearch"
></u-search> @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> </view>
<scroll-view class="record-add__scroll" scroll-y> <scroll-view class="record-add__scroll" scroll-y>
@ -86,6 +94,10 @@
v-model="quantity" v-model="quantity"
placeholder="请输入数量" placeholder="请输入数量"
placeholder-style="color: #c0c4cc;" placeholder-style="color: #c0c4cc;"
:focus="quantityFocus"
:adjust-position="false"
@focus="onQuantityFocus"
@blur="onQuantityBlur"
/> />
</view> </view>
@ -121,6 +133,11 @@ export default {
type: String, type: String,
default: '' default: ''
}, },
// 库位名称(副标题展示用;缺失时回退库位编码)
locationName: {
type: String,
default: ''
},
storeId: { storeId: {
type: [Number, String], type: [Number, String],
default: null default: null
@ -139,13 +156,17 @@ export default {
unknownName: '', unknownName: '',
quantity: '', quantity: '',
loading: false, loading: false,
searched: false searched: false,
quantityFocus: false,
quantityFocused: false,
keyboardHeight: 0
} }
}, },
computed: { computed: {
subtitle() { subtitle() {
const parts = []; 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}`); if (this.detailId) parts.push(`明细 #${this.detailId}`);
return parts.join(' · ') || '按库位盘点录入商品'; return parts.join(' · ') || '按库位盘点录入商品';
}, },
@ -162,6 +183,10 @@ export default {
const value = Number(raw); const value = Number(raw);
if (!Number.isInteger(value) || value < 0) return false; if (!Number.isInteger(value) || value < 0) return false;
return !!(this.selected || this.useUnknown); return !!(this.selected || this.useUnknown);
},
// 键盘弹出时只上移弹窗自身,不推整页(仅在实盘数量输入框聚焦时上移,聚焦顶部搜索框不上移)
popupKeyboardStyle() {
return (this.keyboardHeight && this.quantityFocused) ? { transform: `translateY(-${this.keyboardHeight}px)` } : {};
} }
}, },
watch: { watch: {
@ -173,7 +198,68 @@ export default {
} }
} }
}, },
created() {
this.initKeyboardHeightListener();
},
beforeDestroy() {
this.destroyKeyboardHeightListener();
},
methods: { 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() { resetForm() {
this.keyword = ''; this.keyword = '';
@ -183,6 +269,8 @@ export default {
this.quantity = ''; this.quantity = '';
this.loading = false; this.loading = false;
this.searched = false; this.searched = false;
this.quantityFocus = false;
this.quantityFocused = false;
}, },
/** 外部(扫码)直接带关键字查询;弹窗已打开时同样生效 */ /** 外部(扫码)直接带关键字查询;弹窗已打开时同样生效 */
applyKeyword(keyword) { applyKeyword(keyword) {
@ -279,7 +367,6 @@ export default {
max-height: 80vh; max-height: 80vh;
padding: 32rpx 24rpx calc(24rpx + env(safe-area-inset-bottom)); padding: 32rpx 24rpx calc(24rpx + env(safe-area-inset-bottom));
box-sizing: border-box; box-sizing: border-box;
background: #ffffff;
} }
.record-add__header { .record-add__header {
@ -289,14 +376,15 @@ export default {
} }
.record-add__title { .record-add__title {
font-size: 36rpx; flex-shrink: 0;
font-size: 38rpx;
font-weight: 600; font-weight: 600;
color: #303133; color: #303133;
} }
.record-add__subtitle { .record-add__subtitle {
margin-top: 8rpx; margin-top: 8rpx;
font-size: 26rpx; font-size: 32rpx;
color: #909399; color: #909399;
} }
@ -304,6 +392,55 @@ export default {
margin-top: 24rpx; 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 { .record-add__scroll {
flex: 1; flex: 1;
min-height: 240rpx; min-height: 240rpx;
@ -314,7 +451,7 @@ export default {
.record-add__empty { .record-add__empty {
padding: 70rpx 0; padding: 70rpx 0;
text-align: center; text-align: center;
font-size: 30rpx; font-size: 38rpx;
color: #c0c4cc; color: #c0c4cc;
} }
@ -390,14 +527,14 @@ export default {
} }
.record-add__item-title { .record-add__item-title {
font-size: 32rpx; font-size: 36rpx;
color: #303133; color: #303133;
word-break: break-all; word-break: break-all;
} }
.record-add__item-subtitle { .record-add__item-subtitle {
margin-top: 6rpx; margin-top: 6rpx;
font-size: 26rpx; font-size: 34rpx;
color: #909399; color: #909399;
word-break: break-all; word-break: break-all;
} }
@ -428,7 +565,7 @@ export default {
} }
.record-add__unknown-tip { .record-add__unknown-tip {
font-size: 28rpx; font-size: 36rpx;
color: #ff9800; color: #ff9800;
} }
@ -439,7 +576,7 @@ export default {
} }
.record-add__unknown-code { .record-add__unknown-code {
font-size: 30rpx; font-size: 36rpx;
color: #303133; color: #303133;
word-break: break-all; word-break: break-all;
} }
@ -452,7 +589,7 @@ export default {
background: #ffffff; background: #ffffff;
border: 1rpx solid #ebeef5; border: 1rpx solid #ebeef5;
border-radius: 10rpx; border-radius: 10rpx;
font-size: 30rpx; font-size: 36rpx;
box-sizing: border-box; box-sizing: border-box;
} }
@ -463,12 +600,22 @@ export default {
color: #8a9099; color: #8a9099;
} }
.record-add__unknown .record-add__label {
font-size: 36rpx;
}
.record-add__qty { .record-add__qty {
margin-top: 24rpx; margin-top: 24rpx;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.record-add__qty .record-add__label {
font-size: 42rpx;
width: auto;
margin-right: 20rpx;
}
.record-add__qty-input { .record-add__qty-input {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
@ -477,7 +624,7 @@ export default {
background: #f5f7fa; background: #f5f7fa;
border: 1rpx solid #ebeef5; border: 1rpx solid #ebeef5;
border-radius: 10rpx; border-radius: 10rpx;
font-size: 34rpx; font-size: 42rpx;
box-sizing: border-box; box-sizing: border-box;
} }
@ -486,25 +633,20 @@ export default {
} }
.record-add__btn { .record-add__btn {
height: 88rpx; height: 84rpx;
border-radius: 44rpx;
background: #2979ff;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: #2979ff;
&:active { border-radius: 12rpx;
opacity: 0.9;
}
} }
.record-add__btn--disabled { .record-add__btn--disabled {
background: #c8d6f0; opacity: 0.5;
} }
.record-add__btn-text { .record-add__btn-text {
font-size: 34rpx; font-size: 36rpx;
font-weight: 600;
color: #ffffff; color: #ffffff;
} }
</style> </style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -89,7 +89,9 @@ export default {
scanKeyword: '', scanKeyword: '',
focusChildKey: '', focusChildKey: '',
scrollIntoViewId: '', scrollIntoViewId: '',
submitting: false submitting: false,
// 盲盘接口不返回数量:记录本次会话已上报的数量(detailId → 数量),刷新后回填
reportedQuantities: {}
}; };
}, },
computed: { computed: {
@ -182,6 +184,21 @@ export default {
this.scanKeyword = ''; this.scanKeyword = '';
this.focusChildKey = ''; 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) { locateItem(keyword) {
const children = this.row && Array.isArray(this.row.children) ? this.row.children : []; const children = this.row && Array.isArray(this.row.children) ? this.row.children : [];
@ -195,6 +212,7 @@ export default {
if (!target) { if (!target) {
this.focusChildKey = ''; this.focusChildKey = '';
uni.showToast({ title: '本库位未找到该商品', icon: 'none' }); uni.showToast({ title: '本库位未找到该商品', icon: 'none' });
this.speakMessage('无记录', { force: true, minInterval: 0 });
return; return;
} }
this.focusChildKey = target.key; this.focusChildKey = target.key;
@ -249,6 +267,8 @@ export default {
return false; return false;
} }
uni.showToast({ title: successText || '已记录', icon: 'success', duration: 600 }); uni.showToast({ title: successText || '已记录', icon: 'success', duration: 600 });
// 盲盘接口不返回数量:先记录本次上报数量,重拉后回填输入框与已盘数
this.reportedQuantities[String(payload.detailId)] = String(quantity);
// 上报后重拉该库位单行数据(状态/已盘数量以服务端口径为准) // 上报后重拉该库位单行数据(状态/已盘数量以服务端口径为准)
await this.loadRow(); await this.loadRow();
return true; return true;
@ -300,6 +320,24 @@ export default {
} }
}, },
// ===== 单库位作业数据(stock.check.workDataSpaceDetails:id + location_id)===== // ===== 单库位作业数据(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() { async loadRow() {
const id = Number(this.taskId); const id = Number(this.taskId);
const locationId = Number(this.locationId); const locationId = Number(this.locationId);
@ -329,6 +367,7 @@ export default {
const payload = extractObjectPayload(response); const payload = extractObjectPayload(response);
const rows = extractListPayload(payload, response); const rows = extractListPayload(payload, response);
this.row = normalizeSpaceWorkDetail(rows, this.taskInfo.mode); this.row = normalizeSpaceWorkDetail(rows, this.taskInfo.mode);
this.applyLocalQuantities();
this.loadError = this.row ? '' : '该库位暂无任务商品'; this.loadError = this.row ? '' : '该库位暂无任务商品';
return this.row; return this.row;
} catch (error) { } catch (error) {