<!--{if !empty($data) && $a=='ajaxlist' && $modify==0}-->
    <!--{foreach $data as $volist}-->
    <dl f="data-address" data-del="address_<!--{$volist.addrid}-->" data-id="<!--{$volist.addrid}-->">
        <dt>
            收件人：<font f="sel_contname"><!--{$volist.contname}--></font>    <span f="sel_contphone"><!--{$volist.contphone}--></span>
        </dt>
        <dd>
            <p class="p_1">
            <span f="default-address"><!--{if $volist.isdefault==1}-->[默认地址]<!--{/if}--></span>
                <font f="sel_street">
                    <!--{area type='text' value=$volist.area1}-->省
                    <!--{area type='text' value=$volist.area2}-->市
                    <!--{area type='text' value=$volist.area3}-->
                    <!--{area type='text' value=$volist.area4}-->
                    <!--{$volist.street}-->
                </font>
            </p>
        </dd>
    </dl>
    <!--{/foreach}-->

<script>

</script>
<!--{/if}-->

<!--{if !empty($data) && $a=='ajaxlist' && $modify==1}-->
<!--{foreach $data as $volist}-->
<dl data-del="address_<!--{$volist.addrid}-->">
    <dt>
        收件人：<!--{$volist.contname}-->    <span><!--{$volist.contphone}--></span>
    </dt>
    <dd>
        <p class="p_1">
            <span f="default-address"></span>
            <!--{area type='text' value=$volist.area1}-->
            <!--{area type='text' value=$volist.area2}-->
            <!--{area type='text' value=$volist.area3}-->
            <!--{area type='text' value=$volist.area4}-->
            <!--{$volist.street}-->
        </p>
        <p class="p_2">
            <label <!--{if $volist.isdefault==1}-->class="current"<!--{/if}--> f="setdefault" data-id="<!--{$volist.addrid}-->"><span class="iconfont">&#xe635;</span><i class="iconfont">&#xe621;</i>设为默认</label>
            <span class="span_1" f="modify-edit" data-id="<!--{$volist.addrid}-->"><i class="iconfont">&#xe62c;</i>编辑</span>
            <span class="span_2" f='cofirm-delAddress' data-id="<!--{$volist.addrid}-->"><i class="iconfont">&#xe62b;</i>删除</span>
        </p>
    </dd>
</dl>
<div class="ge"></div>
<!--{/foreach}-->

<!--弹出框提示-->
<div id="varpop_shade" class="varpop-shade"></div>
<div class="confirm-layout" id="cancel_box" style="display: none;">
    <p>确定要删除该地址吗？</p>
    <div class="confirm-list">
        <input type="hidden" name="ajax" id="ajax" value="0">
        <div class="confirm-l" f="close_var" data-id="cancel_box">取消</div>
        <div class="confirm-r"  f="delAddress" data-id="cancel_box">确定</div>
        <div class="clear"></div>
    </div>
</div>
<script>
    //取消操作
    $(document).on("click", "[f='close_var']", function(){
        $_box = $(this).attr("data-id");
        $("#varpop_shade").hide();
        $("#"+$_box).fadeOut(200);
    });

    //删除操作 调出确认框
    $(document).on("click", "[f='cofirm-delAddress']", function(){
        $_id = $(this).attr("data-id");
        $("#ajax").val($_id);
        $("#varpop_shade").show();
        tabPopMarginAuto("cancel_box");
        $("#cancel_box").fadeIn(200); //显示
    });

    //确定删除
    $(document).on("click", '[f="delAddress"]', function(){
        $id = $("#ajax").val();
        $postjson = {url:"<!--{$oefile}-->&c=<!--{$c}-->&a=del&id="+$id, type:"other", success_text:"删除成功", callback:"delCallback()" };
       _oemarryAjaxPost($postjson);
        $_box = $(this).attr("data-id");
        $("#varpop_shade").hide();
        $("#"+$_box).fadeOut(200);
    });
    //删除回调
    function delCallback(){
        $id = $("#ajax").val();
        $('[data-del="address_'+$id+'"]').remove();
    }

    $(document).on("click", '[f="setdefault"]', function(){
        $_id = $(this).attr("data-id");
        $this = $(this);
        $postjson = {url:"<!--{$oefile}-->&c=<!--{$c}-->&a=setdefault&id="+$_id, type:"other", success_text:"设置成功", callback:"setDefCallback($this)" };
        _oemarryAjaxPost($postjson);
    });

    function setDefCallback($this){
        $('[f="setdefault"]').removeClass("current");
        $this.addClass("current");
    }

    $(document).on("click", '[f="modify-edit"]', function(){
        $id = $(this).attr("data-id");
        //异步调取用户收货地址列表 管理收货地址
        $url = "<!--{$oefile}-->&c=<!--{$c}-->&a=ajaxedit&id="+$id;
        _oemarryAjaxGetContent($url, "saveedit-address");
        $('[f="saveedit-address"]').show();
        $('[f="saveedit-address"]').animate({ left: '0px' }, "100");
    });
</script>
<!--{/if}-->

<!--{if $a == 'ajaxadd'}-->
<dl style="border-top:1px solid #ebebeb;">
    <dt>收 货 人</dt>
    <dd><input type="text" name="contname" id="contname" f="data-post" data-flag="1" data-prompt="请输入收货人姓名"  placeholder="请输入收货人姓名" /></dd>
</dl>
<dl>
    <dt>联系电话</dt>
    <dd><input type="text" name="contphone" id="contphone" f="data-post" data-flag="1" data-prompt="请输入联系电话" placeholder="请输入联系电话" /></dd>
</dl>
<dl>
    <dt>所在地区</dt>
    <dd>
        <label>
            <!--{area type='select' name='area' depth='1' child='1' text='请选择'}-->
            <span id="json_area2">
              <select name="area2" id="area2"><option value="">请选择</option></select>
            </span>
            <span id="json_area3">
              <select name="area3" id="area3"><option value="">请选择</option></select>
            </span>
        </label>
        <i class="iconfont">&#xe615;</i>
    </dd>
</dl>
<dl>
    <dt>所在街道</dt>
    <dd><input type="text" name="street" id="street" f="data-post" data-flag="1" data-prompt="请输入街道详细地址" placeholder="街道详细地址" /></dd>
</dl>
<dl>
    <dt>邮政编码</dt>
    <dd><input type="text" name="zipcode" id="zipcode" f="data-post" data-flag="1" data-prompt="请输入邮政编码" placeholder="邮政编码" /></dd>
</dl>
<!--{/if}-->

<!--{if $a == 'ajaxedit'}-->
<dl style="border-top:1px solid #ebebeb;">
    <dt>收 货 人</dt>
    <dd><input type="text" name="contname" id="contname" value="<!--{$data.contname}-->" f="data-post" data-flag="1" data-prompt="请输入收货人姓名"  placeholder="请输入收货人姓名" /></dd>
</dl>
<dl>
    <dt>联系电话</dt>
    <dd><input type="text" name="contphone" id="contphone" value="<!--{$data.contphone}-->" f="data-post" data-flag="1" data-prompt="请输入联系电话" placeholder="请输入联系电话" /></dd>
</dl>
<dl>
    <dt>所在地区</dt>
    <dd>
        <label>
            <!--{area type='select' name='area' depth='1' child='1' text='请选择' value=$data.area1}-->
            <span id="json_area2">
              <!--{if $data.area1 > 0}-->
              <!--{area type='select' name='area' depth='2' child='1' text='请选择' parentid=$data.area1 value=$data.area2}-->
              <!--{else}-->
              <select name="area2" id="area2"><option value="">请选择</option></select>
              <!--{/if}-->
            </span>
            <span id="json_area3">
              <!--{if $data.area2 > 0}-->
              <!--{area type='select' name='area' depth='3' child='1' text='请选择' parentid=$data.area2 value=$data.area3}-->
              <!--{else}-->
              <select name="area3" id="area3"><option value="">请选择</option></select>
              <!--{/if}-->
            </span>
        </label>
        <i class="iconfont">&#xe615;</i>
    </dd>
</dl>
<dl>
    <dt>所在街道</dt>
    <dd><input type="text" name="street" id="street" value="<!--{$data.street}-->" f="data-post" data-flag="1" data-prompt="请输入街道详细地址" placeholder="街道详细地址" /></dd>
</dl>
<dl>
    <dt>邮政编码</dt>
    <dd><input type="text" name="zipcode" id="zipcode" value="<!--{$data.zipcode}-->" f="data-post" data-flag="1" data-prompt="请输入邮政编码" placeholder="邮政编码" /></dd>
</dl>
<input type="hidden" name="id" id="id" value="<!--{$data.addrid}-->" f="data-post" data-flag="1" data-prompt="" placeholder="" />
<!--{/if}-->