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

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

if SafeRequest("act")<>"" then act=SafeRequest("act")
if SafeRequestform("act")<>"" then act=SafeRequestform("act")

if act="edit" then
	diankashu=SafeRequestform("diankashu")
	cid=SafeRequestform("cid")
	cname=SafeRequestform("cname")
	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 aygood where aygoodid="&clng(cid)&" and aygoodsuoyouid="&clng(request.Cookies("aynameid"))&"" 
	rs.open sql,conn,1,3
	ilistr=trim(bilistr)
	bilistr=mid(bilistr,1,len(bilistr)-1)
	rs("aygooddianka")=bilistr
	rs.update

	urllink="goodjiazhi?id="&cid&"&goodname="&cname&""
	call logadd(request.Cookies("aynameid"),"商品价值修改成功"&left(cname,20),0,0)
	call PopErr2("修改成功","goodlist")
	rs.close
end if

if act="huoqu" then
cid=SafeRequest("cid")
goodname=SafeRequest("goodname")
if cid="" or goodname="" then call PopErr("参数获取失败")
	sql="select * from aygood where aygoodid="&clng(cid)&" and aygoodsuoyouid="&clng(request.Cookies("aynameid"))&"" 
	rs.open sql,conn,1,3
    if rs.bof and rs.eof then
	rs.close
	call PopErr("参数获取失败")
	else
	rs("aygooddianka")=""
	rs.update

	end if
	urllink="goodjiazhi?id="&cid&"&goodname="&goodname&""
	call logadd(request.Cookies("aynameid"),"商品价值获取成功"&left(goodname,20),0,0)
	call PopErr2("获取数据成功","goodlist")
	rs.close
end if


id=SafeRequest("id")
goodname=SafeRequest("goodname")
if goodname="" or id="" then call PopErr("参数获取失败")

sql="select * from aygood where aygoodid="&clng(id)&" and aygoodsuoyouid="&clng(request.Cookies("aynameid"))&"" 
rs.open sql,conn,1,3
if rs.bof and rs.eof then 
'rs.close
call PopErr("参数获取失败")
else
	if isnull(rs("aygooddianka"))=true or trim(rs("aygooddianka"))="" then
	set rsadd=server.CreateObject("adodb.recordset")
	sql="select * from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
	rsadd.open sql,conn,1,1
		if isnull(rsadd("aydianka"))=true or trim(rsadd("aydianka"))="" then
		set rsck=server.CreateObject("adodb.recordset")
		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 
		rsck.open sql,conn,1,1
		dim diankastr
			diankastr=""
		do while not rsck.eof
		diankastr=diankastr&trim(rsck("aydianguid"))&"，"&trim(rsck("aydianname"))&"，"&trim(rsck("aydianbili"))&"，"&trim(rsck("aydiankakg"))&"，"&trim(rsck("aydiankaje"))&"|" 
		n=n+1
  		rsck.movenext
		loop
		diankastr=trim(diankastr)
		diankastr=mid(diankastr,1,len(diankastr)-1)
		'response.Write diankastr
		rsck.close
			rs("aygooddianka")=diankastr
			rs.update
			'rs.close
		else
		rs("aygooddianka")=rsadd("aydianka")
		rs.update
		end if
	end if
rs.close
end if

%>



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



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


</div>








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


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

</body>
</html>