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
shenshaokai
jinfa-platform
Commits
dd7275d7
Commit
dd7275d7
authored
Mar 24, 2022
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 对接新增商品发货周期和新增属性值功能
parent
8fec28f5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
10 deletions
+20
-10
basicInfoForm.tsx
...ages/commodity/products/addProductsItem/basicInfoForm.tsx
+4
-1
logisticsForm.tsx
...ages/commodity/products/addProductsItem/logisticsForm.tsx
+3
-1
productAttributeForm.tsx
...mmodity/products/addProductsItem/productAttributeForm.tsx
+7
-8
index.ts
src/store/product/index.ts
+6
-0
No files found.
src/pages/commodity/products/addProductsItem/basicInfoForm.tsx
View file @
dd7275d7
...
...
@@ -64,6 +64,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
setProductName
,
setSelectCategoryId
,
setSelectBrandId
,
setSendCycle
,
}
=
ProductStore
useEffect
(()
=>
{
...
...
@@ -147,11 +148,13 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
setShowCategory
(
data
?.
type
)
setAttributeLists
(
data
?.
customerAttributeList
)
setSelectCategoryId
(
seletCategoryId
)
setSendCycle
(
data
?.
sendCycle
||
0
)
})
}
else
else
{
setShowCategory
(
null
)
}
}
const
onCommodityAreaChange
=
(
value
:
any
,
selected
:
any
)
=>
{
let
areaParams
:
AreaParams
=
{
...
...
src/pages/commodity/products/addProductsItem/logisticsForm.tsx
View file @
dd7275d7
...
...
@@ -33,7 +33,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
const
[
banCarriageType
,
setBanCarriageType
]
=
useState
(
false
)
const
[
template
,
setTemplate
]
=
useState
(
false
)
// 是否必填运费模板
const
{
productInfoByEdit
,
selectCategoryId
,
productPriceType
}
=
ProductStore
const
{
productInfoByEdit
,
selectCategoryId
,
productPriceType
,
sendCycle
}
=
ProductStore
useEffect
(()
=>
{
//传入ref给父级
...
...
@@ -85,6 +85,8 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
}
},
[
productPriceType
])
useEffect
(()
=>
{
logisticsForm
.
setFieldsValue
({
sendCycle
:
sendCycle
})
},
[
sendCycle
])
const
changeDeliveryType
=
(
e
)
=>
{
console
.
log
(
e
)
setDeliveryType
(
e
.
target
.
value
)
...
...
src/pages/commodity/products/addProductsItem/productAttributeForm.tsx
View file @
dd7275d7
...
...
@@ -45,7 +45,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
const
[
addVisible
,
setAddVisible
]
=
useState
<
boolean
>
(
false
)
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
)
const
currentRow
=
useRef
<
any
>
()
const
[
dataSource
,
setDataSource
]
=
useState
<
any
>
([
...
attributesData
])
const
[
dataSource
,
setDataSource
]
=
useState
<
any
>
([])
const
[
newValue
,
setNewValue
]
=
useState
<
string
>
()
useEffect
(()
=>
{
...
...
@@ -58,6 +58,10 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
},
[])
useEffect
(()
=>
{
setDataSource
(()
=>
[...
attributesData
])
},
[
attributesData
])
useEffect
(()
=>
{
// 属性变动 表明品类品牌变动 清空页面全局参数组合和store的选中属性 重置表单 (只对新增有效)
if
(
history
.
location
.
query
?.
id
)
{
// 编辑第一次执行不清空,之后的变动需要清空
...
...
@@ -153,7 +157,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
}
const
addAtttributeValue
=
(
record
)
=>
{
console
.
log
(
record
)
currentRow
.
current
=
record
setAddVisible
(
true
)
addForm
.
setFieldsValue
({
'name'
:
record
[
'name'
],
isEnable
:
true
,
id
:
record
[
'id'
]})
...
...
@@ -173,16 +176,14 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
if
(
code
===
1000
)
{
const
_dataSource
=
dataSource
.
map
((
item
)
=>
{
if
(
item
.
id
===
currentRow
.
current
.
id
)
{
// @todo 调用后台新增属性值接口 成功后把返回的id写入属性值 目前随机数生成
item
.
customerAttributeValueList
.
push
({
...
item
.
customerAttributeValueList
[
0
],
id
:
parseInt
(
Math
.
random
()
*
10000
+
''
)
,
id
:
data
,
...
values
,
})
}
return
item
})
console
.
log
(
_dataSource
)
setDataSource
([...
_dataSource
])
setAddVisible
(
false
)
setLoading
(
false
)
...
...
@@ -208,18 +209,16 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
value
:
newValue
}).
then
(({
code
,
data
})
=>
{
if
(
code
===
1000
)
{
// @todo 调用后台新增属性值接口 成功后把返回的id写入属性值 目前随机数生成
const
_dataSource
=
dataSource
.
map
((
item
,
index
)
=>
{
if
(
item
.
id
===
record
.
id
)
{
item
.
customerAttributeValueList
.
push
({
...
item
.
customerAttributeValueList
[
0
],
id
:
parseInt
(
Math
.
random
()
*
10000
+
''
)
,
id
:
data
,
value
:
newValue
,
})
}
return
item
})
console
.
log
(
_dataSource
)
setDataSource
([...
_dataSource
])
setNewValue
(
''
)
}
...
...
src/store/product/index.ts
View file @
dd7275d7
...
...
@@ -31,6 +31,7 @@ class ProductStore implements IProductModule {
@
observable
public
tabClickItem
:
any
[]
=
[];
// tab标签页点击项
@
observable
public
productPriceType
:
any
=
null
;
// 商品价格类型
@
observable
public
isRecombination
:
boolean
=
false
;
// 编辑时 是否重新属性组合
@
observable
public
sendCycle
:
number
;
// 品类发货周期
/** 计算操作 **/
// 加工接口返回的数据,用户编辑回显数据
...
...
@@ -234,6 +235,11 @@ class ProductStore implements IProductModule {
this
.
isRecombination
=
data
}
@
action
.
bound
public
setSendCycle
(
data
:
number
)
{
this
.
sendCycle
=
data
}
}
export
default
ProductStore
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