|
|
|
@ -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'));
|
|
|
|
|
// 保存后更新数据
|
|
|
|
|