add_address.html 7.96 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">
			.dotm_btn1{
				float: none;
				margin: auto;
				background: #e30000;
				width: 30%;
				height: 35px;
				line-height: 35px;
				border-radius: 35px;
			}
           /* 开关*/
			#toggle-button{ display: none; }
			.button-label{
				position: relative;
				display: inline-block;
				width: 50px;
				height: 20px;
				background-color: #ccc;

				border-radius: 30px;
				overflow: hidden;
			}
			.circle{
				position: absolute;
				top: 0;
				left: 0;
				width: 20px;
				height: 20px;
				border-radius: 50%;
				background-color: #fff;
			}
			.button-label .text {
				line-height: 30px;
				font-size: 18px;
				text-shadow: 0 0 2px #ddd;
			}

			.on { color: #fff; display: none; text-indent: 10px;}
			.off { color: #fff; display: inline-block; text-indent: 34px;}
			.button-label .circle{
				left: 0;
				transition: all 0.3s;
			}

			#toggle-button:checked + label.button-label .on{ display: inline-block; }
			#toggle-button:checked + label.button-label .off{ display: none; }
			.cta{
				background-color:#e30000;
			}
			.cts{
				left: 30px !important;
			}
			.wenben{
				width: 70%;
				height: 90px;
				border: none;
				padding: 14px;
			}
			.operation{
				width: 100%;
				height: 50px;
				line-height: 50px;
				margin: 0px 0px;
			}
			.addressmone ul{
				width: 100%;

			}
			.addressmone ul li{
				width: 100%;
				padding-left: 15px;
				margin: auto;
				border-bottom: 1px solid #ccc!important;

			}

		</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/add_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 class="rel"onclick="show_addsele()">
							<span>所在地区</span>
							<input type="text" value="" id="showaddrQ" readonly
								   placeholder="省市区县,乡镇等"/>
							<input  name='country' value='1' type="hidden">
							<input id='inp_province' name='province' value='' type="hidden">
							<input id='inp_city' name='city' value='' type="hidden">
							<input id='inp_district' name='district' value='' type="hidden">
							<input id='inp_twon' name='twon' value='' type="hidden">
							<input id='more_address' name='more_address' value="" type="hidden">
							<img class="calendar abs" src="__STATIC__/images/category/leftTip.png" style="width: 8px;height: 16px;top:14px" />
						</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>
							<span>详细地址</span>
							<textarea class="wenben" type="text" name="address" id="address" placeholder="街道 楼牌号等">{$address.address}</textarea>
						</li>
						<li>
							<div class="operation flex ai_center jc_sb" data-gg="0" onclick="changeIsdefault()" >
								<i class="fc3">设为默认地址</i>
								<input type="hidden" id="default" name="is_default" />
								<div class="toggle-button-wrapper"style="margin-right: 23px;margin-top: 10px;">
								<!--	<input type="checkbox" id="toggle-button" name="switch">-->
									<div  class="button-label">
										<div class="circle"></div>

									</div>
								</div>
							</div>
						</li>
					</ul>
					<div style=" height:20px"></div>
					<div class="dotm_btn">
						<if condition="$Request.param.source eq 'cart2'">
							<!--如果是下订单时提交过了的页面-->
							<input  type="submit" value="保存并使用该地址" class="dotm_btn1 beett" />
				            <input type="hidden" name="source" value="{$Request.param.source}" />
						<else/>
							<input  type="submit" value="提交地址" class="dotm_btn1" />
						</if>

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

		<script>
			function checkForm() {
                layer.open({content:'加载中',time:2,type:2});
				var consignee = $('input[name="consignee"]').val();
				var province = $('#inp_province').val();
				var city = $('#inp_city').val();
				var district = $('#inp_district').val();
				var address = $('#address').val();
				var mobile = $('input[name="mobile"]').val();
				var error = '';
				if (consignee == '') {
					error += '收货人不能为空 <br/>';
                    layer.open({  content: error, time: 2  });
                    return false;
				}

				if(mobile==""){
                    error += '手机号码不能为空<br/>';
                    layer.open({  content: error, time: 2  });
                    return false;
				}


                if (!checkMobile(mobile)) {
                    error += '手机号码格式有误 <br/>';
                    layer.open({  content: error, time: 2  });
                    return false;
                }

				if ( province=="" ||   province == 0) {
					error += '请选择省份 <br/>';
                    layer.open({  content: error, time: 2  });
                    return false;
				}
				if ( city=="" || city == 0) {
					error += '请选择城市 <br/>';
                    layer.open({  content: error, time: 2  });
                    return false;
				}
				if (district=="" ||  district == 0) {
					error += '请选择区域 <br/>';
                    layer.open({  content: error, time: 2  });
                    return false;
				}
				if (address == '') {
					error += '请填写地址 <br/>';
                    layer.open({  content: error, time: 2  });
                    return false;
				}
				return true;
			}


            function changeIsdefault() {

				var kz=$(".button-label").hasClass("cta")

                if(kz){
					var aa=$(".button-label").removeClass("cta");
					$(".button-label .circle").removeClass("cts")
                    $("#default").val("0");



                }else{

				$(".button-label").addClass("cta")
					$(".button-label .circle").addClass("cts")
                    $("#default").val("1");


                }
            }

		</script>
		<!--地址选择控件-->
		<include file="public/addrsele"/>
	</body>

</html>