address_list.html
8.91 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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<!DOCTYPE html >
<html>
<head>
<meta name="Generator" content="tpshop" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>地址列表-{$tpshop_config['shop_info_store_title']}</title>
<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
<meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<link rel="stylesheet" href="__STATIC__/css/public.css">
<link rel="stylesheet" href="__STATIC__/css/user.css">
<script src="__STATIC__/js/layer.js"></script>
<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__PUBLIC__/js/mobile_common.js"></script>
</head>
<style>
.list_footers a{
display: block;
width: 50%;
border-radius: 20px;
height: 30px;
line-height: 30px;
background:rgb(239, 22, 51) ;
font-size: 16px;
margin: auto;
color: #fff;
text-align: center;
}
.address_add{
width: 100%;
padding: 15px 20px;
}
.address_add dl{
border-bottom: none;
width: 81%;
}
.address_add dl dt em{
float: none;
font-weight: bold;
}
.morendizhi{
background:rgb(239, 22, 51);
padding: 2px 5px;
color: #fff;
text-align: center;
border-radius: 5px;
font-size: 10px;
}
.address_add dl dt span{
width: 50px;
}
.addressmone .add_def, .operation .add_def{width: 20px;height: 20px;border: 1px solid #eee!important;background-color: #fff;
border-radius: 50%;-moz-border-radius:50%;-webkit-border-radius: 50%; vertical-align: middle;display: inline-block;*display: inline;*zoom: 1;}
.address_add dl dd {
line-height: 15px;
}
.operation-frame{
margin: 0px 0px;
border-bottom: 1px solid #eee;
}
.add_class{
max-height: 28px;
height: auto;
margin-bottom: 10px;
}
.operationBtn{
padding-top: 10px;
}
.list_footers{
width: 100%;
height: 75px;
background: #FFF;
position: fixed;
bottom: 0px;
max-width: 720px;
}
</style>
<body style="overflow-x: hidden;">
<include file="public/menu" />
<include file="public/navBall" />
<div id="tbh5v0" style="overflow-x: hidden;">
<dl style="line-height: 40px; border-bottom: #eee solid 1px;background: url(__STATIC__/images/distribut/left.png) no-repeat 95% center;background-size: 11px 20px; display: none" id="btnwxaddress">
<img src="__STATIC__/images/user/wximg.png" style="width: 20px;height: 20px; padding-left: 5px;" />
<span>获取微信收货地址</span>
</dl>
<!--没有地址时显示-->
<div class="map">
<img src="__STATIC__/images/user/map.png" />
<p>您还没有添加收货地址</p>
</div>
<div id="ajaxreturn">
<volist name="lists" id="list">
<div class="address_add flex ai_center operation-frame" aid="{$list.address_id}">
<!-- <div class="operation" aid="{$list.address_id}">
<!–<div class="add_def <if condition='$list.is_default eq 1'>add_def_on</if>"></div>–>
</div>-->
<div class="flex ai_center" style="width: 95%">
<dl class="operation" aid="{$list[address_id]}">
<dt class="flex ai_center"><span>{$list.consignee}</span><em>{$list.mobile}</em> <if condition='$list.is_default eq 1'><div class="morendizhi">默认地址</div></if></dt>
<dd class="ellipsis-2 add_class">{$list.more_address}<br/>{$list.address}</dd>
</dl>
<div class="operationBtn">
<a href="{:U('/Mobile/User/edit_address',array('stoid'=>$Think.request.stoid,'id'=>$list[address_id],'source'=>$Request.param.source))}">
<img src="__STATIC__/images/user_card/zantian.png" style="width:20px;" />
</a>
<!--<a onclick="deladdress(this)" aid="{$list.address_id}">
<img src="__STATIC__/images/user/del.png" style="width: 19px;height: 20px;" /><i>删除</i>
</a>-->
</div>
<p class="clear"></p>
</div>
</div>
</volist>
</div>
</div>
<div style=" width:100%; height:50px;"></div>
<div class="list_footers flex ai_center">
<a href="{:U('/Mobile/User/add_address',array('stoid'=>$Think.request.stoid,'source'=>$Request.param.source,'stoid'=>$Think.request.stoid))}">+新建收货地址</a>
</div>
<input id="fstoid" type="hidden" value="{$Think.request.stoid}"/>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
var wxstoid={$Think.request.stoid};
$(function() {
var str = $(".address_add").text();
if (str.length == 0) {
$(".map").removeClass("dn");
} else {
$(".map").addClass("dn");
}
if(isWeiXin()){
$.ajax({
type : "POST",
url:"/index.php?m=Mobile&c=Index&a=ajaxGetWxConfig&stoid="+wxstoid+"&t="+Math.random(),
data:{'askUrl':encodeURIComponent(location.href.split('#')[0])},
dataType:'JSON',
success: function(res)
{
wx.config({
debug: false,
appId: res.appId,
timestamp: res.timestamp,
nonceStr: res.nonceStr,
signature: res.signature,
jsApiList: ['openAddress'] // 功能列表,我们要使用JS-SDK的什么功能
});
$("#btnwxaddress").show();
wx.ready(function () {
$('#btnwxaddress').click(function(){
wx.openAddress({
success: function (res) {
var userName = res.userName; // 收货人姓名
var postalCode = res.postalCode; // 邮编
var provinceName = res.provinceName; // 国标收货地址第一级地址(省)
var cityName = res.cityName; // 国标收货地址第二级地址(市)
var countryName = res.countryName; // 国标收货地址第三级地址(国家)
var detailInfo = res.detailInfo; // 详细收货地址信息
var nationalCode = res.nationalCode; // 收货地址国家码
var telNumber = res.telNumber; // 收货人手机号码
//
var mm=layer.open({content:'加载中',time:2});
$.ajax({
type: "POST",
url: '/index.php/Mobile/user/addwx_address/stoid/'+wxstoid,
data: {'userName':userName,'postalCode':postalCode,'provinceName':provinceName,'cityName':cityName,'countryName':countryName,'detailInfo':detailInfo,'telNumber':telNumber},
dataType: "json",
success: function (data) {
layer.close(mm);
if (data.code ==0) {
window.location.href=window.location.href;
}else{
layer.open({content:data.msg,time:2});
}
},
error: function () {
layer.close(mm);
layer.open({
content: '网络异常',
time: 2
});
}
});
//
}
});
});
});
},
error:function(){
return false;
}
});
}
});
$(".operation").click(function(){
var ooj=$(this);
var id=ooj.attr("aid");
var mm = layer.open({
type: 2
});
$.ajax({
type: "POST",
url: '/index.php/Mobile/user/set_default/stoid/' + $("#fstoid").val() +"/id/"+id,
data: $('#cart2_form').serialize(),
dataType: "json",
success: function (data) {
layer.close(mm);
if (data.code ==0) {
$(".add_def").removeClass("add_def_on");
$(".operation i").removeClass("red");
$(".operation i").addClass("def");
$(".operation i").text("设为默认");
ooj.find(".add_def").addClass("add_def_on");
ooj.find("i").removeClass("def");
ooj.find("i").addClass("red");
ooj.find("i").text("默认地址");
window.location.href=window.location.href;
}else{
layer.open({content:data.msg,time:2});
}
},
error: function () {
layer.open({
content: '网络异常',
time: 2
});
}
});
});
function goTop() {
$('html,body').animate({
'scrollTop': 0
}, 600);
}
/*--删除地址--*/
function deladdress(ob) {
var id=$(ob).attr("aid");
var ii = layer.open({
type: 2,
content: '正在删除',
shadeClose: false
});
$.ajax({
type: "POST",
url: '/index.php/Mobile/user/deladdress/stoid/' + $("#fstoid").val() +"/id/"+id,
dataType: "json",
success: function (data) {
layer.close(ii);
var ii2 = layer.open({
type: 2,
shadeClose: false
});
$.ajax({
type: "POST",
url: '/index.php/Mobile/user/ajaxaddressreturn/stoid/' + $("#fstoid").val(),
dataType: "json",
success: function (data) {
layer.close(ii2);
$("#ajaxreturn").html(data);
if($.trim(data)==""){
$(".map").removeClass("dn");
}
window.location.href=window.location.href;
},
error: function () {
layer.close(ii2);
layer.open({content: '网络异常',time: 2});
}
});
},
error: function () {
layer.open({
content: '网络异常',
time: 2
});
}
});
}
function isWeiXin(){
var ua = window.navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == 'micromessenger'){
return true;
}else{
return false;
}
}
</script>
<a href="javascript:goTop();" class="gotop"><img src="__STATIC__/images/topup.png"></a>
</div>
</body>
</html>