diff --git a/components/page-nav/page-nav.vue b/components/page-nav/page-nav.vue index 30d6619..e683ca8 100644 --- a/components/page-nav/page-nav.vue +++ b/components/page-nav/page-nav.vue @@ -2,9 +2,12 @@ - - - + + + + + + {{title}} @@ -102,19 +105,28 @@ /* #endif */ flex-direction: row; align-items: center; - justify-content: flex-start; + justify-content: space-between; height:110rpx; line-height:110rpx; background: #FFF; - justify-content: space-between; padding:0 20rpx; + position: relative; .left { - width: 80rpx; + min-width: 80rpx; height: 80rpx; display: flex; align-items: center; - justify-content: center; + justify-content: flex-start; + gap: 10rpx; + + .left-back { + width: 80rpx; + height: 80rpx; + display: flex; + align-items: center; + justify-content: center; + } .u-icon { font-size: 40rpx; @@ -122,8 +134,10 @@ } .title { - flex: 1; - text-align: center; + position: absolute; + left: 50%; + transform: translateX(-50%); + white-space: nowrap; font-size: 32rpx; font-weight: bold; color: #333; @@ -131,6 +145,9 @@ .right { width: 80rpx; + display: flex; + align-items: center; + justify-content: flex-end; } } diff --git a/core/request/apis.js b/core/request/apis.js index 5295567..797af92 100644 --- a/core/request/apis.js +++ b/core/request/apis.js @@ -359,6 +359,12 @@ export default { method: "POST", isSystemApi: true } + }, + bindExpressPackageMaterialByWaybill: { + path: "order.bindExpressPackageMaterialByWaybill", + auth: true, + method: "POST", + isSystemApi: true } }, print: { @@ -380,5 +386,15 @@ export default { method: "POST", isSystemApi: true } + }, + setting: { + packageMaterial: { + search: { + path: "setting.packageMaterial.search", + auth: true, + method: "POST", + isSystemApi: true + } + } } }; \ No newline at end of file diff --git a/pages/work/order/order-review.vue b/pages/work/order/order-review.vue index 4d4384b..810da99 100644 --- a/pages/work/order/order-review.vue +++ b/pages/work/order/order-review.vue @@ -102,6 +102,7 @@ {{ getReviewStatusText(item) }} [{{ item.waveIndex }}] {{ listType === 'single' ? (item.waybillNo || '--') : (item.waveNo || '--') }} + {{ item.boxNo }}号篮 已打印 未打印 @@ -1007,6 +1008,7 @@ waveNo: String(wave?.wave_no || wave?.waveNo || '').trim(), waveIndex: String(wave?.wave_index || wave?.waveIndex || '').trim(), waveId: wave?.wave_id ?? wave?.waveId ?? wave?.id ?? '', + boxNo: String(wave?.box_no ?? wave?.boxNo ?? '').trim(), cartNo: String(wave?.cart_code || wave?.cartCode || wave?.cart_no || wave?.cartNo || '').trim(), pickerName: String(wave?.picker_name || wave?.pickerName || '').trim(), status: String(wave?.status || 'pending'), @@ -1100,6 +1102,7 @@ waybillNo: String(item?.waybill_no || item?.waybillCode || item?.waybill_code || '').trim(), waveNo: String(item?.wave_no || item?.waveNo || '').trim(), waveIndex: String(item?.wave_index || item?.waveIndex || '').trim(), + boxNo: String(item?.box_no || item?.boxNo || '').trim(), pickerName: String(item?.picker_name || item?.pickerName || '').trim(), cartNo: String(item?.cart_code || item?.cartCode || item?.cart_no || item?.cartNo || '').trim(), status: String(item?.status || 'pending'), @@ -1145,6 +1148,7 @@ waveNo: item?.waveNo || '--', waybillNo: item?.waybillNo || '', waveIndex: item?.waveIndex || '', + boxNo: item?.boxNo || '', pickerName: item?.pickerName || '--', cartNo: item?.cartNo || '--', unreviewedCount: item?.recheckStatus === 'fin' ? 0 : 1, @@ -1178,11 +1182,14 @@ const subList = Array.isArray(wave?.list) ? wave.list : []; const waveUnreviewed = Number(wave?.unreviewedCount ?? 0); const rawWaveId = wave?.waveId ?? wave?.id ?? ''; + // 从子订单中取第一个有 boxNo 的值 + const firstChildBoxNo = subList.reduce((found, child) => found || (child?.boxNo || ''), ''); return { id: String(rawWaveId || wave?.waveNo || `wave-${Date.now()}-${wi}`), waveId: rawWaveId, waveNo: wave?.waveNo || '--', waveIndex: String(wave?.wave_index || wave?.waveIndex || '').trim(), + boxNo: wave?.boxNo || firstChildBoxNo || '', waybillNo: groupWaybillNo, pickerName: wave?.pickerName || '--', cartNo: wave?.cartNo || '--', @@ -1296,6 +1303,17 @@ } try { const response = await this.$http('order.recheckOrder.scanOrder', this.buildScanOrderParams(normalizedKeyword)); + // 检测接口返回的错误信息 + if (response?.flag === 'failure') { + const errorMsg = String(response?.message || response?.msg || '').trim(); + if (!silent) { + uni.showToast({ + title: errorMsg || '订单查询失败', + icon: 'none' + }); + } + return; + } const payload = this.extractScanOrderPayload(response); const result = this.normalizeScanOrderResult(payload); this.handleScanOrderSuccess(result, silent); @@ -1448,7 +1466,10 @@ `waveIndex=${encodeURIComponent(waveIndex)}`, `interceptStatus=${encodeURIComponent(interceptStatus)}`, `orderIds=${encodeURIComponent(JSON.stringify(orderIds))}`, - `cacheKey=${encodeURIComponent(cacheKey)}` + `cacheKey=${encodeURIComponent(cacheKey)}`, + `printStationId=${encodeURIComponent(String(this.printStationId || ''))}`, + `printStationName=${encodeURIComponent(String(this.printStationName || ''))}`, + `boxNo=${encodeURIComponent(String(item.boxNo || ''))}` ]; this._navigatedToDetail = true; this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`); @@ -2141,6 +2162,7 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + font-size: 29rpx; } .record-value--wave-index { @@ -2158,6 +2180,21 @@ align-items: center; } + .record-value--box-no { + flex-shrink: 0; + font-size: 28rpx; + color: #e6a23c; + background: #fdf6ec; + border: 1rpx solid #f5dab1; + border-radius: 6rpx; + padding: 0 8rpx; + margin-right: 8rpx; + line-height: 34rpx; + height: 34rpx; + display: inline-flex; + align-items: center; + } + /* 已复核行:运单/波次号颜色与复核状态一致 */ .record-main--row .record-value--id.record-value--id-reviewed { color: #909399; diff --git a/pages/work/order/picking.vue b/pages/work/order/picking.vue index 04f3a7f..a7f60b4 100644 --- a/pages/work/order/picking.vue +++ b/pages/work/order/picking.vue @@ -2,11 +2,13 @@ + @@ -1773,7 +1775,7 @@ } .nav-right { - padding-right: 12rpx; + padding-right: 24rpx; display: flex; align-items: center; justify-content: flex-end; @@ -1800,6 +1802,7 @@ border-radius: 8rpx; height: 60rpx; padding: 0 22rpx; + margin-left: 20rpx; } .nav-action-btn--bind .nav-action-btn__text { diff --git a/pages/work/order/scatter-pick-goods-detail.vue b/pages/work/order/scatter-pick-goods-detail.vue index ad77637..4ee4066 100644 --- a/pages/work/order/scatter-pick-goods-detail.vue +++ b/pages/work/order/scatter-pick-goods-detail.vue @@ -2,6 +2,9 @@ + @@ -154,6 +213,14 @@ weighWeight: 0, weighInputFocused: false, _weighAfterReview: false, + showPackagingPopup: false, + packagingWaybillNo: '', + packagingSearchKeyword: '', + packagingSelectedCode: '', + packagingSelectedName: '', + showPackagingDropdown: false, + packagingMaterialList: [], + packagingListLoading: false, detailInfo: { recordId: '', orderId: 0, @@ -169,7 +236,10 @@ storeRemark: '', waveIndex: '', orderIds: [], - interceptStatus: '' + interceptStatus: '', + printStationId: '', + printStationName: '', + boxNo: '' }, goodsList: [] }; @@ -225,6 +295,18 @@ const status = String(this.detailInfo?.interceptStatus || '').trim().toLowerCase(); return !!status && status !== 'none' && status !== ''; }, + packagingFilteredList() { + const list = Array.isArray(this.packagingMaterialList) ? this.packagingMaterialList : []; + const keyword = String(this.packagingSearchKeyword || '').trim().toLowerCase(); + if (!keyword) { + return list; + } + return list.filter(item => { + const code = String(item.code || '').toLowerCase(); + const name = String(item.name || '').toLowerCase(); + return code.includes(keyword) || name.includes(keyword); + }); + }, isCurrentBarcodeMatched() { const currentId = String(this.currentGoods?.id || ''); if (!currentId) { @@ -293,7 +375,10 @@ storeRemark: safeDecode(options?.storeRemark), waveIndex: String(options?.waveIndex || '').trim(), orderIds: Array.isArray(parsedOrderIds) ? parsedOrderIds : [], - interceptStatus: String(options?.interceptStatus || '').trim() + interceptStatus: String(options?.interceptStatus || '').trim(), + printStationId: String(options?.printStationId || '').trim(), + printStationName: String(options?.printStationName || '').trim(), + boxNo: String(options?.boxNo || '').trim() }; if (this.isRecheckFinished) { uni.showToast({ @@ -451,6 +536,12 @@ return; } + // 包材弹窗打开时,扫描编码自动匹配包材 + if (this.showPackagingPopup) { + this.handlePackagingScanMatch(scanCode); + return; + } + const matchIndex = this.goodsList.findIndex(item => { const candidates = this.extractBarcodeCandidates(item); return candidates.includes(scanCode); @@ -795,6 +886,13 @@ orderIdsParam = [orderId]; } + // 使用当前已绑定的打印台 + const printStationId = String(this.detailInfo?.printStationId || '').trim(); + if (!printStationId) { + uni.showToast({ title: '请先在订单复核页绑定打印台', icon: 'none' }); + return; + } + uni.showLoading({ title: '处理打印中...' }); try { // 1. 获取打印数据 @@ -807,19 +905,11 @@ throw new Error('未获取到可打印数据'); } - // 2. 获取打印台列表,使用第一个可用打印台 - const stationResponse = await this.$http('print.getList', { page: 1, pageSize: 20, where: {} }); - const stationList = this.normalizePrintStations(this.extractPrintRecordList(stationResponse)); - if (!stationList.length) { - throw new Error('无可用的打印台'); - } - const printStation = stationList[0]; - - // 3. 发送打印 + // 2. 发送打印,使用已绑定的打印台 const requestCode = this.buildPrintRequestCode(); const sendParams = { type: 'express', - printStationId: printStation.id, + printStationId, requestCode, data: { waveGroups } }; @@ -837,6 +927,144 @@ uni.showToast({ title: message, icon: 'none' }); } }, + async handlePackaging() { + this.packagingWaybillNo = this.detailInfo?.waybillNo || ''; + this.packagingSearchKeyword = ''; + this.packagingSelectedCode = ''; + this.packagingSelectedName = ''; + this.packagingMaterialList = []; + this.showPackagingDropdown = false; + this.showPackagingPopup = true; + // 打开弹窗后加载包材列表 + await this.loadPackagingMaterialList(); + }, + async loadPackagingMaterialList() { + this.packagingListLoading = true; + try { + const response = await this.$http('setting.packageMaterial.search', {}); + const rawList = this.extractPackagingList(response); + // 将 API 返回的 material_code / material_name 归一化为 code / name + this.packagingMaterialList = Array.isArray(rawList) + ? rawList.map(item => ({ + code: item.material_code || item.code || '', + name: item.material_name || item.name || '' + })) + : []; + } catch (e) { + this.packagingMaterialList = []; + } finally { + this.packagingListLoading = false; + } + }, + extractPackagingList(response) { + const candidates = [ + response?.data?.data, + response?.data?.list, + response?.data?.data?.list, + response?.data?.data?.rows, + response?.data?.rows, + response?.data, + response?.list, + response?.rows + ]; + for (let i = 0; i < candidates.length; i += 1) { + if (Array.isArray(candidates[i])) { + return candidates[i]; + } + } + return []; + }, + async handlePackagingSearchInput(event) { + const value = event?.detail?.value ?? event?.target?.value ?? event ?? ''; + this.packagingSearchKeyword = value; + this.showPackagingDropdown = true; + // 输入变化时客户端过滤,仅首次加载 + if (this.packagingMaterialList.length === 0) { + await this.loadPackagingMaterialList(); + } + }, + handlePackagingSearchFocus() { + this.showPackagingDropdown = true; + }, + handlePackagingSearchBlur() { + setTimeout(() => { + this.showPackagingDropdown = false; + }, 200); + }, + handlePackagingSearchConfirm() { + const keyword = String(this.packagingSearchKeyword || '').trim().toLowerCase(); + if (!keyword || !this.packagingFilteredList.length) { + return; + } + const matched = this.packagingFilteredList.find(item => { + const code = String(item.code || '').toLowerCase(); + return code === keyword; + }); + if (matched) { + this.handlePackagingSelect(matched); + } else { + this.handlePackagingSelect(this.packagingFilteredList[0]); + } + this.showPackagingDropdown = false; + }, + handlePackagingSelect(item) { + this.packagingSelectedCode = item.code || ''; + this.packagingSelectedName = item.name || ''; + this.packagingSearchKeyword = `${item.code || ''} ${item.name || ''}`; + this.showPackagingDropdown = false; + }, + async handlePackagingScanMatch(scanCode) { + // 确保包材列表已加载 + if (this.packagingMaterialList.length === 0) { + await this.loadPackagingMaterialList(); + } + const matched = this.packagingMaterialList.find(item => { + const code = String(item.code || '').toLowerCase(); + return code === scanCode.toLowerCase(); + }); + if (matched) { + this.handlePackagingSelect(matched); + uni.showToast({ title: `已匹配包材:${matched.name}`, icon: 'success' }); + } else { + // 未精确匹配时,将扫描码填入搜索框 + this.packagingSearchKeyword = scanCode; + this.showPackagingDropdown = true; + uni.showToast({ title: '未匹配到包材,请手动选择', icon: 'none' }); + } + }, + handlePackagingClose() { + this.showPackagingPopup = false; + }, + async handlePackagingSubmit() { + const waybillNo = String(this.packagingWaybillNo || '').trim(); + const code = String(this.packagingSelectedCode || '').trim(); + if (!waybillNo) { + uni.showToast({ title: '请输入运单号', icon: 'none' }); + return; + } + if (!code) { + uni.showToast({ title: '请搜索并选择包材', icon: 'none' }); + return; + } + uni.showLoading({ title: '提交中...' }); + try { + const response = await this.$http('order.bindExpressPackageMaterialByWaybill', { + waybill_code: waybillNo, + package_material_code: code + }); + const success = response?.flag !== 'failure' && response?.code !== '500' && response?.code !== 500; + if (!success) { + throw new Error(response?.message || response?.msg || '绑定包材失败'); + } + uni.hideLoading(); + uni.showToast({ title: '绑定包材成功', icon: 'success' }); + this.showPackagingPopup = false; + } catch (error) { + uni.hideLoading(); + const message = String(error?.message || error?.msg || error?.errMsg || '绑定包材失败'); + uni.showToast({ title: message, icon: 'none' }); + } + }, handleWeighClose() { this.showWeighPopup = false; if (this._weighAfterReview) { @@ -1085,6 +1313,16 @@ background: #07c160; } + .nav-packaging-btn { + font-size: 36rpx; + line-height: 44rpx; + color: #ffffff; + padding: 14rpx 24rpx; + border-radius: 8rpx; + background: #2979ff; + white-space: nowrap; + } + .nav-right-complete--disabled { background: #c0c4cc; pointer-events: none; @@ -1303,6 +1541,12 @@ flex-shrink: 0; } + .box-no-suffix { + color: #303133; + font-weight: 500; + margin-left: 8rpx; + } + .label { width: 110rpx; min-width: 110rpx; @@ -1754,4 +1998,156 @@ background: #2979ff; color: #ffffff; } + + .packaging-popup { + width: 640rpx; + padding: 32rpx 40rpx 40rpx; + box-sizing: border-box; + } + + .packaging-popup-title { + font-size: 44rpx; + font-weight: 500; + color: #303133; + text-align: left; + line-height: 1; + padding-top: 8rpx; + margin-bottom: 28rpx; + } + + .packaging-popup-body { + margin: 20rpx 0 40rpx; + } + + .packaging-row { + display: flex; + flex-direction: column; + margin-bottom: 24rpx; + } + + .packaging-label { + font-size: 32rpx; + color: #606266; + margin-bottom: 12rpx; + } + + .packaging-required { + color: #f56c6c; + } + + .packaging-input { + height: 80rpx; + font-size: 32rpx; + color: #303133; + background: #f5f7fa; + border: 2rpx solid #dcdfe6; + border-radius: 10rpx; + padding: 0 20rpx; + box-sizing: border-box; + } + + .packaging-tip { + background: #fef9e7; + border: 1rpx solid #f9e7b3; + border-radius: 8rpx; + padding: 16rpx 20rpx; + margin-top: 8rpx; + } + + .packaging-tip__text { + font-size: 26rpx; + color: #b37400; + line-height: 1.5; + } + + .packaging-popup-footer { + display: flex; + gap: 28rpx; + } + + .packaging-footer-btn { + flex: 1; + height: 90rpx; + border-radius: 12rpx; + display: flex; + align-items: center; + justify-content: center; + font-size: 36rpx; + font-weight: 500; + } + + .packaging-footer-btn:active { + opacity: 0.7; + } + + .packaging-footer-btn--cancel { + background: #f4f4f5; + color: #909399; + } + + .packaging-footer-btn--save { + background: #2979ff; + color: #ffffff; + } + + .packaging-search-wrap { + position: relative; + width: 100%; + } + + .packaging-dropdown { + position: absolute; + top: 100%; + left: 0; + right: 0; + background: #ffffff; + border: 2rpx solid #dcdfe6; + border-top: none; + border-radius: 0 0 10rpx 10rpx; + z-index: 100; + max-height: 320rpx; + overflow: hidden; + } + + .packaging-dropdown-scroll { + max-height: 320rpx; + } + + .packaging-option { + display: flex; + align-items: center; + justify-content: space-between; + padding: 16rpx 20rpx; + border-bottom: 1rpx solid #f2f2f2; + } + + .packaging-option:last-child { + border-bottom: none; + } + + .packaging-option:active { + background: #f0f7ff; + } + + .packaging-option--active { + background: #eef4ff; + } + + .packaging-option--empty { + justify-content: center; + color: #909399; + font-size: 28rpx; + } + + .packaging-option-code { + font-size: 34rpx; + color: #303133; + font-weight: 500; + } + + .packaging-option-name { + font-size: 30rpx; + color: #909399; + margin-left: 12rpx; + }