diff --git a/inventory-web/src/views/stock/inbound/product.vue b/inventory-web/src/views/stock/inbound/product.vue index bc7afe7..8756696 100644 --- a/inventory-web/src/views/stock/inbound/product.vue +++ b/inventory-web/src/views/stock/inbound/product.vue @@ -392,14 +392,19 @@ - + - - - + + + + + + + + @@ -643,7 +648,8 @@ const form = reactive({ bom_code: '', bom_version: '', work_order_code: '', order_id: '', production_manager: '', production_time_range: [] as string[], raw_material_cost: undefined as number | undefined, - manual_cost: undefined as number | undefined, + unit_total_cost: undefined as number | undefined, + total_price: undefined as number | undefined, sale_price: undefined as number | undefined, quality_report_link: [] as string[], inspection_report_link: [] as string[], product_photo: [] as string[], detail_link: '' }) @@ -982,7 +988,8 @@ const submitForm = async () => { quality_report_link: qImages, inspection_report_link: iImages, raw_material_cost: Number(form.raw_material_cost || 0), - manual_cost: Number(form.manual_cost || 0), + unit_total_cost: Number(form.unit_total_cost || 0), + total_price: Number(form.total_price || 0), sale_price: Number(form.sale_price || 0), production_start_time: form.production_time_range?.[0], production_end_time: form.production_time_range?.[1] @@ -1012,7 +1019,7 @@ const handlePrint = async (row: any) => { const confirmPrint = async () => { printing.value = true; try { await executePrint(currentPrintData.value); ElMessage.success('已发送'); printVisible.value = false } catch (e: any) { ElMessage.error('打印失败') } finally { printing.value = false } } const resetForm = () => { materialOptions.value = []; bomOptions.value = []; productPhotoList.value = []; qualityFileList.value = []; inspectionFileList.value = []; quality_url.value = ''; inspection_url.value = '' - Object.assign(form, { id: undefined, base_id: undefined, material_name: '', spec_model: '', material_type: '', category: '', unit: '', sku: '', barcode: '', serial_number: '', in_date: '', in_quantity: 1, stock_quantity: 1, available_quantity: 1, warehouse_location: '', status: '在库', quality_status: '合格', bom_code: '', bom_version: '', work_order_code: '', order_id: '', production_manager: '', production_time_range: [], raw_material_cost: undefined, manual_cost: undefined, sale_price: undefined, quality_report_link: [], inspection_report_link: [], product_photo: [], detail_link: '' }) + Object.assign(form, { id: undefined, base_id: undefined, material_name: '', spec_model: '', material_type: '', category: '', unit: '', sku: '', barcode: '', serial_number: '', in_date: '', in_quantity: 1, stock_quantity: 1, available_quantity: 1, warehouse_location: '', status: '在库', quality_status: '合格', bom_code: '', bom_version: '', work_order_code: '', order_id: '', production_manager: '', production_time_range: [], raw_material_cost: undefined, unit_total_cost: undefined, total_price: undefined, sale_price: undefined, quality_report_link: [], inspection_report_link: [], product_photo: [], detail_link: '' }) } const getStatusType = (s:string) => ({'在库':'success','出库':'info','借库':'warning','损耗':'danger'}[s]||'warning') const getQualityType = (s:string) => ({'合格':'success','不合格':'danger','待检':'info'}[s]||'info') @@ -1023,6 +1030,13 @@ onMounted(() => { fetchData() fetchOptions() }) + +// 成本计算监听 +watch([() => form.unit_total_cost, () => form.in_quantity], ([unit, qty]) => { + const unitNum = Number(unit || 0) + const qtyNum = Number(qty || 1) + form.total_price = Number((unitNum * qtyNum).toFixed(2)) +})