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
3369cfc5
Commit
3369cfc5
authored
Nov 02, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 处理商品编辑下编辑按属性设置图片重置到第一项的问题、处理资金账户详情缺少状态报错问题
parent
e366904d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
26 deletions
+74
-26
addGoods.tsx
src/pages/commodity/goods/addGoods.tsx
+1
-0
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+2
-1
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+58
-17
productImageForm.tsx
...s/commodity/products/addProductsItem/productImageForm.tsx
+10
-6
constant.ts
src/pages/payandSettle/constant.ts
+2
-1
index.tsx
src/pages/trademark/index.tsx
+1
-1
No files found.
src/pages/commodity/goods/addGoods.tsx
View file @
3369cfc5
...
...
@@ -134,6 +134,7 @@ const AddGoods = () => {
onFinish=
{
onFinish
}
colon=
{
false
}
autoComplete=
"off"
labelAlign=
"left"
>
<
Form
.
Item
name=
"code"
...
...
src/pages/commodity/products/addProducts.tsx
View file @
3369cfc5
...
...
@@ -31,6 +31,7 @@ const AddProducts: React.FC<{}> = (props) => {
const
[
responseId
,
setReponseId
]
=
useState
<
number
>
(
null
)
const
[
attributeList
,
setAttributeList
]
=
useState
<
any
[]
>
([])
const
[
clickTabIndex
,
setClickTabIndex
]
=
useState
<
string
[]
>
([
'1'
])
const
[
clickCurrentIndex
,
setClickCurrentIndex
]
=
useState
<
string
>
(
'1'
)
const
[
isDisableSaveBtn
,
setIsDisableSaveBtn
]
=
useState
<
boolean
>
(
false
)
const
[
currentTemplateName
,
setCurrentTemplateName
]
=
useState
<
string
>
()
let
[
formRefs
,
setFormRefs
]
=
useState
([])
//子form的ref数组
...
...
@@ -337,8 +338,8 @@ const AddProducts: React.FC<{}> = (props) => {
}
const
callback
=
(
key
:
any
)
=>
{
setClickCurrentIndex
(
key
)
setClickTabIndex
([...
clickTabIndex
,
key
])
// 点击项存入store 用于后续编辑步骤判断 是直接点击进去某个子模块还是已经进入子模块 从而采用缓存数据还是采用接口返回的编辑数据
setTabClickItem
([...
clickTabIndex
,
key
])
}
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
3369cfc5
...
...
@@ -37,7 +37,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const
{
onRef
}
=
props
const
priceFormRef
=
useRef
()
const
updateFlag
=
useRef
(
true
)
// 是否第一次构建
const
updateAttributeFlag
=
useRef
(
true
)
// 是否第一次商品属性变动的构建
const
clearPrice
=
useRef
(
false
)
const
[
priceForm
]
=
Form
.
useForm
()
const
[
setPriceForm
]
=
Form
.
useForm
()
const
[
planPrice
,
setPlanPrice
]
=
useState
(
1
)
...
...
@@ -56,17 +56,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const
[
combineAttributeChangeFatories
,
setCombineAttributeChangeFatories
]
=
useState
<
number
>
(
0
)
const
memoizedValue
=
useMemo
(()
=>
{
let
len
=
combineAttributeArray
.
length
console
.
log
(
len
,
combineAttributeChangeFatories
)
if
(
len
===
combineAttributeChangeFatories
){
return
false
}
else
{
setCombineAttributeChangeFatories
(
len
)
return
true
}
}
,
[
combineAttributeArray
.
length
])
// 监听属性组合是否有变动(由属性组合引发数据构建清空价格)
const
[
colums
,
setColumns
]
=
useState
<
ColumnType
<
any
>
[]
>
()
const
{
ProductStore
}
=
store
const
{
...
...
@@ -85,6 +74,45 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
tabClickItem
}
=
ProductStore
// const memoizedValue = useMemo(() => {
// let len = combineAttributeArray.length
// console.log(len, combineAttributeChangeFatories)
// // 第一次构建先和编辑数据比对
// // if(updateFlag){
// // if(len === productInfoByEdit?.unitPriceAndPicList.length){
// // return false
// // } else {
// // return true
// // }
// // }
// if(len === combineAttributeChangeFatories){
// return false
// }else{
// setCombineAttributeChangeFatories(len)
// return true
// }
// } , [combineAttributeArray.length]) // 监听属性组合是否有变动(由属性组合引发数据构建清空价格)
// // *bug* 不点击本页面之前就变更了价格属性 这里的属性组合监听就失效了
useEffect
(()
=>
{
let
len
=
combineAttributeArray
.
length
// 第一次构建先和编辑数据比对
if
(
updateFlag
){
if
(
len
===
productInfoByEdit
?.
unitPriceAndPicList
.
length
){
clearPrice
.
current
=
false
}
else
{
clearPrice
.
current
=
true
}
}
if
(
len
===
combineAttributeChangeFatories
){
clearPrice
.
current
=
false
}
else
{
setCombineAttributeChangeFatories
(
len
)
clearPrice
.
current
=
true
}
// console.log(len, combineAttributeChangeFatories, `是否初次构建|${updateFlag.current}`, clearPrice.current, '监听前后属性条目的变动')
},
[
combineAttributeArray
.
length
])
_tableDataSource
=
useMemo
(()
=>
tableDataSource
,
[
tableDataSource
])
// 保持最新值
useEffect
(()
=>
{
...
...
@@ -113,9 +141,21 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
},
[
selectCategoryId
])
/**
* 添加clearPrice.current依赖,处理在未渲染价格属性前已经变动了价格属性组合,此时需要清空价格数据
* bug: 在不改变那价格属性组合情况下修改价格可以保留,当属性组合变动之后,修改价格再做其他修改时会清空价格(原因:clearPrice.current始终为true)
* 添加 tabClickItem
* 价格属性变动引发的构建,清空价格(仅清空一次)之后置为false
*/
useEffect
(()
=>
{
constructedCallback
()
},[
productName
,
selectedGoods
,
productSelectAttribute
,
planPrice
,
tabClickItem
])
},[
productName
,
selectedGoods
,
productSelectAttribute
,
planPrice
,
clearPrice
.
current
])
useEffect
(()
=>
{
if
(
clearPrice
.
current
){
constructedCallback
()
clearPrice
.
current
=
false
}
},[
clearPrice
.
current
])
/* 生成建表所需要的属性 属性值等数组数据 */
const
generateNeedData
=
(
hasAttribute
:
IProductSelectAttribute
[])
=>
{
...
...
@@ -291,13 +331,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
}
else
{
_tempObj
[
'对应货品'
]
=
selectedGoods
.
length
>
0
?
selectedGoods
[
0
].
id
:
0
// _tempObj['单价'] = {}
_tempObj
[
'单价'
]
=
_tableDataSource
[
i
]
&&
tableDataSource
[
i
][
'单价'
]
||
{}
}
// 价格属性变动引发的构建清空价格
if
(
memoizedValue
){
_tempObj
[
'单价'
]
=
{}
}
// 价格属性变动引发的构建清空价格(仅清空一次)
if
(
clearPrice
.
current
){
_tempObj
[
'单价'
]
=
{}
}
// selectedGoods数据是前面表格选择的数组
console
.
log
(
_tableDataSource
,
selectedGoods
,
'构建表格单价数据'
,
memoizedValue
)
// console.log(_tableDataSource , selectedGoods, '构建表格单价数据', `是否初次构建|${updateFlag.current}`, clearPrice.current
)
_tableData
.
push
(
_tempObj
)
})
}
else
{
// length不存在,默认只有商品名称一行(无价格属性组合)只有一行的情况下单价可能有,可能阶梯价,也可能没有
...
...
src/pages/commodity/products/addProductsItem/productImageForm.tsx
View file @
3369cfc5
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
import
React
,
{
useState
,
useEffect
,
useRef
,
useImperativeHandle
}
from
'react'
import
{
history
}
from
'umi'
import
{
message
,
Modal
,
Row
,
Col
,
Alert
,
Upload
,
Radio
,
Button
}
from
'antd'
import
{
EditOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
...
...
@@ -13,7 +13,6 @@ import { inject, observer } from 'mobx-react'
import
{
store
}
from
'@/store'
const
ProductImageForm
:
React
.
FC
<
{}
>
=
(
props
)
=>
{
const
fff
=
useRef
<
number
>
(
0
)
const
[
defaultChecked
,
setDefaultChecked
]
=
useState
(
-
1
)
const
[
priceAttributeParamsByRender
,
setPriceAttributeParamsByRender
]
=
useState
<
any
[]
>
([])
const
[
commonImageList
,
setCommonImageList
]
=
useState
<
any
>
([])
...
...
@@ -31,7 +30,14 @@ const ProductImageForm: React.FC<{}> = (props) => {
const
editRowIndexRef
=
useRef
<
number
>
(
0
)
const
{
ProductStore
}
=
store
const
{
priceAttributeParams
,
productInfoByEdit
,
setProductAttributeAndImageParams
,
setIsAllAttributePic
,
selectCategoryId
}
=
ProductStore
const
{
priceAttributeParams
,
productInfoByEdit
,
setProductAttributeAndImageParams
,
setIsAllAttributePic
,
selectCategoryId
,
tabClickItem
}
=
ProductStore
// 再次点击tab 选中置为0
useEffect
(()
=>
{
if
(
tabClickItem
.
filter
(
i
=>
i
===
'5'
).
length
>
1
){
clickItemTab
(
0
)
}
},
[
tabClickItem
])
useEffect
(()
=>
{
if
(
history
.
location
.
query
?.
id
){
...
...
@@ -57,6 +63,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
return
_commodityPicItem
})
setMaintainImageData
(
o
)
clickItemTab
(
0
)
}
},
[])
...
...
@@ -99,7 +106,6 @@ const ProductImageForm: React.FC<{}> = (props) => {
_priceAttributeParams
=
priceAttributeParams
.
map
((
_item
,
_index
)
=>
{
let
_obj
=
{...
_item
}
_obj
.
commodityPic
=
maintainImageData
[
_index
]
||
[]
// _obj.commodityPic = _commodityPicItem
return
_obj
})
}
else
{
...
...
@@ -109,8 +115,6 @@ const ProductImageForm: React.FC<{}> = (props) => {
return
_obj
})
}
setDefaultChecked
(
0
)
clickItemTab
(
0
)
setPriceAttributeParamsByRender
(
_priceAttributeParams
)
setProductAttributeAndImageParams
(
_priceAttributeParams
)
// 初始化若是按所有属性共用做显示处理
...
...
src/pages/payandSettle/constant.ts
View file @
3369cfc5
...
...
@@ -101,7 +101,8 @@ export const CREDIT_INNER_STATUS_BADGE_MAP = {
'4'
:
{
title
:
'提现成功'
,
type
:
'success'
},
'5'
:
{
title
:
'提现失败'
,
type
:
'danger'
},
'6'
:
{
title
:
'支付中'
,
type
:
'processing'
},
'7'
:
{
title
:
'确认到账'
,
type
:
'success'
},
'7'
:
{
title
:
'支付失败'
,
type
:
'danger'
},
'8'
:
{
title
:
'确认到账'
,
type
:
'success'
},
}
// 流转状态
...
...
src/pages/trademark/index.tsx
View file @
3369cfc5
...
...
@@ -114,7 +114,7 @@ const Trademark: React.FC<{}> = () => {
</
Dropdown
>
</>
:
<>
<
Button
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/memberCenter/commodityAbility/trademark/add
Brand
?id=${record.id}`
)
}
>
修改
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/memberCenter/commodityAbility/trademark/add?id=${record.id}`
)
}
>
修改
</
Button
>
<
Button
onClick=
{
()
=>
handelDelete
(
record
)
}
type=
'link'
>
删除
</
Button
>
</>
}
...
...
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