<%@ LANGUAGE = "VBScript.Encode" codepage="65001" %>
<!--
'##################################################################                                                                 
'★         web08.net - 威博购物系统                                              
'★  版权所有: web08.net                                                                                                       
'★  程序制作: 威博网络技术公司                                     
'★           email:web08net@hotmail.com                           
'★            Q Q :645095280,475980829
'★	       电话:021-55520018                                                                                                         
'★  相关网址: [产品介绍] http://www.021web.com.cn/gwxt.html
'★            [支持论坛] http://bbs.web08.net/                                                                                     
'★  主页地址: http://www.web08.net/  
'★		http://www.021web.com.cn/			                                                                 
'################################################################### 
-->
<html>
<head>
<title>商城系统-威博单用户商城后台管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../css/css.css" rel="stylesheet" type="text/css">
</head>
<!--#include file="../include2.asp"-->
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 class="background" onLoad="LoadFinish()">
<!-- #include file="../loading2.asp" -->

<%#@~^qwAAAA==7M+daW	/+cA!W0DxPDD;n,@#@&i^W	xN(@#@&dk+DP./mdmVn'1Gx	RnamEOnvJd+^n1Y~CP6DWsPSn4|h4W^+dC^+PS4+M+Pb[xJLD;;+dOvJ2k9E#LJEb@#@&dA4KVn{1G	Yn	Y{YDb:v./|/CV`EA|mW	O+	YJ*b@#@&HzcAAA==^#~@%>
<center>
<!--#include file="../mall/web_mall_include.asp"-->
<div class="div-top">
<span class="right-span"><a href="javascript:history.go(-1);"><font color="#990000">返回批发方案管理</font></a>&nbsp;&nbsp;</span>
<span class="left-span">&nbsp;&nbsp;<strong>管理中心</strong>  - 编辑批发方案 </span>
</div>
<div class="tab-div">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<form name="form1" method="post" action="wactivesave.asp?action=editwholesale">


<tr align="center" bgcolor="#FFFFFF">
  <td height="10" align="left" >&nbsp;</td>
</tr>
<tr align="center" bgcolor="#FFFFFF">
<td height="30" align="left" >　批发方案名称: 
  <input name="name" type="text" id="name" size="50" maxlength="25" value="<%=#@~^FwAAAA==OMkhvDk{/mVcJq{Uls+Eb*4gcAAA==^#~@%>">
<input type="hidden" name="pid" value="<%=#@~^DgAAAA==.;;/D`Jak9E#2wQAAA==^#~@%>">
<input name="page" type="hidden" id="page" value="<%=#@~^DwAAAA==.;;/D`JalTnJ*OwUAAA==^#~@%>"></td>
</tr>
<tr align="center" bgcolor="#FFFFFF">
<td height="30" align="left" >　批发方案简述: 
  <input name="shortcontent" type="text" id="shortcontent" value="<%=#@~^HwAAAA==OMkhvDk{/mVcJq{dtKDO^KxYUYr##bAsAAA==^#~@%>" size="50" maxlength="500"></td>
</tr>
<tr align="center" bgcolor="#FFFFFF">
<td height="30" align="center" ><table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td  width="120" align="left" nowrap><INPUT TYPE='checkbox' name=groups[] id=groups value='0' <%#@~^KwAAAA==(wPAk{!mVm/kcDk{dl^+cES{mKUYxYrbS!*'8PPtnUnA4AAA==^#~@%> checked<%#@~^BgAAAA==n	N~b0JgIAAA==^#~@%>>
<span class="p9black">非会员</span>
<INPUT TYPE="hidden" name='rules_0' value='<%=#@~^IQAAAA==Ak{LY	E:vDkm/mVn`rhm^KxYUYr#~Zb1QsAAA==^#~@%>'></td>
<td ><INPUT TYPE="button" name=btn value="新增折扣分段" onClick="addsaleline(0)" class=inputstyle>
&nbsp;</td>
</tr>
<tr>
<td  align="right" nowrap>&nbsp;</td>
<td ><table width=100%  id=multitbl0 >
<tr id=tdt0>
<td width=30% nowrap></td>
<td width=10% nowrap></td>
<td width=20% nowrap></td>
<td width=10% nowrap></td>
<td width=30% nowrap></td>
</tr>
<%#@~^KwAAAA==(wPAk{!mVm/kcDk{dl^+cES{mKUYxYrbS!*'8PPtnUnA4AAA==^#~@%>

<%#@~^LgAAAA==WKD~1k{!PDW,~hk{L+Dx;hvD/|dl^+`rAmmKxD+UYEbB!buA8AAA==^#~@%>
<tr id='tdt0' ln='<%=#@~^BAAAAA==^b_qKAEAAA==^#~@%>'>
<td align=right nowrap>商品购买数量大于等于</td>
<td nowrap><input name=start_0_<%=#@~^BAAAAA==^b_qKAEAAA==^#~@%> type=text value='<%=#@~^NQAAAA==OMkhvhk{oYa.W	Eh`DDrhvD/|dl^+`rAmmKxD+UYEb*~T~1r~Z#blBIAAA==^#~@%>' style='width:60px' class=inputstyle></td>
<td align=right nowrap>时，折扣为</td>
<td nowrap><input name=percent_0_<%=#@~^BAAAAA==^b_qKAEAAA==^#~@%>   type=text value='<%=#@~^NQAAAA==OMkhvhk{oYa.W	Eh`DDrhvD/|dl^+`rAmmKxD+UYEb*~T~1r~8#blRIAAA==^#~@%>' style='width:30px' class=inputstyle>%</td>
<td nowrap><input type='button' name='btn' value='删除' onclick='delsaleline(0,<%=#@~^BAAAAA==^b_qKAEAAA==^#~@%>)' class=inputstyle></td>
</tr>
<%#@~^BAAAAA==U6OvwEAAA==^#~@%>
<%#@~^BgAAAA==n	N~b0JgIAAA==^#~@%>
</table></td>
</tr>
</table></td>
</tr>

<%#@~^dgAAAA==7@#@&d$V{J/V^Y,e~0MWh~q+4|i/DZ^Cd/,WMNnD~8HPrN,[+kmE@#@&/+O~!mslkd{mG	xc+6m!O+v/5V*@#@&[KPh4rVPxKO~E1Vm/dRnG6@#@&HSUAAA==^#~@%>
<tr align="center">
<td height="30" align="center" bgcolor="#FFFFFF"><table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td  width="120" align="left" nowrap><INPUT TYPE='checkbox' name=groups[] id=groups value='<%=#@~^EgAAAA==OMkhvE1Vlk/vEk9Jb#+gUAAA==^#~@%>' <%#@~^NgAAAA==(wPAk{!mVm/kcDk{dl^+cES{mKUYxYrbSE1Vm/d`Er9Jb#{qP:tnUWRIAAA==^#~@%>checked<%#@~^BgAAAA==n	N~b0JgIAAA==^#~@%> >
<span class="p9black"><%=#@~^EQAAAA==;1VCk/vJj;{gC:JbmAUAAA==^#~@%></span>
<INPUT TYPE="hidden" name='rules_<%=#@~^EgAAAA==OMkhvE1Vlk/vEk9Jb#+gUAAA==^#~@%>' value=""></td>
<td ><INPUT TYPE="button" name=btn2 value="新增折扣分段" onClick="addsaleline(<%=#@~^EgAAAA==OMkhvE1Vlk/vEk9Jb#+gUAAA==^#~@%>)" class=inputstyle>
&nbsp;</td>
</tr>
<tr>
<td  align="right" nowrap>&nbsp;</td>
<td ><table width=100%  id=multitbl<%=#@~^EgAAAA==OMkhvE1Vlk/vEk9Jb#+gUAAA==^#~@%> >
<tr id=tdt<%=#@~^DAAAAA==;1VCk/vJk9J*7QMAAA==^#~@%>>
<td width=30% nowrap></td>
<td width=10% nowrap></td>
<td width=20% nowrap></td>
<td width=10% nowrap></td>
<td width=30% nowrap></td>
</tr>

<%#@~^igAAAA==~S+8|0KD{T+DUEs'A/|onO	E:vODb:`Mdm/mV`Ehm^KxO+	OJ*#SOMk:c;1VC/kcrk[r#*#@#@&BMn/aWU/RA.bY+,A+({0K.moY	Eh@#@&WKD~:br'ZPOG,Phn8|0GD|LYU!:FTAAAA==^#~@%>
<%#@~^NgAAAA==(wPAk{!mVm/kcDk{dl^+cES{mKUYxYrbSE1Vm/d`Er9Jb#{qP:tnUWRIAAA==^#~@%>
<tr id='tdt<%=#@~^EgAAAA==OMkhvE1Vlk/vEk9Jb#+gUAAA==^#~@%>' ln='<%=#@~^BQAAAA==hbkQ8mwEAAA==^#~@%>'>
<td align=right nowrap>商品购买数量大于等于</td>
<td nowrap><input name=start_<%=#@~^EgAAAA==OMkhvE1Vlk/vEk9Jb#+gUAAA==^#~@%>_<%=#@~^BQAAAA==hbkQ8mwEAAA==^#~@%> type=text value='<%=#@~^OwAAAA==OMkhvhk{oYa.W	Eh`M/mdmV+vEh|mW	OnxDJ*~;msCk/cJb[J*~hrb~!bbtxQAAA==^#~@%>' style='width:60px' class=inputstyle></td>
<td align=right nowrap>时，折扣为</td>
<td nowrap><input name=percent_<%=#@~^EgAAAA==OMkhvE1Vlk/vEk9Jb#+gUAAA==^#~@%>_<%=#@~^BQAAAA==hbkQ8mwEAAA==^#~@%>   type=text value='<%=#@~^OwAAAA==OMkhvhk{oYa.W	Eh`M/mdmV+vEh|mW	OnxDJ*~;msCk/cJb[J*~hrb~FbbuBQAAA==^#~@%>' style='width:30px' class=inputstyle>%</td>
<td nowrap><input type='button' name='btn' value='删除' onclick='delsaleline(<%=#@~^DAAAAA==;1VCk/vJk9J*7QMAAA==^#~@%>,<%=#@~^BQAAAA==hbkQ8mwEAAA==^#~@%>)' class=inputstyle></td>
</tr>
<%#@~^BgAAAA==n	N~b0JgIAAA==^#~@%>
<%#@~^BAAAAA==U6OvwEAAA==^#~@%>

</table></td>
</tr>
</table></td>
</tr>
<%#@~^JwAAAA==;1VCk/c:W7+	n6D@#@&VKW2@#@&Em^C/kRm^Gd+5gwAAA==^#~@%>



<tr align="center">
<td height="30" align="center" bgcolor="#FFFFFF"><label>
<input type="submit" name="Submit" value=" 确 定 "  onClick="return checkform();">
<input type="reset" name="Submit2" value=" 取 消 ">
</label></td>
</tr>
<tr align="center">
<td height="30" align="left" bgcolor="#FFFFFF"><font color="#FF0000" class="showtip">备注：购买数量请填写整数，折扣请填写整数，如：30 代表着享受30%的折扣 </font></td>
</tr>
</form>
</table>
</div>
</center>
<!-- #include file="../bottom2.asp" -->
</body>
</html>
<script language="javascript">
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)
}
    function checkform(){
		if (form1.name.value == "")
		{
			alert("请输入方案名称！");
			form1.name.focus();
			return false;

		}
			groupchecked = false;
       if(document.all.groups.length>1)
	   {
			for(var i=0;i<document.all.groups.length;i++)

			   if(document.all.groups[i].checked) groupchecked = true;

	   }
	   else
	   {
			if(document.all.groups.checked) groupchecked = true;
	   }
	   if(!groupchecked)
	   {
				alert("请选择方案需要应用到的会员等级!");
				return false;
	   }

       if(document.all.groups.length>1)
	   {
			for(var i=0;i<document.all.groups.length;i++)
			   if(document.all.groups[i].checked)
				{
					var r = eval("form1.rules_"+document.all.groups[i].value);
	
					r.value = getrules(document.all.groups[i].value);
					if(r.value=='') return false;
				}
	   }
	   else
	   {
			if(document.all.groups.checked)
			{
				var r = eval("form1.rules_"+document.all.groups.value);
				r.value = getrules(document.all.groups.value);
				if(r.value=='') return false;
			}
	   }
	   if(!groupchecked)
	   {
				alert("请选择方案需要应用到的会员等级!");
				return false;
	   }
	
		chkout(document.form1)	;
	
	}
	
	var allCount=new Array();    //
	<%#@~^JAAAAA==(wPAk{!mVm/kch4Ws+|mGUD+xDS!*'F,P4+	xgwAAA==^#~@%>
		allCount[0] = <%=#@~^HAAAAA==Ak{LY	E:vh4GV{^W	YnUD~!*Q XAoAAA==^#~@%>;
	<%#@~^BQAAAA==~VdyQEAAA==^#~@%>
	 	allCount[0] = 1;
	<%#@~^BgAAAA==n	N~b0JgIAAA==^#~@%>
	<%#@~^QAAAAA==^KxU94@#@&di/OPM/mm{mGU	R+Xnm!Y+vEd+^+1Y~e~WMWhPqn4|jdnMZVCdkJbIRUAAA==^#~@%>
	<%#@~^FQAAAA==[KPA4k^+P	WD~Dk{^RWWrAcAAA==^#~@%>
	allCount[<%=#@~^CgAAAA==.k{^vJbNJ*CQMAAA==^#~@%>] = <%#@~^LgAAAA==r6PAk{T+Y	Esch4Ws+|mGUD+xDSDk{mvErNr#*'EJ~O4+UFxAAAA==^#~@%>1<%#@~^BAAAAA==n^/nqQEAAA==^#~@%> <%=#@~^JQAAAA==Ak{LY	E:vh4GV{^W	YnUD~DkmmvJk9Eb#3 NQ0AAA==^#~@%><%#@~^BgAAAA==n	N~b0JgIAAA==^#~@%>;
	<%#@~^JQAAAA==.k{^c:K\+	+XO@#@&dsWKw@#@&iD/|^R1VWknMAsAAA==^#~@%>

	function addsaleline(gid)
	{
	
	  var multi = eval("multitbl"+gid);
	  newRow=multi.insertRow(multi.rows.length);
	  newRow.id="tdt"+gid;
	
	  newRow.ln = allCount[gid];
	 // alert(allCount[gid])
	  c1=newRow.insertCell(0);
	  c1html="商品购买数量大于等于\n";
	  c1.innerHTML=c1html;
	 //alert(allCount[gid]);
	  c1.align='right';
	  c2=newRow.insertCell(1);
	  c1html="<input name=start_"+gid+"_"+allCount[gid]+"   type=text value='' style='width:50px' maxlength='5'>\n";
	  c2.innerHTML=c1html;
	  //	alert(c1html);
	  c3=newRow.insertCell(2);
	  c1html="时，折扣为";
	  c3.innerHTML=c1html;
	  c3.align='right';
	  c4=newRow.insertCell(3);
	  c1html="<input name=percent_"+gid+"_"+allCount[gid]+"   type=text value='' style='width:30px' maxlength='3' class=inputstyle>%\n";
	  c4.innerHTML=c1html;
	  	//  	alert(c1html);
	  c5=newRow.insertCell(4);
	  c1html="<input type='button' name='btn' value='删除' onclick='delsaleline("+gid+","+allCount[gid]+")' class=inputstyle>\n";
	  c5.innerHTML=c1html;
		//alert(c1html);
	  c5.align='left';
	  allCount[gid]++;
	}


	function delsaleline(gid,count)
	{
	  var multi = eval("multitbl"+gid);
	  var atdt = eval("tdt"+gid);
	  for (i=1;i<multi.rows.length;i++){
		if (atdt[i].ln==count)
			multi.deleteRow(i);
	  }
    }

	function getrules(gid)
	{
		
	var rules="";
	   var multi = eval("multitbl"+gid);
	
	   var atdt = eval("tdt"+gid);
	
	   for(i=1;i<multi.rows.length;i++){
	        var tdtid = atdt[i].ln;
			//alert(tdtid)
	        var s = eval("form1.start_"+gid+"_"+tdtid);
		   	//alert("form1.start_"+gid+"_"+tdtid);
		//document.write s
	        var p = eval("form1.percent_"+gid+"_"+tdtid);
		
			if(isNaN(s.value)||s.value==''||s.value<=0||parseInt(s.value)!=s.value)
			{
				alert("起始数量必须为正整数！");
				s.focus();
				return '';
			}
			if(isNaN(p.value)||p.value==''||p.value<=0||p.value>100)
			{
				alert("比例必须为大于0小于等于100的数字!");
				p.focus();
				return '';
			}
			 if(rules==""){
				deli="";
			 }else{
				deli=",";
			 }
			 rules+=deli+atdt[i].ln;
	   }
	   if(rules=="") 
	   {
				alert("请录入折扣分段！");
				return '';
	   }
	   return rules;
	 }
	
</script>