2018-09-21 10:35:37 +00:00
< include file = "Public/Header" / >
<!-- conntent start -->
< div class = "am-g my-content" >
<!-- form start -->
2018-09-24 17:03:42 +00:00
< form class = "am-form form-validation" method = "post" action = "{{:U('Home/UserAddress/Save')}}" request-type = "ajax-fun" request-value = "ViewModalBack" >
2018-09-23 08:05:06 +00:00
< div class = "am-form-group" >
< label > {{:L('useraddress_name_text')}}< / label >
< input type = "text" name = "name" placeholder = "{{:L('useraddress_name_text')}}" minlength = "2" maxlength = "16" data-validation-message = "{{:L('useraddress_name_format')}}" class = "am-radius" < present name = "data" > value="{{$data.name}}"< / present > required />
< / div >
< div class = "am-form-group" >
< label > {{:L('useraddress_tel_text')}}< / label >
< input type = "text" name = "tel" placeholder = "{{:L('useraddress_tel_text')}}" minlength = "6" maxlength = "30" data-validation-message = "{{:L('useraddress_tel_format')}}" class = "am-radius" < present name = "data" > value="{{$data.tel}}"< / present > required />
< / div >
2018-09-21 10:35:37 +00:00
< include file = "Lib/RegionLinkage" / >
2018-09-23 08:05:06 +00:00
< div class = "am-form-group" >
< label > {{:L('useraddress_address_text')}}< / label >
2018-09-24 17:03:42 +00:00
< div class = "am-form-group am-input-group am-input-group-sm" >
< input type = "hidden" name = "lng" id = "form-lng" < notempty name = "data" > value="{{$data.lng}}"< / notempty > />
< input type = "hidden" name = "lat" id = "form-lat" < notempty name = "data" > value="{{$data.lat}}"< / notempty > />
< input type = "text" name = "address" id = "form-address" placeholder = "{{:L('useraddress_address_text')}}" minlength = "2" maxlength = "80" data-validation-message = "{{:L('useraddress_address_format')}}" class = "am-radius" < notempty name = "data" > value="{{$data.address}}"< / notempty > required />
< span class = "am-input-group-btn" >
< button class = "am-btn am-btn-default am-radius" type = "button" id = "map-location-submit" > < span class = "am-icon-map-marker" > < / span > {{:L('common_location_submit')}}< / button >
< / span >
< / div >
2018-09-23 08:05:06 +00:00
< / div >
2018-09-25 09:04:56 +00:00
< div id = "map" data-level = "17" class = "am-form-group" > < / div >
2018-09-23 08:05:06 +00:00
< div class = "am-form-group" >
< label > {{:L('useraddress_alias_text')}}< / label >
< input type = "text" name = "alias" placeholder = "{{:L('useraddress_alias_text')}}" minlength = "0" maxlength = "16" data-validation-message = "{{:L('useraddress_alias_format')}}" class = "am-radius" < present name = "data" > value="{{$data.alias}}"< / present > />
< / div >
< div class = "am-form-group" >
< label class = "block" > {{:L('common_view_default_title')}}< / label >
< input name = "is_default" value = "1" type = "checkbox" data-off-text = "{{:L('common_operation_off_is_text')}}" data-on-text = "{{:L('common_operation_on_is_text')}}" data-size = "xs" data-on-color = "success" data-off-color = "default" data-handle-width = "49" data-am-switch < if condition = "isset($data['is_default']) and $data['is_default'] eq 1" > checked="true"< / if > />
< / div >
2018-09-21 10:35:37 +00:00
2018-09-23 08:05:06 +00:00
< div class = "am-form-group" >
< input type = "hidden" name = "id" < notempty name = "data" > value="{{$data.id}}"< / notempty > />
< button type = "submit" class = "am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading = "{loadingText:'{{:L('common_form_loading_tips')}}'}" > {{:L('common_operation_save')}}< / button >
< / div >
2018-09-21 10:35:37 +00:00
< / form >
<!-- form end -->
< / div >
<!-- conntent end -->
<!-- footer start -->
< include file = "Public/Footer" / >
<!-- footer end -->
2018-09-24 17:03:42 +00:00
<!-- map -->
< script type = "text/javascript" src = "http://api.map.baidu.com/api?v=2.0&ak={{:MyC('common_baidu_map_ak')}}" > < / script >
2018-09-21 10:35:37 +00:00
< script type = "text/javascript" >
2018-09-24 17:03:42 +00:00
$(function()
{
// 百度地图API功能
var map = new BMap.Map("map", {enableMapClick:false});
var level = $('#map').data('level') || 16;
var point = new BMap.Point(< if condition = "!empty($data['lng'])" > {{$data['lng']}}< else / > 116.400244< / if > ,< if condition = "!empty($data['lat'])" > {{$data['lat']}}< else / > 39.92556< / if > );
map.centerAndZoom(point, level);
/* 添加控件 */
var navigationControl = new BMap.NavigationControl({
// 靠左上角位置
anchor: BMAP_ANCHOR_TOP_LEFT,
// LARGE类型
type: BMAP_NAVIGATION_CONTROL_LARGE,
});
map.addControl(navigationControl);
/* 创建标注 */
var marker = new BMap.Marker(point); // 创建标注
map.addOverlay(marker); // 将标注添加到地图中
marker.enableDragging(); // 可拖拽
marker.addEventListener("dragend", function(e) {
map.panTo(e.point);
$('#form-lng').val(e.point.lng);
$('#form-lat').val(e.point.lat);
});
/* 设置版权控件位置 */
var cr = new BMap.CopyrightControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT});
map.addControl(cr); //添加版权控件
var bs = map.getBounds(); //返回地图可视区域
cr.addCopyright({id: 1, content: "< div class = 'map-copy' > < span > 拖动红色图标直接定位< / span > < / div > ", bounds:bs});
});
// 返回处理
function ViewModalBack(e)
{
if(e.code == 0)
2018-09-21 10:35:37 +00:00
{
2018-09-24 17:03:42 +00:00
$.AMUI.progress.done();
Prompt(e.msg, 'success');
setTimeout(function()
2018-09-21 10:35:37 +00:00
{
2018-09-24 17:03:42 +00:00
parent.location.reload();
}, 1500);
} else {
$('form.form-validation').find('button[type="submit"]').button('reset');
$.AMUI.progress.done();
Prompt(e.msg);
2018-09-21 10:35:37 +00:00
}
2018-09-24 17:03:42 +00:00
}
2018-09-21 10:35:37 +00:00
< / script >