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.
137 lines
4.8 KiB
HTML
137 lines
4.8 KiB
HTML
5 years ago
|
<extend name="Public/bases" />
|
||
|
<block name="body" >
|
||
|
<link href="__CSS__/user.css" rel="stylesheet" >
|
||
|
<body class="shop">
|
||
|
<header class="header userheader">
|
||
|
<div class="">
|
||
|
<a href="{:U('User/userset')}" class="hbtn back"><i class="iconfont icon-drop-left"></i></a>
|
||
|
<h1 class="caption">地址列表</h1>
|
||
|
<!-- 当没有地址时,这个不显示 -->
|
||
|
<a href="{:U('User/useraddressadd')}" class="hbtn addbtn">添加地址</a>
|
||
|
</div>
|
||
|
</header>
|
||
|
<div class="occupy"></div>
|
||
|
<section class="trunker">
|
||
|
<section class="container">
|
||
|
<div class="t-list4 user-address-list">
|
||
|
<div class="btnbox user-set-btnbox hidden">
|
||
|
<a href="{:U('User/useraddressadd')}" class="btn jssubmit" >添加地址</a>
|
||
|
</div>
|
||
|
<ul class="clearfix">
|
||
|
<volist name='list_data' id='data'>
|
||
|
<li>
|
||
|
<div class="item">
|
||
|
<div class="contact clearfix">
|
||
|
<span class="name">{$data['name']}</span>
|
||
|
<span class="mobile">{$data['phone']}</span>
|
||
|
</div>
|
||
|
<p class="address">{$data['city']} {$data['address']}</p>
|
||
|
<div class="btnbox clearfix">
|
||
|
<a href="javascript:;" class="<eq name="data['is_default']" value='1'>on</eq> defaultbtn jssbtn" data-id="{$data['id']}">
|
||
|
<i class="iconfont icon-default"></i>默认地址
|
||
|
</a>
|
||
|
<span class="changebtn">
|
||
|
<a href="{:U('User/useraddressedit',array('id'=>$data['id']))}" class="editbtn"><i class="iconfont icon-edit"></i>编辑</a>
|
||
|
<a href="javascript:;" class="delbtn jsdbtn" data-id="{$data['id']}"><i class="iconfont icon-delete"></i>删除</a>
|
||
|
</span>
|
||
|
</div>
|
||
|
</div>
|
||
|
</li>
|
||
|
</volist>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</section>
|
||
|
</section>
|
||
|
<div class="pop pop-window">
|
||
|
<div class="pop-box">
|
||
|
<div class="pop-wrap"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="popmsg pop-dialog"></div>
|
||
|
<script src="__JS__/pop.lwx.min.js"></script>
|
||
|
<script>
|
||
|
$(function() {
|
||
|
var popmsg = $('.popmsg').pop();
|
||
|
var pop = $('.pop').pop();
|
||
|
$('.jssbtn').click(function() {
|
||
|
var that = $(this);
|
||
|
var id = $(this).attr('data-id');
|
||
|
// ajax
|
||
|
if (that.hasClass('on')) {
|
||
|
that.removeClass('on');
|
||
|
if(set_delault_address(id,'cancel')){
|
||
|
popmsg.msg('默认地址成功取消');
|
||
|
}
|
||
|
else{
|
||
|
popmsg.msg('默认地址取消失败');
|
||
|
}
|
||
|
} else {
|
||
|
$('.jssbtn').removeClass('on');
|
||
|
that.addClass('on');
|
||
|
if(set_delault_address(id,'setting')){
|
||
|
popmsg.msg('默认地址成功设置');
|
||
|
}
|
||
|
else{
|
||
|
popmsg.msg('默认地址设置失败');
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
function set_delault_address(id,type){
|
||
|
var result = true;
|
||
|
$.ajax({
|
||
|
type:"POST",
|
||
|
url:"{:U('User/setDefaultAddress')}",
|
||
|
dataType:"json",
|
||
|
data:{id:id,type:type},
|
||
|
async:false,
|
||
|
success:function(result){
|
||
|
if(result.status == 1){
|
||
|
result = true;
|
||
|
}else{
|
||
|
result = false
|
||
|
}
|
||
|
},
|
||
|
error:function(){
|
||
|
result = false;
|
||
|
}
|
||
|
})
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
$('.jsdbtn').click(function() {
|
||
|
var that=$(this);
|
||
|
var id = $(this).attr('data-id');
|
||
|
pop.open(800,'<p class="pop-content pop-delete-txt">确定要删除该地址吗?</p><div class="pop-btnbox"><a href="javascript:;" class="pop-btn pop-cancel jscancel">取消</a><a href="javascript:;" class="pop-btn pop-confirm jsconfirm">确定</a></div>');
|
||
|
$('.jscancel').click(function() {
|
||
|
pop.close();
|
||
|
});
|
||
|
|
||
|
$('.jsconfirm').click(function() {
|
||
|
$.ajax({
|
||
|
cache:true,
|
||
|
type:'post',
|
||
|
url:"{:U('User/useraddressdel')}",
|
||
|
data:{id:id},
|
||
|
dataType:'json',
|
||
|
success:function(result){
|
||
|
pop.close();
|
||
|
popmsg.msg(result.info);
|
||
|
if(result.url !=''){
|
||
|
setTimeout(function () {
|
||
|
window.location.href = result.url;
|
||
|
}, 2000);
|
||
|
|
||
|
}
|
||
|
},
|
||
|
error:function(){
|
||
|
alert("错误")
|
||
|
}
|
||
|
})
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|
||
|
</block>
|
||
|
<block name="footer"></block>
|