Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
minio-scs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhaozhenxing
minio-scs
Commits
602953d2
提交
602953d2
authored
8月 11, 2022
作者:
yueyang.lv
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'developer/lyy' 到 'master'
关闭 withCredentials 查看合并请求 minio/saturn-minio-console!4
上级
b76d038f
e7867a9e
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
210 行增加
和
80 行删除
+210
-80
index.tsx
src/screens/Console/Saturn/components/Drawer/index.tsx
+5
-1
index.module.css
...onsole/Saturn/components/DrawerContainer/index.module.css
+2
-1
index.tsx
src/screens/Console/Saturn/components/Form/index.tsx
+4
-0
index.tsx
src/screens/Console/Saturn/components/Modal/index.tsx
+8
-2
index.tsx
...ens/Console/Saturn/components/ValidateCodeInput/index.tsx
+1
-1
index.ts
src/screens/Console/Saturn/constants/index.ts
+22
-0
index.tsx
src/screens/Console/Saturn/pages/Contract/index.tsx
+12
-6
Recharge.tsx
src/screens/Console/Saturn/pages/Cost/Recharge.tsx
+1
-0
index.tsx
src/screens/Console/Saturn/pages/Invoice/index.tsx
+86
-34
Company.tsx
...eens/Console/Saturn/pages/UserInfo/components/Company.tsx
+7
-29
index.ts
src/screens/Console/Saturn/services/index.ts
+20
-2
interface.ts
src/screens/Console/Saturn/services/interface.ts
+28
-3
request.ts
src/screens/Console/Saturn/services/request.ts
+1
-1
index.ts
src/screens/Console/Saturn/utils/index.ts
+13
-0
没有找到文件。
src/screens/Console/Saturn/components/Drawer/index.tsx
浏览文件 @
602953d2
...
...
@@ -16,7 +16,11 @@ export default function SaturnDrawer({
}:
DrawProps
)
{
return
(
<
Drawer
anchor=
{
anchor
}
open=
{
visible
}
onClose=
{
containerProps
.
onCancel
}
>
<
DrawerContainer
width=
{
width
}
{
...
containerProps
}
>
<
DrawerContainer
width=
{
width
}
style=
{
{
height
:
"100%"
}
}
{
...
containerProps
}
>
{
children
}
</
DrawerContainer
>
</
Drawer
>
...
...
src/screens/Console/Saturn/components/DrawerContainer/index.module.css
浏览文件 @
602953d2
.container
{
display
:
flex
;
flex-direction
:
column
;
height
:
100%
;
margin
:
0
auto
;
max-height
:
100%
;
}
.header
{
background-color
:
#fff
;
...
...
@@ -18,6 +18,7 @@
.content
{
flex
:
1
;
overflow-y
:
auto
;
background-color
:
#fff
;
}
...
...
src/screens/Console/Saturn/components/Form/index.tsx
0 → 100644
浏览文件 @
602953d2
import
{
Box
}
from
"@mui/material"
;
export
default
function
Form
()
{
return
<
Box
></
Box
>;
}
src/screens/Console/Saturn/components/Modal/index.tsx
浏览文件 @
602953d2
...
...
@@ -16,8 +16,14 @@ export default function SaturnModal({
onClose=
{
containerProps
.
onCancel
}
closeAfterTransition
>
<
Box
>
<
DrawerContainer
{
...
containerProps
}
>
{
children
}
</
DrawerContainer
>
<
Box
style=
{
{
width
:
"100%"
,
height
:
"100%"
}
}
>
<
DrawerContainer
{
...
containerProps
}
width=
{
width
}
style=
{
{
marginTop
:
50
,
...
containerProps
.
style
}
}
>
{
children
}
</
DrawerContainer
>
</
Box
>
</
Modal
>
);
...
...
src/screens/Console/Saturn/components/ValidateCodeInput/index.tsx
浏览文件 @
602953d2
...
...
@@ -59,7 +59,7 @@ function SendButton({ phone, sendType }: SendButtonProps) {
interface
IProps
extends
SendButtonProps
{
label
?:
string
;
name
?:
string
;
value
:
string
;
value
:
string
|
number
;
onChange
:
(
value
:
React
.
ChangeEvent
<
HTMLInputElement
|
HTMLTextAreaElement
>
)
=>
void
;
...
...
src/screens/Console/Saturn/constants/index.ts
浏览文件 @
602953d2
...
...
@@ -137,3 +137,25 @@ export const V_CODE_SEND = {
}
as
const
;
/** 验证码发送类型枚举 */
export
type
V_CODE_SEND_TYPE
=
TypeOfValue
<
typeof
V_CODE_SEND
>
[
"value"
];
/** 发票类型 */
export
const
INVOICE
=
{
/** 增值税普通发票 */
VAT_NORMAL
:
{
value
:
1
,
cname
:
"增值税普通发票"
,
},
}
as
const
;
/** 发票类型枚举 */
export
type
INVOICE_TYPE
=
TypeOfValue
<
typeof
INVOICE
>
[
"value"
];
/** 发票状态 */
export
const
INVOICE_STATUS
=
{
/** 处理中 */
PENDING
:
{
value
:
1
,
cname
:
"处理中"
,
},
}
as
const
;
/** 发票类型枚举 */
export
type
INVOICE_STATUS_TYPE
=
TypeOfValue
<
typeof
INVOICE_STATUS
>
[
"value"
];
src/screens/Console/Saturn/pages/Contract/index.tsx
浏览文件 @
602953d2
...
...
@@ -16,6 +16,8 @@ import PageLayout from "../../../Common/Layout/PageLayout";
import
PageHeader
from
"../../../Common/PageHeader/PageHeader"
;
import
styles
from
"./index.module.css"
;
import
{
ApplyContractRequestBody
}
from
"../../services/interface"
;
import
{
applyContract
}
from
"../../services"
;
import
message
from
"../../../../../utils/message"
;
const
steps
=
[
{
...
...
@@ -49,8 +51,8 @@ type FormValue = ApplyContractRequestBody;
class
DrawerState
{
visible
:
boolean
=
false
;
form
:
FormValue
=
{
phone
:
""
,
desc
:
""
,
phone
:
0
,
};
}
...
...
@@ -61,15 +63,19 @@ const Contact: React.FC = () => {
setDrawer
((
state
)
=>
({
...
state
,
visible
:
false
}));
};
const
drawerShowHandler
=
()
=>
{
setDrawer
(
(
state
)
=>
({
...
state
,
visible
:
true
})
);
setDrawer
(
{
...
new
DrawerState
(),
visible
:
true
}
);
};
const
submitHandler
=
(
e
:
React
.
FormEvent
<
HTMLFormElement
>
)
=>
{
console
.
log
(
e
);
console
.
log
(
drawer
.
form
);
e
.
preventDefault
();
applyContract
(
drawer
.
form
).
then
((
res
)
=>
{
message
.
success
(
"提交成功"
);
drawerHideHandler
();
});
};
const
updateValueHandler
=
(
key
:
keyof
FormValue
,
value
:
string
)
=>
{
const
updateValueHandler
=
(
key
:
keyof
FormValue
,
value
:
string
|
number
)
=>
{
setDrawer
((
state
)
=>
({
...
state
,
form
:
{
...
...
@@ -159,9 +165,9 @@ const Contact: React.FC = () => {
fullWidth
label=
"联系人手机"
name=
"phone"
value=
{
drawer
.
form
.
phone
}
value=
{
drawer
.
form
.
phone
||
""
}
onChange=
{
(
e
)
=>
{
updateValueHandler
(
"phone"
,
e
.
target
.
value
);
updateValueHandler
(
"phone"
,
Number
(
e
.
target
.
value
)
);
}
}
></
TextField
>
<
TextField
...
...
src/screens/Console/Saturn/pages/Cost/Recharge.tsx
浏览文件 @
602953d2
...
...
@@ -190,6 +190,7 @@ const CostRecharge: React.FC = () => {
visible=
{
offlinePayModal
.
visible
}
onCancel=
{
offlineModalHide
}
title=
"支付中心"
width=
{
700
}
>
<
Typography
>
<
p
>
支付方式: 暂支持转账汇款
</
p
>
...
...
src/screens/Console/Saturn/pages/Invoice/index.tsx
浏览文件 @
602953d2
import
React
,
{
useState
,
useEffect
}
from
"react"
;
import
{
Box
,
Button
,
TextField
,
Alert
}
from
"@mui/material"
;
import
React
,
{
useState
,
useEffect
,
createRef
}
from
"react"
;
import
{
Box
,
Button
,
TextField
,
Alert
,
MenuItem
}
from
"@mui/material"
;
import
{
DataGrid
,
GridColDef
}
from
"@mui/x-data-grid"
;
import
PageLayout
from
"../../../Common/Layout/PageLayout"
;
import
PageHeader
from
"../../../Common/PageHeader/PageHeader"
;
import
Drawer
from
"../../components/Drawer"
;
import
type
{
Pagination
}
from
"../../types"
;
type
TableItem
=
any
;
import
{
applyInvoice
,
getInvoiceList
}
from
"../../services"
;
import
{
ApplyInvoiceRequestBody
,
InvoiceItem
}
from
"../../services/interface"
;
import
{
INVOICE
,
INVOICE_STATUS_TYPE
}
from
"../../constants"
;
import
message
from
"../../../../../utils/message"
;
type
TableItem
=
InvoiceItem
;
type
FormValue
=
ApplyInvoiceRequestBody
;
const
columns
:
GridColDef
<
TableItem
>
[]
=
[
{
field
:
"id"
,
headerName
:
"ID"
,
width
:
220
,
disableColumnMenu
:
true
,
},
{
field
:
"
dat
e"
,
field
:
"
titl
e"
,
headerName
:
"发票抬头"
,
width
:
130
,
disableColumnMenu
:
true
,
sortable
:
false
,
},
{
field
:
"t
ransaction_t
ype"
,
field
:
"type"
,
headerName
:
"发票类型"
,
sortable
:
false
,
width
:
130
,
disableColumnMenu
:
true
,
renderCell
(
params
)
{
return
Object
.
values
(
INVOICE
).
find
((
i
)
=>
i
.
value
===
params
.
value
).
cname
;
},
},
{
field
:
"
transaction_sourc
e"
,
field
:
"
address_nam
e"
,
headerName
:
"收件人姓名"
,
sortable
:
false
,
width
:
130
,
...
...
@@ -37,28 +46,28 @@ const columns: GridColDef<TableItem>[] = [
},
{
field
:
"
transaction_money
"
,
field
:
"
address
"
,
headerName
:
"邮寄地址"
,
sortable
:
false
,
width
:
130
,
disableColumnMenu
:
true
,
},
{
field
:
"
account_balanc
e"
,
field
:
"
phon
e"
,
headerName
:
"联系方式"
,
sortable
:
false
,
//
width: 130,
width
:
130
,
disableColumnMenu
:
true
,
},
{
field
:
"
account_balance1
"
,
field
:
"
desc
"
,
headerName
:
"发票备注"
,
sortable
:
false
,
// width: 130,
disableColumnMenu
:
true
,
},
{
field
:
"
account_balance2
"
,
field
:
"
status
"
,
headerName
:
"状态"
,
sortable
:
false
,
// width: 130,
...
...
@@ -68,8 +77,14 @@ const columns: GridColDef<TableItem>[] = [
class
InvoiceDrawer
{
visible
:
boolean
=
false
;
id
?:
string
;
data
?:
TableItem
;
form
:
FormValue
=
{
title
:
""
,
type
:
INVOICE
.
VAT_NORMAL
.
value
,
address_name
:
""
,
address
:
""
,
phone
:
""
,
desc
:
""
,
};
}
const
Invoice
:
React
.
FC
=
()
=>
{
...
...
@@ -80,12 +95,13 @@ const Invoice: React.FC = () => {
total
:
0
,
});
const
[
list
,
setList
]
=
useState
<
TableItem
[]
>
([]);
const
formRef
=
createRef
<
HTMLFormElement
>
();
const
getList
=
()
=>
{
// getCostList({ ...searchForm,
...pagination }).then((res) => {
//
setList(res.data.list || []);
//
setPagination((state) => ({ ...state, total: res.data.total }));
//
});
getInvoiceList
({
...
pagination
}).
then
((
res
)
=>
{
setList
(
res
.
data
.
list
||
[]);
setPagination
((
state
)
=>
({
...
state
,
total
:
res
.
data
.
total
}));
});
};
useEffect
(()
=>
{
...
...
@@ -96,11 +112,6 @@ const Invoice: React.FC = () => {
setPagination
((
state
)
=>
({
...
state
,
page
:
page
+
1
}));
};
const
commonFormItemProps
:
any
=
{
margin
:
"normal"
,
fullWidth
:
true
,
};
const
drawerHideHandler
=
()
=>
{
setDrawer
(
new
InvoiceDrawer
());
};
...
...
@@ -108,6 +119,39 @@ const Invoice: React.FC = () => {
setDrawer
((
state
)
=>
({
...
state
,
visible
:
true
}));
};
const
createFieldProps
=
(
name
:
keyof
FormValue
):
React
.
ComponentProps
<
typeof
TextField
>
=>
{
return
{
fullWidth
:
true
,
margin
:
"normal"
,
name
,
value
:
drawer
.
form
[
name
],
onChange
:
(
e
)
=>
{
setDrawer
((
state
)
=>
({
...
state
,
form
:
{
...
state
.
form
,
[
name
]:
e
.
target
.
value
,
},
}));
},
};
};
const
submitHandler
=
(
e
:
React
.
FormEvent
)
=>
{
e
.
preventDefault
();
applyInvoice
(
drawer
.
form
).
then
((
res
)
=>
{
message
.
success
(
"提交成功"
);
drawerHideHandler
();
if
(
pagination
.
current
===
1
)
{
getList
();
}
else
{
setPagination
((
state
)
=>
({
...
state
,
current
:
1
}));
}
});
};
return
(
<>
<
PageHeader
label=
"发票管理"
></
PageHeader
>
...
...
@@ -134,45 +178,53 @@ const Invoice: React.FC = () => {
<
Drawer
visible=
{
drawer
.
visible
}
onCancel=
{
drawerHideHandler
}
title=
{
drawer
.
id
?
"修改发票"
:
"申请开票"
}
title=
"申请开票"
onConfirm=
{
()
=>
{
formRef
.
current
.
requestSubmit
();
}
}
>
<
Box
component=
"form"
>
<
Box
component=
"form"
ref=
{
formRef
}
onSubmit=
{
submitHandler
}
>
<
Alert
color=
"warning"
icon=
{
false
}
>
土星云仅提供纸质发票,我们将在收到申请后 7
个工作日内为您开具并用快递邮寄给您。
</
Alert
>
<
TextField
required
label=
"发票抬头"
{
...
c
ommonFormItemProps
}
{
...
c
reateFieldProps
("
title
")
}
></
TextField
>
<
TextField
required
label=
"发票类型"
{
...
c
ommonFormItemProps
}
{
...
c
reateFieldProps
("
type
")
}
select
></
TextField
>
>
{
Object
.
values
(
INVOICE
).
map
((
option
)
=>
(
<
MenuItem
key=
{
option
.
value
}
value=
{
option
.
value
}
>
{
option
.
cname
}
</
MenuItem
>
))
}
</
TextField
>
<
TextField
required
label=
"收件人姓名"
{
...
c
ommonFormItemProps
}
{
...
c
reateFieldProps
("
address_name
")
}
></
TextField
>
<
TextField
required
label=
"邮寄地址"
{
...
c
ommonFormItemProps
}
{
...
c
reateFieldProps
("
address
")
}
></
TextField
>
<
TextField
required
label=
"联系方式"
{
...
c
ommonFormItemProps
}
{
...
c
reateFieldProps
("
phone
")
}
></
TextField
>
<
TextField
required
label=
"发票备注"
{
...
c
ommonFormItemProps
}
{
...
c
reateFieldProps
("
desc
")
}
multiline
minRows=
{
3
}
></
TextField
>
</
Box
>
</
Drawer
>
...
...
src/screens/Console/Saturn/pages/UserInfo/components/Company.tsx
浏览文件 @
602953d2
...
...
@@ -21,8 +21,8 @@ function Company({ userInfo }: IProps) {
legal_person
:
""
,
certificates_url
:
""
,
legal_id_card
:
""
,
legal_phone
:
""
,
code
:
""
,
legal_phone
:
0
,
code
:
0
,
});
const
submitHandler
=
useCallback
(
(
e
:
React
.
FormEvent
<
HTMLFormElement
>
)
=>
{
...
...
@@ -39,7 +39,9 @@ function Company({ userInfo }: IProps) {
[
form
]
);
const
createFieldProps
=
(
name
:
keyof
FormValue
)
=>
{
const
createFieldProps
=
(
name
:
keyof
FormValue
):
React
.
ComponentProps
<
typeof
TextField
>
=>
{
return
{
fullWidth
:
true
,
name
,
...
...
@@ -53,30 +55,6 @@ function Company({ userInfo }: IProps) {
};
};
const
CustomField
=
({
name
,
label
,
required
=
true
,
}:
{
label
;
name
:
keyof
FormValue
;
required
?:
boolean
;
})
=>
(
<
TextField
fullWidth
label=
{
label
}
required=
{
required
}
name=
{
name
}
value=
{
form
[
name
]
}
onChange=
{
(
e
)
=>
{
setForm
((
state
)
=>
({
...
state
,
[
name
]:
e
.
target
.
value
,
}));
}
}
/>
);
return
(
<
Box
component=
"form"
...
...
@@ -147,13 +125,13 @@ function Company({ userInfo }: IProps) {
<
FormControl
fullWidth
required
>
<
ValidateCodeInput
label=
"验证码"
value=
{
form
.
code
}
value=
{
form
.
code
||
""
}
phone=
{
userInfo
?.
phone
||
""
}
sendType=
{
V_CODE_SEND
.
COMPANY_AUTH
.
value
}
onChange=
{
(
e
)
=>
{
setForm
((
state
)
=>
({
...
state
,
code
:
e
.
target
.
value
,
code
:
Number
(
e
.
target
.
value
)
,
}));
}
}
></
ValidateCodeInput
>
...
...
src/screens/Console/Saturn/services/index.ts
浏览文件 @
602953d2
...
...
@@ -13,9 +13,12 @@ import {
PersonalAuthRequestBody
,
CompanyAuthRequestBody
,
ApplyContractRequestBody
,
ApplyInvoiceRequestBody
,
InvoiceItem
,
}
from
"./interface"
;
import
{
Pagination
,
Sort
}
from
"../types"
;
import
{
SORT
}
from
"../constants"
;
import
{
options2Pagination
}
from
"../utils"
;
/** 登陆 */
export
function
userLogin
(
...
...
@@ -49,8 +52,7 @@ export function getCostList(
options
?:
Pagination
&
Sort
):
ResultListPromise
<
CostItem
>
{
return
request
.
post
(
"/api/user/bill/list"
,
{
page
:
options
?.
current
||
1
,
page_size
:
options
?.
pageSize
||
10
,
...
options2Pagination
(
options
),
sort
:
options
?.
sort
||
SORT
.
DESC
.
value
,
});
}
...
...
@@ -87,3 +89,19 @@ export function applyContract(
):
ResultPromise
<
null
>
{
return
request
.
post
(
"/api/user/ApplyForContract"
,
data
);
}
/** 发票申请 */
export
function
applyInvoice
(
data
:
ApplyInvoiceRequestBody
):
ResultPromise
<
null
>
{
return
request
.
post
(
"/api/user/ApplyForInvoice"
,
data
);
}
/** 发票列表 */
export
function
getInvoiceList
(
options
?:
Pagination
):
ResultListPromise
<
InvoiceItem
>
{
return
request
.
post
(
"/api/user/InvoiceList"
,
{
...
options2Pagination
(
options
),
});
}
src/screens/Console/Saturn/services/interface.ts
浏览文件 @
602953d2
...
...
@@ -4,6 +4,8 @@ import {
PERSONAL_CER_TYPE
,
COMPANY_CER_TYPE
,
V_CODE_SEND_TYPE
,
INVOICE_TYPE
,
INVOICE_STATUS_TYPE
,
}
from
"../constants"
;
export
interface
ListResult
<
T
extends
Record
<
string
,
any
>>
{
total
:
number
;
...
...
@@ -110,9 +112,9 @@ export class CompanyAuthRequestBody {
/** 法定代表人身份证号 */
legal_id_card
:
string
;
/** 法定代表人手机号码 */
legal_phone
:
string
;
legal_phone
:
number
;
/** 验证码 */
code
:
string
;
code
:
number
;
}
/** 发送验证码 */
...
...
@@ -126,7 +128,30 @@ export class SendCodeRequestBody {
/** 合同申请 */
export
class
ApplyContractRequestBody
{
/** 手机号 */
phone
:
string
;
phone
:
number
;
/** 备注 */
desc
:
string
;
}
/** 申请发票 */
export
type
ApplyInvoiceRequestBody
=
Omit
<
InvoiceItem
,
"id"
|
"status"
>
;
/** 发票 */
export
interface
InvoiceItem
{
/** 发票 ID */
id
:
string
;
/** 状态 */
status
:
INVOICE_STATUS_TYPE
;
/** 发票抬头 */
title
:
string
;
/** 发票类型 1.增值税普通发票 */
type
:
INVOICE_TYPE
;
/** 收件人姓名 */
address_name
:
string
;
/** 邮寄地址 */
address
:
string
;
/** 联系方式 */
phone
:
string
;
/** 发票备注 */
desc
:
string
;
}
src/screens/Console/Saturn/services/request.ts
浏览文件 @
602953d2
...
...
@@ -51,7 +51,7 @@ class Request {
methods
,
data
,
}:
RequestHandlerOptions
):
SuperAgentRequest
{
let
req
=
superagent
(
methods
,
this
.
formateUrl
(
url
))
.
withCredentials
()
;
let
req
=
superagent
(
methods
,
this
.
formateUrl
(
url
));
if
(
data
)
{
if
(
methods
===
METHOD
.
GET
)
{
...
...
src/screens/Console/Saturn/utils/index.ts
浏览文件 @
602953d2
import
{
SORT
,
SORT_TYPE
,
SORT_CODE_TYPE
}
from
"../constants"
;
import
{
Pagination
}
from
"../types"
;
/** 将 sort 的值 变成 desc / asc */
export
const
sortValue2TypeCode
=
(
sort
:
SORT_TYPE
)
=>
{
...
...
@@ -18,3 +19,15 @@ export function toNewTab(url) {
link
.
click
();
link
.
remove
();
}
interface
Options2PaginationOptions
{
current
?:
Pagination
[
"current"
];
pageSize
?:
Pagination
[
"pageSize"
];
[
key
:
string
]:
any
;
}
export
function
options2Pagination
(
options
?:
Options2PaginationOptions
)
{
return
{
page
:
options
?.
current
??
1
,
page_size
:
options
?.
pageSize
??
10
,
};
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论