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
c3672f3a
Commit
c3672f3a
authored
Apr 06, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改排序问题
parent
03c6c890
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
14 deletions
+54
-14
DragTag.jsx
src/pages/GoodsManage/Takeaway/components/DragTag.jsx
+2
-2
GoodsGroup.jsx
src/pages/GoodsManage/Takeaway/components/GoodsGroup.jsx
+4
-2
WeekTime.jsx
src/pages/GoodsManage/Takeaway/components/WeekTime.jsx
+16
-0
index.jsx
src/pages/GoodsManage/Takeaway/index.jsx
+23
-8
service.js
src/pages/GoodsManage/service.js
+7
-0
staticdata.js
src/pages/GoodsManage/staticdata.js
+2
-2
No files found.
src/pages/GoodsManage/Takeaway/components/DragTag.jsx
View file @
c3672f3a
...
@@ -7,7 +7,7 @@ import styles from '../../style.less';
...
@@ -7,7 +7,7 @@ import styles from '../../style.less';
const
ItemTypes
=
{
const
ItemTypes
=
{
CARD
:
'
card
'
,
CARD
:
'
card
'
,
};
};
const
DragTag
=
({
text
,
id
,
index
,
changePosition
,
endChangePosition
,
edit
,
del
})
=>
{
const
DragTag
=
({
text
,
id
,
index
,
changePosition
,
endChangePosition
,
edit
,
del
,
selected
})
=>
{
const
[
isEdit
,
setIsEdit
]
=
useState
(
false
);
const
[
isEdit
,
setIsEdit
]
=
useState
(
false
);
const
[
inputValue
,
setInputValue
]
=
useState
(
''
);
const
[
inputValue
,
setInputValue
]
=
useState
(
''
);
const
refInput
=
useRef
();
const
refInput
=
useRef
();
...
@@ -69,7 +69,7 @@ const DragTag = ({ text, id, index, changePosition, endChangePosition, edit, del
...
@@ -69,7 +69,7 @@ const DragTag = ({ text, id, index, changePosition, endChangePosition, edit, del
const
groupEditRender
=
()
=>
(
const
groupEditRender
=
()
=>
(
<
Tag
<
Tag
className=
{
styles
[
'
groupBox-body--tag
'
]
}
className=
{
[
styles
[
'
groupBox-body--tag
'
]
]
}
ref=
{
drag
(
drop
(
ref
))
}
ref=
{
drag
(
drop
(
ref
))
}
style=
{
{
style=
{
{
opacity
:
isDragging
?
0.3
:
1
,
opacity
:
isDragging
?
0.3
:
1
,
...
...
src/pages/GoodsManage/Takeaway/components/GoodsGroup.jsx
View file @
c3672f3a
...
@@ -62,11 +62,13 @@ const GoodsGroup = options => {
...
@@ -62,11 +62,13 @@ const GoodsGroup = options => {
setIsModalOpen
(
true
);
setIsModalOpen
(
true
);
};
};
const
handleDelete
=
async
id
=>
{
const
handleDelete
=
async
id
=>
{
await
apiDelStorage
({
const
res
=
await
apiDelStorage
({
shopId
:
options
.
shopId
,
shopId
:
options
.
shopId
,
id
,
id
,
});
});
getGroupList
();
if
(
res
.
businessCode
===
'
0000
'
&&
res
.
code
===
'
0000
'
)
{
getGroupList
();
}
};
};
// 更换位置
// 更换位置
...
...
src/pages/GoodsManage/Takeaway/components/WeekTime.jsx
View file @
c3672f3a
...
@@ -52,6 +52,18 @@ const WeekTime = options => {
...
@@ -52,6 +52,18 @@ const WeekTime = options => {
});
});
};
};
const
onTimeValidator
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
&&
value
.
length
===
2
)
{
if
(
moment
(
value
[
0
]).
format
(
'
HH:mm
'
)
===
moment
(
value
[
1
]).
format
(
'
HH:mm
'
))
{
callback
(
new
Error
(
'
请输入大于0的数字
'
));
}
else
{
callback
();
}
}
else
{
callback
();
}
};
const
initialValues
=
Object
.
assign
(
const
initialValues
=
Object
.
assign
(
{
{
saleTimeType
:
0
,
saleTimeType
:
0
,
...
@@ -137,6 +149,10 @@ const WeekTime = options => {
...
@@ -137,6 +149,10 @@ const WeekTime = options => {
required
:
true
,
required
:
true
,
message
:
'
请选择售卖时间
'
,
message
:
'
请选择售卖时间
'
,
},
},
{
validator
:
onTimeValidator
,
message
:
'
结束时间不能和开始时间相同
'
,
},
]
}
]
}
noStyle
noStyle
>
>
...
...
src/pages/GoodsManage/Takeaway/index.jsx
View file @
c3672f3a
...
@@ -6,7 +6,12 @@ import { SortableContainer, SortableElement, SortableHandle } from 'react-sortab
...
@@ -6,7 +6,12 @@ import { SortableContainer, SortableElement, SortableHandle } from 'react-sortab
import
{
arrayMoveImmutable
}
from
'
array-move
'
;
import
{
arrayMoveImmutable
}
from
'
array-move
'
;
import
{
GOOD_MANAGE
}
from
'
@/../config/permission.config
'
;
import
{
GOOD_MANAGE
}
from
'
@/../config/permission.config
'
;
import
GoodsGroup
from
'
./components/GoodsGroup
'
;
import
GoodsGroup
from
'
./components/GoodsGroup
'
;
import
{
apiTakeawayGoods
,
apiGoodsActionBatch
,
apiSortTakeawayGoods
}
from
'
../service
'
;
import
{
apiTakeawayGoods
,
apiGoodsActionBatch
,
apiSortTakeawayGoods
,
apiTopTakeawayGoods
,
}
from
'
../service
'
;
import
styles
from
'
../style.less
'
;
import
styles
from
'
../style.less
'
;
import
{
takeawayColumn
}
from
'
../staticdata
'
;
import
{
takeawayColumn
}
from
'
../staticdata
'
;
// import VirtualTable from './components/VirtualTable';
// import VirtualTable from './components/VirtualTable';
...
@@ -38,7 +43,7 @@ const Takeaway = options => {
...
@@ -38,7 +43,7 @@ const Takeaway = options => {
onChange
:
setSelectedRowKeys
,
onChange
:
setSelectedRowKeys
,
};
};
const
getDataList
=
async
(
page
,
s
ize
)
=>
{
const
getDataList
=
async
(
page
=
pageNo
,
size
=
pageS
ize
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
const
params
=
Object
.
assign
({},
options
.
searchValue
,
{
const
params
=
Object
.
assign
({},
options
.
searchValue
,
{
pageNo
:
page
||
pageNo
,
pageNo
:
page
||
pageNo
,
...
@@ -69,7 +74,7 @@ const Takeaway = options => {
...
@@ -69,7 +74,7 @@ const Takeaway = options => {
const
newData
=
arrayMoveImmutable
(
tableData
.
slice
(),
oldIndex
,
newIndex
).
filter
(
el
=>
!!
el
);
const
newData
=
arrayMoveImmutable
(
tableData
.
slice
(),
oldIndex
,
newIndex
).
filter
(
el
=>
!!
el
);
const
skuSorts
=
newData
.
map
((
item
,
index
)
=>
({
const
skuSorts
=
newData
.
map
((
item
,
index
)
=>
({
skuId
:
item
.
skuId
,
skuId
:
item
.
skuId
,
sort
:
pageSize
*
pageNo
+
index
+
1
,
sort
:
pageSize
*
(
pageNo
-
1
)
+
index
+
1
,
}));
}));
const
params
=
{
const
params
=
{
storageRackId
:
groupId
,
storageRackId
:
groupId
,
...
@@ -78,7 +83,7 @@ const Takeaway = options => {
...
@@ -78,7 +83,7 @@ const Takeaway = options => {
skuSorts
,
skuSorts
,
};
};
await
apiSortTakeawayGoods
(
params
);
await
apiSortTakeawayGoods
(
params
);
getDataList
();
getDataList
(
pageNo
,
pageSize
);
// setTableData(newData);
// setTableData(newData);
}
}
};
};
...
@@ -121,7 +126,7 @@ const Takeaway = options => {
...
@@ -121,7 +126,7 @@ const Takeaway = options => {
setVisibleBuy
(
false
);
setVisibleBuy
(
false
);
setVisibleSend
(
false
);
setVisibleSend
(
false
);
});
});
getDataList
();
getDataList
(
pageNo
,
pageSize
);
}
}
};
};
...
@@ -155,13 +160,22 @@ const Takeaway = options => {
...
@@ -155,13 +160,22 @@ const Takeaway = options => {
});
});
};
};
// 置顶
// 置顶
const
toTop
=
oldIndex
=>
{
const
toTop
=
async
({
skuId
})
=>
{
onSortEnd
({
oldIndex
,
newIndex
:
0
});
// onSortEnd({ oldIndex, newIndex: 0 });
const
res
=
await
apiTopTakeawayGoods
({
productItemId
:
skuId
,
shopId
,
storageRackId
:
groupId
,
});
if
(
res
.
businessCode
===
'
0000
'
&&
res
.
code
===
'
0000
'
)
{
getDataList
(
pageNo
,
pageSize
);
message
.
success
(
'
处理成功!
'
);
}
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
groupId
)
{
if
(
groupId
)
{
getDataList
();
getDataList
(
0
,
pageSize
);
}
else
{
}
else
{
setTableData
([]);
setTableData
([]);
}
}
...
@@ -173,6 +187,7 @@ const Takeaway = options => {
...
@@ -173,6 +187,7 @@ const Takeaway = options => {
onEdit
,
onEdit
,
getDataList
,
getDataList
,
shopId
,
shopId
,
pageNo
,
};
};
const
canAddTakeaway
=
options
.
permissions
[
GOOD_MANAGE
.
ADD_TAKEAWAY_GOODS
];
const
canAddTakeaway
=
options
.
permissions
[
GOOD_MANAGE
.
ADD_TAKEAWAY_GOODS
];
...
...
src/pages/GoodsManage/service.js
View file @
c3672f3a
...
@@ -312,6 +312,13 @@ export async function apiSortTakeawayGoods(data) {
...
@@ -312,6 +312,13 @@ export async function apiSortTakeawayGoods(data) {
data
,
data
,
});
});
}
}
// 外卖商品置顶
export
async
function
apiTopTakeawayGoods
(
data
)
{
return
request
.
post
(
'
/api/merchants/products/sku/storageRack/topping
'
,
{
prefix
:
goodsApi
,
data
,
});
}
// 获取供应商门店列表
// 获取供应商门店列表
export
async
function
apiSupplierShopList
()
{
export
async
function
apiSupplierShopList
()
{
return
request
.
get
(
'
/api/merchants/shops/getBySupplierId?state=1
'
,
{
return
request
.
get
(
'
/api/merchants/shops/getBySupplierId?state=1
'
,
{
...
...
src/pages/GoodsManage/staticdata.js
View file @
c3672f3a
...
@@ -341,8 +341,8 @@ export function takeawayColumn(actions) {
...
@@ -341,8 +341,8 @@ export function takeawayColumn(actions) {
>
>
修改库存
修改库存
<
/Button
>
<
/Button
>
{
index
>
0
&&
(
{
(
index
>
0
||
actions
.
pageNo
>
1
)
&&
(
<
Button
key
=
"
top
"
className
=
{
styles
.
button
}
onClick
=
{()
=>
actions
.
toTop
(
index
)}
>
<
Button
key
=
"
top
"
className
=
{
styles
.
button
}
onClick
=
{()
=>
actions
.
toTop
(
row
)}
>
置顶
置顶
<
/Button
>
<
/Button
>
)}
)}
...
...
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