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 @@