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
65ffab8e
Commit
65ffab8e
authored
Aug 19, 2022
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改库存变动
parent
8ba34eb5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
22 deletions
+60
-22
index.jsx
src/pages/GoodsManage/UpdateStock/index.jsx
+18
-8
index.jsx
src/pages/GoodsManage/index.jsx
+34
-8
service.js
src/pages/GoodsManage/service.js
+6
-0
staticdata.js
src/pages/GoodsManage/staticdata.js
+1
-5
style.less
src/pages/GoodsManage/style.less
+1
-1
No files found.
src/pages/GoodsManage/UpdateStock/index.jsx
View file @
65ffab8e
...
...
@@ -8,7 +8,6 @@ import styles from '../style.less';
const
UpdateStock
=
props
=>
{
const
{
getFieldDecorator
,
validateFields
,
resetFields
,
getFieldValue
}
=
props
.
form
;
const
valueInfo
=
props
.
info
;
getFieldDecorator
(
'
changeType
'
,
{
initialValue
:
28
});
const
[
loading
,
setLoading
]
=
useState
(
false
);
...
...
@@ -50,7 +49,8 @@ const UpdateStock = props => {
const
validatorCallback
=
(
rule
,
value
,
callback
)
=>
{
// 减库存存时,校验可售库存-输入值>=0,即可售库存不可为负;
const
changeType
=
getFieldValue
(
'
changeType
'
);
const
increment
=
valueInfo
.
stock
-
value
;
const
increment
=
valueInfo
.
marketableStock
-
value
;
console
.
log
(
'
value :>>
'
,
value
,
valueInfo
.
marketableStock
);
console
.
log
(
'
valueInfo :>>
'
,
valueInfo
,
increment
);
return
+
changeType
===
29
&&
increment
<
0
?
callback
(
new
Error
(
rule
.
message
))
:
callback
();
};
...
...
@@ -59,7 +59,7 @@ const UpdateStock = props => {
<
Modal
title=
"修改库存"
visible=
{
props
.
visible
}
okButtonProps=
{
{
loading
}
}
okButtonProps=
{
{
loading
,
disabled
:
valueInfo
.
status
===
1
}
}
onCancel=
{
onCancel
}
onOk=
{
submit
}
width=
{
500
}
...
...
@@ -71,14 +71,15 @@ const UpdateStock = props => {
</
Form
.
Item
>
)
:
(
<
Form
.
Item
label=
"当前库存:"
>
<
span
>
{
valueInfo
.
s
tock
}
</
span
>
<
span
>
{
valueInfo
.
curS
tock
}
</
span
>
</
Form
.
Item
>
)
}
<
Form
.
Item
label=
"变更类型:"
>
{
getFieldDecorator
(
'
changeType
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请选择类型!
'
}],
initialValue
:
valueInfo
.
changeType
||
28
,
})(
<
Radio
.
Group
>
<
Radio
.
Group
disabled=
{
valueInfo
.
status
===
1
}
>
<
Radio
value=
{
28
}
>
增库存
</
Radio
>
<
Radio
value=
{
29
}
>
减库存
</
Radio
>
<
Radio
value=
{
30
}
>
使用新值
</
Radio
>
...
...
@@ -93,15 +94,24 @@ const UpdateStock = props => {
{
validator
:
validatorCallback
,
message
:
'
减库存,输入库存数不可大于可售库存!
'
},
],
validateTrigger
:
[
'
onSubmit
'
,
'
onChange
'
],
})(<
InputNumber
min=
{
0
}
precision=
{
0
}
placeholder=
"请输入库存"
style=
{
{
width
:
200
}
}
/>)
}
initialValue
:
valueInfo
.
stock
,
})(
<
InputNumber
min=
{
0
}
precision=
{
0
}
placeholder=
"请输入库存"
disabled=
{
valueInfo
.
status
===
1
}
style=
{
{
width
:
200
}
}
/>,
)
}
</
Form
.
Item
>
<
Form
.
Item
label=
"变更原因:"
>
{
getFieldDecorator
(
'
changeReason
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入变更原因!
'
}],
initialValue
:
valueInfo
.
changeReason
,
})(<
Input
.
TextArea
/>)
}
})(<
Input
.
TextArea
disabled=
{
valueInfo
.
status
===
1
}
/>)
}
</
Form
.
Item
>
{
valueInfo
.
state
===
4
&&
<
div
className=
{
styles
.
stockErrMsg
}
>
审核中
</
div
>
}
{
valueInfo
.
state
Desc
&&
<
div
className=
{
styles
.
stockErrMsg
}
>
{
valueInfo
.
stateDesc
}
</
div
>
}
</
Form
>
</
Modal
>
);
...
...
src/pages/GoodsManage/index.jsx
View file @
65ffab8e
...
...
@@ -19,6 +19,7 @@ import {
specList
,
queryAllAfterAddress
,
apiEnableUpdataStock
,
apiQueryLastChangeLog
,
}
from
'
./service
'
;
import
LogModal
from
'
./LogModal
'
;
import
CreateModal
from
'
./createModal
'
;
...
...
@@ -225,13 +226,8 @@ class goodsManage extends Component {
list
.
filter
(
item
=>
isEdit
||
!
JDSHOPID
.
includes
(
item
.
id
));
// 验证是否可以修改库存
checkEnableUpdateStock
=
async
(
row
=
{})
=>
{
let
ids
=
''
;
if
(
row
&&
row
.
skuId
)
{
ids
=
row
.
skuId
;
}
else
{
ids
=
this
.
state
.
selectedRowKeys
.
join
(
'
,
'
);
}
checkEnableUpdateStock
=
async
()
=>
{
const
ids
=
this
.
state
.
selectedRowKeys
.
join
(
'
,
'
);
if
(
ids
)
{
const
res
=
await
apiEnableUpdataStock
(
ids
);
if
(
res
.
data
)
{
...
...
@@ -239,7 +235,7 @@ class goodsManage extends Component {
this
.
setState
({
stockSkuIds
:
res
.
data
.
successSkuIds
,
});
this
.
openModal
(
row
,
1
);
this
.
openModal
(
{}
,
1
);
}
else
{
const
message
=
res
.
data
.
failedInfoList
[
0
]?.
message
||
'
未存在可修改库存的商品
'
;
notification
.
info
({
message
});
...
...
@@ -284,6 +280,36 @@ class goodsManage extends Component {
});
};
onShowStockModal
=
async
row
=>
{
console
.
log
(
'
row :>>
'
,
row
);
const
res
=
await
apiQueryLastChangeLog
(
row
.
skuId
);
console
.
log
(
'
res :>>
'
,
res
);
let
priceInfo
=
{
id
:
row
.
skuId
,
curStock
:
row
.
productStock
,
supplierId
:
row
.
supplierId
,
marketableStock
:
row
.
stock
,
};
if
(
res
.
data
&&
[
1
,
3
].
includes
(
+
res
.
data
.
status
))
{
priceInfo
=
Object
.
assign
(
{
changeReason
:
res
.
data
.
changeReason
,
stock
:
+
res
.
data
.
afterChange
,
changeType
:
res
.
data
.
changeType
,
status
:
res
.
data
.
status
,
stateDesc
:
res
.
data
.
statusDesc
,
},
priceInfo
,
);
}
console
.
log
(
'
priceInfo :>>
'
,
priceInfo
);
this
.
setState
({
updateStockVisible
:
true
,
priceInfo
,
stockSkuIds
:
[
row
.
skuId
],
});
};
cancel
=
query
=>
{
this
.
setState
({
updateStockVisible
:
false
});
if
(
query
)
{
...
...
src/pages/GoodsManage/service.js
View file @
65ffab8e
...
...
@@ -224,3 +224,9 @@ export const apiCreateGoodsLog = params =>
data
:
params
,
prefix
:
goodsApi
,
});
// 查询sku最后一条库存变更记录
export
const
apiQueryLastChangeLog
=
skuId
=>
request
.
get
(
`/api/kdsp/sku/last/stockChange/record?skuId=
${
skuId
}
`
,
{
prefix
:
goodsApi
,
});
src/pages/GoodsManage/staticdata.js
View file @
65ffab8e
...
...
@@ -110,11 +110,7 @@ export function column() {
render
:
(
_
,
row
)
=>
{
// const stockView = row.productStock;
const
stockView
=
(
<
Button
type
=
"
link
"
onClick
=
{()
=>
this
.
checkEnableUpdateStock
(
row
)}
style
=
{{
padding
:
0
}}
>
<
Button
type
=
"
link
"
onClick
=
{()
=>
this
.
onShowStockModal
(
row
)}
style
=
{{
padding
:
0
}}
>
{
row
.
productStock
}
<
/Button
>
);
...
...
src/pages/GoodsManage/style.less
View file @
65ffab8e
...
...
@@ -106,7 +106,7 @@
}
.stockErrMsg {
box-sizing: border-box;
padding-left:
25
%;
padding-left:
30
%;
color: #d9363e;
line-height: 1;
}
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