function loadMemberInfo(key,keyType){clearMemberInfo();$("#ddlKeyType").val(keyType);$("#txtKey").val(key);$.ajax({type:"GET",url:"/modules/member/datasrc/get_memberinfo_json.aspx",dataType:"html",data:{"key":key,"keyType":keyType},success:function(data,textStatus){if(data!="error"){if(data==""){alert("没有对应的会员记录，请检查输入是否正确！");$("#txtKey").select();try{doWhenMemberInfoLoadFail()}catch(e){alert(e)}}else if(data=="MANYROWS"){browseMembers(keyType,key)}else{var memberInfo=JSON.parse(data);if(keyType=="cardno"){$("#txtKey").val(memberInfo.cardno)}else if(keyType=="mobileno"){$("#txtKey").val(memberInfo.mobileno)};$("#hfMemberName").val(memberInfo.membername);$("#hfMemberID").val(memberInfo.memberID);$("#hfCardNo").val(memberInfo.cardno);$("#hfMobileNo").val(memberInfo.mobileno);$("#hfLevelCode").val(memberInfo.levelcode);$("#lblMemberName").html(memberInfo.membername);$("#lblCardNo").html(memberInfo.cardno);$("#lblMobileNo").html(memberInfo.mobileno);$("#lblAccountBalance").html(memberInfo.accountbalance);$("#lblLevelName").html(memberInfo.levelname);$("#lblCreateDate").html(memberInfo.createdate);$("#lblAccountPoints").html(memberInfo.accountpoints);$("#lblStatus").html(memberInfo.statusname);try{doWhenMemberInfoLoadSuc(memberInfo)}catch(e){alert(e)}}}else{showActResult("获取会员信息失败！",false)}},error:function(XMLHttpRequest,textStatus,errorThrown){showActResult("请求失败！textStatus :"+textStatus,false)}})};function browseMembers(keyType,keyValue){$('#winMemberList').css("display","block");$('#winMemberList').window({width:730,height:419,modal:true,minimizable:false,collapsible:false,title:'会员列表'});if(keyType=="cardno"){keyType="1"}else if(keyType=="mobileno"){keyType="2"};$('#winMemberList').html("<iframe src='/modules/member/datasrc/get_memberlist.aspx?searchfield="+keyType+"&keywords="+keyValue+"' style='width:100%;height:100%;border:0px;margin:0px;padding:0px;'  ></iframe>")};function closeMemberListWindow(){$('#winMemberList').window("close",true)};function takeMemberInfo(trObj){closeMemberListWindow();var cardNo=$(trObj).find("td.cardno").eq(0).html();$("#ddlKeyType").val("cardno");$("#txtKey").val(cardNo);loadMemberInfo(cardNo,"cardno")};function viewMemberDetail(){var memberID=$("#hfMemberID").val();var memberName=$("#hfMemberName").val();if(memberID==""){return};var pageURL="/modules/member/member/member_detail.aspx?memberid="+memberID+"&canedit=0";var winTitle="会员信息("+memberName+")";try{if(window.top!=window.self){window.top.openWindow(winTitle,pageURL)}else{window.location.href=pageURL}}catch(e){alert(e)}};function clearMemberInfo(){$("#ddlKeyType")[0].options[0].selected=true;$("#txtKey").val("");$("#hfMemberName").val("");$("#hfMemberID").val("");$("#hfCardNo").val("");$("#hfMobileNo").val("");$("#hfLevelCode").val("");$("#lblMemberName").html("");$("#lblCardNo").html("");$("#lblMobileNo").html("");$("#lblAccountBalance").html("");$("#lblLevelName").html("");$("#lblCreateDate").html("");$("#lblAccountPoints").html("");$("#lblStatus").html("");$("#txtKey").focus()};function tryLoadMemberInfo(){var key=$("#txtKey").val();var keyType=$("#ddlKeyType").val();loadMemberInfo(key,keyType)};$(function(){$("#txtKey").focus();$("#txtKey").keydown(function(event){if(event.keyCode==13){tryLoadMemberInfo();return false}})});