<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="Admin_Admin_PaymentType, mallz" title="支付方式查看" enableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table class="adminheading" width="100%">                
   <tr>
      <th class="user" align="left" style="height: 52px">支付方式查看</th>
      <td align="right">
      <div style="width:50px"><asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="Admin_Shop.aspx">返回</asp:HyperLink></div></td>
   </tr>
</table> 
   

 <table class="nick">
        <tr>
            <td class="ltd" style="width: 15%">名称：</td>
            <td class="rtd"><asp:TextBox ID="TxtPayName" runat="server" onblur="CheckInputCharNums(this,25);" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtPayName"
                    ErrorMessage="名称不能空"/>(限定最多为25个中文字)</td>
        </tr>
         <tr>
            <td class="ltd" style="width: 15%; height: 166px;">支付属性：</td>
            <td class="rtd" style="height: 166px"><asp:DropDownList ID="DropPayAttribute" runat="server" >
                    <asp:ListItem Value="0">在线支付</asp:ListItem>
                    <asp:ListItem Value="2">线下支付</asp:ListItem>                    
                </asp:DropDownList><br />              
                           <div class="Content" id="online_payTypeSelect">
                                <div class="div_row" id="AliPay" runat="server">
                                    <div class="div_left">
                                        选择支付方式：<asp:DropDownList ID="ShopOnlinePaytype" runat="server" AppendDataBoundItems="True" >                                           
                                            <asp:ListItem>支付宝</asp:ListItem>
                                            <asp:ListItem>网 银</asp:ListItem>
                                            <asp:ListItem>快 钱</asp:ListItem>
                                        </asp:DropDownList></div>
                                    <div class="div_right" id="AliPay1" runat="server">
                                        支付宝邮箱地址帐号：<asp:TextBox ID="OnlinePayEmail" runat="server" Width="150px" />(选择支付宝时填写)
                                        <span style="color: #ff6600">申请支付宝<img src="/Images/Member/tooltip.png" border="0" /></span></div>
                                </div>
                                <div class="div_row" id="other_onlinepya_account" visible="false" runat="server">
                                    <div class="div_left" visible="false">
                                        支付帐号：<asp:TextBox ID="Account" runat="server"  Width="200px" Visible="False" /></div>
                                    <div class="div_right" visible="false" runat="server">
                                        帐号MD5校验码：<asp:TextBox ID="Md5Code" runat="server" Width="200px" Visible="False" />不修改请匆改动</div>
                                </div>
                                <div class="div_row" id="other_onlinepya_key" visible="false" runat="server">
                                    <div class="div_right">
                                       在线支付订单前缀：<asp:TextBox ID="OnlinePayFlag" runat="server" >HL</asp:TextBox></div>
                                </div> 
                                    <div class="div_right" id="downline" visible="false" runat="server">
                                        线下支付类型：<asp:DropDownList ID="outLinePayType" runat="server">                                        
                                          <asp:ListItem Text="银行转帐/汇款" Value="1"  />
                                          <asp:ListItem Text="现金" Value="0" />
                                          <asp:ListItem Text="邮寄汇款" Value="4" />
                                          <asp:ListItem Text="上门收款" Value="5" />
                                          <asp:ListItem Text="支票" Value="6" />
                                          <asp:ListItem Text="其它" Value="7" />
                                       </asp:DropDownList>（注：“银行转帐”方式请注意描述银行帐号信息）</div>
                                
                           </div>
           
            </td>
        </tr>
        <tr>
            <td class="ltd" style="width: 15%">设定付款折扣：</td>
            <td class="rtd"><asp:TextBox ID="TxtDisCount" runat="server" Text="0" Width="30px" />%(请填写0-100范围内数字) <a href="#"  onmouseover="showHelp('help2');" onmouseout="hidenHelp('help2');" >&nbsp;<img src="/Images/Member/tooltip.png" border="0" /></a><br />
                
                <asp:RequiredFieldValidator ID="Rq2" runat="server" ErrorMessage="折扣不能空" ControlToValidate="TxtDisCount" Display="Dynamic"/>
                <asp:RangeValidator ID="Ra1" runat="server" ControlToValidate="TxtDisCount"  ErrorMessage="请填写0-100范围内数字" MaximumValue="100" MinimumValue="0" Type="Integer" Display="Dynamic" Width="141px"/></td>
        </tr>
        <tr>
            <td class="ltd" style="width: 15%">是否禁用：</td>
            <td class="rtd"><asp:CheckBox ID="ChDisable" runat="server" Text="禁用" /></td>
        </tr>
        <tr>
            <td class="ltd" style="width: 15%">描述：</td>
            <td class="rtd"><asp:TextBox ID="TxtIntro" runat="server" TextMode="MultiLine" Height="60px" Width="433px" onblur="CheckInputCharNums(this,200);"/>(注:字数限制在200字以内)</td>
        </tr>
        <tr visible="false" runat="server">
            <td class="ltd" style="width: 15%">请输入安全密码：</td>
            <td class="rtd"><asp:TextBox ID="UserSavePass" runat="server"  TextMode="Password" /><a href="#"  onmouseover="showHelp('help3');" onmouseout="hidenHelp('help3');" >&nbsp;<img src="/Images/Member/tooltip.png" border="0" /></a><br />              
               <asp:RequiredFieldValidator ID="Rq4" runat="server" ErrorMessage="请输入安全密码" ControlToValidate="UserSavePass" Display="Dynamic"/></td>
        </tr>
       <tr visible="false" runat="server">
           <td class="ltd" style="width: 15%">确认安全密码：</td>
           <td class="rtd"><asp:TextBox ID="TextBox1" runat="server"  TextMode="Password" />
               <asp:CompareValidator ID="cv1" runat="server" ControlToCompare="UserSavePass"
                   ControlToValidate="TextBox1" ErrorMessage="两次的安全密码不一样" Display="Dynamic"/></td>
       </tr>
        <tr>
            <td colspan="2"><asp:Label ID="err_tips" runat="server" /></td>
        </tr>
        <tr>           
            <td colspan="2" style="text-align:center;"><asp:Button ID="OnLinePaySubmit" runat="server" OnClick="OnLinePaySubmit_Click" Text=" 新 增 " Visible="False" />&nbsp;&nbsp;<a href="Shop_PaymentType.aspx" style=" display:none;" id="AddNewPayType">新增付款方式</a></td>
        </tr>
      
    </table>
     <div id="help2"   style="position:absolute;z-index:1000; border:solid 1px black; padding:10px; background:white; display:none;" onmouseover="this.style.display='block';" onmouseout="this.style.display='none'">
       你可以设置多个付款方式，设置优惠的付款折扣可以吸引买家在购买商品时采用该付款方式。    
   </div>
    <div id="help3"   style="position:absolute;z-index:1000; border:solid 1px black; padding:10px; background:white; display:none;" onmouseover="this.style.display='block';" onmouseout="this.style.display='none'">
       若第一次填写请输入安全密码并牢记，下次更改支付方式和帐号需要验证安全密码！   
   </div>
   <div id="help4"   style="position:absolute;z-index:1000; border:solid 1px black; padding:10px; background:white; display:none;" onmouseover="this.style.display='block';" onmouseout="this.style.display='none'">
       商城已集成支付宝商家工具。只需填写支付宝帐号即可无须另外开通商家工具。   
   </div>
  
<script type="text/javascript">
   var PaytypeArray = new Array();//地址数组:收货人姓名,ID,街道地址,邮政编码,电话号码,手机号码，Email
   <asp:Literal ID="JavascriptLiteral" runat="server" />
   	function selectDeliver(obj){
		var da = PaytypeArray[obj];
			if(da){
			 //typename,userid,intro,discount,isdefault,disable,payattribute,onlinepaytype,onlinepayflag,onlinepayaccount,md5code,onlinepayemail,outlinepay
				var payname = da[0];
				var sid = da[1];
				var intro=da[2];
				var discount = da[3];
				var isdefault=da[4];
				var isdisable=da[5];
				var payattribute = da[6];
				var onlinepaytype = da[7];
				var onlinepayflag = da[8];
				var account = da[9];
				var md5code=da[10];
				var onlinepayemail = da[11];					
				var outlinepay = da[12];
				
				
			
				document.getElementById('ctl00_ContentPlaceHolder1_TxtPayName').value = payname;
				document.getElementById('ctl00_ContentPlaceHolder1_DropPayAttribute').value = payattribute;
				document.getElementById('ctl00_ContentPlaceHolder1_ShopOnlinePaytype').value = onlinepaytype;
				document.getElementById('ctl00_ContentPlaceHolder1_OnlinePayEmail').value = onlinepayemail;
				document.getElementById('ctl00_ContentPlaceHolder1_Account').value = account;	
				document.getElementById('ctl00_ContentPlaceHolder1_Md5Code').value = md5code;				
				document.getElementById('ctl00_ContentPlaceHolder1_OnlinePayFlag').value = onlinepayflag;
				document.getElementById('ctl00_ContentPlaceHolder1_TxtDisCount').value = discount;
				
				if(isdisable=="True")
				{				   
				   document.getElementById('ctl00_ContentPlaceHolder1_ChDisable').checked=true;
				}
				else
				{
				   document.getElementById('ctl00_ContentPlaceHolder1_ChDisable').checked=false;
				}
				document.getElementById('ctl00_ContentPlaceHolder1_TxtIntro').value = intro;
				document.getElementById('ctl00_ContentPlaceHolder1_outLinePayType').value = outlinepay;
				
				document.getElementById('action').value = "modify";	
				document.getElementById('pid').value = obj;	
				document.getElementById('uid').value = sid;		
				SelectPayType(payattribute);
				SelectOnlinePaytype();	

				document.getElementById('paytype_title').innerHTML="修改付款方式";
				document.getElementById('AddNewPayType').style.display="";
				document.getElementById('ctl00_ContentPlaceHolder1_OnLinePaySubmit').value=" 保 存 ";
			}
	}	
	
	function deleteDeliver(obj){
	  var url="Shop_PaymentType.aspx?Action=delete&pid="+obj+"&Rnd="+Math.random();
	  window.location.href=url;
	}
	
    function SelectPayType(objValue)
    { 
      var _obj=document.getElementById("online_payTypeSelect");
      var _obj_outline=document.getElementById("outLine_Pay"); 
      switch(parseInt(objValue))
      {
         case 0:
           _obj.style.display="block";
           _obj_outline.style.display="none";
           break;
         case 1:
            _obj.style.display="none";
            _obj_outline.style.display="none";
           break;
         case 2:
            _obj.style.display="none";
            _obj_outline.style.display="block";
           break;
      }
    }

   
   function AddPayTypeToParentWindow()
   {
      alert("添加成功");
      opener.document.getElementById("pay_type_obj").innerHTML="hello";
      top.opener=null;
      top.close();
   }
   
   function SelectOnlinePaytype()
   {
      var alipayObj=document.getElementById("alipay_seller_email");
      var otherPayAccount=document.getElementById("other_onlinepya_account");
      var otherPayKey=document.getElementById("other_onlinepya_key");
      var onlinePaySelect=document.getElementById("ctl00_ContentPlaceHolder1_ShopOnlinePaytype");
      if(onlinePaySelect!=null)
      {
         switch(onlinePaySelect.value)
         {            
            case "支付宝":
               alipayObj.style.display="";
               otherPayAccount.style.display=otherPayKey.style.display="none";
               break;
            case "网银":
            case "快钱":
               alipayObj.style.display="none";
               otherPayAccount.style.display=otherPayKey.style.display="";
               break;
         }
        
      }
      
   
   
   }
   SelectOnlinePaytype();
   

</script>
  

</asp:Content>

