修改复核发货、散单拣货详情、商品查询页面
This commit is contained in:
parent
1c0f6a9451
commit
a448958e47
@ -2147,9 +2147,11 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
const normalizedKeyword = this.normalizeKeyword(keyword);
|
const normalizedKeyword = this.normalizeKeyword(keyword);
|
||||||
if (!normalizedKeyword) {
|
if (!normalizedKeyword) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请输入快递单号或车号',
|
title: '扫描关键词不能为空',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
|
// 对应接口 400「扫描关键词不能为空」:同步语音提示
|
||||||
|
this.speakVoice('扫描关键词不能为空');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2159,35 +2161,61 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const response = await this.$http('order.recheckOrder.scanOrder', this.buildScanOrderParams(normalizedKeyword));
|
// 第4参 toastAfter=false:关闭请求层全局错误 toast,由 handleScanOrderError 统一按 silent 控制提示与语音
|
||||||
|
const response = await this.$http('order.recheckOrder.scanOrder', this.buildScanOrderParams(normalizedKeyword), '', false);
|
||||||
// 检测接口返回的错误信息
|
// 检测接口返回的错误信息
|
||||||
if (response?.flag === 'failure') {
|
if (response?.flag === 'failure') {
|
||||||
|
// 依据后端提示(400 扫描关键词不能为空 / 404 未找到对应订单 / 400 订单未拣货不允许复核等)toast + 语音播报
|
||||||
const errorMsg = String(response?.message || response?.msg || '').trim();
|
const errorMsg = String(response?.message || response?.msg || '').trim();
|
||||||
if (!silent) {
|
this.handleScanOrderError(errorMsg || '订单查询失败', silent);
|
||||||
uni.showToast({
|
|
||||||
title: errorMsg || '订单查询失败',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const payload = this.extractScanOrderPayload(response);
|
const payload = this.extractScanOrderPayload(response);
|
||||||
const result = this.normalizeScanOrderResult(payload);
|
const result = this.normalizeScanOrderResult(payload);
|
||||||
this.handleScanOrderSuccess(result, silent);
|
this.handleScanOrderSuccess(result, silent);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (!silent) {
|
const message = String(error?.message || error?.msg || error?.errMsg || '').trim();
|
||||||
const message = String(error?.message || error?.msg || error?.errMsg || '').trim();
|
this.handleScanOrderError(message || '订单查询失败', silent);
|
||||||
uni.showToast({
|
|
||||||
title: message || '订单查询失败',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// scanOrder 接口业务失败:toast 展示后端提示,并按提示内容语音播报
|
||||||
|
handleScanOrderError(message, silent = false) {
|
||||||
|
const raw = String(message || '').trim();
|
||||||
|
// 去除后端常见包装前缀:如 "接口错误: 未找到对应订单" -> "未找到对应订单"
|
||||||
|
const cleaned = raw.replace(/^接口错误\s*[::]\s*/, '').trim();
|
||||||
|
const toastText = cleaned || '订单查询失败';
|
||||||
|
if (!silent) {
|
||||||
|
uni.showToast({
|
||||||
|
title: toastText,
|
||||||
|
icon: 'none',
|
||||||
|
// 业务错误提示(如未找到对应订单/订单未拣货等)展示 5s,便于 PDA 现场确认
|
||||||
|
duration: 5000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const voiceText = this.resolveScanOrderErrorVoice(toastText);
|
||||||
|
if (voiceText) {
|
||||||
|
this.speakVoice(voiceText);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 将 scanOrder 返回的业务提示映射为语音播报文本(对应接口 400/404 常见错误)
|
||||||
|
resolveScanOrderErrorVoice(message) {
|
||||||
|
const text = String(message || '').trim();
|
||||||
|
if (/未拣货/.test(text)) {
|
||||||
|
return '订单未拣货,不允许复核';
|
||||||
|
}
|
||||||
|
if (/未找到对应订单|未查询到订单|无匹配订单|未找到订单/.test(text)) {
|
||||||
|
return '未找到对应订单';
|
||||||
|
}
|
||||||
|
if (/扫描关键词不能为空|关键词为空|请输入快递单号或车号/.test(text)) {
|
||||||
|
return '扫描关键词不能为空';
|
||||||
|
}
|
||||||
|
// 其他未识别的业务提示:仅 toast 不额外播报,避免朗读非预期文案
|
||||||
|
return '';
|
||||||
|
},
|
||||||
async toggleUnboundPrintStationOnly() {
|
async toggleUnboundPrintStationOnly() {
|
||||||
this.showUnboundPrintStationOnly = true;
|
this.showUnboundPrintStationOnly = true;
|
||||||
this.selectedStationId = this.printStationId || '';
|
this.selectedStationId = this.printStationId || '';
|
||||||
|
|||||||
@ -93,32 +93,29 @@
|
|||||||
<view class="print-popup-title">打印设置</view>
|
<view class="print-popup-title">打印设置</view>
|
||||||
<view class="print-row print-row--station">
|
<view class="print-row print-row--station">
|
||||||
<text class="print-label">打印台</text>
|
<text class="print-label">打印台</text>
|
||||||
<view class="print-picker" @click="togglePrintStationDropdown">
|
<view class="print-station-input-wrap">
|
||||||
<text class="print-picker-value">{{ printStationName || '--' }}</text>
|
<u-input
|
||||||
<u-icon :name="showPrintStationDropdown ? 'arrow-up' : 'arrow-down'" size="24" color="#909399"></u-icon>
|
v-model="printStationInputKeyword"
|
||||||
</view>
|
placeholder="请输入或扫描打印台编号"
|
||||||
<view v-if="showPrintStationDropdown" class="print-station-dropdown">
|
:clearable="true"
|
||||||
<view
|
:customStyle="{ fontSize: '28rpx', height: '80rpx', lineHeight: '80rpx', padding: '0 20rpx', background: '#fafafa', borderRadius: '10rpx' }"
|
||||||
v-for="station in printStationList"
|
@input="handlePrintStationInput"
|
||||||
:key="station.id"
|
@confirm="handlePrintStationInputConfirm"
|
||||||
class="print-station-option"
|
></u-input>
|
||||||
:class="{ 'print-station-option--active': station.id === printStationId }"
|
|
||||||
@click.stop="handlePrintStationSelect(station)"
|
|
||||||
>
|
|
||||||
{{ station.name }}
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="print-row print-row--action">
|
<view class="print-row print-row--action">
|
||||||
<text class="print-label">打印</text>
|
<text class="print-label">打印</text>
|
||||||
<u-button
|
<view class="print-action-wrap">
|
||||||
type="primary"
|
<u-button
|
||||||
size="mini"
|
type="primary"
|
||||||
:customStyle="{ backgroundColor: '#2979ff', borderColor: '#2979ff', fontSize: '26rpx', height: '64rpx', lineHeight: '64rpx', padding: '0 20rpx' }"
|
size="mini"
|
||||||
@click="handleConfirmPrint"
|
:customStyle="{ backgroundColor: '#2979ff', borderColor: '#2979ff', fontSize: '26rpx', height: '64rpx', lineHeight: '64rpx', padding: '0 20rpx' }"
|
||||||
>
|
@click="handleConfirmPrint"
|
||||||
打印
|
>
|
||||||
</u-button>
|
打印
|
||||||
|
</u-button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="print-row print-row--message">
|
<view class="print-row print-row--message">
|
||||||
<text class="print-label">打印消息</text>
|
<text class="print-label">打印消息</text>
|
||||||
@ -143,7 +140,7 @@
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
paginationTotal: 0,
|
paginationTotal: 0,
|
||||||
showPrintPopup: false,
|
showPrintPopup: false,
|
||||||
showPrintStationDropdown: false,
|
printStationInputKeyword: '',
|
||||||
printStationName: '--',
|
printStationName: '--',
|
||||||
printStationId: '',
|
printStationId: '',
|
||||||
printStationList: [],
|
printStationList: [],
|
||||||
@ -462,6 +459,109 @@
|
|||||||
.map(group => (group && typeof group === 'object' ? group : null))
|
.map(group => (group && typeof group === 'object' ? group : null))
|
||||||
.filter(group => !!group);
|
.filter(group => !!group);
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 提取 getWavePlatformPrintData 返回的 locked_wave_groups(打印锁占用的分组)
|
||||||
|
* 已打印面单的数据会出现在 locked_wave_groups,而 waveGroups 为空
|
||||||
|
* @param {object} payload
|
||||||
|
*/
|
||||||
|
extractLockedWaveGroups(payload) {
|
||||||
|
const groups = Array.isArray(payload?.locked_wave_groups) ? payload.locked_wave_groups : [];
|
||||||
|
return groups
|
||||||
|
.map(group => (group && typeof group === 'object' ? group : null))
|
||||||
|
.filter(group => !!group);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 判断锁定订单是否为拦截订单(无需解锁,禁止打印)
|
||||||
|
* 当 locked_orders 的 order_id 与 intercepted_orders 的 order_id 一致(拦截集合覆盖全部锁定集合)时返回 true
|
||||||
|
* @param {object} payload getWavePlatformPrintData 返回的数据
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
isInterceptedPrintBlock(payload) {
|
||||||
|
const lockedOrders = Array.isArray(payload?.locked_orders) ? payload.locked_orders : [];
|
||||||
|
const interceptedOrders = Array.isArray(payload?.intercepted_orders) ? payload.intercepted_orders : [];
|
||||||
|
const lockedIds = new Set(
|
||||||
|
lockedOrders.map(order => order?.order_id ?? order?.orderId ?? '').filter(id => id !== '' && id != null)
|
||||||
|
);
|
||||||
|
const interceptedIds = new Set(
|
||||||
|
interceptedOrders.map(order => order?.order_id ?? order?.orderId ?? '').filter(id => id !== '' && id != null)
|
||||||
|
);
|
||||||
|
if (!lockedIds.size || !interceptedIds.size) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 拦截集合覆盖全部锁定集合 → 锁定订单均为拦截订单,不支持打印
|
||||||
|
for (const id of lockedIds) {
|
||||||
|
if (!interceptedIds.has(id)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 将 locked_wave_groups 转换为 unlockWavePlatformPrintDataByGroup 所需的 groups 分组条件
|
||||||
|
* 每个(波次 + 平台 + 系统快递编码)组合为一个分组
|
||||||
|
* @param {Array} lockedWaveGroups 打印锁占用的波次平台分组
|
||||||
|
*/
|
||||||
|
buildUnlockGroups(lockedWaveGroups) {
|
||||||
|
const groups = [];
|
||||||
|
(Array.isArray(lockedWaveGroups) ? lockedWaveGroups : []).forEach(waveGroup => {
|
||||||
|
const waveId = waveGroup?.wave_id ?? waveGroup?.waveId ?? waveGroup?.id ?? '';
|
||||||
|
const platforms = Array.isArray(waveGroup?.platforms) ? waveGroup.platforms : [];
|
||||||
|
if (platforms.length) {
|
||||||
|
platforms.forEach(platform => {
|
||||||
|
groups.push({
|
||||||
|
wave_id: waveId,
|
||||||
|
platform: platform?.platform ?? platform?.platform_code ?? '',
|
||||||
|
sys_logistics_code: platform?.sys_logistics_code ?? platform?.sysLogisticsCode ?? platform?.logistics_code ?? '',
|
||||||
|
order_ids: Array.isArray(platform?.order_ids) ? platform.order_ids : []
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else if (waveId !== '' && waveId != null) {
|
||||||
|
// 无平台嵌套时按波次兜底
|
||||||
|
groups.push({ wave_id: waveId, platform: '', sys_logistics_code: '', order_ids: [] });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return groups.filter(group => group.wave_id !== '' && group.wave_id != null);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 按分组解锁波次平台打印锁(order.print.unlockWavePlatformPrintDataByGroup)
|
||||||
|
* 将传入的分组中已锁定的订单 print_lock_status 置为 none
|
||||||
|
* @param {Array} lockedWaveGroups 打印锁占用的波次平台分组(用于构建 groups 条件)
|
||||||
|
* @returns {Promise<object>} 解锁结果(summary / unlocked_order_ids / unlocked_orders 等)
|
||||||
|
*/
|
||||||
|
async unlockWavePlatformPrintDataByGroup(lockedWaveGroups) {
|
||||||
|
const warehouseId = this.resolveWarehouseId();
|
||||||
|
if (!warehouseId) {
|
||||||
|
throw new Error('缺少仓库ID');
|
||||||
|
}
|
||||||
|
const groups = this.buildUnlockGroups(lockedWaveGroups);
|
||||||
|
if (!groups.length) {
|
||||||
|
throw new Error('缺少可解锁的分组条件');
|
||||||
|
}
|
||||||
|
const waveIds = Array.from(new Set(
|
||||||
|
groups.map(g => g.wave_id).filter(id => id !== '' && id != null)
|
||||||
|
));
|
||||||
|
const params = {
|
||||||
|
warehouse_id: warehouseId,
|
||||||
|
wave_ids: waveIds,
|
||||||
|
group_type: 'platform_express',
|
||||||
|
unlock_scope: 'group',
|
||||||
|
groups
|
||||||
|
};
|
||||||
|
const response = await this.$http('order.print.unlockWavePlatformPrintDataByGroup', params);
|
||||||
|
const unlockPayload = response?.data?.data
|
||||||
|
|| response?.data
|
||||||
|
|| response?.result
|
||||||
|
|| response
|
||||||
|
|| {};
|
||||||
|
const unlockedIds = unlockPayload?.unlocked_order_ids || [];
|
||||||
|
const unlockedCount = Array.isArray(unlockedIds) ? unlockedIds.length : 0;
|
||||||
|
console.log(`[ScatterPickingDetail] 波次平台打印锁解锁成功,解锁订单数: ${unlockedCount}`);
|
||||||
|
return response;
|
||||||
|
},
|
||||||
|
async fetchWavePlatformPrintPayload(params) {
|
||||||
|
const response = await this.$http('order.print.getWavePlatformPrintData', params);
|
||||||
|
return this.extractWavePlatformPrintPayload(response);
|
||||||
|
},
|
||||||
buildPrintRequestCode() {
|
buildPrintRequestCode() {
|
||||||
const timePart = Date.now().toString(36);
|
const timePart = Date.now().toString(36);
|
||||||
const randomPart = Math.random().toString(36).slice(2, 10);
|
const randomPart = Math.random().toString(36).slice(2, 10);
|
||||||
@ -475,9 +575,25 @@
|
|||||||
if (!params.wave_ids.length) {
|
if (!params.wave_ids.length) {
|
||||||
throw new Error('缺少波次ID');
|
throw new Error('缺少波次ID');
|
||||||
}
|
}
|
||||||
const response = await this.$http('order.print.getWavePlatformPrintData', params);
|
|
||||||
const payload = this.extractWavePlatformPrintPayload(response);
|
let payload = await this.fetchWavePlatformPrintPayload(params);
|
||||||
const waveGroups = this.normalizeWaveGroups(payload);
|
let waveGroups = this.normalizeWaveGroups(payload);
|
||||||
|
const lockedWaveGroups = this.extractLockedWaveGroups(payload);
|
||||||
|
// 打印锁占用:waveGroups 为空 + locked_wave_groups 有值 → 先按分组解锁打印锁,解锁后重新获取可打印数据
|
||||||
|
if (!waveGroups.length && lockedWaveGroups.length) {
|
||||||
|
// 拦截订单与锁定订单 order_id 一致 → 拦截订单不支持打印,无需解锁
|
||||||
|
if (this.isInterceptedPrintBlock(payload)) {
|
||||||
|
throw new Error('拦截订单,不支持打印');
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await this.unlockWavePlatformPrintDataByGroup(lockedWaveGroups);
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(`解锁打印锁失败:${String(error?.message || error?.msg || error?.errMsg || '请稍后重试')}`);
|
||||||
|
}
|
||||||
|
payload = await this.fetchWavePlatformPrintPayload(params);
|
||||||
|
waveGroups = this.normalizeWaveGroups(payload);
|
||||||
|
}
|
||||||
|
|
||||||
if (!waveGroups.length) {
|
if (!waveGroups.length) {
|
||||||
throw new Error('未获取到可打印的waveGroups');
|
throw new Error('未获取到可打印的waveGroups');
|
||||||
}
|
}
|
||||||
@ -506,35 +622,108 @@
|
|||||||
const source = item && typeof item === 'object' ? item : {};
|
const source = item && typeof item === 'object' ? item : {};
|
||||||
const id = String(source.id ?? source.print_station_id ?? source.printStationId ?? '').trim();
|
const id = String(source.id ?? source.print_station_id ?? source.printStationId ?? '').trim();
|
||||||
const name = String(source.name || source.station_name || source.print_station_name || '').trim();
|
const name = String(source.name || source.station_name || source.print_station_name || '').trim();
|
||||||
|
const customBarcode = String(source.custom_barcode || source.bar_code || source.barcode || source.station_code || source.print_station_code || '').trim();
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
name
|
name,
|
||||||
|
customBarcode
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter(item => !!item.id && !!item.name);
|
.filter(item => !!item.id && !!item.name);
|
||||||
},
|
},
|
||||||
async loadPrintStations() {
|
async loadPrintStations(autoAssign = false) {
|
||||||
const response = await this.$http('print.getList', this.buildPrintRecordParams());
|
const response = await this.$http('print.getList', this.buildPrintRecordParams());
|
||||||
const list = this.extractPrintRecordList(response);
|
const list = this.extractPrintRecordList(response);
|
||||||
const stations = this.normalizePrintStations(list);
|
const stations = this.normalizePrintStations(list);
|
||||||
this.printStationList = stations;
|
this.printStationList = stations;
|
||||||
this.printStationId = stations[0]?.id || '';
|
// 输入框模式:不再默认分配打印台,需扫码/输入精确匹配
|
||||||
this.printStationName = stations[0]?.name || '--';
|
if (autoAssign && stations.length && !this.printStationId) {
|
||||||
|
this.printStationId = stations[0]?.id || '';
|
||||||
|
this.printStationName = stations[0]?.name || '--';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
togglePrintStationDropdown() {
|
async ensurePrintStationsLoaded() {
|
||||||
if (!this.printStationList.length) {
|
if (Array.isArray(this.printStationList) && this.printStationList.length) {
|
||||||
uni.showToast({
|
return true;
|
||||||
title: '暂无可用打印台',
|
}
|
||||||
icon: 'none'
|
try {
|
||||||
});
|
uni.showLoading({ title: '加载打印台...' });
|
||||||
|
await this.loadPrintStations(false);
|
||||||
|
return Array.isArray(this.printStationList) && this.printStationList.length;
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('[ScatterPickingDetail] 加载打印台列表失败:', error);
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
resolvePrintStationByKeyword(keyword) {
|
||||||
|
const list = Array.isArray(this.printStationList) ? this.printStationList : [];
|
||||||
|
if (!list.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const kw = this.normalizeKeyword(keyword).toLowerCase();
|
||||||
|
if (!kw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return list.find(station =>
|
||||||
|
String(station.name || '').toLowerCase() === kw
|
||||||
|
|| String(station.id || '').toLowerCase() === kw
|
||||||
|
|| String(station.customBarcode || '').toLowerCase() === kw
|
||||||
|
) || null;
|
||||||
|
},
|
||||||
|
applyPrintStation(station) {
|
||||||
|
if (!station) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.printStationId = String(station.id || '');
|
||||||
|
this.printStationName = String(station.name || '--');
|
||||||
|
// 仅回显打印台名称,不追加条码
|
||||||
|
this.printStationInputKeyword = String(station.name || '');
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
handlePrintStationInput(value) {
|
||||||
|
const keyword = this.normalizeKeyword(value);
|
||||||
|
if (!keyword) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.showPrintStationDropdown = !this.showPrintStationDropdown;
|
const matched = this.resolvePrintStationByKeyword(keyword);
|
||||||
|
if (matched) {
|
||||||
|
this.applyPrintStation(matched);
|
||||||
|
uni.showToast({ title: `已匹配打印台:${matched.name}`, icon: 'none' });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
handlePrintStationSelect(station) {
|
async matchPrintStationByKeyword(keyword) {
|
||||||
this.printStationId = String(station?.id || '');
|
const text = this.normalizeKeyword(keyword);
|
||||||
this.printStationName = String(station?.name || '--');
|
if (!text) {
|
||||||
this.showPrintStationDropdown = false;
|
return;
|
||||||
|
}
|
||||||
|
// 打印台列表未加载时自动加载,保证广播扫描可直接匹配
|
||||||
|
const loaded = await this.ensurePrintStationsLoaded();
|
||||||
|
if (!loaded) {
|
||||||
|
uni.showToast({ title: '暂无可用打印台', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const matched = this.resolvePrintStationByKeyword(text);
|
||||||
|
if (matched) {
|
||||||
|
this.applyPrintStation(matched);
|
||||||
|
uni.showToast({ title: `已匹配打印台:${matched.name}`, icon: 'success' });
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: '未匹配到打印台', icon: 'none' });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handlePrintStationInputConfirm() {
|
||||||
|
const keyword = this.normalizeKeyword(this.printStationInputKeyword);
|
||||||
|
if (!keyword) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const matched = this.resolvePrintStationByKeyword(keyword);
|
||||||
|
if (matched) {
|
||||||
|
this.applyPrintStation(matched);
|
||||||
|
uni.showToast({ title: `已匹配打印台:${matched.name}`, icon: 'success' });
|
||||||
|
} else {
|
||||||
|
this.matchPrintStationByKeyword(keyword);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
safeDispatchBroadcast(action, payload) {
|
safeDispatchBroadcast(action, payload) {
|
||||||
try {
|
try {
|
||||||
@ -585,6 +774,12 @@
|
|||||||
if (!scanText) {
|
if (!scanText) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 打印设置弹窗打开时,扫描结果填入打印台输入框并自动匹配打印台
|
||||||
|
if (this.showPrintPopup) {
|
||||||
|
this.printStationInputKeyword = scanText;
|
||||||
|
this.matchPrintStationByKeyword(scanText);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.keyword = scanText;
|
this.keyword = scanText;
|
||||||
this.handleSearch();
|
this.handleSearch();
|
||||||
},
|
},
|
||||||
@ -742,16 +937,19 @@
|
|||||||
this.printMessage = message;
|
this.printMessage = message;
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: message,
|
title: message,
|
||||||
icon: 'none'
|
icon: 'none',
|
||||||
|
duration: 4000
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.loadPrintStations();
|
await this.loadPrintStations(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.printStationList = [];
|
this.printStationList = [];
|
||||||
|
this.printStationId = '';
|
||||||
this.printStationName = '--';
|
this.printStationName = '--';
|
||||||
|
this.printStationInputKeyword = '';
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '打印台加载失败',
|
title: '打印台加载失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@ -759,7 +957,14 @@
|
|||||||
}
|
}
|
||||||
this.pendingPrintCount = Number(target.unreviewedCount || 0);
|
this.pendingPrintCount = Number(target.unreviewedCount || 0);
|
||||||
this.printMessage = `待打印未复核订单 ${this.pendingPrintCount} 条`;
|
this.printMessage = `待打印未复核订单 ${this.pendingPrintCount} 条`;
|
||||||
this.showPrintStationDropdown = false;
|
// 回显已匹配的打印台;未匹配时清空输入等待扫码/输入
|
||||||
|
if (this.printStationId && this.printStationName && this.printStationName !== '--') {
|
||||||
|
this.printStationInputKeyword = this.printStationName;
|
||||||
|
} else {
|
||||||
|
this.printStationId = '';
|
||||||
|
this.printStationName = '--';
|
||||||
|
this.printStationInputKeyword = '';
|
||||||
|
}
|
||||||
this.showPrintPopup = true;
|
this.showPrintPopup = true;
|
||||||
},
|
},
|
||||||
buildPrintSendParams() {
|
buildPrintSendParams() {
|
||||||
@ -776,10 +981,18 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
async handleConfirmPrint() {
|
async handleConfirmPrint() {
|
||||||
if (!this.printStationList.length || !this.printStationId || !this.printStationName || this.printStationName === '--') {
|
if (!Array.isArray(this.printStationList) || !this.printStationList.length) {
|
||||||
this.printMessage = '请选择打印台';
|
this.printMessage = '暂无可用打印台';
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请选择打印台',
|
title: '暂无可用打印台',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.printStationId || !this.printStationName || this.printStationName === '--') {
|
||||||
|
this.printMessage = '请先扫描/输入打印台';
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先扫描/输入打印台',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@ -1118,7 +1331,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.print-row--station .print-label {
|
.print-row--station .print-label {
|
||||||
padding-top: 10rpx;
|
padding-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.print-row--action {
|
.print-row--action {
|
||||||
@ -1144,53 +1357,40 @@
|
|||||||
color: #303133;
|
color: #303133;
|
||||||
}
|
}
|
||||||
|
|
||||||
.print-picker {
|
.print-station-input-wrap {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
max-width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
box-sizing: border-box;
|
||||||
padding: 10rpx 16rpx;
|
|
||||||
border: 1rpx solid #dcdfe6;
|
|
||||||
border-radius: 10rpx;
|
|
||||||
background: #fafafa;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.print-picker-value {
|
.print-station-input-wrap ::v-deep .u-input {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 28rpx;
|
min-width: 0;
|
||||||
line-height: 40rpx;
|
width: auto;
|
||||||
color: #303133;
|
max-width: 100%;
|
||||||
padding-right: 16rpx;
|
box-sizing: border-box;
|
||||||
word-break: break-all;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.print-station-dropdown {
|
.print-station-input-wrap ::v-deep .u-input__content {
|
||||||
position: absolute;
|
min-width: 0;
|
||||||
right: 0;
|
box-sizing: border-box;
|
||||||
top: calc(100% - 4rpx);
|
|
||||||
width: calc(100% - 154rpx);
|
|
||||||
max-height: 300rpx;
|
|
||||||
overflow-y: auto;
|
|
||||||
background: #ffffff;
|
|
||||||
border: 1rpx solid #ebeef5;
|
|
||||||
border-radius: 10rpx;
|
|
||||||
z-index: 10091;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.print-station-option {
|
.print-action-wrap {
|
||||||
padding: 16rpx 20rpx;
|
flex: 1;
|
||||||
font-size: 28rpx;
|
min-width: 0;
|
||||||
line-height: 40rpx;
|
max-width: 100%;
|
||||||
color: #303133;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.print-station-option + .print-station-option {
|
.print-action-wrap ::v-deep .u-button {
|
||||||
border-top: 1rpx solid #f2f3f5;
|
width: 100%;
|
||||||
}
|
box-sizing: border-box;
|
||||||
|
|
||||||
.print-station-option--active {
|
|
||||||
color: #2979ff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.print-message {
|
.print-message {
|
||||||
|
|||||||
@ -1232,7 +1232,24 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
buildListWhereParams(stockIdList) {
|
buildListWhereParams(stockIdList) {
|
||||||
const normalizedStockIdList = this.extractStockIdList(stockIdList);
|
// 注意:入参在 handleSearch 中已由 extractStockIdList 归一为纯 id 数组(数字),
|
||||||
|
// 不能再套一次 extractStockIdList(它只接受对象数组,会把 id 数组全部过滤成空),
|
||||||
|
// 否则 where 恒为 {},导致 inventory.list 每次全量查询而非按商品过滤。
|
||||||
|
const sourceList = Array.isArray(stockIdList) ? stockIdList : [];
|
||||||
|
const normalizedStockIdList = [];
|
||||||
|
const seenIds = new Set();
|
||||||
|
sourceList.forEach(item => {
|
||||||
|
let candidate = item;
|
||||||
|
if (item && typeof item === 'object') {
|
||||||
|
candidate = item.stock_id ?? item.goods_id ?? item.item_id ?? item.product_id ?? item.id;
|
||||||
|
}
|
||||||
|
const normalized = this.normalizePositiveId(candidate);
|
||||||
|
if (normalized !== null && !seenIds.has(normalized)) {
|
||||||
|
seenIds.add(normalized);
|
||||||
|
normalizedStockIdList.push(normalized);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (!normalizedStockIdList.length) {
|
if (!normalizedStockIdList.length) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user