spring
6 小时以前 8d4473d1b502ca5183981e04d3b2686b4f045ec6
src/pages/outbound/materialOutbound.vue
@@ -364,15 +364,26 @@
  uni.$on("scanMaterial", getScanCode);
};
// 安全解码(兼容已解码或未编码的情况)
const safeDecode = (val: any) => {
  if (typeof val !== "string") return val || "";
  try {
    // 如果是编码过的(包含 %),decode 一次;否则直接返回
    return val.includes("%") ? decodeURIComponent(val) : val;
  } catch (e) {
    return val;
  }
};
onLoad((options: any) => {
  // 从路由参数中获取物料基本信息、出库单信息和 vsrccode
  currentMaterial.value = {
    materialname: options.materialname || "-",
    materialspec: options.materialspec || "-",
    materialname: safeDecode(options.materialname || "-"),
    materialspec: safeDecode(options.materialspec || "-"),
    shippedQuantity: Number(options.shippedQuantity || 0),
    cdeliveryid: options.cdeliveryid || "",
    cdeliverybid: options.cdeliverybid || "",
    materialcode: options.materialcode || "",
    cdeliveryid: safeDecode(options.cdeliveryid || ""),
    cdeliverybid: safeDecode(options.cdeliverybid || ""),
    materialcode: safeDecode(options.materialcode || ""),
  };
  vsrccode.value = options.vsrccode || "";
});