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
6095ba76
Commit
6095ba76
authored
Mar 23, 2023
by
陈万宝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 更新商品字段
parent
6f9f4424
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
435 additions
and
285 deletions
+435
-285
common.less
src/pages/ServiceGoods/common.less
+4
-5
AddRepertoryModal.jsx
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
+92
-26
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+339
-254
No files found.
src/pages/ServiceGoods/common.less
View file @
6095ba76
...
@@ -221,7 +221,7 @@
...
@@ -221,7 +221,7 @@
}
}
.ant-form-item {
.ant-form-item {
margin-bottom: 0;
margin-bottom: 0;
margin-left:
2
0px;
margin-left:
4
0px;
}
}
}
}
}
}
...
@@ -253,7 +253,7 @@
...
@@ -253,7 +253,7 @@
line-height: 20px;
line-height: 20px;
text-align: center;
text-align: center;
margin: 0 10px;
margin: 0 10px;
padding:0 8px;
padding:
0 8px;
border-radius: 8px;
border-radius: 8px;
}
}
.repertoryLimit {
.repertoryLimit {
...
@@ -276,7 +276,7 @@
...
@@ -276,7 +276,7 @@
}
}
}
}
.conBg {
.conBg {
background:
#f8f8f8
;
background:
#f8f8f8
;
min-width: 100%;
min-width: 100%;
width: fit-content;
width: fit-content;
:global {
:global {
...
@@ -299,6 +299,5 @@
...
@@ -299,6 +299,5 @@
.rowWarp {
.rowWarp {
display: flex;
display: flex;
flex-flow: row wrap;
flex-flow: row wrap;
background:#f8f8f8 ;
background: #f8f8f8;
}
}
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
View file @
6095ba76
...
@@ -2,40 +2,98 @@ import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } f
...
@@ -2,40 +2,98 @@ import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } f
import
{
Button
,
Modal
,
Radio
,
Form
,
InputNumber
,
Switch
}
from
'
antd
'
;
import
{
Button
,
Modal
,
Radio
,
Form
,
InputNumber
,
Switch
}
from
'
antd
'
;
import
styles
from
'
../common.less
'
;
import
styles
from
'
../common.less
'
;
import
{
ENUM_SET_REPERTORY
}
from
'
../config
'
;
import
{
ENUM_SET_REPERTORY
}
from
'
../config
'
;
import
{
debounce
}
from
'
@/utils/utils
'
;
const
AddRepertoryModal
=
(
props
,
ref
)
=>
{
const
AddRepertoryModal
=
(
props
,
ref
)
=>
{
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
modalText
,
setModalText
]
=
useState
(
'
Content of the modal
'
);
const
[
openRepertory
,
setOpenRepertory
]
=
useState
(
false
);
const
[
openRepertory
,
setOpenRepertory
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
const
[
repertoryState
,
setRepertoryState
]
=
useState
(
''
);
const
[
initialValues
,
setInitialValues
]
=
useState
({
productStock
:
0
,
maxStock
:
0
,
autoStock
:
0
,
});
// const {
const
{
modifiedInventory
,
intactData
,
repertoryModel
}
=
props
;
// open,
// setOpen,
// } = props;
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
// changeVal 就是暴露给父组件的方法
// changeVal 就是暴露给父组件的方法
setOpenRepertory
:
newVal
=>
{
setOpenRepertory
:
newVal
=>
{
setOpenRepertory
(
newVal
);
setOpenRepertory
(
newVal
);
},
},
}));
}));
const
onChange3
=
()
=>
{};
// 自动补全
const
onChangeAutoStock
=
e
=>
{
const
handleOk
=
()
=>
{
form
.
setFieldsValue
({
setModalText
(
'
The modal will be closed after two seconds
'
);
autoStock
:
e
?
1
:
0
,
setConfirmLoading
(
true
);
});
setTimeout
(()
=>
{
};
setOpenRepertory
(
false
);
// 勾选库存设置
setConfirmLoading
(
false
);
const
onChangeSetRepertory
=
e
=>
{
},
2000
);
console
.
log
(
'
form
'
,
form
);
setRepertoryState
(
`
${
e
.
target
.
value
}
`
);
if
(
+
e
.
target
.
value
===
0
)
{
form
.
setFieldsValue
({
productStock
:
0
,
});
}
else
{
const
{
maxStock
}
=
form
.
getFieldsValue
([
'
maxStock
'
]);
form
.
setFieldsValue
({
productStock
:
maxStock
,
});
}
};
// 最大库存设置
const
onChangeMaxStock
=
e
=>
{
// 已经勾选最大库存 自动更新剩余库存
if
(
+
repertoryState
===
1
)
{
form
.
setFieldsValue
({
productStock
:
e
,
});
}
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
console
.
log
(
'
values========
'
,
values
);
},
400
);
const
handleOk
=
async
()
=>
{
const
values
=
await
form
.
validateFields
();
console
.
log
(
'
values
'
,
values
);
// 回调库存
modifiedInventory
(
values
);
// setConfirmLoading(true);
// setTimeout(() => {
// setOpenRepertory(false);
// setConfirmLoading(false);
// }, 2000);
};
};
const
handleCancel
=
()
=>
{
const
handleCancel
=
()
=>
{
console
.
log
(
'
Clicked cancel button
'
);
setOpenRepertory
(
false
);
setOpenRepertory
(
false
);
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
'
open
'
,
openRepertory
);
console
.
log
(
'
open
'
,
openRepertory
);
},
[
openRepertory
]);
const
{
productStock
,
serviceItem
}
=
intactData
?.
items
;
const
{
autoStock
,
maxStock
}
=
serviceItem
;
const
params
=
{
productStock
,
autoStock
,
maxStock
,
};
switch
(
repertoryModel
)
{
case
'
all
'
:
// 统一设置
setInitialValues
(
params
);
break
;
case
'
mlti
'
:
// 多规格设置
setInitialValues
(
params
);
break
;
case
'
singular
'
:
// 单规格设置
setInitialValues
(
params
);
break
;
default
:
break
;
}
},
[
openRepertory
,
intactData
]);
return
(
return
(
<>
<>
{
openRepertory
&&
(
{
openRepertory
&&
(
...
@@ -46,10 +104,10 @@ const AddRepertoryModal = (props, ref) => {
...
@@ -46,10 +104,10 @@ const AddRepertoryModal = (props, ref) => {
confirmLoading=
{
confirmLoading
}
confirmLoading=
{
confirmLoading
}
onCancel=
{
handleCancel
}
onCancel=
{
handleCancel
}
>
>
<
Form
>
<
Form
form=
{
form
}
initialValues=
{
initialValues
}
onValuesChange=
{
getFormValues
}
>
<
Form
.
Item
className=
{
styles
.
itemInlineModal
}
>
<
Form
.
Item
className=
{
styles
.
itemInlineModal
}
>
<
Form
.
Item
<
Form
.
Item
name=
"
receptionVolume
"
name=
"
productStock
"
label=
"剩余库存"
label=
"剩余库存"
style=
{
{
style=
{
{
display
:
'
flex
'
,
display
:
'
flex
'
,
...
@@ -58,28 +116,36 @@ const AddRepertoryModal = (props, ref) => {
...
@@ -58,28 +116,36 @@ const AddRepertoryModal = (props, ref) => {
rules=
{
[{
required
:
true
,
message
:
'
请填写剩余库存
'
}]
}
rules=
{
[{
required
:
true
,
message
:
'
请填写剩余库存
'
}]
}
>
>
<
InputNumber
<
InputNumber
min=
{
1
}
min=
{
0
}
style=
{
{
width
:
200
,
display
:
'
inline-block
'
}
}
style=
{
{
width
:
200
,
display
:
'
inline-block
'
}
}
placeholder=
"请输入"
placeholder=
"请输入"
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
name=
"limitPurchase"
style=
{
{
width
:
200
,
display
:
'
inline-block
'
}
}
>
<
Form
.
Item
style=
{
{
width
:
200
,
display
:
'
inline-block
'
}
}
>
<
Radio
.
Group
options=
{
ENUM_SET_REPERTORY
}
onChange=
{
onChange3
}
value=
{
1
}
/>
<
Radio
.
Group
value=
{
repertoryState
}
onChange=
{
onChangeSetRepertory
}
>
<
Radio
.
Button
value=
"0"
>
清空
</
Radio
.
Button
>
<
Radio
.
Button
value=
"1"
>
最大
</
Radio
.
Button
>
</
Radio
.
Group
>
</
Form
.
Item
>
</
Form
.
Item
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
name=
"
receptionVolume
"
name=
"
maxStock
"
label=
"最大库存"
label=
"最大库存"
rules=
{
[{
required
:
true
,
message
:
'
请填写最大库存
'
}]
}
rules=
{
[{
required
:
true
,
message
:
'
请填写最大库存
'
}]
}
>
>
<
InputNumber
min=
{
1
}
style=
{
{
width
:
200
}
}
placeholder=
"请输入"
/>
<
InputNumber
min=
{
0
}
style=
{
{
width
:
200
}
}
placeholder=
"请输入"
onChange=
{
onChangeMaxStock
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
name=
"
receptionVolume
"
label=
"自动补足"
>
<
Form
.
Item
name=
"
autoStock
"
label=
"自动补足"
>
<
Switch
<
Switch
checkedChildren=
"开启"
checkedChildren=
"开启"
unCheckedChildren=
"关闭"
unCheckedChildren=
"关闭"
defaultChecked
//
defaultChecked
onChange=
{
onChange
3
}
onChange=
{
onChange
AutoStock
}
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
div
className=
{
styles
.
textStyle
}
>
修改成功后,原库存将被替换,请谨慎操作!
</
div
>
<
div
className=
{
styles
.
textStyle
}
>
修改成功后,原库存将被替换,请谨慎操作!
</
div
>
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
6095ba76
This diff is collapsed.
Click to expand it.
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