From 512ed452e4ada5c0378923c3a2cf244d4def0ab8 Mon Sep 17 00:00:00 2001 From: zm2000 <18386612143@163.com> Date: Fri, 28 Aug 2026 17:51:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=8D=E6=A0=B8=E5=8F=91?= =?UTF-8?q?=E8=B4=A7=E3=80=81=E5=88=86=E6=8B=A3=E7=BC=BA=E8=B4=A7=E8=A1=A5?= =?UTF-8?q?=E8=B4=A7=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/replenishment/replenishShorts.vue | 461 +++++++++++++++++- .../order/order-review-comps/OrderList.vue | 6 +- .../order/order-review-comps/ReviewDetail.vue | 2 + 3 files changed, 441 insertions(+), 28 deletions(-) diff --git a/pages/replenishment/replenishShorts.vue b/pages/replenishment/replenishShorts.vue index 45513a6..fb80f49 100644 --- a/pages/replenishment/replenishShorts.vue +++ b/pages/replenishment/replenishShorts.vue @@ -2,12 +2,18 @@ - - + + + + + + 货主 + {{ selectedStoreIds.length }} + 分拣缺货补货 - - 刷新 + + 刷新 @@ -39,7 +45,7 @@ class="search-bar__input" type="text" v-model="searchKeyword" - placeholder="输入商品名称搜索..." + placeholder="输入商品名称/条码搜索..." placeholder-style="color: #c0c4cc; font-size: 34rpx;" confirm-type="search" /> @@ -94,6 +100,16 @@ {{ item.stock_name || '-' }} + + 货主名称 + + {{ item.store_name || '-' }} + + + 商品条码 + + {{ formatBarcodes(item.barcodes) }} + 出货数量 @@ -117,7 +133,16 @@ 补货库位 - {{ formatLocations(item.replenishment_locations) }} + + + 、{{ formatSpaceLabel(loc) }}({{ loc.available_quantity }}) + + - + @@ -130,25 +155,86 @@ - - 上一页 + + + + + + + + + + + + 选择货主 + + - - 第 {{ page }}/{{ totalPages }} 页,共 {{ getSummaryVal(summary.total_skus) }} 条 - + + + + + + + + + + 加载中... + + - 下一页 + {{ getStoreName(store) }} + + + + + + + + + 已选 {{ pendingSelectedStoreIds.length }} 个货主 + 清空 + + + 重置 + 确定 + @@ -163,6 +249,12 @@ total: 0, page: 1, pageSize: 20, + storeDrawerVisible: false, + storeList: [], + storeLoading: false, + storeSearchText: '', + selectedStoreIds: [], + pendingSelectedStoreIds: [], searchKeyword: '', sort: { sortField: 'shortage', @@ -174,21 +266,99 @@ totalPages() { return Math.max(1, Math.ceil(this.total / this.pageSize)); }, + hasSearch() { + return Boolean(this.searchKeyword.trim()); + }, filteredList() { const keyword = this.searchKeyword.trim(); if (!keyword) { return this.list; } + const kw = keyword.toLowerCase(); return this.list.filter(item => { const name = String(item.stock_name || '').toLowerCase(); - return name.includes(keyword.toLowerCase()); + if (name.includes(kw)) return true; + const barcodes = Array.isArray(item.barcodes) ? item.barcodes : []; + return barcodes.some(b => { + const code = String(b.barcode || b.code || b.custom_code || '').toLowerCase(); + return code.includes(kw); + }); + }); + }, + filteredStores() { + const keyword = String(this.storeSearchText || '').trim().toLowerCase(); + if (!keyword) { + return this.storeList; + } + return this.storeList.filter(store => { + const name = String(this.getStoreName(store) || '').toLowerCase(); + return name.includes(keyword); }); } }, onLoad() { + this.safeDispatchBroadcast('setCallbacks', { + onResult: this.handleBroadcastResult + }); + this.safeDispatchBroadcast('start'); this.fetchData(); }, + onShow() { + this.safeDispatchBroadcast('setCallbacks', { + onResult: this.handleBroadcastResult + }); + this.safeDispatchBroadcast('resume'); + }, + onHide() { + this.safeDispatchBroadcast('pause'); + }, + onUnload() { + this.safeDispatchBroadcast('stop'); + }, methods: { + safeDispatchBroadcast(action, payload) { + try { + const task = this.$store.dispatch(`broadcast/${action}`, payload); + if (task && typeof task.catch === 'function') { + task.catch(error => { + console.warn(`[ReplenishShorts] broadcast/${action} 调用失败:`, error); + }); + } + } catch (error) { + console.warn(`[ReplenishShorts] broadcast/${action} 调用异常:`, error); + } + }, + normalizeUniScanResult(scanResult) { + if (!scanResult) { + return ''; + } + if (typeof scanResult === 'string') { + return scanResult.trim(); + } + if (typeof scanResult.result === 'string') { + return scanResult.result.trim(); + } + if (Array.isArray(scanResult.result)) { + const firstResult = scanResult.result.find(item => item); + if (typeof firstResult === 'string') { + return firstResult.trim(); + } + if (firstResult && typeof firstResult.data === 'string') { + return firstResult.data.trim(); + } + } + if (typeof scanResult.data === 'string') { + return scanResult.data.trim(); + } + return ''; + }, + handleBroadcastResult(result) { + const rawCode = this.normalizeUniScanResult(result); + if (!rawCode) { + return; + } + this.searchKeyword = rawCode; + }, goProductQuery(item) { const keyword = item.stock_name || item.stock_code || item.stock_id || ''; const stockId = item.stock_id || ''; @@ -197,6 +367,59 @@ url: `/pages/work/product/query?stock_id=${encodeURIComponent(stockId)}` }); }, + async openStoreDrawer() { + this.storeDrawerVisible = true; + this.pendingSelectedStoreIds = [...this.selectedStoreIds]; + if (this.storeList.length > 0 || this.storeLoading) return; + this.storeLoading = true; + try { + const res = await this.$http('common.store', {}); + this.storeList = Array.isArray(res && res.stores) ? res.stores : []; + } catch (error) { + console.error('[replenishShorts] 加载货主失败:', error); + uni.showToast({ title: error?.message || error?.msg || '加载货主失败', icon: 'none' }); + } finally { + this.storeLoading = false; + } + }, + getStoreId(store) { + return store?.value ?? store?.id ?? store?.store_id ?? store?.storeId; + }, + getStoreName(store) { + return store?.label || store?.name || store?.store_name || '-'; + }, + isStoreSelected(store) { + const id = this.getStoreId(store); + if (id === undefined || id === null) return false; + return this.pendingSelectedStoreIds.some(sel => String(sel) === String(id)); + }, + toggleStore(store) { + const id = this.getStoreId(store); + if (id === undefined || id === null) return; + const index = this.pendingSelectedStoreIds.findIndex(sel => String(sel) === String(id)); + if (index >= 0) { + this.pendingSelectedStoreIds.splice(index, 1); + } else { + this.pendingSelectedStoreIds.push(id); + } + }, + clearStoreSelection() { + this.pendingSelectedStoreIds = []; + }, + resetStoreSelection() { + this.pendingSelectedStoreIds = []; + this.storeSearchText = ''; + }, + applyStoreSelection() { + this.selectedStoreIds = [...this.pendingSelectedStoreIds]; + this.storeDrawerVisible = false; + this.page = 1; + this.list = []; + this.fetchData(); + }, + handleStoreDrawerClose() { + this.storeDrawerVisible = false; + }, handleBack() { uni.navigateBack({ delta: 1 }); }, @@ -219,12 +442,12 @@ getSummaryVal(val) { return val ?? 0; }, - formatLocations(locations) { - if (!Array.isArray(locations) || locations.length === 0) return '-'; - return locations.map(loc => { - const spaceLabel = loc.space_name || loc.name || loc.custom_name || loc.space_code || '-'; - return `${spaceLabel}(${loc.available_quantity})`; - }).join('、'); + formatSpaceLabel(loc) { + return loc.space_name || loc.name || loc.custom_name || loc.space_code || '-'; + }, + formatBarcodes(barcodes) { + if (!Array.isArray(barcodes) || barcodes.length === 0) return '-'; + return barcodes.map(b => b.barcode || b.code || b.custom_code || '').filter(Boolean).join('、'); }, replenishStatusText(status) { const map = { @@ -261,6 +484,9 @@ sortOrder: this.sort.sortOrder } }; + if (this.selectedStoreIds.length > 0) { + params.store_id = this.selectedStoreIds.map(id => Number(id)); + } const res = await this.$http('storage.management.replenishmentDemand', params); @@ -313,12 +539,52 @@ min-width: 112rpx; display: flex; align-items: center; + gap: 16rpx; } .header-side--left { justify-content: flex-start; } + .header-side__btn { + display: flex; + align-items: center; + gap: 6rpx; + padding: 12rpx 16rpx; + border-radius: 8rpx; + background: #f5f7fa; + } + + .header-side__btn--store { + background: #07c160; + padding: 12rpx 28rpx; + margin-left: 32rpx; + } + + .header-side__btn--store .header-side__btn-text { + color: #ffffff; + font-size: 30rpx; + } + + .header-side__btn-badge { + min-width: 28rpx; + height: 28rpx; + padding: 0 6rpx; + border-radius: 14rpx; + background: #ff4d4f; + color: #ffffff; + font-size: 20rpx; + line-height: 28rpx; + text-align: center; + box-sizing: border-box; + } + + .header-side__btn-text { + font-size: 26rpx; + color: #303133; + line-height: 1; + } + .header-side--right { justify-content: flex-end; } @@ -439,6 +705,7 @@ /* ===== 页面主体 ===== */ .page-body { flex: 1; + min-height: 0; display: flex; flex-direction: column; overflow: hidden; @@ -486,6 +753,7 @@ /* ===== 卡片列表 ===== */ .card-scroll { flex: 1; + min-height: 0; overflow: hidden; } @@ -584,6 +852,10 @@ font-size: 28rpx; } + .card-metric__value--spaces-qty { + font-weight: 700; + } + /* ===== 加载更多 ===== */ .loadmore-state { display: flex; @@ -646,4 +918,141 @@ color: #c0c4cc; background: #f5f7fa; } + + /* ===== 货主抽屉 ===== */ + .store-drawer-layer { + position: fixed; + top: 0; + left: 0; + width: 0; + height: 0; + overflow: visible; + z-index: 9999; + } + + .store-drawer { + width: 560rpx; + height: calc(100vh - var(--status-bar-height)); + display: flex; + flex-direction: column; + background: #ffffff; + } + + .store-drawer__header { + height: 88rpx; + padding: 0 32rpx; + display: flex; + align-items: center; + justify-content: space-between; + border-bottom: 1rpx solid #ebeef5; + flex-shrink: 0; + } + + .store-drawer__close { + display: flex; + align-items: center; + justify-content: center; + padding: 8rpx; + } + + .store-drawer__title { + font-size: 32rpx; + font-weight: bold; + color: #303133; + } + + .store-drawer__loading { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 16rpx; + } + + .store-drawer__loading-text { + font-size: 26rpx; + color: #909399; + } + + .store-drawer__list { + flex: 1; + min-height: 0; + } + + .store-drawer__search { + padding: 16rpx 24rpx; + border-bottom: 1rpx solid #f0f2f5; + flex-shrink: 0; + } + + .store-drawer__item { + display: flex; + align-items: center; + justify-content: space-between; + gap: 16rpx; + padding: 28rpx 32rpx; + border-bottom: 1rpx solid #f0f2f5; + } + + .store-drawer__item--active { + background: #f0f9f0; + } + + .store-drawer__item-name { + font-size: 30rpx; + color: #303133; + line-height: 1.4; + word-break: break-all; + } + + .store-drawer__footer { + flex-shrink: 0; + padding: 20rpx 24rpx; + border-top: 1rpx solid #ebeef5; + background: #ffffff; + } + + .store-drawer__footer-info { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 16rpx; + } + + .store-drawer__footer-text { + font-size: 26rpx; + color: #909399; + } + + .store-drawer__footer-clear { + font-size: 26rpx; + color: #2979ff; + } + + .store-drawer__footer-btns { + display: flex; + gap: 16rpx; + } + + .store-drawer__footer-btn { + flex: 1; + height: 72rpx; + display: flex; + align-items: center; + justify-content: center; + border-radius: 8rpx; + font-size: 30rpx; + line-height: 1; + } + + .store-drawer__footer-btn--reset { + background: #f5f7fa; + color: #606266; + } + + .store-drawer__footer-btn--confirm { + background: #07c160; + color: #ffffff; + } \ No newline at end of file diff --git a/pages/work/order/order-review-comps/OrderList.vue b/pages/work/order/order-review-comps/OrderList.vue index a80b62a..dd4a1f5 100644 --- a/pages/work/order/order-review-comps/OrderList.vue +++ b/pages/work/order/order-review-comps/OrderList.vue @@ -60,8 +60,9 @@ class="record-value" :class="getReviewStatusText(item) === '已复核' ? 'record-value--reviewed' : (isIntercepted(item) ? 'record-value--intercepted-unreviewed' : 'record-value--unreviewed')" >{{ getReviewStatusText(item) }} + [{{ item.waveIndex }}] @@ -69,7 +70,8 @@ class="record-value record-value--id" :class="{ 'record-value--id-reviewed': getReviewStatusText(item) === '已复核' }" >{{ listType === 'single' ? (item.waybillNo || '--') : (item.waveNo || '--') }} - {{ item.boxNo }}号篮 + + {{ item.boxNo }}号篮 已打印