<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html>

	<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="wap-font-scale" content="no">
	<title>诉讼保全担保服务</title>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<link href="${contextPath}/static/weixin/ssdb/css/common.css" rel="stylesheet">
	<link href="${contextPath}/static/weixin/ssdb/css/main.css" rel="stylesheet">
	<link href="${contextPath}/static/weixin/ssdb/css/ssdb.css" rel="stylesheet">
	<link href="${contextPath}/static/weixin/ssdb/css/style.css" rel="stylesheet">
	<script src="${contextPath}/static/js/flexible.min.js"></script>
	<style>
	.btn-heder {
		width: 1.2rem;
		height: 0.6rem;
		border: 2px solid #ff9900;
		background: #ccc;
		border-radius: 5px 5px 5px 5px / 10px 10px 10px 10px;
		background-color: white;
	}
	</style>
</head>
	<body class="bg-grey">
		<header class="pad-lr-20 bc53a2 fc-white ub ub-ac">
			<span class="icon icon-placeholder"></span>
			<p class="ub-f1 fs-16 text-center">诉讼保全担保服务</p>
			<!-- <span class="header-back">取消</span> -->
		</header>
		<div class="pad-lr-30 ub bc53a2 fs-12 service-progress">
			<div class="ub-f1 service-progress-item ">
				<div class="service-progress-bar"></div>
				<div class="service-progress-dotted "></div>
				<p>申请</p>
			</div>
			<div class="ub-f1 service-progress-item ">
				<div class="service-progress-bar"></div>
				<div class="service-progress-dotted"></div>
				<p>审核</p>
			</div>
			<div class="ub-f1 service-progress-item">
				<div class="service-progress-bar"></div>
				<div class="service-progress-dotted"></div>
				<p>付款</p>
			</div>
			<div class="ub-f1 service-progress-item active">
				<div class="service-progress-bar"></div>
				<div class="service-progress-dotted"></div>
				<p>出函</p>
			</div>
		</div>
		<section>
			<div class="fs-12" style="padding:0.2rem  0  0.2rem 0.2rem ;"><button class="btn-heder" style="color: #ff9900;"><span id="stateName">已配送</span></button><span id="stateDesc" style="padding-left: 0.2rem"></span></div>
		</section>
		<!--审核问题反馈-->
		<section>
			<div id="baodanID" class="hide">
			<p class="retinabt"></p>
			<div class="container-lr pad-t-20">
				<div class="container-left mar-l-30"><img class="ub-f1 " id="imgBaoDanID" style="width: 1rem; height: 1rem;" src="${contextPath}/static/weixin/ssdb/images/photo.png" /></div>
				<div class="ub-f1 container-right" style="margin: -1.2rem 0 0 2rem ; overflow: auto;">
					<div style="margin-left: 1.5rem;padding: 0.2rem 0 0 0 ;">
						<p class="pad-tb-5">保函</p>
						<p class="pad-b-5"><span id="baohankuaidiID">快递配送</span><span   style="padding: 0 0 0 1rem;color:blue;" attr-company="" attr-wl-id="" id="showDetailbaohanID">查看物流信息</span></p>
					</div>
				</div>
			</div>
			</div>
			<div id='baohanID' class="hide">
			<p class="retinabt " style="margin: 1.1rem 0 0 0.2rem;"></p>
			<div class="container-lr pad-t-20 " style="margin: 0.8rem 0 0 0 ;">
				<div class="container-left mar-l-30"><img class="ub-f1 " id="imgBaoHanID" style="width: 1rem; height: 1rem;" src="${contextPath}/static/weixin/ssdb/images/photo.png" /></div>
				<div class="ub-f1 container-right" style="margin: -1.2rem 0 0 2rem ; overflow: auto;">
					<div style="margin-left: 1.5rem;padding: 0.2rem 0 0 0 ;">
						<p class="pad-tb-5">发票</p>
						<p class="pad-b-5"><span id="fapiaokuaidiID">快递配送</span><span style="padding: 0 0 0 1rem;color:blue;" attr-fapiao="" attr-val="" id="showDetailbaofapiaoID">查看物流信息</span></p>
					</div>
				</div>
			</div>
			</div>
		</section>
		<!--服务记录-->
		<section style="clear: both;" >
			<div class="pad-l-20 hide" id="serviceID" >
				<p class="retinabt " style="margin:1.2rem 0 0 0 ;"></p>
				<p class="color555 bg-grey " style="padding: 0 0 0.1rem 0 ;"><span class=" fs-16">服务记录</span></p>
				<p class="retinabt pad-t-10"></p>
				<p class="pad-t-15 hide" id="payedDateP" ><span>确认收款时间:</span><span class="pad-l-5" id="payedDate"></span></p>
				<p class="pad-t-10 pad-b-5 hide" id="sendOutDateP"><span>出函时间:</span><span class="pad-l-5" id="sendOutDate"></span></p>
				<p class="pad-tb-5 hide" id="sendeDateP"><span>配送时间:</span><span class="pad-l-5" id="sendeDate"></span></p>
			</div>
		</section>
	<script type="text/javascript" src="${contextPath}/static/js/jquery-1.12.0.min.js"></script>
	<script type="text/javascript" src="${contextPath}/static/js/layer/layer.js"></script>
	<script type="text/javascript" src="${contextPath}/static/js/jstorage.js"></script>
	<script type="text/javascript" src="${contextPath}/static/js/requestutil.js"></script>
	<script type="text/javascript">
 	$(document).ready(function() {
		  var orderId="${orderId}";//订单ID
  			var baseURL='<%=com.fadu.app.util.AppConfig.url_duowenapp_b%>';
  			var token=$.jStorage.get("token");
			var jsonReq = {};
			jsonReq.orderId = orderId;
			jsonReq.step="4";
			jsonReq.token=token;
			jsonReq.actionCode = "B511";
			var url = baseURL + "/B/android/";
			console.log(jsonReq);
			requestData(url, jsonReq, success, fail);
			function success(json) {
				console.log(json);
				if (json) {
					if (json.success == true) {
						var stateName=json.stateName;
						var orderState=json.orderState;
						var stateDesc=json.stateDesc;
						var attachExms=json.attachExms;//保单
						var attachExms1=json.attachExms1;//保函
						var payedDate=json.payedDate;//确认收款时间
						var sendeDate=json.sendeDate;//配送时间
						var sendOutDate=json.sendOutDate;//出函时间
						var wls=json.wls;//物流信息
						//0:快递配送，1：上门配送  wls sendType
						//orderState=40 已出函 待配送     orderState=41 已经配送
						if(orderState==40||orderState==41){
							if(attachExms.length>0){//存在保单
								$.each(attachExms,function(i,v){
								console.log(v);
										var pathSL=v.pathSL;
										var path=v.path;
										if(pathSL){
											$("#imgBaoDanID").attr("src",pathSL);
										}else{
											$("#imgBaoDanID").attr("src",path);
										}
								});
								$("#baodanID").removeClass("hide");
							}
							if(attachExms1.length>0){//存在保函
								$.each(attachExms1,function(i,v){
									console.log(v);
										var pathSL=v.pathSL;
										var path=v.path;
										if(pathSL){
											$("#imgBaoHanID").attr("src",pathSL);
										}else{
											$("#imgBaoHanID").attr("src",path);
										}	
								});
								$("#baohanID").removeClass("hide");
							}
						}
						//服务记录控制
						if(stateDesc){
							$("#stateDesc").text(stateDesc);						
						}
						$("#stateName").text(stateName);
						if(payedDate){
							$("#serviceID").attr("style", "display: block  !important");
							$("#payedDateP").attr("style", "display: block  !important");
							$("#payedDate").text(payedDate);
						}
						if(sendeDate){
							$("#serviceID").attr("style", "display: block  !important");
							$("#sendeDateP").attr("style", "display: block  !important");
							$("#sendeDate").text(sendeDate);
						}
						if(sendOutDate){
							$("#serviceID").attr("style", "display: block  !important");
							$("#sendOutDateP").attr("style", "display: block  !important");
							$("#sendOutDate").text(sendOutDate);
						}
						detail(wls);
						//服务记录控制end
						/* var url="${contextPath}/web/ssdb/ssdbpay/"+orderId+"/"+token+"/";
							location.href=url;//付款页面 */
					}else{
						layer.msg(json.message);
					}
				} else {
					layer.msg("获取信息失败!!");
				}
			}
			//物流操作
			function detail(jsonArray){
				var json0=jsonArray[0];
				var json1=jsonArray[1];
				console.log(json0);
				console.log(json1);
				if(json0){
					if(json0.sendType==0){//0 ：快递配送 1：上门配送
						$("#baohankuaidiID").text("快递配送");
					}else{
						$("#showDetailbaohanID").addClass("hide");
						$("#baohankuaidiID").text("上门配送");
					}
					if(json0.wl_company&&json0.wl_order){
						$("#showDetailbaohanID").attr("attr-company",json0.wl_company);
						$("#showDetailbaohanID").attr("attr-wl-id",json0.wl_order);
					}
				}
				if(json1){
					if(json1.sendType==0){//0 ：快递配送 1：上门配送
						$("#fapiaokuaidiID").text("快递配送");
					}else{
						$("#showDetailbaofapiaoID").addClass("hide");
						$("#fapiaokuaidiID").text("上门配送");
					}
					if(json1.wl_company&&json1.wl_order){
						$("#showDetailbaofapiaoID").attr("attr-fapiao",json1.wl_company);
						$("#showDetailbaofapiaoID").attr("attr-val",json1.wl_order);
					}
				}
			}
			$("#showDetailbaohanID").click(function(){
				var company_name_han=$("#showDetailbaohanID").attr("attr-company");
				var company_order_han=$("#showDetailbaohanID").attr("attr-wl-id");
				var content='';
				content=content+'<p class="mar-l-25 pad-t-20 br-b ">物流信息</p>';
				content=content+'<p class="mar-l-25 pad-tb-10 br-b">物流公司:<span>'+company_name_han+'</span></p>';
				content=content+'<p class="mar-l-25 pad-tb-10 ">物流信息:<span>'+company_order_han+'</span></p>';
				layer.open({
				  type: 1,
				  title: false,
				   closeBtn: 0,
				   shadeClose: true,
				 // skin: 'layui-layer-rim', //加上边框
				  area: ['4.5rem'], //宽高
				  content: content
				});
			});
			$("#showDetailbaofapiaoID").click(function(){
				var company_name_han=$("#showDetailbaofapiaoID").attr("attr-fapiao");
				var company_order_han=$("#showDetailbaofapiaoID").attr("attr-val");
				var content='';
				content=content+'<p class="mar-l-25 pad-t-20 br-b ">物流信息</p>';
				content=content+'<p class="mar-l-25 pad-tb-10 br-b">物流公司:<span>'+company_name_han+'</span></p>';
				content=content+'<p class="mar-l-25 pad-tb-10 ">物流信息:<span>'+company_order_han+'</span></p>';
				layer.open({
				  type: 1,
				  title: false,
				   closeBtn: 0,
				   shadeClose: true,
				 // skin: 'layui-layer-rim', //加上边框
				  area: ['4.5rem'], //宽高
				  content: content
				});
			});
			function fail(resp) {
				console.log(resp);
			}
   });
  </script>
</body>
</html>