Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
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
hujun
tl_estate
Commits
07844009
Commit
07844009
authored
Nov 13, 2018
by
xishifeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
计算距离
parent
06a97155
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
11 deletions
+109
-11
marchin_list.html
application/index/view/marchin/marchin_list.html
+20
-0
marchinList.js
public/resource/js/marchinList.js
+70
-11
public.js
public/resource/js/public.js
+19
-0
No files found.
application/index/view/marchin/marchin_list.html
View file @
07844009
...
@@ -105,6 +105,7 @@
...
@@ -105,6 +105,7 @@
</div>
</div>
</div>
</div>
</div>
</div>
<script
type=
"text/javascript"
src=
"https://api.map.baidu.com/api?v=2.0&ak=RTimRTxtj23AYTCkSsPvNDuQkGpR2fPX"
></script>
<!--时间轴-->
<!--时间轴-->
<!--时间轴-->
<!--时间轴-->
<div
class=
"modal fade"
id=
"modal-time"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
>
<div
class=
"modal fade"
id=
"modal-time"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
>
...
@@ -125,6 +126,25 @@
...
@@ -125,6 +126,25 @@
</div>
<!-- /.modal -->
</div>
<!-- /.modal -->
</div>
</div>
<!--主要列表模板-->
<script
id=
"marchin_list_tpl"
type=
"text/template"
>
<
tr
class
=
"text-center"
>
<
td
>
{
0
}
<
/td
>
<
td
>
{
1
}
<
/td
>
<
td
>
{
2
}
<
/td
>
<
td
>
{
3
}
<
/td
>
<
td
>
{
4
}
<
/td
>
<
td
>
<
img
src
=
'{5}'
class
=
"diagram-image J_preview"
data
-
bimg
=
'{5}'
>
<
/td
>
<
td
>
{
6
}
<
/td
>
<
/tr
>
</script>
<script
id=
"marchin_list_tpl2"
type=
"text/template"
>
<
a
class
=
"btn1 btn-success timeline"
href
=
"#modal-time"
data
-
toggle
=
"modal"
data
-
id
=
'{0}'
>
时间轴
<
/a
>
</script>
...
...
public/resource/js/marchinList.js
View file @
07844009
define
([
'doT'
,
'text!temp/marchin_list_template_tpl.html'
,
'css!style/home.css'
,
'ckfinder'
,
'ckfinderStart'
,
"datetimepicker"
,
'pagination'
,
'bootstrapJs'
,
'blow-up'
],
function
(
doT
,
template
)
{
define
([
'doT'
,
'css!style/home.css'
,
'ckfinder'
,
'ckfinderStart'
,
"datetimepicker"
,
'pagination'
,
'bootstrapJs'
,
'blow-up'
],
function
(
doT
)
{
//百度地图定位相关,根据地址计算经纬度,并返回两个经纬度之间的距离
var
LocalSearch
=
new
BMap
.
LocalSearch
(),
myGeo
=
new
BMap
.
Geocoder
();
function
getDistance
(
s
,
lat
,
lng
,
fn
)
{
if
(
s
){
if
(
lat
&&
lng
){
var
_maxNum
=
Math
.
max
(
s
.
indexOf
(
'国'
),
s
.
indexOf
(
'省'
));
var
_tempS
=
s
.
slice
(
_maxNum
+
1
);
var
_cityTemp
=
_tempS
.
slice
(
0
,
_tempS
.
indexOf
(
'市'
)
+
1
);
myGeo
.
getPoint
(
s
,
function
(
point
){
if
(
point
)
{
var
_dis
=
getFlatternDistance
(
point
.
lat
,
point
.
lng
,
Number
(
lat
),
Number
(
lng
));
fn
(
_dis
.
toFixed
(
3
)
+
'km'
);
}
else
{
fn
(
'计算失败'
);
}
},
_cityTemp
);
}
else
{
fn
(
'无经纬度信息'
);
}
}
else
{
fn
(
'无效地址'
);
}
};
//百度地图定位相关,根据地址计算经纬度,并返回两个经纬度之间的距离
follow
=
{
follow
=
{
pageNo
:
1
,
pageNo
:
1
,
/*第几页*/
/*第几页*/
...
@@ -13,7 +39,6 @@
...
@@ -13,7 +39,6 @@
boxphoto
:
''
,
boxphoto
:
''
,
init
:
function
()
{
init
:
function
()
{
//初始化dot
//初始化dot
$
(
document
.
body
).
append
(
template
);
follow
.
getList
(
1
);
follow
.
getList
(
1
);
follow
.
event
();
follow
.
event
();
},
},
...
@@ -81,6 +106,9 @@
...
@@ -81,6 +106,9 @@
$
(
document
).
delegate
(
".addphone2"
,
"click"
,
function
()
{
//list2消失
$
(
document
).
delegate
(
".addphone2"
,
"click"
,
function
()
{
//list2消失
follow
.
addphone2
(
this
);
follow
.
addphone2
(
this
);
});
});
},
},
addphone2
:
function
(
obj
){
addphone2
:
function
(
obj
){
...
@@ -133,9 +161,6 @@
...
@@ -133,9 +161,6 @@
});
});
},
},
getList
:
function
(
pageNo
)
{
getList
:
function
(
pageNo
)
{
console
.
log
(
$
(
'#customer_name'
).
val
());
console
.
log
(
$
(
'#start_date'
).
val
());
console
.
log
(
$
(
'#shop_name'
).
val
());
follow
.
pageNo
=
pageNo
;
follow
.
pageNo
=
pageNo
;
var
params
=
{};
var
params
=
{};
params
.
create_time_start
=
$
(
'#create_time_start'
).
val
();
params
.
create_time_start
=
$
(
'#create_time_start'
).
val
();
...
@@ -158,14 +183,48 @@
...
@@ -158,14 +183,48 @@
dataType
:
'json'
,
dataType
:
'json'
,
beforeSend
:
function
()
{},
beforeSend
:
function
()
{},
success
:
function
(
data
)
{
success
:
function
(
data
)
{
if
(
typeof
data
===
'object'
)
{
if
(
typeof
data
===
'object'
)
{
if
(
data
.
code
==
200
)
{
if
(
data
.
code
==
200
)
{
var
doTtmpl
=
doT
.
template
(
document
.
getElementById
(
'marchin_list_tpl'
).
innerHTML
);
if
(
Array
.
isArray
(
data
.
data
.
list
)
&&
(
data
.
data
.
list
.
length
>
0
)){
$
(
"#follow_list"
).
html
(
doTtmpl
(
data
.
data
.
list
));
let
_htmlTemp
=
''
;
// $("#average_score_evaluation").html(data.data.average_score_evaluation);
var
_tplTemp
=
$
(
'#marchin_list_tpl'
).
html
();
// $("#average_score").html(data.data.average_score);
var
_tpl2Temp
=
$
(
'#marchin_list_tpl2'
).
html
();
var
_d
=
data
.
data
.
list
;
!
function
funTemp
(
count
)
{
if
(
count
<
_d
.
length
){
var
v
=
_d
[
count
];
var
_aTemp
=
_tpl2Temp
.
stringFormatObj
({
'0'
:
v
.
order_id
});
getDistance
(
v
.
march_in_area
,
v
.
latitude
,
v
.
longitude
,
function
(
ba
){
_htmlTemp
+=
_tplTemp
.
stringFormatObj
({
'0'
:
v
.
user_name
,
'1'
:
hideTel
(
v
.
user_phone
),
'2'
:
v
.
create_time
,
'3'
:
v
.
report_agent_name
,
'4'
:
ba
,
'5'
:
location
.
href
+
"/static/chat_image/"
+
v
.
march_in_img
,
'6'
:
check_auth
(
'marchIn_timer_shaft'
)?
_aTemp
:
''
});
funTemp
(
++
count
);
});
}
else
{
$
(
"#follow_list"
).
html
(
_htmlTemp
);
}
}(
0
);
// $.each(data.data.list, function(i, v) {
//
// });
// $("#follow_list").html(_htmlTemp);/
// $.each(data.data.list, function() {
//
// });
}
else
{
$
(
"#follow_list"
).
html
(
'<tr><td colspan="8" style="text-align:center;"> 暂无数据</td></tr>'
);
}
/*分页代码*/
/*分页代码*/
add_page
(
data
.
data
.
total
,
pageNo
,
follow
.
pageSize
,
follow
.
getList
);
add_page
(
data
.
data
.
total
,
pageNo
,
follow
.
pageSize
,
follow
.
getList
);
...
...
public/resource/js/public.js
View file @
07844009
...
@@ -337,3 +337,22 @@ function dealPunctuation(str) {
...
@@ -337,3 +337,22 @@ function dealPunctuation(str) {
// }, 2000)
// }, 2000)
//}
//}
//计算两个经纬度之间的距离
function
getFlatternDistance
(
lat1
,
lng1
,
lat2
,
lng2
){
var
EARTH_RADIUS
=
6378137.0
;
//单位M
var
PI
=
Math
.
PI
;
function
rad
(
d
){
return
d
*
PI
/
180.0
;
}
var
radLat1
=
rad
(
lat1
);
var
radLat2
=
rad
(
lat2
);
var
a
=
radLat1
-
radLat2
;
var
b
=
rad
(
lng1
)
-
rad
(
lng2
);
var
s
=
2
*
Math
.
asin
(
Math
.
sqrt
(
Math
.
pow
(
Math
.
sin
(
a
/
2
),
2
)
+
Math
.
cos
(
radLat1
)
*
Math
.
cos
(
radLat2
)
*
Math
.
pow
(
Math
.
sin
(
b
/
2
),
2
)));
s
=
s
*
6378.137
;
// EARTH_RADIUS;
s
=
Math
.
round
(
s
*
10000
)
/
10000
;
return
s
;
}
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