From 2e41d727916a0dad2af84d76d5a22ed388d8ef3a Mon Sep 17 00:00:00 2001 From: zm2000 <18386612143@163.com> Date: Sun, 31 May 2026 18:22:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=A3=E5=8D=95=E6=8B=A3?= =?UTF-8?q?=E8=B4=A7=E8=AF=A6=E6=83=85=E3=80=81=E5=9B=A2=E8=B4=AD=E6=8B=A3?= =?UTF-8?q?=E8=B4=A7=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=89=93=E5=8D=B0=E3=80=81?= =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=88=86=E9=A1=B5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/work/order/groupon-picking-detail.vue | 160 +++++++++++- pages/work/order/scatter-picking-detail.vue | 255 ++++++++++++++++---- 2 files changed, 361 insertions(+), 54 deletions(-) diff --git a/pages/work/order/groupon-picking-detail.vue b/pages/work/order/groupon-picking-detail.vue index b4c294b..cb5f582 100644 --- a/pages/work/order/groupon-picking-detail.vue +++ b/pages/work/order/groupon-picking-detail.vue @@ -37,6 +37,21 @@ + + + + @@ -49,6 +64,9 @@ onlyMine: false, currentUserId: '', grabCount: 0, + pageSize: 20, + currentPage: 1, + paginationTotal: 0, orderList: [] }; }, @@ -65,9 +83,121 @@ const hasGrabCountParam = options && Object.prototype.hasOwnProperty.call(options, 'grabCount'); const parsedGrabCount = Number(options?.grabCount || 0); this.grabCount = hasGrabCountParam ? Math.max(0, parsedGrabCount) : 6; - this.orderList = this.buildMockOrderList(this.grabCount); + this.loadBatchWaveNoList(); }, methods: { + buildBatchListParams(page = this.currentPage) { + return { + pagination: { + page: Number(page || 1), + pageSize: Number(this.pageSize || 20) + }, + where: { + source: 0, + wave_type: 1 + } + }; + }, + extractPagination(payload, response) { + return payload?.pagination || payload?.page || response?.data?.pagination || response?.pagination || null; + }, + extractBatchListPayload(response) { + const candidates = [ + response?.data?.data, + response?.data, + response?.result, + response + ]; + for (let i = 0; i < candidates.length; i += 1) { + const current = candidates[i]; + if (current && typeof current === 'object' && !Array.isArray(current)) { + return current; + } + } + return {}; + }, + extractBatchList(payload, response) { + const candidates = [ + payload?.list, + payload?.rows, + payload?.items, + payload?.data?.list, + response?.data?.list, + response?.data?.data?.list, + response?.list + ]; + for (let i = 0; i < candidates.length; i += 1) { + if (Array.isArray(candidates[i])) { + return candidates[i]; + } + } + return []; + }, + normalizeBatchWaveList(list) { + if (!Array.isArray(list)) { + return []; + } + return list + .map(item => { + const source = item && typeof item === 'object' ? item : {}; + const waveNo = String(source.wave_no || '').trim(); + const rowId = source.wave_id ?? source.waveId ?? source.id ?? waveNo; + const pickerName = String(source.picker_name || source.pickerName || source.user_name || source.userName || '--').trim() || '--'; + const pendingCount = Number(source.pending_count ?? source.pendingCount ?? source.unreviewed_count ?? source.unreviewedCount ?? 0); + const assigneeId = String((source.picker_id ?? source.pickerId ?? source.user_id ?? source.userId) || '').trim(); + return { + id: String(rowId || ''), + waveNo, + pickerName, + pendingCount: Number.isFinite(pendingCount) ? pendingCount : 0, + isMine: !!this.currentUserId && !!assigneeId && assigneeId === this.currentUserId + }; + }) + .filter(item => !!item.waveNo) + .map((item, index) => ({ + ...item, + id: item.id || `batch-${this.currentPage}-${index + 1}` + })); + }, + resolvePaginationTotal(payload, response, pagination, list) { + const candidates = [ + pagination?.total, + payload?.total, + payload?.count, + payload?.totalCount, + response?.data?.total, + response?.total, + Array.isArray(list) ? list.length : 0 + ]; + for (let i = 0; i < candidates.length; i += 1) { + const value = Number(candidates[i]); + if (Number.isFinite(value) && value >= 0) { + return value; + } + } + return 0; + }, + async loadBatchWaveNoList(page = this.currentPage) { + const targetPage = Math.max(1, Number(page || 1)); + try { + const response = await this.$http('order.wave.batchList', this.buildBatchListParams(targetPage)); + const payload = this.extractBatchListPayload(response); + const list = this.extractBatchList(payload, response); + const pagination = this.extractPagination(payload, response); + const batchWaveList = this.normalizeBatchWaveList(list); + this.orderList = batchWaveList; + this.paginationTotal = this.resolvePaginationTotal(payload, response, pagination, list); + this.currentPage = Number((pagination?.page ?? targetPage) || targetPage); + this.pageSize = Number((pagination?.pageSize ?? this.pageSize) || this.pageSize); + } catch (error) { + this.orderList = []; + this.paginationTotal = 0; + uni.showToast({ + title: '波次列表加载失败', + icon: 'none' + }); + } + }, toggleOnlyMine() { this.onlyMine = !this.onlyMine; }, @@ -97,6 +227,14 @@ `未复核数量:${item.pendingCount || 0}` ].join('\n') }); + }, + handlePageChange(page) { + const targetPage = Math.max(1, Number(page || 1)); + if (targetPage === this.currentPage) { + return; + } + this.currentPage = targetPage; + this.loadBatchWaveNoList(targetPage); } } }; @@ -104,10 +242,17 @@