<!--#include file="head.asp"-->
<style>body{background-color: #fff;}</style>

<%  
act=SafeRequest("act")

sql="select aydiankapay from ayquanju" 
rs.open sql,conn,1,1
qjdianka=rs("aydiankapay")
rs.close

if act<>"" then

	if act="edit" then
	diankashu=SafeRequestform("diankashu")
	s=1
	bilistr=""
	do while s<=cint(diankashu)
		if SafeRequestform("diankakg"&s)=""  then
		kaiguan="1"
		else
		kaiguan="0"
		end if
		if Not isNumeric(SafeRequestform("diankabili"&s)) then call PopErr("排序应为数字")
		if ccur(SafeRequestform("diankabili"&s))>100 then call PopErr("最大值不应超过100")
		if ccur(SafeRequestform("diankabili"&s))<0 then call PopErr("最小值不应小于0")
		bilistr=bilistr&SafeRequestform("diankanameid"&s)&"，"&SafeRequestform("diankaname"&s)&"，"&SafeRequestform("diankabili"&s)&"，"&kaiguan&"，"&SafeRequestform("diankaje"&s)&"，"&SafeRequestform("aydianlname"&s)&"|"     
	s=s+1
	loop
	'response.Write bilistr
	'response.end
	sql="select * from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
	rs.open sql,conn,1,3
	bilistr=trim(bilistr)
	bilistr=mid(bilistr,1,len(bilistr)-1)
	rs("aydianka")=bilistr
	rs.update
	rs.close
	call logadd(request.Cookies("aynameid"),"点卡比例修改成功",0,0)
	%>
		<script language='javascript'>
		alert('修改成功！');
		window.document.location.href="diankabl";
		</script>
		<%
	end if
	
	
	if act="huoqu" then
	sql="select * from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
	rs.open sql,conn,1,3
	rs("aydianka")=""
	rs.update
	rs.close
	
	sql="select * from aykafenlei where aykanamesuoyou="&clng(request.Cookies("aynameid"))&"" 
	rs.open sql,conn,1,3
	if not(rs.bof and rs.eof) then
	do while not rs.eof
	rs("aykafenleidianka")=""
	rs.update
	rs.movenext 
	loop
	end if
	rs.close
	
	sql="select * from aygood where aygoodsuoyouid="&clng(request.Cookies("aynameid"))&"" 
	rs.open sql,conn,1,3
	if not(rs.bof and rs.eof) then
	do while not rs.eof
	rs("aygooddianka")=""
	rs.update
	rs.movenext 
	loop
	end if
	rs.close	
	call logadd(request.Cookies("aynameid"),"点卡比例获取初始数据成功",0,0)
	%>
		<script language='javascript'>
		alert('获取平台初始数据成功！');
		window.document.location.href="diankabl";
		</script>
		<%
	end if

end if

	set rsadd=server.CreateObject("adodb.recordset")
	sql="select * from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
	rsadd.open sql,conn,1,1
	ayjibie=rsadd("ayjibie")


'response.Write rsadd("aydianka")
'response.end

	if isnull(rsadd("aydianka"))=true or trim(rsadd("aydianka"))="" then
		if cint(ayjibie)=5 or cint(ayjibie)=9 then
	
		if qjdianka=1 then '全局点卡支付接口 1易宝 2 70支付
		sql="select * from aydianka order by aydianguid asc" 
		elseif qjdianka=2 then
		sql="select * from aydianka70 order by aydianguid asc" 
		elseif qjdianka=3 then
		sql="select * from aydianka51 order by aydianguid asc" 
		elseif qjdianka=5 then
		sql="select * from aydiankajh order by aydianguid asc" 
		end if
		rs.open sql,conn,1,1
		dim diankastr
			diankastr=""
		do while not rs.eof
		diankastr=diankastr&trim(rs("aydianguid"))&"，"&trim(rs("aydianname"))&"，"&trim(rs("aydianbili"))&"，"&trim(rs("aydiankakg"))&"，"&trim(rs("aydiankaje"))&"，"&trim(rs("aydianlname"))&"|"      
		n=n+1
  		rs.movenext
		loop
		diankastr=trim(diankastr)
		diankastr=mid(diankastr,1,len(diankastr)-1)
		'response.Write diankastr
		'response.End()
		rs.close
			sql="select * from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
			rs.open sql,conn,1,3
			rs("aydianka")=diankastr
			rs.update
			rs.close
			
			
	elseif cint(ayjibie)<>5 and cint(ayjibie)<>9 then
	set rsjb=server.CreateObject("adodb.recordset")
	sqljb="select * from ayujb where ayujbgid="&cint(ayjibie)&"" 
	rsjb.open sqljb,conn,1,1
	diankastr=trim(rsjb("ayujbdianka"))
	'response.Write diankastr
	'response.End()
	rsjb.close

			sql="select * from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
			rs.open sql,conn,1,3
			rs("aydianka")=diankastr
			rs.update
			rs.close

end if
			
			
			
	end if
	

	'  100 / id * 100 比例
	'获取点卡支付ID 提取兑换比例 xaingxi(2)
	'sql="select * from aydianka order by aydianguid asc" 
	'rs.open sql,conn,1,1
	'dim diankastr
	'	diankastr=""
	'do while not rs.eof
	'diankastr=diankastr&trim(rs("aydianguid"))&"，"&trim(rs("aydianname"))&"，"&trim(rs("aydianbili"))&"，"&trim(rs("aydiankakg"))&"|" 
	'n=n+1
  	'rs.movenext
	'loop
	  
	
		'diankastr=trim(diankastr)
		'diankastr=mid(diankastr,1,len(diankastr)-1)
		'diankastr=split(diankastr,"|")
		'For dianka=0 To Ubound(diankastr) 
		'next
        
			'id=6  '获取ID 电信充值卡 *************************
			'xaingxi=split(diankastr(cint(id)-1),"，")
			'For xiangxiid=0 To Ubound(xaingxi) 
			'next				
			'response.Write xaingxi(2)  '0 ID   1 名称  2 比例 3支付开关 0开 1关
	'获取点卡支付ID结束
%>

<script type="text/javascript">
function upperCase(str,zhi){
if(zhi<=0 || zhi>100){
alert('价值比例设置不应大于100！');
return false;
}
var a=100/zhi*100;
str.innerHTML = parseFloat(a).toFixed(2); 
}
</script>

<main>
<div  class="container">
<div class="ui-lrctnei">
<%call userleft()%>
<div class="r"> 
<div class="ui-content">
                        
					
                            
<div class="neiye">

                   
                                                     
            <!-------------------------------------- 开始 -------------------------------------->									
            <div class="neibiaoti"></div>
            <div class="neibiaoti2">点卡价值</div>
            <div class="gexian20"></div>
                	<div class="neitable">
                    <form action="?act=edit" method="post" name="form1" id="form1">
	    <table>
                        <tr class="hd">
                            <td width="220">点卡名称</td>
                            <td width="220">点卡价值</td>
                          <td width="130">是否开启</td>
                            <td>示例说明</td>
                        </tr>
						<%
                        sql="select * from ayname where aynameid="&clng(request.Cookies("aynameid"))&""
                        rs.open sql,conn,1,1
                        diankastr=rs("aydianka")
                        rs.close
                            diankastr=trim(diankastr)
                            diankastr=split(diankastr,"|")
                            For dianka=0 To Ubound(diankastr) 
                                'response.Write diankastr(dianka)
                                'response.end
                            next
                                'xaingxi=split(diankastr(dianka),"，")
                                'For xiangxiid=0 To Ubound(xaingxi) 
                                'response.Write xaingxi(xiangxiid)
                                'next	
                        n=1
                        do while n<=Ubound(diankastr)+1
                                xaingxi=split(diankastr(n-1),"，")
                                for xiangxiid=0 To Ubound(xaingxi) 
                                'response.Write xaingxi(xiangxiid)
                                next
                        %>
                  		<tr onmouseover=this.bgColor='#FAFAFA' onmouseout=this.bgColor='#ffffff'>
                            <td><%=xaingxi(1)%></td>
                    <td><input name="diankabili<%=n%>" type="text" id="diankabili" value="<%=Formatnumber(xaingxi(2),2,true,-1,0)%>" onKeyUp="upperCase(a<%=n%>,this.value)" size="4" maxlength="5" class="reginputd"></td>
                            <td>
                            <input name="diankakg<%=n%>" type="checkbox" id="diankakg" value="0" <%if cint(xaingxi(3))=0 then response.Write("checked")%>> 开启支付</td>
                            <td>&nbsp; 注：单价<span style="color: #FF0000">100</span>元的商品， 需要消费<span style="color: #FF0000" id="a<%=n%>"><%=FormatCurrency(100/xaingxi(2)*100,2,true)%></span>元的卡才能购买。		 							 							 <input name="diankaje<%=n%>" type="hidden" id="diankaje<%=n%>" value="<%=xaingxi(4)%>">
		  					 <input name="aydianlname<%=n%>" type="hidden" id="aydianlname<%=n%>" value="<%=xaingxi(5)%>">
                             <input name="diankanameid<%=n%>" type="hidden" id="diankanameid" value="<%=xaingxi(0)%>">
                             <input name="diankaname<%=n%>" type="hidden" id="diankaname" value="<%=xaingxi(1)%>"></td>
                        </tr>
					  <%
                      n=n+1
                      loop
                      rsadd.close
                      %>
                 		<tr><td colspan="4"> <input style="cursor:pointer"  class="logindlreg" type="submit" name="Submit" value=" 保存修改 "> &nbsp;&nbsp;<a href="?act=huoqu" onClick="javascript:return confirm('获取初始数据，现有兑换比例将清空，您确定吗？');">【获取平台初始数据】</a>
                        <input name="diankashu" type="hidden" id="diankashu" value="<%=Ubound(diankastr)+1%>"></td>
                    </table>
                    </form>
            		</div>
            <!-------------------------------------- 结束 -------------------------------------->
            
            <div class="gexian20"></div>
            <div class="mzsmbox2" style="padding-top:20px;">
			商户级别：<%=getjbname(cint(ayjibie))%><br>
            说明：价值比率就是此卡的真实价值，比如买家要买100元的商品，当价值比率为100%时需要100的卡可以购得商品，如果价值比率为50%，就需要消费200元的卡能才购买到此商品！<br>
            您现在修改是<span style="color: #FF0000; font-weight: bold">全局比例</span>！(如商品分类有单独设置 则按分类比例计算 如商品有单独设置 则按商品比例计算)<br>
            特别注意：您获取的比例是平台的点卡兑换比例，您设置的比例允许比平台比例低，意味着每笔交易您可以获得额外的利润，但<span style="font-weight: bold">如果设置的比例高于平台初始比例，意味着每笔交易您有亏损的危险！</span>平台比例有调整时，我们会提前发布通知，请留意！</span>
            </div>
           
            
           

        <div class="clearfix"></div>



</div>








</div>
</div>
</div>
</div>
</main>


<footer>
<div class="container">
</div>
</footer>

</body>
</html>