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
30100405
Commit
30100405
authored
Jan 21, 2021
by
XieZhiXiong
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
da292250
935fef95
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
50 deletions
+40
-50
index.tsx
src/pages/lxMall/order/address/index.tsx
+1
-1
index.tsx
src/pages/lxMall/order/components/addAddress/index.tsx
+39
-49
No files found.
src/pages/lxMall/order/address/index.tsx
View file @
30100405
...
...
@@ -79,7 +79,7 @@ const Address: React.FC<AddressPropsType> = (props) => {
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
postLogisticsReceiverAddressDelete
({
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
()
resolve
(
true
)
fetchAddressList
()
}
}).
catch
(()
=>
{
...
...
src/pages/lxMall/order/components/addAddress/index.tsx
View file @
30100405
...
...
@@ -11,19 +11,9 @@ import { Input, Switch, Select, FormMegaLayout } from '@formily/antd-components'
import
{
PublicApi
}
from
'@/services/api'
import
{
PATTERN_MAPS
}
from
'@/constants/regExp'
import
{
GetLogisticsReceiverAddressPageResponseDetail
,
postLogisticsReceiverAddressUpdate
}
from
'@/services/LogisticsApi'
import
ChinaImg
from
'../../../../../../mockStatic/china.png'
import
japenImg
from
'../../../../../../mockStatic/japen.png'
import
korenImg
from
'../../../../../../mockStatic/koren.png'
import
us
from
'../../../../../../mockStatic/us.png'
import
styles
from
'./index.less'
import
{
isEmpty
}
from
'lodash'
const
_width
:
number
=
24
const
_height
:
number
=
17
interface
countryItem
{
name
:
string
,
key
:
string
,
icon
:
string
}
//列表带来的参数
export
interface
ListProps
{
title
?:
React
.
ReactNode
...
...
@@ -50,24 +40,19 @@ const AddAddress: React.FC<AddAddressPropsType> = (props) => {
const
{
visible
=
false
,
title
,
onOk
,
onCancel
,
editItem
,
type
}
=
props
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
<
boolean
>
(
false
)
const
[
Options
,
setOptions
]
=
useState
([])
const
[
state
,
setState
]
=
useState
({
editable
:
true
})
const
[
telCodeList
,
setTelCodeList
]
=
useState
([])
const
[
state
]
=
useState
({
editable
:
true
})
const
[
provinceName
,
setProvinceName
]
=
useState
(
''
)
const
[
cityName
,
setCityName
]
=
useState
(
''
)
const
[
districtName
,
setDistrictName
]
=
useState
(
''
)
const
[
headerTitle
,
setHeaderTitle
]
=
useState
(
''
)
const
[
provinceList
,
setProvinceList
]
=
useState
([])
const
[
cityList
,
setCityList
]
=
useState
([])
const
[
telCode
,
setTelCode
]
=
useState
<
any
>
([])
// useEffect(() => {
// if (type === 'edit' && !!editItem) {
// initAddressItemInfo()
// }
// }, [editItem, type])
const
[
cityList
]
=
useState
([])
const
initAddressItemInfo
=
async
()
=>
{
//@ts-ignore
const
addressDetailRes
=
await
PublicApi
.
getLogisticsReceiverAddressGet
({
id
:
editItem
.
id
})
const
param
:
any
=
{
id
:
editItem
.
id
}
const
addressDetailRes
=
await
PublicApi
.
getLogisticsReceiverAddressGet
(
param
)
const
addressDetail
=
addressDetailRes
.
data
Object
.
keys
(
addressDetail
).
forEach
(
key
=>
{
...
...
@@ -87,41 +72,46 @@ const AddAddress: React.FC<AddAddressPropsType> = (props) => {
})
}
// const selectList: any = [
// { label: <><img src={ChinaImg} key='1' style={{ width: _width, height: _height }} /> +86</>, value: '1' },
// { label: <><img src={japenImg} key='3' style={{ width: _width, height: _height }} /> +86</>, value: '3' },
// { label: <><img src={korenImg} key='4' style={{ width: _width, height: _height }} /> +86</>, value: '4' },
// { label: <><img src={us} key='5' style={{ width: _width, height: _height }} /> +86</>, value: '5' }
// ]
// let _Options: any = []
let
TelCodeList
:
any
=
[]
useEffect
(()
=>
{
const
fetchCountryAreaTelCode
=
()
=>
{
if
(
isEmpty
(
telCodeList
))
{
PublicApi
.
getManageCountryAreaGetTelCode
().
then
(
res
=>
{
const
result
:
any
=
[]
res
.
data
.
forEach
((
item
,
index
)
=>
{
TelCodeLis
t
.
push
({
label
:
item
,
value
:
(
index
).
toString
()
})
resul
t
.
push
({
label
:
item
,
value
:
(
index
).
toString
()
})
})
setOptions
(
TelCodeLis
t
)
setTelCodeList
(
resul
t
)
})
const
getAllCode
=
setTimeout
(()
=>
{
}
}
useEffect
(()
=>
{
if
(
visible
)
{
fetchCountryAreaTelCode
()
let
getAllCode
=
null
if
(
isEmpty
(
provinceList
))
{
getAllCode
=
setTimeout
(()
=>
{
PublicApi
.
getManageAreaByPcodeAll
({
pcode
:
'100000'
}).
then
(
res
=>
{
le
t
list
=
[]
cons
t
list
=
[]
res
.
data
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
list
.
push
({
label
:
item
.
name
,
value
:
`
${
item
.
code
}
-
${
item
.
name
}
`
})
// list.push({ label: item.name, value: item.code })
})
setProvinceList
(
list
)
})
},
1000
)
}
if
(
type
===
'edit'
&&
!!
editItem
)
{
if
(
type
===
'edit'
&&
editItem
)
{
initAddressItemInfo
()
}
return
()
=>
{
clearTimeout
(
getAllCode
)
}
},
[
editItem
,
type
])
}
},
[
editItem
,
type
,
visible
])
/**
* @description: Form保存
...
...
@@ -129,7 +119,7 @@ const AddAddress: React.FC<AddAddressPropsType> = (props) => {
* @return:
*/
const
formSubmit
=
(
values
)
=>
{
le
t
value
=
{
...
values
}
cons
t
value
=
{
...
values
}
value
.
isDefault
=
values
.
isDefault
?
1
:
0
value
.
provinceCode
=
value
.
provinceCode
.
split
(
'-'
).
length
>
1
?
value
.
provinceCode
.
split
(
'-'
)[
0
]
:
value
.
provinceCode
value
.
cityCode
=
value
.
cityCode
.
split
(
'-'
).
length
>
1
?
value
.
cityCode
.
split
(
'-'
)[
0
]
:
value
.
cityCode
...
...
@@ -167,12 +157,12 @@ const AddAddress: React.FC<AddAddressPropsType> = (props) => {
setFieldState
(
'districtCode'
,
state
=>
{
state
.
value
=
''
})
le
t
name
=
value
&&
value
.
split
(
'-'
).
length
>
1
?
value
.
split
(
'-'
)[
1
]
:
''
cons
t
name
=
value
&&
value
.
split
(
'-'
).
length
>
1
?
value
.
split
(
'-'
)[
1
]
:
''
setProvinceName
(
name
)
setFieldState
(
'*(cityCode)'
,
state
=>
{
state
.
value
=
''
le
t
list
=
[]
le
t
pcode
=
value
&&
value
.
split
(
'-'
).
length
>
1
?
value
.
split
(
'-'
)[
0
]
:
value
cons
t
list
=
[]
cons
t
pcode
=
value
&&
value
.
split
(
'-'
).
length
>
1
?
value
.
split
(
'-'
)[
0
]
:
value
PublicApi
.
getManageAreaByPcodeAll
({
pcode
:
pcode
}).
then
(
res
=>
{
res
.
data
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
// list.push({ label: item.name, value: item.code })
...
...
@@ -184,12 +174,12 @@ const AddAddress: React.FC<AddAddressPropsType> = (props) => {
})
onFieldValueChange$
(
'cityCode'
).
subscribe
(({
value
})
=>
{
le
t
name
=
value
&&
value
.
split
(
'-'
).
length
>
1
?
value
.
split
(
'-'
)[
1
]
:
''
cons
t
name
=
value
&&
value
.
split
(
'-'
).
length
>
1
?
value
.
split
(
'-'
)[
1
]
:
''
setCityName
(
name
)
setFieldState
(
'*(districtCode)'
,
state
=>
{
state
.
value
=
''
le
t
list
=
[]
le
t
pcode
=
value
&&
value
.
split
(
'-'
).
length
>
1
?
value
.
split
(
'-'
)[
0
]
:
value
cons
t
list
=
[]
cons
t
pcode
=
value
&&
value
.
split
(
'-'
).
length
>
1
?
value
.
split
(
'-'
)[
0
]
:
value
PublicApi
.
getManageAreaByPcodeAll
({
pcode
:
pcode
}).
then
(
res
=>
{
res
.
data
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
// list.push({ label: item.name, value: item.code })
...
...
@@ -200,7 +190,7 @@ const AddAddress: React.FC<AddAddressPropsType> = (props) => {
})
})
onFieldValueChange$
(
'districtCode'
).
subscribe
(({
value
})
=>
{
le
t
name
=
value
&&
value
.
split
(
'-'
).
length
>
1
?
value
.
split
(
'-'
)[
1
]
:
''
cons
t
name
=
value
&&
value
.
split
(
'-'
).
length
>
1
?
value
.
split
(
'-'
)[
1
]
:
''
setDistrictName
(
name
)
})
}
...
...
@@ -316,7 +306,7 @@ const AddAddress: React.FC<AddAddressPropsType> = (props) => {
message
:
'请选择区号'
,
}
}
x
-
component=
"Select"
enum=
{
Options
}
enum=
{
telCodeList
}
x
-
component
-
props=
{
{
placeholder
:
'请选择'
}
}
...
...
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