You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
4.5 KiB
HTML

<extend name="Public/bases" />
<block name="body" >
<link href="__CSS__/user.css" rel="stylesheet" >
<body class="">
<header class="header">
<div class="">
<a href="{:U('User/useraddresslist')}" class="hbtn back"><i class="iconfont icon-drop-left"></i></a>
<h1 class="caption">编辑地址</h1>
<a href="javascript:;" class="hbtn addbtn jssubmit">保存</a>
</div>
</header>
<div class="occupy"></div>
<section class="trunker">
<section class="container">
<form id='form' action="" method="post" class="">
<div class="t-table user-auth-list">
<ul class="table clearfix">
<li class="table-row">
<span class="table-cell">收货人</span>
<span class="table-cell">
<input type="text" class="txt" id="name" name="name" value="{$data['name']}" placeholder="请输入姓名">
</span>
</li>
<li class="table-row">
<span class="table-cell">手机</span>
<span class="table-cell">
<input type="text" class="txt" id="phone" name="phone" value="{$data['phone']}" placeholder="请输入手机号码">
</span>
</li>
<li class="table-row">
<span class="table-cell">省市区</span>
<span class="table-cell">
<input type="text" class="txt" id="city" name="city" value="{$data['city']}" placeholder="请选择">
</span>
</li>
<li class="table-row">
<span class="table-cell">详细地址</span>
<span class="table-cell">
<input type="text" class="txt" id="address" name="address" value="{$data['address']}" placeholder="请输入详细地址">
</span>
</li>
</ul>
</div>
<input type="hidden" name="id" value="{$data['id']}">
</form>
</section>
</section>
<div class="popmsg pop-dialog"></div>
<link rel="stylesheet" href="__CSS__/ydui.css?rev=@@hash">
<script type="text/javascript" src="__JS__/ydui.citys.js"></script>
<script type="text/javascript" src="__JS__/ydui.js"></script>
<script src="__JS__/pop.lwx.min.js"></script>
<script>
$(function() {
$('input[type=checkbox]').change(function() {
var that = $(this);
if (that.prop('checked')) {
that.addClass('on');
} else {that.removeClass('on');}
});
$('.jssubmit').click(function() {
var pmsg = $('.popmsg').pop();
if(validation()){
$.ajax({
cache:true,
type:'post',
url:"{:U('User/useraddressedit')}",
data:$('#form').serialize(),
dataType:'json',
success:function(result){
pmsg.msg(result.info);
if(result.url !=''){
setTimeout(function () {
window.location.href = result.url;
}, 2000);
}
},
error:function(){
alert("错误")
}
})
}
});
function validation(){
var pmsg = $('.popmsg').pop();
if($.trim($("#name").val()) == ''){
pmsg.msg('请输入姓名');
return false;
}
if($.trim($("#phone").val()) == ''){
pmsg.msg('请输入手机号');
return false;
}
var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(17[0]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1}))+\d{8})$/;
if(!myreg.test($("#phone").val())){
pmsg.msg('请输入有效的手机号码!');
return false;
}
if($.trim($("#city").val()) == ''){
pmsg.msg('请输入城市名称');
return false;
}
if($.trim($("#address").val()) == ''){
pmsg.msg('请输入详细地址');
return false;
}
return true;
}
var $target = $('#city');
$target.citySelect();
$target.on('click', function (event) {
event.stopPropagation();
$target.citySelect('open');
});
$target.on('done.ydui.cityselect', function (ret) {
$(this).val(ret.provance + ' ' + ret.city + ' ' + ret.area);
});
});
</script>
</body>
</block>