From 301031884bdec1b56f1e38f8c701edc503623758 Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Fri, 9 Aug 2024 11:40:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E4=BB=B7=E6=A0=BC=E5=B8=81?= =?UTF-8?q?=E7=A7=8D=E5=A2=9E=E5=8A=A0=EF=BC=9ARMB,USD,THB,JPY?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/Products/Index.js | 1 + .../products/Detail/PriceCompactInput.jsx | 6 +++-- .../products/Detail/ProductInfoQuotation.jsx | 22 +++++++++++-------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/stores/Products/Index.js b/src/stores/Products/Index.js index e326e10..618fb05 100644 --- a/src/stores/Products/Index.js +++ b/src/stores/Products/Index.js @@ -193,6 +193,7 @@ export const useProductsStore = create( const generatedList = [] defList.forEach(definition => { + // 增加多个有效日期批量设置: const mappedPriceList = definition?.priceList.map(price => { return { id: null, diff --git a/src/views/products/Detail/PriceCompactInput.jsx b/src/views/products/Detail/PriceCompactInput.jsx index dd246bb..c2b860e 100644 --- a/src/views/products/Detail/PriceCompactInput.jsx +++ b/src/views/products/Detail/PriceCompactInput.jsx @@ -1,7 +1,7 @@ import { useState } from 'react' import { Input, Space } from 'antd' -export const PriceCompactInput = (props) => { +const PriceCompactInput = (props) => { const { id, value = {}, onChange } = props const [numberStart, setNumberStart] = useState(0) const [numberEnd, setNumberEnd] = useState(0) @@ -104,4 +104,6 @@ export const PriceCompactInput = (props) => { /> ) -} \ No newline at end of file +} + +export default PriceCompactInput \ No newline at end of file diff --git a/src/views/products/Detail/ProductInfoQuotation.jsx b/src/views/products/Detail/ProductInfoQuotation.jsx index 3d59f44..7832b89 100644 --- a/src/views/products/Detail/ProductInfoQuotation.jsx +++ b/src/views/products/Detail/ProductInfoQuotation.jsx @@ -5,7 +5,7 @@ import { CloseOutlined, StarTwoTone, PlusOutlined, ExclamationCircleFilled } fro import { useDatePresets } from '@/hooks/useDatePresets' import dayjs from 'dayjs' import useProductsStore from '@/stores/Products/Index' -import PriceCompactInput from './PriceCompactInput' +import PriceCompactInput from '@/views/products/Detail/PriceCompactInput' const { RangePicker } = DatePicker @@ -290,16 +290,18 @@ const ProductInfoQuotation = ({ editable, ...props }) => { }} />} > - + + RMB + USD + THB + JPY + - + + 每人 + 每团 + { RMB USD + THB + JPY Date: Fri, 9 Aug 2024 14:26:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=97=A0=E6=95=88=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/App.jsx | 1 - src/views/products/Detail/PriceCompactInput.jsx | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/views/App.jsx b/src/views/App.jsx index fa8a61f..34b288f 100644 --- a/src/views/App.jsx +++ b/src/views/App.jsx @@ -40,7 +40,6 @@ function App() { const href = useHref() const navigate = useNavigate() - // 除了路由 /p...以外都需要登陆系统 const needToLogin = href !== '/login' && isEmpty(loginToken) useEffect(() => { diff --git a/src/views/products/Detail/PriceCompactInput.jsx b/src/views/products/Detail/PriceCompactInput.jsx index 2485b52..320d6fa 100644 --- a/src/views/products/Detail/PriceCompactInput.jsx +++ b/src/views/products/Detail/PriceCompactInput.jsx @@ -19,7 +19,7 @@ const PriceCompactInput = (props) => { } const onNumberStartChange = (e) => { const newNumber = parseInt(e.target.value || '0', 10) - if (Number.isNaN(numberStart)) { + if (Number.isNaN(newNumber)) { return } if (!('numberStart' in value)) { @@ -31,7 +31,7 @@ const PriceCompactInput = (props) => { } const onNumberEndChange = (e) => { const newNumber = parseInt(e.target.value || '0', 10) - if (Number.isNaN(numberEnd)) { + if (Number.isNaN(newNumber)) { return } if (!('numberEnd' in value)) { @@ -43,7 +43,7 @@ const PriceCompactInput = (props) => { } const onAudultPriceChange = (e) => { const newNumber = parseInt(e.target.value || '0', 10) - if (Number.isNaN(audultPrice)) { + if (Number.isNaN(newNumber)) { return } if (!('audultPrice' in value)) { @@ -55,7 +55,7 @@ const PriceCompactInput = (props) => { } const onChildrenPriceChange = (e) => { const newNumber = parseInt(e.target.value || '0', 10) - if (Number.isNaN(childrenPrice)) { + if (Number.isNaN(newNumber)) { return } if (!('childrenPrice' in value)) { @@ -106,8 +106,4 @@ const PriceCompactInput = (props) => { ) } -<<<<<<< HEAD export default PriceCompactInput -======= -export default PriceCompactInput ->>>>>>> acaf5a3de7b7197af62517e06d7fdbb7a4a48ace From f315b22b90d99d948d4f545c6f00dda371edd700 Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Fri, 9 Aug 2024 14:48:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?perf:=E5=88=A0=E9=99=A4=E6=97=A0=E6=95=88?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail/addValidityWithWeekend.jsx | 55 ------------------- 1 file changed, 55 deletions(-) delete mode 100644 src/views/products/Detail/addValidityWithWeekend.jsx diff --git a/src/views/products/Detail/addValidityWithWeekend.jsx b/src/views/products/Detail/addValidityWithWeekend.jsx deleted file mode 100644 index 1dd0005..0000000 --- a/src/views/products/Detail/addValidityWithWeekend.jsx +++ /dev/null @@ -1,55 +0,0 @@ - -import React, { useState } from 'react'; -import { DatePicker, Button } from 'antd'; -import dayjs from 'dayjs'; -import { useDatePresets } from '@/hooks/useDatePresets'; -const addValidityWithWeekend = ({ onDateChange }) => { - const dateFormat = 'YYYY/MM/DD'; - const { RangePicker } = DatePicker; - const [dateRange, setDateRange] = useState(null); - const [selectedDays, setSelectedDays] = useState([]); - const presets = useDatePresets(); - const days = [ - 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' - ]; - - - const handleChange = (date, dateString) => { - console.log("dateString",dateString) - onDateChange({ dateRange: dateString, selectedDays }); - }; - - - - const handleDayClick = (day) => { - setSelectedDays((prevSelectedDays) => { - const updatedDays = prevSelectedDays.includes(day) - ? prevSelectedDays.filter((d) => d !== day) - : [...prevSelectedDays, day]; - onDateChange({ dateRange, selectedDays: updatedDays }); - return updatedDays; - }); - }; - - return ( -
-

Data

- {} -

Weekdays

-
- {days.map((day, index) => ( - - ))} -
-
- ); -}; - -export default addValidityWithWeekend;