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
05e6425b
Commit
05e6425b
authored
Apr 04, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 外卖商品添加分页
parent
a8eaad86
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
15 deletions
+48
-15
GoodsGroup.jsx
src/pages/GoodsManage/Takeaway/components/GoodsGroup.jsx
+17
-12
index.jsx
src/pages/GoodsManage/Takeaway/index.jsx
+26
-3
style.less
src/pages/GoodsManage/style.less
+5
-0
No files found.
src/pages/GoodsManage/Takeaway/components/GoodsGroup.jsx
View file @
05e6425b
...
...
@@ -34,18 +34,23 @@ const GoodsGroup = options => {
};
const
getGroupList
=
async
()
=>
{
const
res
=
await
apiStorageList
({
shopId
:
options
.
shopId
,
});
if
(
res
&&
res
.
data
&&
res
.
data
.
length
>
0
)
{
const
arr
=
res
.
data
.
sort
((
x
,
y
)
=>
x
.
priority
-
y
.
priority
)
.
map
(
item
=>
({
text
:
item
.
name
,
id
:
item
.
rackId
,
}));
setTags
(
arr
);
setSelected
(
res
.
data
[
0
].
rackId
);
if
(
options
.
shopId
)
{
const
res
=
await
apiStorageList
({
shopId
:
options
.
shopId
,
});
if
(
res
&&
res
.
data
&&
res
.
data
.
length
>
0
)
{
const
arr
=
res
.
data
.
sort
((
x
,
y
)
=>
x
.
priority
-
y
.
priority
)
.
map
(
item
=>
({
text
:
item
.
name
,
id
:
item
.
rackId
,
}));
setTags
(
arr
);
setSelected
(
res
.
data
[
0
].
rackId
);
}
else
{
setTags
([]);
setSelected
(
0
);
}
}
else
{
setTags
([]);
setSelected
(
0
);
...
...
src/pages/GoodsManage/Takeaway/index.jsx
View file @
05e6425b
import
React
,
{
useState
,
useEffect
,
useCallback
,
useMemo
}
from
'
react
'
;
import
{
Spin
,
Table
,
Modal
,
message
,
notification
}
from
'
antd
'
;
import
{
Spin
,
Table
,
Pagination
,
message
,
notification
}
from
'
antd
'
;
import
{
unstable_batchedUpdates
}
from
'
react-dom
'
;
import
{
MenuOutlined
,
HolderOutlined
,
FormOutlined
,
CloseCircleOutlined
}
from
'
@ant-design/icons
'
;
import
{
SortableContainer
,
SortableElement
,
SortableHandle
}
from
'
react-sortable-hoc
'
;
...
...
@@ -21,6 +21,8 @@ const Takeaway = options => {
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
const
[
shopId
,
setShopId
]
=
useState
(
0
);
const
[
groupId
,
setGroupId
]
=
useState
(
0
);
const
[
pageNo
,
setPageNo
]
=
useState
(
1
);
const
[
pageSize
,
setPageSize
]
=
useState
(
50
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
actionLoading
,
setActionLoading
]
=
useState
(
false
);
const
[
visibleWeekTime
,
setVisibleWeekTime
]
=
useState
(
false
);
...
...
@@ -37,9 +39,9 @@ const Takeaway = options => {
const
getDataList
=
async
()
=>
{
setLoading
(
true
);
const
params
=
Object
.
assign
({},
options
.
searchValue
,
{
pageNo
:
1
,
pageNo
,
productType
:
5
,
pageSize
:
100000
,
pageSize
,
storageRackId
:
groupId
,
});
const
productCategoryId
=
options
.
searchValue
?.
productCategoryId
||
[];
...
...
@@ -51,6 +53,13 @@ const Takeaway = options => {
setTableData
(
res
.
data
.
records
);
}
};
const
onPageChange
=
(
page
,
size
)
=>
{
unstable_batchedUpdates
(()
=>
{
setPageNo
(
page
);
setPageSize
(
size
);
});
getDataList
();
};
const
onSortEnd
=
async
({
oldIndex
,
newIndex
})
=>
{
if
(
oldIndex
!==
newIndex
)
{
...
...
@@ -188,6 +197,20 @@ const Takeaway = options => {
},
}
}
/>
<
br
/>
{
(
tableData
&&
(
<
Pagination
className=
{
styles
[
'
takeawayBox--page
'
]
}
onChange=
{
onPageChange
}
total=
{
tableData
.
total
}
showTotal=
{
total
=>
`共${total}条`
}
current=
{
pageNo
}
pageSize=
{
pageSize
}
showSizeChanger
onShowSizeChange=
{
onPageChange
}
/>
))
||
''
}
</
Spin
>
<
WeekTime
visible=
{
visibleWeekTime
}
...
...
src/pages/GoodsManage/style.less
View file @
05e6425b
...
...
@@ -141,6 +141,11 @@
margin-top: 20px;
padding-bottom: 40px;
background-color: #fff;
&--page {
padding-top: 10px;
padding-left: 30px;
text-align: left;
}
}
.groupBox {
padding: 0 24px 15px 24px;
...
...
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