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
9dcd5b78
Commit
9dcd5b78
authored
Jul 26, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 对接交易流程规则/采购流程规则
parent
410e36a0
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
461 additions
and
225 deletions
+461
-225
addRule.tsx
src/pages/transaction/purchaseRules/addRule.tsx
+11
-14
RuleSetting.tsx
...ages/transaction/purchaseRules/components/RuleSetting.tsx
+56
-34
index.tsx
...saction/purchaseRules/components/selectProcesss/index.tsx
+7
-6
index.tsx
src/pages/transaction/purchaseRules/index.tsx
+13
-13
index.tsx
src/pages/transaction/purchaseRules/schema/index.tsx
+7
-7
addRule.tsx
src/pages/transaction/transactionRules/addRule.tsx
+37
-17
RuleSetting.tsx
...s/transaction/transactionRules/components/RuleSetting.tsx
+57
-22
index.less
...n/transactionRules/components/paymentTableCell/index.less
+11
-0
index.tsx
...on/transactionRules/components/paymentTableCell/index.tsx
+106
-0
index.tsx
...tion/transactionRules/components/selectProcesss/index.tsx
+12
-11
index.tsx
src/pages/transaction/transactionRules/effects/index.tsx
+2
-9
index.tsx
src/pages/transaction/transactionRules/index.tsx
+18
-74
usePaymentTable.tsx
...es/transaction/transactionRules/model/usePaymentTable.tsx
+83
-0
index.tsx
src/pages/transaction/transactionRules/schema/index.tsx
+41
-18
No files found.
src/pages/transaction/purchaseRules/addRule.tsx
View file @
9dcd5b78
...
...
@@ -8,8 +8,8 @@ import {
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
'./index.less'
import
{
ruleDetailSchema
}
from
'./schema'
import
{
createFormActions
,
ISchema
,
FormEffectHooks
}
from
'@formily/antd'
import
{
findItemAndDelete
,
omit
}
from
'@/utils'
import
{
createFormActions
}
from
'@formily/antd'
import
{
omit
}
from
'@/utils'
import
{
PublicApi
}
from
'@/services/api'
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
import
RuleSetting
from
'./components/RuleSetting'
...
...
@@ -28,22 +28,19 @@ const AddRule:React.FC<{}> = (props) => {
// 整体表单提交
const
formSubmit
=
async
(
values
)
=>
{
setIsDisabled
(
true
)
const
params
=
omit
(
values
,
[
'state'
])
// 移除不需要的字段
addSchemaAction
.
getFieldState
(
'processEnumId'
,
state
=>
{
const
process
=
state
.
dataSource
.
filter
(
item
=>
item
.
id
===
params
.
processEnumId
)[
0
]
params
.
type
=
process
.
type
params
.
processEnum
=
process
.
processEnum
params
.
processEnumId
=
process
.
id
})
const
params
=
omit
(
values
,
[
'status'
])
// 移除不需要的字段
let
res
:
any
=
{}
if
(
pageStatus
===
PageStatus
.
EDIT
){
res
=
await
PublicApi
.
postManageRuleUpdate
(
params
)
}
else
if
(
pageStatus
===
PageStatus
.
ADD
){
res
=
await
PublicApi
.
postManageRuleAdd
(
params
)
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
res
=
await
PublicApi
.
postOrderPurchaseProcessUpdate
(
params
)
}
else
if
(
pageStatus
===
PageStatus
.
ADD
){
res
=
await
PublicApi
.
postOrderPurchaseProcessCreate
(
params
)
}
if
(
res
.
code
===
1000
)
{
history
.
goBack
(
-
1
)
}
setIsDisabled
(
false
)
history
.
goBack
(
-
1
)
}
return
(
...
...
src/pages/transaction/purchaseRules/components/RuleSetting.tsx
View file @
9dcd5b78
import
React
,
{
useEffect
,
use
Ref
,
use
State
}
from
'react'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
import
EyePreview
from
'@/components/EyePreview'
import
{
findItemAndDelete
,
formatTimeString
}
from
'@/utils'
...
...
@@ -11,7 +11,6 @@ import {
import
{
Button
,
message
}
from
'antd'
import
NiceForm
from
'@/components/NiceForm'
import
ModalTable
from
'@/components/ModalTable'
import
{
GlobalConfig
}
from
'@/global/config'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
import
SearchSelect
from
'@/components/NiceForm/components/SearchSelect'
import
Search
from
'@/components/NiceForm/components/Search'
...
...
@@ -32,7 +31,6 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
const
[
productRowSelection
,
productRowCtl
]
=
useRowSelectionTable
({
customKey
:
'id'
})
const
[
productsLength
,
setProductsLength
]
=
useState
(
0
)
const
[
initValue
,
setInitialValue
]
=
useState
({})
const
[
idNotInList
,
setIdNotInList
]
=
useState
([])
const
{
id
,
...
...
@@ -52,14 +50,14 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
// table删除合同
const
handleDeleteTable
=
(
id
)
=>
{
const
value
=
addSchemaAction
.
getFieldValue
(
'
ruleC
ontracts'
)
addSchemaAction
.
setFieldValue
(
'
ruleContracts'
,
findItemAndDelete
(
value
,
id
))
const
value
=
addSchemaAction
.
getFieldValue
(
'
c
ontracts'
)
addSchemaAction
.
setFieldValue
(
'
contracts'
,
findItemAndDelete
(
value
,
id
,
'contractId'
))
}
const
handleAddBtn
=
()
=>
{
const
checkBoxs
=
addSchemaAction
.
getFieldValue
(
'
ruleC
ontracts'
)
productRowCtl
.
setSelectedRowKeys
(
checkBoxs
.
map
(
v
=>
v
.
i
d
))
productRowCtl
.
setSelectRow
(
checkBoxs
)
const
checkBoxs
=
addSchemaAction
.
getFieldValue
(
'
c
ontracts'
)
productRowCtl
.
setSelectedRowKeys
(
checkBoxs
.
map
(
v
=>
v
.
contractI
d
))
productRowCtl
.
setSelectRow
(
processFields
(
checkBoxs
,
true
)
)
setVisibleChannelRroduct
(
true
)
}
...
...
@@ -69,45 +67,45 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
const
tableColumns
=
[
{
dataIndex
:
'
i
d'
,
dataIndex
:
'
contractI
d'
,
title
:
'ID'
,
key
:
'
i
d'
,
key
:
'
contractI
d'
,
className
:
'commonHide'
,
},
{
dataIndex
:
'contractNo'
,
title
:
'合同编号'
,
key
:
'contractNo'
,
render
:
(
_
,
record
)
=>
<
EyePreview
url=
{
`/memberCenter/contract/manage/QueryList/QueryListdetails?contractId=${record.
i
d}`
}
>
{
_
}
</
EyePreview
>
render
:
(
_
,
record
)
=>
<
EyePreview
url=
{
`/memberCenter/contract/manage/QueryList/QueryListdetails?contractId=${record.
contractI
d}`
}
>
{
_
}
</
EyePreview
>
},
{
dataIndex
:
'
contractAbstrac
t'
,
dataIndex
:
'
diges
t'
,
title
:
'合同摘要'
,
key
:
'
contractAbstrac
t'
,
key
:
'
diges
t'
,
},
{
dataIndex
:
'
star
tTime'
,
dataIndex
:
'
effec
tTime'
,
title
:
'合同生效/失效时间'
,
key
:
'startTime'
,
render
:
(
t
,
r
)
=>
<>
<
div
>
{
t
}
</
div
>
<
div
>
{
r
.
e
nd
Time
}
</
div
>
<
div
>
{
r
.
e
xpire
Time
}
</
div
>
</>
},
{
dataIndex
:
'partyB
Name
'
,
dataIndex
:
'partyB'
,
title
:
'合同乙方'
,
key
:
'partyB
Name
'
key
:
'partyB'
},
{
dataIndex
:
'
source
No'
,
dataIndex
:
'
receipt
No'
,
title
:
'对应单据'
,
key
:
'
source
No'
key
:
'
receipt
No'
},
{
dataIndex
:
'
source
Type'
,
dataIndex
:
'
contract
Type'
,
title
:
'寻源类型'
,
key
:
'
source
Type'
,
key
:
'
contract
Type'
,
render
:
(
text
:
any
,
reocrd
:
any
)
=>
{
if
(
text
===
1
)
return
'采购询价'
...
...
@@ -120,7 +118,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
{
dataIndex
:
'ctl'
,
title
:
'操作'
,
render
:
(
_
,
record
)
=>
<
Button
type=
'link'
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
}
onClick=
{
()
=>
handleDeleteTable
(
record
.
i
d
)
}
>
删除
</
Button
>
render
:
(
_
,
record
)
=>
<
Button
type=
'link'
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
}
onClick=
{
()
=>
handleDeleteTable
(
record
.
contractI
d
)
}
>
删除
</
Button
>
}
]
...
...
@@ -129,10 +127,34 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
formSubmit
&&
formSubmit
(
values
)
}
const
processFields
=
(
contractLists
,
render
)
=>
{
return
render
?
contractLists
.
map
((
item
)
=>
({
id
:
item
[
'contractId'
],
contractNo
:
item
[
'contractNo'
],
contractAbstract
:
item
[
'digest'
],
startTime
:
item
[
'effectTime'
],
endTime
:
item
[
'expireTime'
],
partyBName
:
item
[
'partyB'
],
freeAmount
:
item
[
'amount'
],
sourceType
:
item
[
'contractType'
],
sourceNo
:
item
[
'receiptNo'
],
}))
:
contractLists
.
map
((
item
)
=>
({
contractId
:
item
[
'id'
],
contractNo
:
item
[
'contractNo'
],
digest
:
item
[
'contractAbstract'
],
effectTime
:
item
[
'startTime'
],
expireTime
:
item
[
'endTime'
],
partyB
:
item
[
'partyBName'
],
amount
:
item
[
'freeAmount'
],
contractType
:
item
[
'sourceType'
],
receiptNo
:
item
[
'sourceNo'
],
}))
}
const
handleOkAdd
=
async
()
=>
{
setVisibleChannelRroduct
(
false
)
setProductsLength
(
productRowCtl
.
selectRow
.
length
);
addSchemaAction
.
setFieldValue
(
'
ruleContracts'
,
productRowCtl
.
selectRow
)
addSchemaAction
.
setFieldValue
(
'
contracts'
,
processFields
(
productRowCtl
.
selectRow
,
false
)
)
clearModalParams
()
}
...
...
@@ -160,9 +182,9 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
key
:
'contractNo'
},
{
dataIndex
:
'
contractAbstrac
t'
,
dataIndex
:
'
diges
t'
,
title
:
'合同摘要'
,
key
:
'
contractAbstrac
t'
key
:
'
diges
t'
},
{
dataIndex
:
'startTime'
,
...
...
@@ -260,15 +282,15 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
useEffect
(()
=>
{
async
function
getInitValue
()
{
const
{
data
}
=
await
PublicApi
.
get
ManageRuleDetails
({
id
:
id
,
current
:
'1'
,
pageSize
:
'1000'
,
contractAbstract
:
''
})
if
(
!
data
.
isApplyContract
)
{
const
res
=
await
getBindingContracts
({
id
:
id
.
toString
(),
current
:
'1'
,
pageSize
:
'1000'
,
contractAbstrac
t
:
''
})
addSchemaAction
.
setFieldState
(
'
ruleC
ontracts'
,
state
=>
{
state
.
value
=
res
.
data
const
{
data
}
=
await
PublicApi
.
get
OrderPurchaseProcessGet
({
processId
:
id
})
if
(
!
data
.
allContracts
)
{
const
res
=
await
getBindingContracts
({
id
:
id
.
toString
(),
current
:
'1'
,
pageSize
:
'1000'
,
diges
t
:
''
})
addSchemaAction
.
setFieldState
(
'
c
ontracts'
,
state
=>
{
state
.
value
=
processFields
(
res
.
data
,
false
)
})
setProductsLength
(
res
.
totalCount
)
}
addSchemaAction
.
setFieldValue
(
'
isApplyContract'
,
data
.
isApplyContract
===
1
?
1
:
0
)
addSchemaAction
.
setFieldValue
(
'
allContracts'
,
data
.
allContracts
)
setInitialValue
(
data
)
}
if
(
id
!=
''
)
{
...
...
@@ -277,15 +299,15 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
},
[
id
])
// 拿到绑定的合同
const
getBindingContracts
=
async
({
id
=
'1'
,
current
=
'1'
,
pageSize
=
'10'
,
contractAbstrac
t
=
''
})
=>
{
const
res
=
await
PublicApi
.
get
ManageRuleContractList
({
id
,
current
,
pageSize
,
contractAbstrac
t
});
const
getBindingContracts
=
async
({
id
=
'1'
,
current
=
'1'
,
pageSize
=
'10'
,
diges
t
=
''
})
=>
{
const
res
=
await
PublicApi
.
get
OrderPurchaseProcessContractPage
({
processId
:
id
,
current
,
pageSize
,
diges
t
});
return
res
.
data
}
const
paginationChange
=
async
(
page
:
number
,
size
:
number
)
=>
{
if
(
id
!==
''
)
{
const
result
=
await
getBindingContracts
({
id
,
current
:
page
.
toString
(),
pageSize
:
size
.
toString
()})
addSchemaAction
.
setFieldValue
(
'
ruleC
ontracts'
,
result
.
data
)
addSchemaAction
.
setFieldValue
(
'
c
ontracts'
,
result
.
data
)
}
}
...
...
src/pages/transaction/purchaseRules/components/selectProcesss/index.tsx
View file @
9dcd5b78
...
...
@@ -48,7 +48,8 @@ enum ProcessTagType {
'售后换货流程'
,
'售后退货流程'
,
'售后维修流程'
,
'加工生产流程'
'加工生产流程'
,
'直发客户自动二次发货'
}
const
SelectProcesss
=
(
props
:
ISchemaFieldComponentProps
)
=>
{
...
...
@@ -61,7 +62,7 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
const
{
value
,
mutators
,
editable
}
=
props
useEffect
(()
=>
{
PublicApi
.
get
ManagePurchaseProcesByMember
().
then
(
res
=>
{
PublicApi
.
get
OrderTradeProcessBaseList
().
then
(
res
=>
{
setFieldState
({
dataSource
:
res
.
data
,
showMore
...
...
@@ -85,8 +86,8 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
}
const
renderProcessType
=
(
v
:
any
)
=>
{
return
<
Tag
color=
{
ProcessTagColor
[
v
.
t
ype
-
1
]
}
>
{
ProcessTagType
[
v
.
t
ype
-
1
]
}
return
<
Tag
color=
{
ProcessTagColor
[
v
.
processT
ype
-
1
]
}
>
{
ProcessTagType
[
v
.
processT
ype
-
1
]
}
</
Tag
>
}
...
...
@@ -94,7 +95,7 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
<
div
style=
{
{
width
:
'100%'
}
}
>
<
SelectStyles
>
{
showDataSource
.
map
(
v
=>
<
div
key=
{
v
.
id
}
onClick=
{
()
=>
handleCheck
(
v
.
id
)
}
className=
{
cx
(
'select_style_border'
,
value
===
v
.
id
?
'active'
:
''
)
}
>
showDataSource
.
map
(
v
=>
<
div
key=
{
v
.
baseProcessid
}
onClick=
{
()
=>
handleCheck
(
v
.
baseProcessid
)
}
className=
{
cx
(
'select_style_border'
,
value
===
v
.
baseProcess
id
?
'active'
:
''
)
}
>
<
div
>
<
Row
style=
{
{
color
:
'#303133'
}
}
>
<
Col
>
{
v
.
name
}
</
Col
>
...
...
@@ -104,7 +105,7 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
}
</
Col
>
</
Row
>
<
div
style=
{
{
color
:
'#909399'
}
}
>
{
v
.
explai
n
}
</
div
>
<
div
style=
{
{
color
:
'#909399'
}
}
>
{
v
.
descriptio
n
}
</
div
>
</
div
>
</
div
>)
}
...
...
src/pages/transaction/purchaseRules/index.tsx
View file @
9dcd5b78
...
...
@@ -23,7 +23,7 @@ const PurchaseRules: React.FC<{}> = () => {
const
fetchData
=
(
params
:
any
)
=>
{
if
(
!
params
?.
name
)
delete
params
.
name
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
get
ManageRuleList
(
params
).
then
(
res
=>
{
PublicApi
.
get
OrderPurchaseProcessPage
(
params
).
then
(
res
=>
{
const
{
data
}
=
res
resolve
(
data
)
})
...
...
@@ -33,8 +33,8 @@ const PurchaseRules: React.FC<{}> = () => {
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'流程规则ID'
,
dataIndex
:
'
i
d'
,
key
:
'
i
d'
,
dataIndex
:
'
processI
d'
,
key
:
'
processI
d'
,
},
{
title
:
'流程规则名称'
,
...
...
@@ -42,21 +42,21 @@ const PurchaseRules: React.FC<{}> = () => {
key
:
'name'
,
className
:
'commonPickColor'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
EyePreview
url=
{
`/memberCenter/tranactionAbility/purchaseRules/detail?id=${record.
i
d}&preview=1`
}
url=
{
`/memberCenter/tranactionAbility/purchaseRules/detail?id=${record.
processI
d}&preview=1`
}
>
{
text
}
</
EyePreview
>
},
{
title
:
'操作时间'
,
dataIndex
:
'
upd
ateTime'
,
key
:
'
upd
ateTime'
,
dataIndex
:
'
cre
ateTime'
,
key
:
'
cre
ateTime'
,
render
:
(
text
:
any
,
record
:
any
)
=>
text
&&
moment
(
text
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
},
{
title
:
'状态'
,
dataIndex
:
'stat
e
'
,
key
:
'stat
e
'
,
dataIndex
:
'stat
us
'
,
key
:
'stat
us
'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
let
component
:
ReactNode
=
null
component
=
(
...
...
@@ -69,7 +69,7 @@ const PurchaseRules: React.FC<{}> = () => {
>
<
Button
type=
"link"
style=
{
record
.
stat
e
?
{
color
:
'#00B37A'
}
:
{
color
:
'red'
}
}
>
{
record
.
state
?
<>
有效
<
PlayCircleOutlined
/></>
:
<>
无效
<
PauseCircleOutlined
/></>
}
</
Button
>
style=
{
record
.
stat
us
?
{
color
:
'#00B37A'
}
:
{
color
:
'red'
}
}
>
{
record
.
state
?
<>
有效
<
PlayCircleOutlined
/></>
:
<>
无效
<
PauseCircleOutlined
/></>
}
</
Button
>
</
Popconfirm
>
)
return
component
...
...
@@ -82,7 +82,7 @@ const PurchaseRules: React.FC<{}> = () => {
return
(
<>
{
(
record
.
stat
e
===
0
)
?
<>
(
record
.
stat
us
===
0
)
?
<>
<
Popconfirm
title=
"确定要执行这个操作?"
onConfirm=
{
()
=>
handelDelete
(
record
)
}
...
...
@@ -92,7 +92,7 @@ const PurchaseRules: React.FC<{}> = () => {
>
<
Button
type=
'link'
>
删除
</
Button
>
</
Popconfirm
>
<
Button
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/memberCenter/tranactionAbility/purchaseRules/add?id=${record.
i
d}`
)
}
>
修改
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/memberCenter/tranactionAbility/purchaseRules/add?id=${record.
processI
d}`
)
}
>
修改
</
Button
>
</>
:
''
}
</>
...
...
@@ -102,7 +102,7 @@ const PurchaseRules: React.FC<{}> = () => {
];
const
confirm
=
(
record
:
any
)
=>
{
PublicApi
.
post
ManageRuleStartOrStop
({
id
:
record
.
id
,
state
:
record
.
state
?
0
:
1
}).
then
(
res
=>
{
PublicApi
.
post
OrderPurchaseProcessStatusUpdate
({
processId
:
record
.
processId
,
status
:
record
.
status
?
0
:
1
}).
then
(
res
=>
{
ref
.
current
.
reload
()
})
}
...
...
@@ -112,7 +112,7 @@ const PurchaseRules: React.FC<{}> = () => {
}
const
handelDelete
=
(
record
:
any
)
=>
{
PublicApi
.
post
ManageRuleDelete
({
id
:
record
.
i
d
}).
then
(
res
=>
{
PublicApi
.
post
OrderPurchaseProcessDelete
({
processId
:
record
.
processI
d
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
ref
.
current
.
reload
()
})
...
...
src/pages/transaction/purchaseRules/schema/index.tsx
View file @
9dcd5b78
...
...
@@ -47,7 +47,7 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
}
]
},
"
processEnum
Id"
:
{
"
baseProcess
Id"
:
{
type
:
'string'
,
title
:
'流程选择'
,
"x-component"
:
'SelectProcesss'
,
...
...
@@ -90,24 +90,24 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
labelAlign
:
'left'
},
properties
:
{
"
isApplyContract
"
:
{
"
allContracts
"
:
{
"type"
:
"radio"
,
enum
:
[
{
label
:
'所有合同(默认)'
,
value
:
1
},
{
label
:
'指定合同'
,
value
:
0
},
{
label
:
'所有合同(默认)'
,
value
:
true
},
{
label
:
'指定合同'
,
value
:
false
},
],
"title"
:
"适用合同"
,
default
:
1
,
default
:
true
,
required
:
true
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'
ruleC
ontracts'
,
target
:
'
c
ontracts'
,
"condition"
:
"{{!$value}}"
}
]
},
"
ruleC
ontracts"
:
{
"
c
ontracts"
:
{
type
:
'array:number'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
...
...
src/pages/transaction/transactionRules/addRule.tsx
View file @
9dcd5b78
import
React
,
{
useState
}
from
'react'
import
{
history
}
from
'umi'
import
{
Button
,
Card
}
from
'antd'
import
{
Button
,
Card
,
message
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
SaveOutlined
,
...
...
@@ -33,33 +33,53 @@ const AddRule:React.FC<{}> = (props) => {
productId
:
item
.
id
,
commodityId
:
item
.
commodityId
,
name
:
item
.
name
,
c
ustomerCategoryName
:
item
.
customerCategoryName
,
c
ategory
:
item
.
customerCategoryName
,
priceType
:
item
.
priceType
,
brand
Name
:
item
.
brandName
brand
:
item
.
brandName
}))
values
.
isElectronicContract
=
values
.
isElectronicContract
?
1
:
0
const
params
=
omit
(
values
,
[
'state'
])
// 移除不需要的字段
addSchemaAction
.
getFieldState
(
'transactionProcesssId'
,
state
=>
{
let
dataSource
=
state
.
dataSource
.
filter
(
item
=>
params
.
transactionProcesssId
===
item
.
id
)
params
.
transactionProcess
=
dataSource
[
0
].
name
params
.
type
=
dataSource
[
0
].
type
})
const
params
=
omit
(
values
,
[
'status'
])
// 移除不需要的字段
if
(
params
?.
hasContract
)
{
params
.
contract
=
{
contractId
:
params
.
contractId
,
}
}
if
(
params
?.
time
)
{
params
.
time
=
Number
(
params
.
time
)
if
(
params
?.
expireHours
)
{
params
.
expireHours
=
Number
(
params
.
expireHours
)
}
if
(
params
?.
payments
)
{
params
.
payments
=
params
.
payments
.
map
(
item
=>
({
...
item
,
payRate
:
Number
(
item
[
'payRate'
])
}))
// 百分比校验
if
(
params
.
payments
.
reduce
((
a
,
b
)
=>
a
+
b
.
payRate
,
0
)
!==
100
)
{
setIsDisabled
(
false
)
return
message
.
error
(
'支付比例之和100'
)
}
}
addSchemaAction
.
getFieldState
(
'shopIds'
,
state
=>
{
let
dataSource
=
state
.
props
[
'x-component-props'
].
dataSource
.
filter
(
item
=>
params
.
shopIds
[
0
]
===
item
.
id
)
params
.
shopType
=
dataSource
[
0
].
type
params
.
shopId
=
dataSource
[
0
].
id
params
.
shopEnvironment
=
dataSource
[
0
].
environment
})
const
_params
=
omit
(
params
,
[
'status'
,
'shopIds'
,
'contractId'
])
let
res
:
any
=
{}
if
(
pageStatus
===
PageStatus
.
EDIT
){
res
=
await
PublicApi
.
postOrderTrad
ingRulesUpdata
(
params
)
res
=
await
PublicApi
.
postOrderTrad
eProcessUpdate
(
_
params
)
}
else
if
(
pageStatus
===
PageStatus
.
ADD
){
res
=
await
PublicApi
.
postOrderTrad
ingRulesAdd
(
params
)
res
=
await
PublicApi
.
postOrderTrad
eProcessCreate
(
_
params
)
}
// if(res.code === 1000){
setIsDisabled
(
false
)
if
(
res
.
code
===
1000
){
history
.
goBack
(
-
1
)
// }
}
setIsDisabled
(
false
)
}
return
(
...
...
src/pages/transaction/transactionRules/components/RuleSetting.tsx
View file @
9dcd5b78
...
...
@@ -19,6 +19,7 @@ import Search from '@/components/NiceForm/components/Search'
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
import
Submit
from
'@/components/NiceForm/components/Submit'
import
SelectProcesss
from
'./selectProcesss'
import
{
usePaymentTable
}
from
'../model/usePaymentTable'
export
interface
RuleSettingProps
{
addSchemaAction
:
ISchemaFormActions
,
...
...
@@ -41,6 +42,8 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
pageStatus
}
=
usePageStatus
()
const
{
paymentColumns
,
paymentComponents
,
...
sectionProps
}
=
usePaymentTable
(
addSchemaAction
)
const
fetchProductList
=
async
(
params
)
=>
{
const
shopIds
=
addSchemaAction
.
getFieldValue
(
'shopIds'
)
if
(
shopIds
.
length
){
...
...
@@ -243,25 +246,29 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
useEffect
(()
=>
{
async
function
getInitValue
()
{
const
{
data
}
=
await
PublicApi
.
getOrderTradingRulesDetails
({
i
d
:
id
})
if
(
data
.
isTacitlyApprove
===
2
)
{
const
{
data
}
:
any
=
await
PublicApi
.
getOrderTradeProcessGet
({
processI
d
:
id
})
if
(
data
.
allProducts
===
false
)
{
const
res
=
await
getBindingProducts
({
id
:
id
.
toString
(),
current
:
'1'
,
pageSize
:
'1000'
})
addSchemaAction
.
setFieldState
(
'products'
,
state
=>
{
state
.
value
=
res
.
data
})
setProductsLength
(
res
.
totalCount
)
}
addSchemaAction
.
setFieldValue
(
'
isElectronicContract'
,
data
.
isElectronic
Contract
?
true
:
false
)
addSchemaAction
.
setFieldValue
(
'
transactionProcesssId'
,
data
.
transactionProces
ssId
)
addSchemaAction
.
setFieldValue
(
'
isTacitlyApprove'
,
data
.
isTacitlyApprove
)
if
(
data
.
t
ype
===
1
)
{
addSchemaAction
.
setFieldState
(
'
time
'
,
state
=>
{
addSchemaAction
.
setFieldValue
(
'
hasContract'
,
data
.
has
Contract
?
true
:
false
)
addSchemaAction
.
setFieldValue
(
'
baseProcessId'
,
data
.
baseProce
ssId
)
addSchemaAction
.
setFieldValue
(
'
allProducts'
,
data
.
allProducts
)
if
(
data
.
processT
ype
===
1
)
{
addSchemaAction
.
setFieldState
(
'
expireHours
'
,
state
=>
{
state
.
visible
=
true
})
}
if
(
pageStatus
===
PageStatus
.
PREVIEW
)
{
data
.
time
=
data
.
time
+
'小时'
data
.
expireHours
=
data
.
expireHours
+
'小时'
}
if
(
data
.
hasContract
)
{
data
.
contractId
=
data
.
contract
.
contractId
}
data
.
shopIds
=
[
data
.
shopId
]
setInitialValue
(
data
)
}
if
(
id
!=
''
)
{
...
...
@@ -271,7 +278,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
// 拿到绑定的商品
const
getBindingProducts
=
async
({
id
=
'1'
,
current
=
'1'
,
pageSize
=
'10'
})
=>
{
const
res
=
await
PublicApi
.
getOrderTrad
ingRulesProductList
({
tradingRule
sId
:
id
,
current
,
pageSize
,
name
:
null
});
const
res
=
await
PublicApi
.
getOrderTrad
eProcessProductPage
({
proces
sId
:
id
,
current
,
pageSize
,
name
:
null
});
return
res
.
data
}
...
...
@@ -282,11 +289,11 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
}
}
//
//
查询已设置交易规则的列表
// 查询已设置交易规则的列表
const
fatchSetedProducts
=
(
id
)
=>
{
let
transactionProcesssId
=
addSchemaAction
.
getFieldValue
(
"transactionProces
ssId"
)
addSchemaAction
.
getFieldState
(
"
transactionProces
ssId"
,
state
=>
{
let
type
=
state
.
dataSource
.
filter
(
item
=>
item
.
id
===
transactionProcesssId
)[
0
][
"t
ype"
]
let
baseProcessId
=
addSchemaAction
.
getFieldValue
(
"baseProce
ssId"
)
addSchemaAction
.
getFieldState
(
"
baseProce
ssId"
,
state
=>
{
let
type
=
state
.
dataSource
.
filter
(
item
=>
item
.
baseProcessid
===
baseProcessId
)[
0
][
"processT
ype"
]
PublicApi
.
getOrderTradingRulesProductIdList
({
shopId
:
id
,
type
}).
then
(
res
=>
{
const
{
data
,
code
}
=
res
setIdNotInList
(()
=>
data
?.
productIds
||
[])
...
...
@@ -309,6 +316,8 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
initialValues=
{
initValue
}
expressionScope=
{
{
tableColumns
,
paymentColumns
,
paymentComponents
,
tableAddButton
,
paginationChange
,
productsLength
,
...
...
@@ -317,38 +326,64 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
components=
{
{
SelectProcesss
,
}
}
effects=
{
(
$
,
{
setFieldState
})
=>
{
effects=
{
(
$
,
{
setFieldState
,
setFieldValue
})
=>
{
FormEffectHooks
.
onFormInputChange$
().
subscribe
(()
=>
{
onFieldChange
()
})
createAddContractTemplateEffect
(
addSchemaAction
)
$
(
'onFieldValueChange'
,
'
isElectronic
Contract'
).
subscribe
(
parentState
=>
{
setFieldState
(
'
electronicC
ontractId'
,
state
=>
{
$
(
'onFieldValueChange'
,
'
has
Contract'
).
subscribe
(
parentState
=>
{
setFieldState
(
'
c
ontractId'
,
state
=>
{
state
.
visible
=
parentState
.
value
})
})
$
(
'onFieldInputChange'
,
'shopIds'
).
subscribe
(
parentState
=>
{
setFieldState
(
'
isTacitlyApprove
'
,
state
=>
{
state
.
value
=
1
setFieldState
(
'
allProducts
'
,
state
=>
{
state
.
value
=
true
})
fatchSetedProducts
(
parentState
.
value
[
0
])
})
$
(
'onFieldInputChange'
,
'transactionProcesssId'
).
subscribe
(
parentState
=>
{
$
(
'onFieldInputChange'
,
'baseProcessId'
).
subscribe
(
parentState
=>
{
const
selectedObject
=
parentState
.
dataSource
.
filter
(
item
=>
item
.
baseProcessid
===
parentState
.
value
)[
0
]
// 不是下单交易类型 隐藏电子合同
if
(
parentState
.
dataSource
.
filter
(
item
=>
item
.
id
===
parentState
.
value
)[
0
][
"t
ype"
]
!==
1
)
{
if
(
selectedObject
[
"processT
ype"
]
!==
1
)
{
setFieldState
(
"MEGA_LAYOUT1_1"
,
state
=>
{
state
.
visible
=
false
})
setFieldState
(
"
time
"
,
state
=>
{
setFieldState
(
"
expireHours
"
,
state
=>
{
state
.
visible
=
false
})
}
else
{
setFieldState
(
"MEGA_LAYOUT1_1"
,
state
=>
{
state
.
visible
=
true
})
setFieldState
(
"time"
,
state
=>
{
setFieldState
(
"expireHours"
,
state
=>
{
state
.
visible
=
true
})
}
// 不是多次支付 隐藏支付配置
if
(
selectedObject
[
'payTimes'
]
>
0
)
{
setFieldState
(
"MEGA_LAYOUT1_2"
,
state
=>
{
state
.
visible
=
true
})
setFieldState
(
"payments"
,
state
=>
{
state
.
visible
=
true
})
let
initPayments
:
any
[]
=
[];
for
(
let
i
=
1
;
i
<=
selectedObject
[
'payTimes'
];
i
++
)
{
initPayments
.
push
({
batchNo
:
i
,
payNode
:
null
,
payRate
:
null
})
}
setFieldValue
(
"payments"
,
initPayments
)
}
else
{
setFieldState
(
"MEGA_LAYOUT1_2"
,
state
=>
{
state
.
visible
=
false
})
setFieldState
(
"payments"
,
state
=>
{
state
.
visible
=
false
})
}
})
}
}
...
...
src/pages/transaction/transactionRules/components/paymentTableCell/index.less
0 → 100644
View file @
9dcd5b78
.customeFormItem {
margin: 0;
position: 'relative';
.ant-form-item-control {
.ant-form-item-explain-error {
position: absolute;
left: 0;
bottom: 0;
}
}
}
src/pages/transaction/transactionRules/components/paymentTableCell/index.tsx
0 → 100644
View file @
9dcd5b78
import
React
,
{
useRef
,
useContext
}
from
'react'
import
{
Form
,
Input
}
from
'antd'
;
import
'./index.less'
import
{
validatorByte
}
from
'@/utils/regExp'
;
export
interface
PaymentTableCellProps
{
title
:
React
.
ReactNode
;
editable
:
boolean
;
children
:
React
.
ReactNode
;
dataIndex
:
string
;
record
:
any
;
handleSave
:
(
record
:
any
)
=>
Promise
<
any
>
;
forceEdit
:
boolean
,
formItem
:
string
,
formItemProps
:
any
,
}
const
EditableContext
=
React
.
createContext
<
any
>
({});
export
const
PaymentEditableRow
:
React
.
FC
<
any
>
=
({...
props
})
=>
{
const
[
form
]
=
Form
.
useForm
();
const
ctx
=
{
form
}
return
(
<
Form
form=
{
form
}
component=
{
false
}
>
<
EditableContext
.
Provider
value=
{
ctx
}
>
<
tr
{
...
props
}
/>
</
EditableContext
.
Provider
>
</
Form
>
);
};
export
const
PaymentTableCell
:
React
.
FC
<
PaymentTableCellProps
>
=
({
title
,
editable
,
children
,
dataIndex
,
record
,
handleSave
,
forceEdit
,
formItem
,
formItemProps
=
{},
...
restProps
})
=>
{
const
formItemRef
=
useRef
<
any
>
();
const
{
form
}
=
useContext
(
EditableContext
);
const
save
=
async
e
=>
{
try
{
const
values
=
await
form
.
validateFields
();
handleSave
({
...
record
,
...
values
});
}
catch
(
errInfo
)
{
console
.
log
(
'Save failed:'
,
errInfo
);
}
};
const
chooseFormItem
=
(
type
,
dataIndex
)
=>
{
switch
(
type
)
{
case
'input'
:
{
return
<
Input
style=
{
{
width
:
140
}
}
type=
{
dataIndex
===
'payNode'
?
'string'
:
'number'
}
ref=
{
formItemRef
}
onChange=
{
save
}
{
...
formItemProps
}
id=
{
dataIndex
+
record
.
batchNo
}
className=
"payment_setting_input"
/>
}
}
}
let
childNode
=
children
;
if
(
editable
)
{
childNode
=
<
Form
.
Item
className=
"customFormItem"
name=
{
dataIndex
}
initialValue=
{
record
[
dataIndex
]
||
''
}
rules=
{
[
{
required
:
true
,
message
:
`${title}必须填写`
,
},
dataIndex
===
'payNode'
?
{
validator
:
(
r
,
v
,
c
)
=>
validatorByte
(
r
,
v
,
c
,
24
)
}
:
{
pattern
:
/^
\d
+
(\.\d
{1,2}
)?
$/
,
message
:
`支付比例仅限两位小数`
,
},
]
}
>
{
chooseFormItem
(
formItem
,
dataIndex
)
}
</
Form
.
Item
>
}
return
<
td
{
...
restProps
}
>
{
childNode
}
</
td
>;
}
PaymentTableCell
.
defaultProps
=
{}
export
default
PaymentTableCell
src/pages/transaction/transactionRules/components/selectProcesss/index.tsx
View file @
9dcd5b78
import
React
,
{
useState
,
use
Ref
,
use
Effect
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
styled
from
'styled-components'
import
{
ISchemaF
ormProps
,
ISchemaFieldProps
,
ISchemaFieldComponentProps
,
createFormAction
s
,
useFieldState
}
from
'@formily/antd'
import
{
Button
,
Space
,
Row
,
Col
,
Tag
}
from
'antd'
import
{
PlusOutlined
,
DeleteColumnOutlined
,
EditOutlined
,
DeleteOutlined
,
CaretUpOutlined
,
CaretDownOutlined
,
Eye
Outlined
}
from
'@ant-design/icons'
import
{
ISchemaF
ieldComponentProp
s
,
useFieldState
}
from
'@formily/antd'
import
{
Row
,
Col
,
Tag
}
from
'antd'
import
{
CaretUpOutlined
,
CaretDown
Outlined
}
from
'@ant-design/icons'
import
cx
from
'classnames'
import
{
PublicApi
}
from
'@/services/api'
...
...
@@ -48,7 +48,8 @@ enum ProcessTagType {
'售后换货流程'
,
'售后退货流程'
,
'售后维修流程'
,
'加工生产流程'
'加工生产流程'
,
'直发客户自动二次发货'
}
const
SelectProcesss
=
(
props
:
ISchemaFieldComponentProps
)
=>
{
...
...
@@ -61,7 +62,7 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
const
{
value
,
mutators
,
editable
}
=
props
useEffect
(()
=>
{
PublicApi
.
getOrderTrad
ingRulesTransactionProcess
List
().
then
(
res
=>
{
PublicApi
.
getOrderTrad
eProcessBase
List
().
then
(
res
=>
{
setFieldState
({
dataSource
:
res
.
data
,
showMore
...
...
@@ -85,8 +86,8 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
}
const
renderProcessType
=
(
v
:
any
)
=>
{
return
<
Tag
color=
{
ProcessTagColor
[
v
.
t
ype
-
1
]
}
>
{
ProcessTagType
[
v
.
t
ype
-
1
]
}
return
<
Tag
color=
{
ProcessTagColor
[
v
.
processT
ype
-
1
]
}
>
{
ProcessTagType
[
v
.
processT
ype
-
1
]
}
</
Tag
>
}
...
...
@@ -94,17 +95,17 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
<
div
style=
{
{
width
:
'100%'
}
}
>
<
SelectStyles
>
{
showDataSource
.
map
(
v
=>
<
div
key=
{
v
.
id
}
onClick=
{
()
=>
handleCheck
(
v
.
id
)
}
className=
{
cx
(
'select_style_border'
,
value
===
v
.
id
?
'active'
:
''
)
}
>
showDataSource
.
map
(
v
=>
<
div
key=
{
v
.
baseProcessid
}
onClick=
{
()
=>
handleCheck
(
v
.
baseProcessid
)
}
className=
{
cx
(
'select_style_border'
,
value
===
v
.
baseProcess
id
?
'active'
:
''
)
}
>
<
div
>
<
Row
style=
{
{
color
:
'#303133'
}
}
>
<
Col
>
{
v
.
n
ame
}
</
Col
>
<
Col
>
{
v
.
processN
ame
}
</
Col
>
<
Col
style=
{
{
marginLeft
:
6
}
}
>
{
renderProcessType
(
v
)
}
</
Col
>
</
Row
>
<
div
style=
{
{
color
:
'#909399'
}
}
>
{
v
.
explai
n
}
</
div
>
<
div
style=
{
{
color
:
'#909399'
}
}
>
{
v
.
descriptio
n
}
</
div
>
</
div
>
</
div
>)
}
...
...
src/pages/transaction/transactionRules/effects/index.tsx
View file @
9dcd5b78
...
...
@@ -7,7 +7,7 @@ const { onFieldValueChange$ } = FormEffectHooks
export
const
createAddContractTemplateEffect
=
(
context
:
ISchemaFormActions
)
=>
{
const
fetchListContractTemplateAll
=
async
()
=>
{
const
{
data
}
=
await
PublicApi
.
getContractSelectListContractTemplate
()
context
.
setFieldState
(
'
electronicC
ontractId'
,
state
=>
{
context
.
setFieldState
(
'
c
ontractId'
,
state
=>
{
state
.
contractTemplateLists
=
data
})
return
data
.
map
(
v
=>
({
...
...
@@ -16,12 +16,5 @@ export const createAddContractTemplateEffect = (context: ISchemaFormActions) =>
}))
}
useAsyncSelect
(
'electronicContractId'
,
fetchListContractTemplateAll
)
}
export
const
useUnitPreview
=
(
initValue
,
context
)
=>
{
useEffect
(()
=>
{
context
.
setFieldValue
(
'isElectronicContract'
,
initValue
?.
isElectronicContract
?
true
:
false
)
context
.
setFieldValue
(
'isTacitlyApprove'
,
initValue
?.
isTacitlyApprove
)
},
[
initValue
])
useAsyncSelect
(
'contractId'
,
fetchListContractTemplateAll
)
}
src/pages/transaction/transactionRules/index.tsx
View file @
9dcd5b78
import
React
,
{
ReactNode
,
useRef
,
useEffect
}
from
'react'
import
React
,
{
ReactNode
,
useRef
}
from
'react'
import
{
history
}
from
'umi'
import
{
Button
,
Popconfirm
,
Card
,
message
,
Dropdown
,
Menu
,
Space
}
from
'antd'
import
{
Button
,
Popconfirm
,
Card
,
Space
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
PlusOutlined
,
PlayCircleOutlined
,
EyeOutlined
,
PauseCircleOutlined
,
CaretDownOutlined
}
from
'@ant-design/icons'
import
{
StandardTable
}
from
'god'
import
{
ColumnType
}
from
'antd/lib/table/interface'
...
...
@@ -23,10 +21,9 @@ const TransactionRules: React.FC<{}> = () => {
const
ref
=
useRef
<
any
>
({})
const
fetchData
=
(
params
:
any
)
=>
{
console
.
log
(
params
,
'params'
)
if
(
!
params
?.
name
)
delete
params
.
name
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getOrderTrad
ingRulesList
(
params
).
then
(
res
=>
{
PublicApi
.
getOrderTrad
eProcessPage
(
params
).
then
(
res
=>
{
const
{
data
}
=
res
resolve
(
data
)
})
...
...
@@ -36,8 +33,8 @@ const TransactionRules: React.FC<{}> = () => {
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'交易规则ID'
,
dataIndex
:
'
i
d'
,
key
:
'
i
d'
,
dataIndex
:
'
processI
d'
,
key
:
'
processI
d'
,
},
{
title
:
'流程规则名称'
,
...
...
@@ -45,26 +42,26 @@ const TransactionRules: React.FC<{}> = () => {
key
:
'name'
,
className
:
'commonPickColor'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
EyePreview
url=
{
`/memberCenter/tranactionAbility/transactionRules/detail?id=${record.
i
d}&preview=1`
}
url=
{
`/memberCenter/tranactionAbility/transactionRules/detail?id=${record.
processI
d}&preview=1`
}
>
{
text
}
</
EyePreview
>
},
{
title
:
'交易流程名称'
,
dataIndex
:
'
transactionProcess
'
,
key
:
'
transactionProcess
'
,
dataIndex
:
'
processName
'
,
key
:
'
processName
'
,
},
{
title
:
'操作时间'
,
dataIndex
:
'
operation
Time'
,
key
:
'
operation
Time'
,
dataIndex
:
'
create
Time'
,
key
:
'
create
Time'
,
render
:
(
text
:
any
,
record
:
any
)
=>
text
&&
moment
(
text
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
},
{
title
:
'状态'
,
dataIndex
:
'stat
e
'
,
key
:
'stat
e
'
,
dataIndex
:
'stat
us
'
,
key
:
'stat
us
'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
let
component
:
ReactNode
=
null
component
=
(
...
...
@@ -77,7 +74,7 @@ const TransactionRules: React.FC<{}> = () => {
>
<
Button
type=
"link"
style=
{
record
.
stat
e
?
{
color
:
'#00B37A'
}
:
{
color
:
'red'
}
}
>
{
record
.
state
?
<>
有效
<
PlayCircleOutlined
/></>
:
<>
无效
<
PauseCircleOutlined
/></>
}
</
Button
>
style=
{
record
.
stat
us
?
{
color
:
'#00B37A'
}
:
{
color
:
'red'
}
}
>
{
record
.
status
?
<>
有效
<
PlayCircleOutlined
/></>
:
<>
无效
<
PauseCircleOutlined
/></>
}
</
Button
>
</
Popconfirm
>
)
return
component
...
...
@@ -90,7 +87,7 @@ const TransactionRules: React.FC<{}> = () => {
return
(
<>
{
(
record
.
stat
e
===
0
)
?
<>
(
record
.
stat
us
===
0
)
?
<>
<
Popconfirm
title=
"确定要执行这个操作?"
onConfirm=
{
()
=>
handelDelete
(
record
)
}
...
...
@@ -100,7 +97,7 @@ const TransactionRules: React.FC<{}> = () => {
>
<
Button
type=
'link'
>
删除
</
Button
>
</
Popconfirm
>
<
Button
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/memberCenter/tranactionAbility/transactionRules/add?id=${record.
i
d}`
)
}
>
修改
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/memberCenter/tranactionAbility/transactionRules/add?id=${record.
processI
d}`
)
}
>
修改
</
Button
>
</>
:
''
}
</>
...
...
@@ -110,7 +107,7 @@ const TransactionRules: React.FC<{}> = () => {
];
const
confirm
=
(
record
:
any
)
=>
{
PublicApi
.
postOrderTrad
ingRulesUpdateState
({
id
:
record
.
id
,
state
:
record
.
state
?
0
:
1
}).
then
(
res
=>
{
PublicApi
.
postOrderTrad
eProcessStatusUpdate
({
processId
:
record
.
processId
,
status
:
record
.
status
?
0
:
1
}).
then
(
res
=>
{
ref
.
current
.
reload
()
})
}
...
...
@@ -120,7 +117,7 @@ const TransactionRules: React.FC<{}> = () => {
}
const
handelDelete
=
(
record
:
any
)
=>
{
PublicApi
.
postOrderTrad
ingRulesDelete
({
id
:
record
.
i
d
}).
then
(
res
=>
{
PublicApi
.
postOrderTrad
eProcessDelete
({
processId
:
record
.
processI
d
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
ref
.
current
.
reload
()
})
...
...
@@ -140,7 +137,7 @@ const TransactionRules: React.FC<{}> = () => {
<
StandardTable
tableProps=
{
{
rowKey
:
'
i
d'
,
rowKey
:
'
processI
d'
,
}
}
columns=
{
columns
}
currentRef=
{
ref
}
...
...
@@ -188,59 +185,6 @@ const TransactionRules: React.FC<{}> = () => {
/>
}
/>
{
/* <StandardTable
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
layouts: {
order: 1,
span: 4,
},
ctx: {
inline: false,
schema: {
type: 'object',
properties: {
megaLayout0: {
type: 'object',
'x-component': 'mega-layout',
"x-component-props": {
grid: true,
columns: 2,
},
properties: {
name: {
type: 'string',
'x-component-props': {
placeholder: '规则名称',
},
'x-component': 'Search'
}
}
}
}
}
}
}}
formilyChilds={{
layouts: {
order: 0
},
children: (
<>
<Button type="primary" icon={<PlusOutlined />} onClick={() => history.push('/memberCenter/tranactionAbility/transactionRules/add')}>
新建
</Button>
</>
)
}}
/> */
}
</
Card
>
</
PageHeaderWrapper
>
)
...
...
src/pages/transaction/transactionRules/model/usePaymentTable.tsx
0 → 100644
View file @
9dcd5b78
import
React
from
'react'
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
;
import
PaymentTableCell
,
{
PaymentEditableRow
}
from
'../components/paymentTableCell'
;
import
style
from
'../index.less'
// 支付配置
const
paymentColumns
=
[
{
dataIndex
:
'batchNo'
,
title
:
'支付次数'
,
key
:
'batchNo'
},
{
dataIndex
:
'payNode'
,
title
:
'支付环节'
,
key
:
'payNode'
,
formItem
:
'input'
,
editable
:
true
,
width
:
200
,
},
{
dataIndex
:
'payRate'
,
title
:
'支付比例'
,
key
:
'payRate'
,
formItem
:
'input'
,
editable
:
true
,
width
:
80
,
formItemProps
:
{
suffix
:
'%'
,
},
},
]
/**
* @param ctx schemaAction
*/
export
const
usePaymentTable
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
const
paymentComponents
=
{
body
:
{
row
:
PaymentEditableRow
,
cell
:
PaymentTableCell
}
}
const
handleSave
=
row
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
newData
=
[...
ctx
.
getFieldValue
(
'payments'
)];
const
index
=
newData
.
findIndex
(
item
=>
row
.
batchNo
===
item
.
batchNo
);
const
item
=
newData
[
index
];
newData
.
splice
(
index
,
1
,
{
...
item
,
...
row
,
});
ctx
.
setFieldValue
(
'payments'
,
newData
)
console
.
log
(
newData
,
row
)
resolve
({
item
,
newData
})
})
};
const
paymentMergeColumns
=
paymentColumns
.
map
(
col
=>
{
if
(
!
col
.
editable
)
{
return
col
;
}
return
{
...
col
,
onCell
:
record
=>
({
record
,
editable
:
ctx
.
getFormState
().
editable
===
false
?
false
:
col
.
editable
,
dataIndex
:
col
.
dataIndex
,
title
:
col
.
title
,
formItem
:
col
.
formItem
,
formItemProps
:
col
.
formItemProps
,
handleSave
}),
};
})
return
{
paymentColumns
:
paymentMergeColumns
,
paymentComponents
,
}
}
src/pages/transaction/transactionRules/schema/index.tsx
View file @
9dcd5b78
...
...
@@ -48,7 +48,7 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
}
]
},
"
transactionProces
ssId"
:
{
"
baseProce
ssId"
:
{
type
:
'string'
,
title
:
'流程选择'
,
"x-component"
:
'SelectProcesss'
,
...
...
@@ -66,15 +66,8 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
message
:
'请选择流程配置'
}
],
// required: true,
// "x-component": 'SearchSelect',
// "x-component-props": {
// placeholder: '请选择交易流程',
// className: 'fixed-ant-selected-down',
// fetchSearch: PublicApi.getOrderTradingRulesTransactionProcessList,
// },
},
"
time
"
:
{
"
expireHours
"
:
{
type
:
'string'
,
title
:
"{{help('订单取消时间', '单后超过多少小时未支付后自动取消订单')}}"
,
"x-component-props"
:
{
...
...
@@ -98,15 +91,22 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
wrapperCol
:
24
,
},
properties
:
{
"
isElectronic
Contract"
:
{
"
has
Contract"
:
{
type
:
'string'
,
"x-component-props"
:
{
children
:
"使用电子合同"
},
"x-component"
:
"checkboxsingle"
,
default
:
false
default
:
false
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'contractId'
,
"condition"
:
"{{$value}}"
}
]
},
"
electronicC
ontractId"
:
{
"
c
ontractId"
:
{
type
:
'string'
,
required
:
true
,
enum
:
[],
...
...
@@ -116,7 +116,30 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
visible
:
false
}
}
}
},
// 自定义支付配置
// MEGA_LAYOUT1_2: {
// type: 'object',
// 'x-component': 'mega-layout',
// 'x-component-props': {
// label: '支付配置',
// wrapperCol: 24,
// },
// properties: {
"payments"
:
{
type
:
'array:number'
,
title
:
'支付配置'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'batchNo'
,
columns
:
"{{paymentColumns}}"
,
components
:
"{{paymentComponents}}"
,
pagination
:
false
,
},
visible
:
false
},
// }
// }
}
}
}
...
...
@@ -165,20 +188,20 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
labelAlign
:
'left'
},
properties
:
{
"
isTacitlyApprove
"
:
{
"
allProducts
"
:
{
"type"
:
"radio"
,
enum
:
[
{
label
:
'所有商品(默认)'
,
value
:
1
},
{
label
:
'指定商品'
,
value
:
2
},
{
label
:
'所有商品(默认)'
,
value
:
true
},
{
label
:
'指定商品'
,
value
:
false
},
],
"title"
:
"适用商品"
,
default
:
1
,
default
:
true
,
required
:
true
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'products'
,
"condition"
:
"{{$value ===
2
}}"
"condition"
:
"{{$value ===
false
}}"
}
]
},
...
...
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