From 630f2a3a3c64b6e41e609cd3feca6898cc8a8bc5 Mon Sep 17 00:00:00 2001 From: zm2000 <18386612143@163.com> Date: Tue, 27 Oct 2026 18:22:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=BA=93=E5=AD=98=E7=9B=98=E7=82=B9):=20?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E6=96=B0=E5=A2=9E=E7=9B=98=E7=82=B9?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E9=80=89=E6=8B=A9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 CountDetailPicker 盘点明细选择组件 - inventoryCountDetail 接入明细选择流程 - countModel 补充明细选择相关共享口径 - apis 调整盘点相关接口定义 --- src/core/request/apis.js | 2 +- .../CountDetailPicker.vue | 2 +- .../inventoryCount-comps/countModel.js | 13 +- src/pages/warehouse/inventoryCountDetail.vue | 123 +++++++++++++++++- 4 files changed, 126 insertions(+), 14 deletions(-) diff --git a/src/core/request/apis.js b/src/core/request/apis.js index 292605f..00a37e5 100644 --- a/src/core/request/apis.js +++ b/src/core/request/apis.js @@ -526,7 +526,7 @@ export default { isSystemApi: true }, // 添加盘点明细(按任务盘点类型决定维度):商品任务传 stock_ids; - // 库位任务传 locations/location_ids(location_ids 优先),type=all 两者都不传则自动拉全仓启用库位 + // 库位任务传 locations/location_ids(location_ids 优先),type=location 两者都不传则自动拉全仓启用库位 // 仅 created/rejected 允许;已存在的盘点项自动跳过(幂等);完成后重算主表 total_items addDetail: { path: "stock.check.addDetail", diff --git a/src/pages/warehouse/inventoryCount-comps/CountDetailPicker.vue b/src/pages/warehouse/inventoryCount-comps/CountDetailPicker.vue index c9716fc..4f5bd8c 100644 --- a/src/pages/warehouse/inventoryCount-comps/CountDetailPicker.vue +++ b/src/pages/warehouse/inventoryCount-comps/CountDetailPicker.vue @@ -19,7 +19,7 @@ > - + 全部库位(自动拉取全仓库启用库位) diff --git a/src/pages/warehouse/inventoryCount-comps/countModel.js b/src/pages/warehouse/inventoryCount-comps/countModel.js index 4a4fbc8..78fe026 100644 --- a/src/pages/warehouse/inventoryCount-comps/countModel.js +++ b/src/pages/warehouse/inventoryCount-comps/countModel.js @@ -72,23 +72,22 @@ export function detailStatusText(status) { return map[key] || ''; } -/** 盘点类型文案:goods=商品盘点 / store=商品盘点(货主)/ location=库位盘点 / all=库位盘点(全仓) */ +/** 盘点类型文案:goods=商品盘点 / store=商品盘点(货主)/ location=库位盘点 */ export function typeText(type) { const map = { goods: '商品盘点', store: '商品盘点(货主)', - location: '库位盘点', - all: '库位盘点(全仓)' + location: '库位盘点' }; const key = String(type || '').trim().toLowerCase(); return map[key] || (type ? String(type) : '--'); } -/** 盘点类型色调:goods/store→商品盘点,location/all→库位盘点 */ +/** 盘点类型色调:goods/store→商品盘点,location→库位盘点 */ export function typeTone(type) { const key = String(type || '').trim().toLowerCase(); if (key === 'goods' || key === 'store') return 'goods'; - if (key === 'location' || key === 'all') return 'location'; + if (key === 'location') return 'location'; return ''; } @@ -482,7 +481,7 @@ export function normalizeCheckResultRows(rows) { // ===== 作业列表(stock.check.workData)===== -/** 商品类任务:type=goods/store(库位类任务 type=location/all) */ +/** 商品类任务:type=goods/store(库位类任务 type=location) */ export function isGoodsTask(type) { const key = String(type || '').trim().toLowerCase(); return key === 'goods' || key === 'store'; @@ -495,7 +494,7 @@ export function isOpenCheckMode(mode) { /** * 作业解析视图: - * 库位任务(location/all)一律 location;商品任务(goods/store)默认 space,isGoods=true 时为 goods + * 库位任务(location)一律 location;商品任务(goods/store)默认 space,isGoods=true 时为 goods */ export function resolveWorkView(type, isGoods) { if (!isGoodsTask(type)) return 'location'; diff --git a/src/pages/warehouse/inventoryCountDetail.vue b/src/pages/warehouse/inventoryCountDetail.vue index 06c6a8a..bbc054f 100644 --- a/src/pages/warehouse/inventoryCountDetail.vue +++ b/src/pages/warehouse/inventoryCountDetail.vue @@ -195,6 +195,33 @@ + + + + + 全部库位 + + 将自动添加当前仓库全部启用库位,盘点范围会扩大。确认继续? + + + 取消 + + {{ submitting ? '添加中...' : '确认添加' }} + + + + @@ -249,6 +276,8 @@ export default { showMarkEmptyConfirm: false, markEmptyTarget: null, showDetailPicker: false, + showAllLocationsConfirm: false, + pendingAllLocationsParams: null, showRecordAdd: false, recordAddTarget: { detailId: '', location: '', locationName: '', spaceId: '' }, currentTab: 0, @@ -306,13 +335,13 @@ export default { showAddDetailEntry() { return this.currentTab === 0 && this.canAddDetail; }, - // 添加维度由任务盘点类型决定:商品任务加商品行,库位任务(含 all)加库位行 + // 添加维度由任务盘点类型决定:商品任务加商品行,库位任务加库位行 detailPickerMode() { return this.isGoodsCheckTask ? 'goods' : 'location'; }, - // type=all 的库位任务支持一键全仓(不传 locations/location_ids) + // 库位任务(type=location)支持一键全仓(不传 locations/location_ids) allowAllLocations() { - return this.detailPickerMode === 'location' && String(this.taskInfo.type || '').trim().toLowerCase() === 'all'; + return this.detailPickerMode === 'location'; }, // 作业数据解析视图:location / goods / space workView() { @@ -826,18 +855,25 @@ export default { }, // ===== 添加明细(stock.check.addDetail)===== async handleDetailPickerConfirm(payload) { - this.showDetailPicker = false; if (!this.taskId || !payload) return; const params = { id: Number(this.taskId) }; if (payload.mode === 'goods') { if (!payload.ids.length) return; params.stock_ids = payload.ids; } else if (payload.all) { - // 不传 locations / location_ids,后端自动拉取全仓启用库位 + // 不传 locations / location_ids,后端自动拉取全仓启用库位;先二次确认 + this.showDetailPicker = false; + this.pendingAllLocationsParams = params; + this.showAllLocationsConfirm = true; + return; } else { if (!payload.ids.length) return; params.location_ids = payload.ids; } + this.showDetailPicker = false; + await this.submitAddDetail(params); + }, + async submitAddDetail(params) { uni.showLoading({ title: '添加中...', mask: true }); try { const response = await this.$http('check.addDetail', params); @@ -863,6 +899,17 @@ export default { uni.hideLoading(); } }, + cancelAllLocations() { + this.showAllLocationsConfirm = false; + this.pendingAllLocationsParams = null; + }, + async confirmAllLocations() { + const params = this.pendingAllLocationsParams; + this.showAllLocationsConfirm = false; + this.pendingAllLocationsParams = null; + if (!params) return; + await this.submitAddDetail(params); + }, // ===== 加载与提交 ===== async loadTaskDetail() { this.loading = true; @@ -1302,4 +1349,70 @@ export default { pointer-events: none; } +/* 全部库位二次确认弹窗(一键全仓前提示) */ +.all-locations-confirm-popup { + width: 640rpx; + padding: 40rpx 32rpx 32rpx; + background: #ffffff; + border-radius: 20rpx; + box-sizing: border-box; +} + +.all-locations-confirm-popup__title { + font-size: 42rpx; + font-weight: 600; + color: #303133; + text-align: center; + margin-bottom: 32rpx; +} + +.all-locations-confirm-popup__body { + margin-bottom: 36rpx; + padding: 24rpx; + background: #eef4ff; + border-radius: 12rpx; +} + +.all-locations-confirm-popup__text { + font-size: 36rpx; + color: #303133; + line-height: 1.6; +} + +.all-locations-confirm-popup__actions { + display: flex; + align-items: center; +} + +.all-locations-confirm-popup__btn { + flex: 1; + height: 88rpx; + border-radius: 12rpx; + display: flex; + align-items: center; + justify-content: center; + font-size: 36rpx; + font-weight: 500; +} + +.all-locations-confirm-popup__btn + .all-locations-confirm-popup__btn { + margin-left: 20rpx; +} + +.all-locations-confirm-popup__btn--cancel { + background: #f5f7fa; + color: #606266; + border: 1rpx solid #dcdfe6; +} + +.all-locations-confirm-popup__btn--confirm { + background: #2979ff; + color: #ffffff; +} + +.all-locations-confirm-popup__btn--disabled { + opacity: 0.6; + pointer-events: none; +} +