diff --git a/src/views/products/Detail.jsx b/src/views/products/Detail.jsx index 9b05614..a1cdda6 100644 --- a/src/views/products/Detail.jsx +++ b/src/views/products/Detail.jsx @@ -1068,9 +1068,9 @@ function Detail() {
{/* onNodeSelect={handleNodeSelect} */} - + -
+
{/* */} {/* */} @@ -1165,8 +1165,8 @@ function Detail() { {/* */} {/* */} -

{t('products:supplierQuotation')}

- + {/*

{t('products:supplierQuotation')}

*/} + {/* { - !isCanEditable && + // !isCanEditable && @@ -1184,7 +1184,7 @@ function Detail() { { } - + */} {/* diff --git a/src/views/products/Detail/ProductInfoForm.jsx b/src/views/products/Detail/ProductInfoForm.jsx index 635e3e5..c53afe4 100644 --- a/src/views/products/Detail/ProductInfoForm.jsx +++ b/src/views/products/Detail/ProductInfoForm.jsx @@ -16,6 +16,7 @@ import { HT_HOST } from '@/config'; import { useProductsTypesMapVal, useProductsTypesFieldsets } from '@/hooks/useProductsSets'; import useProductsStore from '@/stores/Products/Index'; import ProductInfoLgc from './ProductInfoLgc'; +import ProductInfoQuotation from './ProductInfoQuotation'; const { RangePicker } = DatePicker; @@ -23,8 +24,6 @@ const InfoForm = ({ formInstance, onSubmit, onReset, onValuesChange, editable, s const { t } = useTranslation('products'); const [agencyProducts, editingProduct, setEditingProduct] = useProductsStore((state) => [state.agencyProducts, state.editingProduct, state.setEditingProduct]); const weekdays = useWeekdays(); - // const [formValues, setFormValues] = useFormStore((state) => [state.formValues, state.setFormValues]); - // const [formValuesToSub, setFormValuesToSub] = useFormStore((state) => [state.formValuesToSub, state.setFormValuesToSub]); const [form] = Form.useForm(); const { sort, hides, fieldProps, fieldComProps } = { sort: '', @@ -37,45 +36,12 @@ const InfoForm = ({ formInstance, onSubmit, onReset, onValuesChange, editable, s const filedsets = useProductsTypesFieldsets(editingProduct?.info?.product_type_id); const shows = filedsets[0]; // console.log('filedsets', filedsets, shows); - const formValuesMapper = (values) => { - const destinationObject = { - 'keyword': { key: 'keyword', transform: (value) => value || '' }, - 'referenceNo': { key: 'referenceNo', transform: (value) => value || '' }, - 'dates': [ - { key: 'startdate', transform: (arrVal) => (arrVal ? arrVal[0].format(DATE_FORMAT) : '') }, - { key: 'enddate', transform: (arrVal) => (arrVal ? arrVal[1].format(DATE_FORMAT) : '') }, - { key: 'starttime', transform: (arrVal) => (arrVal ? arrVal[0].format(DATE_FORMAT) : '') }, - { key: 'endtime', transform: (arrVal) => (arrVal ? arrVal[1].format(SMALL_DATETIME_FORMAT) : '') }, - ], - 'invoiceStatus': { key: 'invoiceStatus', transform: (value) => value?.value || value?.key || '', default: '' }, - 'audit_state': { key: 'audit_state', transform: (value) => value?.value || value?.key || '', default: '' }, - 'agency': { - key: 'agency', - transform: (value) => { - return Array.isArray(value) ? value.map((ele) => ele.key).join(',') : value ? value.value : ''; - }, - }, - 'year': [{ key: 'year', transform: (arrVal) => (arrVal ? arrVal.format('YYYY') : '') }], - }; - let dest = {}; - const { dates, ...omittedValue } = values; - dest = { ...omittedValue, ...objectMapper(values, destinationObject) }; - for (const key in dest) { - if (Object.prototype.hasOwnProperty.call(dest, key)) { - dest[key] = typeof dest[key] === 'string' ? (dest[key] || '').trim() : dest[key]; - } - } - // omit empty - // Object.keys(dest).forEach((key) => (dest[key] == null || dest[key] === '' || dest[key].length === 0) && delete dest[key]); - return dest; - }; - useEffect(() => { // const dest = formValuesMapper(formValues); - // setFormValuesToSub(dest); form.resetFields(); - form.setFieldsValue(editingProduct?.info); + // form.setFieldsValue(editingProduct?.info); form.setFieldValue('city', { value: editingProduct?.info?.city_id, label: editingProduct?.info?.city_name }); + form.setFieldValue('dept', { value: editingProduct?.info?.dept_id, label: editingProduct?.info?.dept_name }); // form.setFieldValue('open_weekdays', ['1', '2', '3', '4', '5', '6', '7']); return () => {}; }, [editingProduct?.info?.id]); @@ -85,8 +51,6 @@ const InfoForm = ({ formInstance, onSubmit, onReset, onValuesChange, editable, s const dest = formValuesMapper(values); console.log('form value send to onSubmit:\n', dest); const str = new URLSearchParams(dest).toString(); - // setFormValues(values); - // setFormValuesToSub(dest); if (typeof onSubmit === 'function') { onSubmit(null, dest, values, str); } @@ -102,8 +66,6 @@ const InfoForm = ({ formInstance, onSubmit, onReset, onValuesChange, editable, s }; const onIValuesChange = (changedValues, allValues) => { const dest = formValuesMapper(allValues); - // setFormValues(allValues); - // setFormValuesToSub(dest); // console.log('form onValuesChange', Object.keys(changedValues), args); if (typeof onValuesChange === 'function') { onValuesChange(dest); @@ -111,7 +73,7 @@ const InfoForm = ({ formInstance, onSubmit, onReset, onValuesChange, editable, s }; return ( <> - + {getFields({ sort, initialValue: editingProduct?.info, hides, shows, fieldProps, fieldComProps, form, t, dataSets: { weekdays } })} {/* {showSubmit && ( @@ -127,6 +89,7 @@ const InfoForm = ({ formInstance, onSubmit, onReset, onValuesChange, editable, s {/* */} +
+ { + // !isCanEditable && + + } + + { + + } + + + setBatchImportPriceVisible(false)} width={'90%'}> + + + + +

成人价

+ setCurrentQuotationRecord({ ...currentQuotationRecord, adult_cost: e })} /> +

儿童价

+ setCurrentQuotationRecord({ ...currentQuotationRecord, child_cost: e })} /> +

币种

+ +

类型

+ + +

人等

+
+

有效期

+ { + setCurrentQuotationRecord({ + ...currentQuotationRecord, + use_dates_start: dates[0], + use_dates_end: dates[1], + }); + }} + /> +

周末

+ {days.map((day, index) => ( + + ))} + + + ); +}; +export default ProductInfoQuotation; diff --git a/src/views/products/Detail/ProductsTree.jsx b/src/views/products/Detail/ProductsTree.jsx index 94ff6b3..1669625 100644 --- a/src/views/products/Detail/ProductsTree.jsx +++ b/src/views/products/Detail/ProductsTree.jsx @@ -1,10 +1,10 @@ import { createContext, useEffect, useState } from 'react'; import { Tree, Input } from 'antd'; +import { CaretDownOutlined } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; import useProductsStore from '@/stores/Products/Index'; import { useProductsTypes, useProductsAuditStatesMapVal } from '@/hooks/useProductsSets'; - const flattenTreeFun = (tree) => { let flatList = []; const flatten = (nodes) => { @@ -57,7 +57,7 @@ const ProductsTree = ({ onNodeSelect, ...props }) => { ...ele, title: ele.label, key: ele.value, - children: (agencyProducts[ele.value] || []).map(product => ({ + children: (agencyProducts[ele.value] || []).map((product) => ({ title: product.info.title, // key: `${ele.value}-${product.info.id}`, key: product.info.id, @@ -68,18 +68,18 @@ const ProductsTree = ({ onNodeSelect, ...props }) => { setRawTreeData(_show); setFlattenTreeData(flattenTreeFun(_show)); - setExpandedKeys(productsTypes.map(item => item.key)); // 全部展开 + setExpandedKeys(productsTypes.map((item) => item.key)); // 全部展开 // setActiveKey(isEmpty(_show) ? [] : [_show[0].key]); return () => {}; }, [productsTypes, agencyProducts]); const [searchValue, setSearchValue] = useState(''); - const onSearch = ({target: {value}}) => { + const onSearch = ({ target: { value } }) => { // const { value } = e.target; const newExpandedKeys = flattenTreeData - .filter(item => item.title.includes(value)) - .map(item => getParentKey(item.key, rawTreeData)) + .filter((item) => item.title.includes(value)) + .map((item) => getParentKey(item.key, rawTreeData)) .filter((item, i, self) => item && self.indexOf(item) === i); setExpandedKeys(newExpandedKeys); setSearchValue(value); @@ -92,18 +92,6 @@ const ProductsTree = ({ onNodeSelect, ...props }) => { if (typeof onNodeSelect === 'function') { onNodeSelect(_, { node }); } - // setSelectedNodeid(node.key); - // const fatherKey = node.key.split('-')[0]; - // setSelectedCategory(productProject[fatherKey]); - // setTags([languageLabel]); - // // 如果点击的是同一个节点,不做任何操作 - // if (selectedNodeid === node.key) return; - // setLanguageStatus(language); - // const matchedLanguage = HTLanguageSets.find(HTLanguage => HTLanguage.key === language.toString()); - // const languageLabelRefresh = matchedLanguage.label; - // setLanguageLabel(languageLabelRefresh); - // setSelectedTag(languageLabelRefresh); - // setRemainderLanguage(HTLanguageSets.filter(item => item.key !== language.toString())); }; const onExpand = (keys) => { setExpandedKeys(keys); @@ -114,9 +102,7 @@ const ProductsTree = ({ onNodeSelect, ...props }) => { const index = node.title.indexOf(searchValue); const beforeStr = node.title.substr(0, index); const afterStr = node.title.substr(index + searchValue.length); - const highlighted = ( - {searchValue} - ); + const highlighted = {searchValue}; return index > -1 ? ( @@ -132,7 +118,10 @@ const ProductsTree = ({ onNodeSelect, ...props }) => { return (
- } onSelect={handleNodeSelect} treeData={treeData} expandedKeys={expandedKeys}
+ setCurrentQuotationRecord({ ...currentQuotationRecord, group_size_min: e })} + style={{ width: '50%', marginRight: '10px' }} + /> + - + setCurrentQuotationRecord({ ...currentQuotationRecord, group_size_max: e })} + style={{ width: '50%', marginLeft: '10px' }} + /> +