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
c66800e3
Commit
c66800e3
authored
Aug 21, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://10.0.0.22:3000/lingxi/lingxi-business-paltform
into dev
parents
b83bb669
7eee52fa
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
915 additions
and
97 deletions
+915
-97
index.ts
config/routes/index.ts
+3
-2
logisticsRoutes.ts
config/routes/logisticsRoutes.ts
+7
-0
payandSettle.ts
config/routes/payandSettle.ts
+29
-0
index.js
scripts/services/index.js
+17
-0
index.less
src/components/StandardTable/index.less
+0
-0
index.tsx
src/components/StandardTable/index.tsx
+77
-0
index.ts
src/constants/index.ts
+5
-0
global.d.ts
src/global/config/global.d.ts
+0
-53
global.less
src/global/styles/global.less
+25
-0
menu.ts
src/locales/zh-CN/menu.ts
+6
-1
addressList.tsx
src/pages/logistics/list/components/addressList.tsx
+3
-3
index.tsx
src/pages/member/memberUpgradeRule/index.tsx
+255
-38
index.less
src/pages/payandSettle/components/index.less
+7
-0
settingModal.tsx
src/pages/payandSettle/components/settingModal.tsx
+124
-0
index.tsx
src/pages/payandSettle/paySetting/index.tsx
+357
-0
No files found.
config/routes/index.ts
View file @
c66800e3
...
...
@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-13 14:08:50
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-0
7-18 18:56:08
* @LastEditTime: 2020-0
8-19 15:39:49
*/
import
CommodityRoute
from
'./commodityRoute'
// 商品能力路由
import
MemberRoute
from
'./memberRoute'
// 会员能力路由
...
...
@@ -10,8 +10,9 @@ import ShopRoute from './shopRoute' // 店铺能力路由
import
ChannelRoute
from
'./channelRoute'
// 渠道能力路由
import
TranactionRoute
from
'./tranactionRoute'
// 交易能力路由
import
LogisticsRoute
from
'./logisticsRoutes'
// 物流能力路由
import
PayandSettleRoute
from
'./payandSettle'
//支付与结算
const
routes
=
[
CommodityRoute
,
MemberRoute
,
ShopRoute
,
ChannelRoute
,
TranactionRoute
,
LogisticsRoute
]
const
routes
=
[
CommodityRoute
,
MemberRoute
,
ShopRoute
,
ChannelRoute
,
TranactionRoute
,
PayandSettleRoute
,
LogisticsRoute
]
const
memberCenterRoute
=
{
path
:
'/memberCenter'
,
...
...
config/routes/logisticsRoutes.ts
View file @
c66800e3
/*
* @Author: LeeJiancong
* @Date: 2020-07-13 14:36:02
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-19 15:34:24
*/
/*
* @Author: Ljc
* @Date: 2020-07-10 16:15:28
* @Last Modified by: ljc
...
...
config/routes/payandSettle.ts
0 → 100644
View file @
c66800e3
/*
* @Author: LeeJiancong
* @Date: 2020-08-19 15:33:27
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-20 10:22:11
*/
const
payandSettleRoute
=
{
path
:
'/memberCenter/payandSettle'
,
name
:
'payandSettle'
,
icon
:
'smile'
,
routes
:[
{
path
:
'/memberCenter/payandSettle/paySetting'
,
name
:
'paySetting'
,
key
:
'paySetting'
,
routes
:[
{
path
:
'/memberCenter/payandSettle/paySetting/payParamsSetting'
,
name
:
'payParamsSetting'
,
key
:
'payParamsSetting'
,
component
:
'@/pages/payandSettle/paySetting'
}
]
}
]
}
export
default
payandSettleRoute
\ No newline at end of file
scripts/services/index.js
View file @
c66800e3
/*
* @Author: LeeJiancong
* @Date: 2020-07-17 18:01:43
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-19 17:24:16
*/
/**
* 用于在项目开始前获取所有的配置
* 在项目开始前运行`yarn scripts:build`
...
...
@@ -44,6 +51,14 @@ const serviceConfig = {
// // }
// }
},
//初始化会员支付策略配置
payConfig
:{
paymemberConfig
:{
url
:
'/pay/member/pay/config'
,
method
:
'get'
}
}
}
...
...
@@ -68,6 +83,7 @@ async function batchAxiosHttps() {
// }
// serverFn(asyncHttpQueue)
for
(
const
item
in
serviceConfig
)
{
if
(
JSON
.
stringify
(
item
)
!==
'{}'
){
for
(
const
subItem
in
serviceConfig
[
item
])
{
try
{
const
data
=
await
axios
(
serviceConfig
[
item
][
subItem
])
...
...
@@ -78,6 +94,7 @@ async function batchAxiosHttps() {
}
}
}
}
return
isDemo
?
Object
.
assign
(
asyncHttpQueue
,
await
demoFetch
())
:
asyncHttpQueue
}
...
...
src/components/StandardTable/index.less
0 → 100644
View file @
c66800e3
src/components/StandardTable/index.tsx
0 → 100644
View file @
c66800e3
import
React
from
'react'
;
import
{
Table
}
from
'antd'
;
import
classNames
from
'classnames'
;
import
{
TableProps
,
TablePaginationConfig
,
ColumnType
}
from
'antd/lib/table'
;
import
{
PaginationProps
}
from
'antd/lib/pagination'
;
import
styles
from
'./index.less'
;
export
interface
StandardTableProps
extends
TableProps
<
any
>
{
pagination
:
TablePaginationConfig
;
onPaginationChange
?:
(
page
:
number
,
size
:
number
)
=>
void
;
};
export
default
class
StandardTable
extends
React
.
PureComponent
<
StandardTableProps
>
{
state
=
{
page
:
1
,
size
:
10
,
};
handlePaginationChange
=
(
page
:
number
,
size
:
number
)
=>
{
const
{
pagination
=
{},
onPaginationChange
}
=
this
.
props
;
const
{
current
,
pageSize
}
=
pagination
;
// 内部自己维护 page、size, 单独控制当前页 或 当前页数
if
(
!
(
'current'
in
pagination
))
{
this
.
setState
({
page
:
current
});
}
if
(
!
(
'pageSize'
in
pagination
))
{
this
.
setState
({
size
:
pageSize
});
}
if
(
onPaginationChange
)
{
onPaginationChange
(
page
,
size
);
}
};
render
()
{
const
{
page
,
size
}
=
this
.
state
;
const
{
columns
,
dataSource
,
rowKey
=
'id'
,
pagination
=
{},
loading
,
className
,
onPaginationChange
,
...
restProps
}
=
this
.
props
;
const
newPagination
:
any
=
pagination
?
{
current
:
page
,
pageSize
:
size
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
onChange
:
this
.
handlePaginationChange
,
onShowSizeChange
:
this
.
handlePaginationChange
,
size
:
'small'
,
showTotal
:
()
=>
`共
${
pagination
.
total
||
0
}
条`
,
...
pagination
,
}
:
false
;
return
(
<
div
className=
{
classNames
(
className
)
}
>
<
Table
rowKey=
{
rowKey
}
columns=
{
columns
}
dataSource=
{
dataSource
}
loading=
{
loading
}
pagination=
{
newPagination
}
{
...
restProps
}
/>
</
div
>
)
}
}
\ No newline at end of file
src/constants/index.ts
View file @
c66800e3
...
...
@@ -21,3 +21,8 @@ export const Environment_Status = {
// 1是阿里云oss服务器, 2是本地文件服务器
export
const
UPLOAD_TYPE
=
isDev
?
2
:
1
// 会员规则类型
export
const
VIP_RULE_TRANSACTION
=
1
;
// 交易
export
const
VIP_RULE_LOGIN
=
2
;
// 登录
export
const
VIP_RULE_COMMENT
=
3
;
// 评论
src/global/config/global.d.ts
deleted
100644 → 0
View file @
b83bb669
export
interface
MemberType
{
id
:
number
;
typeName
:
string
;
}
export
interface
BusinessType
{
id
:
number
;
typeName
:
string
;
}
export
interface
UseType
{
memberType
:
MemberType
[];
businessType
:
BusinessType
[];
}
export
interface
UserRegister
{
useType
:
UseType
;
}
export
interface
ShopInfo
{
id
:
number
;
name
:
string
;
type
:
number
;
environment
:
number
;
logoUrl
:
string
;
describe
:
string
;
state
:
number
;
url
:
string
;
}
export
interface
Web
{
shopInfo
:
ShopInfo
[];
}
export
interface
CountryList
{
name
:
string
;
key
:
string
;
icon
:
string
;
}
export
interface
Global
{
siteId
:
number
;
siteUrl
:
string
;
logo
:
string
;
countryList
:
CountryList
[];
}
export
interface
RootObject
{
userRegister
:
UserRegister
;
web
:
Web
;
global
:
Global
;
}
\ No newline at end of file
src/global/styles/global.less
View file @
c66800e3
...
...
@@ -240,3 +240,27 @@ h6 {
}
}
}
// 可编辑表格项公用样式
.editable-cell {
position: relative;
}
.editable-cell-value-wrap {
padding: 5px 12px;
min-height: 32px;
cursor: pointer;
}
.editable-row:hover
.editable-cell-value-wrap {
border: 1px solid #d9d9d9;
border-radius: 4px;
padding: 4px 11px;
}
.editable-row .ant-form-explain {
position: absolute;
font-size: 12px;
margin-top: -4px;
}
\ No newline at end of file
src/locales/zh-CN/menu.ts
View file @
c66800e3
...
...
@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-13 14:08:50
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-0
7-28 11:31:13
* @LastEditTime: 2020-0
8-20 10:22:52
*/
export
default
{
...
...
@@ -115,4 +115,8 @@ export default {
'menu.logisticsAbility.logisticsResult.orderResultSearchList'
:
'物流单查询'
,
'menu.logisticsAbility.logisticsResult.orderResultDeatil'
:
'物流单详情'
,
'menu.logisticsAbility.logisticsResult.toOrderComfirmList'
:
'待确认物流单'
,
'menu.payandSettle'
:
'支付'
,
'menu.payandSettle.paySetting'
:
'支付方式管理'
,
'menu.payandSettle.paySetting.payParamsSetting'
:
'会员支付参数配置'
,
};
\ No newline at end of file
src/pages/logistics/list/components/addressList.tsx
View file @
c66800e3
...
...
@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-
19 10:53:33
* @LastEditTime: 2020-08-
20 16:45:16
*/
import
React
,
{
Component
,
ReactNode
,
useRef
,
useState
}
from
'react'
import
{
history
}
from
'umi'
...
...
@@ -122,7 +122,7 @@ const AddressList: React.FC<ListProps> = (props) => {
const
[
table
,
setTable
]
=
useState
([])
const
[
editingKey
,
setEditingKey
]
=
useState
(
''
);
const
toEdit
=
(
id
:
number
)
=>
{
history
.
push
(
`/memberCenter/logisticsAbility/logistics/addressForm?type=
${
props
.
type
}
&id=
${
id
}
`
)
history
.
push
(
`/memberCenter/logisticsAbility/logistics/addressForm?
page_
type=
${
props
.
type
}
&id=
${
id
}
`
)
};
const
columns
:
ColumnType
<
any
>
[]
=
[
{
...
...
@@ -280,7 +280,7 @@ const AddressList: React.FC<ListProps> = (props) => {
formilyChilds=
{
{
children
:
(
<>
<
Button
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
history
.
push
(
`/memberCenter/logisticsAbility/logistics/addressForm?type=${props.type}&id=0`
)
}
>
新建
</
Button
>
<
Button
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
history
.
push
(
`/memberCenter/logisticsAbility/logistics/addressForm?
page_
type=${props.type}&id=0`
)
}
>
新建
</
Button
>
</>
)
}
}
...
...
src/pages/member/memberUpgradeRule/index.tsx
View file @
c66800e3
import
React
,
{
useState
,
useRef
,
ReactNode
}
from
'react'
;
import
{
history
}
from
'umi'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
Card
,
Input
,
Button
}
from
'antd'
;
import
{
ContainerOutlined
}
from
'@ant-design/icons'
;
import
{
StandardTable
}
from
'god'
;
import
React
,
{
useContext
,
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Card
,
Input
,
Button
,
Form
,
message
,
}
from
'antd'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
VIP_RULE_TRANSACTION
,
VIP_RULE_LOGIN
,
VIP_RULE_COMMENT
}
from
'@/constants'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
ContainerOutlined
}
from
'@ant-design/icons'
;
import
StandardTable
from
'@/components/StandardTable'
;
const
fetchData
=
async
(
params
:
any
)
=>
{
const
res
=
await
PublicApi
.
getMemberManageLevelRulePage
(
params
);
return
res
.
data
;
const
EditableContext
=
React
.
createContext
<
any
>
({});
interface
EditableRowProps
{
index
:
number
;
}
const
EditableRow
:
React
.
FC
<
EditableRowProps
>
=
({
index
,
...
props
})
=>
{
const
[
form
]
=
Form
.
useForm
();
return
(
<
Form
form=
{
form
}
component=
{
false
}
>
<
EditableContext
.
Provider
value=
{
form
}
>
<
tr
{
...
props
}
/>
</
EditableContext
.
Provider
>
</
Form
>
);
};
interface
EditableCellProps
{
title
:
React
.
ReactNode
;
editable
:
boolean
;
children
:
React
.
ReactNode
;
dataIndex
:
string
;
index
:
number
;
record
:
any
;
rules
:
any
;
handleSave
:
(
record
:
any
)
=>
void
;
addonAfter
:
React
.
ReactNode
,
}
const
EditableCell
:
React
.
FC
<
EditableCellProps
>
=
({
title
,
editable
,
children
,
dataIndex
,
index
,
record
,
rules
=
[],
addonAfter
=
null
,
handleSave
,
...
restProps
})
=>
{
const
[
editing
,
setEditing
]
=
useState
(
true
);
const
inputRef
=
useRef
();
const
form
=
useContext
(
EditableContext
);
const
inputId
=
`
${
dataIndex
}
-
${
index
}
`
;
// 拼接 name-index,不然全部展示输入框会警告 id 不唯一的问题
useEffect
(()
=>
{
if
(
editing
)
{
// inputRef.current.focus();
}
},
[
editing
]);
const
toggleEdit
=
()
=>
{
setEditing
(
!
editing
);
form
.
setFieldsValue
({
[
dataIndex
]:
record
[
dataIndex
]
});
};
const
save
=
async
e
=>
{
try
{
const
values
=
await
form
.
validateFields
();
// toggleEdit();
handleSave
({
...
record
,
[
dataIndex
]:
values
[
inputId
],
});
}
catch
(
errInfo
)
{
console
.
log
(
'Save failed:'
,
errInfo
);
}
};
let
childNode
=
children
;
if
(
editable
)
{
childNode
=
editing
?
(
<
Form
.
Item
style=
{
{
margin
:
0
}
}
name=
{
inputId
}
rules=
{
rules
}
initialValue=
{
record
[
dataIndex
]
}
>
<
Input
ref=
{
inputRef
}
onPressEnter=
{
save
}
onBlur=
{
save
}
addonAfter=
{
addonAfter
}
/>
</
Form
.
Item
>
)
:
(
<
div
className=
"editable-cell-value-wrap"
style=
{
{
paddingRight
:
24
}
}
onClick=
{
toggleEdit
}
>
{
children
}
</
div
>
);
}
return
<
td
{
...
restProps
}
>
{
childNode
}
</
td
>;
};
interface
Columns
extends
ColumnType
<
any
>
{
editable
?:
boolean
;
rules
?:
Array
<
any
>
;
}
const
MemberUpgradeRule
:
React
.
FC
<
[]
>
=
()
=>
{
const
ref
=
useRef
({});
const
columns
:
ColumnType
<
any
>
[]
=
[
const
[
page
,
setPage
]
=
useState
(
1
);
const
[
size
,
setSize
]
=
useState
(
10
);
const
[
total
,
setTotal
]
=
useState
(
0
);
const
[
dataSource
,
setDataSource
]
=
useState
([]);
const
[
listLoading
,
setListLoading
]
=
useState
(
true
);
const
[
submitLoading
,
setSubmitLoading
]
=
useState
(
false
);
const
getRuleList
=
async
(
params
)
=>
{
setListLoading
(
true
);
const
res
=
await
PublicApi
.
getMemberManageLevelRulePage
(
params
);
if
(
res
.
code
===
1000
)
{
const
{
data
,
totalCount
}
=
res
.
data
;
setDataSource
(
data
);
setTotal
(
totalCount
);
}
setListLoading
(
false
);
};
useEffect
(()
=>
{
getRuleList
({
current
:
page
,
pageSize
:
size
,
});
},
[
page
,
size
]);
const
columns
:
Columns
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
key
:
'id'
,
},
{
title
:
'项目'
,
dataIndex
:
'ruleName'
,
align
:
'center'
,
key
:
'ruleName'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
span
>
{
text
}
</
span
>,
},
{
title
:
'项目说明'
,
dataIndex
:
'remark'
,
align
:
'center'
,
key
:
'remark'
,
},
{
title
:
'可获取的分值'
,
dataIndex
:
'point'
,
align
:
'center'
,
key
:
'point'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
let
component
:
ReactNode
=
null
;
component
=
record
.
id
===
1
?
(
<
Input
addonAfter=
"%"
value=
{
record
.
point
}
onChange=
{
e
=>
{
e
.
preventDefault
();
record
.
point
=
e
.
target
.
value
;
}
}
/>
)
:
(
<
Input
value=
{
record
.
point
}
/>
);
return
component
;
},
width
:
'30%'
,
editable
:
true
,
},
];
const
handleSubmit
=
()
=>
{};
const
handlePaginationChange
=
(
page
:
number
,
size
:
number
)
=>
{
setPage
(
page
);
setSize
(
size
);
};
// 重新保存 dataSource
const
handleSave
=
row
=>
{
const
newData
=
[...
dataSource
];
const
index
=
newData
.
findIndex
(
item
=>
item
.
id
===
row
.
id
);
const
item
=
newData
[
index
];
newData
.
splice
(
index
,
1
,
{
...
item
,
...
row
,
point
:
+
row
.
point
,
});
setDataSource
(
newData
);
};
const
handleSubmit
=
async
()
=>
{
if
(
!
dataSource
.
length
)
{
return
;
}
const
payload
=
dataSource
.
map
(
item
=>
({
id
:
item
.
id
,
point
:
item
.
point
,
}));
setSubmitLoading
(
true
);
const
res
=
await
PublicApi
.
postMemberManageLevelRuleSetpoint
(
payload
);
if
(
res
.
code
===
1000
)
{
message
.
success
(
'保存成功'
);
getRuleList
({
current
:
page
,
pageSize
:
size
,
});
}
setSubmitLoading
(
false
);
};
const
components
=
{
body
:
{
row
:
EditableRow
,
cell
:
EditableCell
,
},
};
const
rulesMap
=
{
[
VIP_RULE_TRANSACTION
]:
[
{
pattern
:
/^
([
0
]
|
[
1-9
]
+
[
0-9
]
*
)(\.[
0-9
]
+
)?
$/
,
message
:
'请输入正确的格式'
,
},
],
[
VIP_RULE_LOGIN
]:
[
{
pattern
:
/^
[
0
]
$|^
[
1-9
]
+
[
0-9
]
*$/
,
message
:
'请输入正确的格式'
,
},
],
[
VIP_RULE_COMMENT
]:
[
{
pattern
:
/^
[
0
]
$|^
[
1-9
]
+
[
0-9
]
*$/
,
message
:
'请输入正确的格式'
,
},
],
};
const
newColumns
:
any
=
columns
.
map
(
col
=>
{
if
(
!
col
.
editable
)
{
return
col
;
}
return
{
...
col
,
onCell
:
(
record
,
index
)
=>
({
handleSave
,
record
,
index
,
dataIndex
:
col
.
dataIndex
,
title
:
col
.
title
,
editable
:
col
.
editable
||
false
,
rules
:
[
{
required
:
true
,
message
:
'请输入相应值'
,
},
...(
rulesMap
[
record
.
ruleTypeEnum
]
||
[]),
],
addonAfter
:
record
.
ruleTypeEnum
===
VIP_RULE_TRANSACTION
?
'%'
:
null
,
}),
};
});
return
(
<
PageHeaderWrapper
...
...
@@ -68,6 +272,7 @@ const MemberUpgradeRule: React.FC<[]> = () => {
<
Button
type=
"primary"
icon=
{
<
ContainerOutlined
/>
}
loading=
{
submitLoading
}
onClick=
{
handleSubmit
}
>
保存
...
...
@@ -75,11 +280,23 @@ const MemberUpgradeRule: React.FC<[]> = () => {
}
>
<
Card
>
<
div
className=
"editable-row"
>
<
div
className=
"ant-form-explain"
>
123
</
div
>
</
div
>
<
StandardTable
tableProps=
{
{
rowKey
:
'id'
}
}
columns=
{
columns
}
currentRef=
{
ref
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
dataSource=
{
dataSource
}
columns=
{
newColumns
}
components=
{
components
}
rowClassName=
{
()
=>
'editable-row'
}
loading=
{
listLoading
}
pagination=
{
{
pageSize
:
size
,
total
,
}
}
onPaginationChange=
{
handlePaginationChange
}
/>
</
Card
>
</
PageHeaderWrapper
>
...
...
src/pages/payandSettle/components/index.less
0 → 100644
View file @
c66800e3
.radio-group-box {
.ant-radio-button-wrapper {
width: 80px;
text-align: center;
}
}
\ No newline at end of file
src/pages/payandSettle/components/settingModal.tsx
0 → 100644
View file @
c66800e3
import
React
,
{
Component
,
useState
,
useEffect
}
from
'react'
;
import
{
Modal
,
Button
,
Form
,
Radio
}
from
'antd'
import
{
SchemaForm
,
SchemaMarkupField
as
Field
,
createFormActions
,
FormEffectHooks
}
from
'@formily/antd'
import
{
Input
,
FormMegaLayout
}
from
'@formily/antd-components'
import
{
PublicApi
}
from
'@/services/api'
export
interface
Params
{
id
?:
any
,
mode
:
number
,
type
?:
number
|
string
,
dialogVisible
:
boolean
;
onCancel
:
Function
;
onOK
?:
Function
;
initialValues
?:
any
;
dontReceive
?:
boolean
;
//默认展示
}
const
actions
=
createFormActions
()
const
{
onFieldChange$
}
=
FormEffectHooks
const
comfirmDialog
:
React
.
FC
<
Params
>
=
(
props
)
=>
{
const
handleCancel
=
()
=>
{
}
const
handletOk
=
(
values
:
any
)
=>
{
let
value
=
{
...
values
}
if
(
props
.
type
){
value
.
type
=
props
.
type
}
console
.
log
(
'列表'
,
value
)
props
.
onOK
(
value
)
}
useEffect
(()
=>
{
return
()
=>
{
}
},
[])
const
useFormEffects
=
()
=>
{
const
{
setFieldState
}
=
createFormActions
()
}
return
(
<>
<
Modal
title=
{
props
.
mode
===
0
?
'新增参数配置'
:
'编辑参数配置'
}
width=
{
800
}
visible=
{
props
.
dialogVisible
}
onOk=
{
()
=>
actions
.
submit
()
}
onCancel=
{
()
=>
props
.
onCancel
()
}
destroyOnClose
afterClose=
{
()
=>
actions
.
reset
()
}
okText=
{
`确定`
}
cancelText=
'取消'
>
<
SchemaForm
labelCol=
{
3
}
components=
{
{
Input
,
Radio
:
Radio
.
Group
,
TextArea
:
Input
.
TextArea
}
}
actions=
{
actions
}
effects=
{
()
=>
useFormEffects
()
}
onSubmit=
{
(
values
)
=>
handletOk
(
values
)
}
initialValues=
{
props
.
initialValues
}
>
<
Field
name=
'code'
title=
'参数代码'
required
x
-
component
-
props=
{
{
placeholder
:
''
,
}
}
x
-
component=
"Input"
/>
<>
<
Field
title=
'参数值'
name=
"value"
x
-
component=
"Input"
required
x
-
component
-
props=
{
{
placeholder
:
''
,
// addonBefore: ' '
}
}
x
-
rules=
{
{
message
:
''
}
}
/>
{
/* <FormMegaLayout name='remarkOption' label='不接受原因' full required labelCol={2} labelAlign="top"> */
}
<
Field
title=
'参数描述'
name=
"describe"
x
-
component=
"TextArea"
x
-
component
-
props=
{
{
placeholder
:
'最长128个字符'
}
}
x
-
rules=
{
{
max
:
128
,
// maximum:10,//最大数值
// message: '参数描述最多128个汉字'
}
}
/>
</>
</
SchemaForm
>
</
Modal
>
</>
)
}
comfirmDialog
.
defaultProps
=
{
dontReceive
:
true
,
type
:
1
//1.支付宝 2.支付宝转账到银行卡参数配置 3.微信
}
export
default
comfirmDialog
\ No newline at end of file
src/pages/payandSettle/paySetting/index.tsx
0 → 100644
View file @
c66800e3
/*
* @Author: LeeJiancong
* @Date: 2020-08-13 09:50:41
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-20 16:04:56
*/
import
React
,
{
useEffect
,
useState
,
useRef
}
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
SettingModal
from
'../components/settingModal'
import
{
PublicApi
}
from
'@/services/api'
import
{
history
}
from
'umi'
import
'../components/index.less'
const
payActions
=
createFormActions
()
const
{
TabPane
}
=
Tabs
const
{
onFieldValueChange$
}
=
FormEffectHooks
const
PaySetting
:
React
.
FC
<
{}
>
=
()
=>
{
const
ref
=
useRef
<
any
>
({})
const
[
TabList
,
setTabList
]
=
useState
([])
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
)
const
[
showInput
,
setshowInput
]
=
useState
(
true
)
const
[
initParam
,
setinitParam
]
=
useState
({
//授权参数
code
:
''
,
value
:
''
,
describe
:
''
})
let
[
tabid
,
settabid
]
=
useState
<
any
>
(
null
)
//选项卡id
const
[
listID
,
setlistID
]
=
useState
(
null
)
//表格id
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
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
)
}
else
if
(
type
===
2
)
{
list
=
[...
payParametersList
]
list
.
splice
(
index
,
1
)
setpayParametersList
(
list
)
}
sethasEdit
(
true
)
}
/**
* @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
.
id
=
`obj-
${
payParametersListResponses
.
length
}
`
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
)
}
}
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
)
}
}
}
// 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
tableColumns
:
ColumnType
<
any
>
[]
=
[
{
dataIndex
:
'code'
,
title
:
'参数代码'
,
align
:
'center'
},
{
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
initBase
=
(
id
)
=>
{
PublicApi
.
getPayMemberQueryPlatformIsStart
({
id
:
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
let
data
=
{
payParametersListResponses
:[],
payParametersList
:[],
isPitchOn
:
0
,
id
:
''
}
if
(
JSON
.
stringify
(
res
.
data
)
!==
'{}'
){
console
.
log
(
'加载到'
)
let
{
id
,
isPitchOn
,
payParametersList
,
payParametersListResponses
}
=
res
.
data
setisPitchOn
(
isPitchOn
)
if
(
id
==
6
){
}
else
{
payParametersList
=
payParametersList
?
payParametersList
:
[]
payParametersListResponses
=
payParametersListResponses
?
payParametersListResponses
:
[]
setpayParametersList
(
payParametersList
)
setpayParametersListResponses
(
payParametersListResponses
)
}
}
}
})
}
useEffect
(()
=>
{
PublicApi
.
getPayMemberPayConfig
().
then
(
res
=>
{
if
(
res
.
code
===
1000
){
let
ids
=
res
.
data
.
map
((
v
,
i
)
=>
v
.
id
)
setTabList
(
res
.
data
)
if
(
ids
.
length
>
0
){
settabid
(
ids
[
0
])
initBase
(
ids
[
0
])
}
}
})
// 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
useTabEffects
=
()
=>
{
}
//提交表单
const
handleSubmit
=
()
=>
{
let
list
:
any
=
[]
if
(
tabid
==
1
)
{
list
=
[...
payParametersList
,
...
payParametersListResponses
]
}
else
if
(
tabid
==
2
)
{
list
=
[...
payParametersListResponses
]
}
else
if
(
tabid
==
6
){
list
=
[{
code
:
initParam
.
code
,
value
:
initParam
.
value
,
describe
:
initParam
.
describe
}]
}
else
{
list
=
[]
}
let
payType
=
TabList
.
filter
(
v
=>
v
.
id
==
tabid
).
map
(
v
=>
v
.
payType
)
let
way
:
any
=
TabList
.
filter
(
v
=>
v
.
id
==
tabid
).
map
(
v
=>
v
.
way
)
// if(list.length > 0){
// list.forEach((v:any) => {
// if((v.id).toString().indexOf('obj') !== -1){
// v.id = ''
// }
// });
// }
console
.
log
(
'list'
,
list
)
PublicApi
.
postPayMemberQueryPlatformUpdate
({
id
:
tabid
,
isPitchOn
:
isPitchOn
,
way
:
way
.
toString
(),
payType
:
Number
(
payType
)
,
payParametersAddListRequests
:
list
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setTimeout
(()
=>
{
history
.
push
(
'/memberCenter/home'
)
},
1500
)
}
})
}
const
changeTab
=
(
tab
)
=>
{
settabid
(
tab
)
initBase
(
tab
)
}
const
changeRadio
=
(
e
)
=>
{
setisPitchOn
(
e
.
target
.
value
)
if
(
tabid
==
6
&&
e
.
target
.
value
){
setshowInput
(
true
)
}
else
{
setshowInput
(
false
)
}
}
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
>
}
>
<
Card
>
<
Tabs
onTabClick=
{
(
e
)
=>
changeTab
(
e
)
}
type=
"card"
>
{
TabList
.
map
((
v
,
i
)
=>
{
return
<>
<
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
>
}
{
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
&&
showInput
)
&&
<
div
style=
{
{
marginTop
:
42
}
}
>
<
Space
direction=
"horizontal"
size=
{
16
}
>
初始申请额度不超过
<
Input
value=
{
initParam
.
code
}
addonBefore=
"¥"
onChange=
{
e
=>
setinitParam
({...
initParam
,
code
:
e
.
target
.
value
})
}
/>
允许满
<
Input
value=
{
initParam
.
value
}
onChange=
{
e
=>
setinitParam
({...
initParam
,
value
:
e
.
target
.
value
})
}
/>
天后申请上调
<
Input
value=
{
initParam
.
describe
}
addonAfter=
"%"
onChange=
{
e
=>
setinitParam
({...
initParam
,
describe
:
e
.
target
.
value
})
}
/>
</
Space
>
</
div
>
}
</
TabPane
>
</>
})
}
</
Tabs
>
<
SettingModal
mode=
{
mode
}
id=
{
listID
}
type=
{
type
}
dialogVisible=
{
visible
}
initialValues=
{
initialValues
}
onCancel=
{
()
=>
setvisible
(
false
)
}
onOK=
{
(
list
)
=>
handleModalOK
(
list
)
}
/>
</
Card
>
</
PageHeaderWrapper
>
)
}
export
default
PaySetting
\ No newline at end of file
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