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
shenshaokai
jinfa-platform
Commits
04ca069a
Commit
04ca069a
authored
Nov 18, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 去掉PublicApi
parent
20665f90
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
index.tsx
src/components/AddressSelect/index.tsx
+24
-12
No files found.
src/components/AddressSelect/index.tsx
View file @
04ca069a
...
...
@@ -2,19 +2,30 @@
* @Author: XieZhiXiong
* @Date: 2021-08-05 10:28:06
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-
09-17 15:48:16
* @LastEditTime: 2021-
11-18 11:14:29
* @Description: 地址选择 FormItem
*/
import
React
,
{
useState
,
useEffect
,
useMemo
,
useRef
}
from
'react'
;
import
{
Select
,
Button
,
Drawer
,
Divider
,
message
}
from
'antd'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
GetLogisticsShipperAddressGetResponse
,
GetLogisticsReceiverAddressGetResponse
}
from
'@/services/LogisticsApi'
;
import
{
createFormActions
,
FormEffectHooks
,
FormPath
,
}
from
'@formily/antd'
;
import
{
IRequestSuccess
}
from
'@/index'
;
import
{
getLogisticsReceiverAddressGet
,
GetLogisticsReceiverAddressGetResponse
,
getLogisticsSelectListReceiverAddress
,
getLogisticsSelectListShipperAddress
,
getLogisticsShipperAddressGet
,
GetLogisticsShipperAddressGetResponse
,
postLogisticsReceiverAddressAdd
,
postLogisticsReceiverAddressUpdate
,
postLogisticsShipperAddressAdd
,
postLogisticsShipperAddressUpdate
,
}
from
'@/services/LogisticsV2Api'
;
import
{
getManageCountryAreaGetTelCode
,
getManageAreaAll
}
from
'@/services/ManageV2Api'
;
import
{
useLinkEnumEffect
}
from
'@/components/NiceForm/linkages/linkEnum'
;
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
;
import
NiceForm
from
'@/components/NiceForm'
;
...
...
@@ -24,6 +35,7 @@ import { AddressItemType, AddressValueType } from './components/AddressRadioGrou
import
AddressRadioGroup
from
'./components/AddressRadioGroupFormilyItem'
;
import
styles
from
'./index.less'
;
const
formActions
=
createFormActions
();
const
{
onFormInit$
,
...
...
@@ -140,7 +152,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
};
const
getAddressList
=
()
=>
{
const
fetchAction
=
addressType
===
2
?
PublicApi
.
getLogisticsSelectListShipperAddress
()
:
PublicApi
.
getLogisticsSelectListReceiverAddress
();
const
fetchAction
=
addressType
===
2
?
getLogisticsSelectListShipperAddress
()
:
getLogisticsSelectListReceiverAddress
();
fetchAction
.
then
((
res
:
IRequestSuccess
<
AddressItemType
[]
>
)
=>
{
if
(
res
.
code
===
1000
)
{
...
...
@@ -186,7 +198,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
// 获取手机code
const
fetchTelCode
=
async
()
=>
{
const
{
data
,
code
}
=
await
PublicApi
.
getManageCountryAreaGetTelCode
();
const
{
data
,
code
}
=
await
getManageCountryAreaGetTelCode
();
if
(
code
===
1000
)
{
return
data
;
}
...
...
@@ -255,11 +267,11 @@ const AddressSelect: React.FC<IProps> = (props) => {
try
{
setSubmitLoading
(
true
);
const
addRes
=
addressType
===
2
?
await
PublicApi
.
postLogisticsShipperAddressAdd
({
?
await
postLogisticsShipperAddressAdd
({
...
commonPayload
,
shipperName
:
name
,
})
:
await
PublicApi
.
postLogisticsReceiverAddressAdd
({
:
await
postLogisticsReceiverAddressAdd
({
...
commonPayload
,
receiverName
:
name
,
});
...
...
@@ -300,12 +312,12 @@ const AddressSelect: React.FC<IProps> = (props) => {
try
{
setSubmitLoading
(
true
);
const
addRes
=
addressType
===
2
?
await
PublicApi
.
postLogisticsShipperAddressUpdate
({
?
await
postLogisticsShipperAddressUpdate
({
...
commonPayload
,
id
:
editAddressId
.
current
,
shipperName
:
name
,
})
:
await
PublicApi
.
postLogisticsReceiverAddressUpdate
({
:
await
postLogisticsReceiverAddressUpdate
({
...
commonPayload
,
id
:
editAddressId
.
current
,
receiverName
:
name
,
...
...
@@ -383,7 +395,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
FormPath
.
setIn
(
targetState
,
'props.x-props.hasFeedback'
,
true
);
FormPath
.
setIn
(
targetState
,
'loading'
,
true
);
});
const
areaRes
=
await
PublicApi
.
getManageAreaAll
();
const
areaRes
=
await
getManageAreaAll
();
formActions
.
setFieldState
(
'provinceCode'
,
targetState
=>
{
FormPath
.
setIn
(
targetState
,
'loading'
,
false
);
...
...
@@ -424,7 +436,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
FormPath
.
setIn
(
targetState
,
'props.x-props.hasFeedback'
,
true
);
FormPath
.
setIn
(
targetState
,
'loading'
,
true
);
});
const
areaRes
=
await
PublicApi
.
getManageAreaAll
();
const
areaRes
=
await
getManageAreaAll
();
formActions
.
setFieldState
(
'provinceCode'
,
targetState
=>
{
FormPath
.
setIn
(
targetState
,
'loading'
,
false
);
...
...
@@ -442,7 +454,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
value
:
v
.
code
,
})));
});
const
res
=
addressType
===
2
?
await
PublicApi
.
getLogisticsShipperAddressGet
({
id
:
`
${
id
}
`
})
:
await
PublicApi
.
getLogisticsReceiverAddressGet
({
id
:
`
${
id
}
`
});
const
res
=
addressType
===
2
?
await
getLogisticsShipperAddressGet
({
id
:
`
${
id
}
`
})
:
await
getLogisticsReceiverAddressGet
({
id
:
`
${
id
}
`
});
if
(
res
.
code
===
1000
)
{
formActions
.
setFieldValue
(
'name'
,
addressType
===
2
?
(
res
.
data
as
GetLogisticsShipperAddressGetResponse
).
shipperName
:
(
res
.
data
as
GetLogisticsReceiverAddressGetResponse
).
receiverName
);
formActions
.
setFieldValue
(
'provinceCode'
,
res
.
data
.
provinceCode
,
true
);
...
...
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