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
62d4be57
Commit
62d4be57
authored
Apr 02, 2023
by
baxibaba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 更新多规格商品
parent
e61c50de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
18 deletions
+14
-18
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+14
-18
No files found.
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
62d4be57
...
...
@@ -156,19 +156,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
autoStock
,
// 弹框设置---自动补足
},
};
let
serviceItem
=
{
description
,
// 商品描述
maxStock
,
// 最大库存
productStock
,
minPurchaseNum
,
// 最少购买
saleTimeType
,
// 售卖时间
singleDelivery
,
// 单点不送
list
,
// 是否列出 1 是 0 否(外卖商品必填)
label
,
// 商品标签id
saleDates
,
// 可售日期 1-8
saleTimes
:
saleTimesTemp
,
// 可售日期 时间段
autoStock
,
// 弹框设置---自动补足
};
// 单规格
if
(
+
repertoryType
===
1
)
{
...
...
@@ -189,6 +176,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if
(
+
repertoryType
===
2
)
{
if
(
name
||
editData
.
name
)
{
if
(
weight
.
length
)
{
let
tempSku
=
[];
multiSpecList
[
0
].
specs
=
weight
;
// 处理specList
if
(
specs
.
length
)
{
specs
.
forEach
((
specsItem
,
specsIndex
)
=>
{
...
...
@@ -203,7 +191,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
item
.
unit
=
''
;
});
// 生成 specs 规格sku
let
tempSku
=
[[...
weight
],
...
sepcx
].
reduce
(
tempSku
=
[[...
weight
],
...
sepcx
].
reduce
(
(
x
,
y
)
=>
{
let
arr
=
[];
x
.
forEach
(
x
=>
y
.
forEach
(
y
=>
arr
.
push
(
x
.
concat
([
y
]))));
...
...
@@ -211,13 +199,18 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
},
[[]],
);
console
.
log
(
'
multiSpu1111
'
,
multiSpu
);
multiSpu
=
tempSku
.
map
((
item
,
index
)
=>
{
let
obj
=
{};
obj
.
salePrice
=
salePrice
;
obj
.
productStock
=
productStock
;
obj
.
list
=
list
;
obj
.
serviceItem
=
{
...
serviceItem
};
obj
.
serviceItem
=
{
...
temp
.
serviceItem
,
productStock
:
multiSpu
?.[
index
]?.
serviceItem
?.
productStock
||
productStock
,
maxStock
:
multiSpu
?.[
index
]?.
serviceItem
?.
maxStock
||
maxStock
,
autoStock
:
multiSpu
?.[
index
]?.
serviceItem
?.
autoStock
||
autoStock
,
};
obj
.
unique
=
''
;
multiSpecList
.
forEach
((
itm
,
idx
)
=>
{
if
(
item
[
idx
]
&&
!
item
[
idx
]?.
specGroupName
)
{
...
...
@@ -446,7 +439,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
let
lastName
=
''
;
const
tempName
=
`
${
editData
?.
name
||
''
}
`;
// const tempSpecName = `
$
{
item
?.
specs
[
0
]?.
specName
||
''
}
`;
const tempQuantity = `
$
{
item
.
specs
[
0
]?.
quantity
?
'
(
'
:
''
}
$
{
item
.
specs
[
0
]?.
quantity
||
''
}
`;
const tempQuantity = `
$
{
+
item
.
specs
[
0
]?.
quantity
>
0
?
'
(
'
:
''
}
$
{
item
.
specs
[
0
]?.
quantity
||
''
}
`;
const tempUnit = `
$
{
item
.
specs
[
0
]?.
unit
||
''
}
$
{
item
.
specs
[
0
]?.
unit
?
'
)
'
:
''
}
`;
// const tempSecondSpecName = `
$
{
item
.
specs
[
1
]?.
specName
||
''
}
`;
// const isShow = tempQuantity && tempUnit && '+';
...
...
@@ -589,7 +583,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
}
form.setFieldsValue({ productRefShopId: editData.shopId });
onCardSuccessImageList(editData?.detailImageList);
getFormValues();
}
}
}, [customer.isEdit, editData]);
...
...
@@ -599,6 +592,9 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
useEffect(() => {
init();
}, []);
useEffect(() => {
getFormValues();
}, [repertoryType]);
return (
<>
<Form
...
...
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