|
|
|
@ -5,6 +5,7 @@ import { CloseOutlined, StarTwoTone, PlusOutlined, ExclamationCircleFilled } fro
|
|
|
|
|
import { useDatePresets } from '@/hooks/useDatePresets'
|
|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
import useProductsStore from '@/stores/Products/Index'
|
|
|
|
|
import { generateId } from '@/utils/commons'
|
|
|
|
|
|
|
|
|
|
const { RangePicker } = DatePicker
|
|
|
|
|
|
|
|
|
@ -121,7 +122,7 @@ const batchSetupInitialValues = {
|
|
|
|
|
dayjs().add(1, 'year').startOf('y'), dayjs().add(1, 'year').endOf('y')
|
|
|
|
|
],
|
|
|
|
|
'unitId': '0',
|
|
|
|
|
'currency': 'CNY',
|
|
|
|
|
'currency': 'RMB',
|
|
|
|
|
'weekend': [
|
|
|
|
|
'5',
|
|
|
|
|
'6'
|
|
|
|
@ -167,7 +168,7 @@ const batchSetupInitialValues = {
|
|
|
|
|
dayjs().add(1, 'year').subtract(2, 'M').startOf('M'), dayjs().add(1, 'year').endOf('M')
|
|
|
|
|
],
|
|
|
|
|
'unitId': '0',
|
|
|
|
|
'currency': 'CNY',
|
|
|
|
|
'currency': 'RMB',
|
|
|
|
|
'weekend': [
|
|
|
|
|
'5',
|
|
|
|
|
'6'
|
|
|
|
@ -224,7 +225,7 @@ const defaultDefinitionValue = {
|
|
|
|
|
dayjs().add(1, 'year').subtract(2, 'M').startOf('M'), dayjs().add(1, 'year').endOf('M')
|
|
|
|
|
],
|
|
|
|
|
'unitId': '0',
|
|
|
|
|
'currency': 'CNY',
|
|
|
|
|
'currency': 'RMB',
|
|
|
|
|
'weekend': [
|
|
|
|
|
'5',
|
|
|
|
|
'6'
|
|
|
|
@ -260,6 +261,7 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
|
|
|
|
|
const onQuotationSeleted = async (quotation) => {
|
|
|
|
|
// 把 start, end 转换为 RangePicker 数组格式
|
|
|
|
|
quotation.use_dates = [dayjs(quotation.use_dates_start), dayjs(quotation.use_dates_end)]
|
|
|
|
|
quotation.weekdayList = quotation.weekdays.split(',')
|
|
|
|
|
quotationForm.setFieldsValue(quotation)
|
|
|
|
|
setQuotationModalOpen(true)
|
|
|
|
|
}
|
|
|
|
@ -277,30 +279,8 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const onBatchSetupFinish = () => {
|
|
|
|
|
let priceList = []
|
|
|
|
|
const defList = batchSetupForm.getFieldsValue().defList
|
|
|
|
|
|
|
|
|
|
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(','),
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
priceList.push(...mappedPriceList)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const newList = appendQuotationList(priceList)
|
|
|
|
|
const newList = appendQuotationList(defList)
|
|
|
|
|
triggerChange(newList)
|
|
|
|
|
setBatchSetupModalOpen(false)
|
|
|
|
|
}
|
|
|
|
@ -406,7 +386,7 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
|
|
|
|
|
>
|
|
|
|
|
<Form.Item label='币种' name={[field.name, 'currency']}>
|
|
|
|
|
<Select placeholder='选择币种'>
|
|
|
|
|
<Select.Option value='CNY'>CNY</Select.Option>
|
|
|
|
|
<Select.Option value='RMB'>RMB</Select.Option>
|
|
|
|
|
<Select.Option value='USD'>USD</Select.Option>
|
|
|
|
|
</Select>
|
|
|
|
|
</Form.Item>
|
|
|
|
@ -479,6 +459,8 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<Form.Item name='id' className='hidden' ><Input /></Form.Item>
|
|
|
|
|
<Form.Item name='key' className='hidden' ><Input /></Form.Item>
|
|
|
|
|
<Form.Item name='fresh' className='hidden' ><Input /></Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('products:adultPrice')}
|
|
|
|
|
name='adult_cost'
|
|
|
|
@ -571,7 +553,7 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t('products:Weekdays')}
|
|
|
|
|
name='weekdays'
|
|
|
|
|
name='weekdayList'
|
|
|
|
|
>
|
|
|
|
|
<Checkbox.Group options={['5', '6', '7']} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|