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
32b90c6e
Commit
32b90c6e
authored
Nov 28, 2022
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改商品驳回规格多行合并一行的问题
parent
0165fab1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
22 deletions
+26
-22
FormPriceOrStock.jsx
src/pages/ServiceGoods/components/FormPriceOrStock.jsx
+4
-2
utils.js
src/pages/ServiceGoods/utils.js
+22
-20
No files found.
src/pages/ServiceGoods/components/FormPriceOrStock.jsx
View file @
32b90c6e
...
...
@@ -298,7 +298,6 @@ const FormPriceOrStock = forwardRef((props, ref) => {
const
{
inIdList
:
secndInIdList
,
noIdList
:
secndNoIdList
}
=
filterSkuNotIdList
(
cleanValues
.
secondValues
,
);
const
createSkuList
=
createProductData
(
{
firstSpecId
:
cleanValues
.
firstSpecId
,
...
...
@@ -309,14 +308,17 @@ const FormPriceOrStock = forwardRef((props, ref) => {
secndNoIdList
,
},
customer
.
isEdit
,
skuList
,
);
CreateColumnsEvent
(
values
);
// 没有规格默认创建一条数据
if
(
!
cleanValues
.
firstSpecId
&&
!
createSkuList
.
secondSpecId
)
{
setTableData
([...
createSkuList
]);
return
;
}
// 是否合并单元格
setMergeTable
(
Boolean
(
cleanValues
.
secondValues
.
length
));
setTableData
(
fliterSkuListSortData
([...
skuList
,
...
createSkuList
]));
setTableData
(
fliterSkuListSortData
([...
createSkuList
]));
}
catch
(
error
)
{
console
.
log
(
error
);
}
...
...
src/pages/ServiceGoods/utils.js
View file @
32b90c6e
...
...
@@ -182,29 +182,38 @@ const createInitSkuItems = () => ({
name
:
null
,
});
export
const
createSkuListData
=
(
first
,
second
,
firstSpecId
,
secondSpecId
)
=>
{
const
getSecordValue
=
(
firstSpecValue
,
sec
,
skuList
)
=>
skuList
.
find
(
sku
=>
sku
.
firstSpecValue
===
firstSpecValue
&&
(
!
sku
.
secondSpecValue
||
sku
.
secondSpecValue
===
sec
.
secondSpecValue
),
);
export
const
createSkuListData
=
(
first
,
second
,
firstSpecId
,
secondSpecId
,
skuList
)
=>
{
const
list
=
[];
const
skuItem
=
createInitSkuItems
();
console
.
log
(
first
,
second
,
firstSpecId
,
secondSpecId
);
if
(
first
&&
first
.
length
)
{
// 一级规格有值时,生成的编辑表格
first
.
forEach
(
fir
=>
{
cons
t
copy
=
{
...
skuItem
};
le
t
copy
=
{
...
skuItem
};
copy
.
firstSpecId
=
firstSpecId
;
copy
.
firstSpecValue
=
fir
.
firstSpecValue
;
// console.log(copy);
if
(
second
.
length
)
{
second
.
forEach
(
sec
=>
{
const
copySec
=
{
...
copy
};
const
v
=
getSecordValue
(
fir
.
firstSpecValue
,
sec
,
skuList
);
const
copySec
=
v
||
{
...
copy
};
copySec
.
secondSpecId
=
secondSpecId
;
copySec
.
secondSpecValue
=
sec
.
secondSpecValue
;
delete
copySec
.
rowSpanCount
;
list
.
push
(
copySec
);
});
return
;
}
const
v
=
getSecordValue
(
`
${
fir
.
firstSpecValue
}
`
,
{},
skuList
);
if
(
v
)
{
copy
=
{
...
v
};
}
list
.
push
(
copy
);
});
}
else
if
(
second
&&
second
.
length
)
{
...
...
@@ -222,7 +231,7 @@ export const createSkuListData = (first, second, firstSpecId, secondSpecId) => {
return
list
;
};
export
const
createProductData
=
(
props
,
isEdit
)
=>
{
export
const
createProductData
=
(
props
,
isEdit
,
skuList
)
=>
{
const
{
firstSpecId
,
secondSpecId
,
...
...
@@ -231,20 +240,13 @@ export const createProductData = (props, isEdit) => {
fisrtInIdList
,
secndInIdList
,
}
=
props
;
const
newFirstList
=
fisrtNoIdList
.
concat
(
fisrtInIdList
||
[]);
let
list
=
[];
// if (!isFirstSame && !isSecondSame) {
if
(
!
isEdit
)
{
list
=
createSkuListData
(
fisrtNoIdList
,
secndNoIdList
,
firstSpecId
,
secondSpecId
);
if
(
isEdit
)
{
const
newFirstList
=
fisrtNoIdList
.
concat
(
fisrtInIdList
||
[]);
const
newSecondList
=
secndInIdList
.
concat
(
secndNoIdList
||
[]);
list
=
createSkuListData
(
newFirstList
,
newSecondList
,
firstSpecId
,
secondSpecId
,
skuList
);
}
else
{
const
list1
=
fisrtNoIdList
.
length
?
createSkuListData
(
fisrtNoIdList
,
secndInIdList
,
firstSpecId
,
secondSpecId
)
:
[];
const
list2
=
secndNoIdList
.
length
?
createSkuListData
(
newFirstList
,
secndNoIdList
,
firstSpecId
,
secondSpecId
)
:
[];
list
=
[...
list1
,
...
list2
];
list
=
createSkuListData
(
fisrtNoIdList
,
secndNoIdList
,
firstSpecId
,
secondSpecId
);
}
// }
return
list
;
};
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