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
ede5c396
Commit
ede5c396
authored
Jun 14, 2023
by
张子雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 接口联调
parent
dc9da6aa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
116 additions
and
65 deletions
+116
-65
viewDepartmentModal.jsx
...ges/EmployeeManagement/components/viewDepartmentModal.jsx
+1
-1
index.jsx
src/pages/EmployeeManagement/index.jsx
+1
-1
index.jsx
src/pages/StoreManagement/addModal/index.jsx
+17
-16
data.js
src/pages/StoreManagement/data.js
+18
-9
index.jsx
src/pages/StoreManagement/editRepastModal/index.jsx
+37
-21
index.jsx
src/pages/StoreManagement/index.jsx
+42
-17
No files found.
src/pages/EmployeeManagement/components/viewDepartmentModal.jsx
View file @
ede5c396
...
...
@@ -111,7 +111,7 @@ const ViewDepartmentModal = ({ visible, onClose, enterpriseList }) => {
const
pagination
=
{
...
pageInfo
,
total
,
showTotal
:
t
=>
`共
${
t
}
项数据
`
,
showTotal
:
t
=>
`共
${
t
}
条
`
,
onChange
,
onShowSizeChange
:
onChange
,
};
...
...
src/pages/EmployeeManagement/index.jsx
View file @
ede5c396
...
...
@@ -212,7 +212,7 @@ const StoreManagement = () => {
const
pagination
=
{
...
page
,
total
,
showTotal
:
t
=>
`共
${
t
}
项数据
`
,
showTotal
:
t
=>
`共
${
t
}
条
`
,
onChange
,
onShowSizeChange
:
onChange
,
};
...
...
src/pages/StoreManagement/addModal/index.jsx
View file @
ede5c396
...
...
@@ -4,11 +4,13 @@ import styles from '../index.less';
import
{
apiSelectedList
,
apiSelectList
,
apiShopAdd
}
from
'
../service.js
'
;
const
AddModal
=
props
=>
{
const
[
form
]
=
Form
.
useForm
();
const
{
addVisible
,
enterpriseId
,
name
,
onCancel
}
=
props
;
const
[
selectList
,
setSelectList
]
=
useState
([]);
const
[
options
,
setOptions
]
=
useState
([]);
const
handleCancel
=
()
=>
{
onCancel
(
false
);
const
handleCancel
=
status
=>
{
form
.
resetFields
();
onCancel
(
status
,
'
add
'
);
};
const
handleChange
=
value
=>
{
setSelectList
(
value
);
...
...
@@ -25,7 +27,7 @@ const AddModal = props => {
notification
.
success
({
message
:
'
添加成功
'
,
});
props
.
on
Cancel
(
true
);
handle
Cancel
(
true
);
}
};
const
getSelectedList
=
async
()
=>
{
...
...
@@ -36,6 +38,7 @@ const AddModal = props => {
data
.
forEach
(
item
=>
{
list
.
push
(
item
.
shopId
);
});
form
.
setFieldsValue
({
shopIds
:
list
});
setSelectList
(
list
);
}
};
...
...
@@ -59,22 +62,20 @@ const AddModal = props => {
return
(
<>
<
Modal
title=
"添加企业店铺"
onOk=
{
onOk
}
visible=
{
addVisible
}
onCancel=
{
handleCancel
}
>
<
Form
>
<
Form
form=
{
form
}
>
<
Form
.
Item
label=
"企业名称"
>
<
span
>
{
name
}
</
span
>
</
Form
.
Item
>
{
selectList
&&
selectList
.
length
>
0
&&
(
<
Form
.
Item
label=
"添加微店"
name=
"shopIds"
initialValue=
{
selectList
}
>
<
Select
mode=
"multiple"
allowClear
style=
{
{
width
:
'
100%
'
}
}
placeholder=
"请选择微店"
onChange=
{
handleChange
}
options=
{
options
}
/>
</
Form
.
Item
>
)
}
<
Form
.
Item
label=
"添加微店"
name=
"shopIds"
initialValue=
{
selectList
}
>
<
Select
mode=
"multiple"
allowClear
style=
{
{
width
:
'
100%
'
}
}
placeholder=
"请选择微店"
onChange=
{
handleChange
}
options=
{
options
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"餐饮类型"
>
<
span
>
到店
</
span
>
</
Form
.
Item
>
...
...
src/pages/StoreManagement/data.js
View file @
ede5c396
...
...
@@ -17,6 +17,17 @@ export const repastTypeList = [
},
];
const
repastType
=
list
=>
{
if
(
list
.
includes
(
4
)
&&
list
.
length
>
1
)
{
return
list
.
filter
(
item
=>
item
!==
4
)
.
map
(
item
=>
{
const
name
=
repastTypeList
.
find
(
i
=>
i
.
value
===
item
)?.
label
;
return
name
?
`
${
name
}
/到店`
:
null
;
});
}
return
'
到店
'
;
};
export
const
columns
=
props
=>
[
{
title
:
'
微店ID
'
,
...
...
@@ -36,14 +47,12 @@ export const columns = props => [
dataIndex
:
'
mealType
'
,
align
:
'
center
'
,
render
:
(
_
,
row
)
=>
{
const
status
=
!
row
?.
pick
selfName
;
const
status
=
!
row
?.
pick
NameList
?.
length
;
const
isArray
=
Array
.
isArray
(
row
?.
mealType
);
if
(
isArray
)
{
return
(
<
Button
type
=
"
text
"
disabled
=
{
status
}
onClick
=
{()
=>
props
.
editRepastType
(
row
)}
>
{
row
.
mealType
?.
map
((
item
,
index
)
=>
(
<
span
>
{
repastTypeList
.
find
(
itm
=>
itm
.
value
===
item
)?.
label
}
&
nbsp
;
<
/span
>
))}
{
repastType
(
row
?.
mealType
)}
<
FormOutlined
/>
<
/Button
>
);
...
...
@@ -53,15 +62,15 @@ export const columns = props => [
},
{
title
:
'
所属企业取餐点
'
,
key
:
'
pick
selfName
'
,
dataIndex
:
'
pick
selfName
'
,
key
:
'
pick
NameList
'
,
dataIndex
:
'
pick
NameList
'
,
align
:
'
center
'
,
render
:
(
text
,
record
)
=>
{
if
(
record
.
pick
selfName
?.
length
)
{
if
(
record
.
pick
NameList
?.
length
)
{
return
text
.
map
((
item
,
index
)
=>
(
<
span
>
<
span
key
=
{
item
}
>
{
item
}
{
index
<
record
.
pick
selfName
.
length
-
1
&&
'
,
'
}
{
index
<
record
.
pick
NameList
.
length
-
1
&&
'
,
'
}
<
/span
>
));
}
...
...
src/pages/StoreManagement/editRepastModal/index.jsx
View file @
ede5c396
import
React
,
{
useState
,
useEffect
,
forwardRef
,
useRef
,
useImperativeHandle
}
from
'
react
'
;
import
{
Button
,
Modal
,
Radio
,
Form
,
Space
,
message
,
Checkbox
,
Col
,
Row
}
from
'
antd
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
{
Modal
,
Radio
,
Form
,
Space
,
message
,
Checkbox
}
from
'
antd
'
;
import
styles
from
'
../index.less
'
;
import
{
apiShopUpdate
}
from
'
../service.js
'
;
import
{
apiShopUpdate
,
busineesTypeCheck
}
from
'
../service.js
'
;
const
EditRepastModal
=
props
=>
{
const
[
form
]
=
Form
.
useForm
();
const
{
editVisible
,
repastType
,
id
}
=
props
;
const
handleCancel
=
()
=>
{
props
.
onCancel
();
const
{
editVisible
,
repastType
,
id
,
enterpriseId
,
isStore
}
=
props
;
const
handleCancel
=
status
=>
{
form
.
resetFields
();
props
.
onCancel
(
status
,
'
edit
'
);
};
const
onOk
=
()
=>
{
form
.
validateFields
().
then
(
async
values
=>
{
console
.
log
(
values
);
const
store
=
values
?.
store
||
''
;
const
mealTypeList
=
[...
values
.
mealTypeList
,
...
store
];
const
params
=
{
id
,
mealTypeList
:
values
.
mealTypeList
,
mealTypeList
,
};
const
res
=
await
apiShopUpdate
(
params
);
if
(
res
.
businessCode
===
'
0000
'
)
{
...
...
@@ -22,31 +27,42 @@ const EditRepastModal = props => {
}
});
};
return
(
<>
<
Modal
title=
"餐饮类型"
onOk=
{
onOk
}
visible=
{
editVisible
}
onCancel=
{
()
=>
handleCancel
()
}
>
<
Form
layout=
"vertical"
autoComplete=
"off"
form=
{
form
}
>
<
Modal
title=
"餐饮类型"
onOk=
{
onOk
}
visible=
{
editVisible
}
onCancel=
{
()
=>
handleCancel
(
false
)
}
>
<
Form
layout=
"vertical"
form=
{
form
}
>
<
Form
.
Item
label=
"取餐点下商户餐品类型"
rules=
{
[{
required
:
true
,
message
:
'
请选择商户餐品类型
'
}]
}
name=
"mealTypeList"
>
<
Checkbox
.
Group
>
<
Space
direction=
"mealTypeList"
>
{
(
repastType
.
length
&&
repastType
.
map
((
index
,
value
)
=>
<
Checkbox
>
{
index
}
</
Checkbox
>))
||
''
}
</
Space
>
</
Checkbox
.
Group
>
<
p
className=
{
styles
.
tip
}
>
切换餐品类型后,请及时维护商品
</
p
>
</
Form
.
Item
>
<
Form
.
Item
label=
"是否开启餐品类型"
>
<
Checkbox
.
Group
>
<
Space
direction=
"vertical"
>
<
Checkbox
>
到店
</
Checkbox
>
{
repastType
.
map
(
item
=>
(
<
Checkbox
value=
{
item
.
value
}
key=
{
item
.
value
}
>
{
item
.
label
}
</
Checkbox
>
))
}
</
Space
>
<
p
className=
{
styles
.
tip
}
>
切换餐品类型后,请及时维护商品
</
p
>
</
Checkbox
.
Group
>
<
p
className=
{
styles
.
tip
}
>
关闭【到店】餐类时,关联到店企业商品将一并删除
</
p
>
</
Form
.
Item
>
{
isStore
&&
(
<
Form
.
Item
label=
"是否开启餐品类型"
name=
"store"
>
<
Checkbox
.
Group
>
<
Space
direction=
"vertical"
>
<
Checkbox
value=
{
4
}
>
到店
</
Checkbox
>
</
Space
>
<
p
className=
{
styles
.
tip
}
>
关闭【到店】餐类时,关联到店企业商品将一并删除
</
p
>
</
Checkbox
.
Group
>
</
Form
.
Item
>
)
}
</
Form
>
</
Modal
>
</>
...
...
src/pages/StoreManagement/index.jsx
View file @
ede5c396
...
...
@@ -2,6 +2,7 @@ import React, { useState, useRef, forwardRef, useEffect } from 'react';
import
{
PageHeaderWrapper
}
from
'
@ant-design/pro-layout
'
;
import
{
Modal
,
Form
,
Select
,
Table
,
Card
,
Row
,
Col
,
Input
,
Button
,
message
}
from
'
antd
'
;
import
{
set
}
from
'
lodash
'
;
import
{
da
}
from
'
date-fns/locale
'
;
import
{
columns
,
repastTypeList
}
from
'
./data
'
;
import
EditRepastModal
from
'
./editRepastModal
'
;
import
AddModal
from
'
./addModal
'
;
...
...
@@ -32,7 +33,7 @@ const StoreManagement = () => {
const
[
enterprise
,
setEnterprise
]
=
useState
({});
const
[
dataList
,
setDataList
]
=
useState
([]);
const
[
name
,
setName
]
=
useState
(
''
);
const
[
isStore
,
setIsStore
]
=
useState
(
false
);
const
shopList
=
async
params
=>
{
const
res
=
await
setShopList
(
params
);
if
(
res
.
businessCode
===
'
0000
'
)
{
...
...
@@ -63,25 +64,45 @@ const StoreManagement = () => {
},
[]);
// 关闭弹框
const
closeModal
=
value
=>
{
if
(
value
)
{
shopList
({
data
:
searchForm
,
...
page
});
const
closeModal
=
(
status
,
val
)
=>
{
if
(
status
)
{
const
pageInfo
=
{
page
:
1
,
size
:
10
,
};
setPage
(
pageInfo
);
shopList
({
data
:
searchForm
,
...
pageInfo
});
}
if
(
val
===
'
edit
'
)
{
setIsStore
(
false
);
setEditVisible
(
false
);
setRepastType
([]);
return
;
}
set
EditVisibl
e
(
false
);
set
Nam
e
(
false
);
setAddVisible
(
false
);
};
const
setMealTypeList
=
async
()
=>
{
setEditVisible
(
true
);
const
res
=
await
mealTypeList
({
id
:
repastId
});
const
setMealTypeList
=
async
id
=>
{
const
res
=
await
mealTypeList
({
id
});
if
(
res
.
businessCode
===
'
0000
'
)
{
setRepastType
(
res
.
data
);
const
resData
=
res
.
data
;
const
data
=
[];
repastTypeList
.
forEach
(
item
=>
{
if
(
resData
.
includes
(
item
.
value
)
&&
item
.
value
!==
4
)
{
data
.
push
(
item
);
}
});
if
(
resData
.
includes
(
4
))
{
setIsStore
(
true
);
}
setRepastType
(
data
);
setEditVisible
(
true
);
}
};
// 修改餐饮类型
const
editRepastType
=
({
id
})
=>
{
setRepastId
(
id
);
setMealTypeList
();
setMealTypeList
(
id
);
};
// 删除
const
editShop
=
async
id
=>
{
...
...
@@ -137,15 +158,20 @@ const StoreManagement = () => {
shopList
({
data
:
{
enterpriseId
:
firstEnterprise
},
...
pageInfo
});
};
// 分页
const
handleTableChange
=
val
=>
{
setPage
(
val
);
const
handleTableChange
=
(
pageNo
,
size
)
=>
{
const
pageInfo
=
{
page
:
pageNo
,
size
,
};
setPage
(
pageInfo
);
shopList
({
data
:
searchForm
,
...
pageInfo
});
};
const
pagination
=
{
...
page
,
total
,
showTotal
:
t
=>
`共
${
t
}
项数据
`
,
handleTableChange
,
showTotal
:
t
=>
`共
${
t
}
条
`
,
onChange
:
handleTableChange
,
onShowSizeChange
:
handleTableChange
,
};
...
...
@@ -168,8 +194,6 @@ const StoreManagement = () => {
initialValue=
{
firstEnterprise
}
>
<
Select
allowClear
showSearch
filterOption=
{
(
input
,
option
)
=>
(
option
?.
label
??
''
).
toLowerCase
().
includes
(
input
.
toLowerCase
())
}
...
...
@@ -223,7 +247,6 @@ const StoreManagement = () => {
dataSource=
{
dataList
}
rowKey=
{
r
=>
r
.
id
}
bordered
// onChange={handleTableChange}
pagination=
{
pagination
}
/>
<
EditRepastModal
...
...
@@ -231,6 +254,8 @@ const StoreManagement = () => {
repastType=
{
repastType
}
id=
{
repastId
}
onCancel=
{
closeModal
}
enterpriseId=
{
searchForm
.
enterpriseId
}
isStore=
{
isStore
}
/>
<
AddModal
addVisible=
{
addVisible
}
...
...
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