| | |
| | | const detail = ref(null); |
| | | const loading = ref(true); |
| | | |
| | | function normalizeDetail(raw, type) { |
| | | function normalizeDetail(raw) { |
| | | if (!raw) return null; |
| | | const d = typeof raw === "object" ? raw : {}; |
| | | return { |
| | |
| | | lockedQuantity: d.lockedQuantity, |
| | | unLockedQuantity: d.unLockedQuantity ?? (d.qualitity - (d.lockedQuantity || 0)), |
| | | updateTime: d.updateTime, |
| | | typeLabel: type === "1" ? "不合格库存" : "合格库存", |
| | | typeLabel: "合格库存", |
| | | }; |
| | | } |
| | | |
| | |
| | | try { |
| | | const payload = typeof cached === "string" ? JSON.parse(cached) : cached; |
| | | const item = payload && payload.item != null ? payload.item : payload; |
| | | const type = payload && payload.type != null ? payload.type : "0"; |
| | | detail.value = normalizeDetail({ ...item, index: 1 }, type); |
| | | detail.value = normalizeDetail({ ...item, index: 1 }); |
| | | uni.removeStorageSync("stockDetailItem"); |
| | | } catch (e) { |
| | | uni.removeStorageSync("stockDetailItem"); |