审查视图

public/themes/simpleboot3/portal/personalcenter/address_edit.html 4.4 KB
5  
anyv authored
1 2 3 4 5 6 7
<!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">
4  
anyv authored
8
    <title>学考无忧-地址编辑</title>
5  
anyv authored
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
    <link rel="stylesheet" href="__TMPL__/public/assets/css/mui.min.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css/mui.picker.min.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css/reset.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css/base.css">
    <style>
        .mui-poppicker-header,
        .mui-picker {
            background-color: white;
        }
    </style>
</head>

<body>
<div class="add_addressBox">
    <!-- 顶部 -->
    <div class="ad_top" style="background-color:white;">
        <a href="javascript:history.back(-1)">
            <img class="ad_topImg" src="__TMPL__/public/assets/images/left.png" alt="">
        </a>
4  
anyv authored
28
        <h1>收货地址编辑</h1>
5  
anyv authored
29 30 31 32 33 34 35
        <p style="color:#FF7700;" onclick="add_save()">保存</p>
    </div>
    <!-- 内容 -->
    <div class="add_con">
        <ul>
            <li>
                <label for="">姓名</label>
4  
anyv authored
36
                <input type="text" placeholder="请输入姓名" id="name" value="{$data.name}">
5  
anyv authored
37 38 39
            </li>
            <li>
                <label for="">手机号</label>
4  
anyv authored
40
                <input type="text" placeholder="请输入手机号" id="phone" value="{$data.phone}">
5  
anyv authored
41 42 43
            </li>
            <li class="add_conThere">
                <label for="">地区</label>
4  
anyv authored
44
                <div class="add_city" id="city_text" type="text" placeholder="">{$data.region}</div>
5  
anyv authored
45 46
                <img src="__TMPL__/public/assets/images/29.png" alt="">
            </li>
anyv authored
47
            <input type="hidden" name="id" value="{$data.id}" id="id">
5  
anyv authored
48 49
            <li>
                <label for="">详细地址</label>
4  
anyv authored
50
                <input type="text" placeholder="街道、小区、门牌号码" id="address_content" value="{$data.detailed0}">
5  
anyv authored
51 52 53
            </li>
        </ul>
        <div class="add_detailAddress">
4  
anyv authored
54
            <textarea placeholder="请输入详细地址,不少于15字" maxlength="200" id="address_content_con">{$data.detailed1}</textarea>
5  
anyv authored
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
        </div>
    </div>
</div>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/mui.min.js"></script>
<script src="__TMPL__/public/assets/js/mui.picker.min.js"></script>
<script src="__TMPL__/public/assets/js/city.data-3.js"></script>
<script>
    /**
     *保存
     */
    function add_save(){
        if($('#name').val() == ''){
            alert('姓名不能为空');
        }else if($('#phone').val() == ''){
            alert('手机号不能为空');
        }else if($('#city_text').text() == ''){
            alert('地区不能为空');
        }else if($('#address_content').val() == ''){
            alert('详细地址不能为空');
        }else{
anyv authored
77
            id = $('#id').val();
5  
anyv authored
78 79 80 81 82
            name = $('#name').val();
            phone = $('#phone').val();
            region = $('#city_text').text();
            address_content = $('#address_content').val();
            address_content_con = $('#address_content_con').val();
anyv authored
83 84
            detailed = address_content+','+address_content_con;
            $.post("{:url('Personalcenter/address_edit')}",{id:id,name:name,phone:phone,region:region,detailed:detailed},function(data){
5  
anyv authored
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
                if(data){
                    window.location.href = "{:url('Personalcenter/shop_address')}";
                }else{
                    alert('保存失败!');
                }
            });
        }
    }

</script>
<script>
    //mui 地址
    var city_picker = new mui.PopPicker({
        layer: 3
    });
    city_picker.setData(cityData3);
    $("#city_text").on("tap", function() {
        setTimeout(function() {
            city_picker.show(function(items) {
                $("#city_text").text((items[0] || {}).text + "," + (items[1] || {}).text + "," + (items[2] || {}).text); //该ID为接收城市ID字段
                $('#city_text').css('color', 'black');
                $("#city_text").html((items[0] || {}).text + " " + (items[1] || {}).text + " " + (items[2] || {}).text);
            });
        }, 200);
    });
</script>
</body>

</html>