Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
merchant-manage-ui
Commits
822cd441
Commit
822cd441
authored
Jun 29, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 优化可售日期
parent
d7d30b15
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
11 deletions
+53
-11
SaleDateModal.jsx
src/pages/businessGoods/components/SaleDateModal.jsx
+38
-5
index.less
src/pages/businessGoods/style/index.less
+5
-0
takeawayGoods.jsx
src/pages/businessGoods/takeawayGoods.jsx
+10
-6
No files found.
src/pages/businessGoods/components/SaleDateModal.jsx
View file @
822cd441
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
Checkbox
,
Space
,
message
,
Modal
,
notification
}
from
'
antd
'
;
import
{
Checkbox
,
Space
,
message
,
Modal
,
notification
,
Button
}
from
'
antd
'
;
import
{
weekOptions
}
from
'
../staticData/goods
'
;
import
{
weekOptions
}
from
'
../staticData/goods
'
;
import
{
apiMealInfoUpdate
,
apiCheckInfo
}
from
'
../service
'
;
import
{
apiMealInfoUpdate
,
apiCheckInfo
}
from
'
../service
'
;
import
style
from
'
../style/index.less
'
;
const
SaleDateModal
=
props
=>
{
const
SaleDateModal
=
props
=>
{
const
[
value
,
setValue
]
=
useState
([]);
const
[
value
,
setValue
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
checkAll
,
setCheckAll
]
=
useState
(
false
);
// 关闭弹窗
// 关闭弹窗
const
handleCancel
=
()
=>
{
const
handleCancel
=
()
=>
{
...
@@ -13,6 +16,7 @@ const SaleDateModal = props => {
...
@@ -13,6 +16,7 @@ const SaleDateModal = props => {
const
onChangeWeek
=
e
=>
{
const
onChangeWeek
=
e
=>
{
setValue
(
e
);
setValue
(
e
);
setCheckAll
(
e
?.
length
===
7
);
};
};
// 提交
// 提交
...
@@ -35,7 +39,9 @@ const SaleDateModal = props => {
...
@@ -35,7 +39,9 @@ const SaleDateModal = props => {
data
.
push
(
obj
);
data
.
push
(
obj
);
}
}
});
});
setLoading
(
true
);
const
res
=
await
apiCheckInfo
(
data
);
const
res
=
await
apiCheckInfo
(
data
);
setLoading
(
false
);
if
(
!
res
||
!
res
.
success
)
{
if
(
!
res
||
!
res
.
success
)
{
return
;
return
;
}
}
...
@@ -45,7 +51,9 @@ const SaleDateModal = props => {
...
@@ -45,7 +51,9 @@ const SaleDateModal = props => {
id
:
props
.
id
,
id
:
props
.
id
,
saleDateList
:
value
,
saleDateList
:
value
,
};
};
setLoading
(
true
);
await
apiMealInfoUpdate
(
params
);
await
apiMealInfoUpdate
(
params
);
setLoading
(
false
);
notification
.
success
({
message
:
'
保存成功
'
});
notification
.
success
({
message
:
'
保存成功
'
});
}
}
handleCancel
();
handleCancel
();
...
@@ -70,20 +78,45 @@ const SaleDateModal = props => {
...
@@ -70,20 +78,45 @@ const SaleDateModal = props => {
return
`
${
item
}
`
;
return
`
${
item
}
`
;
});
});
}
}
setCheckAll
(
v
.
length
===
7
);
setValue
(
v
);
setValue
(
v
);
}
}
},
[
props
.
visible
]);
},
[
props
.
visible
]);
// 全选事件
const
onCheckAll
=
e
=>
{
if
(
e
.
target
.
checked
)
{
setValue
(
Object
.
keys
(
weekOptions
).
map
(
w
=>
`
${
w
}
`
));
}
else
{
setValue
([]);
}
setCheckAll
(
e
.
target
.
checked
);
};
// 弹窗底部
const
footerComponent
=
[
<
div
key=
"footer"
className=
{
style
.
modalFooters
}
>
<
Checkbox
checked=
{
checkAll
}
onChange=
{
onCheckAll
}
>
全选
</
Checkbox
>
<
div
>
<
Button
onClick=
{
handleCancel
}
>
取消
</
Button
>
<
Button
type=
"primary"
loading=
{
loading
}
onClick=
{
handleConfirm
}
>
{
'
'
}
保存
{
'
'
}
</
Button
>
</
div
>
</
div
>,
];
return
(
return
(
<
Modal
<
Modal
title=
{
props
.
title
||
'
设置可售日期
'
}
title=
{
props
.
title
||
'
设置可售日期
'
}
open=
{
props
.
visible
}
open=
{
props
.
visible
}
destroyOnClose
destroyOnClose
maskClosable=
{
false
}
maskClosable=
{
false
}
width=
"200px"
width=
"300px"
okText=
"保存"
footer=
{
footerComponent
}
onOk=
{
handleConfirm
}
onCancel=
{
handleCancel
}
>
>
<
Checkbox
.
Group
onChange=
{
onChangeWeek
}
value=
{
value
}
>
<
Checkbox
.
Group
onChange=
{
onChangeWeek
}
value=
{
value
}
>
<
Space
direction=
"vertical"
>
<
Space
direction=
"vertical"
>
...
...
src/pages/businessGoods/style/index.less
View file @
822cd441
...
@@ -75,3 +75,8 @@
...
@@ -75,3 +75,8 @@
.columnBtnEdit {
.columnBtnEdit {
cursor: pointer;
cursor: pointer;
}
}
.modalFooters {
display: flex;
align-items: center;
justify-content: space-between;
}
src/pages/businessGoods/takeawayGoods.jsx
View file @
822cd441
...
@@ -35,10 +35,14 @@ const TakeawayGoods = () => {
...
@@ -35,10 +35,14 @@ const TakeawayGoods = () => {
const
[
editItem
,
setEditItem
]
=
useState
({});
// 编辑的记录信息
const
[
editItem
,
setEditItem
]
=
useState
({});
// 编辑的记录信息
// 刷新列表
// 刷新列表
const
onRefresh
=
()
=>
{
const
onRefresh
=
isReset
=>
{
if
(
pageLoaded
)
{
if
(
!
pageLoaded
)
{
refTable
.
current
.
reloadAndRest
();
return
;
// refTable.current.reload();
}
if
(
isReset
)
{
refTable
?.
current
?.
reloadAndRest
();
}
else
{
refTable
?.
current
?.
reload
();
}
}
};
};
...
@@ -118,7 +122,7 @@ const TakeawayGoods = () => {
...
@@ -118,7 +122,7 @@ const TakeawayGoods = () => {
const
pid
=
`
${
obj
?.
pickSelfId
||
''
}
`;
const
pid
=
`
${
obj
?.
pickSelfId
||
''
}
`;
setActiveKey(`
$
{
pid
}
`);
setActiveKey(`
$
{
pid
}
`);
if (pageLoaded) {
if (pageLoaded) {
onRefresh();
onRefresh(
true
);
}
}
};
};
...
@@ -196,7 +200,7 @@ const TakeawayGoods = () => {
...
@@ -196,7 +200,7 @@ const TakeawayGoods = () => {
items: pickSelfList,
items: pickSelfList,
onChange: key => {
onChange: key => {
setActiveKey(`
$
{
key
}
`);
setActiveKey(`
$
{
key
}
`);
onRefresh();
onRefresh(
true
);
},
},
},
},
actions: [
actions: [
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment