<!--#include file="conn.asp"-->
<%
dim dingdan,payid,submitname
dingdan=request("orderId")
payid=request("payid")

if payid="ALIPAY" then
submitname="alipayment"
elseif payid="TENPAY" then
submitname="directFrm"
elseif payid="BillPAY" then
submitname="kqPay"
else
submitname="alipayment"
end if

set rs=server.CreateObject("adodb.recordset") 
rs.open "select shopxp_action.shopxpacid,shopxp_action.promoRuleId,shopxp_action.couponCodeNumber,shopxp_action.feiyong,shopxp_action.provinceId,shopxp_action.cityId,shopxp_action.countyId,shopxp_action.deliveryTimeId,shopxp_action.user_01,shopxp_action.user_03,shopxp_action.user_04,shopxp_action.user_05,shopxp_action.user_06,shopxp_action.useremail,shopxp_action.delivery,shopxp_action.zhuangtai,shopxp_action.shopxp_shfs,shopxp_action.liuyan,shopxp_action.zhifufangshi,shopxp_action.shopxpptid,shopxp_action.actiondate,shopxp_action.productcount,shopxp_action.fapiaoTt,shopxp_action.jifen_dk,shopxp_action.zonger,com_books.id,com_books.cid,com_books.titlecn,com_books.bookpicm,com_books.titlecn,com_books.shichangjia,com_books.shopxphyjia,com_books.jifeng,com_books.shopxpvjia from com_books inner join  shopxp_action on com_books.id=shopxp_action.shopxpptid where shopxp_action.dingdan='"&dingdan&"' ",conn,1,1

zongji=0
jf=0
kg_zong=0
do while not rs.eof
	bookiid=rs("shopxpptid")
	jianshu=jianshu+rs("productcount")
	zongji=zongji+rs("zonger")
	subtitle=rs("titlecn")
	subid=rs("id")
	subcid=rs("cid")
	subbookpicm=rs("bookpicm")
	jifeng=jifeng+rs("jifeng")
	shichangjia=rs("shichangjia")
	shopxphyjia=rs("shopxphyjia")
	jifen_dk=rs("jifen_dk")
	
jf=jf+rs("jifeng")
'kg_zong=kg_zong+rs("cs4")*rs("productcount")
feiyong=rs("feiyong")
rs.movenext
loop
rs.movefirst

if rs("promoRuleId")<>"coupon_code" then
	setId=replace(rs("promoRuleId"),"act_","")
	set rsp=server.CreateObject("adodb.recordset")
	rsp.open "select * from com_act where id="&setId&"",conn,1,1
	if not rsp.bof or not rsp.eof then
	amount=rsp("amount")
	act_name=rsp("CodeNumber")
	end if
	rsp.close
	set rsp=nothing
showword="("&act_name&")优惠：<span>- <font color=red>"&Formatnumber(amount,2,-1,-1,0)&"</font></span>"

elseif rs("promoRuleId")="coupon_code" and rs("couponCodeNumber")<>"" then
	set rsp=server.CreateObject("adodb.recordset")
	rsp.open "select * from com_coupon where CodeNumber='"&rs("couponCodeNumber")&"'",conn,1,1
	if not rsp.bof or not rsp.eof then
	amount=rsp("amount")
	end if
	rsp.close
	set rsp=nothing
showword="优惠券：<span>- <font color=red>"&Formatnumber(amount,2,-1,-1,0)&"</font></span>"
	
else
amount=0
showword="无优惠：<span>- <font color=red>0.00</font></span>"
end if

'if zongji<200 then
'zongji_a=feiyong+zongji-int(s_yfk)-int(s_jf)
'else
'zongji_a=zongji-int(s_yfk)-int(s_jf)
'end if
zongji_a=feiyong+zongji-jifen_dk-amount
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>接口</title>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<BODY topMargin=4 onLoad="jscript:<%=submitname%>.submit();">

<form id="alipayment" name="alipayment" action="alipay/alipayapi.asp" method="post">
<!--卖家支付宝帐户：--><input size="30" name="WIDseller_email" value="<%=cart_email%>" readonly="readonly" type='hidden' />
<!--商户订单号：--><input size="30" name="WIDout_trade_no" value="<%=dingdan%>" readonly="readonly" type='hidden'/>
<!--订单名称：--> <input size="30" name="WIDsubject" value="<%=dingdan%>" type='hidden'/>
<!--付款金额：--><input size="30" name="WIDprice" value="<%=zongji_a%>" readonly="readonly" type='hidden'/>
<!--订单描述：--><input size="30" name="WIDbody" value="<%if session("fapiaoTt")<>"" then%>发票抬头：<%=session("fapiaoTt")%>;<%end if%><%=session("liuyan")%>" type='hidden'/>
<!--商品展示地址：--> <input size="30" name="WIDshow_url" value="http://<%=cart_web%>/cn_asp/orderDetail.asp?dingdan=<%=dingdan%>" type='hidden'/>
<!--收货人姓名：--><input size="30" name="WIDreceive_name" value="<%=session("admin_xyz")%>" type='hidden'/>
<!--收货人地址：--><input size="30" name="WIDreceive_address" value="<%=rs("user_03")%>" type='hidden'/>
<!--收货人邮编：--><input size="30" name="WIDreceive_zip" value="<%=rs("user_04")%>" type='hidden'/>
<!--收货人电话号码：--><input size="30" name="WIDreceive_phone" value="<%=rs("user_05")%>" type='hidden'/>
<!--收货人手机号码：--><input size="30" name="WIDreceive_mobile"  value="<%=rs("user_06")%>" type='hidden'/>
<!--<button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>-->
</form>

<form id="directFrm" name="directFrm" action="tenpay/tenpay.asp" method="get">
<!--财付通商户号--><input type="hidden" name="order_no" maxlength="50" size="18"  value="<%=dingdan%>" />
<!--付款项目--> <input name='product_name'  value="<%=dingdan%>"   type='hidden' size="18" maxlength="50"  />
<!--付款金额--><input size="30" name="order_price" value="<%=zongji_a%>"  type='hidden'/>
<!--支付方式--><input type="hidden" name="trade_mode" value="1"  checked="true" /><!--即时到帐&nbsp;<input type="radio" name="trade_mode" value="2" />中介担保&nbsp;<input type="radio" name="trade_mode" value="3" />后台选择--> 
<!--简要说明--><input size="30" name="remarkexplain" id="remark2" value="<%if session("fapiaoTt")<>"" then%>发票抬头：<%=session("fapiaoTt")%>;<%end if%><%=session("liuyan")%>" type='hidden'/>
</form>


<form id="kqPay" name="kqPay" method="post" action="billpay/send.asp">
			<input type="hidden" name="payerName" value="<%=session("admin_xyz")%>">
			<input type="hidden" name="payerContact" value="<%=rs("user_06")%>">
			<input type="hidden" name="orderId" value="<%=dingdan %>">
			<input type="hidden" name="orderAmount" value="<%=zongji_a %>">
			<input type="hidden" name="productName" value="<%=dingdan %>">
		</form>	
</body>
</html>




