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
f48b3497
Commit
f48b3497
authored
Sep 23, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:商品/渠道商品积分/现货类型符号文字显示异常
parent
825d6118
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
56 deletions
+87
-56
setPrice.tsx
src/pages/commodity/products/addChannelItem/setPrice.tsx
+1
-1
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+12
-8
modifyDirectChannel.tsx
src/pages/commodity/products/modifyDirectChannel.tsx
+18
-18
viewDirectChannel.tsx
src/pages/commodity/products/viewDirectChannel.tsx
+1
-1
viewProducts.tsx
src/pages/commodity/products/viewProducts.tsx
+7
-7
addRule.tsx
src/pages/transaction/transactionRules/addRule.tsx
+5
-4
RuleSetting.tsx
...s/transaction/transactionRules/components/RuleSetting.tsx
+40
-6
index.tsx
src/pages/transaction/transactionRules/effects/index.tsx
+2
-10
index.tsx
src/pages/transaction/transactionRules/schema/index.tsx
+1
-1
No files found.
src/pages/commodity/products/addChannelItem/setPrice.tsx
View file @
f48b3497
...
@@ -138,7 +138,7 @@ const SetPrice:React.FC<IProps> = (props) => {
...
@@ -138,7 +138,7 @@ const SetPrice:React.FC<IProps> = (props) => {
render
:
(
text
,
record
)
=>
{
render
:
(
text
,
record
)
=>
{
if
(
!
text
||
JSON
.
stringify
(
text
)
===
'{}'
)
return
null
if
(
!
text
||
JSON
.
stringify
(
text
)
===
'{}'
)
return
null
return
Object
.
keys
(
text
).
map
((
v
,
i
)
=>
{
return
Object
.
keys
(
text
).
map
((
v
,
i
)
=>
{
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
text
[
v
]
}
</
span
></
span
><
br
/></>
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
{
priceType
===
3
?
''
:
'¥'
}
{
text
[
v
]
}
</
span
></
span
><
br
/></>
})
})
}
}
})
})
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
f48b3497
...
@@ -43,7 +43,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
...
@@ -43,7 +43,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const
updateFlag
=
useRef
(
true
)
// 是否第一次构建
const
updateFlag
=
useRef
(
true
)
// 是否第一次构建
const
[
priceForm
]
=
Form
.
useForm
()
const
[
priceForm
]
=
Form
.
useForm
()
const
[
setPriceForm
]
=
Form
.
useForm
()
const
[
setPriceForm
]
=
Form
.
useForm
()
const
[
planPrice
,
setPlanPrice
]
=
useState
(
1
)
//商品定价类型
const
[
planPrice
,
setPlanPrice
]
=
useState
(
1
)
//商品定价类型 ref替代
// const priceTypeRef = useRef<number>(1)
const
[
unitData
,
setUnitData
]
=
useState
<
any
>
([])
const
[
unitData
,
setUnitData
]
=
useState
<
any
>
([])
const
[
unitValue
,
setUnitValue
]
=
useState
(
undefined
)
const
[
unitValue
,
setUnitValue
]
=
useState
(
undefined
)
const
[
setPriceModal
,
setSetPriceModal
]
=
useState
(
false
)
const
[
setPriceModal
,
setSetPriceModal
]
=
useState
(
false
)
...
@@ -76,8 +77,9 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
...
@@ -76,8 +77,9 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
onRef
(
priceFormRef
)
onRef
(
priceFormRef
)
if
(
history
.
location
.
query
?.
id
){
// 编辑情况下 用于判断价格类型和显示单位
if
(
history
.
location
.
query
?.
id
){
// 编辑情况下 用于判断价格类型和显示单位
setPlanPrice
(
productInfoByEdit
?.
priceType
)
setPlanPrice
(
productInfoByEdit
?.
priceType
)
// priceTypeRef.current = productInfoByEdit?.priceType
handleUnitSearch
(
getPriceAttributeFormParamsByEdit
.
unitName
)
handleUnitSearch
(
getPriceAttributeFormParamsByEdit
.
unitName
)
setMinOrderNumber
(
productInfoByEdit
?.
minOrder
)
// 先设置最小起订数 便于后续价格校验
setMinOrderNumber
(
productInfoByEdit
?.
minOrder
)
}
}
return
()
=>
{
return
()
=>
{
console
.
log
(
'价格属性组件卸载'
)
console
.
log
(
'价格属性组件卸载'
)
...
@@ -87,8 +89,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
...
@@ -87,8 +89,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
constructedCallback
()
constructedCallback
()
console
.
log
(
productSelectAttribute
,
'productSelectAttribute'
)
//
console.log(productSelectAttribute, 'productSelectAttribute')
},[
productName
,
selectedGoods
,
productSelectAttribute
,
planPrice
])
},[
productName
,
selectedGoods
,
productSelectAttribute
,
planPrice
])
/* 生成建表所需要的属性 属性值等数组数据 */
/* 生成建表所需要的属性 属性值等数组数据 */
const
generateNeedData
=
(
hasAttribute
:
IProductSelectAttribute
[])
=>
{
const
generateNeedData
=
(
hasAttribute
:
IProductSelectAttribute
[])
=>
{
...
@@ -225,7 +227,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
...
@@ -225,7 +227,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
}
}
}
if
(
_attributeNameArr
?.
length
>
0
){
// ?*9.12*
if
(
_attributeNameArr
?.
length
>
0
){
_attributeNameArr
.
map
(
_attr
=>
{
_attributeNameArr
.
map
(
_attr
=>
{
_col
.
push
({
_col
.
push
({
title
:
_attr
,
title
:
_attr
,
...
@@ -243,7 +245,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
...
@@ -243,7 +245,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
let
_priceRange
=
_tableDataSource
[
record
[
'索引'
]][
"单价"
]
let
_priceRange
=
_tableDataSource
[
record
[
'索引'
]][
"单价"
]
if
(
!
_priceRange
||
JSON
.
stringify
(
_priceRange
)
===
'{}'
)
return
null
if
(
!
_priceRange
||
JSON
.
stringify
(
_priceRange
)
===
'{}'
)
return
null
return
Object
.
keys
(
_priceRange
).
map
((
v
,
i
)
=>
{
return
Object
.
keys
(
_priceRange
).
map
((
v
,
i
)
=>
{
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
_priceRange
[
v
]
}
</
span
></
span
><
br
/></>
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
{
planPrice
===
3
?
''
:
'¥'
}
{
_priceRange
[
v
]
}
</
span
></
span
><
br
/></>
})
})
}
}
})
})
...
@@ -277,7 +279,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
...
@@ -277,7 +279,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
Array
.
isArray
(
_rowArr
)
?
_rowArr
.
map
((
__rowArr
,
index
)
=>
{
Array
.
isArray
(
_rowArr
)
?
_rowArr
.
map
((
__rowArr
,
index
)
=>
{
_tempObj
[
_attributeNameArr
[
index
]]
=
__rowArr
_tempObj
[
_attributeNameArr
[
index
]]
=
__rowArr
})
:
_tempObj
[
_attributeNameArr
[
i
]
||
_attributeNameArr
[
0
]]
=
_rowArr
// 当一项变动的时候 找_attributeNameArr可能会找不到 找不到的情况下置为索引0的那项
})
:
_tempObj
[
_attributeNameArr
[
i
]
||
_attributeNameArr
[
0
]]
=
_rowArr
// 当一项变动的时候 找_attributeNameArr可能会找不到 找不到的情况下置为索引0的那项
if
(
productInfoByEdit
?.
id
){
if
(
productInfoByEdit
?.
id
){
// 编辑的时候,先指定数据中的货品id,如果是重新组合的不存在id就使用选择的货品中的第一个,如果没有置为0;同理,不存在单价就置为{}
// 编辑的时候,先指定数据中的货品id,如果是重新组合的不存在id就使用选择的货品中的第一个,如果没有置为0;同理,不存在单价就置为{}
_tempObj
[
'对应货品'
]
=
productInfoByEdit
.
unitPriceAndPicList
[
i
]?.
goods
?.
id
||
selectedGoods
[
0
]?.
id
||
0
_tempObj
[
'对应货品'
]
=
productInfoByEdit
.
unitPriceAndPicList
[
i
]?.
goods
?.
id
||
selectedGoods
[
0
]?.
id
||
0
...
@@ -293,15 +294,17 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
...
@@ -293,15 +294,17 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
let
_tempObj
:
any
=
{
索引
:
0
,
商品名称
:
productName
}
let
_tempObj
:
any
=
{
索引
:
0
,
商品名称
:
productName
}
_tempObj
[
'对应货品'
]
=
selectedGoods
.
length
>
0
?
selectedGoods
[
0
].
id
:
0
// 编辑情况下 对应货品id和单价 特殊处理
_tempObj
[
'对应货品'
]
=
selectedGoods
.
length
>
0
?
selectedGoods
[
0
].
id
:
0
// 编辑情况下 对应货品id和单价 特殊处理
_tempObj
[
'单价'
]
=
productInfoByEdit
?.
unitPriceAndPicList
[
0
]?.
unitPrice
||
{}
_tempObj
[
'单价'
]
=
productInfoByEdit
?.
unitPriceAndPicList
[
0
]?.
unitPrice
||
{}
_tableData
.
push
(
_tempObj
)
_tableData
.
push
(
_tempObj
)
}
}
// console.log(_tableData, '_tableData') // 只有一项 变动情况下表格数据的key获取不到
// console.log(_tableData, '_tableData') // 只有一项 变动情况下表格数据的key获取不到
_tableDataSource
=
_tableData
_tableDataSource
=
_tableData
// 有前面tab变动引起的二次构建 需要清空价格数据
// 有前面tab变动引起的二次构建 需要清空价格数据
if
(
updateFlag
.
current
){
if
(
updateFlag
.
current
){
// *****bug编辑积分商品(非现货价格)会导致价格类型变动引发重复渲染*****
updateFlag
.
current
=
false
updateFlag
.
current
=
false
}
else
{
}
else
{
// ***** 编辑情况下且是积分商品 不做清空单价处理*****
if
(
!
(
productInfoByEdit
?.
id
&&
planPrice
===
3
))
_tableDataSource
.
map
(
item
=>
item
[
'单价'
]
=
{})
_tableDataSource
.
map
(
item
=>
item
[
'单价'
]
=
{})
}
}
setTableDataSource
(
productName
?
_tableDataSource
:
[])
// 通过商品名称来判断是否显示表格数据
setTableDataSource
(
productName
?
_tableDataSource
:
[])
// 通过商品名称来判断是否显示表格数据
...
@@ -406,6 +409,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
...
@@ -406,6 +409,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
setPriceForm
.
resetFields
()
setPriceForm
.
resetFields
()
setLadderPrice
(
false
)
setLadderPrice
(
false
)
setPlanPrice
(
v
.
target
.
value
)
setPlanPrice
(
v
.
target
.
value
)
// priceTypeRef.current = v.target.value
}
}
const
setPriceOk
=
()
=>
{
const
setPriceOk
=
()
=>
{
...
...
src/pages/commodity/products/modifyDirectChannel.tsx
View file @
f48b3497
...
@@ -41,7 +41,6 @@ const ModifyDirectChannel:React.FC<{}> = () => {
...
@@ -41,7 +41,6 @@ const ModifyDirectChannel:React.FC<{}> = () => {
const
[
visibleAddSpec
,
setVisibleAddSpec
]
=
useState
(
false
)
const
[
visibleAddSpec
,
setVisibleAddSpec
]
=
useState
(
false
)
const
[
channelDetails
,
setChannelDetails
]
=
useState
<
any
>
()
const
[
channelDetails
,
setChannelDetails
]
=
useState
<
any
>
()
const
[
priceType
,
setPriceType
]
=
useState
<
any
>
()
const
[
specColumn
,
setSpecColumn
]
=
useState
<
any
[]
>
([])
const
[
specColumn
,
setSpecColumn
]
=
useState
<
any
[]
>
([])
const
[
specTableData
,
setSpecTableData
]
=
useState
<
any
[]
>
([])
const
[
specTableData
,
setSpecTableData
]
=
useState
<
any
[]
>
([])
const
[
originTableData
,
setOriginTableData
]
=
useState
<
any
[]
>
([])
const
[
originTableData
,
setOriginTableData
]
=
useState
<
any
[]
>
([])
...
@@ -56,6 +55,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
...
@@ -56,6 +55,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
const
[
submitParams
,
setSubmitParams
]
=
useState
<
any
>
()
const
[
submitParams
,
setSubmitParams
]
=
useState
<
any
>
()
const
flagRef
=
useRef
(
false
)
// 价格数据是否被模态框替换
const
flagRef
=
useRef
(
false
)
// 价格数据是否被模态框替换
const
priceTypeRef
=
useRef
<
number
>
()
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -66,9 +66,9 @@ const ModifyDirectChannel:React.FC<{}> = () => {
...
@@ -66,9 +66,9 @@ const ModifyDirectChannel:React.FC<{}> = () => {
const
{
data
}
=
res
const
{
data
}
=
res
if
(
res
.
code
===
1000
){
if
(
res
.
code
===
1000
){
setChannelDetails
(
data
)
setChannelDetails
(
data
)
setPriceType
(
data
.
channelCommodity
.
commodity
.
priceType
)
priceTypeRef
.
current
=
data
.
channelCommodity
.
commodity
.
priceType
formPrice
.
setFieldsValue
({
isMemberPrice
:
data
?.
isMemberPrice
})
formPrice
.
setFieldsValue
({
isMemberPrice
:
data
?.
isMemberPrice
})
structureTable
(
data
.
unitPriceAndPicList
,
data
.
channelCommodity
.
commodity
.
name
,
true
)
// 初始已有规格
structureTable
(
data
.
unitPriceAndPicList
,
data
.
channelCommodity
.
commodity
,
true
)
// 初始已有规格
}
}
})
})
},
[])
},
[])
...
@@ -97,8 +97,8 @@ const ModifyDirectChannel:React.FC<{}> = () => {
...
@@ -97,8 +97,8 @@ const ModifyDirectChannel:React.FC<{}> = () => {
}
}
/** name<string>商品名称 noModal<boolean>不执行规格modla的操作 */
/** name<string>商品名称 noModal<boolean>不执行规格modla的操作 */
const
structureTable
=
(
data
:
any
,
name
?:
string
,
noModal
?:
boolean
)
=>
{
const
structureTable
=
(
data
:
any
,
commodity
?:
any
,
noModal
?:
boolean
)
=>
{
console
.
log
(
data
,
'structureTableData'
)
console
.
log
(
data
,
'structureTableData'
)
// 构建规格弹框table 列columns
// 构建规格弹框table 列columns
let
col
:
any
=
[]
let
col
:
any
=
[]
let
temp
:
any
=
[]
let
temp
:
any
=
[]
...
@@ -134,13 +134,13 @@ const ModifyDirectChannel:React.FC<{}> = () => {
...
@@ -134,13 +134,13 @@ const ModifyDirectChannel:React.FC<{}> = () => {
},
},
...
temp
,
...
temp
,
{
{
title
:
priceType
===
3
?
'积分'
:
'单价'
,
title
:
priceType
Ref
.
current
===
3
?
'积分'
:
'单价'
,
dataIndex
:
'单价'
,
dataIndex
:
'单价'
,
key
:
'单价'
,
key
:
'单价'
,
render
:
(
text
,
record
)
=>
{
render
:
(
text
,
record
)
=>
{
if
(
!
text
||
JSON
.
stringify
(
text
)
===
'{}'
)
return
null
if
(
!
text
||
JSON
.
stringify
(
text
)
===
'{}'
)
return
null
return
Object
.
keys
(
text
).
map
((
v
,
i
)
=>
{
return
Object
.
keys
(
text
).
map
((
v
,
i
)
=>
{
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
text
[
v
]
}
</
span
></
span
><
br
/></>
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
{
priceTypeRef
.
current
===
3
?
''
:
'¥'
}
{
text
[
v
]
}
</
span
></
span
><
br
/></>
})
})
}
}
})
})
...
@@ -156,7 +156,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
...
@@ -156,7 +156,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
"id"
:
item
.
id
,
// 行数据id
"id"
:
item
.
id
,
// 行数据id
"goodsId"
:
item
.
goods
?.
id
||
''
,
// 货品ID 可能为null
"goodsId"
:
item
.
goods
?.
id
||
''
,
// 货品ID 可能为null
"索引"
:
index
,
"索引"
:
index
,
"商品名称"
:
name
||
channelDetails
?.
channelCommodity
?.
commodity
?.
name
,
"商品名称"
:
commodity
?.
name
||
channelDetails
?.
channelCommodity
?.
commodity
?.
name
,
"对应货品"
:
item
.
goods
?.
name
||
''
,
"对应货品"
:
item
.
goods
?.
name
||
''
,
...
temp
,
...
temp
,
"单价"
:
item
.
unitPrice
"单价"
:
item
.
unitPrice
...
@@ -186,7 +186,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
...
@@ -186,7 +186,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
render
:
(
text
:
any
,
record
:
any
)
=>
{
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
return
(
<>
<>
<
Button
type=
'link'
onClick=
{
()
=>
clickSetPrice
(
record
)
}
>
{
priceType
===
3
?
'设置积分'
:
'设置价格'
}
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
clickSetPrice
(
record
)
}
>
{
priceType
Ref
.
current
===
3
?
'设置积分'
:
'设置价格'
}
</
Button
>
{
channelDetails
.
status
!==
6
&&
<
Button
type=
'link'
onClick=
{
()
=>
clickDelete
(
record
)
}
>
删除
</
Button
>
}
{
channelDetails
.
status
!==
6
&&
<
Button
type=
'link'
onClick=
{
()
=>
clickDelete
(
record
)
}
>
删除
</
Button
>
}
</>
</>
)
)
...
@@ -407,14 +407,14 @@ const ModifyDirectChannel:React.FC<{}> = () => {
...
@@ -407,14 +407,14 @@ const ModifyDirectChannel:React.FC<{}> = () => {
<
PlusOutlined
/>
选择商品规格
<
PlusOutlined
/>
选择商品规格
</
Button
>
</
Button
>
{
{
priceTableData
.
length
>
0
&&
priceType
!=
2
&&
priceTableData
.
length
>
0
&&
priceType
Ref
.
current
!=
2
&&
<
Button
<
Button
type=
"text"
type=
"text"
style=
{
{
float
:
'right'
}
}
style=
{
{
float
:
'right'
}
}
onClick=
{
clickBatchSetPrice
}
onClick=
{
clickBatchSetPrice
}
>
>
<
SettingOutlined
/>
<
SettingOutlined
/>
{
priceType
===
3
?
'批量设置积分'
:
'批量设置价格'
}
{
priceType
Ref
.
current
===
3
?
'批量设置积分'
:
'批量设置价格'
}
</
Button
>
</
Button
>
}
}
<
Table
rowKey=
"id"
dataSource=
{
priceTableData
}
columns=
{
priceColumn
}
style=
{
{
clear
:
'both'
}
}
/>
<
Table
rowKey=
"id"
dataSource=
{
priceTableData
}
columns=
{
priceColumn
}
style=
{
{
clear
:
'both'
}
}
/>
...
@@ -423,7 +423,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
...
@@ -423,7 +423,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
</
Card
>
</
Card
>
<
Modal
<
Modal
title=
{
priceType
===
3
?
(
isBatchSetting
?
'批量设置积分'
:
'设置积分'
)
:
(
isBatchSetting
?
'批量设置价格'
:
'设置价格'
)
}
title=
{
priceType
Ref
.
current
===
3
?
(
isBatchSetting
?
'批量设置积分'
:
'设置积分'
)
:
(
isBatchSetting
?
'批量设置价格'
:
'设置价格'
)
}
visible=
{
modifyModal
}
visible=
{
modifyModal
}
onOk=
{
handlePriceOk
}
onOk=
{
handlePriceOk
}
onCancel=
{
()
=>
setModifyModal
(
false
)
}
onCancel=
{
()
=>
setModifyModal
(
false
)
}
...
@@ -437,7 +437,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
...
@@ -437,7 +437,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
initialValues=
{
{
ladderPrice
:
false
}
}
initialValues=
{
{
ladderPrice
:
false
}
}
>
>
{
{
priceType
!==
3
&&
priceType
Ref
.
current
!==
3
&&
<
Form
.
Item
<
Form
.
Item
label=
""
label=
""
name=
"ladderPrice"
name=
"ladderPrice"
...
@@ -561,21 +561,21 @@ const ModifyDirectChannel:React.FC<{}> = () => {
...
@@ -561,21 +561,21 @@ const ModifyDirectChannel:React.FC<{}> = () => {
}
}
}
}
</
Form
.
List
>
</
Form
.
List
>
</
Form
.
Item
>
:
<
Form
.
Item
</
Form
.
Item
>
:
<
Form
.
Item
label=
{
priceType
===
3
?
"所需积分"
:
"单价"
}
label=
{
priceType
Ref
.
current
===
3
?
"所需积分"
:
"单价"
}
name=
"uniquePrice"
name=
"uniquePrice"
rules=
{
[
rules=
{
[
{
{
required
:
true
,
required
:
true
,
type
:
'number'
,
type
:
'number'
,
message
:
priceType
===
3
?
'请输入积分!'
:
'请输入价格!'
message
:
priceType
Ref
.
current
===
3
?
'请输入积分!'
:
'请输入价格!'
},
},
{
{
pattern
:
priceType
!==
3
?
/^
\d
+
(\.\d
{1,4}
)?
$/
:
/^
[
1-9
]\d
*$/
,
pattern
:
priceType
Ref
.
current
!==
3
?
/^
\d
+
(\.\d
{1,4}
)?
$/
:
/^
[
1-9
]\d
*$/
,
message
:
priceType
!==
3
?
'小数点后仅限四位'
:
'请正确输入积分'
,
message
:
priceType
Ref
.
current
!==
3
?
'小数点后仅限四位'
:
'请正确输入积分'
,
}
}
]
}
]
}
>
>
<
InputNumber
min=
{
0
}
style=
{
{
width
:
'100%'
}
}
placeholder=
{
priceType
===
3
?
"请输入积分"
:
"请输入价格"
}
/>
<
InputNumber
min=
{
0
}
style=
{
{
width
:
'100%'
}
}
placeholder=
{
priceType
Ref
.
current
===
3
?
"请输入积分"
:
"请输入价格"
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
}
}
</
Form
>
</
Form
>
...
...
src/pages/commodity/products/viewDirectChannel.tsx
View file @
f48b3497
...
@@ -69,7 +69,7 @@ const ViewDriectChannel: React.FC<{}> = () => {
...
@@ -69,7 +69,7 @@ const ViewDriectChannel: React.FC<{}> = () => {
render
:
(
text
,
record
)
=>
{
render
:
(
text
,
record
)
=>
{
if
(
!
text
||
JSON
.
stringify
(
text
)
===
'{}'
)
return
null
if
(
!
text
||
JSON
.
stringify
(
text
)
===
'{}'
)
return
null
return
Object
.
keys
(
text
).
map
((
v
,
i
)
=>
{
return
Object
.
keys
(
text
).
map
((
v
,
i
)
=>
{
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
text
[
v
]
}
</
span
></
span
><
br
/></>
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
{
commodity
.
priceType
===
3
?
''
:
'¥'
}
{
text
[
v
]
}
</
span
></
span
><
br
/></>
})
})
}
}
})
})
...
...
src/pages/commodity/products/viewProducts.tsx
View file @
f48b3497
...
@@ -55,7 +55,7 @@ const viewProducts: React.FC<{}> = () => {
...
@@ -55,7 +55,7 @@ const viewProducts: React.FC<{}> = () => {
console
.
log
(
data
,
'data'
)
console
.
log
(
data
,
'data'
)
setPorductDetail
(
data
)
setPorductDetail
(
data
)
renderDataByTab
(
data
)
renderDataByTab
(
data
)
constructTableData
(
data
.
name
,
data
.
unitPriceAndPicList
)
constructTableData
(
data
,
data
.
unitPriceAndPicList
)
if
(
data
.
status
===
1
)
setFixStep
(
0
)
if
(
data
.
status
===
1
)
setFixStep
(
0
)
else
if
(
data
.
status
===
2
)
setFixStep
(
1
)
else
if
(
data
.
status
===
2
)
setFixStep
(
1
)
else
if
(
data
.
status
===
3
)
setFixStep
(
2
)
else
if
(
data
.
status
===
3
)
setFixStep
(
2
)
...
@@ -94,6 +94,7 @@ const viewProducts: React.FC<{}> = () => {
...
@@ -94,6 +94,7 @@ const viewProducts: React.FC<{}> = () => {
title
:
'序号'
,
title
:
'序号'
,
dataIndex
:
'memberRoleId'
,
dataIndex
:
'memberRoleId'
,
key
:
'memberRoleId'
,
key
:
'memberRoleId'
,
render
:
(
t
,
c
,
i
)
=>
i
+
1
},
},
{
{
title
:
'角色'
,
title
:
'角色'
,
...
@@ -239,9 +240,9 @@ const viewProducts: React.FC<{}> = () => {
...
@@ -239,9 +240,9 @@ const viewProducts: React.FC<{}> = () => {
}
}
/* 构建表格数据 */
/* 构建表格数据 */
const
constructTableData
=
(
product
Name
:
string
,
unitPriceAndPicList
:
GetProductCommodityGetCommodityResponse
[
"unitPriceAndPicList"
])
=>
{
const
constructTableData
=
(
product
:
any
,
unitPriceAndPicList
:
GetProductCommodityGetCommodityResponse
[
"unitPriceAndPicList"
])
=>
{
// 构建列
// 构建列
console
.
log
(
product
Name
,
unitPriceAndPicList
,
'构建列'
)
console
.
log
(
product
,
unitPriceAndPicList
,
'构建列'
)
let
_col
=
[];
let
_col
=
[];
let
col_productName
=
{
title
:
'商品名称'
,
dataIndex
:
'商品名称'
,
key
:
'索引'
}
let
col_productName
=
{
title
:
'商品名称'
,
dataIndex
:
'商品名称'
,
key
:
'索引'
}
_col
.
push
(
col_productName
)
_col
.
push
(
col_productName
)
...
@@ -272,13 +273,13 @@ const viewProducts: React.FC<{}> = () => {
...
@@ -272,13 +273,13 @@ const viewProducts: React.FC<{}> = () => {
}
}
}
}
_col
.
push
({
_col
.
push
({
title
:
product
Detail
?.
priceType
===
3
?
'所需积分'
:
'单价(元)'
,
title
:
product
?.
priceType
===
3
?
'所需积分'
:
'单价(元)'
,
dataIndex
:
'单价'
,
dataIndex
:
'单价'
,
key
:
'单价'
,
key
:
'单价'
,
render
:
(
text
,
record
)
=>
{
render
:
(
text
,
record
)
=>
{
if
(
JSON
.
stringify
(
text
)
===
'{}'
)
return
null
if
(
JSON
.
stringify
(
text
)
===
'{}'
)
return
null
return
Object
.
keys
(
text
).
map
((
v
,
i
)
=>
{
return
Object
.
keys
(
text
).
map
((
v
,
i
)
=>
{
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
text
[
v
]
}
</
span
></
span
><
br
/></>
return
<><
span
key=
{
i
}
>
{
v
===
'0-0'
?
''
:
`${v}:`
}
<
span
style=
{
{
color
:
'red'
}
}
>
{
product
?.
priceType
===
3
?
''
:
'¥'
}
{
text
[
v
]
}
</
span
></
span
><
br
/></>
})
})
}
}
})
})
...
@@ -291,7 +292,6 @@ const viewProducts: React.FC<{}> = () => {
...
@@ -291,7 +292,6 @@ const viewProducts: React.FC<{}> = () => {
let
_imageArrByImageRender
:
any
[]
=
[]
let
_imageArrByImageRender
:
any
[]
=
[]
_tableData
=
unitPriceAndPicList
.
map
((
item
,
index
)
=>
{
_tableData
=
unitPriceAndPicList
.
map
((
item
,
index
)
=>
{
_imageArrByImageRender
.
push
(
item
.
commodityPic
)
_imageArrByImageRender
.
push
(
item
.
commodityPic
)
console
.
log
(
item
)
let
attrArrayWithObj
=
item
.
attributeAndValueList
.
map
(
_item
=>
{
let
attrArrayWithObj
=
item
.
attributeAndValueList
.
map
(
_item
=>
{
let
_temp
=
{}
let
_temp
=
{}
_temp
[
_item
.
customerAttribute
.
name
]
=
_item
.
customerAttributeValue
.
value
_temp
[
_item
.
customerAttribute
.
name
]
=
_item
.
customerAttributeValue
.
value
...
@@ -304,7 +304,7 @@ const viewProducts: React.FC<{}> = () => {
...
@@ -304,7 +304,7 @@ const viewProducts: React.FC<{}> = () => {
_attributeArrByImageRender
.
push
(
attrWithObj
)
_attributeArrByImageRender
.
push
(
attrWithObj
)
let
temp
=
{
let
temp
=
{
"索引"
:
index
,
"索引"
:
index
,
"商品名称"
:
product
N
ame
,
"商品名称"
:
product
.
n
ame
,
"对应货品"
:
item
.
goods
?.
code
+
'/'
+
item
.
goods
?.
name
+
'/'
+
item
.
goods
?.
type
,
"对应货品"
:
item
.
goods
?.
code
+
'/'
+
item
.
goods
?.
name
+
'/'
+
item
.
goods
?.
type
,
...
attrWithObj
,
...
attrWithObj
,
"单价"
:
item
.
unitPrice
,
"单价"
:
item
.
unitPrice
,
...
...
src/pages/transaction/transactionRules/addRule.tsx
View file @
f48b3497
...
@@ -28,10 +28,11 @@ const AddRule:React.FC<{}> = (props) => {
...
@@ -28,10 +28,11 @@ const AddRule:React.FC<{}> = (props) => {
values
.
products
=
values
.
products
.
map
(
item
=>
({
productId
:
item
.
id
,
productName
:
item
.
name
,
category
:
item
.
customerCategoryName
,
productPrice
:
item
.
priceType
,
brand
:
item
.
brandName
}))
values
.
products
=
values
.
products
.
map
(
item
=>
({
productId
:
item
.
id
,
productName
:
item
.
name
,
category
:
item
.
customerCategoryName
,
productPrice
:
item
.
priceType
,
brand
:
item
.
brandName
}))
values
.
isElectronicContract
=
values
.
isElectronicContract
?
1
:
0
values
.
isElectronicContract
=
values
.
isElectronicContract
?
1
:
0
const
params
=
omit
(
values
,
[
'state'
])
// 移除不需要的字段
const
params
=
omit
(
values
,
[
'state'
])
// 移除不需要的字段
await
PublicApi
.
postOrderTradingRulesAdd
(
params
)
console
.
log
(
params
,
'params'
)
setTimeout
(()
=>
{
// await PublicApi.postOrderTradingRulesAdd(params)
history
.
goBack
(
-
1
)
// setTimeout(() => {
},
1000
)
// history.goBack(-1)
// }, 1000)
}
}
return
(
return
(
...
...
src/pages/transaction/transactionRules/components/RuleSetting.tsx
View file @
f48b3497
import
React
,
{
useState
}
from
'react'
import
React
,
{
use
Effect
,
use
State
}
from
'react'
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
import
{
useInitValue
}
from
'@/formSchema/effects/useInitValue'
import
{
useInitValue
}
from
'@/formSchema/effects/useInitValue'
import
EyePreview
from
'@/components/EyePreview'
import
EyePreview
from
'@/components/EyePreview'
...
@@ -33,6 +33,8 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
...
@@ -33,6 +33,8 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
const
{
addSchemaAction
,
schema
,
formSubmit
,
onFieldChange
=
()
=>
{}
}
=
props
const
{
addSchemaAction
,
schema
,
formSubmit
,
onFieldChange
=
()
=>
{}
}
=
props
const
[
visibleChannelRroduct
,
setVisibleChannelRroduct
]
=
useState
(
false
)
const
[
visibleChannelRroduct
,
setVisibleChannelRroduct
]
=
useState
(
false
)
const
[
productRowSelection
,
productRowCtl
]
=
useRowSelectionTable
({
customKey
:
'id'
})
const
[
productRowSelection
,
productRowCtl
]
=
useRowSelectionTable
({
customKey
:
'id'
})
const
[
productsLength
,
setProductsLength
]
=
useState
(
0
)
const
[
initValue
,
setInitialValue
]
=
useState
({});
const
{
const
{
id
,
id
,
...
@@ -40,9 +42,6 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
...
@@ -40,9 +42,6 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
pageStatus
pageStatus
}
=
usePageStatus
()
}
=
usePageStatus
()
const
initValue
=
useInitValue
(
PublicApi
.
getOrderTradingRulesDetails
)
useUnitPreview
(
initValue
,
addSchemaAction
)
const
fetchProductList
=
async
(
params
)
=>
{
const
fetchProductList
=
async
(
params
)
=>
{
const
shopIds
=
addSchemaAction
.
getFieldValue
(
'shopIds'
)
const
shopIds
=
addSchemaAction
.
getFieldValue
(
'shopIds'
)
if
(
shopIds
.
length
){
if
(
shopIds
.
length
){
...
@@ -63,7 +62,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
...
@@ -63,7 +62,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
// table删除商品
// table删除商品
const
handleDeleteTable
=
(
id
)
=>
{
const
handleDeleteTable
=
(
id
)
=>
{
const
value
=
addSchemaAction
.
getFieldValue
(
'products'
)
const
value
=
addSchemaAction
.
getFieldValue
(
'products'
)
addSchemaAction
.
setFieldValue
(
'products'
,
findItemAndDelete
(
value
,
id
,
'productId'
))
addSchemaAction
.
setFieldValue
(
'products'
,
findItemAndDelete
(
value
,
id
))
}
}
const
handleAddProductBtn
=
()
=>
{
const
handleAddProductBtn
=
()
=>
{
...
@@ -73,7 +72,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
...
@@ -73,7 +72,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
// return false
// return false
// }
// }
const
checkBoxs
=
addSchemaAction
.
getFieldValue
(
'products'
)
const
checkBoxs
=
addSchemaAction
.
getFieldValue
(
'products'
)
productRowCtl
.
setSelectedRowKeys
(
checkBoxs
.
map
(
v
=>
v
.
productI
d
))
productRowCtl
.
setSelectedRowKeys
(
checkBoxs
.
map
(
v
=>
v
.
i
d
))
productRowCtl
.
setSelectRow
(
checkBoxs
)
productRowCtl
.
setSelectRow
(
checkBoxs
)
setVisibleChannelRroduct
(
true
)
setVisibleChannelRroduct
(
true
)
}
}
...
@@ -131,6 +130,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
...
@@ -131,6 +130,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
// 商品添加弹窗控制
// 商品添加弹窗控制
const
handleOkAddProduct
=
async
()
=>
{
const
handleOkAddProduct
=
async
()
=>
{
setVisibleChannelRroduct
(
false
)
setVisibleChannelRroduct
(
false
)
setProductsLength
(
productRowCtl
.
selectRow
.
length
);
addSchemaAction
.
setFieldValue
(
'products'
,
productRowCtl
.
selectRow
)
addSchemaAction
.
setFieldValue
(
'products'
,
productRowCtl
.
selectRow
)
}
}
...
@@ -238,6 +238,38 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
...
@@ -238,6 +238,38 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
}
}
}
}
useEffect
(()
=>
{
async
function
getInitValue
()
{
const
{
data
}
=
await
PublicApi
.
getOrderTradingRulesDetails
({
id
:
id
});
if
(
data
.
isTacitlyApprove
===
2
)
{
const
res
=
await
getBindingProducts
({
id
:
id
.
toString
(),
current
:
'1'
,
pageSize
:
'10'
});
addSchemaAction
.
setFieldState
(
'products'
,
(
state
)
=>
{
state
.
value
=
res
.
data
})
setProductsLength
(
res
.
totalCount
);
}
addSchemaAction
.
setFieldValue
(
'isElectronicContract'
,
data
?.
isElectronicContract
?
true
:
false
)
addSchemaAction
.
setFieldValue
(
'isTacitlyApprove'
,
data
?.
isTacitlyApprove
)
setInitialValue
(
data
)
}
if
(
id
!=
''
)
{
getInitValue
();
}
},
[
id
])
// 拿到绑定的商品
const
getBindingProducts
=
async
({
id
=
'1'
,
current
=
'1'
,
pageSize
=
'10'
})
=>
{
const
res
=
await
PublicApi
.
getOrderTradingRulesProductList
({
tradingRulesId
:
id
,
current
,
pageSize
});
return
res
.
data
}
const
paginationChange
=
async
(
page
:
number
,
size
:
number
)
=>
{
if
(
id
!==
''
)
{
const
result
=
await
getBindingProducts
({
id
,
current
:
page
.
toString
(),
pageSize
:
size
.
toString
()})
addSchemaAction
.
setFieldValue
(
'products'
,
result
.
data
)
}
}
return
(
return
(
<>
<>
<
NiceForm
<
NiceForm
...
@@ -247,6 +279,8 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
...
@@ -247,6 +279,8 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
expressionScope=
{
{
expressionScope=
{
{
tableColumns
,
tableColumns
,
tableAddButton
,
tableAddButton
,
paginationChange
,
productsLength
}
}
}
}
components=
{
{
components=
{
{
SelectProcesss
,
SelectProcesss
,
...
...
src/pages/transaction/transactionRules/effects/index.tsx
View file @
f48b3497
...
@@ -22,15 +22,6 @@ export const createAddContractTemplateEffect = (context: ISchemaFormActions) =>
...
@@ -22,15 +22,6 @@ export const createAddContractTemplateEffect = (context: ISchemaFormActions) =>
export
const
useUnitPreview
=
(
initValue
,
context
)
=>
{
export
const
useUnitPreview
=
(
initValue
,
context
)
=>
{
useEffect
(()
=>
{
useEffect
(()
=>
{
context
.
setFieldValue
(
'isElectronicContract'
,
initValue
?.
isElectronicContract
?
true
:
false
)
context
.
setFieldValue
(
'isElectronicContract'
,
initValue
?.
isElectronicContract
?
true
:
false
)
// console.log(initValue, 'init')
context
.
setFieldValue
(
'isTacitlyApprove'
,
initValue
?.
isTacitlyApprove
)
// if (initValue) {
// context.setFieldState('inventory', state => {
// if (!state.props['x-props']) {
// state.props['x-props'] = {}
// }
// state.props['x-props'].addonAfter = <div style={{marginLeft: 4}}>{initValue.unit}</div>
// })
// context.setFieldValue('itemNo', initValue.itemNo)
// }
},
[
initValue
])
},
[
initValue
])
}
}
\ No newline at end of file
src/pages/transaction/transactionRules/schema/index.tsx
View file @
f48b3497
...
@@ -173,7 +173,7 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
...
@@ -173,7 +173,7 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
type
:
'array:number'
,
type
:
'array:number'
,
"x-component"
:
'MultTable'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
"x-component-props"
:
{
rowKey
:
'
productI
d'
,
rowKey
:
'
i
d'
,
columns
:
"{{tableColumns}}"
,
columns
:
"{{tableColumns}}"
,
prefix
:
"{{tableAddButton}}"
prefix
:
"{{tableAddButton}}"
}
}
...
...
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