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
linweijiong
jinfa-platform
Commits
da7ccfcf
Commit
da7ccfcf
authored
Nov 25, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix;修改订单结算新增个人类型发票填写项问题
parent
3fb09f60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
10 deletions
+30
-10
index.tsx
src/pages/lxMall/order/components/addInvoice/index.tsx
+27
-3
index.tsx
src/pages/lxMall/order/invoice/index.tsx
+3
-7
No files found.
src/pages/lxMall/order/components/addInvoice/index.tsx
View file @
da7ccfcf
...
...
@@ -4,6 +4,8 @@ import {
SchemaForm
,
SchemaMarkupField
as
Field
,
createAsyncFormActions
,
FormEffectHooks
,
createFormActions
}
from
'@formily/antd'
import
{
Input
,
Switch
,
Select
,
FormMegaLayout
,
Radio
}
from
'@formily/antd-components'
import
styles
from
'./index.less'
...
...
@@ -33,6 +35,9 @@ const AddInvoice: React.FC<AddAddressPropsType> = (props) => {
const
{
visible
=
false
,
title
,
onOk
,
onCancel
,
editItem
,
type
}
=
props
const
[
state
,
setState
]
=
useState
({
editable
:
true
})
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
<
boolean
>
(
false
)
const
[
invoiceTitle
,
setInvoiceTitle
]
=
useState
<
string
>
(
"发票抬头"
)
const
[
invoiceTitleTip
,
setInvoiceTitleTip
]
=
useState
<
string
>
(
"请输入发票抬头"
)
const
[
taxNoRequired
,
setTaxNoRequired
]
=
useState
<
boolean
>
(
true
)
/**
* @description: Form保存
...
...
@@ -65,6 +70,22 @@ const AddInvoice: React.FC<AddAddressPropsType> = (props) => {
actions
.
submit
()
}
const
{
onFieldValueChange$
}
=
FormEffectHooks
const
useTypeEffects
=
()
=>
{
onFieldValueChange$
(
'type'
).
subscribe
(({
value
})
=>
{
if
(
value
===
1
)
{
setInvoiceTitle
(
"发票抬头"
)
setInvoiceTitleTip
(
"请输入发票抬头"
)
setTaxNoRequired
(
true
)
}
else
{
setInvoiceTitle
(
"名称"
)
setInvoiceTitleTip
(
"请输入名称"
)
setTaxNoRequired
(
false
)
}
})
}
return
visible
&&
(
<
Modal
title=
{
title
}
...
...
@@ -79,6 +100,9 @@ const AddInvoice: React.FC<AddAddressPropsType> = (props) => {
>
<
SchemaForm
editable=
{
state
.
editable
}
actions=
{
actions
}
// 要传递
effects=
{
()
=>
{
useTypeEffects
()
}
}
initialValues=
{
type
===
'edit'
?
editItem
:
{
type
:
1
,
kind
:
1
...
...
@@ -114,9 +138,9 @@ const AddInvoice: React.FC<AddAddressPropsType> = (props) => {
<
Field
x
-
rules=
{
{
required
:
true
,
message
:
'请输入发票抬头'
,
message
:
invoiceTitleTip
,
}
}
title=
"发票抬头"
title=
{
invoiceTitle
}
name=
"invoiceTitle"
maxLength=
{
40
}
x
-
component=
"Input"
...
...
@@ -126,7 +150,7 @@ const AddInvoice: React.FC<AddAddressPropsType> = (props) => {
/>
<
Field
x
-
rules=
{
{
required
:
t
rue
,
required
:
t
axNoRequired
,
message
:
'请输入纳税号'
,
}
}
title=
"纳税号"
...
...
src/pages/lxMall/order/invoice/index.tsx
View file @
da7ccfcf
...
...
@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'
import
{
Checkbox
,
Radio
,
Modal
}
from
'antd'
import
AddInvoice
from
'../components/addInvoice'
import
{
PublicApi
}
from
'@/services/api'
import
{
getAuth
}
from
'@/utils/auth'
;
import
{
GetSettleAccountsInvoiceMessageListResponse
}
from
'@/services/SettleApi'
import
cx
from
'classnames'
import
styles
from
'./index.less'
...
...
@@ -26,8 +25,6 @@ const Invoice: React.FC<InvoicePropsType> = (props) => {
},
[])
const
fetchInvoiceList
=
(
init
=
false
)
=>
{
const
{
memberId
}
=
getAuth
()
||
{}
//@ts-ignore
PublicApi
.
getSettleAccountsInvoiceMessageList
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setInvoiceList
(
res
.
data
)
...
...
@@ -40,7 +37,7 @@ const Invoice: React.FC<InvoicePropsType> = (props) => {
const
initDefaultInvoice
=
(
data
:
GetSettleAccountsInvoiceMessageListResponse
)
=>
{
let
selectItem
for
(
le
t
item
of
data
)
{
for
(
cons
t
item
of
data
)
{
if
(
item
.
isDefault
===
1
)
{
selectItem
=
item
}
...
...
@@ -54,7 +51,7 @@ const Invoice: React.FC<InvoicePropsType> = (props) => {
const
handleSelect
=
(
e
:
any
)
=>
{
setSelectKey
(
e
.
target
.
value
)
let
selectItem
for
(
le
t
item
of
invoiceList
)
{
for
(
cons
t
item
of
invoiceList
)
{
if
(
item
.
id
===
e
.
target
.
value
)
{
selectItem
=
item
}
...
...
@@ -98,9 +95,8 @@ const Invoice: React.FC<InvoicePropsType> = (props) => {
* @param item
*/
const
handleSetDefault
=
(
item
)
=>
{
le
t
param
=
item
cons
t
param
=
item
param
.
isDefault
=
1
//@ts-ignore
PublicApi
.
postSettleAccountsInvoiceMessageUpdate
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
fetchInvoiceList
()
...
...
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