<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html>
	<head>
		<style>
.user_order_msg { b
	font-size: 25px;
}

.user_order_investor_msg {
	font-size: 20px;
}

div.tabs
{
    width:940px;
	height:35px;
	overflow:hidden;
	padding-left:10px;
	margin-top:10px;
}
div.tabs ul li
{
	float:left;
	padding:0 5px;
}
div.tabs ul li a
{
	display:block;
	width:101px;
	height:36px;
	overflow:hidden;
	line-height:36px;
	text-align:center;
}

</style>
	
		<%@include file="/WEB-INF/navigation/JsAndCss.jsp" %>
		<script type="text/javascript">

		$(function(){
			$(".user_order_msg").css({"fontSize":"25px","color":"#000"});
			$("#user_order").show();
			$("#user_order_investor").hide();
			
		});
		function user_order(){
			$(".user_order_msg").css({"fontSize":"25px","color":"#000"});
			$(".user_order_investor_msg").css({"fontSize":"20px","color":""});
			
			$("#user_order").show();
			$("#user_order_investor").hide();
		}
		
		function user_order_investor(){
			$(".user_order_msg").css({"fontSize":"20px","color":""});
			$(".user_order_investor_msg").css({"fontSize":"25px","color":"#000"});
			
			$("#user_order").hide();
			$("#user_order_investor").show();
			
		}
		

			$(function(){
				if($("#money").val()==null||$("#money").val()=="null"||$("#money").val()==undefined){
					$("#money").val("");
				}
				var minorStatus=$("#minorStatus").val();
				if(minorStatus==="1083"){
					$("#money")[0].type="text";
				}
			});

			function getMinorStatus(){
				var majorStatus=$("#majorStatus").val();
				if(majorStatus===1074){
					$("#statusDescription").val("已完成");
				}
				$.post("findMinorStatusByMajorStatus.do",{"majorStatus":majorStatus},function(data){
					var obj = document.form.minorStatus;
					obj.length=0;
					if(data != null){
						findDescription(data[0].subclassId);
						for(i=0;i<data.length;i++){
							obj[i]=new Option(data[i].title, data[i].subclassId);
						}
					}
				});
				
			}
			function getDescription(){
				var minorStatus=$("#minorStatus").val();
				$.post("findDescriptionByMinorStatus.do",{"minorStatus":minorStatus},function(data){
					if(data != null){
						$("#statusDescription").val(data.description);
						$("#description").val(data.description);
					}
				});
				if(minorStatus==="1083"){
					$("#money")[0].type="text";
				}else{
					$("#money")[0].type="hidden";
				}
			}
			function findDescription(minorStatus){
				$.post("findDescriptionByMinorStatus.do",{"minorStatus":minorStatus},function(data){
					if(data != null){
						$("#statusDescription").val(data.description);
						$("#description").val(data.description);
					}
				});
			}
			
			function selectFinancial(){
				var companyId=$("#select1").val();
				$.ajax({
					url:"findFinancial.do",
					type:"post",
					data:{companyId:companyId},
					success:function(data){
						var obj = document.form.select2;
						obj.length=0;
						for(i=0;i<data.length;i++){
							obj[i] = new Option(data[i].name, data[i].uid);
						}
					}
				});
			}
			function changeMoneyDescription(obj){
				var moneyDes = $("#money").val();
				var bankCard = $("#bankcard").val();
				var cardLastNum = bankCard.substring(bankCard.length-4,bankCard.length);
				$("#statusDescription").val("系统已向您的尾号为"+cardLastNum+"的银行卡打入佣金"+moneyDes+"元，请及时查收");
				$("#description").val("系统已向您的尾号为"+cardLastNum+"的银行卡打入佣金"+moneyDes+"元，请及时查收");
			}
			
		</script>
	</head>
	<body>
		<div class="container">
			<div class="navbar">
				<div class="navbar-inner">
					<%@include file="../navigation/menu.jsp" %>
				</div>
			</div>
			<div class="row">
				<%@include file="../navigation/navigation.jsp" %>
				<div class="span9">
					<ul>
						<li><a href="toModifyUserOrder.do?orderId=${userOrder.orderId}"><span class="user_order_msg">客户订单基本详情 </span></a></li>
						<li><a href="toUpdateUserOrderInvestor.do?orderId=${userOrder.orderId}"><span class="user_order_investor_msg">凭证展示 </span></a></li>
					</ul>
				</div>
					
					<form id="new-project" class="form-horizontal" action="modifyUserOrder.do?orderId=${userOrder.orderId }" method="post" name="form">
						<fieldset>
						<legend></legend>
						<div id="user_order">
							<div class="control-group">
								<label class="control-label" for="input01">客户名字</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="input01" name="userName" value="${userOrder.userName }" readonly/>
									&nbsp;用户名<input type="text" name="submitterTitle" value="${userOrder.submitterTitle }" readonly/></label>
								</div>
								
								
							
							</div>
							
							<div class="control-group">
								<label class="control-label" for="input01">客户电话</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="input01" name=" mobile" value="${userOrder.mobile }" readonly/>
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label" for="input01">订单编号</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="input01" name="orderCode" value="${userOrder.orderCode }" readonly/>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="input01">产品名称</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="input01" name="productName" value="${userOrder.productName }" readonly/>
								</div>
							</div>
							
							<div class="control-group" >
								<label class="control-label" for="input01">专属理财师</label>
								<div class="controls">
									 <select style="width:130px" id="select1" name="companyId" onchange="selectFinancial();"> 
									 <option value="0">-- 选择公司 --</option> 
									  <c:forEach items="${company}" var="company">
									 <option value="${company.companyId}"
										 <c:if test="${company.companyId == user.companyId}">
									  		selected
									 	 </c:if>>
									 	 ${company.companyName}
									  </option>
									  </c:forEach>
									</select> 
									<select style="width:150px" id="select2" name="introducerUid"> 
									 <option value="0">-- 选择理财师 --</option> 
										<option value="${user.uid}" selected>
										${user.name}
										</option>
									</select> 
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="input01">订单来源</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="input01" name="orginTitle"
									<c:if test="${userOrder.orgin == 0 }">value="未知"</c:if>
									<c:if test="${userOrder.orgin == 1 }">value="微信端"</c:if>
									<c:if test="${userOrder.orgin == 2 }">value="金客"</c:if>
									<c:if test="${userOrder.orgin == 3 }">value="企业网站"</c:if>
									<c:if test="${userOrder.orgin == 4 }">value="转发渠道"</c:if>
									  readonly />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="input01">预约金额(万元)</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="input01" name="orderMount" value="${userOrder.orderMount }" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="input01">订单生成时间</label>
								<div class="controls">
								
									<input type="text" class="input-xlarge" id="input01" name="postTime"  value="<fmt:formatDate value="${userOrder.postTime }" pattern="yyyy-MM-dd HH:mm:ss" />" readonly />
								</div>
							</div>
							
							 <div class="control-group">
								<label class="control-label" for="contact">合同邮寄联系人</label>
								<div class="controls">
								 	<input type="text" class="input-xlarge" id="contact" name="contact" value="${userOrder.contact }" />
 								</div>
							</div>
							 <div class="control-group">
								<label class="control-label" for="phone">合同邮寄联系人电话</label>
								<div class="controls">
								 	<input type="text" class="input-xlarge" id="phone" name="phone" value="${userOrder.phone }" />
 								</div>
							</div>
                            <div class="control-group">
								<label class="control-label" for="address">合同邮寄地址</label>
								<div class="controls">
								 	<input type="text" class="input-xlarge" id="address" name="address" value="${userOrder.address }" />
								    <input type="hidden" name="addressId" value="${userOrder.addressId}"/>
 								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="openBank">返佣开户行</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="openBank" name="openBank" value="${userOrder.openBank }" />
									<input type="hidden" name="cardId" value="${userOrder.cardId}"/>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="openName">返佣银行卡开户人</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="openName" name="openName" value="${userOrder.openName }" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="bankcard">返佣银行卡卡号</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="bankcard" name="openCardno" value="${userOrder.openCardno }" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="majorStatus">主状态变更</label>
								<div class="controls">
									<select id="majorStatus" name="majorStatus" onchange="getMinorStatus()">
									<c:if test="${majorStatus!=null}"><option value="${majorStatus.subclassId }">${majorStatus.title }</option></c:if>
									<c:forEach items="${majorStatuses }" var="majorStatuses">
										<c:if test="${majorStatuses.subclassId!=majorStatus.subclassId}"><option value="${majorStatuses.subclassId }">${majorStatuses.title }</option></c:if>
									</c:forEach>
									</select>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="minorStatus">子状态变更</label>
								<div class="controls">
									<select id="minorStatus" name="minorStatus" onchange="getDescription()">
									<c:if test="${minorStatus!=null}"><option value="${minorStatus.subclassId }">${minorStatus.title }</option></c:if>
									<c:forEach items="${minorStatuses }" var="minorStatuses">
										<c:if test="${minorStatus.subclassId!=minorStatuses.subclassId}"><option value="${minorStatuses.subclassId }">${minorStatuses.title }</option>
										</c:if>
									</c:forEach>
									</select>
								<input id="money" type="hidden" name="money" value="${userOrder.money }" placeholder="请输入佣金" 
								onchange="changeMoneyDescription()"/>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="input01">实际打款金额(万元)</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="input01" name="actualMount" value="${userOrder.actualMount }" />
								</div>
							</div>
							<div class="control-group">
							   <label class="control-label" for="description">备注信息</label>
							   <div class="controls">
								  <textarea type="text" class="input-xlarge" id="description"
									  name="description">${userOrder.description }</textarea>
							   </div>
						   </div>
							<div class="control-group">
							   <label class="control-label" for="statusDescription">状态描述</label>
							   <div class="controls">
								  <textarea type="text" class="input-xlarge" id="statusDescription"
									  name="statusDescription">${userOrderStatus.description }</textarea>
							   </div>
						   </div>
						   <div class="control-group">
							   <label class="control-label" for="status">历史状态变更</label>
							   <div class="controls">
								  <div class="input-xlarge" id="status" style="width:700px;">
								      <ul>
								         <c:forEach items="${orderStatus}" var="status" >
								          <li>${status.description}&nbsp;&nbsp;
								          <fmt:formatDate value="${status.postTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
								          </li>
								         </c:forEach>
								      </ul>
								  </div>
							   </div>
						   </div>
							
							<div class="form-actions">
								<button type="submit" class="btn btn-primary">保存</button> <button class="btn" type="reset" onclick="history.back()">取消</button>
							</div>
						</div>
						</div>
						</fieldset>
					</form>
			</div>
		</div>
	</body>
</html>