Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eduline
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
eduline
Commits
bfb32226
Commit
bfb32226
authored
May 14, 2020
by
陈超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
T
parent
574e3caa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
30 deletions
+44
-30
apps/home/Tpl/default/User/address_w3g.html
+44
-30
No files found.
apps/home/Tpl/default/User/address_w3g.html
View file @
bfb32226
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
</div>
</div>
<van-popup
v-model=
"showPicker"
round
position=
"bottom"
>
<van-popup
v-model=
"showPicker"
round
position=
"bottom"
>
<van-picker
<van-picker
ref=
"picker"
show-toolbar
show-toolbar
title=
"收货地址"
title=
"收货地址"
:columns=
"columns"
:columns=
"columns"
...
@@ -152,7 +153,7 @@
...
@@ -152,7 +153,7 @@
showPicker
:
false
,
showPicker
:
false
,
loading
:
false
,
loading
:
false
,
columns
:
[],
columns
:
[],
selected
:
[]
selected
:
[
''
,
''
,
''
]
}
}
},
},
created
:
function
(){
created
:
function
(){
...
@@ -171,35 +172,58 @@
...
@@ -171,35 +172,58 @@
}
}
},
},
methods
:
{
methods
:
{
//当选择省变化
onProvinceChange
:
function
(
picker
,
p
)
{
let
that
=
this
if
(
p
.
children
.
length
==
0
)
{
that
.
getCity
(
p
.
id
,
r
=>
{
p
.
children
=
r
.
map
(
r
=>
{
return
{
text
:
r
.
title
,
id
:
r
.
area_id
,
children
:
[]
}
})
if
(
p
.
children
.
length
>
0
)
{
that
.
onCityChange
(
picker
,
p
.
children
[
0
])
}
else
{
that
.
columns
=
[].
concat
(
that
.
columns
)
}
})
}
else
{
picker
.
setColumnValues
(
1
,
p
.
children
)
}
},
//当选择市变化
onCityChange
:
function
(
picker
,
c
)
{
let
that
=
this
if
(
c
.
children
.
length
==
0
)
{
that
.
getArea
(
c
.
id
,
r
=>
{
c
.
children
=
r
.
map
(
r
=>
{
return
{
text
:
r
.
title
,
id
:
r
.
area_id
}
})
picker
.
setColumnValues
(
2
,
c
.
children
)
})
}
else
{
picker
.
setColumnValues
(
2
,
c
.
children
)
}
},
onArea
:
function
()
{
onArea
:
function
()
{
let
that
=
this
let
that
=
this
that
.
showPicker
=
true
that
.
showPicker
=
true
if
(
that
.
selected
.
length
==
0
)
{
if
(
that
.
columns
[
0
].
children
.
length
==
0
)
{
let
p
=
that
.
columns
[
0
]
that
.
onProvinceChange
(
that
.
$refs
.
picker
,
that
.
columns
[
0
])
if
(
p
.
children
.
length
==
0
)
{
that
.
loading
=
true
that
.
getCity
(
p
.
id
)
}
}
}
},
},
onAreaConfirm
:
function
(
r
,
values
)
{
onAreaConfirm
:
function
(
picke
r
,
values
)
{
},
},
onAreaCancel
:
function
(
r
,
values
)
{
onAreaCancel
:
function
(
picke
r
,
values
)
{
},
},
onAreaChange
:
function
(
r
,
values
)
{
onAreaChange
:
function
(
picker
,
values
)
{
let
selected
=
values
.
filter
(
r
=>
{
return
r
!=
undefined
})
console
.
log
(
selected
)
console
.
log
(
this
.
columns
)
},
},
saveAddress
:
function
()
{
saveAddress
:
function
()
{
},
},
//Helper
//Helper
getCity
:
function
(
id
)
{
getCity
:
function
(
id
,
call
)
{
let
that
=
this
let
that
=
this
that
.
loading
=
true
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
url
:
"{:U('home/User/getAreaList')}"
,
url
:
"{:U('home/User/getAreaList')}"
,
...
@@ -208,33 +232,23 @@
...
@@ -208,33 +232,23 @@
success
:
function
(
res
){
success
:
function
(
res
){
that
.
loading
=
false
that
.
loading
=
false
if
(
res
.
status
==
1
)
{
if
(
res
.
status
==
1
)
{
let
found
=
that
.
columns
.
filter
(
r
=>
{
return
r
.
id
==
id
})
call
&&
call
(
res
.
data
)
if
(
found
.
length
>
0
)
{
let
province
=
found
[
0
]
province
.
children
=
res
.
data
.
map
(
r
=>
{
return
{
text
:
r
.
title
,
id
:
r
.
area_id
,
children
:
[]
}
})
if
(
province
.
children
.
length
>
0
)
{
that
.
getArea
(
province
,
province
.
children
[
0
].
id
)
}
}
}
}
}
}
})
})
},
},
getArea
:
function
(
p
,
id
)
{
getArea
:
function
(
id
,
call
)
{
let
that
=
this
let
that
=
this
that
.
loading
=
true
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
url
:
"{:U('home/User/getAreaList')}"
,
url
:
"{:U('home/User/getAreaList')}"
,
data
:{
id
:
id
},
data
:{
id
:
id
},
dataType
:
'json'
,
dataType
:
'json'
,
success
:
function
(
res
){
success
:
function
(
res
){
that
.
loading
=
false
if
(
res
.
status
==
1
)
{
if
(
res
.
status
==
1
)
{
let
found
=
p
.
children
.
filter
(
r
=>
{
return
r
.
id
==
id
})
call
&&
call
(
res
.
data
)
if
(
found
.
length
>
0
)
{
let
city
=
found
[
0
]
city
.
children
=
res
.
data
.
map
(
r
=>
{
return
{
text
:
r
.
title
,
id
:
r
.
area_id
}
})
}
that
.
columns
=
[].
concat
(
that
.
columns
)
}
}
}
}
})
})
...
...
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