' +
" <% } %>" +
"<% if(!dataItem.distance) { %>" +
'
' +
" <% } %>" +
'
' +
"<%- dataItem.name %>" +
"
" +
'
' +
"<%- dataItem.address %>" +
"
" +
"
",
{
dataItem: dataItem,
label: label,
styleslabel: styleslabel,
}
);
if (recycledListElement) {
recycledListElement.innerHTML = innerHTML;
return recycledListElement;
}
return (
'
' +
innerHTML +
"
"
);
},
//列表节点上监听的事件
listElementEvents: ["click", "mouseenter", "mouseleave"],
//marker上监听的事件
markerEvents: ["click", "mouseover", "mouseout"],
//makeSelectedEvents:false,
selectedClassNames: "select_map",
autoSetFitView: true,
});
$scope.markerList.on("selectedChanged", function (event, info) {
if (info.selected) {
// 设置列表样式
var selectclassobj =
info.selected.listElement.getElementsByClassName(
"my-marker"
);
selectclassobj[0].className =
"amap-simple-marker margin-center my-marker amap-simple-marker-def-style " +
"amap-simple-marker-style-" +
selectedIconStyle;
if (info.selected.marker) {
//更新为选中样式
info.selected.marker.setIconStyle(selectedIconStyle);
} else {
// alert("此网点暂无标注,有疑问请联系95353");
$scope.popupInfo_marklist.title = "网点地图查询";
$scope.popupInfo_marklist.text =
"此网点暂无标注,有疑问请联系95353!";
$("#marklistmsg").modal("show");
}
}
if (info.unSelected) {
// console.log(info.unSelected);
//列表回复样式
var unselectclassobj =
info.unSelected.listElement.getElementsByClassName(
"my-marker"
);
unselectclassobj[0].className =
"amap-simple-marker margin-center my-marker amap-simple-marker-def-style " +
"amap-simple-marker-style-" +
defaultIconStyle;
//更新为默认样式
if (info.unSelected.marker) {
info.unSelected.marker.setIconStyle(defaultIconStyle);
}
}
});
$scope.markerList.on(
"listElementMouseenter markerMouseover",
function (event, record) {
if (record && record.marker) {
forcusMarker(record.marker);
//this.openInfoWindowOnRecord(record);
//非选中的id
if (!this.isSelectedDataId(record.id)) {
//设置为hover样式
record.marker.setIconStyle(hoverIconStyle);
//this.closeInfoWindow();
}
}
}
);
function forcusMarker(marker) {
marker.setTop(true);
//不在地图视野内
if (!map.getBounds().contains(marker.getPosition())) {
//移动到中心
map.setCenter(marker.getPosition());
}
}
$scope.markerList.on(
"listElementMouseleave markerMouseout",
function (event, record) {
if (record && record.marker) {
if (!this.isSelectedDataId(record.id)) {
//恢复默认样式
record.marker.setIconStyle(defaultIconStyle);
}
}
}
);
$scope.markerList.on("infoWindowClick", function (event, record) {
if (
event.target.className ==
"button primary-xs normal el-hover-pointer text-right"
) {
window.location.href =
CustomUtils.getPageViewBaseUrl() + "/mail/order";
}
});
function isElementInViewport(el) {
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <=
(window.innerHeight ||
document.documentElement
.clientHeight) /*or $(window).height() */ &&
rect.right <=
(window.innerWidth ||
document.documentElement
.clientWidth) /*or $(window).width() */
);
}
//展示该数据
$scope.markerList.render(listdata);
}
);
}
//获取热门城市
function getHotCitiesList() {
var url =
CustomUtils.getBusinessBaseUrl() +
"/phonerest/citycontrol/queryHotCitys";
//var url = "";
var req = {
method: "GET",
url: url,
headers: {
"Content-Type": "application/json",
Accept: "application/json, text/plain, */*",
},
};
$http(req).then(
function (data) {
$scope.mapdataList.hotCitiesList = data.data.result;
// console.log($scope.mapdataList.hotCitiesList);
},
function (err) {}
);
}
//获取省市拼音
function getProvinceList(countryCode) {
var url =
CustomUtils.getBusinessBaseUrl() +
"/phonerest/citycontrol/queryProviecn/" +
countryCode;
var req = {
method: "GET",
url: url,
headers: {
"Content-Type": "application/json",
Accept: "application/json, text/plain, */*",
},
};
$http(req).then(
function (data) {
setProvinceSoft(data.data.result);
// console.log(data);
},
function (err) {}
);
}
//设置省排序
function setProvinceSoft(list) {
angular.forEach(list, function (item, index) {
// if(item.provinceCode != "820000" && item.provinceCode != "710000" && item.provinceCode != "810000"){
// //去除港澳台
if (
"a" <= item.pinyin.substr(0, 1) &&
item.pinyin.substr(0, 1) <= "f"
) {
$scope.mapdataList.provinceList["A-F"].push(item);
} else if (item.pinyin.substr(0, 1) == "g") {
$scope.mapdataList.provinceList["G-G"].push(item);
} else if (
"h" <= item.pinyin.substr(0, 1) &&
item.pinyin.substr(0, 1) <= "i"
) {
$scope.mapdataList.provinceList["H-I"].push(item);
} else if (
"j" <= item.pinyin.substr(0, 1) &&
item.pinyin.substr(0, 1) <= "r"
) {
$scope.mapdataList.provinceList["J-R"].push(item);
} else if (
"s" <= item.pinyin.substr(0, 1) &&
item.pinyin.substr(0, 1) <= "w"
) {
$scope.mapdataList.provinceList["S-W"].push(item);
} else if (
"x" <= item.pinyin.substr(0, 1) &&
item.pinyin.substr(0, 1) <= "z"
) {
$scope.mapdataList.provinceList["X-Z"].push(item);
}
// }else{
// $scope.dataList.provinceListGAT.push(item);
// }
});
}
//点击热门城市
function clickHotCity(value) {
setCountyList(value);
}
//点击热门城市/省/国家菜单
function clickMenu(num) {
$scope.formData.searchmapAddress = "";
$scope.pageInfoisable = false;
if (num == 0) {
//调用接口
getMarkslist();
} else if (num == 1) {
$scope.mapResultlevel = "2";
var jsonbody = {
level: $scope.mapResultlevel,
provinceCode: $scope.selectedResultMap.provinceCode,
provinceName: $scope.selectedResultMap.provinceName,
cityCode: "",
cityName: "",
countyCode: "",
countyName: "",
};
getsearchBranchMap(jsonbody, "mylist1");
$scope.selectedResultMap.cityName = "";
$scope.selectedResultMap.cityCode = "";
$scope.selectedResultMap.countyName = "";
$scope.selectedResultMap.countyCode = "";
} else if (num == 2) {
$scope.mapResultlevel = "3";
var jsonbody = {
level: $scope.mapResultlevel,
provinceCode: $scope.selectedResultMap.provinceCode,
provinceName: $scope.selectedResultMap.provinceName,
cityCode: $scope.selectedResultMap.cityCode,
cityName: $scope.selectedResultMap.cityName,
countyCode: "",
countyName: "",
};
getsearchBranchMap(jsonbody, "mylist1");
$scope.selectedResultMap.countyName = "";
$scope.selectedResultMap.countyCode = "";
}
}
//设置市列表
function setCityList(item) {
$scope.setCityListprovinceName = item.provinceName;
//console.log($scope.setCityListprovinceName);
$scope.mapResultlevel = "2";
var jsonbody = {
level: $scope.mapResultlevel,
provinceCode: item.provinceCode,
provinceName: item.provinceName,
cityCode: "",
cityName: "",
countyCode: "",
countyName: "",
};
getsearchBranchMap(jsonbody, "mylist1");
$scope.selectedResultMap.provinceName = item.provinceName;
$scope.selectedResultMap.provinceCode = item.provinceCode;
}
//设置区县列表
function setCountyList(item) {
$scope.setCountyListcountyName = item.cityName;
$scope.mapResultlevel = "3";
var jsonbody = {
level: $scope.mapResultlevel,
provinceCode: item.provinceCode,
provinceName: item.provinceName,
cityCode: item.cityCode,
cityName: item.cityName,
countyCode: "",
countyName: "",
};
getsearchBranchMap(jsonbody, "mylist1");
$scope.selectedResultMap.provinceName = item.provinceName;
$scope.selectedResultMap.provinceCode = item.provinceCode;
$scope.selectedResultMap.cityName = item.cityName;
$scope.selectedResultMap.cityCode = item.cityCode;
}
//设置选择结果
function setSelectedArea(item) {
$scope.mapResultlevel = "4";
$scope.mapresulttabIndex = 1;
$scope.map_pageInfo1.currentPage = 1;
$scope.map_pageInfo1.watchParam.currentPage = 1;
var jsonbody = {
level: $scope.mapResultlevel,
provinceCode: item.provinceCode,
provinceName: item.provinceName,
cityCode: item.cityCode,
cityName: item.cityName,
countyCode: item.countyCode,
countyName: item.countyName,
pageIndex: 1,
pageSize: 5,
};
getsearchBranchMap(jsonbody, "mylist1");
$scope.selectedResultMap.countyName = item.countyName;
$scope.selectedResultMap.countyCode = item.countyCode;
}
//根据地名获取网点列表, 没有详细地址 true
function getsearchBranchMap(jsonbody, id) {
$scope.serachisdetail = true;
$scope.isSelectgetMapdetail = true;
//初始化数据源
$scope.serachmarkerlistdata = [];
if ($scope.markerList) {
$scope.markerList.clearData();
}
commonMethods.pageLoading(true);
branchSearchService
.searchBranchMap(jsonbody)
.then(function (data) {
if (data.status == "success") {
// console.log(data);
$scope.serachmarkerlistdata = data.result.netResponses;
if (data.result.totalRows) {
$scope.mappagetotal = data.result.totalRows;
// console.log( $scope.mappagetotal);
}
// 处理数据
addlistshowname(
$scope.serachmarkerlistdata,
$scope.mapResultlevel
);
if ($scope.mapResultlevel === "4") {
// 设置页数
$scope.pageInfoisable = true;
if ($scope.mapresulttabIndex == "1") {
$scope.map_pageInfo1.totalNum = $scope.mappagetotal;
} else if ($scope.mapresulttabIndex == "2") {
$scope.map_pageInfo2.totalNum = $scope.mappagetotal;
} else if ($scope.mapresulttabIndex == "3") {
$scope.map_pageInfo3.totalNum = $scope.mappagetotal;
}
$scope.controlField.step = 0;
$scope.mapResultList = "查询结果";
$scope.mapinitpage = false;
map.remove($scope.markerinitList);
testlist(id, deletesomemsg($scope.serachmarkerlistdata));
} else {
getMarkerlsitmap($scope.serachmarkerlistdata);
if ($scope.mapResultlevel === "2") {
$scope.controlField.step = 2;
$scope.mapdataList.cityList = $scope.serachmarkerlistdata;
} else if ($scope.mapResultlevel === "1") {
$scope.controlField.step = 0;
$scope.mapinitpage = true;
$scope.mapResultList = "全国网点";
$scope.selectedResultMap = {
provinceName: "",
provinceCode: "",
cityName: "",
cityCode: "",
countyName: "",
countyCode: "",
};
} else if ($scope.mapResultlevel === "3") {
$scope.controlField.step = 3;
$scope.mapdataList.countyList = $scope.serachmarkerlistdata;
}
}
// console.log($scope.serachmarkerlistdata);
commonMethods.pageLoading(false);
} else if (data.status == "fail") {
commonMethods.pageLoading(false);
$scope.popupInfo_marklist.title = "网点地图查询";
$scope.popupInfo_marklist.text =
"网点地图查询失败,请稍后再试!";
$("#marklistmsg").modal("show");
}
})
.then(null, function (err) {
commonMethods.pageLoading(false);
});
}
//根据地名获取网点列表, 详细地址
function getsearchBranchMapdetail(jsonbody, id) {
// $scope.serachisdetail=true;
$scope.isSelectgetMapdetail = false;
//初始化数据源
$scope.serachmarkerlistdata = [];
if ($scope.markerList) {
$scope.markerList.clearData();
}
commonMethods.pageLoading(true);
branchSearchService
.stationSearch(jsonbody)
.then(function (data) {
if (data.status == "success") {
// console.log(data.result)
// var response = data.result
// if(typeof(response)==='string') {
// data.result = JSON.parse(data.result)
// }
var resData = data.result.data;
angular.forEach(resData, function (item, index) {
// 将百度经纬度改成 高德经纬度
// var gLatLngArr = BmapToGmapLngLat(item.baiduLng, item.baiduLat)
var items = {
latitude: item.baiduLat,
longitude: item.baiduLng,
name: item.deptName,
address: item.deptAddress,
contactway: item.contactway,
distance: item.distance,
businessType: item.businessScope,
isPickupSelf: item.pickupSelf ? "提货" : "",
isLeave: item.isLeave ? "发货" : "",
isDelivery: item.delivery ? "送货" : "",
};
$scope.serachmarkerlistdata.push(items);
});
testlist(id, $scope.serachmarkerlistdata);
// console.log($scope.serachmarkerlistdata);
commonMethods.pageLoading(false);
} else if (data.status == "fail") {
commonMethods.pageLoading(false);
$scope.popupInfo_marklist.title = "网点地图查询";
$scope.popupInfo_marklist.text =
"网点地图暂无数据,请稍后再试!";
$("#marklistmsg").modal("show");
}
})
.then(null, function (err) {
commonMethods.pageLoading(false);
});
}
//自定义函数为在得到的数据上加字段
function addlistshowname(data, i) {
if (i == "1") {
angular.forEach(data, function (item) {
item["showname"] = item.provinceName;
});
} else if (i == "2") {
angular.forEach(data, function (item) {
item["showname"] = item.cityName;
});
} else if (i == "3") {
angular.forEach(data, function (item) {
item["showname"] = item.countyName;
});
}
}
//定义函数处理数据
function deletesomemsg(list) {
angular.forEach(list, function (item) {
// if (item.name.indexOf("【") != -1) {
// item.name = item.name.substring(3);
// }
if (item.name.indexOf("】") !== -1) {
item.name = item.name.substring(item.name.indexOf("】") + 1);
}
});
//console.log(list);
return list;
}
// 获取全部城市 热门城市
getHotCitiesList();
getProvinceList("100000");
// 百度经纬度 转成 高德 经纬度
function BmapToGmapLngLat(bd_lon, bd_lat) {
var x_pi = (3.14159265358979324 * 3000.0) / 180.0;
var x = bd_lon - 0.0065;
var y = bd_lat - 0.006;
var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
var gg_lng = z * Math.cos(theta);
var gg_lat = z * Math.sin(theta);
return [gg_lng, gg_lat];
}
var w = angular.element($window);
w.bind("click", function () {
$scope.showRecogDialog = false;
});
},
]);
angular.bootstrap(document.getElementById("branchSearch"), [
"branchSearch",
]);
});
联系方式
客户服务热线: 400-80045666
总部地址: 凯发娱发K8官网_凯发官网平台
邮箱: k8.com@ag100.org|网站地图