diff --git a/src/stores/Products/Index.js b/src/stores/Products/Index.js index 98f4cc0..45307c6 100644 --- a/src/stores/Products/Index.js +++ b/src/stores/Products/Index.js @@ -207,30 +207,31 @@ export const useProductsStore = create( const generatedList = [] defList.forEach(definition => { - // 增加多个有效日期批量设置: - const mappedPriceList = definition?.priceList.map(price => { - return { - id: null, - adult_cost: price.priceInput.audultPrice, - child_cost: price.priceInput.childrenPrice, - group_size_min: price.priceInput.numberStart, - group_size_max: price.priceInput.numberEnd, - - currency: definition.currency, - unit_id: definition.unitId, - // 保持和 API 返回格式一致,日期要转换为字符串 - use_dates_start: definition.useDate[0].format('YYYY-MM-DD'), - use_dates_end: definition.useDate[1].format('YYYY-MM-DD'), - weekdays: definition.weekend.join(','), - WPI_SN: editingProduct.info.id, - WPP_VEI_SN: activeAgency.travel_agency_id, - lastedit_changed: '', - audit_state_id: -1, - key: generateId(), - fresh: false - } + definition?.useDateList.map(useDateItem => { + const mappedPriceList = definition?.priceList.map(price => { + return { + id: null, + adult_cost: price.priceInput.audultPrice, + child_cost: price.priceInput.childrenPrice, + group_size_min: price.priceInput.numberStart, + group_size_max: price.priceInput.numberEnd, + + currency: definition.currency, + unit_id: definition.unitId, + // 保持和 API 返回格式一致,日期要转换为字符串 + use_dates_start: useDateItem.useDate[0].format('YYYY-MM-DD'), + use_dates_end: useDateItem.useDate[1].format('YYYY-MM-DD'), + weekdays: definition.weekend.join(','), + WPI_SN: editingProduct.info.id, + WPP_VEI_SN: activeAgency.travel_agency_id, + lastedit_changed: '', + audit_state_id: -1, + key: generateId(), + fresh: false + } + }) + generatedList.push(...mappedPriceList) }) - generatedList.push(...mappedPriceList) }) const mergedList = [...quotationList,...generatedList] diff --git a/src/views/products/Detail/ProductInfoQuotation.jsx b/src/views/products/Detail/ProductInfoQuotation.jsx index db85504..2c1638d 100644 --- a/src/views/products/Detail/ProductInfoQuotation.jsx +++ b/src/views/products/Detail/ProductInfoQuotation.jsx @@ -1,5 +1,5 @@ import { useState } from 'react' -import { Table, Form, Modal, Button, Radio, Input, Flex, Card, InputNumber, Checkbox, DatePicker, Space, App, Tooltip } from 'antd' +import { Table, Form, Modal, Typography, Button, Radio, Input, Flex, Card, InputNumber, Checkbox, DatePicker, Space, App, Tooltip } from 'antd' import { useTranslation } from 'react-i18next' import { CloseOutlined, StarTwoTone, PlusOutlined, ExclamationCircleFilled, QuestionCircleOutlined, QuestionOutlined } from '@ant-design/icons' import { useDatePresets } from '@/hooks/useDatePresets' @@ -13,8 +13,12 @@ const batchSetupInitialValues = { 'defList': [ // 旺季 { - 'useDate': [ - dayjs().add(1, 'year').startOf('y'), dayjs().add(1, 'year').endOf('y') + 'useDateList': [ + { + 'useDate': [ + dayjs().add(1, 'year').startOf('y'), dayjs().add(1, 'year').endOf('y') + ] + } ], 'unitId': '0', 'currency': 'RMB', @@ -57,8 +61,12 @@ const batchSetupInitialValues = { }, // 淡季 { - 'useDate': [ - dayjs().add(1, 'year').subtract(2, 'M').startOf('M'), dayjs().add(1, 'year').endOf('M') + 'useDateList': [ + { + 'useDate': [ + dayjs().add(1, 'year').subtract(2, 'M').startOf('M'), dayjs().add(1, 'year').endOf('M') + ] + } ], 'unitId': '0', 'currency': 'RMB', @@ -111,17 +119,16 @@ const defaultPriceValue = { } } +const defaultUseDate = { + 'useDate': [dayjs().add(1, 'year').startOf('y'), dayjs().add(1, 'year').endOf('y')] +} + const defaultDefinitionValue = { - 'useDate': [ - dayjs().add(1, 'year').subtract(2, 'M').startOf('M'), dayjs().add(1, 'year').endOf('M') - ], + 'useDateList': [defaultUseDate], 'unitId': '0', 'currency': 'RMB', - 'weekend': [ - ], - 'priceList': [ - defaultPriceValue - ] + 'weekend': [], + 'priceList': [defaultPriceValue] } const ProductInfoQuotation = ({ editable, ...props }) => { @@ -306,8 +313,24 @@ const ProductInfoQuotation = ({ editable, ...props }) => { options={['5', '6', '7']} /> - - + + + {(useDateFieldList, useDateOptList) => ( + + {useDateFieldList.map((useDateField, index) => ( + + + + + {index == 0 ? : useDateOptList.remove(useDateField.name)} />} + + ))} + + + )} + @@ -336,6 +359,13 @@ const ProductInfoQuotation = ({ editable, ...props }) => { )} + + {() => ( + +
{JSON.stringify(batchSetupForm.getFieldsValue(), null, 2)}
+
+ )} +