<!--{include file="<!--{$mpath}-->block_header.tpl"}-->
<!--loading页开始-->
<div class="loading">
    <div class="loader">
        <div class="loader-inner pacman">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
</div>
<!--loading页结束-->
<body>
<header class="mui-bar mui-bar-nav report-header box-s" id="header">
    <!--{if $res == '1'}-->
                <!--{if $type == '1'}-->
                    <a href="javascript:history.go(-1)"><i class="iconfont icon-fanhui fl"></i></a>
                <!--{else}-->
                  <a href="index.php?c=user&a=order"><i class="iconfont icon-fanhui fl"></i></a>
                <!--{/if}-->

    <!--{else}-->
     <a href="javascript:history.go(-1)"><i class="iconfont icon-fanhui fl"></i></a>
    <!--{/if}-->

    <p>管理收货地址</p>
</header>
<div id="main" class="mui-clearfix contaniner">
    <!--{foreach $list as $volist}-->
    <div class="addlist clearfloat">
        <div class="top clearfloat box-s xuan" addressid="<!--{$volist.id}-->">
            <ul>
                <li>
                    <span class="fl"><!--{$volist.name}--></span>
                    <span class="fr"><!--{$volist.phone}--></span>
                </li>
                <li>
                    <!--{$volist.province}--><!--{$volist.city}--><!--{$volist.county}--><!--{$volist.address}-->
                </li>
            </ul>
        </div>
        <div class="bottom clearfloat box-s">
            <section class="shopcar clearfloat">
                <!--{if $volist.is_mo == '1'}-->
                <div class="shopcar-checkbox fl">
                    <label for="shopcar" onselectstart="return false" class="shopcar-checkd"></label>
                    <input type="checkbox" id="shopcar"/>
                </div>
                <span class="mradd fl">默认地址</span>
                <!--{else}-->
                <div class="shopcar-checkbox fl">
                    <label for="shopcar" onselectstart="return false" class=""></label>
                    <input type="checkbox" id="shopcar"/>
                </div>
                <span class="mradd fl">设为默认</span>
                <!--{/if}-->

                <div class="right fr clearfloat">
                    <a href="javascript:void(0)" class="fr deladdress"  addressid="<!--{$volist.id}-->">
                        <i class="iconfont icon-shanchu icon-shanchutwo"></i>
                        删除
                    </a>
                    <a href="index.php?c=user&a=adddizhi&id=<!--{$volist.id}-->" class="fr">
                        <i class="iconfont icon-bianji bianjittt"></i>
                        编辑
                    </a>
                </div>
            </section>
        </div>
    </div>
    <!--{/foreach}-->
</div>
<input type="hidden" id="res" value="<!--{$res}-->"/>
<input type="hidden" id="type" value="<!--{$type}-->"/>
<input type="hidden" id="id" value="<!--{$id}-->"/>
<input type="hidden" id="num" value="<!--{$num}-->"/>
<footer class="page-footer fixed-footer" id="footer">
    <a href="index.php?c=user&a=adddizhi" class="address-add fl">
        添加新地址
    </a>
</footer>
</body>
<script type="text/javascript" src="<!--{$mpath}-->js/jquery-1.8.3.min.js" ></script>
<script src="<!--{$mpath}-->layer_mobile/layer.js"></script>
<script src="<!--{$mpath}-->js/fastclick.js"></script>
<script src="<!--{$mpath}-->js/mui.min.js"></script>
<script type="text/javascript" src="<!--{$mpath}-->js/hmt.js" ></script>
<script type="text/javascript">
    $('.deladdress').click(function(e){
        //询问框
        var id =$(this).attr("addressid");
        layer.open({
            content: '您确定删除改地址么？'
            ,btn: ['确定', '不要']
            ,yes: function(index){
                $.post("<!--{$urlpath}-->index.php?c=user&a=deladdress", {
                    id:id,
                }, function (data) {
                    if (data.response == '1') {
                        layer.open({
                            content: data.result
                            ,skin: 'msg'
                            ,time: 2 //2秒后自动关闭
                        });
                        setTimeout( function(){
                            location.reload();
                            layer.close(index);
                        }, 1 * 1000 );//延迟5000毫米
                    } else {
                        layer.open({
                            content: data.result
                            ,skin: 'msg'
                            ,time: 2 //2秒后自动关闭
                        });
                    }
                }, "json");

            }
        });

    });
    var res = $('#res').val();
    var type = $('#type').val();
   if(res == 1){
       $('.xuan').click(function(e){
           var id =$(this).attr("addressid");
           if(type == 1){
               var goodsid = $('#id').val();
               var num = $('#num').val();
               window.location.href = 'index.php?c=integral&a=order&addressid='+id+'&id='+goodsid+'&num='+num ;

           }else {
               window.location.href = 'index.php?c=user&a=order&addressid=' +id;
           }
       });
   }

</script>
</html>
