|
|
@@ -427,26 +427,26 @@ onMounted(async () => {
|
|
|
} catch (e) { console.error("Failed to load initial data:", e); }
|
|
|
});
|
|
|
|
|
|
-watch([() => files.value.length, selectedMaterial, modelLink], async () => {
|
|
|
+watch([() => files.value.map(f => f.quantity), selectedMaterial, modelLink], async () => {
|
|
|
if ((files.value.length > 0) && selectedMaterial.value) {
|
|
|
try {
|
|
|
const res = await getPriceEstimate({
|
|
|
material_id: parseInt(selectedMaterial.value),
|
|
|
file_sizes: files.value.map(f => f.size),
|
|
|
- file_quantities: files.value.map(f => 1), // Only get base unit cost
|
|
|
+ file_quantities: files.value.map(f => f.quantity),
|
|
|
});
|
|
|
// Assign individual prices to files for local quantity multiplication
|
|
|
- if (res.file_prices && Array.isArray(res.file_prices)) {
|
|
|
- files.value.forEach((f, i) => {
|
|
|
- f.basePrice = res.file_prices[i];
|
|
|
- });
|
|
|
- estimateMetadata.value = res.metadata;
|
|
|
- // Force reactivity update
|
|
|
- files.value = [...files.value];
|
|
|
- }
|
|
|
+ if (res.file_prices && Array.isArray(res.file_prices)) {
|
|
|
+ files.value.forEach((f, i) => {
|
|
|
+ f.basePrice = res.file_prices[i];
|
|
|
+ });
|
|
|
+ estimateMetadata.value = res.metadata;
|
|
|
+ // Force reactivity update
|
|
|
+ files.value = [...files.value];
|
|
|
+ }
|
|
|
} catch { /* silent */ }
|
|
|
}
|
|
|
-});
|
|
|
+}, { deep: true });
|
|
|
|
|
|
const isFormValid = computed(() =>
|
|
|
firstName.value.trim() !== "" && lastName.value.trim() !== "" &&
|