Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
黄庭坚
jinfa-platform
Commits
438c5643
Commit
438c5643
authored
Sep 01, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:新建商品无属性无货品下异常
parent
43a1de49
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
24 deletions
+28
-24
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+4
-4
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+23
-20
selectGoodsForm.tsx
...es/commodity/products/addProductsItem/selectGoodsForm.tsx
+1
-0
No files found.
src/pages/commodity/products/addProducts.tsx
View file @
438c5643
...
@@ -31,6 +31,7 @@ const AddProducts: React.FC<{}> = (props) => {
...
@@ -31,6 +31,7 @@ const AddProducts: React.FC<{}> = (props) => {
const
{
ProductStore
}
=
store
const
{
ProductStore
}
=
store
const
{
const
{
productSelectAttribute
,
productSelectAttribute
,
priceAttributeParams
,
productAttributeAndImageParams
,
productAttributeAndImageParams
,
areaOption
,
areaOption
,
productDescription
,
productDescription
,
...
@@ -131,9 +132,9 @@ const AddProducts: React.FC<{}> = (props) => {
...
@@ -131,9 +132,9 @@ const AddProducts: React.FC<{}> = (props) => {
if
(
productAttributeAndImageParams
.
length
>
0
){
if
(
productAttributeAndImageParams
.
length
>
0
){
productAttributeAndImageParams
.
map
(
_item
=>
{
productAttributeAndImageParams
.
map
(
_item
=>
{
console
.
log
(
_item
,
'_item'
)
console
.
log
(
_item
,
'_item'
)
_item
.
goods
=
{
id
:
_item
.
goodsId
}
// id为0表示无货品
delete
_item
.
goodsId
if
(
_item
.
attributeAndValueList
.
length
>
0
){
if
(
_item
.
attributeAndValueList
.
length
>
0
){
_item
.
goods
=
{
id
:
_item
.
goodsId
}
delete
_item
.
goodsId
_item
.
attributeAndValueList
.
map
(
__item
=>
{
_item
.
attributeAndValueList
.
map
(
__item
=>
{
delete
__item
.
customerAttributeName
delete
__item
.
customerAttributeName
// **** 新字段结构变更
// **** 新字段结构变更
...
@@ -154,8 +155,7 @@ const AddProducts: React.FC<{}> = (props) => {
...
@@ -154,8 +155,7 @@ const AddProducts: React.FC<{}> = (props) => {
throw
new
Error
(
'每项请至少上传一张商品图片!'
)
throw
new
Error
(
'每项请至少上传一张商品图片!'
)
}
}
})
})
}
}
else
{
else
{
throw
new
Error
(
'每项请至少上传一张商品图片!'
)
throw
new
Error
(
'每项请至少上传一张商品图片!'
)
}
}
}
catch
(
e
){
}
catch
(
e
){
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
438c5643
...
@@ -197,26 +197,29 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
...
@@ -197,26 +197,29 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
</>
</>
})
})
}
else
if
(
history
.
location
.
query
?.
id
){
// 此时没有货品并且处于编辑状态 取接口返回的数据
}
else
if
(
history
.
location
.
query
?.
id
){
// 此时没有货品并且处于编辑状态 取接口返回的数据
let
goodsInApi
:
any
=
Object
.
values
(
productInfoByEdit
.
unitPriceAndPicList
.
map
(
_
=>
_
.
goods
).
reduce
((
item
,
next
)
=>
{
let
_goods
:
any
[]
=
Object
.
values
(
productInfoByEdit
.
unitPriceAndPicList
.
map
(
_
=>
_
.
goods
))
item
[
next
.
id
]
=
next
if
(
_goods
.
indexOf
(
null
)
===-
1
){
return
item
let
goodsInApi
:
any
=
_goods
.
reduce
((
item
,
next
)
=>
{
},{}))
item
[
next
.
id
]
=
next
return
item
_col
.
push
({
},{})
title
:
'对应货品'
,
dataIndex
:
'对应货品'
,
_col
.
push
({
key
:
'对应货品'
,
title
:
'对应货品'
,
width
:
360
,
dataIndex
:
'对应货品'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<>
key
:
'对应货品'
,
<
Select
style=
{
{
width
:
'100%'
}
}
defaultValue=
{
text
}
onChange=
{
(
v
)
=>
{
tableSelelctChange
(
v
,
record
)
}
}
>
width
:
360
,
{
render
:
(
text
:
any
,
record
:
any
)
=>
<>
goodsInApi
.
length
>
0
&&
goodsInApi
.
map
(
_item
=>
(
<
Select
style=
{
{
width
:
'100%'
}
}
defaultValue=
{
text
}
onChange=
{
(
v
)
=>
{
tableSelelctChange
(
v
,
record
)
}
}
>
<
Option
key=
{
_item
.
id
}
value=
{
_item
.
id
}
>
{
_item
.
code
}
/
{
_item
.
name
}
/
{
_item
.
type
}
/¥
{
_item
.
costPrice
}
</
Option
>
{
))
goodsInApi
.
length
>
0
&&
goodsInApi
.
map
(
_item
=>
(
}
<
Option
key=
{
_item
.
id
}
value=
{
_item
.
id
}
>
{
_item
.
code
}
/
{
_item
.
name
}
/
{
_item
.
type
}
/¥
{
_item
.
costPrice
}
</
Option
>
</
Select
>
))
</>
}
})
</
Select
>
</>
})
}
}
}
if
(
_attributeNameArr
.
length
>
0
){
if
(
_attributeNameArr
.
length
>
0
){
...
...
src/pages/commodity/products/addProductsItem/selectGoodsForm.tsx
View file @
438c5643
...
@@ -41,6 +41,7 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
...
@@ -41,6 +41,7 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
item
[
next
.
id
]
=
next
;
item
[
next
.
id
]
=
next
;
return
item
return
item
},{}))
},{}))
console
.
log
(
goodsArr
,
'goods'
)
if
(
goodsArr
.
length
>
0
){
if
(
goodsArr
.
length
>
0
){
setIsChecked
(
true
)
setIsChecked
(
true
)
setIsSelectGoods
(
true
)
setIsSelectGoods
(
true
)
...
...
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