index.html
3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>2.5地址管理</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1, minimum-scale=1">
<link rel="stylesheet" href="__TMPL__/public/assets/css/base.css">
<link rel="stylesheet" href="__TMPL__/public/assets/css/swiper.min.css">
<link rel="stylesheet" href="__TMPL__/public/assets/css/common/address_manage.css">
<script src="__TMPL__/public/assets/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/assets/js/swiper.min.js" type="text/javascript" charset="utf-8"></script>
<script src="__TMPL__/public/assets/js/base.js" type="text/javascript" charset="utf-8"></script>
<style>
</style>
</head>
<body>
<div class="container">
<div class="address_out_box" style="padding-bottom: 1.5rem;">
<volist name="list" id="list">
<div class="address_in_box">
<div class="user_box">
<div class="left_ltem">
<p class="user_name">{$list.name}</p>
<span class="phone"> {$list.tel}</span>
</div>
<div class="right_item">
<p class="moren">
<p class="moren_box <eq name='list.is_check' value='1'>choose_box</eq>" index="{$list.id}">
<img class="duigou" src="__TMPL__/public/assets/images/duigou.png" alt=""></p> 默认地址
</p>
</div>
</div>
<div class="address_box" index="{$list.id}">
<p class="user_address">{$list.city}{$list.address}
<span class="edit_box" index="{$list.id}">
<a href="{:url('Address/edit',array('id'=>$list.id))}">
<img class="add_pic" src="__TMPL__/public/assets/images/edit.png" alt="">
</a>
<img class="del_icon" src="__TMPL__/public/assets/images/delete.png" alt="">
</span>
</p>
</div>
</div>
</volist>
</div>
</div>
<footer class="footer">
<p class="add_address">新增收货地址</p>
</footer>
</div>
<script>
//默认地址勾选
$('.moren_box').on('click', function() {
var address_id = $(this).attr('index');
var obj = $(this);
console.log(address_id)
$.ajax({
type: "POST",
url: "{:url('Address/isCheck')}",
data: {
"address_id": address_id,
},
success: function (data) {
if (data.code == '1') {
$('.moren_box').removeClass('choose_box');
obj.addClass('choose_box');
} else {
alert(data.message);
}
},
error: function () {
}
})
})
//添加地址跳转
$('.add_address').on('click', function() {
window.location.href = "{:url('Address/add')}"
})
// 删除
$('.del_icon').click(function () {
var id = "{$list.id}";
$.ajax({
type:"POST",
url:"{:url('Address/del')}",
data:{
"id":id,
},
success:function (data) {
alert(data.message);
window.location.reload()
},
error:function () {
}
})
})
</script>
</body>
</html>