<%@page contentType="text/html; charset=UTF-8"%>
<%@include file="/inc/init.jsp" %>
<%
	  int classid=pu.getInt("i");//主要调整此参数
	  String domain=pu.getStringByNoChars("d");
	  ArrayList<String> list=new ArrayList<String>(); 
	  java.util.Random rd=new java.util.Random();
	  boolean isOk=Util.isLimit(pu);//普通情况下，类别大于0并且来源是允许访问的
	  if(isOk){//有效才显示
		  DOC doc=null;
		  doc=new Product_class_db().getOne(classid);
		  boolean isSelect=doc.geti("retain4")==2;//选择显示方式 1为单选，2为下拉
		  boolean showAddress=doc.geti("retain5")==0;//选择显示地址
		  boolean showMarquee=doc.geti("retain6")!=1;//选择默认滚动
		  boolean showNumber=doc.geti("retain7")==1;
		  boolean showPhone2=doc.geti("retain8")==1;
		  boolean showQQ=doc.geti("retain9")==1;
		  DOC[] paydocs=new Pay_type_db().getListByState();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<script src="/js/jquery.js" language="javascript" type="text/javascript"></script>
<script src="/js/buy.js" language="javascript" type="text/javascript"></script>
<script src="/js/area.js" language="javascript" type="text/javascript"></script>
<title>订单提交 - <%=Config.get("version")%></title>
<%
DOC[] docs=null;
Product_db pdb=new Product_db();
docs=pdb.getListByClassidAll(classid);
String URL=request.getRequestURL().toString();  //跳转URL
String price="0";
if(request.getQueryString()!=null){
	URL+="?"+request.getQueryString();
}
%>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-family:"宋体";	
	font-size:13px;
	color:#333
}
a {
	text-decoration:none;
	
}
ul, li {
	list-style-type: none;
}
td {
	font-size:13px;
}
.btn {
	height: 30px;
	margin-top: 3px;
}
.btn input {
	background: url("/images/button/order_btn.gif") no-repeat scroll 0 0 transparent;
	border: 0 none;
	cursor: pointer;
	display: inline;
	float: left;
	height: 28px;
	margin-left: 35px;
	width: 90px;
}
input.pay {
	background-position: -102px 0;
	margin-left: 1px;
	width: 90px;
}
.paybb {
	background-color: #F9F9F9;
	border: 1px dotted #CCCCCC;
	color: #BD0000;
	margin-left:2px;
	width: 270px;
	font: 12px "宋体", Arial, Verdana;
}
.payaa {
	height: 25px;
}
.payaa input{
	margin-left:1px;
}
.payaa label{
	margin-left:-2px;
}
.label {
	cursor: pointer;
	display: block;
	float: left;
	height: 18px;
	line-height: 18px;
	margin: 0 20px 0 6px;
}
.payaa label img {
    border: 0 none;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}
#payn1 > font {
    margin-right: -4px;
}
.mobile_jilu {
	background: none repeat scroll 0 0 #F5FDB9;
	color: #333333;
	font-size: 12px;
	height: 40px;
	line-height: 18px;
	overflow: hidden;
	padding: 5px;
	margin-top: 5px;
	margin-bottom: 5px;
}
/*数量*/
.scount .addmin {
    border: 1px solid #8AB6DD;
    color: #8AB6DD;
    cursor: default;
	margin-left: 5px;
	margin-right: 3px;
}

.scount .text {
    color: #666666;
    display: inline-block;
    padding: 1px 3px;
    text-align: right;
    width: 28px;
}

.numbertext {
    border: 1px solid #8AB6DD;
}

.scount a {
    background: none repeat scroll 0 0 #FFFFFF;
    display: inline-block;
    font-family: arial;
    height: 9px;
    line-height: 9px;
    margin: 5px 0 0;
    overflow: hidden;
    text-align: center;
    width: 9px;
}
.scount  a:hover{
    border: 1px solid #F60;
    color: #F60;
    cursor: default;
	margin-left: 5px;
	margin-right: 3px;
}
-->
</style>
</head>
<body>
<FORM method="post" name="myform" id="myform" action="/buy.do" onsubmit="return checkform();" onreset="resetform();">
	<TABLE width="312" border=0 align="center" cellPadding="0" cellSpacing=1 bgColor="#cccccc" id="producttable">
		<tr>
			<td height="35" align="center" valign="middle" bgcolor="#f7f7f7">产品</td>
			<td height="35" bgcolor="#f7f7f7"><%
      if(isSelect){   //采用select方式显示
      %>
				<span style="padding-left:2px;"></span>
				<select id="productid" class="wenbenkuang" name="productid" style="width:250px;">
					<%
			for(int i=0;i<docs.length;i++){
				if(docs[i].geti("isshow")==2){  //如是停用状态，将不显示
					continue;
				}
				String tempName=docs[i].get("name");
				if(tempName.indexOf("装")!=-1){  //套装名字，不需要后面的
					tempName=Util.sub_StringByKey(tempName,0,"装");
					//tempName=pdname +" "+tempName;//加上产品品牌
				}
				list.add(StringUtil.htmlC2U(tempName,ConfigUtil.unicode));
				boolean isShow=docs[i].geti("isshow")==1;
				if(isShow){//假如是默认的
					price=docs[i].get("price2");
				}else if(price.equals("0")){
					price=docs[i].get("price2");
				}
			%>
					<option title="<%=docs[i].get("price2")%>" value="<%=docs[i].get("productid")%>" <%=isShow?"selected":""%>><%=StringUtil.htmlC2U(docs[i].get("name"),ConfigUtil.unicode)%> (<%=docs[i].get("price2")%>)元<%=isShow?"　【推荐】":""%></option>
					<%}%>
				</select>
				<font class="STYLE17" color="#ff0000">*</font>
				<%
	  }else{
      %>
				<%
			for(int i=0;i<docs.length;i++){
				if(docs[i].geti("isshow")==2){  //如是停用状态，将不显示
					continue;
				}
				String tempName=docs[i].get("name");
				if(tempName.indexOf("装")!=-1){  //套装名字，不需要后面的
					tempName=Util.sub_StringByKey(tempName,0,"装");
					//tempName=pdname +" "+tempName;//加上产品品牌
				}
				list.add(StringUtil.htmlC2U(tempName,ConfigUtil.unicode));
				boolean isShow=docs[i].geti("isshow")==1;
				if(isShow){//用来显示初始的价格
					price=docs[i].get("price2"); //用于显示总计
				}else if(price.equals("0")){
					price=docs[i].get("price2");
				}
			%>
				<input value="<%=docs[i].get("productid")%>" name="productid" style="line-height:24px" type="radio" id="<%="productid"+i%>" alt="<%=StringUtil.htmlC2U(docs[i].get("name"),ConfigUtil.unicode)%> <%=docs[i].get("price2") %>元" title="<%=docs[i].get("price2") %>" <%=docs[i].geti("price2")==0?"disabled":""%>>
				<label for="<%="productid"+i%>" <%=isShow?"id=\"heightlight\"":""%>><%=StringUtil.htmlC2U(docs[i].get("name"),ConfigUtil.unicode)%> <font color="#FF0000"><%=docs[i].get("price2") %></font> 元</label><br />
				<%}%>
		<%} %></td>
		</tr>
		<%if(showNumber){%>
		<TR>
			<TD align="center" valign="middle" bgColor=#f7f7f7>数量</TD>
			<TD width=276 height="35" bgColor=#f7f7f7 class="scount"><a class="addmin" href="javascript:void(0)" onclick="minnumber()">-</a><input type="text" class="text numbertext" value="1" name="number" id="number" onblur="inputnumber();"><a class="addmin" href="javascript:void(0)" onclick="addnumber()">+</a>
			<font class=STYLE17 color=#BD0000>*订购数量(点击增减或填写)</font></TD>
		</TR>
		<%}else{%>
			<input id="number"  name="number" type="hidden" value="1" />
		<%}%>
		<TR>
			<TD height="35" align="center" valign="middle" bgColor=#f7f7f7>姓名</TD>
			<TD width=276 height="35" bgColor=#f7f7f7><span style="padding-left:2px;"></span>
				<input id="contact" class="STYLE21" maxLength=10 size=20 name="contact" style="width:155px;">
			<font class=STYLE17 color=#BD0000>*您的真实姓名</font></TD>
		</TR>
		<TR>
			<TD height="35" align="center" valign="middle" bgColor=#f7f7f7>手机</TD>
			<TD height="35" bgColor=#f7f7f7><span style="padding-left:2px;"></span>
				<input id="phone" maxLength=11 size=20 name="phone" style="width:155px;">
				<font class=STYLE17 color=#BD0000>*您的手机号码</font></TD>
		</TR>
		<%if(showPhone2){ %>
		<TR>
			<TD height="35" align="center" valign="middle" bgColor=#f7f7f7>确认</TD>
			<TD height="35" bgColor=#f7f7f7><span style="padding-left:2px;"></span>
				<input id="phone2" maxLength=11 size=20 name="phone2" style="width:155px;">
				<font class=STYLE17 color=#BD0000>*再次输入手机</font></TD>
		</TR>
		<%} %>
		<%if(showQQ){ %>
		<TR>
			<TD height="35" align="center" valign="middle" bgColor=#f7f7f7>QQ号</TD>
			<TD height="35" bgColor=#f7f7f7><span style="padding-left:2px;"></span>
				<input id="qq" size=20 name="qq" style="width:155px;"> <font class=STYLE17 color=#BD0000>可选填QQ号</font></TD>
		</TR>
		<%}%>
		<%if(showAddress){ %>
		<TR>
			<TD height="35" align="center" valign="middle" bgColor=#f7f7f7>地区</TD>
			<TD height="35" valign="middle" bgColor=#f7f7f7>
				<span style="padding-left:2px;"></span>
				<select errorid="errorArea" emp="true" des="地区" name="Province" class="mobileselect" id="Province" style="width:85px;"></select>
				<select errorid="errorArea" emp="true" name="City" class="mobileselect" id="City"  style="width:85px;"></select>
				<select errorid="errorArea" emp="true" des="地区" name="County" class="mobileselect" id="County"  style="width:85px;"></select>

			<script type="text/javascript">
            new InitPCA("Province", "City", "County", "", "", "");</script></TD>
		</TR>
		<tr>
			<td height="35" align="center" valign="middle" bgcolor="#f7f7f7">地址</td>
			<td height="35" bgcolor="#f7f7f7"><span style="padding-left:2px;"></span>
				<input name="address" id="address" style="width:200px;" maxlength="200" />
				<font class="STYLE17" color="#BD0000">*详细地址</font></td>
		</tr>
		<%} %>
		<tr>
			<td align="center" valign="middle" bgcolor="#f7f7f7">付款<br />方式</td>
			<td bgcolor="#f7f7f7"><div class="payaa">
					<%for(int i=0;i<paydocs.length;i++) {%>
					<input id="pay_type<%=i %>" type="radio" <%=i==0?"checked":"" %> value="<%=paydocs[i].get("payid") %>" name="pay_type" title="<%=paydocs[i].get("rebate")%>" alt="<%=paydocs[i].get("name")%>" /><label for="pay_type<%=i %>" id="payn<%=i %>"><%=paydocs[i].geti("retain2")==0?paydocs[i].get("name"):"<img src=\"images/pay/"+paydocs[i].get("payid")+"wap.gif\" />"%><%if(paydocs[i].geti("rebate")<1){%><font id="dazhe<%=i %>"><%=(paydocs[i].getd("rebate")*100)%10==0?((int)(paydocs[i].getd("rebate")*10))+"":paydocs[i].getd("rebate")*10%>折</font><%}%></label>
					<%} %>
					</div>
				<div style="width:276px;margin-bottom: 1px;">
				    <%for(int i=0;i<paydocs.length;i++){ %>
					<div style="display:<%=i==0?"block":"none"%>;" id="paydiv<%=i %>" class="paybb">
						<div style="line-height:23px; margin:3px 3px;"><%=Util.htmlEncode(paydocs[i].get("content"))%></div>
					</div>
					<%} %>
				</div></td>
		</tr>
		<tr>
			<td height="35" align="center" valign="middle" bgcolor="#f7f7f7">总价</td>
			<td height="35" bgcolor="#f7f7f7"><span style="padding-left:2px;"></span> <span id="price3" style="font-size: 14px;font-weight: bold; color:#F00">0 元</span><font id="fontflag"></font>
			<span style="font-weight: bold;color:#999;display:none;" id="dazhearea">【省<font id="youhuiprice" color="#FF0000">0</font>元】</span></td>
		</tr>
		<TR>
			<TD width="33" height="35" align="center" bgColor="#f7f7f7">留言</TD>
			<TD height="35" bgColor="#f7f7f7"><span style="padding-left:2px;"></span>
			<textarea id="remark" name="remark" style="width:250px;height:40px;margin-top:2px;font-size: 12px;color: #006600;" onblur="if(this.value==''){this.value='如备用联系电话'}" onfocus="if(this.value=='如备用联系电话'){this.value=''}">如备用联系电话</textarea></TD>
		</TR>
		<tr>
			<td align="center" bgColor=#f7f7f7></td>
			<td align="center" bgColor=#f7f7f7><div class="btn">
					<input type="submit" name="Submit" value="" style="margin-left:88px;" />
					<!--<input type="reset" name="reset"  value="" class="pay" style=" float:right;margin-right:30px;" />-->
				</div></td>
		</tr>
	</TABLE>
	<input id="classid" name="classid" size="11" type="hidden" value="<%=classid%>" />
	<input name="action" type="hidden" value="add" />
	<input id="price2" name="price2" type="hidden" value="<%=price %>" />
	<input id="url"  name="url" value="<%=URL%>" type="hidden" />
	<input id="buyurl"  name="buyurl" type="hidden" />
	<input id="referrer"  name="referrer" type="hidden" />
	<input id="gender"  name="gender" type="hidden" value="-1" />
</FORM>
<!--订单滚动开始-->
<% if(showMarquee){%>
<div class="mobile_jilu" id="demo" style="margin:0 auto;"></div>
<%if(list.size()>0){ %>
		<script>
        var marquee = new Array(
"[最新]：13<%=Util.getRamdomString(1)%>****<%=Util.getRamdomString(4)%>在1分钟前订购了 <%=list.get(rd.nextInt(list.size()))%><br />",
"[最新]：13<%=Util.getRamdomString(1)%>****<%=Util.getRamdomString(4)%>在2分钟前订购了 <%=list.get(rd.nextInt(list.size()))%><br />",
"[最新]：159****<%=Util.getRamdomString(4)%>在4分钟前订购了 <%=list.get(rd.nextInt(list.size()))%><br />",
"[最新]：13<%=Util.getRamdomString(1)%>****<%=Util.getRamdomString(4)%>在5分钟前订购了 <%=list.get(rd.nextInt(list.size()))%><br />",
"[最新]：186****<%=Util.getRamdomString(4)%>在7分钟前订购了 <%=list.get(rd.nextInt(list.size()))%><br />",
"[最新]：13<%=Util.getRamdomString(1)%>****<%=Util.getRamdomString(4)%>在9分钟前订购了 <%=list.get(rd.nextInt(list.size()))%><br />",
"[最新]：13<%=Util.getRamdomString(1)%>****<%=Util.getRamdomString(4)%>在10分钟前订购了 <%=list.get(rd.nextInt(list.size()))%><br />",
"[最新]：188****<%=Util.getRamdomString(4)%>在12分钟前订购了 <%=list.get(rd.nextInt(list.size()))%><br />");
        var marqeeI = 0;
        var marqueeII = 1;
        function marqueeL() {
            if (marqeeI > (marquee.length - 1))
                marqeeI = 0;
            if (marqueeII > (marquee.length - 1))
                marqeeI = 0;
            marqueeII = marqeeI + 1;
            var marHTML = marquee[marqeeI] + marquee[marqueeII];
            document.getElementById("demo").innerHTML = marHTML;
            marqeeI += 1;
            marqueeII += 1;
        }
        window.setInterval(function(){marqueeL()},2000);
</script>
<%} %>
<%} %>
<!--订单滚动结束-->
</body>
<script language="javascript" type="text/javascript">
try {
<%
	String str = "document.domain='";
	String topdomain = com.config.Config.get("topdomain");
	if(StringUtil.isFine(domain)){
		topdomain=domain;
	}
	out.print(str + topdomain + "';");
%>
} catch (e) {}
$(document).ready(function(){
try {
	$('#referrer').val(window.parent.document.referrer);
} catch (e) {
	$('#referrer').val(document.referrer);
}
//下单地址
try {
	$('#buyurl').val(window.parent.location.href);
} catch (e) {
	$('#buyurl').val(document.referrer);
}
//宽度
var tableWidth=$("#producttable").width();
$("#demo").width(tableWidth);
//高度
window.setInterval(function(){setheight()},5000);
});
function setheight(){
try {
		var height=$("#producttable").height()+$("#demo").height();
		$("#buyiframe",window.parent.document).height(height+10);
  } catch (e) {}
}
</script>
</html>
<%
doc=null;
docs=null;
paydocs=null;
}
%>
<!--鑫路在线订单管理系统 免费版-->