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
47411217
Commit
47411217
authored
Jan 12, 2023
by
武广
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/package-upgrade' into 'master'
Feature/package upgrade See merge request
!74
parents
d50542cd
c9195344
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
11 deletions
+36
-11
FormPackage.jsx
src/pages/ServiceGoods/components/FormPackage.jsx
+35
-11
index.jsx
src/pages/ServiceGoods/index.jsx
+1
-0
No files found.
src/pages/ServiceGoods/components/FormPackage.jsx
View file @
47411217
import
React
,
{
useState
,
forwardRef
,
useEffect
,
useImperativeHandle
}
from
'
react
'
;
import
React
,
{
useState
,
forwardRef
,
useEffect
,
useImperativeHandle
}
from
'
react
'
;
import
{
Form
,
Button
,
Row
,
Col
,
Input
,
Select
,
Modal
,
notification
}
from
'
antd
'
;
import
{
Form
,
Button
,
Row
,
Col
,
Input
,
Select
,
Modal
,
notification
,
Popover
}
from
'
antd
'
;
import
{
PlusOutlined
}
from
'
@ant-design/icons
'
;
import
{
PlusOutlined
}
from
'
@ant-design/icons
'
;
import
styles
from
'
../common.less
'
;
import
styles
from
'
../common.less
'
;
import
{
isIntegerNotZero
,
isCheckPriceOneDecimal
}
from
'
@/utils/validator
'
;
import
{
isIntegerNotZero
,
isCheckPriceOneDecimal
}
from
'
@/utils/validator
'
;
...
@@ -15,19 +15,29 @@ const getCaiJson = gname => ({
...
@@ -15,19 +15,29 @@ const getCaiJson = gname => ({
gName
:
gname
,
gName
:
gname
,
quantity
:
''
,
quantity
:
''
,
dishName
:
''
,
dishName
:
''
,
subtitle
:
''
,
unit
:
'
份
'
,
unit
:
'
份
'
,
price
:
''
,
price
:
''
,
skuId
:
''
,
skuId
:
''
,
});
});
const
FormCai
=
forwardRef
((
props
,
ref
)
=>
{
const
FormCai
=
forwardRef
((
props
,
ref
)
=>
{
const
{
gitem
,
groupName
,
groupkey
,
packageIndex
}
=
props
;
const
{
gitem
,
groupName
,
groupkey
,
packageIndex
,
form
,
groupIndex
}
=
props
;
const
lists
=
form
.
getFieldValue
(
'
lists
'
);
const
subTitles
=
lists
[
packageIndex
].
children
[
groupIndex
].
dishes
.
map
(
item
=>
item
.
subtitle
);
const
[
subTitle
,
setSubTitle
]
=
useState
(
subTitles
);
const
onDel
=
(
callback
,
name
,
key
)
=>
{
const
onDel
=
(
callback
,
name
,
key
)
=>
{
// callback(name);
// callback(name);
props
.
onDelCai
(
packageIndex
,
groupkey
,
key
);
props
.
onDelCai
(
packageIndex
,
groupkey
,
key
);
};
};
const
onChange
=
(
e
,
i
)
=>
{
const
{
value
}
=
e
.
target
;
const
arr
=
[...
subTitle
];
arr
[
i
]
=
value
;
setSubTitle
(
arr
);
};
const
onAdd
=
(
callback
,
key
)
=>
{
const
onAdd
=
(
callback
,
key
)
=>
{
if
(
props
.
onAddCai
(
packageIndex
,
groupkey
))
{
if
(
props
.
onAddCai
(
packageIndex
,
groupkey
))
{
callback
(
getCaiJson
(
groupName
));
callback
(
getCaiJson
(
groupName
));
...
@@ -40,7 +50,7 @@ const FormCai = forwardRef((props, ref) => {
...
@@ -40,7 +50,7 @@ const FormCai = forwardRef((props, ref) => {
<>
<>
{
items
.
map
(({
key
,
name
},
caiIndex
)
=>
(
{
items
.
map
(({
key
,
name
},
caiIndex
)
=>
(
<
Row
gutter=
{
24
}
key=
{
`cai_${key}`
}
className=
{
styles
.
caiRow
}
>
<
Row
gutter=
{
24
}
key=
{
`cai_${key}`
}
className=
{
styles
.
caiRow
}
>
<
Col
span=
{
5
}
>
<
Col
span=
{
3
}
>
<
Form
.
Item
name=
{
[
name
,
'
gName
'
]
}
>
<
Form
.
Item
name=
{
[
name
,
'
gName
'
]
}
>
<
Input
readOnly
hidden
/>
<
Input
readOnly
hidden
/>
<
span
>
{
groupName
}
</
span
>
<
span
>
{
groupName
}
</
span
>
...
@@ -80,7 +90,7 @@ const FormCai = forwardRef((props, ref) => {
...
@@ -80,7 +90,7 @@ const FormCai = forwardRef((props, ref) => {
</
Select
>
</
Select
>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
<
Col
span=
{
4
}
>
<
Col
span=
{
3
}
>
<
Form
.
Item
<
Form
.
Item
name=
{
[
name
,
'
price
'
]
}
name=
{
[
name
,
'
price
'
]
}
rules=
{
[
rules=
{
[
...
@@ -91,7 +101,18 @@ const FormCai = forwardRef((props, ref) => {
...
@@ -91,7 +101,18 @@ const FormCai = forwardRef((props, ref) => {
<
Input
maxLength=
{
10
}
/>
<
Input
maxLength=
{
10
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
<
Col
span=
{
3
}
>
<
Col
span=
{
4
}
>
<
Popover
content=
{
()
=>
subTitle
[
caiIndex
]
}
trigger=
"hover"
>
<
Form
.
Item
name=
{
[
name
,
'
subtitle
'
]
}
onChange=
{
e
=>
onChange
(
e
,
caiIndex
)
}
// rules=
{[{
required
:
true
,
message
:
'请输入副标题'
}]}
>
<
Input
maxLength=
{
100
}
placeholder=
"最多100个字"
/>
</
Form
.
Item
>
</
Popover
>
</
Col
>
<
Col
span=
{
2
}
>
<
Button
type=
"link"
onClick=
{
()
=>
onDel
(
remove
,
name
,
key
)
}
>
<
Button
type=
"link"
onClick=
{
()
=>
onDel
(
remove
,
name
,
key
)
}
>
删除
删除
</
Button
>
</
Button
>
...
@@ -118,15 +139,16 @@ const FormGroup = forwardRef((props, ref) => {
...
@@ -118,15 +139,16 @@ const FormGroup = forwardRef((props, ref) => {
<
Form
.
List
name=
{
item
}
>
<
Form
.
List
name=
{
item
}
>
{
(
items
,
{
add
,
remove
})
=>
(
{
(
items
,
{
add
,
remove
})
=>
(
<>
<>
{
items
.
map
(({
key
,
name
})
=>
(
{
items
.
map
(({
key
,
name
}
,
index
)
=>
(
<
div
className=
{
styles
.
groupMargin
}
key=
{
`group_${key}`
}
>
<
div
className=
{
styles
.
groupMargin
}
key=
{
`group_${key}`
}
>
<
Row
gutter=
{
24
}
className=
{
styles
.
groupHeader
}
>
<
Row
gutter=
{
24
}
className=
{
styles
.
groupHeader
}
>
<
Col
span=
{
5
}
>
组名
</
Col
>
<
Col
span=
{
3
}
>
组名
</
Col
>
<
Col
span=
{
3
}
>
数量
</
Col
>
<
Col
span=
{
3
}
>
数量
</
Col
>
<
Col
span=
{
4
}
>
菜名
</
Col
>
<
Col
span=
{
4
}
>
标题
</
Col
>
<
Col
span=
{
2
}
>
单位
</
Col
>
<
Col
span=
{
2
}
>
单位
</
Col
>
<
Col
span=
{
4
}
>
价格
</
Col
>
<
Col
span=
{
3
}
>
价格
</
Col
>
<
Col
span=
{
3
}
>
操作
</
Col
>
<
Col
span=
{
4
}
>
副标题
</
Col
>
<
Col
span=
{
2
}
>
操作
</
Col
>
<
Col
span=
{
3
}
>
<
Col
span=
{
3
}
>
<
div
>
<
div
>
<
Form
.
Item
name=
{
[
name
,
'
groupName
'
]
}
>
<
Form
.
Item
name=
{
[
name
,
'
groupName
'
]
}
>
...
@@ -138,6 +160,8 @@ const FormGroup = forwardRef((props, ref) => {
...
@@ -138,6 +160,8 @@ const FormGroup = forwardRef((props, ref) => {
<
FormCai
<
FormCai
gitem=
{
[
name
,
'
dishes
'
]
}
gitem=
{
[
name
,
'
dishes
'
]
}
packageIndex=
{
packageIndex
}
packageIndex=
{
packageIndex
}
groupIndex=
{
index
}
form=
{
form
}
groupkey=
{
key
}
groupkey=
{
key
}
onAddCai=
{
onAddCai
}
onAddCai=
{
onAddCai
}
onDelCai=
{
onDelCai
}
onDelCai=
{
onDelCai
}
...
...
src/pages/ServiceGoods/index.jsx
View file @
47411217
...
@@ -92,6 +92,7 @@ const ServiceGoods = options => {
...
@@ -92,6 +92,7 @@ const ServiceGoods = options => {
setPageLoading
(
true
);
setPageLoading
(
true
);
setCategoryIds
([]);
setCategoryIds
([]);
setVisibleCacheEdit
(
false
);
setVisibleCacheEdit
(
false
);
resetForm
();
const
timer
=
setTimeout
(()
=>
{
const
timer
=
setTimeout
(()
=>
{
setPageLoading
(
false
);
setPageLoading
(
false
);
resetForm
();
resetForm
();
...
...
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