394 lines
15 KiB
HTML
394 lines
15 KiB
HTML
|
|
<!doctype html>
|
|||
|
|
<html>
|
|||
|
|
|
|||
|
|
<head>
|
|||
|
|
<meta charset="utf-8">
|
|||
|
|
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
|
|||
|
|
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
|
|||
|
|
<title>我的地址</title>
|
|||
|
|
<link rel="stylesheet" type="text/css" href="/css/api.css" />
|
|||
|
|
<link rel="stylesheet" type="text/css" href="/css/content.css" />
|
|||
|
|
<script type="text/javascript" src="/scripts/jquery-3.4.1.min.js"></script>
|
|||
|
|
<script type="text/javascript" src="/scripts/jquery.cookie.min.js"></script>
|
|||
|
|
<!--<script type="text/javascript" src="/scripts/iscroll.js"></script>-->
|
|||
|
|
<script type="text/javascript" src="/script/main.js?t=0"></script>
|
|||
|
|
<script type="text/javascript" src="/layer/layer.js"></script>
|
|||
|
|
<script type="text/javascript" src="/Scripts/long.js"></script>
|
|||
|
|
<script type="text/javascript" src="/script/moment.js"></script>
|
|||
|
|
<script type="text/javascript" src="/script/area.js?t=0"></script>
|
|||
|
|
<script type="text/javascript" src="/script/api.js"></script>
|
|||
|
|
<style type="text/css">
|
|||
|
|
html, body {
|
|||
|
|
overflow: hidden;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#wrapper {
|
|||
|
|
flex: 1;
|
|||
|
|
overflow-y: auto;
|
|||
|
|
-webkit-overflow-scrolling: touch;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.pullDown {
|
|||
|
|
position: absolute;
|
|||
|
|
top: -1.25rem;
|
|||
|
|
left: 0;
|
|||
|
|
width: 100%;
|
|||
|
|
z-index: 100;
|
|||
|
|
text-align: center;
|
|||
|
|
display: none;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.pullUp {
|
|||
|
|
position: absolute;
|
|||
|
|
bottom: -1.25rem;
|
|||
|
|
left: 0;
|
|||
|
|
width: 100%;
|
|||
|
|
z-index: 100;
|
|||
|
|
text-align: center;
|
|||
|
|
display: none;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.pullDown.loading, .pullUp.loading, .pullDown.refresh, .pullUp.refresh {
|
|||
|
|
display: block;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.dbtnbox {
|
|||
|
|
margin: 0 auto;
|
|||
|
|
width: 100%;
|
|||
|
|
text-align: center;
|
|||
|
|
padding: 0;
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.dbtnbox input[type='button'] {
|
|||
|
|
height: 3.5em;
|
|||
|
|
line-height: 3.5em;
|
|||
|
|
border-radius: 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.uploadpic_btn {
|
|||
|
|
position: absolute;
|
|||
|
|
width: 5em;
|
|||
|
|
height: 5em;
|
|||
|
|
right: 0;
|
|||
|
|
top: 0;
|
|||
|
|
opacity: 0;
|
|||
|
|
filter: alpha(opacity=0);
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
var userId = null;
|
|||
|
|
var LoginId = null;
|
|||
|
|
var CartId = null;
|
|||
|
|
var opentimes = null;
|
|||
|
|
var sInterval0 = null;
|
|||
|
|
var t = 0, iflayer=0;
|
|||
|
|
var image = "", avatar = "", img_url = "";
|
|||
|
|
var myScroll = null;
|
|||
|
|
var pullDown = 1; // 下拉刷新避免多次执行
|
|||
|
|
var pullUp = 1; // 上拉加载避免多次执行
|
|||
|
|
var downHeight = 0;
|
|||
|
|
var upHeight = 0;
|
|||
|
|
var isload = true;//设置是否终止滚动加载
|
|||
|
|
var curScrollHeight = 0;//当前滚动位置
|
|||
|
|
var curCount = 1;//计数器,防止滚动时重复执行加载下一页
|
|||
|
|
|
|||
|
|
$(document).ready(function () {
|
|||
|
|
userId = getlocalStorage("userId");
|
|||
|
|
LoginId = getlocalStorage("LoginId");
|
|||
|
|
CartId = getlocalStorage("CartId");
|
|||
|
|
var qygm = getlocalStorage('qygm');
|
|||
|
|
if (qygm != null) {
|
|||
|
|
if (qygm == 2) {
|
|||
|
|
iflayer = 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
opentimes = setInterval(function () {
|
|||
|
|
var myrefresh = getlocalStorage("myaddress_add_refresh");
|
|||
|
|
if (myrefresh != null) {
|
|||
|
|
rdata(0);
|
|||
|
|
clearlocalStorage("myaddress_add_refresh");
|
|||
|
|
}
|
|||
|
|
}, 1000);
|
|||
|
|
rdata(1);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
function rdata(ag) {
|
|||
|
|
|
|||
|
|
userId = getlocalStorage("userId");
|
|||
|
|
LoginId = getlocalStorage("LoginId");
|
|||
|
|
if (ag == 1) {
|
|||
|
|
$(".ajaxLoader").removeClass("uhide");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'GET',
|
|||
|
|
url: "/apiajax.ashx",
|
|||
|
|
data: "&action=getAddress&ifweb=1&userId=" + (userId != null ? userId : "") + "&LoginId=" + (LoginId != null ? LoginId : ""),
|
|||
|
|
dataType: "JSON",
|
|||
|
|
error: function (xhr, type) {
|
|||
|
|
tishi3("发生错误:" + JSON.stringify(xhr));
|
|||
|
|
},
|
|||
|
|
success: function (data) {
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (data) {
|
|||
|
|
|
|||
|
|
if (data.status == 1) {
|
|||
|
|
|
|||
|
|
var html = "";
|
|||
|
|
for (i = 0; i < data.data.length; i++) {
|
|||
|
|
html += addAddress(data.data[i]);
|
|||
|
|
}
|
|||
|
|
$('#sysnew').html(html);
|
|||
|
|
$(".ajaxLoader").addClass("uhide");
|
|||
|
|
} else {
|
|||
|
|
|
|||
|
|
tishi3(data.msg);
|
|||
|
|
$(".ajaxLoader").addClass("uhide");
|
|||
|
|
if (data.msg == "您未登录") {
|
|||
|
|
onlink("/");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
tishi3("网络错误!");
|
|||
|
|
$(".ajaxLoader").addClass("uhide");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
function isDefault(id) {
|
|||
|
|
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'POST',
|
|||
|
|
url: "/apiajax.ashx",
|
|||
|
|
data: { "action": "setDefaultAddress", "userId": (userId != null ? userId : ""), "LoginId": (LoginId != null ? LoginId : ""), "addressId": id },
|
|||
|
|
dataType: "json",
|
|||
|
|
error: function (jqXHR) {
|
|||
|
|
tishi3("发生错误:" + JSON.stringify(xhr));
|
|||
|
|
},
|
|||
|
|
success: function (data) {
|
|||
|
|
if (data.status == 1) {
|
|||
|
|
tishi3(data.msg);
|
|||
|
|
$(".isDefault").removeClass("cbgb");
|
|||
|
|
$("#address_" + id + " .isDefault").addClass("cbgb");
|
|||
|
|
select(id);
|
|||
|
|
} else {
|
|||
|
|
tishi3(data.msg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
function addAddress(address) {
|
|||
|
|
var flag = address.IFIndex;
|
|||
|
|
var styleStr = "";
|
|||
|
|
if (flag == 1) {
|
|||
|
|
styleStr = " cbgb";
|
|||
|
|
}
|
|||
|
|
var qygm = getlocalStorage("qygm");
|
|||
|
|
var qyStr = "";
|
|||
|
|
if (qygm != null) {
|
|||
|
|
qyStr += '<div class="selectaddress_btn" onclick="select(\'' + address.addressId + '\')">'
|
|||
|
|
+ '选择' + '</div>';
|
|||
|
|
}
|
|||
|
|
var detail = getname(address.Province, address.City, address.County, address.IFFill, address.Tradingarea) + address.detail;
|
|||
|
|
var html = '<div id="address_' + address.addressId + '" contact="' + address.contact + '" tel="' + address.tel + '" Province="' + address.Province + '" City="' + address.City + '" County="' + address.County + '" IFFill="' + address.IFFill + '" Tradingarea="' + address.Tradingarea + '" detail="' + address.detail + '" class="ub ub-f1 ub-ver cbgw" style="margin-bottom: .8em;">'
|
|||
|
|
+ '<div class="ub ub-ver padding1" onclick="select(\'' + address.addressId + '\')">'
|
|||
|
|
+ '<div class="contact">'
|
|||
|
|
+ '<div class="uinl"> 收货人:</div>'
|
|||
|
|
+ '<div class="uinl a_contact">'
|
|||
|
|
+ address.contact + '</div>'
|
|||
|
|
+ ' <div class="ufr a_tel">'
|
|||
|
|
+ address.tel + '</div>'
|
|||
|
|
+ '</div>'
|
|||
|
|
+ '<div class="ub ulev-1 detail_a a_addr" >'
|
|||
|
|
+ '收货地址:' + detail + '</div>'
|
|||
|
|
+ '</div>'
|
|||
|
|
+ '<div class="ub" style="border-top: 1px solid #dfdfdf;color:#333;">'
|
|||
|
|
+ qyStr
|
|||
|
|
+ '<div class="ub padding1">'
|
|||
|
|
+ '<div class="ub isDefault' + styleStr + '" onclick="isDefault(\'' + address.addressId + '\')" style=" margin:0.2em .35em; "></div>'
|
|||
|
|
+ '<div class="ub" onclick="isDefault(\'' + address.addressId + '\')" style="margin-top:0em;">设为默认</div></div>'
|
|||
|
|
+ '<div class="ub ulev-1 ub-ac" style="padding: 1em 0.2em;margin-left: 0%;">'
|
|||
|
|
|
|||
|
|
+ '<div class="ub ub-ac" style="margin-right: 1.2em;" onclick="edit(' + "'" + address.addressId + "'" + ')">'
|
|||
|
|
+ '<img src="../image/Edit.png" style="height:1em;margin-right:0.2em;"/><div style="margin-top:-.3em;">编辑</div></div> '
|
|||
|
|
+ '<div class="ub ub-ac" onclick="Delete(' + "'" + address.addressId + "'" + ')"><img src="../image/Delete.png" style="height:1em;margin-right:0.2em;"/><div style="margin-top:-.2em;">删除</div></div>' + '</div>' + '</div>' + '</div>'
|
|||
|
|
return html;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function updateAddress(address) {
|
|||
|
|
address = JSON.parse(address);
|
|||
|
|
var contact = $("#address_" + address.addressId + " .a_contact");
|
|||
|
|
|
|||
|
|
var tel = $("#address_" + address.addressId + " .a_tel");
|
|||
|
|
var addr = $("#address_" + address.addressId + " .a_addr");
|
|||
|
|
$("#address_" + address.addressId).attr("Province", address.Province);
|
|||
|
|
$(contact).html(address.contact);
|
|||
|
|
$(tel).html(address.tel);
|
|||
|
|
var detail = getname(address.Province, address.City, address.County) + address.detail;
|
|||
|
|
$(addr).html("收货地址:" + detail);
|
|||
|
|
$("#address_" + address.addressId).attr("Province", address.Province);
|
|||
|
|
$("#address_" + address.addressId).attr("City", address.City);
|
|||
|
|
$("#address_" + address.addressId).attr("County", address.County);
|
|||
|
|
$("#address_" + address.addressId).attr("detail", address.detail);
|
|||
|
|
}
|
|||
|
|
function select(id) {
|
|||
|
|
var qygm = getlocalStorage('qygm');
|
|||
|
|
if (qygm != null) {
|
|||
|
|
var titaddress = "shop_qygm_selectaddress";
|
|||
|
|
if (qygm == 2) {
|
|||
|
|
titaddress = "myorders_info_selectaddress";
|
|||
|
|
}
|
|||
|
|
if (qygm == 3) {
|
|||
|
|
titaddress = "yydd_lqcp0_selectaddress";
|
|||
|
|
}
|
|||
|
|
var address_ = $("#address_" + id);
|
|||
|
|
var detail = getname($(address_).attr("Province"), $(address_).attr("City"), $(address_).attr("County"), $(address_).attr("IFFill"), $(address_).attr("Tradingarea")) + "/" + $(address_).attr("detail");
|
|||
|
|
setlocalStorage(titaddress, id + "," + $(address_).attr("Province") + "," + $(address_).attr("City") + "," + $(address_).attr("County") + "," + $(address_).attr("IFFill") + "," + $(address_).attr("Tradingarea") + "," + $(address_).attr("contact") + "," + $(address_).attr("tel") + "," + detail);
|
|||
|
|
|
|||
|
|
closeWin0();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
function closeWin0(){
|
|||
|
|
|
|||
|
|
if (iflayer == 1) {
|
|||
|
|
clearlocalStorage("qygm");
|
|||
|
|
parent.layer.closeAll();
|
|||
|
|
} else {
|
|||
|
|
clearlocalStorage("qygm");
|
|||
|
|
closeWin();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
function addaddress() {
|
|||
|
|
clearlocalStorage("address");
|
|||
|
|
if (iflayer == 1) {
|
|||
|
|
layer.open({
|
|||
|
|
type: 2,
|
|||
|
|
title: false,
|
|||
|
|
closeBtn: false,
|
|||
|
|
content: "myaddress_add.html",
|
|||
|
|
area: ['100%', '100%']
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
onlink("myaddress_add.html");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
function edit(addressId) {
|
|||
|
|
var address_ = $('#address_' + addressId);
|
|||
|
|
var contact = $(address_).attr('contact');
|
|||
|
|
var tel = $(address_).attr('tel');
|
|||
|
|
var Province = $(address_).attr('Province');
|
|||
|
|
var City = $(address_).attr('City');
|
|||
|
|
var County = $(address_).attr('County');
|
|||
|
|
var IFFill = $(address_).attr('IFFill');
|
|||
|
|
var Tradingarea = $(address_).attr('Tradingarea');
|
|||
|
|
var detail = $(address_).attr('detail');
|
|||
|
|
var address = {
|
|||
|
|
addressId: addressId,
|
|||
|
|
contact: contact,
|
|||
|
|
tel: tel,
|
|||
|
|
Province: Province,
|
|||
|
|
City: City,
|
|||
|
|
County: County,
|
|||
|
|
IFFill: IFFill,
|
|||
|
|
Tradingarea: Tradingarea,
|
|||
|
|
detail: detail,
|
|||
|
|
IFIndex: 0
|
|||
|
|
}
|
|||
|
|
if ($("#address_" + addressId + " .isDefault.cbgb").length>0) {
|
|||
|
|
address.IFIndex = 1;
|
|||
|
|
}
|
|||
|
|
setlocalStorage('address', JSON.stringify(address));
|
|||
|
|
if (iflayer == 1) {
|
|||
|
|
layer.open({
|
|||
|
|
type: 2,
|
|||
|
|
title: false,
|
|||
|
|
closeBtn: false,
|
|||
|
|
content: "myaddress_add.html",
|
|||
|
|
area: ['100%', '100%']
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
onlink("myaddress_add.html");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function Delete(addressId) {
|
|||
|
|
var index_ = layer.confirm('您确定要删除此地址吗?', {
|
|||
|
|
title: "删除提醒",
|
|||
|
|
btn: ['是', '否'] //按钮
|
|||
|
|
}, function () {
|
|||
|
|
$.ajax({
|
|||
|
|
type: 'POST',
|
|||
|
|
url: "/apiajax.ashx",
|
|||
|
|
data: { "action": "deleteAddress", "userId": userId, "LoginId": LoginId, "addressId": addressId },
|
|||
|
|
dataType: "json",
|
|||
|
|
error: function (jqXHR) {
|
|||
|
|
tishi3("发生错误:" + JSON.stringify(xhr));
|
|||
|
|
},
|
|||
|
|
success: function (data) {
|
|||
|
|
if (data.status == 1) {
|
|||
|
|
tishi3(data.msg);
|
|||
|
|
$api.remove($api.dom('#address_' + addressId));
|
|||
|
|
} else {
|
|||
|
|
tishi3(data.msg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
</head>
|
|||
|
|
|
|||
|
|
<body class="wrap">
|
|||
|
|
<header><div class="ub">
|
|||
|
|
<div class="nav-btn" id="nav-left" style=" margin:0; padding:0; padding-top:0.2em; min-width:3em" onclick="closeWin0()">
|
|||
|
|
|
|||
|
|
<img src="../image/faifei.png" style="margin-left:0; margin-top:0em; height:1.2em;width:1.2em;" />
|
|||
|
|
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<h1 class="ub-f1">
|
|||
|
|
我的地址
|
|||
|
|
</h1>
|
|||
|
|
<div class="nav-btn blue" id="nav-right" style=" margin:0; padding:0; min-width:4em; padding-right:1em;">
|
|||
|
|
<img src="../image/addto.png" title="添加地址" onclick='addaddress()' style="width: 1.2em;margin-top: .2em; cursor: pointer;" />
|
|||
|
|
</div>
|
|||
|
|
</div></header>
|
|||
|
|
|
|||
|
|
<section class="ub-f1" id="wrapper">
|
|||
|
|
|
|||
|
|
<div id="wrapper_content">
|
|||
|
|
|
|||
|
|
<p class="pullDown">下拉刷新...</p>
|
|||
|
|
<div class="clear"></div>
|
|||
|
|
<div class="maxcontent" style="padding:0.8em; box-sizing:border-box;">
|
|||
|
|
<div class="ub ub-ver" id="sysnew"> </div>
|
|||
|
|
</div>
|
|||
|
|
<div class="clear"></div>
|
|||
|
|
<p class="pullUp">上拉加载...</p>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</section>
|
|||
|
|
|
|||
|
|
<div class="ajaxLoader ub ub-ac uhide" onclick="reload()">
|
|||
|
|
<div class="ub ub-ac ub-ver"><img src="image/load.gif" /><br>正在加载...</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</body>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</html>
|