| | |
| | | let orderRow = ""; |
| | | |
| | | // 尝试从扫码结果中提取orderRow参数 |
| | | // 假设二维码内容是JSON格式或URL参数格式 |
| | | try { |
| | | // 检查是否是JSON格式 |
| | | const parsedData = JSON.parse(scanResult); |
| | | if (parsedData.orderRow) { |
| | | orderRow = parsedData.orderRow; |
| | | } |
| | | // 处理混合格式: http://...?orderRow={...} |
| | | const orderRowStart = scanResult.indexOf("orderRow={"); |
| | | // 提取从orderRow={开始的JSON内容 |
| | | const jsonPart = scanResult.substring(orderRowStart + 9); // 9是"orderRow=".length |
| | | // 尝试直接使用这个JSON部分 |
| | | orderRow = jsonPart; |
| | | } catch (e) { |
| | | // 检查是否是URL参数格式,如 orderRow=12345 |
| | | const params = new URLSearchParams(scanResult); |
| | | orderRow = params.get("orderRow") || ""; |
| | | console.error(e, "解析失败====????====="); |
| | | orderRow = ""; |
| | | } |
| | | |
| | | console.log(orderRow, "orderRow======@@@@@@@@"); |
| | | // 扫码成功后跳转到生产报工页面,并传递orderRow参数 |
| | | uni.navigateTo({ |
| | | url: `/pages/productionManagement/productionReport/index?orderRow=${orderRow}`, |