shop_address.html 6.3 KB
<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>学考无忧-收货地址</title>
    <link rel="stylesheet" href="__TMPL__/public/assets/css/reset.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css/base.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css/log.css">
    <style>
        .tx_mask_delete {
            display: none;
            z-index: 2;
            width: 100%;
            height: 100%;
            position: fixed;
            background-color: rgba(0, 0, 0, 0.5);
        }

        .delete_school {
            font-size: 0.32rem;
            color: #333;
            text-align: center;
        }

        .delete_btn {
            display: flex;
            display: -webkit-flex;
            justify-content: space-around;
            align-items: center;
        }

        .tx_maskcancel {
            width: 100%;
            height: 0.8rem;
            background: #f2f2f2;
            border-radius: 0.08rem;
            text-align: center;
            line-height: 0.8rem;
            color: #333;
            font-size: 0.32rem;
            margin-top: 0.4rem;
            margin-right: 0.5rem;
        }

        .tx_maskYes {
            width: 100%;
            height: 0.8rem;
            background: linear-gradient(338deg, rgba(255, 78, 0, 1) 0%, rgba(255, 157, 45, 1) 100%);
            border-radius: 0.08rem;
            text-align: center;
            line-height: 0.8rem;
            color: white;
            font-size: 0.32rem;
            margin-top: 0.4rem;
            margin-left: 0.5rem;
        }
    </style>
</head>

<body style="background-color:white;">
<div class="address_box">
    <!-- 删除弹窗 -->
    <div class="tx_mask_delete" onclick="$(this).hide()">
        <div class="tx_maskCon" onclick="zZFun(this)">
            <div class="tx_maskCon2" style="border-radius: 0.1rem;">
                <div class="delete_school">
                    是否确定删除?
                </div>

                <div class="delete_btn">
                    <div class="tx_maskcancel">取消</div>
                    <div class="tx_maskYes">确定</div>
                </div>
            </div>
        </div>
    </div>
    <!-- 顶部 -->
    <div class="ad_top">
        <a href="javascript:history.back(-1)">
            <img class="ad_topImg" src="__TMPL__/public/assets/images/left.png" alt="">
        </a>
        <h1>收货地址</h1>
        <a href="{:url('Personalcenter/add_shop_address')}">
            <p>新增地址</p>
        </a>
    </div>
    <!-- 内容 -->
    <div class="ad_content">
        <ul id="ad_contentUl">
            <volist name="data" id="vo">
                <li ontouchstart="fors()" class="com">
                    <div class="ad_conBox">
                        <div class="ad_con1">
                            <p class="ad_conName">{$vo.name}</p>
                            <if condition="$vo.default_address eq 1">
                                <p class="ad_conMo" style="display:block;">默认</p>
                                <else/>
                                <p class="ad_conMo">默认</p>
                            </if>

                            <p class="ad_conPhone">{$vo.phone}</p>
                                <img class="ad_conImg" src="__TMPL__/public/assets/images/35.png" ontouchstart="address_edit({$vo.id})" alt="">
                        </div>
                    </div>
                    <div class="jiantou" style="display: flex;display: -webkit-flex;justify-content: space-between;align-items: center">
                        <div class="jiantou_title"><p class="ad_conAddress">收货地址:{$vo.region}{$vo.detailed}</p></div>
                        <div class="jiantou_img" style="margin-top: 0.15rem;"><img class="ad_conImg" src="__TMPL__/public/assets/images/zuojiantou.png" alt=""></div>
                    </div>

                    <div class="ad_MoRemove">
                        <div class="ad_mo" ontouchstart="set_default({$vo.id})">设为默认</div>
                        <!--<div class="ad_move" ontouchstart="address_del({$vo.id})">删除</div>-->
                        <div class="ad_move" ontouchstart="fun(this)" data-id="{$vo.id}">删除</div>
                    </div>
                </li>
            </volist>
        </ul>
    </div>
</div>
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/address.js"></script>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script>

    function fors() {
        console.log(111)
    }

    /**
     *点击设置默认
     */
    function set_default(id){
        $.post("{:url('Personalcenter/set_default_address')}",{id:id},function(data){
            if(data){
            }else{
                alert('设置失败!');
            }
        });
    }

    /**
     * 点击删除地址
     */
    var id;
    function address_del(id){
        $.post("{:url('Personalcenter/address_del')}",{id:id},function(data){
            if(data){
            }else{
                alert('删除失败!');
            }
        });
    }
    //删除
    let index = ''

    function fun(e){
        console.log(e)
        id=$(e).attr("data-id");
        console.log(id)
        index = $(e).parents(".com").index();
        console.log(index)
        $(".tx_mask_delete").css({
            display: "block"
        });
    };
    $(".tx_maskYes").click(function() {
        console.log(index)
        var len = $(".com");
        console.log(len)
        for(var i = 0; i < len.length; i++) {
            if(i == index) {
                $(len[i]).remove()
            };
            $(".tx_mask_delete").css({
                display: "none"
            });
        }

        address_del(id)
    })
    $(".tx_maskcancel").click(function() {
        $(".tx_mask_delete").css({
            display: "none"
        });
    })
    function zZFun(e) {
        window.event ? (window.event.cancelBubble = true) : e.stopPropagation();
    }

    /**
     *编辑地址
     */
    function address_edit(id){
        window.location.href = "{:url('Personalcenter/address_edit')}?id="+id;
    }
</script>
</body>

</html>