forked from ds-mall/mall-pc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
address.html
156 lines (143 loc) · 4.94 KB
/
address.html
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">
<title>吃货多多用户中心 - 地址管理</title>
<link rel="shortcut icon" href="img/foodie.ico" />
<link href="AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
<link href="AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">
<link href="css/personal.css" rel="stylesheet" type="text/css">
<link href="css/addstyle.css" rel="stylesheet" type="text/css">
<script src="AmazeUI-2.4.2/assets/js/jquery.min.js" type="text/javascript"></script>
<script src="AmazeUI-2.4.2/assets/js/amazeui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<div id="addressList">
<div class="nav-table">
<div class="long-title"><span class="all-goods" style="font-weight: bold;">用户中心</span></div>
</div>
<b class="line"></b>
<div class="center">
<div class="col-main">
<div class="main-wrap">
<div class="user-address">
<!--标题 -->
<div class="am-cf am-padding">
<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">地址管理</strong> / <small>Address list</small></div>
</div>
<hr/>
<ul class="am-avg-sm-1 am-avg-md-3 am-thumbnails">
<li v-for="(address, addressIndex) in addressList" :key="addressIndex" :class="['user-addresslist', {'defaultAddr':address.isDefault == 1}]" style="margin-top: 6px;">
<span class="new-option-r" v-show="address.isDefault == 1">
<i class="am-icon-check-circle"></i>默认地址
</span>
<p class="new-tit new-p-re">
<span class="new-txt">{{address.receiver}}</span>
<span class="new-txt-rd2">{{address.mobile}}</span>
</p>
<div class="new-mu_l2a new-p-re">
<p class="new-mu_l2cw">
<span class="title">地址:</span>
<span class="province">{{address.province}}</span>
<span class="city">{{address.city}}</span>
<span class="dist">{{address.district}}</span>
<span class="street">{{address.detail}}</span></p>
</div>
</li>
</ul>
<div class="clear"></div>
</div>
</div>
<!--底部-->
<div class="footer ">
<div class="footer-hd ">
<p>
<a href="https://github.com/dsying" target="_blank">Github</a>
<b>|</b>
<a href="https://juejin.im/user/5b0e60f6f265da08f0339162" target="_blank">掘金社区</a>
</p>
</div>
<div class="footer-bd ">
<p><em></em></p>
</div>
</div>
</div>
<aside class="menu">
<ul>
<li class="person">
<span style="font-weight: bold;">
<a href="center.html">个人中心</a>
</span>
</li>
<li class="person">
<a href="#">个人资料</a>
<ul>
<li> <a href="userinfo.html">我的信息</a></li>
<!-- <li> <a href="safety.html">安全设置</a></li> -->
<li class="active"> <a href="address.html">收货地址</a></li>
</ul>
</li>
<li class="person">
<a href="#">我的交易</a>
<ul>
<li><a href="order.html">订单管理</a></li>
<li> <a href="comment.html">我的评价</a></li>
</ul>
</li>
</ul>
</aside>
</div>
</div>
<script type="text/javascript" src="js/app.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script type="text/javascript">
var index = new Vue({
el: "#addressList",
data: {
userIsLogin: false,
userInfo: {},
addressList: {},
},
created() {
// var me = this;
// 通过cookie判断用户是否登录
app.judgeUserLoginStatus(this);
// 渲染地址信息
this.renderAddressList();
},
methods: {
renderAddressList() {
var userInfo = this.userInfo;
// 请求后端获得最新数据
var serverUrl = app.serverUrl;
axios.defaults.withCredentials = true;
axios.get(
serverUrl + '/address/list?userId=' + userInfo.id,
{
headers: {
'headerUserId': userInfo.id,
'headerUserToken': userInfo.userUniqueToken
}
})
.then(res => {
if (res.data.status == 200) {
var addressList = res.data.data;
console.log(addressList);
this.addressList = addressList;
} else if (res.data.status == 500) {
alert(res.data.msg);
console.log(res.data.msg);
} else {
alert(res.data.msg);
console.log(res.data.msg);
}
});
},
}
});
</script>
</body>
</html>