修改订单复核模块

This commit is contained in:
zm2000 2026-06-14 16:37:35 +08:00
parent 7105e4570a
commit f49411c428
2 changed files with 404 additions and 188 deletions

View File

@ -32,21 +32,8 @@
</view> </view>
<view class="print-config-row"> <view class="print-config-row">
<view class="print-config-col"> <view class="print-config-col">
<view class="print-station-select" @click="togglePrintStationDropdown(); showPrintModeDropdown = false"> <view class="unbound-print-btn" @click="handleOpenPrintSettings">
<text class="print-station-value" :class="{ 'print-station-value--bound': !!printStationId }">{{ printStationName || '请选择打印台' }}</text> <text class="unbound-print-btn__text" :class="{ 'unbound-print-btn__text--bound': !!printStationId }">{{ printStationId ? printStationName : '未绑定' }}</text>
<u-icon :name="showPrintStationDropdown ? 'arrow-up' : 'arrow-down'" size="24" color="#909399"></u-icon>
</view>
<view v-if="showPrintStationDropdown" class="print-station-dropdown-inline">
<view v-if="printStationList.length === 0" class="print-station-option print-station-option--empty">暂无可用打印台</view>
<view
v-for="station in printStationList"
:key="station.id"
class="print-station-option"
:class="{ 'print-station-option--active': station.id === printStationId }"
@click.stop="handlePrintStationSelect(station)"
>
{{ station.name }}
</view>
</view> </view>
</view> </view>
<view class="print-config-col"> <view class="print-config-col">
@ -133,7 +120,7 @@
<text class="bottom-stats-text">剩余未复核:<text class="bottom-stats-value bottom-stats-value--warn">{{ totalUnreviewedCount }}</text></text> <text class="bottom-stats-text">剩余未复核:<text class="bottom-stats-value bottom-stats-value--warn">{{ totalUnreviewedCount }}</text></text>
</view> </view>
<view class="bottom-stats-btn" @click="handleRefreshTask"> <view class="bottom-stats-btn" @click="handleRefreshTask">
<text class="bottom-stats-btn__text">刷新任务数据</text> <text class="bottom-stats-btn__text">刷新</text>
</view> </view>
</view> </view>
@ -144,37 +131,34 @@
<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" @focus="handlePrintStationInputFocus"
class="print-station-option" @blur="handlePrintStationInputBlur"
:class="{ 'print-station-option--active': station.id === printStationId }" @confirm="handlePrintStationInputConfirm"
@click.stop="handlePrintStationSelect(station)" ></u-input>
> <view v-if="showPrintStationDropdown && printStationFilteredList.length > 0" class="print-station-dropdown">
{{ station.name }} <view
v-for="station in printStationFilteredList"
:key="station.id"
class="print-station-option print-station-option--row"
:class="{ 'print-station-option--active': station.id === printStationId }"
@mousedown.stop="handlePrintStationSelect(station)"
>
<text class="station-option-name">{{ station.name }}</text>
<text v-if="station.customBarcode" class="station-option-code">{{ station.customBarcode }}</text>
</view>
</view>
<view v-if="showPrintStationDropdown && printStationInputKeyword && printStationFilteredList.length === 0" class="print-station-dropdown">
<view class="print-station-option print-station-option--empty">未匹配到打印台</view>
</view> </view>
</view> </view>
</view> </view>
<view class="print-row print-row--action">
<text class="print-label">打印</text>
<u-button
type="primary"
size="mini"
:customStyle="{ backgroundColor: '#2979ff', borderColor: '#2979ff', fontSize: '26rpx', height: '64rpx', lineHeight: '64rpx', padding: '0 20rpx' }"
@click="handleConfirmPrint"
>
打印
</u-button>
</view>
<view class="print-row print-row--message">
<text class="print-label">打印消息</text>
<text class="print-message">{{ printMessage || '暂无打印消息' }}</text>
</view>
</view> </view>
</u-popup> </u-popup>
@ -243,6 +227,7 @@
showStationListPopup: false, showStationListPopup: false,
showPrintPopup: false, showPrintPopup: false,
showPrintStationDropdown: false, showPrintStationDropdown: false,
printStationInputKeyword: '',
printStationName: '--', printStationName: '--',
printStationId: '', printStationId: '',
printMode: 'printFirst', printMode: 'printFirst',
@ -269,6 +254,20 @@
}; };
}, },
computed: { computed: {
printStationFilteredList() {
const list = Array.isArray(this.printStationList) ? this.printStationList : [];
const keyword = this.normalizeKeyword(this.printStationInputKeyword);
if (!keyword) {
return list;
}
return list.filter(station => {
const name = String(station.name || '').toLowerCase();
const id = String(station.id || '').toLowerCase();
const barcode = String(station.customBarcode || '').toLowerCase();
const kw = keyword.toLowerCase();
return name.includes(kw) || id.includes(kw) || barcode.includes(kw);
});
},
displayOrderList() { displayOrderList() {
const list = Array.isArray(this.orderList) ? this.orderList : []; const list = Array.isArray(this.orderList) ? this.orderList : [];
if (!this.showUnboundPrintStationOnly) { if (!this.showUnboundPrintStationOnly) {
@ -311,7 +310,7 @@
? Math.max(0, parsedGrabCount) ? Math.max(0, parsedGrabCount)
: 5; : 5;
this.initializeOrderList(); this.initializeOrderList();
this.loadPrintStations(); this.loadPrintStations(1, false);
// 监听拦截完成事件 // 监听拦截完成事件
uni.$on('orderInterceptCompleted', this.handleInterceptCompleted); uni.$on('orderInterceptCompleted', this.handleInterceptCompleted);
@ -596,9 +595,11 @@
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 || '').trim();
return { return {
id, id,
name name,
customBarcode
}; };
}) })
.filter(item => !!item.id && !!item.name); .filter(item => !!item.id && !!item.name);
@ -626,10 +627,83 @@
} }
this.showPrintStationDropdown = !this.showPrintStationDropdown; this.showPrintStationDropdown = !this.showPrintStationDropdown;
}, },
handleOpenPrintSettings() {
this.showPrintStationDropdown = false;
this.showPrintModeDropdown = false;
this.printStationInputKeyword = '';
this.showPrintPopup = true;
// 加载打印台列表
if (!this.printStationList.length) {
this.loadPrintStations(1, false);
}
},
handlePrintStationSelect(station) { handlePrintStationSelect(station) {
this.printStationId = String(station?.id || ''); this.printStationId = String(station?.id || '');
this.printStationName = String(station?.name || '--'); this.printStationName = String(station?.name || '--');
const name = String(station?.name || '');
const code = String(station?.customBarcode || '');
this.printStationInputKeyword = code ? `${name}(${code})` : name;
this.showPrintStationDropdown = false; this.showPrintStationDropdown = false;
if (name) {
uni.showToast({
title: `已匹配:${name}`,
icon: 'none'
});
setTimeout(() => {
this.showPrintPopup = false;
}, 600);
}
},
handlePrintStationInput(value) {
const keyword = this.normalizeKeyword(value);
this.showPrintStationDropdown = true;
if (!keyword) {
return;
}
// 精确匹配:输入内容与某个打印台名称或ID完全一致时自动选中
const exactMatch = this.printStationFilteredList.find(station => {
const kw = keyword.toLowerCase();
return String(station.name).toLowerCase() === kw
|| String(station.id).toLowerCase() === kw
|| String(station.customBarcode || '').toLowerCase() === kw;
});
if (exactMatch) {
this.printStationId = String(exactMatch.id);
this.printStationName = String(exactMatch.name);
const name = String(exactMatch.name || '');
const code = String(exactMatch.customBarcode || '');
this.printStationInputKeyword = code ? `${name}(${code})` : name;
this.showPrintStationDropdown = false;
uni.showToast({
title: `已匹配:${name}`,
icon: 'none'
});
setTimeout(() => {
this.showPrintPopup = false;
}, 600);
}
},
handlePrintStationInputFocus() {
if (this.printStationList.length > 0) {
this.showPrintStationDropdown = true;
}
},
handlePrintStationInputBlur() {
// 延迟关闭,让点击选项事件有机会执行
setTimeout(() => {
this.showPrintStationDropdown = false;
}, 200);
},
handlePrintStationInputConfirm() {
const keyword = this.normalizeKeyword(this.printStationInputKeyword);
if (!keyword) {
return;
}
// 按回车时,如果有精确匹配则选中,否则选中过滤列表第一个
if (this.printStationFilteredList.length > 0) {
const station = this.printStationFilteredList[0];
this.handlePrintStationSelect(station);
}
}, },
safeDispatchBroadcast(action, payload) { safeDispatchBroadcast(action, payload) {
try { try {
@ -680,9 +754,40 @@
if (!scanText) { if (!scanText) {
return; return;
} }
// 打印设置弹窗打开时,扫描结果填入打印台输入框
if (this.showPrintPopup) {
this.printStationInputKeyword = scanText;
this.handlePrintStationInput(scanText);
return;
}
// 已命中订单列表后,扫描直接作为商品条码进入详情页
if (Array.isArray(this.orderList) && this.orderList.length > 0 && this.listType) {
this.handleScanAsProductBarcode(scanText);
return;
}
this.keyword = scanText; this.keyword = scanText;
this.handleSearch(); this.handleSearch();
}, },
handleScanAsProductBarcode(barcode) {
// 从订单列表中取第一个未复核的订单进入详情
const target = this.orderList.find(item => {
if (this.listType === 'single') {
return !item.isReviewed;
}
return (item.unreviewedCount || 0) > 0;
}) || this.orderList[0];
if (!target) {
uni.showToast({ title: '无可用订单进入', icon: 'none' });
return;
}
// 将商品条码缓存,供详情页自动匹配
try {
uni.setStorageSync('scan_product_barcode', barcode);
} catch (e) {
console.warn('[OrderReview] 缓存商品条码失败:', e);
}
this.goPickGoodsDetail(target);
},
handleSearch() { handleSearch() {
this.keyword = this.normalizeKeyword(this.keyword); this.keyword = this.normalizeKeyword(this.keyword);
this.requestScanOrder(this.keyword); this.requestScanOrder(this.keyword);
@ -1569,7 +1674,7 @@
} }
.bottom-stats-text { .bottom-stats-text {
font-size: 26rpx; font-size: 34rpx;
color: #909399; color: #909399;
white-space: nowrap; white-space: nowrap;
} }
@ -1604,7 +1709,7 @@
} }
.bottom-stats-btn__text { .bottom-stats-btn__text {
font-size: 26rpx; font-size: 34rpx;
color: #ffffff; color: #ffffff;
line-height: 1.4; line-height: 1.4;
white-space: nowrap; white-space: nowrap;
@ -1619,7 +1724,7 @@
} }
.section-title { .section-title {
font-size: 30rpx; font-size: 38rpx;
line-height: 42rpx; line-height: 42rpx;
font-weight: 600; font-weight: 600;
color: #303133; color: #303133;
@ -1657,7 +1762,7 @@
.goods-info-cell { .goods-info-cell {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 28rpx; font-size: 36rpx;
line-height: 40rpx; line-height: 40rpx;
} }
@ -1686,7 +1791,7 @@
.goods-info-name { .goods-info-name {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
font-size: 30rpx; font-size: 38rpx;
line-height: 44rpx; line-height: 44rpx;
color: #303133; color: #303133;
word-break: break-all; word-break: break-all;
@ -1720,20 +1825,20 @@
min-width: 0; min-width: 0;
} }
.print-station-select,
.print-mode-select { .print-mode-select {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 12rpx 16rpx; padding: 12rpx 16rpx;
height: 72rpx;
box-sizing: border-box;
border: 1rpx solid #dcdfe6; border: 1rpx solid #dcdfe6;
border-radius: 10rpx; border-radius: 10rpx;
background: #fafafa; background: #fafafa;
} }
.print-station-value,
.print-mode-value { .print-mode-value {
flex: 1; flex: 1;
font-size: 26rpx; font-size: 34rpx;
color: #303133; color: #303133;
min-width: 0; min-width: 0;
overflow: hidden; overflow: hidden;
@ -1741,11 +1846,33 @@
white-space: nowrap; white-space: nowrap;
} }
.print-station-value--bound { .unbound-print-btn {
color: #07c160; display: flex;
align-items: center;
justify-content: center;
padding: 0 16rpx;
height: 72rpx;
box-sizing: border-box;
border: 1rpx solid #dcdfe6;
border-radius: 10rpx;
background: #fafafa;
}
.unbound-print-btn:active {
opacity: 0.7;
}
.unbound-print-btn__text {
font-size: 34rpx;
color: #909399;
white-space: nowrap;
}
.unbound-print-btn__text--bound {
color: #07c160;
font-weight: 500;
} }
.print-station-dropdown-inline,
.print-mode-dropdown-inline { .print-mode-dropdown-inline {
position: absolute; position: absolute;
left: 0; left: 0;
@ -1763,7 +1890,7 @@
.print-station-option, .print-station-option,
.print-mode-dropdown-option { .print-mode-dropdown-option {
padding: 16rpx 20rpx; padding: 16rpx 20rpx;
font-size: 26rpx; font-size: 34rpx;
color: #303133; color: #303133;
border-bottom: 1rpx solid #f2f3f5; border-bottom: 1rpx solid #f2f3f5;
} }
@ -1852,7 +1979,7 @@
} }
.search-btn__text { .search-btn__text {
font-size: 30rpx; font-size: 38rpx;
color: #2979ff; color: #2979ff;
font-weight: 500; font-weight: 500;
line-height: 1; line-height: 1;
@ -1919,7 +2046,7 @@
.record-value--wave-index { .record-value--wave-index {
flex-shrink: 0; flex-shrink: 0;
font-size: 24rpx; font-size: 32rpx;
color: #2979ff; color: #2979ff;
background: #f0f7ff; background: #f0f7ff;
border: 1rpx solid #b3d8ff; border: 1rpx solid #b3d8ff;
@ -1993,7 +2120,7 @@
padding: 4rpx 16rpx; padding: 4rpx 16rpx;
border: 2rpx solid #07c160; border: 2rpx solid #07c160;
border-radius: 8rpx; border-radius: 8rpx;
font-size: 26rpx; font-size: 34rpx;
line-height: 1.4; line-height: 1.4;
background: #f0fff5; background: #f0fff5;
} }
@ -2007,7 +2134,7 @@
padding: 4rpx 16rpx; padding: 4rpx 16rpx;
border: 2rpx solid #dcdfe6; border: 2rpx solid #dcdfe6;
border-radius: 8rpx; border-radius: 8rpx;
font-size: 26rpx; font-size: 34rpx;
line-height: 1.4; line-height: 1.4;
background: #f5f5f5; background: #f5f5f5;
} }
@ -2016,7 +2143,7 @@
display: inline-block; display: inline-block;
margin-left: 8rpx; margin-left: 8rpx;
padding: 0 8rpx; padding: 0 8rpx;
font-size: 22rpx; font-size: 30rpx;
color: #ffffff; color: #ffffff;
border-radius: 6rpx; border-radius: 6rpx;
line-height: 1.6; line-height: 1.6;
@ -2032,14 +2159,14 @@
} }
.record-count { .record-count {
font-size: 30rpx; font-size: 34rpx;
line-height: 40rpx; line-height: 40rpx;
color: #fa8c16; color: #fa8c16;
} }
.record-status { .record-status {
margin-top: 12rpx; margin-top: 12rpx;
font-size: 30rpx; font-size: 34rpx;
line-height: 40rpx; line-height: 40rpx;
color: #2979ff; color: #2979ff;
} }
@ -2060,7 +2187,7 @@
.empty-text { .empty-text {
margin-top: 18rpx; margin-top: 18rpx;
font-size: 28rpx; font-size: 36rpx;
color: #909399; color: #909399;
} }
@ -2069,23 +2196,24 @@
} }
.print-popup { .print-popup {
padding: 24rpx 24rpx calc(20rpx + env(safe-area-inset-bottom)); padding: 48rpx 32rpx calc(40rpx + env(safe-area-inset-bottom));
background: #ffffff; background: #ffffff;
border-top-left-radius: 20rpx; border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx; border-top-right-radius: 20rpx;
min-height: 500rpx;
} }
.print-popup-title { .print-popup-title {
font-size: 34rpx; font-size: 42rpx;
font-weight: 600; font-weight: 600;
color: #303133; color: #303133;
margin-bottom: 20rpx; margin-bottom: 36rpx;
} }
.print-row { .print-row {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
padding: 16rpx 0; padding: 28rpx 0;
border-bottom: 1rpx solid #f2f3f5; border-bottom: 1rpx solid #f2f3f5;
} }
@ -2097,61 +2225,39 @@
padding-top: 10rpx; padding-top: 10rpx;
} }
.print-row--action {
align-items: center;
}
.print-row--message {
border-bottom: none;
}
.print-label { .print-label {
min-width: 130rpx; min-width: 130rpx;
width: 130rpx; width: 130rpx;
font-size: 28rpx; font-size: 36rpx;
line-height: 40rpx; line-height: 40rpx;
color: #909399; color: #909399;
} }
.print-value { .print-value {
flex: 1; flex: 1;
font-size: 28rpx; font-size: 36rpx;
line-height: 40rpx; line-height: 40rpx;
color: #303133; color: #303133;
} }
.print-picker { .print-station-input-wrap {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
display: flex; position: relative;
align-items: center;
justify-content: space-between;
padding: 10rpx 16rpx;
border: 1rpx solid #dcdfe6;
border-radius: 10rpx;
background: #fafafa;
}
.print-picker-value {
flex: 1;
font-size: 28rpx;
line-height: 40rpx;
color: #303133;
padding-right: 16rpx;
word-break: break-all;
} }
.print-station-dropdown { .print-station-dropdown {
position: absolute; position: absolute;
left: 0;
right: 0; right: 0;
top: calc(100% - 4rpx); top: 100%;
width: calc(100% - 154rpx); max-height: 600rpx;
max-height: 300rpx;
overflow-y: auto; overflow-y: auto;
background: #ffffff; background: #ffffff;
border: 1rpx solid #ebeef5; border: 1rpx solid #ebeef5;
border-radius: 10rpx; border-radius: 10rpx;
z-index: 10091; z-index: 10091;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
} }
.print-station-option { .print-station-option {
@ -2169,13 +2275,22 @@
color: #2979ff; color: #2979ff;
} }
.print-message { .print-station-option--row {
flex: 1; display: flex;
font-size: 28rpx; align-items: center;
line-height: 40rpx; }
.station-option-name {
font-size: 36rpx;
color: #303133; color: #303133;
} }
.station-option-code {
font-size: 32rpx;
color: #909399;
margin-left: 12rpx;
}
.station-list-scroll { .station-list-scroll {
max-height: 600rpx; max-height: 600rpx;
padding: 0 10rpx; padding: 0 10rpx;
@ -2189,7 +2304,7 @@
.station-list-empty { .station-list-empty {
text-align: center; text-align: center;
padding: 60rpx 0; padding: 60rpx 0;
font-size: 28rpx; font-size: 36rpx;
color: #909399; color: #909399;
} }
@ -2219,7 +2334,7 @@
} }
.station-list-item__name { .station-list-item__name {
font-size: 30rpx; font-size: 38rpx;
color: #303133; color: #303133;
font-weight: 500; font-weight: 500;
} }

View File

@ -136,7 +136,7 @@
</view> </view>
</view> </view>
<u-popup :show="showWeighPopup" mode="center" :closeable="true" border-radius="20" :z-index="10090" @close="showWeighPopup = false"> <u-popup :show="showWeighPopup" mode="center" :closeable="true" border-radius="20" :z-index="10090" :customStyle="{ transform: 'translateY(-80rpx)' }" @close="handleWeighClose">
<view class="weigh-popup"> <view class="weigh-popup">
<view class="weigh-popup-title">称重</view> <view class="weigh-popup-title">称重</view>
<view class="weigh-popup-body"> <view class="weigh-popup-body">
@ -146,19 +146,21 @@
<view class="weigh-btn weigh-btn--minus" @click="weighDecrement">-</view> <view class="weigh-btn weigh-btn--minus" @click="weighDecrement">-</view>
<input <input
class="weigh-input" class="weigh-input"
type="digit" type="number"
:value="weighWeight > 0 ? String(weighWeight) : ''" :value="weighWeight > 0 ? String(weighWeight) : ''"
placeholder="请输入重量" :focus="weighInputFocused"
placeholder-style="color:#c0c4cc;font-size:28rpx" placeholder="请输入重量(g)"
placeholder-style="color:#c0c4cc;font-size:36rpx"
@input="handleWeighInput" @input="handleWeighInput"
@blur="weighInputFocused = false"
/> />
<view class="weigh-btn weigh-btn--plus" @click="weighIncrement">+</view> <view class="weigh-btn weigh-btn--plus" @click="weighIncrement">+</view>
<text class="weigh-unit">kg</text> <text class="weigh-unit">g</text>
</view> </view>
</view> </view>
</view> </view>
<view class="weigh-popup-footer"> <view class="weigh-popup-footer">
<view class="weigh-footer-btn weigh-footer-btn--cancel" @click="showWeighPopup = false">取消</view> <view class="weigh-footer-btn weigh-footer-btn--cancel" @click="handleWeighCancel">取消</view>
<view class="weigh-footer-btn weigh-footer-btn--save" @click="handleWeighSave">保存</view> <view class="weigh-footer-btn weigh-footer-btn--save" @click="handleWeighSave">保存</view>
</view> </view>
</view> </view>
@ -178,6 +180,8 @@
showPickListSection: true, showPickListSection: true,
showWeighPopup: false, showWeighPopup: false,
weighWeight: 0, weighWeight: 0,
weighInputFocused: false,
_weighAfterReview: false,
detailInfo: { detailInfo: {
recordId: '', recordId: '',
orderId: 0, orderId: 0,
@ -340,6 +344,8 @@
} }
this.currentGoodsIndex = 0; this.currentGoodsIndex = 0;
this.matchedGoodsState = {}; this.matchedGoodsState = {};
// 从订单复核页带入的商品条码,自动触发匹配
this.tryAutoMatchBarcode();
this.safeDispatchBroadcast('setCallbacks', { this.safeDispatchBroadcast('setCallbacks', {
onResult: this.handleBroadcastResult onResult: this.handleBroadcastResult
}); });
@ -754,11 +760,11 @@
} catch (e) { } catch (e) {
console.warn('[confirmRecheck] 缓存复核完成数据失败:', e); console.warn('[confirmRecheck] 缓存复核完成数据失败:', e);
} }
// 复核成功后弹出称重弹窗
this._weighAfterReview = true;
setTimeout(() => { setTimeout(() => {
uni.navigateBack({ this.handleWeigh();
delta: 1 }, 800);
});
}, 1500);
} catch (error) { } catch (error) {
uni.showToast({ uni.showToast({
title: this.getApiErrorMessage(error, '确认复核失败'), title: this.getApiErrorMessage(error, '确认复核失败'),
@ -852,38 +858,122 @@
uni.showToast({ title: message, icon: 'none' }); uni.showToast({ title: message, icon: 'none' });
} }
}, },
handleWeighClose() {
this.showWeighPopup = false;
if (this._weighAfterReview) {
this._weighAfterReview = false;
setTimeout(() => {
uni.navigateBack({ delta: 1 });
}, 300);
}
},
handleWeighCancel() {
this.handleWeighClose();
},
tryAutoMatchBarcode() {
let barcode = '';
try {
barcode = String(uni.getStorageSync('scan_product_barcode') || '').trim();
if (barcode) {
uni.removeStorageSync('scan_product_barcode');
}
} catch (e) {
return;
}
if (!barcode || !Array.isArray(this.goodsList) || this.goodsList.length === 0) {
return;
}
// 延迟执行,等待页面渲染完成
this.$nextTick(() => {
const matchIndex = this.goodsList.findIndex(item => {
const candidates = this.extractBarcodeCandidates(item);
return candidates.includes(barcode);
});
if (matchIndex >= 0) {
// 模拟一次广播扫描结果匹配
this.currentGoodsIndex = matchIndex;
this.matchedGoodsId = String(this.goodsList[matchIndex]?.id || '');
if (this.matchedGoodsId) {
if (typeof this.$set === 'function') {
this.$set(this.matchedGoodsState, this.matchedGoodsId, true);
} else {
this.matchedGoodsState[this.matchedGoodsId] = true;
}
}
const matchedItem = this.goodsList[matchIndex];
const itemName = matchedItem?.skuName || '商品';
const maxQty = matchedItem?.planQty || 0;
const currentScanned = matchedItem?.scannedQty || 0;
if (maxQty < 3) {
const newScanned = Math.min(currentScanned + 1, maxQty);
if (typeof this.$set === 'function') {
this.$set(this.goodsList, matchIndex, { ...matchedItem, scannedQty: newScanned });
} else {
this.goodsList[matchIndex].scannedQty = newScanned;
}
uni.showToast({ title: `已扫:${newScanned}/${maxQty}`, icon: 'none' });
} else {
uni.showModal({
title: `扫描成功:${itemName}`,
content: `请输入数量(共 ${maxQty},已扫 ${currentScanned}):`,
editable: true,
placeholderText: '请输入数量',
success: (res) => {
if (!res.confirm) return;
const inputQty = this.toPositiveNumber(res.content, 0);
if (inputQty <= 0) {
uni.showToast({ title: '请输入有效数量', icon: 'none' });
return;
}
const newScanned = Math.min(currentScanned + inputQty, maxQty);
if (typeof this.$set === 'function') {
this.$set(this.goodsList, matchIndex, { ...matchedItem, scannedQty: newScanned });
} else {
this.goodsList[matchIndex].scannedQty = newScanned;
}
uni.showToast({ title: `已扫:${newScanned}/${maxQty}`, icon: 'success' });
}
});
}
} else {
uni.showToast({ title: '条码不匹配', icon: 'none' });
}
});
},
handleWeigh() { handleWeigh() {
this.weighWeight = 0; this.weighWeight = 0;
this.weighInputFocused = false;
this.showWeighPopup = true; this.showWeighPopup = true;
this.$nextTick(() => {
this.weighInputFocused = true;
});
}, },
weighIncrement() { weighIncrement() {
this.weighWeight = Math.round((this.weighWeight + 0.1) * 10) / 10; this.weighWeight = this.weighWeight + 1;
}, },
weighDecrement() { weighDecrement() {
const val = Math.round((this.weighWeight - 0.1) * 10) / 10; const val = this.weighWeight - 1;
this.weighWeight = val < 0 ? 0 : val; this.weighWeight = val < 0 ? 0 : val;
}, },
handleWeighInput(e) { handleWeighInput(e) {
const raw = String(e?.detail?.value || '').trim(); const raw = String(e?.detail?.value || '').trim();
if (raw === '') { // 只保留数字,过滤掉小数点等任何非数字字符
const digits = raw.replace(/\D/g, '');
if (digits === '') {
this.weighWeight = 0; this.weighWeight = 0;
return; return;
} }
const num = parseFloat(raw); this.weighWeight = parseInt(digits, 10);
if (Number.isFinite(num) && num >= 0) {
this.weighWeight = Math.round(num * 1000) / 1000;
} else {
this.weighWeight = 0;
}
}, },
async handleWeighSave() { async handleWeighSave() {
if (this.weighWeight <= 0) { if (this.weighWeight < 100) {
uni.showToast({ title: '请输入重量', icon: 'none' }); uni.showToast({ title: '重量至少输入三位数', icon: 'none' });
return; return;
} }
const listType = String(this.detailInfo?.listType || '').trim(); const listType = String(this.detailInfo?.listType || '').trim();
const weighingWeight = this.weighWeight; const weighingWeight = this.weighWeight;
const weighingWeightKg = weighingWeight / 1000;
uni.showLoading({ title: '提交称重中...' }); uni.showLoading({ title: '提交称重中...' });
try { try {
@ -897,7 +987,7 @@
} }
await this.$http('order.recheckOrder.updateExpressWeighingWeight', { await this.$http('order.recheckOrder.updateExpressWeighingWeight', {
order_id: waveId, order_id: waveId,
weighing_weight: weighingWeight weighing_weight: weighingWeightKg
}); });
} else { } else {
// 散单/详情模式:传 order_id // 散单/详情模式:传 order_id
@ -909,12 +999,18 @@
} }
await this.$http('order.recheckOrder.updateExpressWeighingWeight', { await this.$http('order.recheckOrder.updateExpressWeighingWeight', {
order_id: orderId, order_id: orderId,
weighing_weight: weighingWeight weighing_weight: weighingWeightKg
}); });
} }
uni.hideLoading(); uni.hideLoading();
uni.showToast({ title: '称重完成', icon: 'success' }); uni.showToast({ title: '称重完成', icon: 'success' });
this.showWeighPopup = false; this.showWeighPopup = false;
if (this._weighAfterReview) {
this._weighAfterReview = false;
setTimeout(() => {
uni.navigateBack({ delta: 1 });
}, 1000);
}
} catch (error) { } catch (error) {
uni.hideLoading(); uni.hideLoading();
const message = String(error?.message || error?.msg || error?.errMsg || '称重提交失败'); const message = String(error?.message || error?.msg || error?.errMsg || '称重提交失败');
@ -1002,11 +1098,11 @@
} }
.nav-right-complete { .nav-right-complete {
font-size: 32rpx; font-size: 36rpx;
line-height: 36rpx; line-height: 44rpx;
color: #ffffff; color: #ffffff;
padding: 8rpx 18rpx; padding: 14rpx 24rpx;
border-radius: 6rpx; border-radius: 8rpx;
background: #07c160; background: #07c160;
} }
@ -1044,13 +1140,13 @@
} }
.page-head-label { .page-head-label {
font-size: 28rpx; font-size: 32rpx;
color: #909399; color: #909399;
flex-shrink: 0; flex-shrink: 0;
} }
.page-head-wave { .page-head-wave {
font-size: 28rpx; font-size: 32rpx;
color: #303133; color: #303133;
font-weight: 500; font-weight: 500;
flex: 1; flex: 1;
@ -1061,7 +1157,7 @@
} }
.page-head-value { .page-head-value {
font-size: 32rpx; font-size: 36rpx;
font-weight: 600; font-weight: 600;
color: #303133; color: #303133;
flex: 1; flex: 1;
@ -1072,7 +1168,7 @@
} }
.page-head-picker { .page-head-picker {
font-size: 26rpx; font-size: 30rpx;
color: #909399; color: #909399;
} }
@ -1087,7 +1183,7 @@
} }
.page-head-btn { .page-head-btn {
font-size: 30rpx; font-size: 34rpx;
color: #ffffff; color: #ffffff;
padding: 12rpx 24rpx; padding: 12rpx 24rpx;
border: none; border: none;
@ -1113,8 +1209,8 @@
.page-head-value { .page-head-value {
margin-left: 8rpx; margin-left: 8rpx;
font-size: 36rpx; font-size: 40rpx;
line-height: 46rpx; line-height: 50rpx;
font-weight: 600; font-weight: 600;
color: #303133; color: #303133;
flex: 1; flex: 1;
@ -1129,11 +1225,12 @@
flex-wrap: nowrap; flex-wrap: nowrap;
width: 100%; width: 100%;
margin-top: 14rpx; margin-top: 14rpx;
font-size: 32rpx; font-size: 36rpx;
line-height: 54rpx; line-height: 58rpx;
} }
.barcode-value { .barcode-value {
font-size: 40rpx;
color: #2979ff; color: #2979ff;
text-decoration: underline; text-decoration: underline;
text-decoration-color: rgba(41, 121, 255, 0.45); text-decoration-color: rgba(41, 121, 255, 0.45);
@ -1144,31 +1241,35 @@
} }
.goods-row--barcode-highlight { .goods-row--barcode-highlight {
background: #f0fff4; background: #14e578;
border: 1rpx solid #b7eb8f; border: 1rpx solid #0fcb68;
border-radius: 8rpx; border-radius: 8rpx;
padding: 0 10rpx; padding: 0 10rpx;
} }
.goods-row--barcode-highlight .label, .goods-row--barcode-highlight .label,
.goods-row--barcode-highlight .value { .goods-row--barcode-highlight .value {
color: #52c41a; color: #303133;
}
.goods-row--barcode-highlight .barcode-value {
color: #303133;
} }
.goods-row--scanned-complete { .goods-row--scanned-complete {
background: #f0fff4; background: #14e578;
border: 1rpx solid #b7eb8f; border: 1rpx solid #0fcb68;
border-radius: 8rpx; border-radius: 8rpx;
padding: 0 10rpx; padding: 0 10rpx;
} }
.goods-row--scanned-complete .qty-item .label, .goods-row--scanned-complete .qty-item .label,
.goods-row--scanned-complete .qty-item .value { .goods-row--scanned-complete .qty-item .value {
color: #52c41a; color: #303133;
} }
.goods-row--scanned-complete .qty-divider { .goods-row--scanned-complete .qty-divider {
background: #b7eb8f; background: #0fcb68;
} }
.goods-row:first-child { .goods-row:first-child {
@ -1359,7 +1460,7 @@
} }
.more-text { .more-text {
font-size: 34rpx; font-size: 38rpx;
line-height: 1; line-height: 1;
color: #ffffff; color: #ffffff;
font-weight: 600; font-weight: 600;
@ -1368,8 +1469,8 @@
.goods-name { .goods-name {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
font-size: 38rpx; font-size: 42rpx;
line-height: 52rpx; line-height: 56rpx;
font-weight: 700; font-weight: 700;
color: #303133; color: #303133;
} }
@ -1390,7 +1491,7 @@
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 30rpx; font-size: 34rpx;
line-height: 1.2; line-height: 1.2;
font-weight: 500; font-weight: 500;
color: #ffffff; color: #ffffff;
@ -1470,8 +1571,8 @@
position: absolute; position: absolute;
left: 8rpx; left: 8rpx;
top: 6rpx; top: 6rpx;
font-size: 30rpx; font-size: 34rpx;
line-height: 38rpx; line-height: 42rpx;
font-weight: 600; font-weight: 600;
color: #606266; color: #606266;
} }
@ -1480,8 +1581,8 @@
position: absolute; position: absolute;
right: 8rpx; right: 8rpx;
bottom: 4rpx; bottom: 4rpx;
font-size: 38rpx; font-size: 42rpx;
line-height: 46rpx; line-height: 50rpx;
font-weight: 700; font-weight: 700;
color: #2979ff; color: #2979ff;
} }
@ -1490,8 +1591,8 @@
position: absolute; position: absolute;
left: 8rpx; left: 8rpx;
bottom: 4rpx; bottom: 4rpx;
font-size: 28rpx; font-size: 32rpx;
line-height: 36rpx; line-height: 40rpx;
color: #19be6b; color: #19be6b;
} }
@ -1503,8 +1604,8 @@
} }
.switch-index { .switch-index {
font-size: 28rpx; font-size: 32rpx;
line-height: 38rpx; line-height: 42rpx;
color: #606266; color: #606266;
} }
@ -1516,8 +1617,8 @@
} }
.bottom-module-title { .bottom-module-title {
font-size: 32rpx; font-size: 36rpx;
line-height: 46rpx; line-height: 50rpx;
font-weight: 600; font-weight: 600;
color: #303133; color: #303133;
margin-bottom: 8rpx; margin-bottom: 8rpx;
@ -1535,28 +1636,28 @@
} }
.bottom-summary-text { .bottom-summary-text {
font-size: 28rpx; font-size: 32rpx;
color: #909399; color: #909399;
} }
.bottom-summary-scan { .bottom-summary-scan {
font-size: 28rpx; font-size: 32rpx;
color: #909399; color: #909399;
} }
.bottom-summary-split { .bottom-summary-split {
font-size: 28rpx; font-size: 32rpx;
color: #909399; color: #909399;
margin: 0 2rpx; margin: 0 2rpx;
} }
.bottom-summary-total { .bottom-summary-total {
font-size: 28rpx; font-size: 32rpx;
color: #909399; color: #909399;
} }
.bottom-summary-value { .bottom-summary-value {
font-size: 32rpx; font-size: 36rpx;
font-weight: 600; font-weight: 600;
color: #2979ff; color: #2979ff;
} }
@ -1576,7 +1677,7 @@
.empty-text { .empty-text {
margin-top: 18rpx; margin-top: 18rpx;
font-size: 32rpx; font-size: 36rpx;
color: #909399; color: #909399;
} }
@ -1585,14 +1686,14 @@
} }
.weigh-popup { .weigh-popup {
width: 560rpx; width: 640rpx;
padding: 24rpx 36rpx 36rpx; padding: 32rpx 40rpx 40rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.weigh-popup-title { .weigh-popup-title {
font-size: 34rpx; font-size: 44rpx;
font-weight: 400; font-weight: 500;
color: #303133; color: #303133;
text-align: left; text-align: left;
line-height: 1; line-height: 1;
@ -1601,7 +1702,7 @@
} }
.weigh-popup-body { .weigh-popup-body {
margin: 20rpx 0 48rpx; margin: 30rpx 0 56rpx;
} }
.weigh-row { .weigh-row {
@ -1609,11 +1710,11 @@
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 24rpx; gap: 28rpx;
} }
.weigh-label { .weigh-label {
font-size: 30rpx; font-size: 40rpx;
color: #606266; color: #606266;
} }
@ -1628,12 +1729,12 @@
} }
.weigh-btn { .weigh-btn {
width: 60rpx; width: 72rpx;
height: 76rpx; height: 88rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 36rpx; font-size: 44rpx;
font-weight: 400; font-weight: 400;
color: #606266; color: #606266;
background: #f5f7fa; background: #f5f7fa;
@ -1657,10 +1758,10 @@
} }
.weigh-input { .weigh-input {
width: 200rpx; width: 240rpx;
height: 76rpx; height: 88rpx;
font-size: 36rpx; font-size: 44rpx;
font-weight: 500; font-weight: 600;
color: #303133; color: #303133;
text-align: center; text-align: center;
background: #ffffff; background: #ffffff;
@ -1673,24 +1774,24 @@
} }
.weigh-unit { .weigh-unit {
font-size: 30rpx; font-size: 36rpx;
color: #909399; color: #909399;
margin-left: 16rpx; margin-left: 16rpx;
} }
.weigh-popup-footer { .weigh-popup-footer {
display: flex; display: flex;
gap: 24rpx; gap: 28rpx;
} }
.weigh-footer-btn { .weigh-footer-btn {
flex: 1; flex: 1;
height: 72rpx; height: 90rpx;
border-radius: 10rpx; border-radius: 12rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 28rpx; font-size: 36rpx;
font-weight: 500; font-weight: 500;
} }