修改订单复核模块
This commit is contained in:
parent
7105e4570a
commit
f49411c428
@ -32,21 +32,8 @@
|
||||
</view>
|
||||
<view class="print-config-row">
|
||||
<view class="print-config-col">
|
||||
<view class="print-station-select" @click="togglePrintStationDropdown(); showPrintModeDropdown = false">
|
||||
<text class="print-station-value" :class="{ 'print-station-value--bound': !!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 class="unbound-print-btn" @click="handleOpenPrintSettings">
|
||||
<text class="unbound-print-btn__text" :class="{ 'unbound-print-btn__text--bound': !!printStationId }">{{ printStationId ? printStationName : '未绑定' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<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>
|
||||
</view>
|
||||
<view class="bottom-stats-btn" @click="handleRefreshTask">
|
||||
<text class="bottom-stats-btn__text">刷新任务数据</text>
|
||||
<text class="bottom-stats-btn__text">刷新</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -144,37 +131,34 @@
|
||||
<view class="print-popup-title">打印设置</view>
|
||||
<view class="print-row print-row--station">
|
||||
<text class="print-label">打印台</text>
|
||||
<view class="print-picker" @click="togglePrintStationDropdown">
|
||||
<text class="print-picker-value">{{ 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">
|
||||
<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 class="print-station-input-wrap">
|
||||
<u-input
|
||||
v-model="printStationInputKeyword"
|
||||
placeholder="请输入或扫描打印台编号"
|
||||
:clearable="true"
|
||||
:customStyle="{ fontSize: '28rpx', height: '80rpx', lineHeight: '80rpx', padding: '0 20rpx', background: '#fafafa', borderRadius: '10rpx' }"
|
||||
@input="handlePrintStationInput"
|
||||
@focus="handlePrintStationInputFocus"
|
||||
@blur="handlePrintStationInputBlur"
|
||||
@confirm="handlePrintStationInputConfirm"
|
||||
></u-input>
|
||||
<view v-if="showPrintStationDropdown && printStationFilteredList.length > 0" class="print-station-dropdown">
|
||||
<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 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>
|
||||
</u-popup>
|
||||
|
||||
@ -243,6 +227,7 @@
|
||||
showStationListPopup: false,
|
||||
showPrintPopup: false,
|
||||
showPrintStationDropdown: false,
|
||||
printStationInputKeyword: '',
|
||||
printStationName: '--',
|
||||
printStationId: '',
|
||||
printMode: 'printFirst',
|
||||
@ -269,6 +254,20 @@
|
||||
};
|
||||
},
|
||||
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() {
|
||||
const list = Array.isArray(this.orderList) ? this.orderList : [];
|
||||
if (!this.showUnboundPrintStationOnly) {
|
||||
@ -311,7 +310,7 @@
|
||||
? Math.max(0, parsedGrabCount)
|
||||
: 5;
|
||||
this.initializeOrderList();
|
||||
this.loadPrintStations();
|
||||
this.loadPrintStations(1, false);
|
||||
|
||||
// 监听拦截完成事件
|
||||
uni.$on('orderInterceptCompleted', this.handleInterceptCompleted);
|
||||
@ -596,9 +595,11 @@
|
||||
const source = item && typeof item === 'object' ? item : {};
|
||||
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 customBarcode = String(source.custom_barcode || '').trim();
|
||||
return {
|
||||
id,
|
||||
name
|
||||
name,
|
||||
customBarcode
|
||||
};
|
||||
})
|
||||
.filter(item => !!item.id && !!item.name);
|
||||
@ -626,10 +627,83 @@
|
||||
}
|
||||
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) {
|
||||
this.printStationId = String(station?.id || '');
|
||||
this.printStationName = String(station?.name || '--');
|
||||
const name = String(station?.name || '');
|
||||
const code = String(station?.customBarcode || '');
|
||||
this.printStationInputKeyword = code ? `${name}(${code})` : name;
|
||||
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) {
|
||||
try {
|
||||
@ -680,9 +754,40 @@
|
||||
if (!scanText) {
|
||||
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.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() {
|
||||
this.keyword = this.normalizeKeyword(this.keyword);
|
||||
this.requestScanOrder(this.keyword);
|
||||
@ -1569,7 +1674,7 @@
|
||||
}
|
||||
|
||||
.bottom-stats-text {
|
||||
font-size: 26rpx;
|
||||
font-size: 34rpx;
|
||||
color: #909399;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@ -1604,7 +1709,7 @@
|
||||
}
|
||||
|
||||
.bottom-stats-btn__text {
|
||||
font-size: 26rpx;
|
||||
font-size: 34rpx;
|
||||
color: #ffffff;
|
||||
line-height: 1.4;
|
||||
white-space: nowrap;
|
||||
@ -1619,7 +1724,7 @@
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 30rpx;
|
||||
font-size: 38rpx;
|
||||
line-height: 42rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
@ -1657,7 +1762,7 @@
|
||||
.goods-info-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
font-size: 36rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
@ -1686,7 +1791,7 @@
|
||||
.goods-info-name {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 30rpx;
|
||||
font-size: 38rpx;
|
||||
line-height: 44rpx;
|
||||
color: #303133;
|
||||
word-break: break-all;
|
||||
@ -1720,20 +1825,20 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.print-station-select,
|
||||
.print-mode-select {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12rpx 16rpx;
|
||||
height: 72rpx;
|
||||
box-sizing: border-box;
|
||||
border: 1rpx solid #dcdfe6;
|
||||
border-radius: 10rpx;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.print-station-value,
|
||||
.print-mode-value {
|
||||
flex: 1;
|
||||
font-size: 26rpx;
|
||||
font-size: 34rpx;
|
||||
color: #303133;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
@ -1741,11 +1846,33 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.print-station-value--bound {
|
||||
color: #07c160;
|
||||
.unbound-print-btn {
|
||||
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 {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
@ -1763,7 +1890,7 @@
|
||||
.print-station-option,
|
||||
.print-mode-dropdown-option {
|
||||
padding: 16rpx 20rpx;
|
||||
font-size: 26rpx;
|
||||
font-size: 34rpx;
|
||||
color: #303133;
|
||||
border-bottom: 1rpx solid #f2f3f5;
|
||||
}
|
||||
@ -1852,7 +1979,7 @@
|
||||
}
|
||||
|
||||
.search-btn__text {
|
||||
font-size: 30rpx;
|
||||
font-size: 38rpx;
|
||||
color: #2979ff;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
@ -1919,7 +2046,7 @@
|
||||
|
||||
.record-value--wave-index {
|
||||
flex-shrink: 0;
|
||||
font-size: 24rpx;
|
||||
font-size: 32rpx;
|
||||
color: #2979ff;
|
||||
background: #f0f7ff;
|
||||
border: 1rpx solid #b3d8ff;
|
||||
@ -1993,7 +2120,7 @@
|
||||
padding: 4rpx 16rpx;
|
||||
border: 2rpx solid #07c160;
|
||||
border-radius: 8rpx;
|
||||
font-size: 26rpx;
|
||||
font-size: 34rpx;
|
||||
line-height: 1.4;
|
||||
background: #f0fff5;
|
||||
}
|
||||
@ -2007,7 +2134,7 @@
|
||||
padding: 4rpx 16rpx;
|
||||
border: 2rpx solid #dcdfe6;
|
||||
border-radius: 8rpx;
|
||||
font-size: 26rpx;
|
||||
font-size: 34rpx;
|
||||
line-height: 1.4;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
@ -2016,7 +2143,7 @@
|
||||
display: inline-block;
|
||||
margin-left: 8rpx;
|
||||
padding: 0 8rpx;
|
||||
font-size: 22rpx;
|
||||
font-size: 30rpx;
|
||||
color: #ffffff;
|
||||
border-radius: 6rpx;
|
||||
line-height: 1.6;
|
||||
@ -2032,14 +2159,14 @@
|
||||
}
|
||||
|
||||
.record-count {
|
||||
font-size: 30rpx;
|
||||
font-size: 34rpx;
|
||||
line-height: 40rpx;
|
||||
color: #fa8c16;
|
||||
}
|
||||
|
||||
.record-status {
|
||||
margin-top: 12rpx;
|
||||
font-size: 30rpx;
|
||||
font-size: 34rpx;
|
||||
line-height: 40rpx;
|
||||
color: #2979ff;
|
||||
}
|
||||
@ -2060,7 +2187,7 @@
|
||||
|
||||
.empty-text {
|
||||
margin-top: 18rpx;
|
||||
font-size: 28rpx;
|
||||
font-size: 36rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
@ -2069,23 +2196,24 @@
|
||||
}
|
||||
|
||||
.print-popup {
|
||||
padding: 24rpx 24rpx calc(20rpx + env(safe-area-inset-bottom));
|
||||
padding: 48rpx 32rpx calc(40rpx + env(safe-area-inset-bottom));
|
||||
background: #ffffff;
|
||||
border-top-left-radius: 20rpx;
|
||||
border-top-right-radius: 20rpx;
|
||||
min-height: 500rpx;
|
||||
}
|
||||
|
||||
.print-popup-title {
|
||||
font-size: 34rpx;
|
||||
font-size: 42rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 20rpx;
|
||||
margin-bottom: 36rpx;
|
||||
}
|
||||
|
||||
.print-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding: 16rpx 0;
|
||||
padding: 28rpx 0;
|
||||
border-bottom: 1rpx solid #f2f3f5;
|
||||
}
|
||||
|
||||
@ -2097,61 +2225,39 @@
|
||||
padding-top: 10rpx;
|
||||
}
|
||||
|
||||
.print-row--action {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.print-row--message {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.print-label {
|
||||
min-width: 130rpx;
|
||||
width: 130rpx;
|
||||
font-size: 28rpx;
|
||||
font-size: 36rpx;
|
||||
line-height: 40rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.print-value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
font-size: 36rpx;
|
||||
line-height: 40rpx;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.print-picker {
|
||||
.print-station-input-wrap {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
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;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.print-station-dropdown {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: calc(100% - 4rpx);
|
||||
width: calc(100% - 154rpx);
|
||||
max-height: 300rpx;
|
||||
top: 100%;
|
||||
max-height: 600rpx;
|
||||
overflow-y: auto;
|
||||
background: #ffffff;
|
||||
border: 1rpx solid #ebeef5;
|
||||
border-radius: 10rpx;
|
||||
z-index: 10091;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.print-station-option {
|
||||
@ -2169,13 +2275,22 @@
|
||||
color: #2979ff;
|
||||
}
|
||||
|
||||
.print-message {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
.print-station-option--row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.station-option-name {
|
||||
font-size: 36rpx;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.station-option-code {
|
||||
font-size: 32rpx;
|
||||
color: #909399;
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
|
||||
.station-list-scroll {
|
||||
max-height: 600rpx;
|
||||
padding: 0 10rpx;
|
||||
@ -2189,7 +2304,7 @@
|
||||
.station-list-empty {
|
||||
text-align: center;
|
||||
padding: 60rpx 0;
|
||||
font-size: 28rpx;
|
||||
font-size: 36rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
@ -2219,7 +2334,7 @@
|
||||
}
|
||||
|
||||
.station-list-item__name {
|
||||
font-size: 30rpx;
|
||||
font-size: 38rpx;
|
||||
color: #303133;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@
|
||||
</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-title">称重</view>
|
||||
<view class="weigh-popup-body">
|
||||
@ -146,19 +146,21 @@
|
||||
<view class="weigh-btn weigh-btn--minus" @click="weighDecrement">-</view>
|
||||
<input
|
||||
class="weigh-input"
|
||||
type="digit"
|
||||
type="number"
|
||||
:value="weighWeight > 0 ? String(weighWeight) : ''"
|
||||
placeholder="请输入重量"
|
||||
placeholder-style="color:#c0c4cc;font-size:28rpx"
|
||||
:focus="weighInputFocused"
|
||||
placeholder="请输入重量(g)"
|
||||
placeholder-style="color:#c0c4cc;font-size:36rpx"
|
||||
@input="handleWeighInput"
|
||||
@blur="weighInputFocused = false"
|
||||
/>
|
||||
<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 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>
|
||||
</view>
|
||||
@ -178,6 +180,8 @@
|
||||
showPickListSection: true,
|
||||
showWeighPopup: false,
|
||||
weighWeight: 0,
|
||||
weighInputFocused: false,
|
||||
_weighAfterReview: false,
|
||||
detailInfo: {
|
||||
recordId: '',
|
||||
orderId: 0,
|
||||
@ -340,6 +344,8 @@
|
||||
}
|
||||
this.currentGoodsIndex = 0;
|
||||
this.matchedGoodsState = {};
|
||||
// 从订单复核页带入的商品条码,自动触发匹配
|
||||
this.tryAutoMatchBarcode();
|
||||
this.safeDispatchBroadcast('setCallbacks', {
|
||||
onResult: this.handleBroadcastResult
|
||||
});
|
||||
@ -754,11 +760,11 @@
|
||||
} catch (e) {
|
||||
console.warn('[confirmRecheck] 缓存复核完成数据失败:', e);
|
||||
}
|
||||
// 复核成功后弹出称重弹窗
|
||||
this._weighAfterReview = true;
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}, 1500);
|
||||
this.handleWeigh();
|
||||
}, 800);
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: this.getApiErrorMessage(error, '确认复核失败'),
|
||||
@ -852,38 +858,122 @@
|
||||
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() {
|
||||
this.weighWeight = 0;
|
||||
this.weighInputFocused = false;
|
||||
this.showWeighPopup = true;
|
||||
this.$nextTick(() => {
|
||||
this.weighInputFocused = true;
|
||||
});
|
||||
},
|
||||
weighIncrement() {
|
||||
this.weighWeight = Math.round((this.weighWeight + 0.1) * 10) / 10;
|
||||
this.weighWeight = this.weighWeight + 1;
|
||||
},
|
||||
weighDecrement() {
|
||||
const val = Math.round((this.weighWeight - 0.1) * 10) / 10;
|
||||
const val = this.weighWeight - 1;
|
||||
this.weighWeight = val < 0 ? 0 : val;
|
||||
},
|
||||
handleWeighInput(e) {
|
||||
const raw = String(e?.detail?.value || '').trim();
|
||||
if (raw === '') {
|
||||
// 只保留数字,过滤掉小数点等任何非数字字符
|
||||
const digits = raw.replace(/\D/g, '');
|
||||
if (digits === '') {
|
||||
this.weighWeight = 0;
|
||||
return;
|
||||
}
|
||||
const num = parseFloat(raw);
|
||||
if (Number.isFinite(num) && num >= 0) {
|
||||
this.weighWeight = Math.round(num * 1000) / 1000;
|
||||
} else {
|
||||
this.weighWeight = 0;
|
||||
}
|
||||
this.weighWeight = parseInt(digits, 10);
|
||||
},
|
||||
async handleWeighSave() {
|
||||
if (this.weighWeight <= 0) {
|
||||
uni.showToast({ title: '请输入重量', icon: 'none' });
|
||||
if (this.weighWeight < 100) {
|
||||
uni.showToast({ title: '重量至少输入三位数', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
const listType = String(this.detailInfo?.listType || '').trim();
|
||||
const weighingWeight = this.weighWeight;
|
||||
const weighingWeightKg = weighingWeight / 1000;
|
||||
|
||||
uni.showLoading({ title: '提交称重中...' });
|
||||
try {
|
||||
@ -897,7 +987,7 @@
|
||||
}
|
||||
await this.$http('order.recheckOrder.updateExpressWeighingWeight', {
|
||||
order_id: waveId,
|
||||
weighing_weight: weighingWeight
|
||||
weighing_weight: weighingWeightKg
|
||||
});
|
||||
} else {
|
||||
// 散单/详情模式:传 order_id
|
||||
@ -909,12 +999,18 @@
|
||||
}
|
||||
await this.$http('order.recheckOrder.updateExpressWeighingWeight', {
|
||||
order_id: orderId,
|
||||
weighing_weight: weighingWeight
|
||||
weighing_weight: weighingWeightKg
|
||||
});
|
||||
}
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '称重完成', icon: 'success' });
|
||||
this.showWeighPopup = false;
|
||||
if (this._weighAfterReview) {
|
||||
this._weighAfterReview = false;
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ delta: 1 });
|
||||
}, 1000);
|
||||
}
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
const message = String(error?.message || error?.msg || error?.errMsg || '称重提交失败');
|
||||
@ -1002,11 +1098,11 @@
|
||||
}
|
||||
|
||||
.nav-right-complete {
|
||||
font-size: 32rpx;
|
||||
line-height: 36rpx;
|
||||
font-size: 36rpx;
|
||||
line-height: 44rpx;
|
||||
color: #ffffff;
|
||||
padding: 8rpx 18rpx;
|
||||
border-radius: 6rpx;
|
||||
padding: 14rpx 24rpx;
|
||||
border-radius: 8rpx;
|
||||
background: #07c160;
|
||||
}
|
||||
|
||||
@ -1044,13 +1140,13 @@
|
||||
}
|
||||
|
||||
.page-head-label {
|
||||
font-size: 28rpx;
|
||||
font-size: 32rpx;
|
||||
color: #909399;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.page-head-wave {
|
||||
font-size: 28rpx;
|
||||
font-size: 32rpx;
|
||||
color: #303133;
|
||||
font-weight: 500;
|
||||
flex: 1;
|
||||
@ -1061,7 +1157,7 @@
|
||||
}
|
||||
|
||||
.page-head-value {
|
||||
font-size: 32rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
flex: 1;
|
||||
@ -1072,7 +1168,7 @@
|
||||
}
|
||||
|
||||
.page-head-picker {
|
||||
font-size: 26rpx;
|
||||
font-size: 30rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
@ -1087,7 +1183,7 @@
|
||||
}
|
||||
|
||||
.page-head-btn {
|
||||
font-size: 30rpx;
|
||||
font-size: 34rpx;
|
||||
color: #ffffff;
|
||||
padding: 12rpx 24rpx;
|
||||
border: none;
|
||||
@ -1113,8 +1209,8 @@
|
||||
|
||||
.page-head-value {
|
||||
margin-left: 8rpx;
|
||||
font-size: 36rpx;
|
||||
line-height: 46rpx;
|
||||
font-size: 40rpx;
|
||||
line-height: 50rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
flex: 1;
|
||||
@ -1129,11 +1225,12 @@
|
||||
flex-wrap: nowrap;
|
||||
width: 100%;
|
||||
margin-top: 14rpx;
|
||||
font-size: 32rpx;
|
||||
line-height: 54rpx;
|
||||
font-size: 36rpx;
|
||||
line-height: 58rpx;
|
||||
}
|
||||
|
||||
.barcode-value {
|
||||
font-size: 40rpx;
|
||||
color: #2979ff;
|
||||
text-decoration: underline;
|
||||
text-decoration-color: rgba(41, 121, 255, 0.45);
|
||||
@ -1144,31 +1241,35 @@
|
||||
}
|
||||
|
||||
.goods-row--barcode-highlight {
|
||||
background: #f0fff4;
|
||||
border: 1rpx solid #b7eb8f;
|
||||
background: #14e578;
|
||||
border: 1rpx solid #0fcb68;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.goods-row--barcode-highlight .label,
|
||||
.goods-row--barcode-highlight .value {
|
||||
color: #52c41a;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.goods-row--barcode-highlight .barcode-value {
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.goods-row--scanned-complete {
|
||||
background: #f0fff4;
|
||||
border: 1rpx solid #b7eb8f;
|
||||
background: #14e578;
|
||||
border: 1rpx solid #0fcb68;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.goods-row--scanned-complete .qty-item .label,
|
||||
.goods-row--scanned-complete .qty-item .value {
|
||||
color: #52c41a;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.goods-row--scanned-complete .qty-divider {
|
||||
background: #b7eb8f;
|
||||
background: #0fcb68;
|
||||
}
|
||||
|
||||
.goods-row:first-child {
|
||||
@ -1359,7 +1460,7 @@
|
||||
}
|
||||
|
||||
.more-text {
|
||||
font-size: 34rpx;
|
||||
font-size: 38rpx;
|
||||
line-height: 1;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
@ -1368,8 +1469,8 @@
|
||||
.goods-name {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 38rpx;
|
||||
line-height: 52rpx;
|
||||
font-size: 42rpx;
|
||||
line-height: 56rpx;
|
||||
font-weight: 700;
|
||||
color: #303133;
|
||||
}
|
||||
@ -1390,7 +1491,7 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 30rpx;
|
||||
font-size: 34rpx;
|
||||
line-height: 1.2;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
@ -1470,8 +1571,8 @@
|
||||
position: absolute;
|
||||
left: 8rpx;
|
||||
top: 6rpx;
|
||||
font-size: 30rpx;
|
||||
line-height: 38rpx;
|
||||
font-size: 34rpx;
|
||||
line-height: 42rpx;
|
||||
font-weight: 600;
|
||||
color: #606266;
|
||||
}
|
||||
@ -1480,8 +1581,8 @@
|
||||
position: absolute;
|
||||
right: 8rpx;
|
||||
bottom: 4rpx;
|
||||
font-size: 38rpx;
|
||||
line-height: 46rpx;
|
||||
font-size: 42rpx;
|
||||
line-height: 50rpx;
|
||||
font-weight: 700;
|
||||
color: #2979ff;
|
||||
}
|
||||
@ -1490,8 +1591,8 @@
|
||||
position: absolute;
|
||||
left: 8rpx;
|
||||
bottom: 4rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 36rpx;
|
||||
font-size: 32rpx;
|
||||
line-height: 40rpx;
|
||||
color: #19be6b;
|
||||
}
|
||||
|
||||
@ -1503,8 +1604,8 @@
|
||||
}
|
||||
|
||||
.switch-index {
|
||||
font-size: 28rpx;
|
||||
line-height: 38rpx;
|
||||
font-size: 32rpx;
|
||||
line-height: 42rpx;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
@ -1516,8 +1617,8 @@
|
||||
}
|
||||
|
||||
.bottom-module-title {
|
||||
font-size: 32rpx;
|
||||
line-height: 46rpx;
|
||||
font-size: 36rpx;
|
||||
line-height: 50rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 8rpx;
|
||||
@ -1535,28 +1636,28 @@
|
||||
}
|
||||
|
||||
.bottom-summary-text {
|
||||
font-size: 28rpx;
|
||||
font-size: 32rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.bottom-summary-scan {
|
||||
font-size: 28rpx;
|
||||
font-size: 32rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.bottom-summary-split {
|
||||
font-size: 28rpx;
|
||||
font-size: 32rpx;
|
||||
color: #909399;
|
||||
margin: 0 2rpx;
|
||||
}
|
||||
|
||||
.bottom-summary-total {
|
||||
font-size: 28rpx;
|
||||
font-size: 32rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.bottom-summary-value {
|
||||
font-size: 32rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #2979ff;
|
||||
}
|
||||
@ -1576,7 +1677,7 @@
|
||||
|
||||
.empty-text {
|
||||
margin-top: 18rpx;
|
||||
font-size: 32rpx;
|
||||
font-size: 36rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
@ -1585,14 +1686,14 @@
|
||||
}
|
||||
|
||||
.weigh-popup {
|
||||
width: 560rpx;
|
||||
padding: 24rpx 36rpx 36rpx;
|
||||
width: 640rpx;
|
||||
padding: 32rpx 40rpx 40rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.weigh-popup-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 400;
|
||||
font-size: 44rpx;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
text-align: left;
|
||||
line-height: 1;
|
||||
@ -1601,7 +1702,7 @@
|
||||
}
|
||||
|
||||
.weigh-popup-body {
|
||||
margin: 20rpx 0 48rpx;
|
||||
margin: 30rpx 0 56rpx;
|
||||
}
|
||||
|
||||
.weigh-row {
|
||||
@ -1609,11 +1710,11 @@
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 24rpx;
|
||||
gap: 28rpx;
|
||||
}
|
||||
|
||||
.weigh-label {
|
||||
font-size: 30rpx;
|
||||
font-size: 40rpx;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
@ -1628,12 +1729,12 @@
|
||||
}
|
||||
|
||||
.weigh-btn {
|
||||
width: 60rpx;
|
||||
height: 76rpx;
|
||||
width: 72rpx;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 36rpx;
|
||||
font-size: 44rpx;
|
||||
font-weight: 400;
|
||||
color: #606266;
|
||||
background: #f5f7fa;
|
||||
@ -1657,10 +1758,10 @@
|
||||
}
|
||||
|
||||
.weigh-input {
|
||||
width: 200rpx;
|
||||
height: 76rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
width: 240rpx;
|
||||
height: 88rpx;
|
||||
font-size: 44rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
text-align: center;
|
||||
background: #ffffff;
|
||||
@ -1673,24 +1774,24 @@
|
||||
}
|
||||
|
||||
.weigh-unit {
|
||||
font-size: 30rpx;
|
||||
font-size: 36rpx;
|
||||
color: #909399;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.weigh-popup-footer {
|
||||
display: flex;
|
||||
gap: 24rpx;
|
||||
gap: 28rpx;
|
||||
}
|
||||
|
||||
.weigh-footer-btn {
|
||||
flex: 1;
|
||||
height: 72rpx;
|
||||
border-radius: 10rpx;
|
||||
height: 90rpx;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user