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
944b0885
Commit
944b0885
authored
Apr 03, 2023
by
陈万宝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修改自动补足问题
parent
3c90436f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
16 deletions
+22
-16
AddRepertoryModal.jsx
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
+3
-2
AddSellTimeModal.jsx
src/pages/ServiceGoods/components/AddSellTimeModal.jsx
+0
-1
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+19
-13
No files found.
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
View file @
944b0885
...
@@ -14,7 +14,7 @@ const AddRepertoryModal = (props, ref) => {
...
@@ -14,7 +14,7 @@ const AddRepertoryModal = (props, ref) => {
maxStock
:
0
,
maxStock
:
0
,
autoStock
:
false
,
autoStock
:
false
,
});
});
const
[
isRequired
,
setIsRequired
]
=
useState
(
true
);
const
{
modifiedInventory
,
intactData
,
repertoryModel
}
=
props
;
const
{
modifiedInventory
,
intactData
,
repertoryModel
}
=
props
;
const
{
type
,
idx
,
item
}
=
repertoryModel
;
const
{
type
,
idx
,
item
}
=
repertoryModel
;
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
...
@@ -28,6 +28,7 @@ const AddRepertoryModal = (props, ref) => {
...
@@ -28,6 +28,7 @@ const AddRepertoryModal = (props, ref) => {
form
.
setFieldsValue
({
form
.
setFieldsValue
({
autoStock
:
e
?
1
:
0
,
autoStock
:
e
?
1
:
0
,
});
});
setIsRequired
(
!
e
)
};
};
// 勾选库存设置
// 勾选库存设置
const
onChangeSetRepertory
=
e
=>
{
const
onChangeSetRepertory
=
e
=>
{
...
@@ -135,7 +136,7 @@ const AddRepertoryModal = (props, ref) => {
...
@@ -135,7 +136,7 @@ const AddRepertoryModal = (props, ref) => {
<
Form
.
Item
<
Form
.
Item
name=
"maxStock"
name=
"maxStock"
label=
"最大库存"
label=
"最大库存"
rules=
{
[{
required
:
true
,
message
:
'
请填写最大库存
'
}]
}
rules=
{
[{
required
:
isRequired
,
message
:
'
请填写最大库存
'
}]
}
>
>
<
InputNumber
<
InputNumber
min=
{
0
}
min=
{
0
}
...
...
src/pages/ServiceGoods/components/AddSellTimeModal.jsx
View file @
944b0885
...
@@ -39,7 +39,6 @@ const AddSellTimeModal = (props, ref) => {
...
@@ -39,7 +39,6 @@ const AddSellTimeModal = (props, ref) => {
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
'
open
'
,
open
);
console
.
log
(
'
open
'
,
open
);
console
.
log
(
'
sss/
'
,
formProject
);
// formProject.setFieldsValue({ saleTimes: [['12:00', '13:00']] })
// formProject.setFieldsValue({ saleTimes: [['12:00', '13:00']] })
},
[
open
]);
},
[
open
]);
const
onChange
=
()
=>
{};
const
onChange
=
()
=>
{};
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
944b0885
...
@@ -79,6 +79,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -79,6 +79,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const
[
tempSpecs
,
setTempSpecs
]
=
useState
([]);
const
[
tempSpecs
,
setTempSpecs
]
=
useState
([]);
const
[
weightUnits
,
setWeightUnits
]
=
useState
([]);
const
[
weightUnits
,
setWeightUnits
]
=
useState
([]);
const
[
peopleUnits
,
setPeopleUnits
]
=
useState
([]);
const
[
peopleUnits
,
setPeopleUnits
]
=
useState
([]);
const
[
isRequired
,
setIsRequired
]
=
useState
(
true
);
// 自定义加入菜单
// 自定义加入菜单
const
showModal
=
()
=>
{
const
showModal
=
()
=>
{
...
@@ -123,8 +125,9 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -123,8 +125,9 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
categoryId
,
categoryId
,
}
=
takeawayItem
;
}
=
takeawayItem
;
let
unit
=
takeawayItem
.
unit
;
let
unit
=
takeawayItem
.
unit
;
unit
=
(
unit
&&
(
Array
.
isArray
(
unit
)
&&
unit
?.
length
&&
unit
?.
slice
(
1
).
toString
()))
||
unit
;
unit
=
(
unit
&&
(
Array
.
isArray
(
unit
)
&&
unit
?.
length
&&
unit
?.
slice
(
1
).
toString
()))
||
unit
;
console
.
log
(
unit
,
'
unit=====
'
);
console
.
log
(
takeawayItem
,
'
takeawayItem
'
);
const
singularSpecList
=
[{
specGroupName
:
'
份量
'
,
generateSku
:
1
,
specs
:
[]
}];
// 单规格
const
singularSpecList
=
[{
specGroupName
:
'
份量
'
,
generateSku
:
1
,
specs
:
[]
}];
// 单规格
const
multiSpecList
=
[{
specGroupName
:
'
份量
'
,
generateSku
:
1
,
specs
:
[]
}];
// 多规格
const
multiSpecList
=
[{
specGroupName
:
'
份量
'
,
generateSku
:
1
,
specs
:
[]
}];
// 多规格
// const multiSpu = customer.isEdit ? skuList:[]; // 多库存spu、
// const multiSpu = customer.isEdit ? skuList:[]; // 多库存spu、
...
@@ -188,6 +191,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -188,6 +191,11 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if
(
specsItem
&&
!
specsItem
.
generateSku
)
{
if
(
specsItem
&&
!
specsItem
.
generateSku
)
{
specsItem
.
generateSku
=
1
;
specsItem
.
generateSku
=
1
;
}
}
if
(
specsItem
.
specGroupName
){
specsItem
?.
specs
?.
forEach
(
itm
=>
{
itm
.
specGroupName
=
specsItem
.
specGroupName
})
}
multiSpecList
.
push
(
specsItem
);
multiSpecList
.
push
(
specsItem
);
});
});
}
}
...
@@ -219,9 +227,10 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -219,9 +227,10 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
obj
.
unique
=
''
;
obj
.
unique
=
''
;
multiSpecList
.
forEach
((
itm
,
idx
)
=>
{
multiSpecList
.
forEach
((
itm
,
idx
)
=>
{
if
(
item
[
idx
]
&&
!
item
[
idx
]?.
specGroupName
)
{
if
(
item
[
idx
]
&&
!
item
[
idx
]?.
specGroupName
)
{
i
tem
[
idx
].
specGroupName
=
''
;
i
f
(
multiSpecList
[
idx
].
specGroupName
){
item
[
idx
].
specGroupName
=
multiSpecList
[
idx
].
specGroupName
;
item
[
idx
].
specGroupName
=
multiSpecList
[
idx
].
specGroupName
;
}
}
}
});
});
obj
.
specs
=
[...
item
];
obj
.
specs
=
[...
item
];
return
obj
;
return
obj
;
...
@@ -232,7 +241,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -232,7 +241,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
item
.
salePrice
=
0
;
item
.
salePrice
=
0
;
item
.
unique
=
item
?.
specs
item
.
unique
=
item
?.
specs
.
map
(
itm
=>
{
.
map
(
itm
=>
{
if
(
itm
.
unit
)
{
if
(
itm
?
.
unit
)
{
itm
.
unit
=
itm
.
unit
=
itm
?.
unit
&&
itm
?.
unit
&&
(
Array
.
isArray
(
itm
?.
unit
)
?
itm
?.
unit
.
slice
(
itm
?.
unit
.
length
-
1
)[
0
]
:
itm
?.
unit
);
(
Array
.
isArray
(
itm
?.
unit
)
?
itm
?.
unit
.
slice
(
itm
?.
unit
.
length
-
1
)[
0
]
:
itm
?.
unit
);
...
@@ -250,7 +259,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -250,7 +259,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
console
.
log
(
'
multiSpu
'
,
multiSpu
);
console
.
log
(
'
multiSpu
'
,
multiSpu
);
if
(
tempMultiSpu
.
length
)
{
if
(
tempMultiSpu
.
length
)
{
multiSpu
.
forEach
((
item
,
index
)
=>
{
multiSpu
.
forEach
((
item
,
index
)
=>
{
console
.
log
(
'
item===
'
,
item
);
tempMultiSpu
.
forEach
((
itm
,
idx
)
=>
{
tempMultiSpu
.
forEach
((
itm
,
idx
)
=>
{
if
(
item
.
unique
===
itm
.
unique
)
{
if
(
item
.
unique
===
itm
.
unique
)
{
item
.
serviceItem
=
objectComparison
(
item
.
serviceItem
,
itm
);
item
.
serviceItem
=
objectComparison
(
item
.
serviceItem
,
itm
);
...
@@ -300,6 +308,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -300,6 +308,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const
getFormValues
=
debounce
(()
=>
{
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
const
values
=
form
.
getFieldsValue
();
console
.
log
(
values
,
'
values===
'
);
console
.
log
(
values
,
'
values===
'
);
// debugger
props
.
onValuesChange
({
takeawayItem
:
JSON
.
parse
(
JSON
.
stringify
(
values
))
});
props
.
onValuesChange
({
takeawayItem
:
JSON
.
parse
(
JSON
.
stringify
(
values
))
});
const
takeawayData
=
customer
.
isEdit
const
takeawayData
=
customer
.
isEdit
?
{
takeawayItem
:
Object
.
assign
({},
editData
,
values
)
}
?
{
takeawayItem
:
Object
.
assign
({},
editData
,
values
)
}
...
@@ -333,7 +342,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -333,7 +342,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
tempMultiSpu
.
push
(...
temp
);
tempMultiSpu
.
push
(...
temp
);
setTempMultiSpu
(
tempMultiSpu
);
setTempMultiSpu
(
tempMultiSpu
);
setMultiSpu
(
multiSpu
);
setMultiSpu
(
multiSpu
);
console
.
log
(
'
multiSpu===333
'
,
multiSpu
,
tempMultiSpu
);
getFormValues
();
getFormValues
();
return
false
;
return
false
;
};
};
...
@@ -432,6 +440,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -432,6 +440,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
form
.
setFieldsValue
({
form
.
setFieldsValue
({
autoStock
:
e
?
1
:
0
,
autoStock
:
e
?
1
:
0
,
});
});
setIsRequired
(
!
e
)
};
};
// 显示加入库存弹框
// 显示加入库存弹框
const
showAddRepertoryModal
=
(
type
,
idx
,
item
)
=>
{
const
showAddRepertoryModal
=
(
type
,
idx
,
item
)
=>
{
...
@@ -444,7 +453,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -444,7 +453,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
let
lastName
=
''
;
let
lastName
=
''
;
const
tempName
=
`
${
editData
?.
name
||
''
}
`;
const
tempName
=
`
${
editData
?.
name
||
''
}
`;
// const tempSpecName = `
$
{
item
?.
specs
[
0
]?.
specName
||
''
}
`;
// const tempSpecName = `
$
{
item
?.
specs
[
0
]?.
specName
||
''
}
`;
const tempQuantity = `
$
{
+
item
.
specs
[
0
]?.
quantity
>
0
?
'
(
'
:
''
}
$
{
item
.
specs
[
0
]?.
quantity
||
const tempQuantity = `
(
$
{
item
.
specs
[
0
]?.
quantity
||
''
}
`;
''
}
`;
const tempUnit = `
$
{
item
.
specs
[
0
]?.
unit
||
''
}
$
{
item
.
specs
[
0
]?.
unit
?
'
)
'
:
''
}
`;
const tempUnit = `
$
{
item
.
specs
[
0
]?.
unit
||
''
}
$
{
item
.
specs
[
0
]?.
unit
?
'
)
'
:
''
}
`;
// const tempSecondSpecName = `
$
{
item
.
specs
[
1
]?.
specName
||
''
}
`;
// const tempSecondSpecName = `
$
{
item
.
specs
[
1
]?.
specName
||
''
}
`;
...
@@ -863,7 +872,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -863,7 +872,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
<Form.Item
<Form.Item
name="maxStock"
name="maxStock"
label="最大库存"
label="最大库存"
rules={[{ required:
true
, message: '请填写最大库存' }]}
rules={[{ required:
isRequired
, message: '请填写最大库存' }]}
>
>
<InputNumber
<InputNumber
max={999999999}
max={999999999}
...
@@ -1047,10 +1056,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -1047,10 +1056,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
name="specs"
name="specs"
initialValue={
initialValue={
[
[
// {
// specGroupName: '',
// specs: [],
// },
]
]
}
}
>
>
...
@@ -1060,7 +1066,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -1060,7 +1066,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
<Form.Item key={specsField.key} className={styles.conBg}>
<Form.Item key={specsField.key} className={styles.conBg}>
<Form.Item
<Form.Item
{...specsField}
{...specsField}
validateTrigger={['onChange', 'onBlur']}
//
validateTrigger={['onChange', 'onBlur']}
name={[specsField.name, 'specGroupName']}
name={[specsField.name, 'specGroupName']}
rules={[
rules={[
{
{
...
...
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