diff --git a/env.js b/env.js index b87b72a..c33f58a 100644 --- a/env.js +++ b/env.js @@ -1,4 +1,4 @@ -export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址 -// export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址 +// export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址 +export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址 export const API_URL = `${BASE_URL}/system` //后台接口域名 export const IMG_URL = 'https://ye4s.file.gzxunren.com' //全局网络图片地址变量,css背景图片地址变量在uni.scss diff --git a/pages/work/order/bindPkgMat.vue b/pages/work/order/bindPkgMat.vue index 577f7f8..e05b94e 100644 --- a/pages/work/order/bindPkgMat.vue +++ b/pages/work/order/bindPkgMat.vue @@ -63,15 +63,11 @@ - + - 确认绑定 + + 扫描包材条码后将自动完成绑定 + @@ -94,7 +90,6 @@ import voice from '@/core/utils/voice'; packageInputCode: '', packageFocused: false, scannedPackageMaterial: null, - submitting: false, showOrderInfo: false }; }, @@ -118,14 +113,32 @@ import voice from '@/core/utils/voice'; const scanText = data && data.data ? data.data.trim() : ''; console.log('[包材绑定] 广播扫描到数据:', scanText); if (!scanText) return; - // 如果已显示订单信息,则扫描结果作为包材条码处理 + if (this.showOrderInfo) { - this.packageInputCode = scanText; - await this.$nextTick(); - await this.handlePackageCodeSearch(scanText); + // 先尝试匹配包材,匹配不上则作为新快递单号处理 + uni.showLoading({ title: '绑定包材中...', mask: true }); + const matched = await this.tryMatchPackageMaterial(scanText); + if (matched) { + this.packageInputCode = scanText; + await this.$nextTick(); + this.scannedPackageMaterial = matched; + this.packageInputCode = matched.material_name || matched.material_code || scanText; + await this.$nextTick(); + this.$forceUpdate(); + // 连续加载,进入自动绑定 + await this.autoBindPackage(matched, scanText); + } else { + uni.hideLoading(); + // 清空旧包材信息,作为新快递单查询 + this.packageInputCode = ''; + this.scannedPackageMaterial = null; + this.suggestedPkg = null; + this.scanInput = scanText; + this.fetchOrderInfo(scanText); + } } else { this.scanInput = scanText; - this.handleScanConfirm(scanText); + this.fetchOrderInfo(scanText); } }, toggleScanInput() { @@ -171,26 +184,10 @@ import voice from '@/core/utils/voice'; order_id: orderId, waybill_code: code }; - // 2. 调用 order.detail 用订单ID获取已绑定的包材数据 - try { - const detailRes = await this.$http('order.detail', { order_id: orderId, tableType: 'dispatch' }, '', false); - if (detailRes && detailRes.flag !== 'failure') { - const detailData = detailRes.data || {}; - // 从运单信息中提取已绑定的包材 - const firstExpress = (detailData.expresses || [])[0]; - if (firstExpress && firstExpress.package_material_id) { - this.suggestedPkg = { - id: firstExpress.package_material_id, - name: firstExpress.package_material_name_snapshot - }; - this.packageInputCode = firstExpress.package_material_name_snapshot || ''; - } - } - } catch (e) { - console.error('获取订单详情失败', e); - } this.showOrderInfo = true; uni.showToast({ title: '查询成功', icon: 'success' }); + // 3. 后台静默加载已绑定的包材信息(不阻塞界面) + this.loadBoundPackageMaterial(orderId); } else { uni.showToast({ title: (toOrderRes && toOrderRes.msg) || '查询失败', icon: 'none' }); this.speakVoice('无记录'); @@ -202,79 +199,109 @@ import voice from '@/core/utils/voice'; uni.hideLoading(); } }, - async handlePackageCodeSearch(value) { - const code = value || this.packageInputCode; - if (!code) { - uni.showToast({ title: '请输入包材条码', icon: 'none' }); - return; - } - const trimmed = String(code).trim(); - uni.showLoading({ title: '查询包材...', mask: true }); + /** + * 后台静默加载已绑定的包材信息(不阻塞界面) + */ + async loadBoundPackageMaterial(orderId) { try { - const res = await this.$http('setting.packageMaterial.search', { keyword: trimmed }, '', false); - const list = Array.isArray(res?.data) ? res.data : []; - // 优先按 material_code 精确匹配,再按 barcodes 数组匹配 - const matched = list.find(item => { - if (String(item.material_code || '') === trimmed) return true; - const barcodes = item.barcodes || []; - return barcodes.some(b => String(b.barcode || '') === trimmed); - }) || list[0]; - if (matched) { - this.scannedPackageMaterial = matched; - this.packageInputCode = matched.material_name || matched.material_code || trimmed; - await this.$nextTick(); - this.$forceUpdate(); - uni.hideLoading(); - uni.showToast({ title: '数据一致', icon: 'success' }); - this.speakVoice('数据一致'); - } else { - this.scannedPackageMaterial = null; - uni.hideLoading(); - uni.showToast({ title: '无记录', icon: 'none' }); - this.speakVoice('无记录'); + const detailRes = await this.$http('order.detail', { order_id: orderId, tableType: 'dispatch' }, '', false); + if (detailRes && detailRes.flag !== 'failure') { + const detailData = detailRes.data || {}; + const firstExpress = (detailData.expresses || [])[0]; + if (firstExpress && firstExpress.package_material_id) { + this.suggestedPkg = { + id: firstExpress.package_material_id, + name: firstExpress.package_material_name_snapshot + }; + this.packageInputCode = firstExpress.package_material_name_snapshot || ''; + } } - } catch (error) { - uni.hideLoading(); - const msg = String(error?.message || error?.msg || '查询包材失败'); - uni.showToast({ title: msg, icon: 'none' }); + } catch (e) { + // 静默失败,不影响主流程 + console.error('[包材绑定] 加载已绑包材失败', e); } }, - async handleSubmitBinding() { - if (!this.scannedPackageMaterial) { - uni.showToast({ title: '请先扫描包材', icon: 'none' }); - return; + /** + * 仅搜索匹配包材(无 UI 副作用),返回匹配的包材对象或 null + */ + async tryMatchPackageMaterial(code) { + const trimmed = String(code).trim(); + if (!trimmed) return null; + try { + const res = await this.$http('setting.packageMaterial.search', { keyword: trimmed }, '', false); + const list = Array.isArray(res?.data) ? res.data : []; + // 优先按 material_code 精确匹配,再按 barcodes 数组匹配 + const matched = list.find(item => { + if (String(item.material_code || '') === trimmed) return true; + const barcodes = item.barcodes || []; + return barcodes.some(b => String(b.barcode || '') === trimmed); + }) || list[0]; + return matched || null; + } catch (error) { + console.error('[包材匹配] 查询失败', error); + return null; + } + }, + async handlePackageCodeSearch(value) { + const code = value || this.packageInputCode; + if (!code) { + uni.showToast({ title: '请输入包材条码', icon: 'none' }); + return; + } + const trimmed = String(code).trim(); + uni.showLoading({ title: '绑定包材中...', mask: true }); + try { + const matched = await this.tryMatchPackageMaterial(trimmed); + if (matched) { + this.scannedPackageMaterial = matched; + this.packageInputCode = matched.material_name || matched.material_code || trimmed; + await this.$nextTick(); + this.$forceUpdate(); + // 连续加载,不隐藏,继续自动绑定 + await this.autoBindPackage(matched, trimmed); + } else { + this.scannedPackageMaterial = null; + uni.hideLoading(); + uni.showToast({ title: '无记录', icon: 'none' }); + this.speakVoice('无记录'); } + } catch (error) { + uni.hideLoading(); + const msg = String(error?.message || error?.msg || '查询包材失败'); + uni.showToast({ title: msg, icon: 'none' }); + } + }, + async autoBindPackage(matched, trimmed) { const waybillNo = String(this.orderInfo.waybill_code || '').trim(); if (!waybillNo) { - uni.showToast({ title: '缺少运单号', icon: 'none' }); + uni.showToast({ title: '缺少运单号,无法自动绑定', icon: 'none' }); return; } - this.submitting = true; - const packageMaterialId = String(this.scannedPackageMaterial.id || ''); + const packageMaterialId = String(matched.id || ''); if (!packageMaterialId) { uni.showToast({ title: '包材数据异常,缺少ID', icon: 'none' }); - this.submitting = false; return; } + uni.showLoading({ title: '绑定中...', mask: true }); try { const res = await this.$http('order.bindExpressPackageMaterialByWaybill', { waybill_code: waybillNo, package_material_id: packageMaterialId }, '', false); if (res && res.flag !== 'failure') { + uni.hideLoading(); uni.showToast({ title: '包材绑定成功', icon: 'success' }); - this.speakVoice('绑定成功'); - this.resetForm(); + this.speakVoice('包材更改为' + (matched.material_name || '')); } else { + uni.hideLoading(); uni.showToast({ title: (res && res.msg) || '绑定失败', icon: 'none' }); this.speakVoice('绑定失败'); } } catch (error) { + uni.hideLoading(); const msg = String(error?.message || error?.msg || '绑定失败'); uni.showToast({ title: msg, icon: 'none' }); this.speakVoice('绑定失败'); - } finally { - this.submitting = false; } }, handleReset() { @@ -450,9 +477,25 @@ import voice from '@/core/utils/voice'; } } - /* ===== 提交按钮 ===== */ + /* ===== 自动绑定提示 ===== */ .submit-section { padding: 40rpx 24rpx; + + .auto-bind-tip { + display: flex; + align-items: center; + justify-content: center; + padding: 24rpx; + background: #f0f7ff; + border-radius: 12rpx; + border: 1rpx solid #b3d8ff; + + .auto-bind-tip-text { + font-size: 28rpx; + color: #2979ff; + text-align: center; + } + } } } diff --git a/pages/work/order/order-review-comps/ReviewDetail.vue b/pages/work/order/order-review-comps/ReviewDetail.vue index fbcb067..3ecccf6 100644 --- a/pages/work/order/order-review-comps/ReviewDetail.vue +++ b/pages/work/order/order-review-comps/ReviewDetail.vue @@ -15,17 +15,19 @@ 运单:{{ detailInfo.waybillNo }} 波次:{{ detailInfo.waveNo }} - 拣货人:{{ detailInfo.pickerName }} + {{ detailInfo.pickerName }} 面单补打 + 蓝号:{{ detailInfo.waveIndex || detailInfo.boxNo || '--' }} + 货主:{{ detailInfo.storeName }} - 波次订单:{{ detailInfo.totalOrders || '--' }}单 + 订单数:{{ detailInfo.totalOrders || '--' }} 篮号:{{ detailInfo.waveIndex || detailInfo.boxNo || '--' }} @@ -34,56 +36,9 @@ 推荐包材: - {{ detailInfo.suggestedPkg.name }}({{ detailInfo.suggestedPkg.code }}) - {{ detailInfo.suggestedPkg.spec }} + {{ detailInfo.suggestedPkg.name }} - - - - - - - - - - 1/{{ getCurrentGoodsImageList().length }} - - - - - - {{ currentGoods.skuName || '--' }} - {{ currentGoods.barcode || '--' }} - - - 数量 - {{ currentGoods.scannedQty || 0 }} / {{ currentGoods.planQty || 0 }} - - - 蓝号 - {{ detailInfo.waveIndex || (detailInfo.boxNo ? '' : '--') }}{{ detailInfo.boxNo }}号篮 - - - 规格 - {{ currentGoods.location || '--' }} - - - - - - - 商品列表 @@ -110,28 +65,49 @@ - - 序号 - 商品名称 - 数量 - 已扫 - 状态 - - {{ item.lineNo || index + 1 }} - {{ item.skuName || '--' }} - {{ item.planQty || 0 }} - {{ item.scannedQty || 0 }} - {{ isGoodsMatched(item) ? '已匹配' : '待匹配' }} + + + + 数量 + {{ item.planQty || 0 }} + + + 已扫 + {{ item.scannedQty || 0 }} + + + + + + + + + + {{ item.skuName || '--' }} + {{ item.barcode || '--' }} + {{ item.location || '--' }} + @@ -565,6 +541,45 @@ import voice from '@/core/utils/voice'; uni.showToast({ title: `已标记为已复核(${planQty}/${planQty})`, icon: 'success' }); voice.speak('数据一致'); }, + handleListBarcodeClick(item, index) { + if (this.isReadOnly) return; + this.currentGoodsIndex = index; + this.openNoBarcodePopup(item); + }, + handleListLongPress(item, index) { + if (this.isReadOnly) return; + this.currentGoodsIndex = index; + this.openNoBarcodePopup(item); + }, + openNoBarcodePopup(item) { + if (!item) return; + const skuName = item.skuName || '商品'; + const planQty = item.planQty || 0; + const scannedQty = item.scannedQty || 0; + + if (scannedQty >= planQty) { + uni.showToast({ title: '该商品已复核完成', icon: 'none' }); + return; + } + + this.noBarcodeItemName = skuName; + this.noBarcodePickedCount = scannedQty; + this.noBarcodeItemTotalQty = planQty; + this.showNoBarcodePopup = true; + }, + previewListGoodsImage(item) { + const list = Array.isArray(item?.images) ? item.images : []; + const normalizedList = list + .map(url => String(url || '').trim()) + .filter(url => !!url); + const currentUrl = String(item?.imageUrl || '').trim(); + const images = normalizedList.length ? normalizedList : (currentUrl ? [currentUrl] : []); + if (!images.length) return; + uni.previewImage({ + current: images[0], + urls: images + }); + }, previewCurrentGoodsImage() { const images = this.getCurrentGoodsImageList(); if (!images.length) return; @@ -700,6 +715,7 @@ import voice from '@/core/utils/voice'; flex-direction: column; height: 100%; overflow: hidden; + position: relative; } .content-layout { @@ -707,83 +723,10 @@ import voice from '@/core/utils/voice'; display: flex; flex-direction: column; min-height: 0; - } - - .top-module { - flex-shrink: 0; - } - - .top-card { - background: #ffffff; - border-radius: 12rpx; - margin: 12rpx 16rpx 0; - padding: 16rpx; - box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04); - } - - .goods-thumb { - position: relative; - width: 140rpx; - height: 140rpx; - border-radius: 10rpx; overflow: hidden; - flex-shrink: 0; - background: #f5f5f5; } - .goods-image { - width: 140rpx; - height: 140rpx; - } - .image-placeholder--large { - width: 140rpx; - height: 140rpx; - display: flex; - align-items: center; - justify-content: center; - background: #f2f3f5; - border-radius: 10rpx; - } - - .image-badge { - position: absolute; - right: 6rpx; - bottom: 6rpx; - background: rgba(0, 0, 0, 0.5); - border-radius: 10rpx; - padding: 2rpx 8rpx; - } - - .image-badge-text { - font-size: 18rpx; - color: #ffffff; - line-height: 1.3; - } - - .top-main--horizontal { - display: flex; - flex-direction: row; - align-items: flex-start; - gap: 16rpx; - } - - .top-info--compact { - flex: 1; - min-width: 0; - display: flex; - flex-direction: column; - gap: 6rpx; - } - - .goods-name--compact { - font-size: 32rpx; - font-weight: 600; - color: #303133; - line-height: 38rpx; - word-break: break-all; - margin-bottom: 2rpx; - } .info-row { display: flex; @@ -844,7 +787,7 @@ import voice from '@/core/utils/voice'; .order-info-text { font-size: 28rpx; - color: #909399; + color: #000000; white-space: nowrap; } @@ -867,7 +810,7 @@ import voice from '@/core/utils/voice'; } .wave-info-text { - color: #606266; + color: #000000; font-size: 26rpx; } @@ -882,7 +825,15 @@ import voice from '@/core/utils/voice'; .store-info-text { font-size: 26rpx; - color: #606266; + color: #000000; + } + + .store-info-divider { + width: 1rpx; + height: 20rpx; + background: #dcdfe6; + margin: 0 24rpx; + flex-shrink: 0; } .wave-info-divider { @@ -948,12 +899,7 @@ import voice from '@/core/utils/voice'; -webkit-overflow-scrolling: touch; } - .bottom-module-title { - font-size: 30rpx; - font-weight: 600; - color: #303133; - margin-bottom: 8rpx; - } + .pick-list-scroll { min-height: 0; @@ -1040,8 +986,8 @@ import voice from '@/core/utils/voice'; display: flex; align-items: center; justify-content: space-between; - padding: 16rpx 24rpx; - padding-bottom: calc(16rpx + env(safe-area-inset-bottom)); + padding: 6rpx 24rpx; + padding-bottom: calc(6rpx + env(safe-area-inset-bottom)); background: #ffffff; border-top: 1rpx solid #ebeef5; } @@ -1092,10 +1038,10 @@ import voice from '@/core/utils/voice'; .view-mode-toggle { display: flex; align-items: center; - gap: 6rpx; - padding: 6rpx 12rpx; + gap: 4rpx; + padding: 4rpx 8rpx; border: 1rpx solid #2979ff; - border-radius: 8rpx; + border-radius: 6rpx; flex-shrink: 0; } @@ -1104,96 +1050,139 @@ import voice from '@/core/utils/voice'; } .view-mode-text { - font-size: 26rpx; + font-size: 22rpx; color: #2979ff; } - /* 列表模式表格样式 */ + /* 列表模式卡片样式 */ .pick-list--table { display: flex; flex-direction: column; gap: 0; } - .list-table-header { - display: flex; - align-items: center; - padding: 16rpx 12rpx; - background: #f5f7fa; - border-radius: 8rpx 8rpx 0 0; - border-bottom: 2rpx solid #ebeef5; + .list-card-row { + padding: 0; + border: 1rpx solid #000000; + border-radius: 10rpx; + background: #ffffff; + margin-bottom: 24rpx; } - .list-table-row { - display: flex; - align-items: center; - padding: 22rpx 12rpx; - border-bottom: 1rpx solid #000000; - } - - .list-table-row:active { + .list-card-row:active { background: #f5f6fa; } - .list-table-row--active { - background: #9dc4f1; - } - - .list-table-row--active .list-table-col { + .list-card-row--active .list-card-label, + .list-card-row--active .list-card-value, + .list-card-row--active .list-card-name, + .list-card-row--active .list-card-tag { color: #000000; } - .list-table-row--matched { + .list-card-row--matched { background: #07c160; } - .list-table-row--matched .list-table-col { + .list-card-row--matched .list-card-label, + .list-card-row--matched .list-card-value, + .list-card-row--matched .list-card-name, + .list-card-row--matched .list-card-tag { color: #ffffff; } - .list-table-col { - font-size: 40rpx; - color: #303133; + .list-card-row__top { + display: flex; + align-items: flex-start; + justify-content: space-between; + margin-bottom: 0; } - .list-table-header .list-table-col { - color: #909399; - font-weight: 500; - font-size: 38rpx; - } - - .list-table-col--no { - width: 100rpx; - text-align: center; - flex-shrink: 0; - } - - .list-table-col--name { + .list-card-qty-group { + display: flex; + flex-direction: row; flex: 1; min-width: 0; - word-break: break-all; - padding: 0 12rpx; + border-bottom: 1rpx solid #000000; } - .list-table-col--qty { - width: 110rpx; - text-align: center; + .list-card-qty-item { + display: flex; + align-items: center; + flex: 1; + padding: 20rpx 0 8rpx 16rpx; + } + + .list-card-qty-item:first-child { + border-right: 1rpx solid #000000; + } + + .list-card-label { + font-size: 32rpx; + color: #000000; flex-shrink: 0; - } - - .list-table-col--status { - width: 120rpx; + width: 100rpx; text-align: center; - flex-shrink: 0; + padding: 0 6rpx; + line-height: 1.8; } - .list-table-col--done { - color: #07c160; + .list-card-value { + font-size: 46rpx; + color: #000000; font-weight: 500; + flex: 1; + text-align: center; + padding: 0 10rpx; } - .list-table-col--matched-text { - color: #ffffff; + .list-card-value--done { + color: #07c160; + font-weight: 600; + } + + .list-card-image-wrap { + flex-shrink: 0; + margin-left: 16rpx; + padding: 4rpx 16rpx 0 0; + } + + .list-card-image { + width: 120rpx; + height: 120rpx; + border-radius: 10rpx; + } + + .list-card-row__bottom { + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: baseline; + gap: 8rpx; + padding: 4rpx 16rpx 20rpx; + } + + .list-card-name { + font-size: 34rpx; + color: #000000; + font-weight: 500; + line-height: 1.4; + } + + .list-card-tag { + font-size: 34rpx; + color: #000000; + line-height: 1.4; + } + + .image-placeholder--small { + width: 120rpx; + height: 120rpx; + display: flex; + align-items: center; + justify-content: center; + background: #f2f3f5; + border-radius: 10rpx; } .empty-state { diff --git a/pages/work/order/order-review.vue b/pages/work/order/order-review.vue index c587f6e..0432105 100644 --- a/pages/work/order/order-review.vue +++ b/pages/work/order/order-review.vue @@ -164,10 +164,10 @@ 包材绑定 - 推荐包材:{{ suggestedPkg.name }}({{ suggestedPkg.code }}) {{ suggestedPkg.spec }} + 推荐包材:{{ suggestedPkg.name }} - 已扫包材:{{ scannedPackageMaterial.material_name || '' }}({{ scannedPackageMaterial.material_code || '' }}) {{ scannedPackageMaterial.spec || '' }} + 已扫包材:{{ scannedPackageMaterial.material_name || '' }}