From 7509df62180e7e4b08bf41bf3a181b23910d7c6c Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 29 四月 2026 15:26:20 +0800
Subject: [PATCH] 优化扫码结果处理逻辑
---
src/pages/index.vue | 10 +++++++---
src/pages/works.vue | 4 ++--
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/pages/index.vue b/src/pages/index.vue
index b7d3fa9..7ff805e 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -249,9 +249,13 @@
console.log("鎵爜缁撴灉:", res);
// 瑙f瀽鎵爜缁撴灉骞惰烦杞埌鐢熶骇鎶ュ伐椤甸潰
try {
- const scanResult = JSON.parse(res.result);
+ const scanRaw = res.result;
+ const scanResult =
+ typeof scanRaw === "string" ? JSON.parse(scanRaw) : scanRaw;
+ console.log("scanResult", scanResult);
uni.navigateTo({
- url: `/pages/productionManagement/productionReport/index?orderRow=${encodeURIComponent(JSON.stringify(scanResult))}`
+ // 浼犻�掓暣涓� orderRow 瀵硅薄锛堟壂鐮佸璞★級缁欐姤宸ラ〉
+ url: `/pages/productionManagement/productionReport/index?orderRow=${encodeURIComponent(JSON.stringify(scanResult))}`,
});
} catch (e) {
console.error("鎵爜缁撴灉瑙f瀽澶辫触:", e);
@@ -260,7 +264,7 @@
},
fail: (err) => {
console.error("鎵爜澶辫触:", err);
- }
+ }
});
return;
}
diff --git a/src/pages/works.vue b/src/pages/works.vue
index 8d37e74..8673344 100644
--- a/src/pages/works.vue
+++ b/src/pages/works.vue
@@ -980,7 +980,7 @@
console.log("宸ュ崟鏁版嵁:", workData);
orderRow = JSON.stringify({
- id: workData.id || workOrderId,
+ workOrderId: workData.id || workOrderId,
planQuantity: workData.planQuantity - workData.completeQuantity,
productProcessRouteItemId:
workData.productProcessRouteItemId ||
@@ -1027,7 +1027,7 @@
}
// 鎵爜鎴愬姛鍚庤烦杞埌鐢熶骇鎶ュ伐椤甸潰锛屽苟浼犻�抩rderRow鍙傛暟
uni.navigateTo({
- url: `/pages/productionManagement/productionReport/index?orderRow=${orderRow}`,
+ url: `/pages/productionManagement/productionReport/index?orderRow=${encodeURIComponent(orderRow)}`,
});
},
fail: err => {
--
Gitblit v1.9.3