style: 统一页面顶部与弹窗风格、修复打印台绑定误绑与软键盘问题

- 拆单页(splitOrder)
  · 打印台绑定弹窗统一圆角/标题/关闭按钮布局,字号、标签颜色统一
  · 输入框内容字号 36rpx,打印台行去掉分隔线,弹窗高度调整为 450rpx
  · 修复回车确认误绑首个模糊匹配项(改为精确匹配优先)

- 分拣缺货补货页(replenishShorts)
  · 选择货主弹窗标题样式统一(居中标题,去掉底部分隔线)

- 称重页(weighing)
  · 顶部与空态参考绑定包材页,内容字号对齐
  · 连秤/蓝牙秤面板/设置重量等按钮字号统一
  · 连接蓝牙秤弹窗去掉按名称连接,改为搜索框按关键字筛选(统一 SearchBar)
  · 设置重量成功后不再自动激活软键盘
  · 称重重量输入框字号恢复 56rpx

- 订单复核页(order-review)
  · 顶部改为自定义标题栏(参考绑定包材),按钮改实心风格
  · 拦截信息升级为横幅(位于搜索框下方)
  · 连接蓝牙秤弹窗参考称重页

- 面单补打页(labelReprint)
  · 顶部样式参考拆单页,搜索框置顶
  · 去掉打印台本地存储
  · 打印台绑定弹窗样式参考拆单页,修复回车误绑
  · 模式切换按钮改蓝色主题、字号 38rpx
  · 日志面板白底黑字、时间去掉 GMT、统一字体
This commit is contained in:
zm2000 2026-11-11 18:09:40 +08:00
parent dc554f9a9e
commit bbfd474028
6 changed files with 591 additions and 401 deletions

View File

@ -125,17 +125,85 @@ class VoiceBroadcastManager {
return this.initPromise;
}
// 从语音接口响应中提取音频地址,兼容 JSON / XML / 纯文本 URL 等多种返回格式
_extractAudioUrl(data) {
if (!data) {
return '';
}
// 1. 字符串:可能是 JSON 文本、XML 或纯 URL
if (typeof data === 'string') {
const trimmed = data.trim();
if (trimmed.startsWith('{')) {
try {
data = JSON.parse(trimmed);
} catch (e) {
// 不是合法 JSON,按纯文本继续处理
data = trimmed;
}
} else if (trimmed.startsWith('<')) {
// XML:提取 <audio>/<url>/<path>/<src>/<file> 标签内容,兼容 CDATA
const match = trimmed.match(/<(?:audio|url|path|src|file)[^>]*>\s*(?:<!\[CDATA\[)?([^<\]\[]*)/i);
return match ? match[1].trim() : '';
} else if (/^https?:\/\//i.test(trimmed)) {
return trimmed;
} else {
// 其他纯文本,直接当作路径使用
return trimmed;
}
}
// 2. 对象:尝试常见字段
if (data && typeof data === 'object') {
const keys = ['audio', 'url', 'path', 'src', 'file', 'data', 'result'];
for (const key of keys) {
const value = data[key];
if (typeof value === 'string' && value.trim()) {
return value.trim();
}
}
// data 可能是嵌套对象,再探测一层
for (const key of keys) {
const value = data[key];
if (value && typeof value === 'object') {
for (const innerKey of keys) {
const innerValue = value[innerKey];
if (typeof innerValue === 'string' && innerValue.trim()) {
return innerValue.trim();
}
}
}
}
}
return '';
}
playByHttp(msg) {
return new Promise(resolve => {
uni.request({
url: VOICE_API_URL + msg,
method: 'GET',
timeout: 3000,
dataType: 'text',
header: {
'content-type': 'text/xml; charset=utf-8'
},
success: res => {
const _src = VOICE_API_PATH + res.data.audio;
// uni.request 的 success 对非 2xx 也会回调(如 502),需先判断状态码
const statusCode = res && res.statusCode;
if (statusCode && (statusCode < 200 || statusCode >= 300)) {
console.warn('[VoiceHTTP] 语音服务返回异常状态码:', statusCode, '原始响应:', res && res.data);
resolve(false);
return;
}
const audioPath = this._extractAudioUrl(res && res.data);
if (!audioPath) {
console.warn('[VoiceHTTP] 未解析到音频地址, 原始响应:', res && res.data);
resolve(false);
return;
}
const _src = /^https?:\/\//i.test(audioPath) ? audioPath : (VOICE_API_PATH + audioPath);
console.log('[VoiceHTTP] audio src:', _src);
// 每次重新创建 audio 实例,避免复用导致播放卡死
if (this.audio) {

View File

@ -1,26 +1,22 @@
<template>
<view class="reprint-page">
<!-- 顶部栏 -->
<view class="top-bar">
<view class="status-bar"></view>
<view class="header">
<view class="header-left">
<view class="header-left__back" @click="handleBack">
<u-icon name="arrow-left" size="36rpx" color="#303133"></u-icon>
</view>
<view class="header-left__divider"></view>
<view class="manual-toggle-btn"
:class="{ 'manual-toggle-btn--active': manualInputOpen }"
@click="toggleManualInput"
>
<text class="manual-toggle-btn__text">{{ manualInputOpen ? '关闭手动输入' : '手动输入' }}</text>
</view>
<!-- 顶部标题栏(参考拆单) -->
<view class="status-bar"></view>
<view class="page-header">
<view class="back-btn" @click="handleBack">
<u-icon name="arrow-left" size="18" color="#333"></u-icon>
</view>
<text class="header-title">面单补打</text>
<view class="header-side header-side--right">
<view
class="header-side__btn"
:class="{ 'header-side__btn--active': manualInputOpen }"
@click="toggleManualInput"
>
<text class="header-side__btn-text">输入框</text>
</view>
<text class="header-title">面单补打</text>
<view class="header-right" @click="handlePrinterSettings">
<text class="header-printer-text" :class="{ 'header-printer-text--bound': !!printerName }">
{{ printerName || '未绑定' }}
</text>
<view class="header-printer-btn" :class="{ 'header-printer-btn--bound': !!printerName }" @click="handlePrinterSettings">
<text class="header-printer-btn__text">{{ printerName || '未绑定' }}</text>
</view>
</view>
</view>
@ -33,25 +29,23 @@
<!-- 有权限:中部操作区 + 底部消息区 -->
<template v-else>
<view class="content-box">
<!-- 手动输入输入框(默认隐藏) -->
<view class="broadcast-input-area">
<view v-if="manualInputOpen" class="scan-section">
<SearchBar
v-model="scanKeyword"
:placeholder="printerId ? '扫描/输入快递单号' : '扫描/输入打印台编码'"
:show-search="true"
:show-scan="!isBroadcastMode"
scan-icon="scan"
:focus="inputFocus"
:input-font-size="'34rpx'"
:search-text-font-size="'34rpx'"
@search="handleScanConfirm"
@scan="handleCameraScan"
></SearchBar>
</view>
</view>
<!-- 扫码输入区(参考拆单,白底顶栏) -->
<view class="scan-bar-wrap" v-if="manualInputOpen">
<SearchBar
v-model="scanKeyword"
:placeholder="printerId ? '扫描/输入快递单号' : '扫描/输入打印台编码'"
:show-search="true"
:show-scan="!isBroadcastMode"
scan-icon="scan"
:focus="inputFocus"
:input-font-size="'34rpx'"
:search-text-font-size="'34rpx'"
@search="handleScanConfirm"
@scan="handleCameraScan"
></SearchBar>
</view>
<view class="content-box">
<!-- 模式切换条 -->
<view class="mode-switch-bar">
<view
@ -89,10 +83,12 @@
</view>
<!-- 打印台设置弹窗 -->
<u-popup :show="showPopup" mode="bottom" :closeable="true" border-radius="20" :z-index="10090" @close="showPopup = false" style="flex: none">
<u-popup :show="showPopup" mode="bottom" :closeable="true" round="20" :z-index="10090" @close="showPopup = false" style="flex: none">
<view class="print-popup">
<view class="print-popup-header">
<text class="print-popup-title">打印台绑定</text>
</view>
<scroll-view scroll-y class="print-popup-scroll">
<view class="print-popup-title">打印台绑定</view>
<view class="print-row print-row--station">
<text class="print-label">打印台</text>
<view class="print-station-input-wrap">
@ -100,7 +96,8 @@
v-model="printStationInputKeyword"
placeholder="请输入或扫描打印台编号"
:clearable="true"
:customStyle="{ fontSize: '28rpx', height: '80rpx', lineHeight: '80rpx', padding: '0 20rpx', background: '#fafafa', borderRadius: '10rpx' }"
font-size="36rpx"
:customStyle="{ height: '80rpx', lineHeight: '80rpx', padding: '0 20rpx', background: '#fafafa', borderRadius: '10rpx' }"
@input="handlePrintStationInput"
@focus="handlePrintStationInputFocus"
@blur="handlePrintStationInputBlur"
@ -174,7 +171,6 @@ import voice from '@/core/utils/voice';
onLoad(options) {
this.isBroadcastMode = options?.broadcast === 'true' || options?.broadcast === true;
this.checkPermission();
this.loadPrinterBinding();
this.loadPrintStations(1, false);
this.safeDispatchBroadcast('setCallbacks', {
onResult: this.handleBroadcastResult
@ -280,27 +276,6 @@ import voice from '@/core/utils/voice';
console.warn('[labelReprint] 加载打印台列表失败:', error);
}
},
savePrinterBinding() {
try {
uni.setStorageSync('labelReprint_printer', {
printerId: this.printerId,
printerName: this.printerName
});
} catch (e) {
console.warn('[labelReprint] 保存打印台绑定失败:', e);
}
},
loadPrinterBinding() {
try {
const stored = uni.getStorageSync('labelReprint_printer');
if (stored) {
this.printerId = String(stored.printerId || '');
this.printerName = String(stored.printerName || '');
}
} catch (e) {
// 忽略
}
},
matchPrintStation(text) {
if (!text || !Array.isArray(this.printStationList) || !this.printStationList.length) {
uni.showToast({ title: '暂无可用打印台', icon: 'none' });
@ -317,7 +292,6 @@ import voice from '@/core/utils/voice';
if (matched) {
this.printerId = String(matched.id);
this.printerName = String(matched.name || '');
this.savePrinterBinding();
uni.showToast({ title: `已绑定打印台:${matched.name}`, icon: 'success' });
this.speakVoice('已绑定打印台');
this.addPrintMsg(`打印台绑定成功:${matched.name}(${matched.customBarcode || matched.id})`);
@ -350,7 +324,6 @@ import voice from '@/core/utils/voice';
handlePrintStationSelect(station) {
this.printerId = String(station?.id || '');
this.printerName = String(station?.name || '');
this.savePrinterBinding();
this.showPrintStationDropdown = false;
this.showPopup = false;
uni.showToast({ title: `已绑定打印台:${station.name}`, icon: 'success' });
@ -360,9 +333,23 @@ import voice from '@/core/utils/voice';
handlePrintStationInputConfirm() {
const keyword = this.normalizeKeyword(this.printStationInputKeyword);
if (!keyword) return;
if (this.printStationFilteredList.length > 0) {
this.handlePrintStationSelect(this.printStationFilteredList[0]);
const kw = keyword.toLowerCase();
// 仅精确匹配才直接绑定,避免输入部分关键字回车误绑到首个模糊匹配项
const exactMatch = this.printStationFilteredList.find(station => {
return String(station.name).toLowerCase() === kw
|| String(station.id).toLowerCase() === kw
|| String(station.customBarcode || '').toLowerCase() === kw;
});
if (exactMatch) {
this.handlePrintStationSelect(exactMatch);
return;
}
if (this.printStationFilteredList.length === 1) {
this.handlePrintStationSelect(this.printStationFilteredList[0]);
return;
}
uni.showToast({ title: '未匹配到打印台', icon: 'none' });
this.speakVoice('未绑定打印台');
},
handlePrintStationInputFocus() {
this.showPrintStationDropdown = false;
@ -568,7 +555,9 @@ import voice from '@/core/utils/voice';
return `PRINT_${timePart}_${randomPart}`;
},
addPrintMsg(msg) {
const timestamp = new Date().toLocaleTimeString();
const now = new Date();
const pad = n => String(n).padStart(2, '0');
const timestamp = `${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
this.printMsgList.push(`[${timestamp}] ${msg}`);
if (this.printMsgList.length > 200) {
this.printMsgList = this.printMsgList.slice(-100);
@ -587,49 +576,67 @@ import voice from '@/core/utils/voice';
overflow: hidden;
}
/* ===== 顶部栏 ===== */
.top-bar {
/* ===== 顶部标题栏(参考拆单) ===== */
.status-bar {
height: var(--status-bar-height);
background: #ffffff;
}
.page-header {
position: relative;
height: 88rpx;
padding: 0 24rpx;
display: flex;
align-items: center;
background: #ffffff;
box-sizing: border-box;
flex-shrink: 0;
}
.status-bar {
height: var(--status-bar-height, 44rpx);
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.header-left {
display: flex;
align-items: center;
gap: 12rpx;
min-width: 100rpx;
}
.header-left__back {
.back-btn {
flex-shrink: 0;
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
width: 56rpx;
height: 56rpx;
}
.header-left__divider {
width: 1rpx;
height: 32rpx;
background: #dcdfe6;
.header-side {
flex-shrink: 0;
display: flex;
align-items: center;
}
.header-side .header-side__btn + .header-printer-btn {
margin-left: 16rpx;
}
.header-side__btn {
display: flex;
align-items: center;
padding: 12rpx 28rpx;
border-radius: 8rpx;
background: #2979ff;
}
.header-side__btn--active {
background: #fa8c16;
}
.header-side__btn-text {
font-size: 36rpx;
color: #ffffff;
line-height: 1;
}
.header-side--right {
justify-content: flex-end;
}
.header-title {
flex: 1;
padding: 0 16rpx;
font-size: 32rpx;
font-size: 36rpx;
font-weight: bold;
color: #333;
text-align: center;
@ -638,22 +645,17 @@ import voice from '@/core/utils/voice';
text-overflow: ellipsis;
}
.header-right {
min-width: 100rpx;
display: flex;
justify-content: flex-end;
}
.header-printer-text {
font-size: 28rpx;
.header-printer-btn {
padding: 12rpx 20rpx;
font-size: 36rpx;
color: #909399;
padding: 4rpx 12rpx;
border: 1rpx solid #dcdfe6;
border-radius: 6rpx;
border-radius: 8rpx;
line-height: 1;
white-space: nowrap;
}
.header-printer-text--bound {
.header-printer-btn--bound {
color: #07c160;
border-color: #07c160;
}
@ -673,36 +675,20 @@ import voice from '@/core/utils/voice';
color: #909399;
}
/* ===== 手动输入开关按钮(头部) ===== */
.manual-toggle-btn {
display: flex;
align-items: center;
justify-content: center;
width: 175rpx;
height: 52rpx;
background: #2979ff;
border-radius: 8rpx;
}
.manual-toggle-btn--active {
background: #fa8c16;
}
.manual-toggle-btn__text {
font-size: 28rpx;
color: #ffffff;
white-space: nowrap;
}
/* ===== 中部操作区 ===== */
.content-box {
padding: 20rpx 24rpx;
flex-shrink: 0;
}
/* 扫码输入区 */
.scan-section {
margin-bottom: 20rpx;
/* 扫码输入区(参考拆单) */
.scan-bar-wrap {
position: relative;
z-index: 10;
padding: 20rpx;
background: #ffffff;
border-bottom: 1rpx solid #f2f2f2;
flex-shrink: 0;
}
/* 模式切换条 */
@ -711,7 +697,7 @@ import voice from '@/core/utils/voice';
gap: 0;
border-radius: 12rpx;
overflow: hidden;
border: 2rpx solid #e74c3c;
border: 2rpx solid #2979ff;
}
.mode-switch-item {
@ -723,11 +709,11 @@ import voice from '@/core/utils/voice';
}
.mode-switch-item--active {
background: #e74c3c;
background: #2979ff;
}
.mode-switch-item__text {
font-size: 32rpx;
font-size: 38rpx;
color: #303133;
font-weight: 500;
}
@ -741,7 +727,7 @@ import voice from '@/core/utils/voice';
flex: 1;
min-height: 0;
margin: 0 24rpx 24rpx;
background: #1a1a1a;
background: #ffffff;
border-radius: 12rpx;
overflow: hidden;
display: flex;
@ -760,9 +746,8 @@ import voice from '@/core/utils/voice';
}
.message-item__text {
font-size: 32rpx;
color: #ffffff;
font-family: 'Courier New', monospace;
font-size: 34rpx;
color: #000000;
line-height: 1.6;
word-break: break-all;
}
@ -775,54 +760,60 @@ import voice from '@/core/utils/voice';
}
.message-empty__text {
font-size: 28rpx;
color: #666666;
font-size: 34rpx;
color: #909399;
}
/* ===== 打印台设置弹窗 ===== */
.print-popup {
height: 70vh;
height: 450rpx;
background: #ffffff;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
/* 顶部圆角与 u-popup 的 round="20"(20px)保持一致,并裁切内部白底 */
border-radius: 20px 20px 0 0;
overflow: hidden;
display: flex;
flex-direction: column;
}
.print-popup-scroll {
flex: 1;
padding: 48rpx 32rpx calc(40rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
/* 居中标题 + 细分隔线(与拆单弹窗保持一致) */
.print-popup-header {
display: flex;
flex-direction: column;
align-items: center;
padding: 32rpx 30rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
flex-shrink: 0;
}
.print-popup-title {
font-size: 42rpx;
font-size: 38rpx;
font-weight: 600;
color: #303133;
margin-bottom: 36rpx;
color: #333;
}
.print-popup-scroll {
flex: 1;
padding: 32rpx 32rpx calc(40rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
}
.print-row {
display: flex;
align-items: flex-start;
padding: 28rpx 0;
border-bottom: 1rpx solid #f2f3f5;
}
.print-row--station {
position: relative;
}
.print-row--station .print-label {
padding-top: 10rpx;
align-items: center;
}
.print-label {
min-width: 130rpx;
width: 130rpx;
font-size: 36rpx;
line-height: 40rpx;
color: #909399;
line-height: 36rpx;
color: #000000;
}
.print-station-input-wrap {

View File

@ -136,10 +136,12 @@
</u-popup>
<!-- 打印台设置弹窗 -->
<u-popup :show="showPopup" mode="bottom" :closeable="true" border-radius="20" :z-index="10090" @close="showPopup = false" style="flex: none">
<u-popup :show="showPopup" mode="bottom" :closeable="true" round="20" :z-index="10090" @close="showPopup = false" style="flex: none">
<view class="print-popup">
<view class="print-popup-header">
<text class="print-popup-title">打印台绑定</text>
</view>
<scroll-view scroll-y class="print-popup-scroll">
<view class="print-popup-title">打印台绑定</view>
<view class="print-row print-row--station">
<text class="print-label">打印台</text>
<view class="print-station-input-wrap">
@ -147,7 +149,8 @@
v-model="printStationInputKeyword"
placeholder="请输入或扫描打印台编号"
:clearable="true"
:customStyle="{ fontSize: '28rpx', height: '80rpx', lineHeight: '80rpx', padding: '0 20rpx', background: '#fafafa', borderRadius: '10rpx' }"
font-size="36rpx"
:customStyle="{ height: '80rpx', lineHeight: '80rpx', padding: '0 20rpx', background: '#fafafa', borderRadius: '10rpx' }"
@input="handlePrintStationInput"
@focus="handlePrintStationInputFocus"
@blur="handlePrintStationInputBlur"
@ -706,9 +709,23 @@ export default {
handlePrintStationInputConfirm() {
const keyword = this.normalizeKeyword(this.printStationInputKeyword);
if (!keyword) return;
if (this.printStationFilteredList.length > 0) {
this.handlePrintStationSelect(this.printStationFilteredList[0]);
const kw = keyword.toLowerCase();
// 仅精确匹配才直接绑定,避免输入部分关键字回车误绑到首个模糊匹配项
const exactMatch = this.printStationFilteredList.find(station => {
return String(station.name).toLowerCase() === kw
|| String(station.id).toLowerCase() === kw
|| String(station.customBarcode || '').toLowerCase() === kw;
});
if (exactMatch) {
this.handlePrintStationSelect(exactMatch);
return;
}
if (this.printStationFilteredList.length === 1) {
this.handlePrintStationSelect(this.printStationFilteredList[0]);
return;
}
uni.showToast({ title: '未匹配到打印台', icon: 'none' });
this.speakVoice('未绑定打印台');
},
handlePrintStationInputFocus() {
this.showPrintStationDropdown = false;
@ -1148,48 +1165,54 @@ export default {
/* ===== 打印台设置弹窗 ===== */
.print-popup {
height: 70vh;
height: 450rpx;
background: #ffffff;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
/* 顶部圆角与 u-popup 的 round="20"(20px)保持一致,并裁切内部白底 */
border-radius: 20px 20px 0 0;
overflow: hidden;
display: flex;
flex-direction: column;
}
.print-popup-scroll {
flex: 1;
padding: 48rpx 32rpx calc(40rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
/* 居中标题 + 细分隔线(与仓库切换等弹窗保持一致) */
.print-popup-header {
display: flex;
flex-direction: column;
align-items: center;
padding: 32rpx 30rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
flex-shrink: 0;
}
.print-popup-title {
font-size: 42rpx;
font-size: 38rpx;
font-weight: 600;
color: #303133;
margin-bottom: 36rpx;
color: #333;
}
.print-popup-scroll {
flex: 1;
padding: 32rpx 32rpx calc(40rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
}
.print-row {
display: flex;
align-items: flex-start;
padding: 28rpx 0;
border-bottom: 1rpx solid #f2f3f5;
}
.print-row--station {
position: relative;
}
.print-row--station .print-label {
padding-top: 10rpx;
align-items: center;
}
.print-label {
min-width: 130rpx;
width: 130rpx;
font-size: 36rpx;
line-height: 40rpx;
color: #909399;
line-height: 36rpx;
color: #000000;
}
.print-station-input-wrap {

View File

@ -919,15 +919,19 @@
}
.store-drawer__header {
height: 88rpx;
padding: 0 32rpx;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 32rpx 30rpx 24rpx;
flex-shrink: 0;
}
.store-drawer__close {
position: absolute;
top: 50%;
right: 24rpx;
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
@ -935,9 +939,9 @@
}
.store-drawer__title {
font-size: 36rpx;
font-weight: bold;
color: #303133;
font-size: 38rpx;
font-weight: 600;
color: #333;
}
.store-drawer__loading {

View File

@ -1,13 +1,13 @@
<template>
<view class="scatter-picking-detail-page">
<view class="normar_container">
<page-nav :title="showDetailView ? '订单复核详情' : title">
<template #left>
<view v-if="showDetailView && isIntercepted" class="nav-intercept-btn" @click="handleShowInterceptInfo">
<text class="nav-intercept-btn__text">拦截信息</text>
</view>
</template>
<template #right>
<view class="status-bar"></view>
<view class="page-header">
<view class="back-btn" @click="handleBack">
<u-icon name="arrow-left" size="18" color="#333"></u-icon>
</view>
<text class="header-title">{{ showDetailView ? '订单复核详情' : title }}</text>
<view class="header-side header-side--right">
<view
class="nav-scale-btn"
:class="{ 'nav-scale-btn--connected': isScaleConnected }"
@ -18,8 +18,8 @@
<view class="nav-settings-btn" @click="showSettingsPopup = true">
<text class="nav-settings-btn__text">设置</text>
</view>
</template>
</page-nav>
</view>
</view>
<view class="search-filter">
<view class="search-row">
@ -44,6 +44,12 @@
</view>
</view>
<!-- 拦截信息横幅 -->
<view v-if="showDetailView && isIntercepted" class="intercept-banner" @click="handleShowInterceptInfo">
<text class="intercept-banner__text">该订单已被拦截,请勿复核发货</text>
<text class="intercept-banner__more">查看</text>
</view>
<!-- 复核明细区域:占满剩余空间 -->
<view class="detail-area" :class="{ 'detail-area--empty': !showDetailView }">
<ReviewDetail
@ -253,26 +259,19 @@
</view>
<view class="scale-popup-input">
<u-input
<SearchBar
v-model="scaleFilterName"
placeholder="电子秤蓝牙名称(完整名称)"
border="surround"
fontSize="32rpx"
></u-input>
<u-button
type="primary"
size="mini"
:disabled="!scaleFilterName"
:loading="scaleConnectionStatus === 'connecting'"
:customStyle="{ width: '200rpx', height: '72rpx', padding: '0', fontSize: '32rpx', flexShrink: '0' }"
@click="handleScaleConnectByName"
>按名称连接</u-button>
placeholder="搜索设备名称/ID"
:show-scan="false"
:input-font-size="'34rpx'"
:search-text-font-size="'34rpx'"
></SearchBar>
</view>
<scroll-view scroll-y class="scale-popup-list" v-if="scaleDevices.length">
<scroll-view scroll-y class="scale-popup-list" v-if="filteredScaleDevices.length">
<view class="scale-popup-list-inner">
<view
v-for="d in scaleDevices"
v-for="d in filteredScaleDevices"
:key="d.deviceId"
class="scale-device-item"
:class="{ 'scale-device-item--active': isScaleCurrentDevice(d) }"
@ -286,7 +285,7 @@
</view>
</view>
</scroll-view>
<u-empty v-else class="scale-popup-list" mode="list" text="暂无设备,点击扫描"></u-empty>
<u-empty v-else class="scale-popup-list" mode="list" :text="scaleDevices.length ? '未匹配到设备' : '暂无设备,点击扫描'" text-size="32rpx"></u-empty>
<view class="scale-popup-actions">
<view class="scale-popup-close-btn" @click="closeScalePopup">关闭</view>
@ -756,6 +755,16 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
scaleDevices() {
return this.$store.state.bluetoothScale.devices;
},
filteredScaleDevices() {
const keyword = String(this.scaleFilterName || '').trim().toLowerCase();
const list = Array.isArray(this.scaleDevices) ? this.scaleDevices : [];
if (!keyword) return list;
return list.filter(d => {
const name = String(d.name || '').toLowerCase();
const id = String(d.deviceId || '').toLowerCase();
return name.includes(keyword) || id.includes(keyword);
});
},
scaleDiscovering() {
return this.$store.state.bluetoothScale.discovering;
},
@ -893,6 +902,32 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
}
},
methods: {
handleBack() {
const pages = getCurrentPages();
if (pages.length > 1) {
uni.navigateBack({
delta: 1,
fail: () => {
this.toHome();
}
});
} else {
this.toHome();
}
},
toHome() {
const pages = getCurrentPages();
const currentRoute = pages.length ? `/${pages[pages.length - 1].route || ''}` : '';
if (currentRoute === '/pages/index/index') {
return;
}
uni.switchTab({
url: '/pages/index/index',
fail: () => {
uni.reLaunch({ url: '/pages/index/index' });
}
});
},
initKeyboardHeightListener() {
// H5 端:监听 visualViewport 高度变化,差值即键盘高度(仅垫高弹窗内容,不整页上推)
// #ifdef H5
@ -3368,20 +3403,6 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
uni.showToast({ title: (e && e.message) || '扫描失败', icon: 'none' });
});
},
async handleScaleConnectByName() {
if (!this.scaleFilterName) {
uni.showToast({ title: '请输入电子秤蓝牙名称', icon: 'none' });
return;
}
try {
await this.$store.dispatch('bluetoothScale/connectDeviceByName', this.scaleFilterName);
uni.showToast({ title: '连接成功', icon: 'success' });
this.showScalePopup = false;
this.speakVoice('蓝牙秤连接成功');
} catch (e) {
uni.showToast({ title: (e && e.message) || '连接失败', icon: 'none' });
}
},
async handleScaleConnectDevice(device) {
try {
await this.$store.dispatch('bluetoothScale/connectDevice', device);
@ -4331,13 +4352,58 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
z-index: 10090 !important;
}
::v-deep .nav-title .right {
width: auto;
min-width: 136rpx;
/* ===== 顶部标题栏(参考绑定包材) ===== */
.status-bar {
height: var(--status-bar-height);
background: #ffffff;
flex-shrink: 0;
}
.page-header {
position: relative;
height: 88rpx;
padding: 0 24rpx;
display: flex;
align-items: center;
background: #ffffff;
box-sizing: border-box;
flex-shrink: 0;
}
.back-btn {
flex-shrink: 0;
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
}
.header-side {
flex-shrink: 0;
display: flex;
align-items: center;
}
.header-side--right {
justify-content: flex-end;
}
.header-side .nav-scale-btn + .nav-settings-btn {
margin-left: 16rpx;
}
.header-title {
flex: 1;
font-size: 36rpx;
font-weight: bold;
color: #333;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.detail-area {
flex: 1;
min-height: 0;
@ -4445,27 +4511,21 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
}
.nav-scale-btn {
padding: 8rpx 18rpx;
padding: 12rpx 24rpx;
display: flex;
align-items: center;
justify-content: center;
border: 1rpx solid #2979ff;
border-radius: 6rpx;
margin-right: 12rpx;
background: #2979ff;
border-radius: 8rpx;
&--connected {
border-color: #07c160;
background: #f0f9eb;
background: #07c160;
}
.nav-scale-btn__text {
font-size: 30rpx;
color: #2979ff;
line-height: 1.4;
}
&--connected .nav-scale-btn__text {
color: #07c160;
font-size: 36rpx;
color: #ffffff;
line-height: 1;
}
}
@ -4474,12 +4534,12 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
}
.nav-settings-btn {
padding: 8rpx 18rpx;
padding: 12rpx 24rpx;
display: flex;
align-items: center;
justify-content: center;
border: 1rpx solid #2979ff;
border-radius: 6rpx;
background: #2979ff;
border-radius: 8rpx;
}
.nav-settings-btn:active {
@ -4487,29 +4547,35 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
}
.nav-settings-btn__text {
font-size: 30rpx;
color: #2979ff;
line-height: 1.4;
font-size: 36rpx;
color: #ffffff;
line-height: 1;
}
.nav-intercept-btn {
padding: 4rpx 16rpx;
/* ===== 拦截信息横幅 ===== */
.intercept-banner {
display: flex;
align-items: center;
justify-content: center;
border: 1rpx solid #fa3534;
border-radius: 6rpx;
background: #fef0f0;
}
justify-content: space-between;
padding: 20rpx 24rpx;
background: #fa3534;
flex-shrink: 0;
.nav-intercept-btn:active {
opacity: 0.7;
}
&__text {
flex: 1;
min-width: 0;
font-size: 32rpx;
color: #ffffff;
line-height: 1.4;
}
.nav-intercept-btn__text {
font-size: 26rpx;
color: #fa3534;
line-height: 1.6;
&__more {
flex-shrink: 0;
margin-left: 16rpx;
font-size: 30rpx;
color: #ffffff;
opacity: 0.9;
}
}
.order-intercept-popup {
@ -4994,37 +5060,23 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
.scale-popup-header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 48rpx 32rpx 0;
padding: 32rpx 30rpx 24rpx;
flex-shrink: 0;
.scale-popup-title {
font-size: 38rpx;
font-weight: 600;
color: #303133;
text-align: center;
white-space: nowrap;
color: #333;
}
}
.scale-popup-input {
display: flex;
align-items: center;
padding: 32rpx 32rpx 0;
::v-deep .u-input {
flex: 1;
min-width: 0;
height: 72rpx;
box-sizing: border-box;
padding-top: 0 !important;
padding-bottom: 0 !important;
}
::v-deep .u-button {
margin-left: 16rpx;
flex-shrink: 0;
}
padding: 32rpx 32rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.scale-popup-list {
@ -5070,7 +5122,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
}
.scale-device-id {
font-size: 24rpx;
font-size: 32rpx;
color: #999;
margin-top: 6rpx;
white-space: nowrap;
@ -5110,7 +5162,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
font-size: 36rpx;
color: #909399;
border: 2rpx solid #dcdfe6;
border-radius: 16rpx;
@ -5127,7 +5179,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
font-size: 36rpx;
color: #ffffff;
background: #2979ff;
border: 2rpx solid #2979ff;

View File

@ -1,25 +1,27 @@
<template>
<view class="weighing-page">
<view class="normar_container">
<page-nav title="称重">
<template #left>
<!-- 顶部标题栏(参考绑定包材) -->
<view class="status-bar"></view>
<view class="page-header">
<view class="back-btn" @click="handleBack">
<u-icon name="arrow-left" size="18" color="#333"></u-icon>
</view>
<text class="header-title">称重</text>
<view class="header-side header-side--right">
<view
class="nav-manual-input"
:class="{ 'nav-manual-input--inactive': !showScanInput }"
class="header-side__btn"
:class="{ 'header-side__btn--active': showScanInput }"
@click="toggleScanInput"
>
<text class="nav-manual-input-text">{{ showScanInput ? '关闭手动输入' : '手动输入' }}</text>
<text class="header-side__btn-text">输入框</text>
</view>
</template>
<template #right>
<view class="nav-reset" @click="handleReset">
<text class="nav-reset-text">重置</text>
</view>
</template>
</page-nav>
<view class="header-btn-reset" @click="handleReset">重置</view>
</view>
</view>
<!-- 扫码输入区 -->
<view class="scan-section" v-show="showScanInput">
<view class="scan-bar-wrap" v-show="showScanInput">
<SearchBar
v-model="scanInput"
placeholder="扫描/输入快递单号"
@ -33,6 +35,13 @@
></SearchBar>
</view>
<!-- 空态提示 -->
<view class="empty-state" v-show="!showOrderInfo">
<u-icon name="scan" size="100" color="#c0c4cc"></u-icon>
<text class="empty-state__title">暂无订单信息</text>
<text class="empty-state__hint">请扫描或输入快递单号查询订单信息</text>
</view>
<!-- 信息展示 -->
<view class="info-list" :class="{ 'info-list--no-scan': !showScanInput }" v-show="showOrderInfo">
<view class="info-row">
@ -127,26 +136,19 @@
</view>
<view class="scale-popup-input">
<u-input
<SearchBar
v-model="scaleFilterName"
placeholder="电子秤蓝牙名称(完整名称)"
border="surround"
fontSize="32rpx"
></u-input>
<u-button
type="primary"
size="mini"
:disabled="!scaleFilterName"
:loading="scaleConnectionStatus === 'connecting'"
:customStyle="{ width: '200rpx', height: '72rpx', padding: '0', fontSize: '32rpx', flexShrink: '0' }"
@click="handleScaleConnectByName"
>按名称连接</u-button>
placeholder="搜索设备名称/ID"
:show-scan="false"
:input-font-size="'34rpx'"
:search-text-font-size="'34rpx'"
></SearchBar>
</view>
<scroll-view scroll-y class="scale-popup-list" v-if="scaleDevices.length">
<scroll-view scroll-y class="scale-popup-list" v-if="filteredScaleDevices.length">
<view class="scale-popup-list-inner">
<view
v-for="d in scaleDevices"
v-for="d in filteredScaleDevices"
:key="d.deviceId"
class="scale-device-item"
:class="{ 'scale-device-item--active': isScaleCurrentDevice(d) }"
@ -160,7 +162,7 @@
</view>
</view>
</scroll-view>
<u-empty v-else class="scale-popup-list" mode="list" text="暂无设备,点击扫描"></u-empty>
<u-empty v-else class="scale-popup-list" mode="list" :text="scaleDevices.length ? '未匹配到设备' : '暂无设备,点击扫描'" text-size="32rpx"></u-empty>
<view class="scale-popup-actions">
<view class="scale-popup-close-btn" @click="closeScalePopup">关闭</view>
@ -262,6 +264,16 @@ import voice from '@/core/utils/voice';
scaleDevices() {
return this.$store.state.bluetoothScale.devices;
},
filteredScaleDevices() {
const keyword = String(this.scaleFilterName || '').trim().toLowerCase();
const list = Array.isArray(this.scaleDevices) ? this.scaleDevices : [];
if (!keyword) return list;
return list.filter(d => {
const name = String(d.name || '').toLowerCase();
const id = String(d.deviceId || '').toLowerCase();
return name.includes(keyword) || id.includes(keyword);
});
},
scaleDiscovering() {
return this.$store.state.bluetoothScale.discovering;
},
@ -508,7 +520,7 @@ import voice from '@/core/utils/voice';
this.isGroupOrder = false;
this.lastAutoWeight = '';
this.weightEditing = false;
this.scanFocused = true;
this.scanFocused = false;
},
scaleWeightInGrams() {
const raw = this.scaleWeight;
@ -533,20 +545,6 @@ import voice from '@/core/utils/voice';
uni.showToast({ title: (e && e.message) || '扫描失败', icon: 'none' });
});
},
async handleScaleConnectByName() {
if (!this.scaleFilterName) {
uni.showToast({ title: '请输入电子秤蓝牙名称', icon: 'none' });
return;
}
try {
await this.$store.dispatch('bluetoothScale/connectDeviceByName', this.scaleFilterName);
uni.showToast({ title: '连接成功', icon: 'success' });
this.showScalePopup = false;
this.speakVoice('蓝牙秤连接成功');
} catch (e) {
uni.showToast({ title: (e && e.message) || '连接失败', icon: 'none' });
}
},
async handleScaleConnectDevice(device) {
try {
await this.$store.dispatch('bluetoothScale/connectDevice', device);
@ -616,66 +614,130 @@ import voice from '@/core/utils/voice';
<style lang="scss" scoped>
.weighing-page {
.normar_container {
position: relative;
min-height: 100vh;
background-color: #f5f5f5;
}
/* ===== 左侧手动输入按钮 ===== */
::v-deep .nav-title .left {
min-width: auto;
gap: 0;
/* ===== 顶部标题栏(参考绑定包材) ===== */
.status-bar {
height: var(--status-bar-height);
background: #ffffff;
}
::v-deep .nav-title .right {
width: auto;
min-width: 80rpx;
.page-header {
position: relative;
height: 88rpx;
padding: 0 24rpx;
display: flex;
align-items: center;
background: #ffffff;
box-sizing: border-box;
flex-shrink: 0;
}
.nav-manual-input {
.back-btn {
flex-shrink: 0;
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
width: 210rpx;
height: 52rpx;
background: #fa8c16;
}
.header-side {
flex-shrink: 0;
display: flex;
align-items: center;
}
.header-side .header-side__btn + .header-btn-reset {
margin-left: 16rpx;
}
.header-side__btn {
display: flex;
align-items: center;
padding: 12rpx 28rpx;
border-radius: 8rpx;
&--inactive {
background: #2979ff;
}
.nav-manual-input-text {
font-size: 32rpx;
color: #ffffff;
white-space: nowrap;
}
background: #2979ff;
}
/* ===== 重置按钮 ===== */
.nav-reset {
padding: 8rpx 0;
.nav-reset-text {
font-size: 32rpx;
color: #fff;
background-color: #2979ff;
padding: 8rpx 24rpx;
border-radius: 8rpx;
white-space: nowrap;
}
.header-side__btn--active {
background: #fa8c16;
}
/* ===== 扫码输入区 ===== */
.scan-section {
padding: 20rpx 24rpx;
background: #fff;
margin-bottom: 16rpx;
.header-side__btn-text {
font-size: 36rpx;
color: #ffffff;
line-height: 1;
}
.header-side--right {
justify-content: flex-end;
}
.header-title {
flex: 1;
font-size: 36rpx;
font-weight: bold;
color: #333;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.header-btn-reset {
padding: 14rpx 28rpx;
background: #2979ff;
color: #ffffff;
font-size: 36rpx;
border-radius: 8rpx;
line-height: 1;
}
/* ===== 扫码输入区(参考绑定包材) ===== */
.scan-bar-wrap {
position: relative;
z-index: 10;
padding: 20rpx;
background: #ffffff;
border-bottom: 1rpx solid #f2f2f2;
flex-shrink: 0;
}
/* ===== 空态提示(参考绑定包材) ===== */
.empty-state {
position: absolute;
top: calc(var(--status-bar-height) + 88rpx);
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 80rpx 40rpx;
&__title {
margin-top: 32rpx;
font-size: 38rpx;
color: #909399;
}
&__hint {
margin-top: 16rpx;
font-size: 36rpx;
color: #c0c4cc;
text-align: center;
}
}
/* ===== 信息展示列表 ===== */
.info-list {
background: #fff;
margin: 0 24rpx 16rpx;
margin: 20rpx 24rpx 16rpx;
&--no-scan {
margin-top: 20rpx;
@ -699,7 +761,7 @@ import voice from '@/core/utils/voice';
}
.info-label {
font-size: 32rpx;
font-size: 36rpx;
color: #000;
width: 160rpx;
flex-shrink: 0;
@ -707,7 +769,7 @@ import voice from '@/core/utils/voice';
}
.info-value {
font-size: 32rpx;
font-size: 40rpx;
color: #000;
flex: 1;
text-align: center;
@ -724,7 +786,7 @@ import voice from '@/core/utils/voice';
display: flex;
.info-unit {
font-size: 32rpx;
font-size: 40rpx;
color: #000;
white-space: nowrap;
margin-left: 8rpx;
@ -757,7 +819,7 @@ import voice from '@/core/utils/voice';
}
.scale-read-btn-text {
font-size: 30rpx;
font-size: 36rpx;
color: #fff;
white-space: nowrap;
}
@ -782,7 +844,7 @@ import voice from '@/core/utils/voice';
}
.scale-status-label {
font-size: 32rpx;
font-size: 36rpx;
color: #333;
}
@ -791,7 +853,7 @@ import voice from '@/core/utils/voice';
align-items: center;
.scale-status-value {
font-size: 32rpx;
font-size: 36rpx;
font-weight: 500;
&.scale-status-connected {
@ -809,7 +871,7 @@ import voice from '@/core/utils/voice';
}
.scale-device-name {
font-size: 34rpx;
font-size: 36rpx;
color: #999;
margin-left: 12rpx;
}
@ -845,11 +907,11 @@ import voice from '@/core/utils/voice';
min-height: 72rpx;
padding: 0 32rpx;
border-radius: 8rpx;
font-size: 32rpx !important;
font-size: 36rpx !important;
}
::v-deep .u-button__text {
font-size: 32rpx !important;
font-size: 36rpx !important;
}
::v-deep .u-button + .u-button {
@ -867,37 +929,23 @@ import voice from '@/core/utils/voice';
.scale-popup-header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 48rpx 32rpx 0;
padding: 32rpx 30rpx 24rpx;
flex-shrink: 0;
.scale-popup-title {
font-size: 38rpx;
font-weight: 600;
color: #303133;
text-align: center;
white-space: nowrap;
color: #333;
}
}
.scale-popup-input {
display: flex;
align-items: center;
padding: 32rpx 32rpx 0;
::v-deep .u-input {
flex: 1;
min-width: 0;
height: 72rpx;
box-sizing: border-box;
padding-top: 0 !important;
padding-bottom: 0 !important;
}
::v-deep .u-button {
margin-left: 16rpx;
flex-shrink: 0;
}
padding: 32rpx 32rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.scale-popup-list {
@ -943,7 +991,7 @@ import voice from '@/core/utils/voice';
}
.scale-device-id {
font-size: 24rpx;
font-size: 32rpx;
color: #999;
margin-top: 6rpx;
white-space: nowrap;
@ -983,7 +1031,7 @@ import voice from '@/core/utils/voice';
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
font-size: 36rpx;
color: #909399;
border: 2rpx solid #dcdfe6;
border-radius: 16rpx;
@ -1000,7 +1048,7 @@ import voice from '@/core/utils/voice';
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
font-size: 36rpx;
color: #ffffff;
background: #2979ff;
border: 2rpx solid #2979ff;
@ -1021,6 +1069,10 @@ import voice from '@/core/utils/voice';
/* ===== 提交按钮 ===== */
.submit-section {
padding: 40rpx 24rpx;
::v-deep .u-button__text {
font-size: 36rpx !important;
}
}
/* ===== 断开蓝牙秤二次确认弹窗 ===== */