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
0f8e5501
Commit
0f8e5501
authored
Mar 27, 2023
by
陈万宝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修改表单
parent
36782629
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
6 deletions
+41
-6
FormInformationBasic.jsx
src/pages/ServiceGoods/components/FormInformationBasic.jsx
+41
-6
No files found.
src/pages/ServiceGoods/components/FormInformationBasic.jsx
View file @
0f8e5501
...
@@ -12,6 +12,7 @@ import { ServiceContext } from '../context';
...
@@ -12,6 +12,7 @@ import { ServiceContext } from '../context';
import
{
debounce
}
from
'
@/utils/utils
'
;
import
{
debounce
}
from
'
@/utils/utils
'
;
import
AddMenusModal
from
'
./AddMenusModal
'
;
import
AddMenusModal
from
'
./AddMenusModal
'
;
import
UploadImage
from
'
./UploadImage
'
;
import
UploadImage
from
'
./UploadImage
'
;
import
{
apiShopIds
,
apiQueryShopList
}
from
'
../service
'
;
const
CreateSelectOption
=
optionList
=>
const
CreateSelectOption
=
optionList
=>
optionList
.
map
(
brandItem
=>
(
optionList
.
map
(
brandItem
=>
(
...
@@ -32,16 +33,16 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -32,16 +33,16 @@ const FormInformationBasic = forwardRef((props, ref) => {
categoryList
,
categoryList
,
virtualCategoryList
,
virtualCategoryList
,
brandList
,
brandList
,
shopList
,
afterAddressList
,
afterAddressList
,
specListData
,
specListData
,
queryShopList
,
}
=
props
;
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
[
noreBrandList
,
setNoreBrandList
]
=
useState
([]);
const
[
noreBrandList
,
setNoreBrandList
]
=
useState
([]);
const
customer
=
useContext
(
ServiceContext
);
const
customer
=
useContext
(
ServiceContext
);
const
childAddMenusModalRef
=
useRef
(
null
);
const
childAddMenusModalRef
=
useRef
(
null
);
const
[
takeawayImageList
,
setTakeawayImageList
]
=
useState
([]);
const
[
takeawayImageList
,
setTakeawayImageList
]
=
useState
([]);
const
[
shopIds
,
setShopIds
]
=
useState
([]);
const
[
shopList
,
setShopList
]
=
useState
([]);
const
onCheck
=
async
()
=>
{
const
onCheck
=
async
()
=>
{
try
{
try
{
...
@@ -101,7 +102,25 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -101,7 +102,25 @@ const FormInformationBasic = forwardRef((props, ref) => {
const
values
=
form
.
getFieldsValue
();
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
({
infoMation
:
values
});
props
.
onValuesChange
({
infoMation
:
values
});
},
400
);
},
400
);
// 查询shopIds
const
queryShopIds
=
async
()
=>
{
if
(
!
shopIds
.
length
)
{
const
result
=
await
apiShopIds
();
setShopIds
(
result
.
data
||
[]);
}
};
// 查询分组列表
const
queryShopList
=
async
params
=>
{
if
(
!
shopList
.
length
)
{
const
result
=
await
apiQueryShopList
(
params
);
setShopList
(
result
.
data
||
[]);
}
};
const
onChangeShopId
=
async
e
=>
{
if
(
e
)
{
queryShopList
({
shopId
:
e
});
// 分组列表
}
};
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
onCheck
,
onCheck
,
reset
:
form
.
resetFields
,
reset
:
form
.
resetFields
,
...
@@ -121,6 +140,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -121,6 +140,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
console
.
log
(
'
!customer.isTakeawayService
'
,
customer
);
console
.
log
(
'
!customer.isTakeawayService
'
,
customer
);
console
.
log
(
'
newCategoryList[customer.productType]
'
,
newCategoryList
[
customer
.
productType
]);
console
.
log
(
'
newCategoryList[customer.productType]
'
,
newCategoryList
[
customer
.
productType
]);
console
.
log
(
'
newCategoryList[customer.productType]
'
,
shopList
);
console
.
log
(
'
newCategoryList[customer.productType]
'
,
shopList
);
queryShopIds
()
},
[
customer
.
productType
]);
},
[
customer
.
productType
]);
return
(
return
(
<
Form
<
Form
...
@@ -148,11 +168,25 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -148,11 +168,25 @@ const FormInformationBasic = forwardRef((props, ref) => {
<
Input
placeholder=
"请输入商品名称"
disabled=
{
customer
.
isDisabled
}
/>
<
Input
placeholder=
"请输入商品名称"
disabled=
{
customer
.
isDisabled
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Popover
>
</
Popover
>
{
customer
.
isTakeawayService
&&
(
<
Form
.
Item
name=
"productRefShopId"
key=
"productRefShopId"
label=
"所属门店"
rules=
{
[{
required
:
true
,
message
:
'
请选择所属门店
'
}]
}
>
<
Select
fieldNames=
{
{
label
:
'
name
'
,
value
:
'
id
'
}
}
placeholder=
"请选择所属门店"
options=
{
shopIds
}
onChange=
{
onChangeShopId
}
></
Select
>
</
Form
.
Item
>
)
}
{
/* 菜单分组 */
}
{
/* 菜单分组 */
}
{
customer
.
isTakeawayService
&&
(
{
customer
.
isTakeawayService
&&
(
<
Form
.
Item
<
Form
.
Item
name=
"
categoryId
"
name=
"
storageRackIds
"
label=
"菜单分组"
label=
"菜单分组"
rules=
{
[{
type
:
'
array
'
,
required
:
true
,
message
:
'
请输入菜单分组
'
}]
}
rules=
{
[{
type
:
'
array
'
,
required
:
true
,
message
:
'
请输入菜单分组
'
}]
}
>
>
...
@@ -170,7 +204,8 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -170,7 +204,8 @@ const FormInformationBasic = forwardRef((props, ref) => {
{
/* 新增菜单分组弹框 */
}
{
/* 新增菜单分组弹框 */
}
<
AddMenusModal
ref=
{
childAddMenusModalRef
}
queryShopList=
{
queryShopList
}
/>
<
AddMenusModal
ref=
{
childAddMenusModalRef
}
queryShopList=
{
queryShopList
}
/>
<
Form
.
Item
<
Form
.
Item
name=
"storageRackIds"
name=
"categoryId"
key=
"categoryId"
label=
"商品类目"
label=
"商品类目"
rules=
{
[{
type
:
'
array
'
,
required
:
true
,
message
:
'
请输入商品类目
'
}]
}
rules=
{
[{
type
:
'
array
'
,
required
:
true
,
message
:
'
请输入商品类目
'
}]
}
>
>
...
...
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