203 lines
7.5 KiB
Plaintext
203 lines
7.5 KiB
Plaintext
<%@ Page Title="" Language="C#" MasterPageFile="~/Telesa.Master" AutoEventWireup="true" CodeBehind="Member_address.aspx.cs" Inherits="Mtxfw.shop.Member_address" %>
|
|
<%@ Register src="Controls/Left.ascx" tagname="Left" tagprefix="uc1" %>
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="MyHead" runat="server">
|
|
<link href="css/member.css" rel="stylesheet" type="text/css" />
|
|
<script type="text/javascript">
|
|
var ifshow = 1;
|
|
</script>
|
|
<script type="text/javascript">
|
|
var pid = '<%=pid %>';
|
|
var cid = '<%=cid %>';
|
|
var qid = '<%=qid %>';
|
|
$(document).ready(function () {
|
|
$('#select_p').change(function () {//获取城市
|
|
getCity();
|
|
});
|
|
|
|
$('#select_c').change(function () {//获取县区
|
|
getCounty();
|
|
});
|
|
|
|
$('#select_p').val(pid);
|
|
getCity();
|
|
var IFaddress = <%=IFaddress %>;
|
|
if(IFaddress==1){
|
|
addnewaddress();
|
|
}
|
|
})
|
|
|
|
function getCity() {
|
|
if ($('#select_p').val() != '-1') {
|
|
$.post("/Ajax.ashx", { action: 'GetCity', ProvinceID: $('#select_p').val(), cityIDs: cid }, function (data) {
|
|
if (data != 'false') {
|
|
$('#select_c').html(data);
|
|
getCounty();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function getCounty() {
|
|
if ($('#select_c').val() != '-1') {
|
|
$.post("/Ajax.ashx", { action: 'GetCounty', CityID: $('#select_c').val(), countyIDs: qid }, function (data) {
|
|
if (data != 'false')
|
|
$('#select_q').html(data);
|
|
|
|
});
|
|
}
|
|
}
|
|
function toaddress() {
|
|
|
|
}
|
|
function addnewaddress() {
|
|
if($("#addressid").val()!=""){
|
|
$("#addressid").val("");
|
|
$("#Text_Name").val("");
|
|
$("#Text_Phone").val("");
|
|
$("#Text_MailingAddress").val("");
|
|
$("#Text_PostalCode").val("");
|
|
$("#savebtn").val("添加新地址");
|
|
$(".address_table").show();
|
|
}else{
|
|
$(".address_table").show();
|
|
}
|
|
$(".selectaddress").removeAttr("checked");
|
|
}
|
|
function saveaddress()
|
|
{
|
|
if ($("#Text_Name").val() == "") {
|
|
alert('联系人不能为空');
|
|
$("#Text_Name").focus();
|
|
return false;
|
|
}
|
|
if ($("#Text_Phone").val() == "") {
|
|
alert('联系电话不能为空');
|
|
$("#Text_Phone").focus();
|
|
return false;
|
|
}
|
|
if ($("#select_p").val() == "-1") {
|
|
alert('所在省份必须选择');
|
|
$("#select_p").focus();
|
|
return false;
|
|
}
|
|
if ($("#select_c").val() == "-1") {
|
|
alert('所在城市必须选择');
|
|
$("#select_c").focus();
|
|
return false;
|
|
}
|
|
if ($("#Text_MailingAddress").val() == "") {
|
|
alert('邮寄地址不能为空');
|
|
$("#Text_MailingAddress").focus();
|
|
return false;
|
|
}
|
|
$.post("/Ajax.ashx", { action: 'saveaddress', name: escape($("#Text_Name").val()), phone: escape($("#Text_Phone").val()), province: escape($("#select_p").val()), city: escape($("#select_c").val()), county: escape($("#select_q").val()), address: escape($("#Text_MailingAddress").val()), postalcode: escape($("#Text_PostalCode").val()), addressid: escape($("#addressid").val()) }, function (data) {
|
|
if (data == 'true') {
|
|
alert('保存成功');
|
|
top.location = top.location.toString();
|
|
}else{
|
|
alert(data);
|
|
}
|
|
});
|
|
}
|
|
function deladdress(id)
|
|
{
|
|
$.post("/Ajax.ashx", { action: 'deladdress', addressid: escape(id) }, function (data) {
|
|
if (data == 'true') {
|
|
alert('删除成功');
|
|
top.location = top.location.toString();
|
|
}else{
|
|
alert(data);
|
|
}
|
|
});
|
|
}
|
|
function setaddress(id)
|
|
{
|
|
$.post("/Ajax.ashx", { action: 'setaddress', addressid: escape(id) }, function (data) {
|
|
if (data == 'true') {
|
|
alert('设置成功');
|
|
top.location = top.location.toString();
|
|
}else{
|
|
alert(data);
|
|
}
|
|
});
|
|
}
|
|
function editaddress(id,name,tel,province,city,county,address,zipcode){
|
|
$(".address_table").show();
|
|
$("#addressid").val(id);
|
|
$("#Text_Name").val(name);
|
|
$("#Text_Phone").val(tel);
|
|
$("#select_p").val(province);
|
|
$("#select_c").val(city);
|
|
$("#select_q").val(county);
|
|
$("#Text_MailingAddress").val(address);
|
|
$("#Text_PostalCode").val(zipcode);
|
|
$("#selectaddress" + id).attr("checked","true");
|
|
$("#savebtn").val("保存编辑");
|
|
}
|
|
</script>
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="MyContent" runat="server">
|
|
<form id="form1" runat="server">
|
|
<div id="main">
|
|
<div id="Location">当前位置: <a href="/" class="red">首页</a> > <a href="/Member_Index.aspx">会员中心</a> > 配送地址</div>
|
|
<div id="member" class="f_clear">
|
|
<uc1:Left ID="Left1" runat="server" />
|
|
<div class="right">
|
|
<div id="membertab">
|
|
<h2>配送地址<span class="title"><input type="button" value="添加新地址" class="returnbtn" onclick="addnewaddress();" /></span></h2>
|
|
<div class="addresslist"><ul><li><%=addresslist%></ul></div>
|
|
<table cellSpacing="0" class="address_table" style=" display:none;">
|
|
<tr>
|
|
<th>联 系 人</th>
|
|
<td><input id="Text_Name" name="Text_Name" value="<%=strName %>"/> <span id="span_Name">联系人不能为空</span>
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>联系电话</th>
|
|
<td><input id="Text_Phone" name="Text_Phone" value="<%=strPhone %>"/> <span id="span_Phone">联系电话不能为空</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>所在城市</th>
|
|
<td>
|
|
<select name="select_p" id="select_p">
|
|
<option value="-1">--省--</option>
|
|
<%=GetProvince() %>
|
|
</select>
|
|
<select name="select_c" id="select_c">
|
|
<option value="-1">--市--</option>
|
|
</select>
|
|
<select name="select_q" id="select_q" onchange="toaddress()">
|
|
<option value="-1">--县区--</option>
|
|
</select> <span id="span_select">所在城市必须选择</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>邮寄地址</th>
|
|
<td><input id="Text_MailingAddress" name="Text_MailingAddress" value="<%=strMailingAddress %>"/> <span id="span_MailingAddress">邮寄地址不能为空,不用填写省,市,县</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th>邮政编码</th>
|
|
<td><input id="Text_PostalCode" name="Text_PostalCode" value="<%=strPostalCode %>"/> <span id="span_PostalCode"></span></td>
|
|
</tr>
|
|
<tr>
|
|
<th></th>
|
|
<td><input type="button" id="savebtn" name="savebtn" onclick="saveaddress()" value="添加新地址"/> <input type="button" id="resetbtn" name="resetbtn" onclick="$('.address_table').hide();" value="取消"/><input type="hidden" id="addressid" value="" /></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
$("#ap_category").hide();
|
|
|
|
</script>
|
|
</asp:Content>
|