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
shenshaokai
jinfa-admin
Commits
d48280b4
Commit
d48280b4
authored
Oct 22, 2020
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对接发票以及对公账号配置
parent
d7d44e14
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
109 additions
and
99 deletions
+109
-99
balancedRoute.ts
config/routes/balancedRoute.ts
+4
-3
bank.png
src/asserts/bank.png
+0
-0
bank_account.png
src/asserts/bank_account.png
+0
-0
company.png
src/asserts/company.png
+0
-0
index.tsx
src/pages/platformSettlement/corporateAccount/index.tsx
+76
-51
index.tsx
src/pages/platformSettlement/receipt/index.tsx
+20
-37
info.tsx
src/pages/platformSettlement/receipt/info.tsx
+6
-7
api.ts
src/services/api.ts
+3
-1
No files found.
config/routes/balancedRoute.ts
View file @
d48280b4
...
...
@@ -26,14 +26,15 @@ const router = {
path
:
'/balanced/receipt/add'
,
name
:
'receiptAdd'
,
component
:
'@/pages/platformSettlement/receipt/info'
,
hidePageHeader
:
true
hidePageHeader
:
true
,
hideInMenu
:
true
,
},
{
path
:
'/balanced/receipt/detail'
,
name
:
'receiptDetail'
,
component
:
'@/pages/platformSettlement/receipt/info'
,
hidePageHeader
:
true
hidePageHeader
:
true
,
hideInMenu
:
true
,
}
]
}
...
...
src/asserts/bank.png
0 → 100644
View file @
d48280b4
2.73 KB
src/asserts/bank_account.png
0 → 100644
View file @
d48280b4
2.22 KB
src/asserts/company.png
0 → 100644
View file @
d48280b4
2.88 KB
src/pages/platformSettlement/corporateAccount/index.tsx
View file @
d48280b4
...
...
@@ -2,10 +2,10 @@ import React, { useState, useEffect } from 'react';
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
styles
from
'./index.less'
import
{
FormOutlined
}
from
'@ant-design/icons'
;
import
{
Button
,
Input
,
Space
}
from
'antd'
;
// import bank from '@/assets/img
s/bank.png';
// import bank_account from '@/assets/img
s/bank_account.png';
// import company from '@/assets/img
s/company.png';
import
{
Button
,
Input
,
Space
,
Popconfirm
}
from
'antd'
;
import
bank
from
'@/assert
s/bank.png'
;
import
bank_account
from
'@/assert
s/bank_account.png'
;
import
company
from
'@/assert
s/company.png'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
getAuth
}
from
'@/utils/auth'
;
import
{
Prompt
}
from
'umi'
...
...
@@ -19,40 +19,10 @@ interface Config {
cacheValue
:
string
,
changeEdit
?:
any
,
pattern
?:
any
,
message
?:
string
message
?:
string
,
dataIndex
:
string
}
const
CONFIGS
:
Config
[]
=
[
{
name
:
'账号名称'
,
image
:
null
,
value
:
''
,
cacheValue
:
''
,
isEdit
:
false
,
canEdit
:
false
},
{
name
:
'银行账号'
,
image
:
null
,
value
:
''
,
cacheValue
:
''
,
isEdit
:
false
,
canEdit
:
true
,
pattern
:
/^
([
1-9
]{1})(\d{14}
|
\d{18})
$/
,
message
:
'请输入正确的银行账号'
},
{
name
:
'开户行'
,
image
:
null
,
value
:
''
,
cacheValue
:
''
,
isEdit
:
false
,
canEdit
:
true
,
pattern
:
/^
[\u
4e00-
\u
9fa5
]{0,50}
|
[
0-9a-zA-Z
]{0,100}
$/
,
message
:
'最多50个汉字'
},
]
const
ItemRender
:
React
.
FC
<
Config
>
=
(
props
)
=>
{
const
{
isEdit
,
name
,
canEdit
,
value
,
image
,
changeEdit
,
pattern
,
message
}
=
props
;
const
[
validError
,
setValidError
]
=
useState
(
false
);
...
...
@@ -101,7 +71,9 @@ const ItemRender: React.FC<Config> = (props) => {
:
<
div
>
<
Space
>
<
Button
type=
"primary"
onClick=
{
()
=>
handleConfirm
(
name
)
}
>
确定
</
Button
>
<
Button
onClick=
{
()
=>
handleCancel
(
name
)
}
>
取消
</
Button
>
<
Popconfirm
title=
"确定取消吗?"
onConfirm=
{
()
=>
handleCancel
(
name
)
}
>
<
Button
>
取消
</
Button
>
</
Popconfirm
>
</
Space
>
</
div
>
:
null
...
...
@@ -114,8 +86,9 @@ const ItemRender: React.FC<Config> = (props) => {
}
const
CorporateAccount
=
()
=>
{
const
[
configs
,
setConfigs
]
=
useState
<
Config
[]
>
(
CONFIGS
);
const
[
unsaved
,
setUnsaved
]
=
useState
<
Boolean
>
(
false
)
const
[
configs
,
setConfigs
]
=
useState
<
Config
[]
>
([]);
const
[
datas
,
setDatas
]
=
useState
<
any
>
({});
const
[
unsaved
,
setUnsaved
]
=
useState
<
boolean
>
(
false
)
const
changeEdit
=
(
name
:
string
,
res
:
any
,
type
:
string
)
=>
{
let
temp
=
[...
configs
];
const
index
=
temp
.
findIndex
((
row
)
=>
row
.
name
===
name
);
...
...
@@ -126,6 +99,8 @@ const CorporateAccount = () => {
...
target
,
...
res
,
}
setConfigs
(
temp
);
}
else
if
(
type
==
'cancel'
)
{
setUnsaved
(
false
);
temp
[
index
]
=
{
...
...
@@ -133,26 +108,76 @@ const CorporateAccount = () => {
...
res
,
value
:
type
==
'cancel'
?
target
.
cacheValue
:
target
.
value
,
}
setConfigs
(
temp
);
}
else
if
(
type
==
'confirm'
)
{
setUnsaved
(
false
);
temp
[
index
]
=
{
...
target
,
...
res
,
cacheValue
:
type
==
'confirm'
?
target
.
value
:
target
.
cacheValue
const
postData
=
{
...
datas
,
[
target
.
dataIndex
]:
target
.
value
}
///settle/accounts/platform/config/updatePlatformAccountConfig
PublicApi
.
postSettleAccountsPlatformConfigUpdatePlatformAccountConfig
(
postData
)
.
then
((
data
)
=>
{
if
(
data
.
code
==
1000
)
{
setDatas
(
postData
);
temp
[
index
]
=
{
...
target
,
...
res
,
cacheValue
:
type
==
'confirm'
?
target
.
value
:
target
.
cacheValue
}
setConfigs
(
temp
);
}
})
}
setConfigs
(
temp
);
}
useEffect
(()
=>
{
const
{
memberId
}
=
getAuth
()
||
{};
// 进行基础赋值, fetchData
// async function fetchData() {
// const res = await PublicApi.getSettleAccountsCorporateAccountConfig({memberId: memberId});
// console.log(res);
// }
// fetchData();
async
function
fetchData
()
{
const
{
data
}
=
await
PublicApi
.
getSettleAccountsPlatformConfigGetPlatformAccountConfig
();
setDatas
(
data
);
setConfigs
(
[
{
name
:
'账号名称'
,
pattern
:
/.+/
,
message
:
'请填写账号名称'
,
dataIndex
:
'name'
,
image
:
company
,
value
:
data
.
name
,
cacheValue
:
data
.
name
,
isEdit
:
false
,
canEdit
:
true
},
{
name
:
'银行账号'
,
dataIndex
:
'bankAccount'
,
image
:
bank_account
,
value
:
data
.
bankAccount
,
cacheValue
:
data
.
bankAccount
,
isEdit
:
false
,
canEdit
:
true
,
pattern
:
/^
([
1-9
]{1})(\d{14}
|
\d{18})
$/
,
message
:
'请输入正确的银行账号'
},
{
name
:
'开户行'
,
dataIndex
:
'bankDeposit'
,
image
:
bank
,
value
:
data
.
bankDeposit
,
cacheValue
:
data
.
bankDeposit
,
isEdit
:
false
,
canEdit
:
true
,
pattern
:
/^
[\u
4e00-
\u
9fa5
]{0,50}
|
[
0-9a-zA-Z
]{0,100}
$/
,
message
:
'最多50个汉字'
},
]
)
}
fetchData
();
},
[])
...
...
src/pages/platformSettlement/receipt/index.tsx
View file @
d48280b4
...
...
@@ -12,30 +12,17 @@ import styles from './index.less';
import
{
history
,
Link
}
from
'umi'
;
import
{
PublicApi
}
from
'@/services/api'
interface
iProps
{
}
enum
Kind
{
common
=
1
,
// 增值税普通发票(默认
special
=
2
// 增值税专用发票
}
enum
ItemIpropType
{
business
=
1
,
//企业
person
=
2
// 个人
}
interface
ReceiptProps
{
id
:
number
,
kind
:
Kind
,
type
:
ItemIpropType
,
kind
Name
:
string
,
type
Name
:
string
,
invoiceTitle
:
string
,
taxNo
:
string
,
bankOfDeposit
:
string
,
account
:
string
,
addres
:
string
,
addres
s
:
string
,
tel
:
string
isDefault
:
number
defaultName
:
string
}
interface
ItemIprops
extends
ReceiptProps
{
...
...
@@ -47,9 +34,9 @@ interface ItemIprops extends ReceiptProps {
* @param props ItemIprops
*/
const
ReceiptItem
:
React
.
FC
<
ItemIprops
>
=
(
props
:
ItemIprops
)
=>
{
const
{
id
,
kind
,
type
,
invoiceTitle
,
taxNo
,
bankOfDeposit
,
account
,
addres
,
tel
,
isDefault
}
=
props
;
const
{
id
,
kind
Name
,
typeName
,
invoiceTitle
,
taxNo
,
bankOfDeposit
,
account
,
address
,
tel
,
defaultName
}
=
props
;
const
handleRouterPush
=
()
=>
{
history
.
push
(
`/balance/receipt/detail?id=
${
id
}
`
);
history
.
push
(
`/balance
d
/receipt/detail?id=
${
id
}
`
);
}
const
handleDelete
=
(
id
:
number
|
string
)
=>
{
props
.
onRemove
(
id
);
...
...
@@ -71,11 +58,11 @@ const ReceiptItem: React.FC<ItemIprops> = (props: ItemIprops) => {
</
div
>
<
Row
className=
{
styles
.
row
}
>
<
Col
span=
{
6
}
>
开具类型
</
Col
>
<
Col
span=
{
18
}
>
{
type
==
1
?
'企业'
:
'个人'
}
</
Col
>
<
Col
span=
{
18
}
>
{
typeName
}
</
Col
>
</
Row
>
<
Row
className=
{
styles
.
row
}
>
<
Col
span=
{
6
}
>
发票种类
</
Col
>
<
Col
span=
{
18
}
>
{
kind
==
1
?
'增值税普通发票'
:
'增值税专用发票'
}
</
Col
>
<
Col
span=
{
18
}
>
{
kind
Name
}
</
Col
>
</
Row
>
<
Row
className=
{
styles
.
row
}
>
<
Col
span=
{
6
}
>
发票抬头
</
Col
>
...
...
@@ -95,7 +82,7 @@ const ReceiptItem: React.FC<ItemIprops> = (props: ItemIprops) => {
</
Row
>
<
Row
className=
{
styles
.
row
}
>
<
Col
span=
{
6
}
>
地址
</
Col
>
<
Col
span=
{
18
}
>
{
addres
}
</
Col
>
<
Col
span=
{
18
}
>
{
addres
s
}
</
Col
>
</
Row
>
<
Row
className=
{
styles
.
row
}
>
<
Col
span=
{
6
}
>
电话
</
Col
>
...
...
@@ -103,7 +90,7 @@ const ReceiptItem: React.FC<ItemIprops> = (props: ItemIprops) => {
</
Row
>
<
Row
>
<
Col
span=
{
6
}
>
是否默认
</
Col
>
<
Col
span=
{
18
}
><
Switch
disabled
checked=
{
isDefault
?
true
:
false
}
/></
Col
>
<
Col
span=
{
18
}
><
Switch
disabled
checked=
{
defaultName
==
'是'
?
true
:
false
}
/></
Col
>
</
Row
>
</
div
>
)
...
...
@@ -113,14 +100,11 @@ const ReceiptItem: React.FC<ItemIprops> = (props: ItemIprops) => {
/**
* 发票列表
*/
const
Receipt
:
React
.
FC
<
iProps
>
=
()
=>
{
const
Receipt
:
React
.
FC
<
{}
>
=
()
=>
{
const
[
list
,
setList
]
=
useState
<
ReceiptProps
[]
>
([]);
const
fetchData
=
async
()
=>
{
// /settle/platform/config/getPlatformInvoiceList
// const { data } = await PublicApi.getSettlePlatformConfigGetPlatformInvoiceList();
// return data;
// PublicApi.getSettlePla
return
[]
const
{
data
}
=
await
PublicApi
.
getSettleAccountsPlatformConfigGetPlatformInvoiceList
();
return
data
;
}
useEffect
(()
=>
{
fetchData
().
then
((
data
)
=>
{
...
...
@@ -129,24 +113,23 @@ const Receipt: React.FC<iProps> = () => {
},
[])
const
handleRouterAdd
=
()
=>
{
history
.
push
(
'/balance/receipt/add'
)
history
.
push
(
'/balance
d
/receipt/add'
)
}
// 删除发票
const
remove
=
async
(
id
:
number
|
string
)
=>
{
console
.
log
(
id
);
// const res = await PublicApi.postSettleAccountsInvoiceMessageDelete({id});
// if(res.code == 1000) {
// const newList = list.filter((item) => item.id !== id);
// setList(newList);
// }
const
res
=
await
PublicApi
.
postSettleAccountsPlatformConfigDeletePlatformInvoice
({
id
:
id
.
toString
()});
if
(
res
.
code
==
1000
)
{
const
newList
=
list
.
filter
((
item
)
=>
item
.
id
!==
id
);
setList
(
newList
);
}
}
return
(
<
div
>
<
Row
gutter=
{
24
}
>
{
list
.
map
((
item
)
=>
{
list
.
map
((
item
:
ReceiptProps
)
=>
{
return
(
<
Col
span=
{
8
}
key=
{
item
.
id
}
className=
{
styles
.
margin
}
>
<
ReceiptItem
onRemove=
{
remove
}
{
...
item
}
/>
...
...
src/pages/platformSettlement/receipt/info.tsx
View file @
d48280b4
...
...
@@ -91,7 +91,7 @@ const schema = {
{
pattern
:
/^
([
1-9
]{1})(\d{14}
|
\d{18})
$/
,
message
:
'请填写正确的银行账号'
}
]
},
addres
:
{
addres
s
:
{
type
:
'text'
,
title
:
'地址'
,
'x-component'
:
'textarea'
,
...
...
@@ -129,10 +129,9 @@ const Info: React.FC = () => {
const
handleSubmit
=
(
value
)
=>
{
console
.
log
(
value
);
// return value;
const
serviceActions
=
isAdd
?
PublicApi
.
postSettleAccounts
InvoiceMessageAdd
:
PublicApi
.
postSettleAccounts
InvoiceMessageUpdat
e
?
PublicApi
.
postSettleAccounts
PlatformConfigAddPlatformInvoice
:
PublicApi
.
postSettleAccounts
PlatformConfigUpdatePlatformInvoic
e
let
tempData
=
{...
value
,
isDefault
:
value
.
isDefault
?
1
:
0
};
const
postData
=
isAdd
?
tempData
:
{...
tempData
,
id
};
...
...
@@ -141,7 +140,7 @@ const Info: React.FC = () => {
serviceActions
(
postData
).
then
((
data
)
=>
{
setSubmitLoading
(
false
);
if
(
data
.
code
===
1000
)
{
history
.
push
(
'/
memberCenter/balance/settleRules/receiptLis
t'
)
history
.
push
(
'/
balanced/receip
t'
)
}
})
}
...
...
@@ -149,7 +148,7 @@ const Info: React.FC = () => {
useEffect
(()
=>
{
if
(
id
)
{
async
function
fetchData
()
{
const
{
data
}
=
await
PublicApi
.
getSettleAccounts
InvoiceMessageDetails
({
id
});
const
{
data
}
=
await
PublicApi
.
getSettleAccounts
PlatformConfigGetPlatformInvoiceDetail
({
id
});
setInitialValue
(
data
)
}
fetchData
()
...
...
@@ -158,7 +157,7 @@ const Info: React.FC = () => {
},
[
id
])
const
handleCancel
=
()
=>
{
history
.
push
(
'/
memberCenter/balance/settleRules/receiptLis
t'
)
history
.
push
(
'/
balanced/receip
t'
)
}
return
(
...
...
src/services/api.ts
View file @
d48280b4
...
...
@@ -6,7 +6,8 @@ import * as ProductApi from './ProductApi'
import
*
as
TemplateApi
from
'./TemplateApi'
import
*
as
PayApi
from
'./PayApi'
import
*
as
SearchApi
from
'./SearchApi'
import
*
as
OrderApi
from
'./OrderApi'
import
*
as
OrderApi
from
'./OrderApi'
;
import
*
as
SettleApi
from
'./SettleApi'
;
/**
* 可在这里写入自定义的接口
...
...
@@ -26,4 +27,5 @@ export const PublicApi = {
...
PayApi
,
...
SearchApi
,
...
OrderApi
,
...
SettleApi
}
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