<?php
//====== 会员管理 ======
require "common.php";
$m=file_get_contents("php://input");if($m=="")$m='{"act":"index"}';$m=Dec($m,true);
switch($m["act"]){
	case "lgn"://登录
	$q=Qry("Select ID,Up,Us,Ux,Ue From ".$pre."user Where Uc='".$m["Uc"]."'");
	if(Qrc($q)==0)die('{"msg":"手机号码或密码错误！"}');
	$r=Qra($q);if(md5($m["Up"])!=$r["Up"])die('{"msg":"手机号码或密码错误！"}');
	echo Enc(["msg"=>"ok","Us"=>$r["Us"],"Ux"=>$r["Ux"],"Ue"=>$r["Ue"],"Ab"=>$cfg["Ab"],"Ac"=>$cfg["Ac"]]);
	break;

	case "reg"://注册
	if(Qrc(Qry("Select ID From ".$pre."user Where Uc='".$m["Uc"]."'"))>0)die('{"msg":"手机号码已被注册！"}');
	if($cfg["Ag"]["Ac"]!=""){
		if($m["Uk"]!=md5($m["Uc"].$m["Uv"].$m["Ut"].$cfg["Ak"]))die('{"msg":"验证码错误！"}');
		if((time()-$m["Ut"]*1)>180)die('{"msg":"验证码已过期，请重新获取！"}');
	}
	Qry("Insert Into ".$pre."user (Uc,Un,Up,Ud,Us,Ux,Ut,Ue,Uf) Values ('".$m["Uc"]."','".$m["Uc"]."','".md5($m["Up"])."',Now(),0,0,Now(),0,'')");
	echo '{"msg":"ok"}';
	break;

	case "pwd"://改密
	$q=Qry("Select Up From ".$pre."user Where Uc='".$m["Uc"]."'");
	if(Qrc($q)==0)die('{"msg":"原密码错误，请重新输入！"}');
	if(Qrs($q)!=md5($m["P0"]))die('{"msg":"原密码错误，请重新输入！"}');
	Qry("Update ".$pre."user Set Up='".md5($m["P1"])."' Where Uc='".$m["Uc"]."'");
	echo '{"msg":"ok"}';
	break;

	case "rst"://重设
	if($cfg["Ag"]["Ac"]=="")die('{"msg":"ok","err":"系统未使用手机验证码校验，无法自助重置密码！\n请至实体店内请店员核实手机号后重置密码！\n若注册时手机号乱填的则无法重置密码！"}');
	if($m["Uk"]!=md5($m["Uc"].$m["Uv"].$m["Ut"].$cfg["Ak"]))die('{"msg":"验证码错误！"}');
	if((time()-$m["Ut"]*1)>180)die('{"msg":"验证码已过期，请重新获取！"}');
	Qry("Update ".$pre."user Set Up='".md5($m["Up"])."' Where Uc='".$m["Uc"]."'");
	echo '{"msg":"ok"}';
	break;

	case "sms"://短信
	if($cfg["Ag"]["Ac"]=="")die('{"msg":"ok","err":"系统未使用手机验证码校验，请输入任意6位数字！\n请牢记登录密码，若忘记后无法自助重置密码！"}');
	$a=Qrc(Qry("Select ID From ".$pre."user Where Nc='".$m["mob"]."'"));
	if($a >0&&$m["Um"]=="drc")die('{"msg":"手机号码已被注册！"}');
	if($a==0&&$m["Um"]=="doc")die('{"msg":"手机号码未被注册！"}');
	$c=rand(100000,999999);$d=time();$k=md5($m["Uc"].$c.$d.$cfg["Ak"]);
	$f=str_replace(" ","",Cul("https://chanyoo.market.alicloudapi.com/sendsms?mobile=".$m["Uc"]."&content=".str_replace("{{1}}",$m["Uc"],str_replace("{{2}}",$c,$cfg["Ag"]["At"])),false,array("Authorization:APPCODE ".$cfg["Ag"]["Ac"])));
	if(strpos($f,'"errmsg":"OK"')>-1){
		echo '{"msg":"ok","err":"ok","Uk":"'.$k.'","Ut":"'.$d.'"}';
	}else echo '{"msg":"ok","err":"获取短信验证码失败！"}';
	break;

	case "mcz"://充值
	$o=$cfg["Ai"]."-C".$m["Uc"]."-".Rnd(5);
	Qry("Insert Into ".$pre."pay (Mc,Mp,Md,Mt,Nc,Np,Nd,Nt) Values ('".$o."',".$m["Pm"].",Now(),".$m["Pt"].",'',0,Now(),0)");
	echo '{"msg":"ok","odr":"'.$o.'"}';
	break;

	case "mcv"://回调
	$r=Qra(Qry("Select Mp,Nt From ".$pre."pay Where Mc='".$m["odr"]."'"));
	if($r&&$r["Nt"]==1){
		$n=explode("-",$m["odr"]);$c=substr($n[1],1);
		if(Qrc(Qry("Select ID From ".$pre."expend Where Go='".$m["odr"]."' And Si=".$cfg["Ai"]." And Gc='".$c."'"))==0){
			if(Qrc(Qry("Select ID From ".$pre."expend Where Gn>0 And Gc='".$c."'"))==0){$j=$r["Mp"]*1+$cfg["Ab"]["Bc"]*100;}else $j=$r["Mp"];
			for($i=0;$i<count($cfg["Ab"]["Bs"]);$i++){if($r["Mp"]*1==$cfg["Ab"]["Bs"][$i][0]*100)$j+=$cfg["Ab"]["Bs"][$i][1]*100;}
			Qry("Insert Into ".$pre."expend (Si,Gc,Go,Gu,Gm,Gn,Gd,Ge) Values (".$cfg["Ai"].",'".$c."',0,'".$m["odr"]."',".$r["Mp"].",".$j.",Now(),0)");
			Qry("Update ".$pre."user Set Us=Us+".$j." Where Uc='".$c."'");
		}
		echo '{"msg":"ok","pay":1}';
	}else echo '{"msg":"ok","pay":0}';
	break;

	case "pls"://消费
	$p=["msg"=>"ok","Mx"=>[]];
	$q=Qry("Select Go,Gu,Gm,Gd From ".$pre."expend Where Gd>'".date("Y-m-d H:i:s",strtotime("-3 month"))."' And Gc='".$m["Uc"]."' Order By ID Desc");
	while($r=Qra($q)){
		if(substr($r["Gu"],5,1)=="C"){$n="自助充值";}else{$n=Qrs(Qry("Select Sn From ".$pre."shop Where Si=".explode("-",$r["Gu"])[0]));}
		$r["Sn"]=$n;$p["Mx"][]=$r;
	}
	echo Enc($p);
	break;

	case "hbl"://优惠
	$p=["msg"=>"ok","Mh"=>[]];
	$q=Qry("Select ID,Cm,Cn,Cd From ".$pre."coupon Where Co=0 And Cu='".$m["Uc"]."' And Cd>='".date("Y-m-d")."'");
	while($r=Qra($q))$p["Mh"][]=$r;
	echo Enc($p);
	break;

	default:
	$q=Qry("Select Si,Sn,Sa,Sb,Sx,Sy From ".$pre."shop Where Sx<>'0' And Sy<>'0' And Sh=0 Order By ID Asc");
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=360, initial-scale=1, user-scalable=no">
<script type="text/javascript">document.write('<meta name="viewport" content="width=360, initial-scale='+parseInt(document.documentElement.clientWidth)/360+', user-scalable=no">');</script>
<title>选择餐厅</title>
<style type="text/css">
html,body {margin:0px;padding:0px;font-size:16px;}
a:link,a:visited {color:#09F;text-decoration:none;}
a:hover,a:active {color:#F00;text_decoration:underline;}
input[type=text],input[type=date],input[type=number],input[type=password],textarea,select {padding:3px;font-size:16px;resize:none;width:128px;}
#msk {position:fixed;width:360px;left:0px;top:0px;background-color:#000;opacity:0.2;z-index:9;display:none;}
#tip {position:fixed;max-width:300px;background-color:#000;color:#FFF;padding:5px 10px;z-index:99;display:none;}
#cfn {position:fixed;background-color:#FFF;padding:20px;width:280px;border:1px solid #CCC;line-height:24px;box-shadow:2px 2px 2px #666;display:none;z-index:98;}
.bn0 {display:inline-block;line-height:24px;padding:0px 6px;border:1px solid #CCC;text-align:center;cursor:pointer;}
.bn1 {display:inline-block;line-height:24px;padding:0px 6px;border:1px solid #CCC;background-color:#09F;color:#FFF;text-align:center;cursor:pointer;}
.btn {background-color:#09F;color:#FFF;border:0px;font-size:16px;padding:4px 10px;box-shadow:1px 1px 1px #666;border-radius:5px;}
.fld {position:absolute;background-color:#FFF;border:1px solid #09F;box-shadow:2px 2px 2px #666;display:none;}
.flt {text-align:center;line-height:36px;background-color:#09F;color:#FFF;font-weight:bold;}
.flb {padding:10px 20px;line-height:32px;}
.bnc {float:right;font-szie:24px;margin:6px 8px 0px 0px;border:1px solid #FFF;width:20px;line-height:20px;}
.dv0 {margin:10px;border:1px solid #CCC;padding:2px 10px;}
.dv1 {float:left; font-size:16px;line-height:32px;color:#09F;font-weight:bold;}
.dv2 {float:right;font-size:12px;line-height:32px;color:#CCC;}
.dv3 {font-size:12px;clear:both;color:#666;line-height:32px;}
.dv4 {float:right;font-size:16px;line-height:32px;color:#F90;}
.djq {font-size:14px;margin:5px 0px;}
.djq span {display:inline-block;width:40px;height:40px;border:2px solid #F90;text-align:center;color:#F90;font-size:20px;line-height:40px;margin-right:10px;}
</style>
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=p7qaGmr37q4uCgiBShG0tOsI&s=1"></script>
<script type="text/javascript">
function $(o){return document.getElementById(o);}function $$(o){return document.getElementsByName(o);}
function xml(u,p,f){var x;try{x=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{x=new ActiveXObject('Microsoft.XMLHTTP');}catch(f){x=false;}}if(!x&&typeof XMLHttpRequest!='undefined'){x=new XMLHttpRequest();}if(!x){alt('创建XHR对象失败！');return;}x.open(p?'Post':'Get',u,true);x.setRequestHeader('Content-Type','application/json;');x.onreadystatechange=function(){if(x.readyState==4&&x.status==200){try{var s=JSON.parse(x.responseText.replace(/\&\#32;/gi,' ').replace(/\&\#34;/gi,'&quot;').replace(/\&\#37;/gi,'%').replace(/\&\#39;/gi,'\''));if(s.msg!='ok'){alt(s.msg);return;}}catch(e){alt('响应JSON解析错误！\n'+x.responseText+'\n'+e);return;}f(s);}};x.send(p?JSON.stringify(p):null);}
function rnd(n,c){var s='';for(var i=0;i<(n||16);i++)s+='1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'.substr(Math.floor((c?10:62)*Math.random()),1);return s;}
function num(n){var o=event.srcElement;if(o.tagName=='INPUT'&&(o.type=='text'||o.type=='number')){if(!n)n=0;var v=parseFloat(o.value);if(!v)v=0;v=Math.round(v*Math.pow(10,n))/Math.pow(10,n);o.value=v;}}
function sck(n,v){var d=new Date();d.setTime(d.getTime()+1080000000);document.cookie=n+'='+encodeURI(v)+'; expires='+d.toGMTString();}
function gck(n){var c=document.cookie.split("; ");for(var i=0;i<c.length;i++){var t=c[i].split("=");if(t[0]==n)return decodeURI(t[1]);}return '';}
function css(n){for(var i=0;i<document.styleSheets.length;i++){var r=document.styleSheets[i].cssRules?document.styleSheets[i].cssRules:document.styleSheets[i].rules;for(var j=0;j<r.length;j++){if(r[j].selectorText==n)return r[j].style;}}}
function psz(o,s){var w=o.width;var h=o.height;if(w<h){h=h*s/w;w=s;}else{w=s*w/h;h=s;}o.width=w;o.height=h;o.style.margin=(s-h)/2+'px '+(s-w)/2+'px';}
function bsz(o,w,h){w=parseInt(w);h=parseInt(h)-4;var s=w>h?w:h;psz(o,s);}
function fio(m,n,o){if(o&&o!=1){o=o.split(',');for(var i=0;i<o.length;i++)$(o[i]).style.display='none';}o=o?1:0;$(m).style.display='block';if(o)msk.style.display='block';var c=Math.round(parseFloat($(m).style.opacity||(n>0?0:1))*100)/100;c+=0.1*n;if(c<=1&&c>0){$(m).style.opacity=c;if(o)msk.style.opacity=c/5;$(m).style.left=(pw-parseInt($(m).offsetWidth))/2+'px';$(m).style.top=(ph-parseInt($(m).offsetHeight))/2+20-c*20+'px';setTimeout('fio(\''+m+'\','+n+','+o+')',20);}if(c==0){$(m).style.display='none';if(o)msk.style.display='none';}}
function alt(n){tip.innerText=n;if(tip.style.display=='block')return;fio('tip',1);setTimeout(function(){fio('tip',-1);},2000);}
function cfm(n,s,c){var m=msk.style.display=='block'?false:1;msk.style.zIndex=97;cfn.innerHTML=n.replace(/\n/gi,'<br>')+'<div style="text-align:right;"><br><span id="cfc" class="bn0">取消</span>　<span id="cfs" class="bn1">确定</span></div>';cfc.addEventListener('click',function(){fio('cfn',-1,m);msk.style.zIndex=9;if(c)c();});cfs.addEventListener('click',function(){fio('cfn',-1,m);msk.style.zIndex=9;s();});fio('cfn',1,m);}
//----------------------------------------------------------------
var uri='weixin.php';
var An='<?php echo $cfg["An"];?>';
var Sh=[];<?php while($r=Qra($q))echo "Sh.push([-1,'".$r["Si"]."','".$r["Sn"]."','".$r["Sa"]."，".$r["Sb"]."','".$r["Sx"]."','".$r["Sy"]."']);";?>
var pw,ph,Uk,Ut,Ue,Ab,Ac;
function rsz(n){pw=parseInt(document.documentElement.clientWidth);ph=parseInt(document.documentElement.clientHeight);if(pw>360)pw=360;msk.style.height=ph+'px';dm.style.top=ph-50+'px';lst.style.height=ph-100+'px';lsm.style.height=ph-120+'px';lsb.style.height=ph-100+'px';if(n){dmc.value=gck('Jir_MbrUsr');dmp.value=gck('Jir_MbrUpw');if(dmc.value!=''&&dmp.value!='')lgn();}setTimeout('rsz()',500);}
function jsn(x){return {act:x,rnd:rnd(6)};}
//店铺列表
function shl(){var s='';var c='';for(var i=0;i<Sh.length;i++){s+='<div class="dv0" onclick="location.href=\'guest2.php?i='+Sh[i][1]+'#gzh\';"><div class="dv1">'+Sh[i][2]+'</div><div class="dv2">距离：'+(Sh[i][0]==-1?'未知':(Sh[i][0]<1000?(Sh[i][0]+'米'):(Math.round(Sh[i][0]/100)/10+'公里')))+'</div><div class="dv3">地址：'+Sh[i][3]+'</div></div>';}lsm.innerHTML=s;dnm.innerText=An;document.title=An+' - 选择餐厅';}
//会员登陆
function lgn(n){if(dmc.value.replace(/\s/gi,'').length!=11||dmp.value.length<6){alt('请输入11位手机号码及6位以上密码！');return;}var p=jsn('lgn');p.Uc=dmc.value;p.Up=dmp.value;xml(uri,p,function(r){sck('Jir_MbrUsr',dmc.value.replace(/\s/gi,''));sck('Jir_MbrUpw',dmp.value);dmv.innerText=gck('Jir_MbrUsr');dmq.innerText=r.Us/100;Ue=r.Ue/100;Ab=r.Ab;Ac=r.Ac;fio('dmn',-1,1);dml.style.display='none';dmu.style.display='block';if(!n)mcv();});}
//会员注册
function reg(){if(drc.value.replace(/\s/gi,'').length!=11||drp.value.length<6){alt('请输入11位手机号码及6位以上密码！');return;}var p=jsn('reg');p.Uc=drc.value;p.Up=drp.value;p.Uk=Uk;p.Ut=Ut;p.Uv=dry.value;xml(uri,p,function(r){dmc.value=drc.value;dmp.value=drp.value;fio('dmr',-1,1);;lgn();});}
//修改密码
function pwd(){if(dmx.value.length<6){alt('新密码应至少6位！');return;}var p=jsn('pwd');p.Uc=dmc.value;p.P0=dmy.value;p.P1=dmx.value;xml(uri,p,function(r){alt('新密码修改成功，请牢记新密码！');sck('Jir_MbrUpw',dmx.value);dmp.value=dmx.value;fio('dmg',-1,1);});}
//重设密码
function rst(){if(doc.value.replace(/\s/gi,'').length!=11||dop.value.length<6){alt('请输入11位手机号码及6位以上密码！');return;}var p=jsn('rst');p.Uc=doc.value;p.Up=dop.value;p.Uk=Uk;p.Ut=Ut;p.Uv=doy.value;xml(uri,p,function(r){dmc.value=doc.value;dmp.value=dop.value;fio('dmo',-1,1);lgn();});}
//获取验证
function sms(n){var m=$(n).value.replace(/\s/gi,'');if(m.length!=11){alt('请输入11位手机号码！');return;}var d1=new Date().getTime();var d2=gck('Jir_SMSCode')*1;if(d1-d2<60000)return;var p=jsn('sms');p.Uc=m;p.Um=n;xml(uri,p,function(r){if(r.err=='ok'){Uk=r.Uk;Ut=r.Ut;alt('验证码已发送，有效期3分钟！');sck('Jir_SMSCode',d1);scd();}else alt(r.err);});}
function scd(){var d1=new Date().getTime();var d2=gck('Jir_SMSCode')*1;var d=65-Math.ceil((d1-d2)/1000);if(d>0){drb.innerText='('+d+')';dob.innerText='('+d+')';setTimeout('scd()',1000);}else{drb.innerText='获 取';dob.innerText='获 取';sck('Jir_SMSCode','');}}
//会员充值
function mcs(){var s='';for(var i=0;i<Ab.Bs.length;i++)s+='<option value="'+Ab.Bs[i][0]+'">'+Ab.Bs[i][0]+'元'+(Ab.Bs[i][1]*1>0?'(送'+Ab.Bs[i][1]+'元)':'')+'</option>';dmj.innerHTML=s;czzs.innerText=Ab.Bc*1>0?'新会员首次充值送'+Ab.Bc+'元':'';fio('dmw',1,1);dmk.innerText=dmc.value;}
//充值下单
function mcz(){var p=jsn('mcz');p.Uc=dmc.value;p.Pm=dmj.value*100;p.Pt=3-dwp.value*1;xml(uri,p,function(r){sck('Jir_PayChk',r.odr);window.location='mobile.php?o='+r.odr+'&r=weixin%2Ephp';});}
//充值回调
function mcv(){var o=gck('Jir_PayChk');if(o=='')return;var p=jsn('mcv');p.odr=o;xml(uri,p,function(r){if(r.pay==1){sck('Jir_PayChk','');alt('充值成功！');setTimeout('lgn(1)',500);}});}
//消费列表
function pls(){var p=jsn('pls');p.Uc=dmc.value;xml(uri,p,function(r){var t=r.Mx;var s='';for(var i=0;i<t.length;i++){s+='<div class="dv0"><div class="dv1">'+t[i].Sn+'</div><div class="dv4">金额：'+(t[i].Gm/100)+'元</div><div class="dv3">时间：'+t[i].Gd+'　类型：'+(t[i].Go=='0'?(t[i].Gu.split('-')[1].substr(0,1)=='C'?'自助充值':'店内充值'):('消费[单号:'+t[i].Go+']'))+'</div></div>';}lsb.innerHTML=s+'<div style="text-align:center;font-size:12px;color:#999;line-height:20px;">仅显示三个月内订单，更多订单及详情请至店面内查询。</div>';lsb.style.display='block';lst.style.display='none';dnn.innerHTML='消费列表 [<a href="javascr'+'ipt:void(0);" onclick="lsb.style.display=\'none\';lst.style.display=\'block\';dnn.innerHTML=\'选择餐厅\';">关闭</a>]';});}
//红包列表
function cpl(){var p=jsn('hbl');p.Uc=dmc.value;xml(uri,p,function(r){var s='<strong>优惠券获取规则</strong>：（优惠券仅限会员卡支付时使用）<br>';for(var i=0;i<Ac.length;i++){s+=(i+1)+'、消费满 '+Ac[i][0]+' 元送 '+Ac[i][1]+' 元代金券 '+Ac[i][3]+' 张（满 '+Ac[i][2]+' 元可用）<br>';}djh.innerHTML=s;s='';t=r.Mh;for(var i=0;i<t.length;i++)s+='<div class="djq"><span>'+(t[i][1]/100)+'</span>满 '+(t[i][2]/100)+' 元可用，有效期至：'+t[i][3]+'</div>';djq.innerHTML=s;fio('dmh',1,1);});}
</script>
</head>
<body onLoad="rsz(1);">
<div id="msk"></div><div id="tip"></div><div id="cfn"></div>
<div style="width:360px;line-height:50px;font-size:20px;background-color:#333;color:#FFF;">
  <div style="float:left;margin:3px;width:44px;height:44px;"><img src="images/icon.png" width="44" height="44"></div>
  <span id="dnm"></span> - <span id="dnn">选择餐厅</span>
</div>
<div id="lst" style="width:360px;background-color:#FFF;display:block;">
  <div id="lsm" style="width:360px;overflow:auto;"><div style="text-align:center;">正在获取位置信息，请稍候...</div></div>
  <div style="height:20px;line-height:20px;font-size:12px;">点击餐厅列表进入快餐外卖点单。正餐点单请扫描餐桌二维码进入。</div>
</div>
<div id="lsb" style="width:360px;overflow:auto;background-color:#FFF;display:none;"></div>
<div id="dm" style="position:absolute;background-color:#333;width:360px;height:50px;left:0px;z-index:11;">
  <div id="dml" style="text-align:center;display:block;"><div style="margin:10px auto;width:150px;line-height:30px;background-color:#F90;color:#FFF;" onClick="fio('dmn',1,1);">会员登录/注册</div></div>
  <div id="dmu" style="color:#FFF;display:none;"><div style="float:left;line-height:21px;margin:3px 5px;"><span id="dmv"></span><br><span style="font-size:12px;"><a href="javascript:void(0);" onClick="cfm('确认退出？',function(){sck('Jir_MbrUpw','');location.reload();});">退出</a> | <a href="javascript:void(0);" onClick="fio('dmg',1,1);dmy.value='';dmx.value='';">改密</a> | <a href="javascript:void(0);" onClick="pls();">消费</a> | <a href="javascript:void(0);" onClick="cpl();">优惠</a> | <a href="javascript:void(0);" onClick="mcs();">充值</a></span></div><div style="float:right;font-size:14px;margin:10px 5px 0px 0px;">余额： <span id="dmq" style="font-size:24px;color:#F90;"></span> 元 <span style="border:1px solid #F90;font-size:12px;color:#F90;padding:0px 1px;border-radius:3px;" onClick="alt(Ue?('您当前信用额度为'+Ue+'元，结账时使用会员卡付款，即可挂账用餐，有钱再还：）'):'月底没钱吃饭了？没关系，快联系店长开通信用额度，结账时使用会员卡付款，即可挂账用餐，有钱再还：）');">信</span></div></div>
</div>
<div id="dmn" class="fld" style="width:298px;z-index:12;">
  <div class="flt"><div class="bnc" onClick="fio('dmn',-1,1);">×</div>会员登录</div>
  <div class="flb">成为本店会员可在本餐厅下所有连锁店凭手机号及密码消费！<br>手机号：<input type="number" id="dmc"> <span class="bn1" onClick="fio('dmn',-1);setTimeout('fio(\'dmr\',1)',300);drc.value='';drp.value='';dry.value='';scd();">注 册</span><br>密　码：<input type="password" id="dmp"> <span class="bn1" onClick="fio('dmn',-1);setTimeout('fio(\'dmo\',1)',300);doc.value='';dop.value='';doy.value='';scd();">重 设</span><br>　　　　<span class="btn" onClick="lgn();">登 录</span>　</div>
</div>
<div id="dmr" class="fld" style="width:298px;z-index:13;">
  <div class="flt"><div class="bnc" onClick="fio('dmr',-1,1);">×</div>会员注册</div>
  <div class="flb">成为本店会员可在本餐厅下所有连锁店凭手机号及密码消费！<br>手机号：<input type="number" id="drc"> <br>密　码：<input type="password" id="drp"><br>验证码：<input type="number" id="dry"> <span class="bn1" id="drb" onClick="if(this.innerText=='获 取')sms('drc');">获 取</span><br>　　　　<span class="btn" onClick="reg();">注 册</span></div>
</div>
<div id="dmo" class="fld" style="width:298px;z-index:14;">
  <div class="flt"><div class="bnc" onClick="fio('dmo',-1,1);">×</div>重设密码</div>
  <div class="flb">手机号：<input type="number" id="doc"> <br>新密码：<input type="password" id="dop"><br>验证码：<input type="number" id="doy"> <span class="bn1" id="dob" onClick="if(this.innerText=='获 取')sms('doc');">获 取</span><br>　　　　<span class="btn" onClick="rst();">重 设</span></div>
</div>
<div id="dmg" class="fld" style="width:298px;z-index:15;">
  <div class="flt"><div class="bnc" onClick="fio('dmg',-1,1);">×</div>修改密码</div>
  <div class="flb">原密码：<input type="password" id="dmy"><br>新密码：<input type="password" id="dmx"><br>　　　　<span class="btn" onClick="pwd();">修改密码</span></div>
</div>
<div id="dmw" class="fld" style="width:298px;z-index:16;">
  <div class="flt"><div class="bnc" onClick="fio('dmw',-1,1);">×</div>会员充值</div>
  <div class="flb">充值卡号：<span id="dmk"></span><br>充值金额：<select id="dmj"></select><br>支付方式：<select id="dwp"><option value="2">微信支付</option><option value="3">支付宝</option></select><br><span id="czzs"></span>　　　　　<span class="btn" onClick="mcz();">立即充值</span></div>
</div>
<div id="dmh" class="fld" style="width:328px;height:490px;z-index:17;">
  <div class="flt"><div class="bnc" onClick="fio('dmh',-1,1);">×</div>我的优惠券</div>
  <div class="flb" style="width:328px;height:430px;padding:10px;overflow:auto;">
    <div id="djq"></div>
    <div id="djh" style="font-size:12px;"></div>
  </div>
</div>
<div id="map" style="width:360px;height:540px;display:none;"></div>
<script type="text/javascript">
//获取定位
var map=new BMap.Map('map');var geo=new BMap.Geolocation();geo.getCurrentPosition(function(p){if(this.getStatus()==BMAP_STATUS_SUCCESS){var cxy=gez(p.point.lng,p.point.lat);var pnt=new BMap.Point(cxy[0],cxy[1]);var loc=new BMap.Geocoder();loc.getLocation(pnt,function(r){if(r){for(var i=0;i<Sh.length;i++)Sh[i][0]=Math.round(map.getDistance(pnt,new BMap.Point(Sh[i][4],Sh[i][5])));Sh.sort(function(x,y){return x[0]-y[0]});shl();}else{shl();}});}else shl();});
//支付宝偏移修正
var gez=function(lng,lat){var x_pi=3.14159265358979324*3000.0/180.0;var PI=3.1415926535897932384626;var aa=6378245.0;var ee=0.00669342162296594323;function b2g(lng,lat){var x=lng-0.0065;var y=lat-0.006;var z=Math.sqrt(x*x+y*y)-0.00002*Math.sin(y*x_pi);var v=Math.atan2(y,x)-0.000003*Math.cos(x*x_pi);return[z*Math.cos(v),z*Math.sin(v)];}function g2b(lng,lat){var z=Math.sqrt(lng*lng+lat*lat)+0.00002*Math.sin(lat*x_pi);var v=Math.atan2(lat,lng)+0.000003*Math.cos(lng*x_pi);return[z*Math.cos(v)+0.0065,z*Math.sin(v)+0.006];}function g2w(lng,lat){if((lng<72.004||lng>137.8347)||((lat<0.8293||lat>55.8271)||false)){return [lng,lat];}else{var dlat=tfy(lng-105.0,lat-35.0);var dlng=tfx(lng-105.0,lat-35.0);var radlat=lat/180.0*PI;var magic=Math.sin(radlat);magic=1-ee*magic*magic;var sqrtmagic=Math.sqrt(magic);dlat=(dlat*180.0)/((aa*(1-ee))/(magic*sqrtmagic)*PI);dlng=(dlng*180.0)/(aa/sqrtmagic*Math.cos(radlat)*PI);mglat=lat+dlat;mglng=lng+dlng;return [lng*2-mglng,lat*2-mglat];}}function tfy(lng,lat){var ret=-100.0+2.0*lng+3.0*lat+0.2*lat*lat+0.1*lng*lat+0.2*Math.sqrt(Math.abs(lng));ret+=(20.0*Math.sin(6.0*lng*PI)+20.0*Math.sin(2.0*lng*PI))*2.0/3.0;ret+=(20.0*Math.sin(lat*PI)+40.0*Math.sin(lat/3.0*PI))*2.0/3.0;ret+=(160.0*Math.sin(lat/12.0*PI)+320*Math.sin(lat*PI/30.0))*2.0/3.0;return ret;}function tfx(lng,lat){var ret=300.0+lng+2.0*lat+0.1*lng*lng+0.1*lng*lat+0.1*Math.sqrt(Math.abs(lng));ret+=(20.0*Math.sin(6.0*lng*PI)+20.0*Math.sin(2.0*lng*PI))*2.0/3.0;ret+=(20.0*Math.sin(lng*PI)+40.0*Math.sin(lng/3.0*PI))*2.0/3.0;ret+=(150.0*Math.sin(lng/12.0*PI)+300.0*Math.sin(lng/30.0*PI))*2.0/3.0;return ret;}if(navigator.userAgent.toLowerCase().indexOf('alipay')>0||navigator.userAgent.toLowerCase().indexOf('aliapp')>0){var b=b2g(lng,lat);var c=g2w(b[0],b[1]);return g2b(c[0],c[1]);}else return [lng,lat];}
</script>
</body>
</html>
<?php
}
?>