diff --git a/core/request/apis.js b/core/request/apis.js index 033aa7c..6d28d47 100644 --- a/core/request/apis.js +++ b/core/request/apis.js @@ -288,6 +288,12 @@ export default { auth: true, method: "POST", isSystemApi: true + }, + getOrderPrintData: { + path: "order.print.getOrderPrintData", + auth: true, + method: "POST", + isSystemApi: true } }, wave: { @@ -323,6 +329,12 @@ export default { method: "POST", isSystemApi: true }, + scanTask: { + path: "order.recheckOrder.scanTask", + auth: true, + method: "POST", + isSystemApi: true + }, scanOrder: { path: "order.recheckOrder.scanOrder", auth: true, diff --git a/pages/work/order/order-review.vue b/pages/work/order/order-review.vue index d1879b3..45428f5 100644 --- a/pages/work/order/order-review.vue +++ b/pages/work/order/order-review.vue @@ -1,11 +1,7 @@ @@ -119,7 +128,7 @@ export default { data() { return { - title: '拣货商品详情', + title: '订单商品详情', currentGoodsIndex: 0, confirmingRecheck: false, matchedGoodsId: '', @@ -177,6 +186,22 @@ return false; } return !!this.matchedGoodsState[currentId]; + }, + totalPlanQty() { + return this.goodsList.reduce((sum, item) => sum + (item.planQty || 0), 0); + }, + isAllMatched() { + return this.goodsList.every(item => { + const id = String(item?.id || ''); + if (!id) return false; + return !!this.matchedGoodsState[id]; + }); + }, + isAllScanned() { + return this.goodsList.every(item => (item.scannedQty || 0) >= (item.planQty || 0)); + }, + canConfirmRecheck() { + return this.isAllMatched && this.isAllScanned; } }, onLoad(options) { @@ -192,7 +217,8 @@ pickerName: options?.pickerName || '--', cartNo: options?.cartNo || '--', status: options?.status || 'pending', - unreviewedCount: Number(options?.unreviewedCount || 0) + unreviewedCount: Number(options?.unreviewedCount || 0), + listType: String(options?.listType || '').trim() }; if (this.isRecheckFinished) { uni.showToast({ @@ -334,9 +360,38 @@ this.matchedGoodsState[this.matchedGoodsId] = true; } } - uni.showToast({ - title: '条码匹配成功', - icon: 'success' + + const matchedItem = this.goodsList[matchIndex]; + const itemName = matchedItem?.skuName || '商品'; + const maxQty = matchedItem?.planQty || 0; + const currentScanned = matchedItem?.scannedQty || 0; + + uni.showModal({ + title: `扫描成功:${itemName}`, + content: `请输入数量(共 ${maxQty},已扫 ${currentScanned}):`, + editable: true, + placeholderText: '请输入数量', + success: (res) => { + if (!res.confirm) return; + const inputQty = this.toPositiveNumber(res.content, 0); + if (inputQty <= 0) { + uni.showToast({ title: '请输入有效数量', icon: 'none' }); + return; + } + const newScanned = Math.min(inputQty, maxQty); + if (typeof this.$set === 'function') { + this.$set(this.goodsList, matchIndex, { + ...matchedItem, + scannedQty: newScanned + }); + } else { + this.goodsList[matchIndex].scannedQty = newScanned; + } + uni.showToast({ + title: `已录入 ${newScanned} 个`, + icon: 'success' + }); + } }); }, toPositiveNumber(value, fallback = 0) { @@ -378,9 +433,13 @@ buildGoodsListByItems(items) { const sourceList = Array.isArray(items) ? items : []; return sourceList.map((item, index) => { + // 判断是否为 stock 对象(直接包含 item_name 等字段) + const isStockItem = !!item?.stock_id || (!!item?.item_name && !!item?.plan_qty); + const stockItem = isStockItem ? item : (Array.isArray(item?.stock) && item.stock.length > 0 ? item.stock[0] : null); const snapshot = item?.item_snapshot && typeof item.item_snapshot === 'object' ? item.item_snapshot : {}; + const stockImages = stockItem ? (Array.isArray(stockItem.images) ? stockItem.images : []) : []; const snapshotImages = [ ...(Array.isArray(snapshot?.images) ? snapshot.images : []), ...(Array.isArray(snapshot?.image_list) ? snapshot.image_list : []) @@ -391,20 +450,28 @@ .map(url => String(url || '').trim()) .filter(url => !!url); const snapshotSingleImage = String(snapshot?.image || snapshot?.pic || '').trim(); - const images = snapshotImages.length - ? snapshotImages - : (snapshotSingleImage ? [snapshotSingleImage] : itemImages); + const images = stockImages.length + ? stockImages + : (snapshotImages.length + ? snapshotImages + : (snapshotSingleImage ? [snapshotSingleImage] : itemImages)); const imageUrl = images.length > 0 ? String(images[0] || '') : ''; - const planQty = this.toPositiveNumber(item?.plan_qty, 0); + const planQty = this.toPositiveNumber(stockItem?.plan_qty ?? item?.plan_qty, 0); + const scannedQty = this.toPositiveNumber(item?.scanned_qty ?? item?.finish_qty ?? item?.scannedQty ?? 0, 0); + const stockName = stockItem ? String(stockItem.item_name || '').trim() : ''; + const stockBarcodes = stockItem ? (Array.isArray(stockItem.barcodes) ? stockItem.barcodes : []) : []; return { - id: String(item?.id || `${this.detailInfo.recordId || 'record'}-${index + 1}`), + id: String(item?.id || stockItem?.stock_id || `${this.detailInfo.recordId || 'record'}-${index + 1}`), lineNo: this.toPositiveNumber(item?.order_line_no, index + 1), planQty, - skuCode: String(item?.item_code || snapshot?.item_code || ''), - skuName: String(snapshot?.item_name || item?.item_name || '--'), - location: String(snapshot?.sku_property || item?.sku_property || '--'), - barcode: String(snapshot?.barcode || snapshot?.item_code || item?.item_code || '--'), + scannedQty, + packageRequirement: String(item?.packing_requirements || item?.package_requirement || item?.packageRequirement || item?.packing_requirement || '').trim() || '--', + skuCode: String(stockItem?.item_code || item?.item_code || snapshot?.item_code || ''), + skuName: stockName || String(snapshot?.item_name || item?.item_name || '--'), + location: String(stockItem?.sku_property || snapshot?.sku_property || item?.sku_property || '--'), + barcode: stockBarcodes.length > 0 ? stockBarcodes.join(', ') : String(snapshot?.barcode || snapshot?.item_code || item?.item_code || '--'), + barcodes: stockBarcodes.length > 0 ? stockBarcodes : (snapshot?.barcode ? [snapshot.barcode] : []), imageUrl, images, pickedQty: 0 @@ -441,10 +508,11 @@ }, handleComplete() { if (this.isRecheckFinished) { - uni.showToast({ - title: '该订单已复核完成', - icon: 'none' - }); + uni.showToast({ title: '该订单已复核完成', icon: 'none' }); + return; + } + if (!this.canConfirmRecheck) { + uni.showToast({ title: '请先完成所有商品条码扫描和数量核对', icon: 'none' }); return; } this.confirmRecheck(); @@ -470,10 +538,11 @@ uni.showLoading({ title: '确认复核中...' }); + const params = { order_id: orderId }; + console.log('[confirmRecheck] 请求参数:', JSON.stringify(params)); try { - await this.$http('order.recheckOrder.confirmRecheck', { - order_id: orderId - }); + const response = await this.$http('order.recheckOrder.confirmRecheck', params); + console.log('[confirmRecheck] 返回数据:', JSON.stringify(response)); uni.showToast({ title: '已确认复核', icon: 'success' @@ -493,6 +562,12 @@ uni.hideLoading(); } }, + handleReprint() { + uni.showToast({ title: '面单补打', icon: 'none' }); + }, + handleWeigh() { + uni.showToast({ title: '称重', icon: 'none' }); + }, getStatusText(status) { const map = { pending: '待拣货', @@ -506,6 +581,8 @@ id: `${this.detailInfo.recordId || 'record'}-${index + 1}`, lineNo: (index % 4) + 1, planQty: (index % 6) + 2, + scannedQty: 0, + packageRequirement: '--', skuCode: `SKU${String(index + 1).padStart(4, '0')}`, skuName: `模拟商品${index + 1}`, location: `A-${String(index + 1).padStart(2, '0')}`, @@ -577,7 +654,12 @@ color: #ffffff; padding: 8rpx 18rpx; border-radius: 6rpx; - background: #2979ff; + background: #07c160; + } + + .nav-right-complete--disabled { + background: #c0c4cc; + pointer-events: none; } .page-head { @@ -585,10 +667,65 @@ padding: 16rpx; background: #fff; border-radius: 12rpx; + } + + .page-head-row { display: flex; align-items: center; } + .page-head-row--top { + margin-bottom: 10rpx; + } + + .page-head-row--bottom { + justify-content: space-between; + } + + .page-head-value { + font-size: 32rpx; + font-weight: 600; + color: #303133; + flex: 1; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .page-head-picker { + font-size: 26rpx; + color: #909399; + } + + .page-head-actions { + display: flex; + gap: 12rpx; + flex-shrink: 0; + } + + .page-head-actions { + gap: 20rpx; + } + + .page-head-btn { + font-size: 26rpx; + color: #ffffff; + padding: 6rpx 16rpx; + border: none; + border-radius: 8rpx; + background: #fa8c16; + white-space: nowrap; + } + + .page-head-btn--primary { + background: #2979ff; + } + + .page-head-btn:active { + opacity: 0.7; + } + .page-head-item { flex: 1; display: flex; @@ -596,22 +733,6 @@ min-width: 0; } - .page-head-label { - font-size: 28rpx; - line-height: 40rpx; - color: #909399; - display: inline-flex; - align-items: center; - flex-shrink: 0; - white-space: nowrap !important; - word-break: keep-all; - overflow-wrap: normal; - } - - .page-head-label::after { - content: ':'; - } - .page-head-value { margin-left: 8rpx; font-size: 36rpx; @@ -673,6 +794,11 @@ flex-shrink: 0; } + .label--package { + width: 170rpx; + min-width: 170rpx; + } + .value { flex: 1; color: #303133; @@ -816,6 +942,11 @@ margin-top: 22rpx; } + .goods-row--pick-btn { + margin-top: 12rpx; + justify-content: flex-end; + } + .pick-list-title-btn { margin-top: 0; margin-left: auto; @@ -918,6 +1049,15 @@ color: #2979ff; } + .metric-scanned { + position: absolute; + left: 8rpx; + bottom: 4rpx; + font-size: 28rpx; + line-height: 36rpx; + color: #19be6b; + } + .switch-row { margin-top: 14rpx; display: flex; @@ -946,6 +1086,26 @@ margin-bottom: 8rpx; } + .bottom-summary { + padding: 16rpx 24rpx; + padding-bottom: calc(16rpx + env(safe-area-inset-bottom)); + background: #ffffff; + border-top: 1rpx solid #ebeef5; + text-align: left; + flex-shrink: 0; + } + + .bottom-summary-text { + font-size: 28rpx; + color: #909399; + } + + .bottom-summary-value { + font-size: 32rpx; + font-weight: 600; + color: #2979ff; + } + .empty-state { height: 100%; display: flex;