diff --git a/pages/work/order/scatter-picking-detail.vue b/pages/work/order/scatter-picking-detail.vue index 94b8b66..f3e22f6 100644 --- a/pages/work/order/scatter-picking-detail.vue +++ b/pages/work/order/scatter-picking-detail.vue @@ -103,7 +103,8 @@ onlyMine: false, currentUserId: '', showPrintPopup: false, - printStationName: '默认打印台', + printStationName: '--', + printStationList: [], printMessage: '', pendingPrintCount: 0, orderList: [] @@ -156,6 +157,32 @@ this.safeDispatchBroadcast('stop'); }, methods: { + buildPrintRecordWhere() { + return {}; + }, + buildPrintRecordParams() { + return { + page: 1, + pageSize: 20, + where: this.buildPrintRecordWhere() + }; + }, + extractPrintRecordList(response) { + const list = response?.data?.list || response?.data?.data?.list; + return Array.isArray(list) ? list : []; + }, + normalizePrintStationNames(list) { + return list + .map(item => String(item?.name || '').trim()) + .filter(name => !!name); + }, + async loadPrintStations() { + const response = await this.$http('print.getList', this.buildPrintRecordParams()); + const list = this.extractPrintRecordList(response); + const names = this.normalizePrintStationNames(list); + this.printStationList = names; + this.printStationName = names.length ? names.join('、') : '--'; + }, safeDispatchBroadcast(action, payload) { try { const task = this.$store.dispatch(`broadcast/${action}`, payload); @@ -443,7 +470,7 @@ ]; this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`); }, - handlePrintAllUnreviewed() { + async handlePrintAllUnreviewed() { const targetList = this.displayOrderList.filter(item => Number(item.unreviewedCount || 0) > 0); if (!targetList.length) { uni.showToast({ @@ -452,6 +479,16 @@ }); return; } + try { + await this.loadPrintStations(); + } catch (error) { + this.printStationList = []; + this.printStationName = '--'; + uni.showToast({ + title: '打印台加载失败', + icon: 'none' + }); + } this.pendingPrintCount = targetList.length; this.printMessage = `待打印未复核订单 ${targetList.length} 条`; this.showPrintPopup = true;