Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
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
project
jinfa-admin
Commits
b4b621b1
Commit
b4b621b1
authored
Dec 28, 2020
by
前端-黄佳鑫
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into test
parents
9aab7ff4
492b2cb3
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
452 additions
and
285 deletions
+452
-285
payWayRadio.tsx
...s/ruleSettingManage/paySetting/components/payWayRadio.tsx
+43
-0
payWayTable.tsx
...s/ruleSettingManage/paySetting/components/payWayTable.tsx
+116
-0
setUpModal.tsx
...es/ruleSettingManage/paySetting/components/setUpModal.tsx
+102
-0
usePayTypeEnum.ts
...ruleSettingManage/paySetting/components/usePayTypeEnum.ts
+31
-0
index.less
src/pages/ruleSettingManage/paySetting/index.less
+6
-0
index.tsx
src/pages/ruleSettingManage/paySetting/index.tsx
+4
-5
settingIndex.tsx
src/pages/ruleSettingManage/paySetting/settingIndex.tsx
+142
-276
index.tsx
src/pages/ruleSettingManage/payStrategy/index.tsx
+8
-4
No files found.
src/pages/ruleSettingManage/paySetting/components/payWayRadio.tsx
0 → 100644
View file @
b4b621b1
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Space
,
Radio
,
Form
}
from
'antd'
;
import
"../index.less"
;
interface
params
{
name
:
string
,
value
:
number
,
selectId
:
number
,
onChange
:
Function
}
const
PayWayRadio
:
React
.
FC
<
params
>
=
(
props
)
=>
{
const
{
value
,
selectId
,
onChange
,
name
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
useEffect
(()
=>
{
form
.
resetFields
()
},
[
value
])
const
options
=
[{
label
:
'是'
,
value
:
1
},
{
label
:
'否'
,
value
:
0
}]
return
(
<
Space
size=
{
49
}
>
<
span
>
是否开启
{
name
}
</
span
>
<
Form
form=
{
form
}
>
<
Form
.
Item
name=
{
`radio-${selectId}`
}
noStyle
initialValue=
{
value
}
>
<
Radio
.
Group
options=
{
options
}
className=
'radio-group-box'
size=
"small"
buttonStyle=
"solid"
optionType=
"button"
onChange=
{
(
e
)
=>
onChange
(
e
)
}
/>
</
Form
.
Item
>
</
Form
>
</
Space
>
)
}
export
default
PayWayRadio
;
src/pages/ruleSettingManage/paySetting/components/payWayTable.tsx
0 → 100644
View file @
b4b621b1
import
React
,
{
useState
}
from
'react'
;
import
{
Table
,
Button
}
from
'antd'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
SetUpModal
from
'./setUpModal'
;
interface
payWayTableParams
{
name
?:
string
,
payParametersList
?:
any
,
payParametersListResponses
?:
any
,
visible
?:
boolean
,
onGet
:
Function
,
onType
?:
number
,
onDel
:
Function
,
onEdit
:
Function
,
id
?:
number
}
const
PayWayTable
:
React
.
FC
<
payWayTableParams
>
=
(
props
)
=>
{
const
[
modalvisible
,
setmodalvisible
]
=
useState
<
boolean
>
(
false
);
const
[
type
,
setType
]
=
useState
<
any
>
();
// 1.
const
[
edit
,
setedit
]
=
useState
<
any
>
({});
const
[
modifyIndex
,
setModifyIndex
]
=
useState
<
any
>
(
0
)
const
[
modify
,
setmodify
]
=
useState
<
boolean
>
(
false
);
const
{
name
,
payParametersListResponses
,
payParametersList
,
visible
,
onType
,
onGet
,
onDel
,
onEdit
,
id
}
=
props
;
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'参数代码'
,
key
:
'code'
,
dataIndex
:
'code'
},
{
title
:
'参数值'
,
key
:
'value'
,
dataIndex
:
'value'
},
{
title
:
'参数描述'
,
key
:
'describe'
,
dataIndex
:
'describe'
},
{
title
:
'操作'
,
key
:
'options'
,
dataIndex
:
'options'
,
render
:
(
text
:
any
,
record
:
any
,
index
:
number
)
=>
<>
<
Button
type=
'link'
onClick=
{
()
=>
{
setedit
(
record
);
setmodalvisible
(
true
);
setModifyIndex
(
index
);
setmodify
(
true
)
}
}
>
编辑
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
onDel
(
record
.
type
,
index
)
}
>
删除
</
Button
>
</>
}
]
const
handleOk
=
(
value
:
any
,
idx
:
number
)
=>
{
let
idType
:
number
=
1
;
switch
(
type
)
{
case
1
:
idType
=
1
break
;
case
2
:
idType
=
3
break
;
case
3
:
idType
=
2
break
;
}
if
(
!
modify
)
{
onGet
(
value
,
idType
)
}
else
{
onEdit
(
value
,
idType
,
modifyIndex
)
}
setedit
({});
setmodalvisible
(
false
);
}
return
(
<>
{
visible
&&
<>
<
div
style=
{
{
borderLeft
:
'2px solid #00B37A'
,
margin
:
'41px 0 8px'
,
padding
:
'1px 5px'
}
}
>
{
name
}
参数配置
</
div
>
<
Table
columns=
{
columns
}
dataSource=
{
payParametersListResponses
}
rowKey=
{
(
record
:
any
,
index
:
number
)
=>
index
}
pagination=
{
false
}
/>
<
Button
style=
{
{
marginBottom
:
16
,
marginTop
:
24
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
{
setmodalvisible
(
true
);
setType
(
id
);
setmodify
(
false
)
}
}
type=
'dashed'
>
新增参数配置
</
Button
>
{
id
!==
2
&&
<>
<
div
style=
{
{
borderLeft
:
'2px solid #00B37A'
,
margin
:
'41px 0 8px'
,
padding
:
'1px 5px'
}
}
>
{
name
}
转账到银行卡参数配置
</
div
>
<
Table
columns=
{
columns
}
dataSource=
{
payParametersList
}
rowKey=
{
(
record
:
any
,
index
:
number
)
=>
index
}
pagination=
{
false
}
/>
<
Button
style=
{
{
marginBottom
:
16
,
marginTop
:
24
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
{
setmodalvisible
(
true
);
setType
(
3
);
setmodify
(
false
)
}
}
type=
'dashed'
>
新增参数配置
</
Button
>
</>
}
</>
}
<
SetUpModal
onType=
{
onType
}
type=
{
type
}
modalvisible=
{
modalvisible
}
edit=
{
edit
}
onOK=
{
(
value
)
=>
handleOk
(
value
,
type
)
}
onCancel=
{
()
=>
setmodalvisible
(
false
)
}
/>
</>
)
}
export
default
PayWayTable
;
src/pages/ruleSettingManage/paySetting/components/setUpModal.tsx
0 → 100644
View file @
b4b621b1
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Modal
,
Form
,
Select
,
Input
}
from
'antd'
;
import
usePayTypeEnum
from
'./usePayTypeEnum'
;
const
{
Option
}
=
Select
;
const
{
TextArea
}
=
Input
;
interface
setUpModalParams
{
type
?:
number
,
modalvisible
?:
boolean
,
onOK
:
Function
,
onCancel
:
Function
,
onType
?:
number
,
edit
?:
any
}
const
layout
:
any
=
{
colon
:
false
,
labelCol
:
{
style
:
{
width
:
'100px'
}
},
labelAlign
:
"left"
};
const
SetUpModal
:
React
.
FC
<
setUpModalParams
>
=
(
props
)
=>
{
const
[
form
]
=
Form
.
useForm
();
const
{
payTypeEnum
}
=
usePayTypeEnum
();
const
{
modalvisible
,
onOK
,
onCancel
,
type
,
edit
}
=
props
;
const
[
option
,
setOption
]
=
useState
<
any
>
({})
const
handleOk
=
()
=>
{
form
.
validateFields
().
then
(
res
=>
{
console
.
log
(
type
)
let
idType
:
number
=
1
;
switch
(
type
)
{
case
1
:
idType
=
1
break
;
case
2
:
idType
=
3
break
;
case
3
:
idType
=
2
break
;
}
const
obj
=
{
id
:
edit
.
id
?
edit
.
id
:
undefined
,
code
:
option
.
children
?
option
.
children
:
edit
.
code
,
value
:
res
.
value
,
describe
:
res
.
describe
,
type
:
idType
,
payWayCodeTypeEnum
:
res
.
code
}
onOK
(
obj
)
form
.
resetFields
();
}).
catch
(
error
=>
{
console
.
log
(
error
)
})
}
const
handleChange
=
(
e
:
any
,
option
:
any
)
=>
{
setOption
(
option
)
}
useEffect
(()
=>
{
if
(
Object
.
keys
(
edit
).
length
>
0
)
{
console
.
log
(
edit
,
10086
)
form
.
setFieldsValue
({
code
:
edit
.
payWayCodeTypeEnum
,
value
:
edit
.
value
,
describe
:
edit
.
describe
})
}
},
[
edit
])
return
(
<
Modal
width=
{
576
}
title=
'新增参数配置'
visible=
{
modalvisible
}
onOk=
{
handleOk
}
onCancel=
{
()
=>
onCancel
()
}
>
<
Form
form=
{
form
}
{
...
layout
}
>
<
Form
.
Item
name=
'code'
label=
'参数代码'
rules=
{
[{
required
:
true
,
message
:
'请选择参数代码'
}]
}
>
<
Select
onChange=
{
handleChange
}
>
{
payTypeEnum
.
map
(
item
=>
(
<
Option
key=
{
item
.
value
}
payWayCodeTypeEnum=
{
item
.
value
}
value=
{
item
.
value
}
>
{
item
.
label
}
</
Option
>
))
}
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
name=
'value'
label=
'参数值'
rules=
{
[{
required
:
true
,
message
:
'请输入参数值'
}]
}
>
<
Input
/>
</
Form
.
Item
>
<
Form
.
Item
name=
'describe'
label=
'参数描述'
>
<
TextArea
rows=
{
4
}
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
)
}
export
default
SetUpModal
;
src/pages/ruleSettingManage/paySetting/components/usePayTypeEnum.ts
0 → 100644
View file @
b4b621b1
import
{
PublicApi
}
from
'@/services/api'
;
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
const
usePayTypeEnum
=
()
=>
{
const
[
payTypeEnum
,
setPayTypeEnum
]
=
useState
<
any
>
([])
const
ref
=
useRef
(
payTypeEnum
);
useEffect
(()
=>
{
const
getPayWayType
=
async
()
=>
{
await
PublicApi
.
getPayGetPayWayCodeTypeEnum
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
const
{
data
}
=
res
;
const
payWay
:
any
[]
=
[]
data
.
forEach
(
v
=>
{
payWay
.
push
({
label
:
v
.
name
,
value
:
v
.
type
})
})
ref
.
current
=
payWay
setPayTypeEnum
(
ref
.
current
)
}
})
}
getPayWayType
();
},[])
return
{
payTypeEnum
};
}
export
default
usePayTypeEnum
;
src/pages/ruleSettingManage/paySetting/index.less
0 → 100644
View file @
b4b621b1
.radio-group-box {
.ant-radio-button-wrapper {
width: 80px !important;
text-align: center;
}
}
src/pages/ruleSettingManage/paySetting/index.tsx
View file @
b4b621b1
...
...
@@ -39,7 +39,7 @@ const PaySetting: React.FC<{}> = () => {
}
const
handleModalOK
=
(
obj
:
any
)
=>
{
console
.
log
(
'选项卡:'
,
exportId
(),
'弹窗id:'
,
type
)
setvisible
(
false
)
currentTab
=
!
exportId
()
?
1
:
exportId
()
console
.
log
(
'选项卡:'
,
exportId
(),
'数据'
,
obj
)
...
...
@@ -62,7 +62,7 @@ const PaySetting: React.FC<{}> = () => {
//微信
if
(
type
==
3
){
let
list
:
any
=
[]
list
.
push
(
obj
)
let
old
=
payActions
.
getFieldValue
(
"payParametersListResponses2"
)
...
...
@@ -137,7 +137,7 @@ const PaySetting: React.FC<{}> = () => {
list
=
[...
payParametersListResponses
]
}
console
.
log
(
list
)
// return
// return
PublicApi
.
postPayCollectionParametersAdd
({
payWayId
:
currentTab
,
isPitchOn
:
values
.
isPitchOn
,
...
...
@@ -183,4 +183,4 @@ const PaySetting: React.FC<{}> = () => {
</
PageHeaderWrapper
>
)
}
export
default
PaySetting
\ No newline at end of file
export
default
PaySetting
src/pages/ruleSettingManage/paySetting/settingIndex.tsx
View file @
b4b621b1
/*
* @Author:
LeeJiancong
* @Date: 2020-
08-13 09:50:41
* @LastEditors:
LeeJiancong
* @LastEditTime: 2020-
08-21 15:05:26
* @Author:
HJX
* @Date: 2020-
11-19 15:25:54
* @LastEditors:
HJX
* @LastEditTime: 2020-
11-19 15:25:54
*/
import
React
,
{
useEffect
,
useState
,
useRef
,
Fragment
,
ReactNode
}
from
'react'
import
{
Card
,
Button
,
Tabs
,
Radio
,
Space
,
Row
,
Col
,
Table
,
Popconfirm
,
Input
}
from
'antd'
import
{
PlusOutlined
,
SaveOutlined
}
from
'@ant-design/icons'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
EyePreview
from
'@/components/EyePreview'
import
{
createFormActions
,
FormEffectHooks
,
useFormEffects
}
from
'@formily/antd'
import
{
GlobalConfig
}
from
'@/global/config'
import
{
ColumnType
}
from
'antd/lib/table/interface'
import
PayForm
from
'../components/PayForm'
import
Setting
,
{
TabSetting
,
exportId
}
from
'../schema'
import
SettingModal
from
'../components/PayForm/components/settingModal'
import
{
PublicApi
}
from
'@/services/api'
import
{
history
}
from
'umi'
import
'../components/PayForm/components/index.less'
const
payActions
=
createFormActions
()
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
history
}
from
'umi'
;
import
{
Button
,
Card
,
Tabs
,
Space
,
Input
}
from
'antd'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
PayWayRadio
from
'./components/payWayRadio'
;
import
PayWayTable
from
'./components/payWayTable'
;
const
{
TabPane
}
=
Tabs
const
{
onFieldValueChange$
}
=
FormEffectHooks
const
TabList
:
any
=
GlobalConfig
.
payConfig
.
payPlatformPayConfig
||
[]
console
.
log
(
'初始化payConfig'
,
GlobalConfig
.
payConfig
.
payPlatformPayConfig
)
const
PaySetting
:
React
.
FC
<
{}
>
=
()
=>
{
const
ref
=
useRef
<
any
>
({})
const
[
mode
,
setmode
]
=
useState
<
number
>
(
0
)
const
[
dataInfo
,
setdataInfo
]
=
useState
<
any
>
({})
const
[
visible
,
setvisible
]
=
useState
<
boolean
>
(
false
)
const
[
optionType
,
setoptionType
]
=
useState
(
0
)
const
[
isPitchOn
,
setisPitchOn
]
=
useState
<
number
>
(
0
)
const
[
payParametersList
,
setpayParametersList
]
=
useState
<
any
>
([])
const
[
payParametersListResponses
,
setpayParametersListResponses
]
=
useState
<
any
>
([])
const
[
initialValues
,
setinitialValues
]
=
useState
({})
const
[
type
,
settype
]
=
useState
<
any
>
(
null
)
const
[
hasEdit
,
sethasEdit
]
=
useState
<
boolean
>
(
false
)
let
[
tabid
,
settabid
]
=
useState
<
any
>
(
null
)
//选项卡id
const
[
listID
,
setlistID
]
=
useState
(
null
)
//表格id
let
currentTab
=
exportId
()
let
[
tabOption
,
settabOption
]
=
useState
({
tab
:
1
,
type
:
1
})
const
handleAddMemberBtn
=
(
id
:
string
|
number
,
type
:
number
)
=>
{
console
.
log
(
'id'
,
id
,
'type'
,
type
)
setmode
(
0
)
settype
(
type
)
setvisible
(
true
)
setinitialValues
({})
const
PayWaySetTemplate
:
React
.
FC
<
{}
>
=
()
=>
{
const
[
config
,
setconfig
]
=
useState
<
any
>
([]);
const
[
payItem
,
setPayItem
]
=
useState
<
any
>
([]);
// const [step, setStep] = useState<Array<number>>([]);
const
[
obj
,
setObj
]
=
useState
<
any
>
({});
const
payWayConfigInfo
=
()
=>
{
// 支付配置信息
return
new
Promise
(
resolve
=>
{
PublicApi
.
getPayQueryPlatformDetails
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
})
})
}
const
handleEdit
=
(
record
:
any
,
type
:
number
|
string
,
index
:
number
)
=>
{
setvisible
(
true
)
setmode
(
1
)
//编辑还是新增
settype
(
type
)
setlistID
(
record
.
id
)
setinitialValues
(
record
)
console
.
log
(
'类型'
,
type
,
'下标'
,
index
,
'record'
,
record
,
'listID:'
,
listID
)
}
//删除
const
handleDeleteTable
=
(
type
:
number
,
id
:
number
,
index
)
=>
{
let
list
:
any
=
[]
if
(
type
===
1
||
type
===
3
)
{
list
=
[...
payParametersListResponses
]
list
.
splice
(
index
,
1
)
setpayParametersListResponses
(
list
)
useEffect
(()
=>
{
// 支付配置信息
payWayConfigInfo
().
then
((
res
:
any
)
=>
{
const
arr
:
any
[]
=
[];
console
.
log
(
res
)
res
.
forEach
((
item
:
any
)
=>
{
arr
.
push
({
id
:
item
.
id
,
way
:
item
.
way
,
isPitchOn
:
item
.
isPitchOn
?
item
.
isPitchOn
:
0
,
payType
:
item
.
payType
,
payParametersList
:
item
.
payParametersList
?
item
.
payParametersList
:
[],
payParametersAddListRequests
:
item
.
payParametersListResponses
?
item
.
payParametersListResponses
:
[]
})
})
setconfig
([...
res
]);
setPayItem
([...
arr
]);
})
},
[])
}
else
if
(
type
===
2
)
{
list
=
[...
payParametersList
]
list
.
splice
(
index
,
1
)
setpayParametersList
(
list
)
}
sethasEdit
(
true
)
const
onChangeRaido
=
(
e
:
any
,
index
:
number
)
=>
{
const
data
=
[...
payItem
];
payItem
[
index
].
isPitchOn
=
e
.
target
.
value
;
setPayItem
(
data
);
}
/**
* @description: 保存 编辑的时候遍历id是否一样 一样就替换
* @param {type} type: 1支付宝 2支付宝银行卡 3微信
* @return {type}
*/
const
handleModalOK
=
(
obj
:
any
)
=>
{
// console.log('选项卡:', tabid, '弹窗id:', type)
setvisible
(
false
)
// console.log('选项卡:', tabid, '数据', obj,'mode:',mode)
if
(
mode
===
0
)
{
if
(
type
==
1
||
type
==
3
)
{
let
list
:
any
=
[]
obj
.
payWayCodeTypeEnum
=
obj
.
code
list
.
push
(
obj
)
setpayParametersListResponses
([...
payParametersListResponses
,
...
list
])
sethasEdit
(
true
)
}
if
(
type
==
2
)
{
let
list
:
any
=
[]
obj
.
id
=
`obj-
${
payParametersList
.
length
}
`
list
.
push
(
obj
)
setpayParametersList
([...
payParametersList
,
...
list
])
sethasEdit
(
true
)
}
const
onGet
=
(
value
:
any
,
type
:
number
,
idx
:
number
)
=>
{
console
.
log
(
value
,
type
)
const
data
=
[...
payItem
];
if
(
type
===
2
)
{
data
[
idx
].
payParametersList
.
push
(
value
)
}
else
{
if
(
type
==
1
||
type
==
3
)
{
let
list
=
[...
payParametersListResponses
]
if
(
listID
)
{
list
.
forEach
((
v
,
i
)
=>
{
if
(
listID
==
v
.
id
)
{
list
[
i
]
=
obj
}
})
}
setpayParametersListResponses
([...
list
])
sethasEdit
(
true
)
}
else
if
(
type
==
2
)
{
//支付宝银行卡
let
list
=
[...
payParametersList
]
if
(
listID
)
{
list
.
forEach
((
v
,
i
)
=>
{
if
(
listID
==
v
.
id
)
{
list
[
i
]
=
obj
}
})
}
setpayParametersList
([...
list
])
sethasEdit
(
true
)
}
data
[
idx
].
payParametersAddListRequests
=
[...
data
[
idx
].
payParametersAddListRequests
,
value
]
}
setPayItem
(
data
);
}
// const tableAddButton = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(1)} type='dashed'>新增参数配置1</Button>
// const tableAddButton2 = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(2)} type='dashed'>新增参数配置2</Button>
// const tableAddButton3 = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(3)} type='dashed'>新增参数配置3</Button>
const
codeText
=
(
text
:
any
)
=>
{
let
code
:
ReactNode
=
''
;
text
===
1
?
code
=
<
span
>
mchId
</
span
>
:
text
===
2
?
code
=
<
span
>
mchKey
</
span
>
:
text
===
3
?
code
=
<
span
>
appId
</
span
>
:
code
=
<
span
>
appSecret
</
span
>
return
code
;
}
const
tableColumns
:
ColumnType
<
any
>
[]
=
[
{
dataIndex
:
'code'
,
title
:
'参数代码'
,
align
:
'center'
,
render
:
(
text
:
any
)
=>
codeText
(
text
)
},
{
dataIndex
:
'value'
,
align
:
'center'
,
title
:
'参数值'
,
render
:
(
_
,
record
)
=>
<
EyePreview
url=
{
`/memberCenter/memberAbility/manage/addMember?id=${record.memberId}&preview=1`
}
>
{
_
}
</
EyePreview
>
},
{
dataIndex
:
'describe'
,
title
:
'参数描述'
,
align
:
'center'
},
{
dataIndex
:
'ctl'
,
title
:
'操作'
,
align
:
'center'
,
render
:
(
_
,
record
,
index
)
=>
<>
<
Button
type=
'link'
onClick=
{
()
=>
handleEdit
(
record
,
record
.
type
,
index
)
}
>
编辑
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
handleDeleteTable
(
record
.
type
,
record
.
id
,
index
)
}
>
删除
</
Button
>
</>
/**删除 */
const
onDel
=
(
value
:
any
,
index
:
number
,
idx
:
number
)
=>
{
console
.
log
(
value
,
index
,
idx
,
10086
)
const
data
=
[...
payItem
];
if
(
Number
(
value
)
===
2
)
{
data
[
idx
].
payParametersList
.
splice
(
index
,
1
);
data
[
idx
].
payParametersList
=
[...
data
[
idx
].
payParametersList
]
}
else
{
data
[
idx
].
payParametersAddListRequests
.
splice
(
index
,
1
);
data
[
idx
].
payParametersAddListRequests
=
[...
data
[
idx
].
payParametersAddListRequests
]
}
]
//初始化
const
initBase
=
(
id
)
=>
{
PublicApi
.
getPayQueryPlatformDetails
({
id
:
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
let
{
id
,
isPitchOn
,
payParametersList
,
payParametersListResponses
}
=
res
.
data
payParametersList
=
payParametersList
?
payParametersList
:
[]
payParametersListResponses
=
payParametersListResponses
?
payParametersListResponses
:
[]
setisPitchOn
(
isPitchOn
)
setpayParametersList
(
payParametersList
)
setpayParametersListResponses
(
payParametersListResponses
)
}
})
setPayItem
([...
data
]);
}
useEffect
(()
=>
{
let
ids
=
TabList
.
map
((
v
,
i
)
=>
v
.
id
)
settabid
(
ids
[
0
]
)
const
init
=
setTimeout
(()
=>
{
tabid
=
tabid
?
tabid
:
ids
[
0
]
initBase
(
tabid
)
}
,
1000
)
return
()
=>
{
clearTimeout
(
init
)
/**编辑 */
const
onEdit
=
(
value
:
any
,
type
:
number
,
index
:
number
,
idx
:
number
)
=>
{
console
.
log
(
value
,
type
,
index
,
idx
)
const
data
=
[...
payItem
];
if
(
type
===
2
)
{
data
[
idx
].
payParametersList
[
index
]
=
{
...
value
};
data
[
idx
].
payParametersList
=
[...
data
[
idx
].
payParametersList
]
}
else
{
data
[
idx
].
payParametersAddListRequests
[
index
]
=
{
...
value
};
data
[
idx
].
payParametersAddListRequests
=
[...
data
[
idx
].
payParametersAddListRequests
]
}
},
[]
)
const
useTabEffects
=
()
=>
{
console
.
log
(
data
,
10086
)
setPayItem
(
data
);
}
//提交表单
const
handleSubmit
=
()
=>
{
let
list
:
any
=
[]
if
(
tabid
==
1
)
{
list
=
[...
payParametersList
,
...
payParametersListResponses
]
}
else
if
(
tabid
==
2
)
{
list
=
[...
payParametersListResponses
]
}
else
{
list
=
[]
}
/**保存更新 */
const
onHnadleSubmit
=
()
=>
{
PublicApi
.
postPayCollectionParametersAdd
({
payWayId
:
tabid
,
isPitchOn
:
isPitchOn
,
payParameters
:
list
platformPayWays
:
payItem
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setTimeout
(()
=>
{
history
.
push
(
`/ruleSettingManager/paySetting`
)
},
1500
)
history
.
push
(
'/ruleSettingManager/paySetting'
)
// location.reload();
}
})
}
const
changeTab
=
(
tab
)
=>
{
settabid
(
tab
)
initBase
(
tab
)
}
const
changeRadio
=
(
e
)
=>
{
setisPitchOn
(
e
.
target
.
value
)
/** */
const
handleBlur
=
(
e
,
name
,
idx
)
=>
{
const
data
=
[...
payItem
]
const
payParametersAddListRequests
=
data
[
idx
].
payParametersAddListRequests
;
if
(
payParametersAddListRequests
.
length
===
0
)
{
payParametersAddListRequests
.
push
({
code
:
''
,
value
:
''
,
describe
:
''
})
}
payParametersAddListRequests
.
map
(
item
=>
{
for
(
let
key
in
item
)
{
if
(
key
===
name
)
{
item
[
key
]
=
e
.
target
.
value
}
else
{
item
[
name
]
=
e
.
target
.
value
}
}
item
.
type
=
6
;
})
data
[
idx
].
payParametersAddListRequests
=
[...
payParametersAddListRequests
]
console
.
log
(
payParametersAddListRequests
,
10086
)
setPayItem
(
data
)
}
const
options
=
[{
label
:
'是'
,
value
:
1
},
{
label
:
'否'
,
value
:
0
}]
return
(
<
PageHeaderWrapper
extra=
{
hasEdit
?
<
Popconfirm
title=
"配置已修改,是否保存?"
okText=
"是"
cancelText=
"否"
onConfirm=
{
()
=>
handleSubmit
()
}
>
<
Button
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
>
保存
</
Button
>
</
Popconfirm
>
:
<
Button
type=
"primary"
onClick=
{
()
=>
handleSubmit
()
}
icon=
{
<
SaveOutlined
/>
}
>
保存
</
Button
>
}
extra=
{
<
Button
type=
'primary'
onClick=
{
onHnadleSubmit
}
>
保存
</
Button
>
}
>
<
Card
>
<
Tabs
onTabClick=
{
(
e
)
=>
changeTab
(
e
)
}
type=
"card"
>
{
TabList
.
map
((
v
,
i
)
=>
{
return
(
<
Fragment
key=
{
`tab-${i}`
}
>
<
TabPane
tab=
{
`${v.way}`
}
key=
{
v
.
id
}
>
<
Space
size=
{
49
}
>
<
span
>
是否开启
{
v
.
way
}
</
span
>
<
Radio
.
Group
className=
'radio-group-box'
size=
"small"
value=
{
isPitchOn
}
// defaultValue=
{0}
buttonStyle=
"solid"
options=
{
options
}
optionType=
"button"
onChange=
{
value
=>
changeRadio
(
value
)
}
/>
</
Space
>
{
(
v
.
id
===
1
||
v
.
id
===
2
)
&&
<
Row
>
<
Col
><
div
style=
{
{
borderLeft
:
'2px solid #00B37A'
,
margin
:
'41px 0 8px'
,
padding
:
'1px 5px'
}
}
>
{
v
.
way
}
参数配置
</
div
></
Col
>
<
Col
span=
{
24
}
>
<
Table
dataSource=
{
payParametersListResponses
}
columns=
{
tableColumns
}
pagination=
{
false
}
/>
{
v
.
id
==
1
?
<
Button
style=
{
{
marginBottom
:
16
,
marginTop
:
24
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
handleAddMemberBtn
(
`${v.id}`
,
1
)
}
type=
'dashed'
>
新增参数配置
</
Button
>
:
<
Button
style=
{
{
marginBottom
:
16
,
marginTop
:
24
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
handleAddMemberBtn
(
`${v.id}`
,
3
)
}
type=
'dashed'
>
新增参数配置
</
Button
>
}
</
Col
>
</
Row
>
<
Tabs
type=
"card"
>
{
config
.
map
((
item
:
any
,
idx
:
number
)
=>
<
TabPane
tab=
{
item
.
way
}
key=
{
item
.
id
}
forceRender
>
<>
{
payItem
.
length
>
0
&&
<>
<
PayWayRadio
name=
{
payItem
[
idx
].
way
}
value=
{
payItem
[
idx
].
isPitchOn
}
selectId=
{
payItem
[
idx
].
id
}
onChange=
{
(
value
)
=>
onChangeRaido
(
value
,
idx
)
}
/>
{
(
payItem
[
idx
].
id
===
1
||
payItem
[
idx
].
id
===
2
)
&&
<
PayWayTable
id=
{
payItem
[
idx
].
id
}
onType=
{
payItem
[
idx
].
payType
}
name=
{
payItem
[
idx
].
way
}
payParametersList=
{
payItem
[
idx
].
payParametersList
}
payParametersListResponses=
{
payItem
[
idx
].
payParametersAddListRequests
}
visible=
{
!!
payItem
[
idx
].
isPitchOn
}
onGet=
{
(
value
,
t
)
=>
onGet
(
value
,
t
,
idx
)
}
onDel=
{
(
value
,
index
)
=>
onDel
(
value
,
index
,
idx
)
}
onEdit=
{
(
value
,
type
,
index
)
=>
onEdit
(
value
,
type
,
index
,
idx
)
}
/>
}
{
v
.
id
===
1
&&
<
Row
>
<
Col
><
div
style=
{
{
borderLeft
:
'2px solid #00B37A'
,
margin
:
'41px 0 8px'
,
padding
:
'1px 5px'
}
}
>
{
v
.
way
}
转账到银行卡参数配置
</
div
></
Col
>
<
Col
span=
{
24
}
>
<
Table
dataSource=
{
payParametersList
}
columns=
{
tableColumns
}
pagination=
{
false
}
/>
<
Button
style=
{
{
marginBottom
:
16
,
marginTop
:
24
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
handleAddMemberBtn
(
`${v.id}`
,
2
)
}
type=
'dashed'
>
新增参数配置
</
Button
>
</
Col
>
</
Row
>
}
{
(
v
.
id
===
6
&&
isPitchOn
)
&&
(
payItem
[
idx
].
id
===
6
&&
!!
payItem
[
idx
].
isPitchOn
)
&&
<
div
style=
{
{
marginTop
:
42
}
}
>
<
Space
direction=
"horizontal"
size=
{
16
}
>
初始申请额度不超过
<
Input
addonBefore=
"¥"
/>
允许满
<
Input
/>
天后申请上调
<
Input
addonAfter=
"%"
/>
<
Input
onChange=
{
(
e
)
=>
handleBlur
(
e
,
'code'
,
idx
)
}
value=
{
payItem
[
idx
].
payParametersAddListRequests
.
length
>
0
?
payItem
[
idx
].
payParametersAddListRequests
[
0
].
code
:
undefined
}
addonBefore=
"¥"
/>
允许满
<
Input
onChange=
{
(
e
)
=>
handleBlur
(
e
,
'value'
,
idx
)
}
value=
{
payItem
[
idx
].
payParametersAddListRequests
.
length
>
0
?
payItem
[
idx
].
payParametersAddListRequests
[
0
].
value
:
undefined
}
/>
天后申请上调
<
Input
onChange=
{
(
e
)
=>
handleBlur
(
e
,
'describe'
,
idx
)
}
value=
{
payItem
[
idx
].
payParametersAddListRequests
.
length
>
0
?
payItem
[
idx
].
payParametersAddListRequests
[
0
].
describe
:
undefined
}
addonAfter=
"%"
/>
</
Space
>
</
div
>
}
</
TabPane
>
</
Fragment
>
)
})
}
</>
}
</>
</
TabPane
>
)
}
</
Tabs
>
<
SettingModal
mode=
{
mode
}
id=
{
listID
}
type=
{
type
}
dialogVisible=
{
visible
}
initialValues=
{
initialValues
}
onCancel=
{
()
=>
setvisible
(
false
)
}
onOK=
{
(
list
)
=>
handleModalOK
(
list
)
}
/>
</
Card
>
</
PageHeaderWrapper
>
)
}
export
default
Pay
Setting
}
;
export
default
Pay
WaySetTemplate
;
src/pages/ruleSettingManage/payStrategy/index.tsx
View file @
b4b621b1
...
...
@@ -18,11 +18,15 @@ import {FORM_FILTER_PATH} from '@/formSchema/const'
import
{
SaveOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
import
{
strategySearch
}
from
'../schema'
import
{
PublicApi
}
from
'@/services/api'
import
moment
from
'moment'
;
const
formActions
=
createFormActions
()
interface
searchType
{
name
:
string
}
const
List
:
React
.
FC
<
{}
>
=
()
=>
{
const
format
=
(
text
)
=>
{
return
<>
{
moment
(
text
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
}
</>
}
const
ref
=
useRef
<
any
>
({})
const
[
searchParams
,
setsearchParams
]
=
useState
<
searchType
>
({
name
:
''
...
...
@@ -49,6 +53,7 @@ const List: React.FC<{}> = () => {
title
:
'操作时间'
,
dataIndex
:
'operationTime'
,
key
:
'operationTime'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(
format
(
text
)),
align
:
'center'
},
{
...
...
@@ -88,7 +93,7 @@ const List: React.FC<{}> = () => {
)
}
}
]
const
handleModify
=
async
(
record
:
any
)
=>
{
await
PublicApi
.
postPayPaymentPolicyUpdateState
({
...
...
@@ -127,7 +132,7 @@ const List: React.FC<{}> = () => {
layouts
:{
order
:
2
},
children
:
children
:
<
Button
type=
"primary"
onClick=
{
handleToAdd
}
...
...
@@ -160,4 +165,4 @@ const List: React.FC<{}> = () => {
</
Card
>
)
}
export
default
List
\ No newline at end of file
export
default
List
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