edit_address.html 9.22 KB
<!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="__PUBLIC__/js/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="__STATIC__/js/layer.js"></script>
		<script src="__PUBLIC__/js/global.js"></script>
		<script src="__PUBLIC__/js/mobile_common.js"></script>
		<style type="text/css">
			.layermchild {
				width: 100%;
				position: absolute;
				bottom: 0;
				left: 0;
			}
			.dotm_btn1{
				background:#e30000;
				border-radius: 30px;
				height: 30px;
				line-height: 30px;
				width: 30%;
				float:none;
				margin-top: 0px;
			}


          /*开关的样式*/
			.chooseBtn {
				display: none;
			}

			.choose-label {
				box-shadow: #ccc 0px 0px 0px 1px;
				width: 40px;
				height: 20px;
				display: inline-block;
				border-radius: 20px;
				position: relative;
				background-color: #fff;
				overflow: hidden;
			}

			.choose-label-yuan {
				content: '';
				position: absolute;
				left: 0;
				width: 18px;
				height:18px;
				display: inline-block;
				border-radius: 20px;
				background-color: #fff;
				z-index: 20;
				-webkit-transition: all 0.5s;
				transition: all 0.5s;
				border: 1px solid #999;
			}

		.before {
				left: 20px;
			}

			.chooseBtn:checked + label.choose-label {
				background-color: #e30000;
			}
			.selection{
				background-color: #e30000;
			}
			.default-fraem{
				width: 93%;

			}
			.delete{
				width: 100%;
				border: 1px solid #eee;
				height: 30px;
				line-height: 30px;
				text-align: center;
				background: #fff;
				border-radius: 30px;
				margin-right: 50px;
			}
			.button-fraem{
				width: 95%;
				margin: auto;
			}
			.addressmone ul{
				width: 100%;

			}
			.addressmone ul li{
				width: 100%;
			padding: 5px 15px;
				border-bottom: 1px solid #f5f5f5;
			}
			#address{
				height: 150px;
				width: 70%;
				margin-top: 14px;
				border: none;
				margin-left: 10px;
			}
			.mo_default{
				border-bottom: 1px solid #f5f5f5!important;
				padding-bottom: 17px!important;
				padding-top: 17px!important;
			}
			.select_region{
				width: 14px;
				margin-top: 15px;
			}

		</style>
	</head>

	<body>
		<!--<header>
      <div class="tab_nav">
        <div class="header">
          <div class="h-left"><a class="sb-back" href="javascript:history.back(-1)" title="返回"></a></div>
          <div class="h-mid">地址管理</div>
          <div class="h-right">
            <aside class="top_bar">
              <div onClick="show_menu();$('#close_btn').addClass('hid');" id="show_more"><a href="javascript:;"></a> </div>
            </aside>
          </div>
        </div>
      </div>
      </header>-->
		<include file="public/menu" />
		<include file="public/navBall" />
		<div id="tbh5v0">

			<div class="addressmone">
				<form action="{:U('Mobile/User/edit_address',array('stoid'=>$Think.request.stoid))}" method="post" onSubmit="return checkForm()">
					<input  name="store_id" value="{$pstore_id}" type="hidden">
					<ul>
						<li>
							<span>收货人</span>
							<input name="consignee" id="consignee" type="text" value="{$address.consignee}" maxlength="12" placeholder="收货人姓名" />
						</li>
						<li>
							<span>手机号码</span>
							<input type="tel" name="mobile" value="{$address.mobile}" onpaste="this.value=this.value.replace(/[^\d-]/g,'')" onKeyUp="this.value=this.value.replace(/[^\d-]/g,'')" maxlength="15" placeholder="联系电话" />
						</li>
						<li onclick="show_addsele()">
							<span>所在地区</span>
							<input style="width:64% " type="text" value="{$areaname}" id="showaddrQ" readonly
								   placeholder="所在地区"/>
							<input  name='country' value='1' type="hidden">
							<input id='inp_province' name='province' value="{$address['province']}" type="hidden">
							<input id='inp_city' name='city' value="{$address['city']}" type="hidden">
							<input id='inp_district' name='district' value="{$address['district']}" type="hidden">
							<input id='inp_twon' name='twon' value="{$address['twon']}" type="hidden">
							<input id='more_address' name='more_address' value="{$address['more_address']}" type="hidden">
							<img class="select_region" src="__WEBPUBLIC__/miniapp/images/icon-arrowdown.png">
						</li>
						<li>
							<span>详细地址</span> <textarea type="text" name="address" id="address" placeholder="详细地址">{$address.address}</textarea>
						</li>

						<!--<li>
							<span>邮政编码</span>
							<input type="tel" name="zipcode" value="{$address.zipcode}" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onKeyUp="this.value=this.value.replace(/[^\d]/g,'')" maxlength="10" placeholder="邮政编码" />
						</li>-->
						<li class="mo_default">
							<div class="flex jc_sb ai_center default-fraem">
						<!--	<if class="operation">-->
								<i class="fs13">设为默认地址</i>
								<input type="checkbox" name="sex" id="male" class="chooseBtn" style="display: none" />
								<label for="male" class="choose-label <if condition='$address[is_default] eq 1'>selection</if>"  onclick="changeIsdefault()">
									<div class="choose-label-yuan <if condition='$address[is_default] eq 1'>before</if>"></div>
								</label>

						<!--		</div>-->
								<input type="hidden" id="default" name="is_default" value="{$address[is_default]}"/>
							</div>
							<!--<div class="operationBtn">
								<a href="javascript:void(0);" onClick="if (confirm('你确认要删除该收货地址吗?'))location.href='{:U('/Mobile/User/del_address',array('stoid'=>$Think.request.stoid,'id'=>$address[address_id]))}'" >
									<img src="__STATIC__/images/user/del.png" style="width: 19px;height: 20px;" /><i>删除</i>
								</a>
							</div>-->
						</li>
					</ul>
					<div style=" height:50px"></div>
					<div class="dotm_btn">

						<if condition="$Request.param.source eq 'cart2'">
							<!--如果是下订单时提交过了的页面-->
							<input type="submit" value="保存并使用该地址" class="dotm_btn1" />
							<input type="hidden" name="source" value="{$Request.param.source}" />
							<else/>
							<div class="flex jc_center ai_center button-fraem">
								<a href="javascript:void(0);" style="width: 30%;margin-right:50px" onClick="if (confirm('你确认要删除该收货地址吗?'))location.href='{:U('/Mobile/User/del_address',array('stoid'=>$Think.request.stoid,'id'=>$address[address_id]))}'" >
							    <input type="button" value="删除地址" class="delete">
								</a>
							<!--<a href="javascript:void(0);" onClick="if (confirm('你确认要删除该收货地址吗?'))location.href='{:U('/Mobile/User/del_address',array('stoid'=>$Think.request.stoid,'id'=>$address[address_id]))}'" class="dotm_btn2" style="color:#666;">删除</a>
							<a href="{:U('/Mobile/User/set_default',array('stoid'=>$Think.request.stoid,'id'=>$address[address_id]))}" class="dotm_btn3" style=" color:#FFF;font-size:14px;">设置为默认地址</a>-->
							<input type="submit" value="提交地址" class="dotm_btn1" />
							</div>
						</if>

					</div>
					<input type="hidden" name="id" value="{$address.address_id}" />

				</form>
			</div>
		</div>

		<!--地址选择控件-->
		<include file="public/addrsele"/>
		<script src="__PUBLIC__/js/validate2.js"></script>
		<script>
			var data={$jdata};
			$(function () {
                set_getarea(data.data,data.data2);
            });
			function checkForm() {
				var consignee = $('input[name="consignee"]').val();
				var province = $('select[name="province"]').find('option:selected').val();
				var city = $('select[name="city"]').find('option:selected').val();
				var district = $('select[name="district"]').find('option:selected').val();
				var address = $('input[name="address"]').val();
				var mobile = $('input[name="mobile"]').val();
				var error = '';
				console.log(consignee,"收货人","手机号码",mobile);
				if (consignee == '') {
					error += '收货人不能为空 <br/>';
				}
				if (province == 0) {
					error += '请选择省份 <br/>';
				}
				if (city == 0) {
					error += '请选择城市 <br/>';
				}
				if (district == 0) {
					error += '请选择区域 <br/>';
				}
				if (address == '') {
					error += '请填写地址 <br/>';
				}
//				if (!checkMobile(mobile)) {
//					error += '手机号码格式有误 <br/>';
//				}
				if (error) {
					layer.closeAll();
					layer.open({
						content: error,
						time: 2
					});
					return false;
				}
				return true;
			}

			function changeIsdefault() {

				if( $(".choose-label").hasClass('selection')){
					$(".choose-label").removeClass('selection');
					$(".choose-label-yuan").removeClass('before');


					$("#default").val("0");
				}else{

					$(".choose-label").addClass('selection');
					$(".choose-label-yuan").addClass('before');
					$("#default").val("1");
				}
            }


		</script>
	</body>
</html>