价格设置、人等增加默认值,使用颜色表示必填

perf/export-docx
Jimmy Liow 11 months ago
parent 2b9a365c45
commit 2e68c7621d

@ -2,7 +2,7 @@ import { useState } from 'react';
import { Button, Card, Checkbox, Table, Col, Flex, DatePicker, Typography, Form, Input, Row, Select, Space } from 'antd';
import dayjs from "dayjs";
import { useTranslation } from 'react-i18next';
import { CloseOutlined, StarOutlined } from '@ant-design/icons';
import { CloseOutlined, StarTwoTone, PlusOutlined } from '@ant-design/icons';
import { useDatePresets } from '@/hooks/useDatePresets';
const { Option } = Select;
const { RangePicker } = DatePicker;
@ -268,6 +268,37 @@ const BatchImportPrice = ({ onBatchImportData }) => {
]
}
const defaultPriceValue = {
"priceInput": {
"numberStart": 1,
"numberEnd": 2,
"audultPrice": 0,
"childrenPrice": 0
}
}
const defaultDefinitionValue = {
"useDate": [
dayjs().add(1, 'year').subtract(2, "M").startOf("M"), dayjs().add(1, 'year').endOf("M")
],
"unitName": "每人",
"currency": "CNY",
"weekend": [
"5",
"6"
],
"priceList": [
{
"priceInput": {
"numberStart": 1,
"numberEnd": 2,
"audultPrice": 0,
"childrenPrice": 0
}
},
]
}
return (
<Row gutter={16} justify="center">
<Col span={12}>
@ -287,7 +318,7 @@ const BatchImportPrice = ({ onBatchImportData }) => {
size="small"
title={index==0?'旺季':index==1?'淡季':'其他'}
key={field.key}
extra={index==0?null:<CloseOutlined onClick={() => {
extra={index==0?<StarTwoTone twoToneColor="#eb2f96" />:<CloseOutlined onClick={() => {
remove(field.name)
}} />}
>
@ -321,11 +352,11 @@ const BatchImportPrice = ({ onBatchImportData }) => {
<Form.Item noStyle name={[priceField.name, 'priceInput']}>
<PriceInput />
</Form.Item>
{index==0?<StarOutlined />:<CloseOutlined onClick={() => priceOptList.remove(priceField.name)} />}
{index==0?<StarTwoTone twoToneColor="#eb2f96" />:<CloseOutlined onClick={() => priceOptList.remove(priceField.name)} />}
</Space>
))}
<Button type="dashed" onClick={() => priceOptList.add()} block>
+ 新增人等
<Button type="dashed" icon={<PlusOutlined />} onClick={() => priceOptList.add(defaultPriceValue)} block>
新增人等
</Button>
</Flex>
)}
@ -333,8 +364,8 @@ const BatchImportPrice = ({ onBatchImportData }) => {
</Form.Item>
</Card>
))}
<Button type="dashed" onClick={() => add()} block>
+ 新增价格设置
<Button type="dashed" icon={<PlusOutlined />} onClick={() => add(defaultDefinitionValue)} block>
新增设置
</Button>
</Flex>
)}

Loading…
Cancel
Save