<%@ LANGUAGE = VBScript.Encode %>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312" />
<TITLE>在线支付设置</TITLE>
<link rel="stylesheet" href="Images/Admin.css">
<script language=javascript src=../Include/mouse_on_title.js></script>
</HEAD>
<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->

<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方客服中心 http://www.ip126.com
'微信公众号 ip126com
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<%if Instr(session("AdminPurview"),"|51,")=0 then
  response.write ("<br><br><div align=""center""><font style=""color:red; font-size:9pt; "")>您没有管理该模块的权限！</font></div>")
  response.end
end If%>
<%dim action,deliveryid
deliveryid=request("id")
action=request("action")
set rs=server.CreateObject("adodb.recordset")

select case action

case "deliverysave"
rs.open "select * from TianTianCMS_delivery where id="&deliveryid,conn,1,3
rs("subject")=trim(request.form("subject"))
rs("deliveryidorder")=request.form("deliveryidorder")
rs("fee")=request.form("fee")
rs("methord")=0
rs.update
rs.close
response.Write "<script language=javascript>alert('成功修改了送货方式!');location.replace('methord.asp?action=delivery');</script>"
response.End

case "deliveryadd"
rs.open "select * from TianTianCMS_delivery",conn,1,3
rs.addnew
rs("subject")=trim(request.form("subject"))
rs("deliveryidorder")=request.form("deliveryidorder")
rs("fee")=request.form("fee")
rs("methord")=0
rs.update
rs.close
response.Write "<script language=javascript>alert('成功添加了新的送货方式!');location.replace('methord.asp?action=delivery');</script>"
response.End

case "deliverydel"
conn.execute "delete from TianTianCMS_delivery where id="&deliveryid
response.redirect "methord.asp?action=delivery"

case "zhifudel"
conn.execute "delete from TianTianCMS_delivery where id="&deliveryid
response.redirect "methord.asp?action=zhifu"

case "zhifusave"
rs.open "select * from TianTianCMS_delivery where id="&deliveryid,conn,1,3
rs("subject")=trim(request.form("subject2"))
rs("deliveryidorder")=request.form("deliveryidorder")
rs("methord")=1
rs.update
rs.close
response.Write "<script language=javascript>alert('成功修改了新的支付方式!');location.replace('methord.asp?action=zhifu');</script>"
response.End

case "zhifuadd"
rs.open "select * from TianTianCMS_delivery",conn,1,3
rs.addnew
rs("subject")=trim(request.form("subject2"))
rs("deliveryidorder")=request.form("deliveryidorder")
rs("methord")=1
rs.update
rs.close
response.Write "<script language=javascript>alert('成功添加了新的支付方式!');location.replace('methord.asp?action=zhifu');</script>"
response.End
end select
set rs=nothing
%>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr><th>送货收款设置</th></tr>
  <tr>
    <td height="24" align="center" nowrap="nowrap"  class="forumrow">注：参数设定后不要随意改动，否则影响旧订单统计。</td>
  </tr>
      </table>
      <br>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr align="center" bgcolor="#6AB6B6" height="20"> 
    <td><a href="methord.asp?action=delivery"><font color="#0000FF">编辑送货方式</font></a></td>
    <td><a href="methord.asp?action=zhifu"><font color="#0000FF">编辑支付方式</font></a></td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td height="100" colspan="2"> <br> 
      <%select case action
	case "delivery"%>
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
        <tr bgcolor="#6699cc" align="center" height="20"> 
          <td width="30%"><font color="#000000">送货方式</font></td>
          <td width="12%"><font color="#000000">送货费用</font></td>          
          <td width="20%"><font color="#000000">排 序</font></td>
          <td width="25%"><font color="#000000">操 作 </font></td>
        </tr>
        <%dim i,j
		set rs=server.CreateObject("adodb.recordset")
		rs.open "select * from TianTianCMS_delivery where methord=0 order by deliveryidorder",conn,1,1
		i=rs.recordcount				
		do while not rs.eof%>
        <tr align="center" bgcolor="#FFFFFF"> 
          <form name="form1" method="post" action="methord.asp?action=deliverysave&id=<%=rs("id")%>">
            <td><input name="subject" type="text" id="subject" size="14" value=<%=trim(rs("subject"))%>></td>
            <td><input name="fee" type="text" id="fee" size="4" value=<%=rs("fee")%> onKeyPress	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" 
		onpaste		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		window.clipboardData.getData('Text'))"
		ondrop		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		event.dataTransfer.getData('Text'))">
              元</td>            
            <td><input name="deliveryidorder" type="text" id="deliveryidorder" size="2" value=<%=rs("deliveryidorder")%> onKeyPress	= "return regInput(this,	/^[0-9]*$/,		String.fromCharCode(event.keyCode))"
		onpaste		= "return regInput(this,	/^[0-9]*$/,		window.clipboardData.getData('Text'))"
		ondrop		= "return regInput(this,	/^[0-9]*$/,		event.dataTransfer.getData('Text'))"></td>
            <td><input type="submit" name="Submit" value="修 改"> &nbsp;<a href="methord.asp?action=deliverydel&id=<%=rs("id")%>" onClick="return confirm('您确定进行删除操作吗？')"><font color="#FF6600">删除</font></a> 
            </td>
          </form>
        </tr>
        <%rs.movenext
		Loop		
		rs.close
		set rs=Nothing
		%>
      </table>
	  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<TR>
	<TD>		        <tr> 
          <td height="20" bgcolor="#6699cc" colspan="5" align="center"><font color="#FFFFFF">增加送货方式</font></td>
        </tr>
        <tr align="center" bgcolor="#FFFFFF"> 
          <form name="form2" method="post" action="methord.asp?action=deliveryadd">
            <td width="30%"><input name="subject" type="text" id="subject" size="14"></td>
            <td width="12%"><input name="fee" type="text" id="fee" size="4" onKeyPress	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" 
		onpaste		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		window.clipboardData.getData('Text'))"
		ondrop		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		event.dataTransfer.getData('Text'))">
              元</td>            
            <td width="20%"><input name="deliveryidorder" type="text" id="deliveryidorder" value=<%=i+1%> size="2" onKeyPress	= "return regInput(this,	/^[0-9]*$/,		String.fromCharCode(event.keyCode))"
		onpaste		= "return regInput(this,	/^[0-9]*$/,		window.clipboardData.getData('Text'))"
		ondrop		= "return regInput(this,	/^[0-9]*$/,		event.dataTransfer.getData('Text'))"></td>
            <td width="25%"><input type="submit" name="Submit3" value="添 加"></td>
          </form>
        </tr></TD>
</TR>
</TABLE>
      <%case "zhifu"%>
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
        <tr bgcolor="#6699cc" align="center" height="20"> 
          <td width="40%"><font color="#000000">支付方式</font></td>
          <td width="30%"><font color="#000000">排 序</font></td>
          <td width="30%"><font color="#000000">操作</font></td>
        </tr>
        <%set rs=server.CreateObject("adodb.recordset")
		  rs.open "select * from TianTianCMS_delivery where methord=1 order by deliveryidorder",conn,1,1
		  j=rs.recordcount		 
		  do while not rs.eof%>
        <tr align="center" bgcolor="#FFFFFF"> 
          <form name="form1" method="post" action="methord.asp?action=zhifusave&id=<%=rs("id")%>">
            <td width="40%"><input name="subject2" type="text" id="subject2" size="14" value=<%=trim(rs("subject"))%>></td>
            <td width="30%"><input name="deliveryidorder" type="text" id="deliveryidorder" size="2" value=<%=rs("deliveryidorder")%> onKeyPress	= "return regInput(this,	/^[0-9]*$/,		String.fromCharCode(event.keyCode))"
		onpaste		= "return regInput(this,	/^[0-9]*$/,		window.clipboardData.getData('Text'))"
		ondrop		= "return regInput(this,	/^[0-9]*$/,		event.dataTransfer.getData('Text'))"></td>
            <td width="30%"><input type="submit" name="Submit2" value="确 认">
                &nbsp;<a href="methord.asp?action=zhifudel&id=<%=rs("id")%>" onClick="return confirm('您确定进行删除操作吗？')"><font color="#FF6600">删除</font></a> 
             </td>
          </form>
          <%rs.movenext
		  loop
		  rs.close
		  set rs=Nothing
		  %>
        </tr>
      </table>
	  	 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
	  <TR>
		<TD>		<tr><td height="20" bgcolor="#6699cc" colspan="4" align="center"><font color="#FFFFFF">增加支付方式</font></td></tr>
        <tr bgcolor="#FFFFFF" align="center"> 
          <form name="form1" method="post" action="methord.asp?action=zhifuadd">
            <td><input name="subject2" type="text" id="subject2" size="14"></td>
            <td><input name="deliveryidorder" type="text" id="deliveryidorder" value=<%=j+1%> size="2" onKeyPress	= "return regInput(this,	/^[0-9]*$/,		String.fromCharCode(event.keyCode))"
		onpaste		= "return regInput(this,	/^[0-9]*$/,		window.clipboardData.getData('Text'))"
		ondrop		= "return regInput(this,	/^[0-9]*$/,		event.dataTransfer.getData('Text'))"></td>
            <td><input type="submit" name="Submit32" value="添 加"></td>
          </form>
        </tr></TD>
	  </TR>
	  </TABLE>
      <%end select%>

      </td>
  </tr>
</table>
<br>
<script>
	function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}
</script>