From c2e4b027a1cf5719e5a188728473472da226bce0 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 1 Aug 2024 14:14:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98,=20=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Detail/ProductInfo.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/views/products/Detail/ProductInfo.jsx b/src/views/products/Detail/ProductInfo.jsx index 7da23ac..26f85c6 100644 --- a/src/views/products/Detail/ProductInfo.jsx +++ b/src/views/products/Detail/ProductInfo.jsx @@ -35,14 +35,26 @@ const ProductInfo = ({ editable, ...props }) => { // "travel_agency_name": "", // "lastedit_changed": "", }; + /** lgc_details */ const copyFields = pick(editingProduct.info, ['title', 'product_type_id', ]); const readyToSubInfo = {...copyNewProduct.info, ...values.info, ...copyFields, type: copyFields.product_type_id, ...poster }; // console.log('onSave', editingProduct.info, readyToSubInfo); const prevLgcDetailsMapped = editingProduct.lgc_details.reduce((r, c) => ({...r, [c.lgc]: {...c, description: c.descriptions}}), {}); // todo: description字段不一致 const mergedLgc = { ...prevLgcDetailsMapped, ...values.lgc_details_mapped }; + + /** quotation */ // todo: 报价不能为空 + const prevQuotationMapped = editingProduct.quotation.reduce((r, c) => ({...r, [c.id]: {...c, unit: c.unit_id, audit_state: c.audit_state_id }}), {}); + const mergedQ = { ...prevQuotationMapped, ...(values.quotation || []) }; + // console.log(values); + // return false; setLoading(true); - const { success, result } = await postProductsSaveAction({ travel_agency_id: activeAgency.travel_agency_id, info: readyToSubInfo, lgc_details: Object.values(mergedLgc) }); + const { success, result } = await postProductsSaveAction({ + travel_agency_id: activeAgency.travel_agency_id, + info: readyToSubInfo, + lgc_details: Object.values(mergedLgc), + quotation: Object.values(mergedQ), + }); setLoading(false); success ? message.success(t('Success')) : message.error(t('Failed')); // 保存后更新数据