From 6c2f8895a6b1fb5558d6e6acaad128b5a40ca7bd Mon Sep 17 00:00:00 2001
From: zm2000 <18386612143@163.com>
Date: Sun, 14 Jun 2026 19:28:40 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=93=E5=8D=B0=E6=97=A5?=
=?UTF-8?q?=E5=BF=97=EF=BC=9A=E8=AE=A2=E5=8D=95=E5=A4=8D=E6=A0=B8=E7=9A=84?=
=?UTF-8?q?=E6=89=93=E5=8D=B0=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/work/order/order-review.vue | 97 ++++++++++++++++++++++++++++++-
1 file changed, 96 insertions(+), 1 deletion(-)
diff --git a/pages/work/order/order-review.vue b/pages/work/order/order-review.vue
index 1f39dd0..d89ba7f 100644
--- a/pages/work/order/order-review.vue
+++ b/pages/work/order/order-review.vue
@@ -4,7 +4,7 @@
-
+
{
+ this._debugClickCount = 0;
+ }, 2000);
+ if (this._debugClickCount >= 10) {
+ this._debugClickCount = 0;
+ if (this._debugClickTimer) {
+ clearTimeout(this._debugClickTimer);
+ this._debugClickTimer = null;
+ }
+ this._debugMode = !this._debugMode;
+ if (this._debugMode) {
+ // 清空旧日志
+ this._debugLogs = [];
+ this.debugLog('调试模式', '已开启');
+ // #ifdef APP-PLUS
+ const filePath = '_doc/print_debug_log.txt';
+ uni.showToast({
+ title: `调试模式已开启,日志文件:${filePath}`,
+ icon: 'none',
+ duration: 3000
+ });
+ // #endif
+ // #ifndef APP-PLUS
+ uni.showToast({
+ title: '调试模式已开启(仅App端可写入文件)',
+ icon: 'none',
+ duration: 2000
+ });
+ // #endif
+ } else {
+ this.flushDebugLogs();
+ uni.showToast({
+ title: '调试模式已关闭',
+ icon: 'none'
+ });
+ }
+ }
+ },
+ debugLog(label, data) {
+ if (!this._debugMode) return;
+ const timestamp = new Date().toLocaleString();
+ const text = `[${timestamp}][${label}] ${typeof data === 'string' ? data : JSON.stringify(data, null, 2)}`;
+ this._debugLogs.push(text);
+ // 每10条写入一次文件
+ if (this._debugLogs.length >= 10) {
+ this.flushDebugLogs();
+ }
+ },
+ flushDebugLogs() {
+ if (!this._debugLogs.length) return;
+ const content = this._debugLogs.join('\n') + '\n';
+ this._debugLogs = [];
+ // #ifdef APP-PLUS
+ try {
+ plus.io.requestFileSystem(plus.io.PRIVATE_DOC, fs => {
+ fs.root.getFile('print_debug_log.txt', { create: true }, fileEntry => {
+ fileEntry.file(file => {
+ const reader = new plus.io.FileReader();
+ reader.onloadend = e => {
+ const existing = e.target.result || '';
+ fileEntry.createWriter(writer => {
+ writer.seek(file.size);
+ writer.write(content);
+ });
+ };
+ reader.readAsText(file);
+ });
+ });
+ });
+ } catch (e) {
+ console.warn('[debugLog] 写入文件失败:', e);
+ }
+ // #endif
+ },
handleCameraScan() {
uni.scanCode({
onlyFromCamera: true,
@@ -1418,6 +1509,7 @@
}
const params = this.buildPrintSendParams();
+ this.debugLog('print.send 请求参数', params);
const effectivePrintCount = Number(this.pendingPrintCount || 0) > 0
? Number(this.pendingPrintCount || 0)
: this.printWaveGroups.length;
@@ -1426,6 +1518,7 @@
});
try {
const response = await this.$http('print.send', params);
+ this.debugLog('print.send 返回数据', response);
const success = response?.flag !== 'failure' && response?.code !== '500' && response?.code !== 500;
if (!success) {
throw new Error(response?.message || response?.msg || '打印失败');
@@ -1516,7 +1609,9 @@
waveGroups
}
};
+ this.debugLog('print.send 请求参数', sendParams);
const sendResponse = await this.$http('print.send', sendParams);
+ this.debugLog('print.send 返回数据', sendResponse);
const success = sendResponse?.flag !== 'failure' && sendResponse?.code !== '500' && sendResponse?.code !== 500;
if (!success) {
throw new Error(sendResponse?.message || sendResponse?.msg || '打印发送失败');