From 104423eec49c9be32aca65c85aaa298728ec56b2 Mon Sep 17 00:00:00 2001
From: zm2000 <18386612143@163.com>
Date: Tue, 5 May 2026 18:31:25 +0800
Subject: [PATCH] feat(picking): integrate pick.query and enhance picking flow
---
core/request/apis.js | 8 +
pages/work/order/detail.vue | 497 ++++++++++++++++++++-
pages/work/order/picking.vue | 290 +++++++++---
pages/work/storage/receiving/receiving.vue | 114 ++++-
4 files changed, 839 insertions(+), 70 deletions(-)
diff --git a/core/request/apis.js b/core/request/apis.js
index 9d47120..e07d370 100644
--- a/core/request/apis.js
+++ b/core/request/apis.js
@@ -211,6 +211,14 @@ export default {
}
}
},
+ pick: {
+ query: {
+ path: "pick.query",
+ auth: true,
+ method: "POST",
+ isSystemApi: true
+ }
+ },
print: {
getList: {
path: "print.getList",
diff --git a/pages/work/order/detail.vue b/pages/work/order/detail.vue
index 22c63c5..6bfd21b 100644
--- a/pages/work/order/detail.vue
+++ b/pages/work/order/detail.vue
@@ -14,15 +14,27 @@
拣货进度:{{ orderInfo.pickedQty || 0 }}/{{ orderInfo.needQty || 0 }}
- 拣货明细
+
+ 拣货明细
+
+
+ 扫码拣货
+
+
-
+
{{ line.skuName }}
- {{ line.space }}
+
+ 无条码核对
+ 库位报错
+ 已拣
+ {{ line.space }}
+
SKU:{{ line.skuCode }}
条码:{{ line.barcode || '--' }}
+ 篮号:{{ getBasketNoText(line) }}
应拣:{{ line.needQty }}
已拣:{{ line.pickedQty }}
@@ -42,6 +54,33 @@
>完成拣货
已完成
+
+
+
+
@@ -61,7 +100,12 @@
needQty: 0,
pickedQty: 0
},
- detailList: []
+ detailList: [],
+ locationErrorPopupVisible: false,
+ currentActionLineIndex: -1,
+ locationErrorRemark: '',
+ locationErrorImages: [],
+ locationErrorSubmitting: false
}
},
computed: {
@@ -75,9 +119,20 @@
done: '已完成'
};
return map[this.orderInfo.status] || '未知状态';
+ },
+ currentActionLine() {
+ if (this.currentActionLineIndex < 0) {
+ return null;
+ }
+ return this.detailList[this.currentActionLineIndex] || null;
}
},
onLoad(options) {
+ this.safeDispatchBroadcast('setCallbacks', {
+ onResult: this.handleBroadcastResult
+ });
+ this.safeDispatchBroadcast('start');
+
if (options && options.mode) {
const mode = String(options.mode || '').toUpperCase();
if (mode === 'F' || mode === 'E') {
@@ -97,7 +152,292 @@
this.detailList = this.buildMockDetails(this.orderInfo);
},
+ onShow() {
+ this.safeDispatchBroadcast('setCallbacks', {
+ onResult: this.handleBroadcastResult
+ });
+ this.safeDispatchBroadcast('resume');
+ },
+ onHide() {
+ this.safeDispatchBroadcast('pause');
+ },
+ onUnload() {
+ this.safeDispatchBroadcast('stop');
+ },
methods: {
+ getBasketNoText(line) {
+ if (!line || typeof line !== 'object') {
+ return '--';
+ }
+ const basketNo = String(line.basketNo || '').trim();
+ if (basketNo) {
+ return basketNo;
+ }
+ const space = String(line.space || '').trim();
+ if (!space) {
+ return '--';
+ }
+ const segments = space.split('-').filter(Boolean);
+ return segments[segments.length - 1] || space;
+ },
+ speakPickResult(line) {
+ if (!line || typeof line !== 'object') {
+ return;
+ }
+ const basketNo = this.getBasketNoText(line);
+ const qty = Number(line.needQty || 0);
+ const speakText = `篮号${basketNo},数量${qty}`;
+ try {
+ const task = this.$tools && typeof this.$tools.speakText === 'function'
+ ? this.$tools.speakText(speakText, { force: true })
+ : null;
+ if (task && typeof task.catch === 'function') {
+ task.catch(() => {});
+ }
+ } catch (error) {}
+ },
+ handleLineLongPress(line, index) {
+ if (!line || typeof line !== 'object') {
+ return;
+ }
+ uni.showActionSheet({
+ itemList: ['无条码核对', '库位报错(拍照上传)'],
+ success: (res) => {
+ if (res.tapIndex === 0) {
+ this.handleNoBarcodeVerify(index);
+ return;
+ }
+ if (res.tapIndex === 1) {
+ this.openLocationErrorPopup(index);
+ }
+ },
+ fail: () => {}
+ });
+ },
+ handleNoBarcodeVerify(index) {
+ const line = this.detailList[index];
+ if (!line) {
+ return;
+ }
+
+ if (Number(line.pickedQty || 0) >= Number(line.needQty || 0)) {
+ uni.showToast({
+ title: '该商品已拣完成',
+ icon: 'none'
+ });
+ return;
+ }
+
+ const updatedLine = {
+ ...line,
+ pickedQty: Number(line.needQty || 0),
+ noBarcodeVerified: true,
+ noBarcodeVerifiedAt: Date.now()
+ };
+ this.$set(this.detailList, index, updatedLine);
+ this.recalculateOrderProgress();
+ this.emitOrderUpdate();
+ this.speakPickResult(updatedLine);
+ uni.showToast({
+ title: '已完成无条码核对',
+ icon: 'success'
+ });
+ },
+ openLocationErrorPopup(index) {
+ this.currentActionLineIndex = index;
+ this.locationErrorRemark = '';
+ this.locationErrorImages = [];
+ this.locationErrorPopupVisible = true;
+ },
+ closeLocationErrorPopup() {
+ this.locationErrorPopupVisible = false;
+ this.currentActionLineIndex = -1;
+ this.locationErrorSubmitting = false;
+ },
+ chooseLocationErrorImage() {
+ if (this.locationErrorImages.length >= 3) {
+ return;
+ }
+ uni.chooseImage({
+ count: 1,
+ sourceType: ['camera'],
+ sizeType: ['compressed'],
+ success: (res) => {
+ const filePath = res?.tempFilePaths?.[0] || res?.tempFiles?.[0]?.path;
+ if (!filePath) {
+ uni.showToast({
+ title: '拍照失败,请重试',
+ icon: 'none'
+ });
+ return;
+ }
+ this.locationErrorImages = [...this.locationErrorImages, filePath].slice(0, 3);
+ },
+ fail: () => {}
+ });
+ },
+ removeLocationErrorImage(index) {
+ this.locationErrorImages.splice(index, 1);
+ },
+ previewLocationErrorImage(index) {
+ if (!this.locationErrorImages.length) {
+ return;
+ }
+ uni.previewImage({
+ urls: this.locationErrorImages,
+ current: this.locationErrorImages[index] || this.locationErrorImages[0]
+ });
+ },
+ submitLocationError() {
+ const line = this.currentActionLine;
+ if (!line) {
+ this.closeLocationErrorPopup();
+ return;
+ }
+
+ if (!this.locationErrorImages.length) {
+ uni.showToast({
+ title: '请先拍照上传',
+ icon: 'none'
+ });
+ return;
+ }
+
+ this.locationErrorSubmitting = true;
+ const updatedLine = {
+ ...line,
+ locationErrorReported: true,
+ locationErrorRemark: String(this.locationErrorRemark || '').trim(),
+ locationErrorImages: [...this.locationErrorImages],
+ locationErrorReportedAt: Date.now()
+ };
+ this.$set(this.detailList, this.currentActionLineIndex, updatedLine);
+ this.emitOrderUpdate();
+ this.locationErrorSubmitting = false;
+ this.locationErrorPopupVisible = false;
+ this.currentActionLineIndex = -1;
+ uni.showToast({
+ title: '库位报错已提交',
+ icon: 'success'
+ });
+ },
+ safeDispatchBroadcast(action, payload) {
+ try {
+ const task = this.$store.dispatch(`broadcast/${action}`, payload);
+ if (task && typeof task.catch === 'function') {
+ task.catch(error => {
+ console.warn(`[OrderDetail] broadcast/${action} 调用失败:`, error);
+ });
+ }
+ } catch (error) {
+ console.warn(`[OrderDetail] broadcast/${action} 调用异常:`, error);
+ }
+ },
+ normalizeKeyword(value) {
+ return String(value || '').replace(/\s+/g, '');
+ },
+ normalizeScanResult(scanResult) {
+ if (!scanResult) {
+ return '';
+ }
+
+ if (typeof scanResult === 'string') {
+ return this.normalizeKeyword(scanResult);
+ }
+
+ if (typeof scanResult.result === 'string') {
+ return this.normalizeKeyword(scanResult.result);
+ }
+
+ if (Array.isArray(scanResult.result)) {
+ const firstResult = scanResult.result.find(item => item);
+ if (typeof firstResult === 'string') {
+ return this.normalizeKeyword(firstResult);
+ }
+ if (firstResult && typeof firstResult.data === 'string') {
+ return this.normalizeKeyword(firstResult.data);
+ }
+ }
+
+ if (typeof scanResult.data === 'string') {
+ return this.normalizeKeyword(scanResult.data);
+ }
+
+ return '';
+ },
+ handleBroadcastResult(result) {
+ const scanResult = this.normalizeScanResult(result);
+ if (!scanResult) {
+ return;
+ }
+ this.markPickedByBarcode(scanResult);
+ },
+ handleScanBarcode() {
+ this.safeDispatchBroadcast('resume');
+ uni.showToast({
+ title: '请使用扫描枪扫码',
+ icon: 'none'
+ });
+ },
+ markPickedByBarcode(barcode) {
+ const normalizedBarcode = String(barcode || '').trim();
+ if (!normalizedBarcode) {
+ return;
+ }
+
+ const index = this.detailList.findIndex(line => String(line.barcode || '').trim() === normalizedBarcode);
+ if (index < 0) {
+ uni.showToast({
+ title: '无扫描记录',
+ icon: 'none'
+ });
+ return;
+ }
+
+ const targetLine = this.detailList[index];
+ if (Number(targetLine.pickedQty || 0) >= Number(targetLine.needQty || 0)) {
+ uni.showToast({
+ title: '该商品已拣完成',
+ icon: 'none'
+ });
+ return;
+ }
+
+ const updatedLine = {
+ ...targetLine,
+ pickedQty: Number(targetLine.needQty || 0)
+ };
+ this.$set(this.detailList, index, updatedLine);
+
+ this.recalculateOrderProgress();
+ this.emitOrderUpdate();
+ this.speakPickResult(updatedLine);
+ uni.showToast({
+ title: `已拣:${updatedLine.skuName}`,
+ icon: 'success'
+ });
+ },
+ recalculateOrderProgress() {
+ const totalPicked = this.detailList.reduce((sum, line) => {
+ return sum + Number(line.pickedQty || 0);
+ }, 0);
+ const totalNeed = this.detailList.reduce((sum, line) => {
+ return sum + Number(line.needQty || 0);
+ }, 0);
+
+ this.orderInfo.needQty = totalNeed;
+ this.orderInfo.pickedQty = Math.max(0, Math.min(totalPicked, totalNeed));
+
+ if (this.orderInfo.pickedQty >= totalNeed && totalNeed > 0) {
+ this.orderInfo.status = 'done';
+ return;
+ }
+ if (this.orderInfo.pickedQty > 0) {
+ this.orderInfo.status = 'picking';
+ return;
+ }
+ this.orderInfo.status = 'pending';
+ },
emitOrderUpdate() {
uni.$emit('order:picking:updated', {
id: this.orderInfo.id,
@@ -112,10 +452,6 @@
return;
}
this.orderInfo.status = 'picking';
- if (Number(this.orderInfo.needQty || 0) > 0 && Number(this.orderInfo.pickedQty || 0) <= 0) {
- this.orderInfo.pickedQty = 1;
- }
- this.detailList = this.buildMockDetails(this.orderInfo);
this.emitOrderUpdate();
uni.showToast({
title: '已开始拣货',
@@ -127,8 +463,11 @@
return;
}
this.orderInfo.status = 'done';
- this.orderInfo.pickedQty = Number(this.orderInfo.needQty || 0);
- this.detailList = this.buildMockDetails(this.orderInfo);
+ this.detailList = this.detailList.map(line => ({
+ ...line,
+ pickedQty: Number(line.needQty || 0)
+ }));
+ this.recalculateOrderProgress();
this.emitOrderUpdate();
uni.showToast({
title: '拣货完成',
@@ -156,6 +495,7 @@
skuName: '陶瓷马克杯 350ml',
skuCode: 'SKU-CP-350',
barcode: '6901001000011',
+ basketNo: 'A01',
space: 'A-01-03',
needQty: firstNeed,
pickedQty: firstPicked
@@ -165,6 +505,7 @@
skuName: '密封保鲜盒 2L',
skuCode: 'SKU-FB-2000',
barcode: '6901001000028',
+ basketNo: 'B02',
space: 'B-02-08',
needQty: secondNeed,
pickedQty: secondPicked
@@ -174,6 +515,7 @@
skuName: '厨房清洁布 5片装',
skuCode: 'SKU-KC-005',
barcode: '6901001000035',
+ basketNo: 'C03',
space: 'C-03-12',
needQty: thirdNeed,
pickedQty: thirdPicked
@@ -236,11 +578,34 @@
color: #303133;
}
+ .section-title-row {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 24rpx 24rpx 12rpx;
+ }
+
.section-title {
font-size: 26rpx;
font-weight: 600;
color: #303133;
- padding: 24rpx 24rpx 12rpx;
+ }
+
+ .scan-entry {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ height: 46rpx;
+ padding: 0 14rpx;
+ background: #edf4ff;
+ border-radius: 23rpx;
+ }
+
+ .scan-entry__text {
+ font-size: 22rpx;
+ font-weight: 600;
+ color: #2979ff;
+ margin-left: 6rpx;
}
.detail-list {
@@ -261,6 +626,38 @@
margin-bottom: 8rpx;
}
+ .detail-head-right {
+ display: inline-flex;
+ align-items: center;
+ }
+
+ .verify-tag {
+ font-size: 20rpx;
+ color: #2979ff;
+ background: #edf4ff;
+ padding: 4rpx 10rpx;
+ border-radius: 12rpx;
+ margin-right: 8rpx;
+ }
+
+ .error-tag {
+ font-size: 20rpx;
+ color: #fa3534;
+ background: #fff2f0;
+ padding: 4rpx 10rpx;
+ border-radius: 12rpx;
+ margin-right: 8rpx;
+ }
+
+ .picked-tag {
+ font-size: 20rpx;
+ color: #19be6b;
+ background: #eafaf0;
+ padding: 4rpx 10rpx;
+ border-radius: 12rpx;
+ margin-right: 8rpx;
+ }
+
.sku-name {
font-size: 26rpx;
font-weight: 600;
@@ -285,4 +682,82 @@
border-top: 1rpx solid #f0f0f0;
box-sizing: border-box;
}
+
+ .location-error-popup {
+ padding: 26rpx 24rpx calc(20rpx + env(safe-area-inset-bottom));
+ }
+
+ .popup-title {
+ font-size: 30rpx;
+ font-weight: 600;
+ color: #303133;
+ margin-bottom: 16rpx;
+ }
+
+ .popup-line {
+ font-size: 24rpx;
+ line-height: 38rpx;
+ color: #606266;
+ }
+
+ .popup-label {
+ font-size: 24rpx;
+ color: #303133;
+ font-weight: 600;
+ margin: 16rpx 0 10rpx;
+ }
+
+ .photo-list {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ }
+
+ .photo-item {
+ position: relative;
+ width: 120rpx;
+ height: 120rpx;
+ margin-right: 12rpx;
+ margin-bottom: 12rpx;
+ }
+
+ .photo-remove {
+ position: absolute;
+ right: -10rpx;
+ top: -10rpx;
+ width: 34rpx;
+ height: 34rpx;
+ border-radius: 17rpx;
+ background: rgba(0, 0, 0, 0.6);
+ color: #fff;
+ font-size: 26rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .photo-add {
+ width: 120rpx;
+ height: 120rpx;
+ border: 1rpx dashed #bdd4ff;
+ border-radius: 10rpx;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ margin-bottom: 12rpx;
+ }
+
+ .photo-add-text {
+ font-size: 22rpx;
+ color: #2979ff;
+ margin-top: 4rpx;
+ }
+
+ .popup-actions {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ column-gap: 12rpx;
+ margin-top: 8rpx;
+ }
\ No newline at end of file
diff --git a/pages/work/order/picking.vue b/pages/work/order/picking.vue
index b37622e..0f2ae2c 100644
--- a/pages/work/order/picking.vue
+++ b/pages/work/order/picking.vue
@@ -7,7 +7,7 @@
-
+
@@ -81,6 +81,9 @@
+
@@ -92,43 +95,15 @@
title: '订单拣货',
keyword: '',
pickMode: 'F',
+ fullDisplay: true,
+ loading: false,
status: 'all',
+ pageSize: 10,
+ currentPage: 1,
+ totalItems: 0,
onOrderPickingUpdated: null,
- fullList: [
- {
- id: 'op-001',
- orderNo: 'SO20260504001',
- customerName: '广州天豹贸易',
- waveNo: 'W2026050401',
- skuCount: 6,
- needQty: 56,
- pickedQty: 0,
- status: 'pending',
- createTime: '2026-05-04 09:10'
- },
- {
- id: 'op-002',
- orderNo: 'SO20260504002',
- customerName: '深圳辰星供应链',
- waveNo: 'W2026050401',
- skuCount: 9,
- needQty: 120,
- pickedQty: 68,
- status: 'picking',
- createTime: '2026-05-04 09:32'
- },
- {
- id: 'op-003',
- orderNo: 'SO20260503015',
- customerName: '佛山云仓科技',
- waveNo: 'W2026050303',
- skuCount: 3,
- needQty: 24,
- pickedQty: 24,
- status: 'done',
- createTime: '2026-05-03 15:46'
- }
- ],
+ fullList: [],
+ filteredList: [],
displayList: []
}
},
@@ -143,6 +118,11 @@
}
},
onLoad(options) {
+ this.safeDispatchBroadcast('setCallbacks', {
+ onResult: this.handleBroadcastResult
+ });
+ this.safeDispatchBroadcast('start');
+
this.onOrderPickingUpdated = payload => {
this.applyOrderUpdate(payload);
};
@@ -157,42 +137,214 @@
this.pickMode = mode;
}
}
- this.handleSearch();
+ if (options && options.waybill_code) {
+ this.keyword = String(options.waybill_code || '').trim();
+ this.handleSearch({
+ silentTip: true
+ });
+ }
+ },
+ onShow() {
+ this.safeDispatchBroadcast('setCallbacks', {
+ onResult: this.handleBroadcastResult
+ });
+ this.safeDispatchBroadcast('resume');
+ },
+ onHide() {
+ this.safeDispatchBroadcast('pause');
},
onUnload() {
+ this.safeDispatchBroadcast('stop');
if (this.onOrderPickingUpdated) {
uni.$off('order:picking:updated', this.onOrderPickingUpdated);
this.onOrderPickingUpdated = null;
}
},
methods: {
+ safeDispatchBroadcast(action, payload) {
+ try {
+ const task = this.$store.dispatch(`broadcast/${action}`, payload);
+ if (task && typeof task.catch === 'function') {
+ task.catch(error => {
+ console.warn(`[OrderPicking] broadcast/${action} 调用失败:`, error);
+ });
+ }
+ } catch (error) {
+ console.warn(`[OrderPicking] broadcast/${action} 调用异常:`, error);
+ }
+ },
+ normalizeKeyword(value) {
+ return String(value || '').replace(/\s+/g, '');
+ },
+ normalizeScanResult(scanResult) {
+ if (!scanResult) {
+ return '';
+ }
+
+ if (typeof scanResult === 'string') {
+ return this.normalizeKeyword(scanResult);
+ }
+
+ if (typeof scanResult.result === 'string') {
+ return this.normalizeKeyword(scanResult.result);
+ }
+
+ if (Array.isArray(scanResult.result)) {
+ const firstResult = scanResult.result.find(item => item);
+ if (typeof firstResult === 'string') {
+ return this.normalizeKeyword(firstResult);
+ }
+ if (firstResult && typeof firstResult.data === 'string') {
+ return this.normalizeKeyword(firstResult.data);
+ }
+ }
+
+ if (typeof scanResult.data === 'string') {
+ return this.normalizeKeyword(scanResult.data);
+ }
+
+ return '';
+ },
+ handleBroadcastResult(result) {
+ const scanResult = this.normalizeScanResult(result);
+ if (!scanResult) {
+ return;
+ }
+
+ this.keyword = scanResult;
+ this.handleSearch();
+ },
+ handleScanTrigger() {
+ this.safeDispatchBroadcast('resume');
+ uni.showToast({
+ title: '请使用扫描枪扫码',
+ icon: 'none'
+ });
+ },
switchPickMode(mode) {
if (mode !== 'F' && mode !== 'E') {
return;
}
this.pickMode = mode;
},
- handleSearch() {
- const keyword = String(this.keyword || '').trim().toLowerCase();
- this.displayList = this.fullList.filter(item => {
- const matchStatus = this.status === 'all' || item.status === this.status;
- const matchKeyword = !keyword || String(item.orderNo).toLowerCase().includes(keyword) || String(item.customerName || '').toLowerCase().includes(keyword);
- return matchStatus && matchKeyword;
- });
+ getApiErrorMessage(error, fallback = '请求失败') {
+ const message = error?.message || error?.msg || error?.errMsg || error?.data?.message;
+ return String(message || fallback);
+ },
+ normalizeStatus(value) {
+ const text = String(value || '').toLowerCase();
+ if (!text) {
+ return 'pending';
+ }
+ if (['fin', 'finished', 'done', 'completed', 'complete', 'success'].includes(text)) {
+ return 'done';
+ }
+ if (['picking', 'pick', 'doing', 'processing', 'progress', 'part'].includes(text)) {
+ return 'picking';
+ }
+ return 'pending';
+ },
+ extractOrderList(response) {
+ if (Array.isArray(response)) {
+ return response;
+ }
+ const candidates = [
+ response?.data,
+ response?.data?.data,
+ response?.data?.list,
+ response?.data?.rows,
+ response?.data?.items,
+ response?.data?.result,
+ response?.list,
+ response?.rows,
+ response?.items,
+ response?.result
+ ];
+ for (let i = 0; i < candidates.length; i += 1) {
+ if (Array.isArray(candidates[i])) {
+ return candidates[i];
+ }
+ }
+ return [];
+ },
+ normalizeOrderItem(item, index) {
+ const source = item && typeof item === 'object' ? item : {};
+ const inspectionStatus = source.inspection_status || source.pick_status || source.status;
+ return {
+ id: source.id || source.order_id || source.pick_id || source.waybill_code || `pick_${index}`,
+ orderNo: source.order_no || source.order_code || source.waybill_code || source.waybillCode || '--',
+ customerName: source.customer_name || source.consignee || source.receiver_name || '--',
+ waveNo: source.wave_no || source.wave_code || source.batch_no || '--',
+ skuCount: Number(source.sku_count || source.item_count || source.goods_count || source.detail_count || 0),
+ needQty: Number(source.need_qty || source.pick_qty || source.total_qty || source.total_quantity || 0),
+ pickedQty: Number(source.picked_qty || source.done_qty || source.finish_qty || source.finished_qty || source.finished_qty || 0),
+ status: this.normalizeStatus(inspectionStatus),
+ createTime: source.created_at || source.create_time || source.createdAt || '--'
+ };
+ },
+ applyFilteredList(resetPage = true) {
+ this.filteredList = this.fullList.filter(item => this.status === 'all' || item.status === this.status);
+ this.totalItems = this.filteredList.length;
+ if (resetPage) {
+ this.currentPage = 1;
+ }
+ this.refreshDisplayList();
+ },
+ async handleSearch(options = {}) {
+ const resetPage = options.resetPage !== false;
+ const silentTip = options.silentTip === true;
+ const waybillCode = String(this.keyword || '').trim();
+ if (!waybillCode) {
+ this.fullList = [];
+ this.applyFilteredList(true);
+ if (!silentTip) {
+ uni.showToast({
+ title: '请输入快递号/运单号',
+ icon: 'none'
+ });
+ }
+ return;
+ }
+
+ this.loading = true;
+ try {
+ const response = await this.$http('pick.query', {
+ waybill_code: waybillCode,
+ full_display: Boolean(this.fullDisplay)
+ });
+ const orderList = this.extractOrderList(response)
+ .map((item, index) => this.normalizeOrderItem(item, index));
+ this.fullList = orderList;
+ this.applyFilteredList(resetPage);
+ } catch (error) {
+ this.fullList = [];
+ this.applyFilteredList(true);
+ uni.showToast({
+ title: this.getApiErrorMessage(error, '查询失败'),
+ icon: 'none'
+ });
+ } finally {
+ this.loading = false;
+ }
+ },
+ refreshDisplayList() {
+ const source = Array.isArray(this.filteredList) ? this.filteredList : [];
+ const totalPage = Math.max(Math.ceil(source.length / this.pageSize), 1);
+ if (this.currentPage > totalPage) {
+ this.currentPage = totalPage;
+ }
+ const start = (this.currentPage - 1) * this.pageSize;
+ this.displayList = source.slice(start, start + this.pageSize);
+ },
+ handlePageChange(page) {
+ this.currentPage = Number(page || 1);
+ this.refreshDisplayList();
},
switchStatus(nextStatus) {
this.status = nextStatus;
- this.handleSearch();
- },
- handleCameraScan() {
- uni.scanCode({
- success: (res) => {
- this.keyword = String(res.result || '').trim();
- this.handleSearch();
- },
- fail: () => {}
- });
+ this.applyFilteredList(true);
},
+
getStatusText(status) {
const map = {
pending: '待拣货',
@@ -250,7 +402,7 @@
}
this.$set(this.fullList, index, merged);
- this.handleSearch();
+ this.applyFilteredList(false);
},
getPickModeText() {
return this.pickMode === 'E' ? 'E拣货(边拣边分)' : 'F拣货(先拣后分)';
@@ -263,6 +415,14 @@
.order-picking-page {
min-height: 100vh;
background: #f8f9fa;
+ display: flex;
+ flex-direction: column;
+ }
+
+ ::v-deep .normar_container {
+ min-height: 100vh;
+ display: flex;
+ flex-direction: column;
}
.page-header {
@@ -384,7 +544,8 @@
}
.list-content {
- height: calc(100vh - 332rpx);
+ height: 100rpx;
+ flex: 1;
padding: 20rpx 24rpx 0;
box-sizing: border-box;
}
@@ -476,4 +637,19 @@
.safe-area-bottom {
height: calc(20rpx + env(safe-area-inset-bottom));
}
+
+ .order-pagination {
+ background: #fff;
+ position: relative;
+ }
+
+ ::v-deep .order-pagination .page-indicator {
+ padding: 16rpx 0;
+ }
+
+ .order-pagination::after {
+ content: '';
+ display: block;
+ height: env(safe-area-inset-bottom);
+ }
\ No newline at end of file
diff --git a/pages/work/storage/receiving/receiving.vue b/pages/work/storage/receiving/receiving.vue
index 1ff239c..74fe554 100644
--- a/pages/work/storage/receiving/receiving.vue
+++ b/pages/work/storage/receiving/receiving.vue
@@ -437,11 +437,121 @@
// 时间选择确认
handleDateConfirm(data) {
console.log('选择的时间范围:', data);
- this.where.startDate = data[0];
- this.where.endDate = data[1];
+ const { startDate, endDate } = this.parseCalendarRange(data);
+ if (startDate) {
+ this.where.startDate = startDate;
+ }
+ if (endDate) {
+ this.where.endDate = endDate;
+ }
this.dateModel = 'custom';
this.showSelectDate = false;
},
+ parseCalendarRange(data) {
+ let startDate = '';
+ let endDate = '';
+
+ if (Array.isArray(data)) {
+ startDate = data[0];
+ endDate = data[1];
+ } else if (data && typeof data === 'object') {
+ startDate = data.startDate || data.start || data.beginDate || '';
+ endDate = data.endDate || data.end || '';
+
+ if ((!startDate || !endDate) && Array.isArray(data.result)) {
+ startDate = startDate || data.result[0];
+ endDate = endDate || data.result[1];
+ }
+
+ if ((!startDate || !endDate) && typeof data.result === 'string') {
+ const parts = this.extractCalendarDateTokens(data.result);
+ startDate = startDate || parts[0] || '';
+ endDate = endDate || parts[1] || '';
+ }
+ } else if (typeof data === 'string') {
+ const parts = this.extractCalendarDateTokens(data);
+ startDate = parts[0] || '';
+ endDate = parts[1] || '';
+ }
+
+ const extractedDates = this.extractCalendarDatesFromPayload(data);
+ if (extractedDates.length >= 2) {
+ startDate = extractedDates[0];
+ endDate = extractedDates[extractedDates.length - 1];
+ }
+
+ startDate = this.normalizeCalendarDate(startDate);
+ endDate = this.normalizeCalendarDate(endDate);
+
+ if (startDate && !endDate) {
+ endDate = startDate;
+ }
+ if (!startDate && endDate) {
+ startDate = endDate;
+ }
+
+ return {
+ startDate,
+ endDate
+ };
+ },
+ extractCalendarDatesFromPayload(payload) {
+ let text = '';
+ if (typeof payload === 'string') {
+ text = payload;
+ } else {
+ try {
+ text = JSON.stringify(payload || '');
+ } catch (error) {
+ text = String(payload || '');
+ }
+ }
+
+ const matched = String(text || '').match(/\d{4}-\d{2}-\d{2}/g) || [];
+ const normalized = matched
+ .map(item => this.normalizeCalendarDate(item))
+ .filter(Boolean);
+
+ return Array.from(new Set(normalized)).sort();
+ },
+ extractCalendarDateTokens(value) {
+ const text = String(value || '').trim();
+ if (!text) {
+ return [];
+ }
+
+ const matched = text.match(/\d{4}-\d{2}-\d{2}/g);
+ if (matched && matched.length) {
+ return matched;
+ }
+
+ return text.split(/[~至]/).map(item => String(item || '').trim()).filter(Boolean);
+ },
+ normalizeCalendarDate(value) {
+ if (value === null || value === undefined || value === '') {
+ return '';
+ }
+
+ if (typeof value === 'number') {
+ return this.formatDate(new Date(value));
+ }
+
+ const text = String(value).trim();
+ if (!text) {
+ return '';
+ }
+
+ if (/^\d{4}-\d{2}-\d{2}$/.test(text)) {
+ return text;
+ }
+
+ const date = new Date(text);
+ if (!Number.isNaN(date.getTime())) {
+ return this.formatDate(date);
+ }
+
+ return '';
+ },
// 货主选择
handleStoreChange(option) {