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
ec597dfc
Commit
ec597dfc
authored
Nov 30, 2022
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改规格ID丢失问题
parent
28edaf68
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
6 deletions
+41
-6
FormPriceOrStock.jsx
src/pages/ServiceGoods/components/FormPriceOrStock.jsx
+37
-5
FormRuleVPictures.jsx
src/pages/ServiceGoods/components/FormRuleVPictures.jsx
+1
-1
index.jsx
src/pages/ServiceGoods/index.jsx
+1
-0
utils.js
src/pages/ServiceGoods/utils.js
+2
-0
No files found.
src/pages/ServiceGoods/components/FormPriceOrStock.jsx
View file @
ec597dfc
...
@@ -231,6 +231,24 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -231,6 +231,24 @@ const FormPriceOrStock = forwardRef((props, ref) => {
const
[
tableData
,
setTableData
]
=
useState
([]);
const
[
tableData
,
setTableData
]
=
useState
([]);
const
[
mergeTable
,
setMergeTable
]
=
useState
(
false
);
const
[
mergeTable
,
setMergeTable
]
=
useState
(
false
);
const
insertSpecID
=
items
=>
{
const
sids
=
items
.
filter
(
item
=>
item
.
id
);
if
(
sids
.
length
!==
skuList
.
length
)
{
let
i
=
0
;
const
ids
=
skuList
.
reduce
((
prev
,
cur
)
=>
{
if
(
!
sids
.
includes
(
cur
.
id
))
{
prev
.
push
(
cur
.
id
);
}
return
prev
;
},
[]);
items
.
forEach
(
item
=>
{
if
(
!
item
.
id
&&
i
<
ids
.
length
)
{
item
.
id
=
ids
[
i
++
];
}
});
}
};
const
onCheck
=
async
()
=>
{
const
onCheck
=
async
()
=>
{
try
{
try
{
let
setMealContent
=
''
;
let
setMealContent
=
''
;
...
@@ -238,6 +256,14 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -238,6 +256,14 @@ const FormPriceOrStock = forwardRef((props, ref) => {
setMealContent
=
await
packageRef
.
current
.
onCheck
();
setMealContent
=
await
packageRef
.
current
.
onCheck
();
}
}
const
values
=
await
form
.
validateFields
();
const
values
=
await
form
.
validateFields
();
if
(
!
values
.
firstSpecValue
||
!
values
.
firstSpecValue
.
length
)
{
values
.
firstSpecId
=
null
;
values
.
firstSpec
=
''
;
}
if
(
!
values
.
secondSpecValue
||
!
values
.
secondSpecValue
.
length
)
{
values
.
secondSpecId
=
null
;
values
.
secondSpec
=
''
;
}
const
items
=
await
editRef
.
current
.
onCheck
();
const
items
=
await
editRef
.
current
.
onCheck
();
if
(
customer
.
isCard
&&
!
setMealContent
)
{
if
(
customer
.
isCard
&&
!
setMealContent
)
{
notification
.
open
({
notification
.
open
({
...
@@ -247,6 +273,9 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -247,6 +273,9 @@ const FormPriceOrStock = forwardRef((props, ref) => {
return
null
;
return
null
;
}
}
if
(
items
)
{
if
(
items
)
{
if
(
customer
.
isEdit
&&
skuList
.
length
)
{
insertSpecID
(
items
);
}
const
obj
=
{
...
values
,
items
,
temp
:
'
infoSpecData
'
};
const
obj
=
{
...
values
,
items
,
temp
:
'
infoSpecData
'
};
customer
.
isCard
&&
setMealContent
&&
(
obj
.
setMealContent
=
setMealContent
);
customer
.
isCard
&&
setMealContent
&&
(
obj
.
setMealContent
=
setMealContent
);
return
obj
;
return
obj
;
...
@@ -288,8 +317,10 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -288,8 +317,10 @@ const FormPriceOrStock = forwardRef((props, ref) => {
const
cleanValues
=
{
const
cleanValues
=
{
firstValues
:
cleanArray
(
values
.
firstSpecValue
||
[]),
firstValues
:
cleanArray
(
values
.
firstSpecValue
||
[]),
secondValues
:
cleanArray
(
values
.
secondSpecValue
||
[]),
secondValues
:
cleanArray
(
values
.
secondSpecValue
||
[]),
firstSpecId
:
values
.
firstSpecId
,
firstSpecId
:
secondSpecId
:
values
.
secondSpecId
,
values
.
firstSpecValue
&&
values
.
firstSpecValue
.
length
?
values
.
firstSpecId
:
null
,
secondSpecId
:
values
.
secondSpecValue
&&
values
.
secondSpecValue
.
length
?
values
.
secondSpecId
:
null
,
};
};
const
{
inIdList
:
fisrtInIdList
,
noIdList
:
fisrtNoIdList
}
=
filterSkuNotIdList
(
const
{
inIdList
:
fisrtInIdList
,
noIdList
:
fisrtNoIdList
}
=
filterSkuNotIdList
(
...
@@ -325,9 +356,8 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -325,9 +356,8 @@ const FormPriceOrStock = forwardRef((props, ref) => {
};
};
const
batchChange
=
()
=>
{
const
batchChange
=
()
=>
{
const
batchItem
=
form
.
getFieldValue
(
'
batchItem
'
);
const
values
=
form
.
getFieldsValue
();
const
bacthFirst
=
form
.
getFieldValue
(
'
bacthFirst
'
);
const
{
batchItem
,
bacthFirst
,
bacthSecon
}
=
values
;
const
bacthSecon
=
form
.
getFieldValue
(
'
bacthSecon
'
);
const
resetObject
=
batchTableSourceData
({
batchItem
,
tableData
,
bacthSecon
,
bacthFirst
});
const
resetObject
=
batchTableSourceData
({
batchItem
,
tableData
,
bacthSecon
,
bacthFirst
});
setTableData
(
resetObject
);
setTableData
(
resetObject
);
};
};
...
@@ -335,6 +365,8 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -335,6 +365,8 @@ const FormPriceOrStock = forwardRef((props, ref) => {
const
onSpecificationEvent
=
async
()
=>
{
const
onSpecificationEvent
=
async
()
=>
{
try
{
try
{
const
values
=
await
form
.
validateFields
();
const
values
=
await
form
.
validateFields
();
console
.
log
(
'
values :>>
'
,
values
);
console
.
log
(
'
cleanArray(values.secondSpecValue) :>>
'
,
cleanArray
(
values
.
secondSpecValue
));
const
cleanValues
=
{
const
cleanValues
=
{
firstSpec
:
values
.
firstSpec
,
firstSpec
:
values
.
firstSpec
,
firstSpecId
:
values
.
firstSpecId
,
firstSpecId
:
values
.
firstSpecId
,
...
...
src/pages/ServiceGoods/components/FormRuleVPictures.jsx
View file @
ec597dfc
...
@@ -165,7 +165,7 @@ const FormRuleVPictures = forwardRef((props, ref) => {
...
@@ -165,7 +165,7 @@ const FormRuleVPictures = forwardRef((props, ref) => {
]
}
]
}
>
>
<
UploadImage
<
UploadImage
multiple=
{
false
}
multiple=
{
!
customer
.
isCard
}
maxWidth=
{
customer
.
isCard
?
0
:
1200
}
maxWidth=
{
customer
.
isCard
?
0
:
1200
}
maxHeight=
{
customer
.
isCard
?
0
:
1200
}
maxHeight=
{
customer
.
isCard
?
0
:
1200
}
superTips=
"公共滑动图尺寸不可大于 1200*1200"
superTips=
"公共滑动图尺寸不可大于 1200*1200"
...
...
src/pages/ServiceGoods/index.jsx
View file @
ec597dfc
...
@@ -141,6 +141,7 @@ const ServiceGoods = options => {
...
@@ -141,6 +141,7 @@ const ServiceGoods = options => {
const
submitEvent
=
async
()
=>
{
const
submitEvent
=
async
()
=>
{
const
checkPromiseList
=
clearCurrent
(
checkFormList
).
map
(({
current
})
=>
current
.
onCheck
());
const
checkPromiseList
=
clearCurrent
(
checkFormList
).
map
(({
current
})
=>
current
.
onCheck
());
const
resuslt
=
await
Promise
.
all
(
checkPromiseList
);
const
resuslt
=
await
Promise
.
all
(
checkPromiseList
);
console
.
log
(
'
resuslt :>>
'
,
resuslt
);
if
(
!
resuslt
.
includes
(
null
))
{
if
(
!
resuslt
.
includes
(
null
))
{
const
params
=
resuslt
.
reduce
((
origin
,
item
)
=>
{
const
params
=
resuslt
.
reduce
((
origin
,
item
)
=>
{
const
{
temp
,
...
other
}
=
item
;
const
{
temp
,
...
other
}
=
item
;
...
...
src/pages/ServiceGoods/utils.js
View file @
ec597dfc
...
@@ -224,6 +224,8 @@ export const createSkuListData = (first, second, firstSpecId, secondSpecId, skuL
...
@@ -224,6 +224,8 @@ export const createSkuListData = (first, second, firstSpecId, secondSpecId, skuL
copy
.
secondSpecValue
=
sec
.
secondSpecValue
;
copy
.
secondSpecValue
=
sec
.
secondSpecValue
;
list
.
push
(
copy
);
list
.
push
(
copy
);
});
});
}
else
if
(
skuList
&&
skuList
.
length
)
{
list
.
push
(...
skuList
);
}
else
{
}
else
{
// 缺少一级和二级规格时生成的编辑表格
// 缺少一级和二级规格时生成的编辑表格
list
.
push
(
skuItem
);
list
.
push
(
skuItem
);
...
...
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