<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiadmin/dist/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/static/css/reset.css">
</head>
<style>
    .orderCost td{
        padding: 5px 32px;
    }
    .orderTd{
        font-weight:bold;
    }
</style>
<body class="">
<div class="layui-fluid ">
    <div class="layui-card pr-10 over">
        <div class="layui-card-body layui-col-xs11">
    <form class="layui-form" action="" lay-filter="component-form-group" id="orderForm">
        <div class="layui-card">
            <input type="hidden" name="id" id="orderId" value="${order.id}">
          <%--  <input type="hidden" id="logisticName" name="logisticName" value="${order.logisticsName}">
            <input type="hidden" id="logisticNo" name="logisticNo" value="${order.logisticsNo}">--%>
          <%--  <input type="hidden" name="sign" id="sign" value="${order.customerSignFlag}">--%>
            <input type="hidden" name="fittingFlag" id="fittingFlag" value="${order.fittingFlag}">
          <%-- <fieldset class="layui-elem-field " >--%>
                <div class="site-demo-button siteOrderButten">
                    <button type="button" class="layui-btn  ">基本信息</button>
                    <button type="button" class="layui-btn layui-btn-primary">过程信息</button>
                    <button type="button" class="layui-btn layui-btn-primary">物流信息</button>
                </div>
            <hr class="layui-bg-gray">
            <div class="layui-card-header pt-10">
                <div class="layui-col-lg2 layui-col-sm4">
                    <label>工单编号：${order.number}</label>
                </div>
                <div class="layui-col-lg2 layui-col-sm4 layui-form" lay-filter="component-form-element">
               <%--     <label >下单时间：<fmt:formatDate value="${order.createTime}" pattern="yyyy-MM-dd HH:mm"/></label>--%>
                    <label >服务类型：${order.serviceType}</label>
                </div>

                <div class="layui-col-lg2 layui-col-sm4" style="position: relative">
                    <label >服务措施：${order.serviceMeasures}</label>
                </div>


            </div>
        </div>
        <div class="layui-card jibenxinxi ">
            <div class="layui-card-header pt-10">
                <h1 class="title">用户信息</h1>
            </div>
            <div class="layui-card-body ">
                <div class="layui-form" action="" lay-filter="component-form-element">
                    <div class="layui-row layui-col-space12 layui-form-item">

                        <div class="layui-col-lg3 layui-col-sm4">
                            <label class="layui-form-label"><i class="mark">*</i>用户姓名：</label>
                            <div class="layui-input-block">
                                <input type="text" name="customerName" id="customerName" lay-verify="required" placeholder=""
                                       autocomplete="off" class="layui-input layui-bg-gray" value="${order.customerName}" disabled>
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm4 layui-form" lay-filter="component-form-element">
                            <label class="layui-form-label">性别：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="customerSex" value="1" title="先生">
                                <input type="radio" name="customerSex" value="2"  title="女士" >
                            </div>
                        </div>

                        <div class="layui-col-lg3 layui-col-sm4" style="position: relative">
                            <label class="layui-form-label"><i class="mark">*</i>联系方式1：</label>
                            <div class="layui-input-block pr-30">
                                <input type="text" name="customerMobile" lay-verify="required" class="layui-input layui-bg-gray" value="${order.customerMobile}" disabled>
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm4">
                            <label class="layui-form-label">联系方式2：</label>
                            <div class="layui-input-block">
                                <input type="text" name="customerTelephone" id="customerTelephone"  placeholder=""
                                       autocomplete="off" class="layui-input layui-bg-gray" value="${order.customerTelephone}" disabled>
                            </div>
                        </div>
                        <div class="layui-col-lg8">
                            <div class="layui-col-xs12 layui-form-item">
                                <label class="layui-form-label"><i class="mark">*</i>用户地址：</label>
                                <div class="layui-input-block">
                                    <div class="layui-col-lg3 layui-col-sm3 pr-30">
                                        <select name="province" id="province" lay-verify="required" lay-filter="province" disabled lay-search>
                                            <option value=""></option>
                                            <c:forEach items="${pros}" var="pro">
                                                <option value="${pro.columns.ProvinceName}" <c:if test="${order.province eq pro.columns.ProvinceName}">selected</c:if> title="${pro.columns.ProvinceID }">${pro.columns.ProvinceName}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <div class="layui-col-lg2 layui-col-sm3 pr-30">
                                        <select name="city" id="city" lay-verify="required" lay-filter="city" disabled lay-search>
                                            <option value="">请选择</option>
                                            <c:forEach items="${faccitys}" var="city">
                                                <option value="${city.columns.CityName}" <c:if test="${order.city eq city.columns.CityName}">selected</c:if> title="${city.columns.CityID}">${city.columns.CityName}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <div class="layui-col-lg2 layui-col-sm3 pr-30">
                                        <select name="area" id="area" lay-verify="required" lay-filter="aihao" disabled lay-search>
                                            <option value="">请选择</option>
                                            <c:forEach items="${areas}" var="area">
                                                <option value="${area.columns.DistrictName}" <c:if test="${order.area eq area.columns.DistrictName}">selected</c:if> title="${area.columns.DistrictID}">${area.columns.DistrictName}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <div class="layui-col-lg6 layui-col-sm3">
                                        <input type="text" name="customerAddress" lay-verify="required" placeholder=""
                                               autocomplete="off" class="layui-input layui-col-lg2 layui-bg-gray" value="${order.customerAddress}" disabled>
                                    </div>
                                </div>

                            </div>

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

        </div>
        <div class="layui-card jibenxinxi">
            <div class="layui-card-header pt-10">
                <h1 class="title">服务信息</h1>
            </div>
            <div class="layui-card-body">
                <div class="layui-form" action="" lay-filter="component-form-element">
                    <div class="layui-row layui-col-space12 layui-form-item">

                        <div class="layui-col-lg2 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>产品品牌：</label>
                            <div class="layui-input-block">
                                <select name="applianceBrand" id="applianceBrand" lay-verify="required" lay-filter="applianceBrand" disabled lay-search>
                                    <c:forEach items="${product}" var="bran">
                                        <option value="${bran.columns.brand }" <c:if test="${bran.columns.brand eq order.applianceBrand}"> selected</c:if> >${bran.columns.brand}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="layui-col-lg2 layui-col-sm3">
                            <label class="layui-form-label"><i class="mark">*</i>产品品类：</label>
                            <div class="layui-input-block">
                                <select name="applianceCategory" id="applianceCategory" lay-verify="required" disabled lay-filter="applianceCategory" lay-search>
                                    <c:forEach items="${cate}" var="ca">
                                        <option value="${ca.columns.category }" <c:if test="${ca.columns.category eq order.applianceCategory}"> selected</c:if> >${ca.columns.category}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>

                        <div class="layui-col-lg2 layui-col-sm3">
                            <label class="layui-form-label">产品型号：</label>
                            <div class="layui-input-block">
                                <select name="applianceModel" id="applianceModel" lay-verify="required"  disabled class="layui-bg-gray" lay-search>
                                    <option value="${order.applianceModel}">${order.applianceModel}</option>

                                </select>
                            </div>
                        </div>
                        <div class="layui-col-lg2 layui-col-sm3">
                            <label class="layui-form-label">产品数量：</label>
                            <div class="layui-input-block">
                                <input type="text" name="applianceNum" id="applianceNum"  placeholder=""
                                       autocomplete="off" class="layui-input layui-bg-gray" value="" disabled>
                            </div>
                        </div>
                        <div class="layui-col-lg2 layui-col-sm3">
                            <label class="layui-form-label">机身条码：</label>
                            <div class="layui-input-block">
                                <input type="text" name="applianceBarcode"  placeholder="" id="applianceBarcode"
                                       autocomplete="off" class="layui-input layui-bg-gray" value="${order.applianceBarcode}" disabled>
                            </div>
                        </div>
                        <div class="layui-col-lg2 layui-col-sm3">
                            <label class="layui-form-label">购买时间：</label>
                            <div class="layui-input-block">
                                <input type="text" name="applianceBuyTime" id="applianceBuyTime"   placeholder="" disabled
                                       autocomplete="off" class="layui-input layui-bg-gray" value="<fmt:formatDate value="${order.applianceBuyTime}" pattern="yyyy-MM-dd" />">
                            </div>
                        </div>
                        <div class="layui-col-lg2 layui-col-sm3">
                            <label class="layui-form-label">购买渠道：</label>
                            <div class="layui-input-block">
                                <select  name="pleaseReferMall" id="pleaseReferMall"  lay-filter="aihao" class="layui-bg-gray" disabled lay-search>
                                    <option value=""></option>
                                    <c:forEach items="${mall}" var="mal">
                                        <option value="${mal.columns.mall_name}" <c:if test="${order.pleaseReferMall == mal.columns.mall_name}">selected</c:if> >${mal.columns.mall_name}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="layui-col-lg3 layui-col-sm3 layui-form" lay-filter="component-form-element">
                            <label class="layui-form-label"><i class="mark">*</i>保修类型：</label>
                            <div class="layui-input-block">
                                <select  name="warrantyType" id="warrantyType"  lay-filter="aihao" class="layui-bg-gray" disabled>
                                    <option value="">请选择</option>
                                    <option value="1" <c:if test="${order.warrantyType eq 1}">selected</c:if> >保内</option>
                                    <option value="2" <c:if test="${order.warrantyType eq 2}">selected</c:if> >保外</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-col-lg2 layui-col-sm3">
                            <label class="layui-form-label">
                                工单加急：</label>
                            <div class="layui-input-block">
                                <select name="completeLimitLength" id="completeLimitLength" lay-filter="completeLimitLength" class="layui-bg-gray" disabled>
                                    <option value="" ></option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-col-lg2 layui-col-sm3 lh-30">
                            <input type="hidden" name="completeExtendCost"  id="completeExtendCost" value="">
                            加急费：<span class="red completeExtendCost" id="seriousMoney">¥</span>元
                        </div>
                        <div class="layui-col-xs12">
                            <label class="layui-form-label"><i class="red">*</i>故障描述：</label>
                            <div class="layui-input-block">
                                <input name="remarks" id="remarks" placeholder="" class="layui-input layui-bg-gray" lay-verify="required" disabled value="${order.remarks}"></input>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <div class="layui-card processInformation layui-hide">
        <ul class="layui-timeline guoChen">



        </ul>
    </div>

            <div class="layui-card over pl-10 logsticInfoNew layui-hide">
                <div class="layui-col-xs6 pr-20">
                    <h1 class="title mt-10">寄件物流</h1>
                    <div class="mt-5">
                        <div class="layui-collapse" lay-accordion="">
                            <c:choose>
                                <c:when test="">
                                    <div class="layui-colla-item">
                                        <h2 class="layui-colla-title productInfo">${order.applianceBrand}${order.applianceCategory}</h2>
                                        <div class="layui-colla-content">
                                            <ul class="layui-timeline logisticInfor" style="max-height: 200px;overflow-y: auto">
                                            </ul>
                                        </div>
                                    </div>
                                </c:when>
                                <c:otherwise>

                                </c:otherwise>
                            </c:choose>
                            <c:choose>
                                <c:when test="${order.fittingFlag eq '2'}">
                                    <div class="layui-colla-item">
                                        <h2 class="layui-colla-title fitRefundInfo">已发备件</h2>
                                        <div class="layui-colla-content">
                                            <ul class="layui-timeline logisticInfor" style="max-height: 200px;overflow-y: auto">

                                            </ul>
                                        </div>
                                    </div>
                                </c:when>
                                <c:otherwise>
                                </c:otherwise>
                            </c:choose>

                            <c:forEach items="${applyInfo}" var="info">
                                <c:choose>
                                    <c:when test="${info.columns.site_id eq ''}">

                                    </c:when>
                                    <c:when test="${info.columns.site_id eq null}">

                                    </c:when>
                                    <c:otherwise>
                                        <div class="layui-colla-item">
                                            <h2 class="layui-colla-title fitApplyInfo" data-logName="${info.columns.logistics_names}" data-logNumber="${info.columns.logistics_number}" >${info.columns.fitting_name}</h2>
                                            <div class="layui-colla-content">
                                                <ul class="layui-timeline logisticInfor" style="max-height: 200px;overflow-y: auto">

                                                </ul>
                                            </div>
                                        </div>
                                    </c:otherwise>
                                </c:choose>
                            </c:forEach>
                        </div>

                    </div>
                </div>
                <div class="layui-col-xs6 pr-20">
                    <h1 class="title mt-10">返件物流</h1>
                    <div class="mt-5">
                        <div class="layui-collapse" lay-accordion="">
                            <c:forEach items="${rd}" var="rdList">
                                <c:choose>
                                    <c:when test="${rdList.columns.fitting_name eq ''}">

                                    </c:when>
                                    <c:when test="${rdList.columns.fitting_name eq null}">

                                    </c:when>
                                    <c:otherwise>
                                        <div class="layui-colla-item">
                                            <h2 class="layui-colla-title returnFactoryInfo" data-logName="${rdList.columns.logistics_names}" data-logNum="${rdList.columns.logistics_number}">${rdList.columns.fitting_name}</h2>
                                            <div class="layui-colla-content">
                                                <ul class="layui-timeline returnFactory" style="max-height: 200px;overflow-y: auto">

                                                </ul>
                                            </div>
                                        </div>
                                    </c:otherwise>
                                </c:choose>
                            </c:forEach>
                        </div>
                    </div>
                </div>
            </div>
    <div class="layui-card orderqitaxinxi">
        <div class="site-demo-button fuwufankuiorder">

            <button type="button" class="layui-btn " >服务反馈</button>
            <button type="button" class="layui-btn layui-btn-primary" >个人记录</button>
            <button type="button" class="layui-btn layui-btn-primary" >备件信息</button>
           <button type="button" class="layui-btn layui-btn-primary" >回访信息</button>
            <button type="button" class="layui-btn layui-btn-primary" >服务商结算</button>
        </div>
        <div class="layui-card-body   fuwufankui orderRelation">
            <div class="layui-form" action="" lay-filter="component-form-element">
                <div class="layui-row layui-col-space12 layui-form-item pt-10">
                    <div class="layui-col-xs4">
                        <label class="layui-form-label">工单状态：</label>
                        <div class="layui-input-block">
                            <c:if test="${order.status eq 1}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="待派工"></c:if>
                            <c:if test="${order.status eq 2}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="服务中"></c:if>
                            <c:if test="${order.status eq 3}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="待回访"></c:if>
                            <c:if test="${order.status eq 4}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="待结算"></c:if>
                            <c:if test="${order.status eq 5}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="已完成"></c:if>
                            <c:if test="${order.status eq 6}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="无效工单"></c:if>
                        </div>
                    </div>
                    <div class="layui-col-xs4">
                        <label class="layui-form-label">服务商：</label>
                        <div class="layui-input-block">
                            <input type="text"  placeholder=""
                                   autocomplete="off" class="layui-input layui-bg-gray" value="${order.siteName}" disabled>
                        </div>
                    </div>
                    <div class="layui-col-xs4">
                        <label class="layui-form-label">服务工程师：</label>
                        <div class="layui-input-block">
                            <input type="text"  placeholder=""
                                   autocomplete="off" class="layui-input layui-bg-gray" value="${order.employeName}" disabled>
                        </div>
                    </div>
                    <div class="layui-col-xs12">
                        <label class="layui-form-label">反馈内容：</label>
                        <div class="layui-input-block lh-34">
                            <c:forEach var="fbItems" items="${feedbackInfo.feedbackResults}">
                                <p class="processItem">
                                    <span class="time">${fbItems.feedbackTime} </span>
                                    <span>${fbItems.feedbackName }：${fbItems.feedbackResults }</span>
                                </p>
                            </c:forEach>
                        </div>
                    </div>
                    <div class="layui-col-xs12">
                        <label class="layui-form-label">过程图片：</label>
                        <div class="layui-input-block">
                            <c:forEach var="fbImgItems" items="${feedbackInfo.feedbackImgs}">
                                <c:if test="${not empty fbImgItems.fbImgPath }">
                                    <c:forEach var="fbImgItem" items="${fbImgItems.fbImgPath}">
                                        <div class="imgWrap1 f-l" id="img${da.index}">
                                            <div class="imgWrap text-c">
                                                <img src="${commonStaticImgPath}${fbImgItem}" data-img="${commonStaticImgPath}${fbImgItem}" class="w-80 h-80 selectImg" style="width:150px;">
                                                <p class="hei">${fbImgItems.fbImgTime}</p>
                                            </div>
                                        </div>
                                    </c:forEach>
                                </c:if>
                            </c:forEach>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-card orderRelation layui-hide">
            <ul class="layui-timeline">
                <c:forEach items="${detail}" var="deta">
                    <li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis"></i>
                        <div class="layui-timeline-content layui-text">
                            <h4 class="layui-timeline-title">${deta.t}</h4>
                            <p>
                                    ${deta.c}
                            </p>
                        </div>
                    </li>

            </c:forEach>

            </ul>
        </div>

        <div class="layui-card  layui-hide orderRelation">
            <table class="layui-table " style="table-layout:fixed;">
            <thead>
            <tr>
                <th width="13%">备件名称</th>
                <th width="13%">备件条码</th>
                <th width="13%">备件描述</th>
                <th width="13%">备件状态</th>
                <th width="13%">使用数量</th>
                <%--<th width="13%">是否返旧</th>--%>
                <th width="13%">有无返旧</th>
                <th width="12%">收货人</th>
                <th width="14%">联系方式</th>
                <th width="15%">收货地址</th>
            </tr>
            </thead>
            <tbody id="fittingOrder">


            </tbody>
        </table>
        </div>
        <div class="layui-card-body layui-hide orderRelation">
            <div class="" lay-filter="component-form-element">
                <div class="layui-row layui-col-space12 layui-form-item">
                    <div class="layui-col-lg2 layui-col-sm3">
                        <label class="layui-form-label">服务态度：</label>
                        <div class="layui-input-block">
                            <c:if test="${call.columns.service_attitude eq 1}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="十分不满意"></c:if>
                            <c:if test="${call.columns.service_attitude eq 2}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="不满意"></c:if>
                            <c:if test="${call.columns.service_attitude eq 3}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="一般 "></c:if>
                            <c:if test="${call.columns.service_attitude eq 4}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="满意"></c:if>
                            <c:if test="${call.columns.service_attitude eq 5}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="十分满意"></c:if>
                            <c:if test="${call.columns.service_attitude eq 6}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="无效回访"></c:if>
                        </div>
                    </div>
                    <div class="layui-col-lg2 layui-col-sm3">
                        <label class="layui-form-label">安全评价：</label>
                        <div class="layui-input-block">
                            <c:if test="${call.columns.safety_evaluation eq 1}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="按安全规范操作"></c:if>
                            <c:if test="${call.columns.safety_evaluation eq 2}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="未出示上岗证"></c:if>
                            <c:if test="${call.columns.safety_evaluation eq 3}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="未出示上岗证"></c:if>
                            <c:if test="${call.columns.safety_evaluation eq 4}"><input type="text"  class="layui-input layui-bg-gray layui-disabled" disabled value="未清理现场"></c:if>
                        </div>
                    </div>

                    <div class="layui-col-lg12 layui-col-sm10">
                        <label class="layui-form-label">回访内容：</label>
                        <div class="layui-input-block">
                            <input type="text"  placeholder=""
                                   autocomplete="off" class="layui-input layui-bg-gray" value="${call.columns.remarks}" disabled>
                        </div>
                    </div>

            <%--        <div class="layui-col-xs12 layui-col-sm5">
                        <label class="layui-form-label">结算方案：</label>
                        <div class="layui-input-block">
                            <input type="text"  placeholder=""
                                   autocomplete="off" class="layui-input layui-bg-gray" value="${facset.serviceMeasures}" disabled>
                        </div>
                    </div>
                    <div class="layui-col-lg2 layui-col-sm5">
                        <label class="layui-form-label">结算总额：</label>
                        <div class="layui-input-block">
                            <input type="text"  placeholder=""
                                   id="total"  autocomplete="off" class="layui-input layui-bg-gray" value="" disabled>
                        </div>
                    </div>
--%>

                    <table class="layui-table">
                        <colgroup>
                            <col width="100">
                            <col width="200">
                            <col>
                        </colgroup>
                        <thead>
                        <tr>
                            <th style="padding: 5px 32px;">结算方案</th>
                            <th>${facset.columns.service_measures}</th>
                        </tr>
                        </thead>
                        <tbody class="orderCost">
                        <tr>
                            <td>费用类型</td>
                            <td>结算金额</td>
                        </tr>
                        <tr>
                            <td class="text-l">服务费</td>
                            <td>${facset.columns.service_costs}</td>
                        </tr>
                        <tr>
                            <td>里程费</td>
                            <td>${facset.columns.mileage_cost}</td>
                        </tr>
                        <tr>
                            <td>加急费</td>
                            <td>${facset.columns.exigency_costs}</td>
                        </tr>
                        <tr>
                            <td>其他费</td>
                            <td>${facset.columns.other_cost}</td>
                        </tr>
                        <tr>
                            <td>合计</td>
                            <td class="orderTd">${facset.columns.other_cost+facset.columns.exigency_costs+facset.columns.mileage_cost+facset.columns.service_costs}</td>
                        </tr>
                        <tr>
                            <td>结算备注</td>
                            <td>${facset.columns.remarks}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="layui-card-body layui-hide orderRelation">
            <%--<div class="" lay-filter="component-form-element">
                <div class="layui-row layui-col-space12 layui-form-item">
                    <div class="layui-col-xs12">
                        <label class="layui-form-label">结算方案：</label>
                        <div class="layui-input-block lh-34">
                           ${serrds.columns.service_measures} (服务费:${serrds.columns.service_costs}、奖励费:${serrds.columns.reward_costs}、其他费:${serrds.columns.other_cost}、里程费:${serrds.columns.mileage_cost}、加急费:${serrds.columns.exigency_costs})
                        </div>
                    </div>
                    <div class="layui-col-xs12">
                        <label class="layui-form-label">结算总额：</label>
                        <div class="layui-input-block">
                            <input type="text"  placeholder=""
                                   autocomplete="off" class="layui-input layui-bg-gray" value="${serrds.columns.service_costs+serrds.columns.reward_costs+serrds.columns.other_cost+serrds.columns.mileage_cost+serrds.columns.exigency_costs}" disabled>
                        </div>
                    </div>

                    <div class="layui-col-xs12">
                        <label class="layui-form-label">结算备注：</label>
                        <div class="layui-input-block">
                            <input type="text"  placeholder=""
                                   autocomplete="off" class="layui-input layui-bg-gray" value="${serrds.columns.remarks}" disabled>
                        </div>
                    </div>

                </div>
            </div>--%>

            <table class="layui-table">
                <colgroup>
                    <col width="100">
                    <col width="200">
                    <col>
                </colgroup>
                <thead>
                <tr>
                    <th style="padding: 5px 32px;">结算方案</th>
                    <th>${serrds.columns.service_measures}</th>
                </tr>
                </thead>
                <tbody class="orderCost">
                <tr>
                    <td>费用类型</td>
                    <td>结算金额</td>
                </tr>
                <tr>
                    <td class="text-l">服务费</td>
                    <td>${serrds.columns.service_costs}</td>
                </tr>
                <tr>
                    <td>里程费</td>
                    <td>${serrds.columns.mileage_cost}</td>
                </tr>
                <tr>
                    <td>奖励费</td>
                    <td>${serrds.columns.reward_costs}</td>
                </tr>
                <tr>
                    <td>加急费</td>
                    <td>${serrds.columns.exigency_costs}</td>
                </tr>
                <tr>
                    <td>其他费</td>
                    <td>${serrds.columns.other_cost}</td>
                </tr>
                <tr>
                    <td>合计</td>
                    <td class="orderTd">${serrds.columns.service_costs+serrds.columns.reward_costs+serrds.columns.other_cost+serrds.columns.mileage_cost+serrds.columns.exigency_costs}</td>
                </tr>
                <tr>
                    <td>结算备注</td>
                    <td>${serrds.columns.remarks}</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
        </div>
        <div class="layui-card-body layui-col-xs1 right-btn">

            <div class="layui-btn-container">
                <c:if test="${order.status ne '6'}">
                    <%--<button type="button" class="layui-btn xiugaiOrder" >编辑</button>
                    <button type="button" class="layui-btn layui-hide uodateorder" >保存</button>
                    <button type="button" class="layui-btn layui-hide cancelorder" >取消</button>--%>
                    <c:if test="${facset.columns.jz_flag eq 0}">
                        <button type="button" class="layui-btn againset" >厂家重新结算</button>
                    </c:if>
                    <c:if test="${serrds.columns.jz_flag eq 0}">
                        <button type="button" class="layui-btn siteagain" >网点重新结算</button>
                    </c:if>
                    <c:if test="${order.status eq 5}">
                        <button type="button" data-orderId="${order.id}" class="layui-btn feedback">完成反馈</button>
                    </c:if>
                </c:if>
            </div>
        </div>
    </div>
</div>

<div id="lookImg" class="hide pos-r">
    <div style="position:relative;width:100%;height:100%;">
        <div class="w-500 h-500 lookImg">
            <img src="" width="80%" id="image">
        </div>
        <i class="layui-icon xuanZhuan" style="position:absolute;bottom:9px;left:50%;">&#xe9aa;</i>
    </div>
</div>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/static/js/orderCommon.js"></script>
<script>
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'layedit', 'laydate'], function () {
        $ = layui.$
            , admin = layui.admin
            , element = layui.element
            , form = layui.form
            ,laydate = layui.laydate;
        //日期
        laydate.render({
            elem: '#applianceBuyTime'
        });
        form.render(null, 'component-form-element');
        //自定义验证规则
        form.verify({
            title: function(value){
                if(value.length < 5){
                    return '标题至少得5个字符啊';
                }
            }
            ,pass: [
                /^[\S]{6,12}$/
                ,'密码必须6到12位，且不能出现空格'
            ]
            ,content: function(value){
                layedit.sync(editIndex);
            }
        });
        element.render('breadcrumb', 'breadcrumb');

        form.on('select(province)', function(data){
            var province = $(data.elem).find("option:selected").attr("title");
            provinceOrder(province);
        });
        form.on('select(city)', function(data){
            var city = $(data.elem).find("option:selected").attr("title");
            cityOrder(city);

        });

        form.on('submit(component-form-demo1)', function (data) {

            //验证不必填项的值格式
            var shuzi = /[0-9]*[1-9][0-9]*$/;
            var applianceNum = data.field.applianceNum;
            var articleFrom = data.field;
            $.ajax({
                type:"POST",
                url:"${ctx}/order/saveOrder",
                data:articleFrom,
                success:function(data){
                    if(data.code=='200'){
                        layer.msg('提交成功！', {icon:1,time:1000},function(){
                            setTimeout('window.location.reload()',1000);
                        });
                    }else{
                        layer.msg(data.msg, {icon: 2});
                    }
                }
            });

            return false;
        });

        function provinceOrder(province){
            $("#city").empty();
            $("#area").empty();
            if(isBlank(province)){
                $("#city").append("<option value=''>请选择</option>");
                return "";
            }
            $.ajax({
                type:"POST",
                url:"${ctx}/main/redirect/getCitysByProId",
                data:{
                    province:province
                },
                success:function(result){
                    if(result =="205"){
                        layer.msg("暂无数据!")
                        return
                    }
                    var html =" <option value=''>请选择</option>";
                    for(var i=0;i<result.length;i++){
                        var city = result[i];
                        html =html+ '<option value="'+city.columns.CityName+'" title="'+city.columns.CityID+'">'+city.columns.CityName+'</option>';
                    }
                    $("#city").append(html);
                    form.render('select');
                }
            });

        }


    });
    var siteId = "${order.siteId}";

    layui.use(['jquery','form'], function(args){
         $= layui.jquery;
        var form = layui.form;
        var aa = $('.siteOrderButten button');
        var orderId = $("#orderId").val();
        var sign = $("#sign").val();
        var fittingFlag = $("#fittingFlag").val();
        aa.click(function () {
            aa.addClass("layui-btn-primary");
            $(this).removeClass("layui-btn-primary");
            var index=aa.index(this);
           if(index == 1){
               //过程信息
               $(".processInformation").removeClass("layui-hide");
               $(".jibenxinxi").addClass("layui-hide");
               $(".logsticInfoNew").addClass("layui-hide");
               var html = $.trim($(".layui-timeline").html()) ;
           //    if(isBlank(html)){
                   guocheng(orderId);
            //   }

           }else if(index == 2){
               //物流信息
               /*if(sign == 2){
                   layer.msg("暂时没有物流信息，请稍后查询!",{icon:2});
               }else*/ if(fittingFlag == 0 &&  "安装" != "${order.serviceType}"){
                   layer.msg("暂时没有物流信息，请稍后查询!",{icon:2});
               }else{
                   //物流信息
                   $(".processInformation").addClass("layui-hide");
                   $(".jibenxinxi").addClass("layui-hide");
                   $(".logsticInfoNew").removeClass("layui-hide");//物流信息
               }
           }else{
               $(".jibenxinxi").removeClass("layui-hide");
               $(".processInformation").addClass("layui-hide");
               $(".logsticInfoNew").addClass("layui-hide");
           }
        })

        $(".xiugaiOrder").click(function(){
            $(this).addClass("layui-hide");
            $(".uodateorder").removeClass("layui-hide");
            $(".cancelorder").removeClass("layui-hide");
            $("input").removeClass("layui-bg-gray");
            $("input").removeClass("layui-disabled");
            $("input").removeAttr("disabled");
            $("select").removeAttr("disabled");
            $("textarea").removeClass("layui-bg-gray");
            $("#remarks").attr("disabled",false);
            form.render('select');
        })
        //保存
        $(".uodateorder").click(function(){
            //验证不必填项的值格式
            var shuzi = /[0-9]*[1-9][0-9]*$/;
            var customerName = $("input[name=customerName]").val();//用户姓名
            if(isBlank(customerName)){
                layer.msg("请输入用户姓名!",{icon:2})
                return false
            }
            var customerMobile = $("input[name=customerMobile]").val();//联系方式1

            var customerSex = $('input[name="customerSex"]:checked').val();//用户性别
            var customerTelephone = $("input[name=customerTelephone]").val();//联系方式2
            var province = $("#province").find("option:selected").text();//省
            var city = $("#city").find("option:selected").text();//市
            var area = $("#area").find("option:selected").text();//区
            var applianceBrand = $("select[name=applianceBrand]").val();//品牌
            var applianceCategory = $("select[name=applianceCategory]").val();//品类
            var applianceModel = $("select[name=applianceModel]").val();//型号
            var applianceBarcode = $("input[name=applianceBarcode]").val();//机身条码
            var applianceBuyTime = $("input[name=applianceBuyTime]").val();//购买时间
            var pleaseReferMall = $("#pleaseReferMall").find("option:selected").text();//购买渠道  1
            var warrantyType = $("#warrantyType").find("option:selected").val();//保修类型
            //var promiseTime = $("#promiseTime").val();//预约时间  2
            // alert(promiseTime)
            //var promiseLimit = $("input[name=promiseLimit]").val();//时间要求   3
            var completeLimitLength = $("select[name=completeLimitLength]").val();//加急时间
            var seriousMoney = $("#seriousMoney").text();//加急费用

            var remarks = $("input[name=remarks]").val();//故障描述
            var customerAddress = $("input[name=customerAddress]").val();//用户地址
            if (isBlank(customerMobile)) {
                layer.msg("请输入联系方式",{icon:2});
                return
            } else if (!isPhoneNo($.trim(customerMobile))) {
                layer.msg("手机号码格式不正确",{icon:2});
                return
            } else if (isBlank(customerAddress)) {
                layer.msg("请输入详细地址",{icon:2});
                return
            }
            if (isBlank(applianceBrand)) {
                layer.msg("请选择品牌",{icon:2});
                return
            }
            if (isBlank(applianceCategory)) {
                layer.msg("请选择品类",{icon:2});
                return
            }
            if (isBlank(remarks)) {
                layer.msg("请输入故障描述",{icon:2});
                return
            }

            var applianceNum = $("#applianceNum").val();//产品数量
            if(!shuzi.test(applianceNum)){

                layer.msg("家电数量格式不正确!",{icon:2})
                return false
            }
            var orderId = $("#orderId").val();//工单id
            var orderStatus = ${order.status};
            var serviceType = "${order.serviceType}";
            $.ajax({
                url:"${ctx}/order/saveUpdate",
                type:"post",
                data:{
                    orderId:orderId,
                    orderStatus:orderStatus,
                    serviceType:serviceType,
                    customerName:customerName,
                    customerMobile:customerMobile,
                    customerSex:customerSex,
                    customerTelephone:customerTelephone,
                    province:province,
                    city:city,
                    area:area,
                    applianceBrand:applianceBrand,
                    applianceCategory:applianceCategory,
                    applianceModel:applianceModel,
                    applianceBarcode:applianceBarcode,
                    applianceBuyTime:applianceBuyTime,
                    pleaseReferMall:pleaseReferMall,
                    warrantyType:warrantyType,
                    //promiseTime:promiseTime,
                    completeLimitLength:completeLimitLength,
                    seriousMoney:seriousMoney,
                    //promiseLimit:promiseLimit,
                    remarks:remarks,
                    customerAddress:customerAddress,
                    applianceNum:applianceNum
                }
                ,success:function (result) {
                    console.log(result)
                    if(result.code=="505"){
                        layer.msg("保存失败",{icon:2});
                    }else{
                        layer.msg("保存成功",{icon:1});
                        window.location.reload();
                    }
                },error:function () {
                    layer.msg("保存失败",{icon:2});
                }
            })

        })
        //取消
        $(".cancelorder").click(function(){
            $(this).addClass("layui-hide");
            $(".uodateorder").addClass("layui-hide");
            $(".xiugaiOrder").removeClass("layui-hide");
            window.location.reload();

        })

        var orderId = $("#orderId").val();
        /**
         * 厂家重新结算
         */
        $(".againset").click(function(){
            layer.open({
                type: 2,
                content: "${ctx}/settlement/factory/stat/getAgainSettlementOrder?orderId="+orderId  //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
                ,title: "厂家重新结算"
                ,btn:['重新结算',"取消"]
                ,area:["860px","320px"]
                ,yes: function(index, layero){
                    var iframeWindow = window['layui-layer-iframe'+ index]
                        ,submitID = 'btnSubmit'
                        ,submit = layero.find('iframe').contents().find('#'+ submitID);

                    //监听提交
                    iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
                        var val = layero.find('iframe').contents();
                        var  cost = /^(\-)?\d+(.\d{1,2})?$/;

                        var id = val.find("input[name=\"id\"]").val();
                        var serviceMeasures = val.find("select[name=\"serviceMeasures\"]").find("option:selected").attr("title");
                        var serviceStep = val.find("select[name=\"serviceStep\"]").val();
                        var serviceCosts = val.find("input[name=\"serviceCosts\"]").val();
                        var exigencyCosts = val.find("input[name=\"exigencyCosts\"]").val();
                        var otherCost = val.find("input[name=\"otherCost\"]").val();
                        var mileageCost = val.find("input[name=\"mileageCost\"]").val();
                        var extendCostType = val.find("input[name=\"extendCostType\"]").val();
                        var remarks=  val.find("input[name=\"remarks\"]").val();

                            if(isBlank(serviceMeasures)){
                                layer.msg("请选择结算方案!",{icon:2});
                                return false
                            }
                            if(isBlank(serviceStep)){
                                layer.msg("请选择服务措施!",{icon:2});
                                return false
                            }
                            if(isBlank(serviceCosts)){
                                serviceCosts=0;
                            }else if(!cost.test(serviceCosts)){
                                layer.msg("服务费用为可保留两位小数的正数!",{icon:2});
                                return false
                            }
                            if(isBlank(exigencyCosts)){
                                exigencyCosts=0;
                           } else if(!cost.test(exigencyCosts)){
                                layer.msg("加急费为可保留两位小数的正数!",{icon:2});
                                return false
                            }
                            if(isBlank(otherCost)){
                                otherCost=0;
                            }else if(!cost.test(otherCost)){
                                layer.msg("其他费用为可保留两位小数的正数!",{icon:2});
                                return false
                            }
                            if(isBlank(mileageCost)){
                                mileageCost=0;
                            }else if(!cost.test(mileageCost)){
                                layer.msg("里程费为可保留两位小数的正数!",{icon:2});
                                return false
                            }

                        $.ajax({
                            type:"POST",
                            url:"${ctx}/settlement/factory/stat/saveAgainSettlementOrder",
                            data:{
                                id:id,
                                orderId:orderId,
                                remarks:remarks,
                                serviceStep:serviceStep,
                                serviceMeasures:serviceMeasures,
                                serviceCosts:serviceCosts,
                                exigencyCosts:exigencyCosts,
                                otherCost:otherCost,
                                mileageCost:mileageCost,
                                extendCostType:extendCostType,
                            },
                            success:function(result){
                                if(result.code =="200"){
                                    layer.closeAll()
                                    layer.msg('重新结算成功！', {icon:1,time:1000},function(){
                                        window.location.reload();
                                    });
                                }else if(result.code == "500"){
                                    layer.msg('重新结算失败失败,该工单已经结账!', {icon:2,time:1000});
                                }else if(result.code == "401"){
                                    layer.msg('请选择结算方案!', {icon:2,time:1000});
                                }else if(result.code =="501"){
                                    layer.msg('可用金额小于结算金额,不可重新结算!', {icon:2,time:1000});
                                }else if(result.code =="506"){
                                    layer.msg('抵押总金额结算后为负数,不可重新结算!', {icon:2,time:1000});
                                }else if(result.code =="507"){
                                    layer.msg('厂家金额结算后为负数,不可重新结算!', {icon:2,time:1000});
                                }else{
                                    layer.msg('结算失败,数据有误', {icon:2,time:1000});
                                }

                            }
                        });

                    });
                    submit.trigger('click');
                }
                ,btn3: function(index, layero){
                    //return false 开启该代码可禁止点击该按钮关闭
                },
                success : function(layero) {
                    layero.find('.layui-layer-btn').css('text-align', 'center');
                    layero.find('.layui-layer-btn').find(".layui-layer-btn0").css("background-color","#009688");
                }
            });
        })


        //服务商重新结算
        $(".siteagain").click(function(){
            layer.open({
                type: 2,
                content: "${ctx}/settlement/site/stat/siteAgainSettle?orderId="+orderId   //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
                ,title: "服务商重新结算"
                ,btn:['保存',"取消"]
                ,area:["860px","400px"]
                ,yes: function(index, layero){
                    var iframeWindow = window['layui-layer-iframe'+ index]
                        ,submitID = 'setSubmit'
                        ,submit = layero.find('iframe').contents().find('#'+ submitID);

                    //监听提交
                    iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
                        var val = layero.find('iframe').contents();
                        var  cost = /^(\-)?\d+(.\d{1,2})?$/;
                        var serviceMeasures = val.find("select[name=\"serviceMeasures\"]").find("option:selected").attr("title");
                        var serviceStep = val.find("select[name=\"serviceStep\"]").val();
                        var id = val.find("input[name=\"id\"]").val();
                        var serviceCosts = val.find("input[name=\"serviceCosts\"]").val();
                        var rewardCosts = val.find("input[name=\"rewardCosts\"]").val();
                        var otherCost = val.find("input[name=\"otherCost\"]").val();
                        var mileageCost = val.find("input[name=\"mileageCost\"]").val();
                        var exigencyCosts = val.find("input[name=\"exigencyCosts\"]").val();
                        var remarks=  val.find("input[name=\"remarks\"]").val();

                        if(isBlank(serviceMeasures)){
                            layer.msg("请选择结算方案!",{icon:2});
                            return false
                        }
                        if(isBlank(serviceStep)){
                            layer.msg("请选择服务措施!",{icon:2});
                            return false
                        }
                        if(isBlank(serviceCosts)){
                            serviceCosts=0;
                        }else if(!cost.test(serviceCosts)){
                            layer.msg("服务费用为可保留两位小数的正数!",{icon:2});
                            return false
                        }
                        if(isBlank(rewardCosts)){
                            rewardCosts=0;
                        }else if(!cost.test(rewardCosts)){
                            layer.msg("奖惩费用为可保留两位小数的正数!",{icon:2});
                            return false
                        }
                        if(isBlank(otherCost)){
                            otherCost=0;
                        }else if(!cost.test(otherCost)){
                            layer.msg("其他费用为可保留两位小数的正数!",{icon:2});
                            return false
                        }
                        if(isBlank(mileageCost)){
                            mileageCost=0;
                        }else if(!cost.test(mileageCost)){
                            layer.msg("里程费为可保留两位小数的正数!",{icon:2});
                            return false
                        }
                        if(isBlank(exigencyCosts)){
                            exigencyCosts=0;
                        }else if(!cost.test(exigencyCosts)){
                            layer.msg("加急费用为可保留两位小数的正数!",{icon:2});
                            return false
                        }

                        $.ajax({
                            type:"POST",
                            url:"${ctx}/settlement/site/stat/saveAgainSettlementOrder",
                            data:{
                                id:id,
                                orderId:orderId,
                                serviceMeasures:serviceMeasures,
                                serviceStep:serviceStep,
                                serviceCosts:serviceCosts,
                                rewardCosts:rewardCosts,
                                otherCost:otherCost,
                                mileageCost:mileageCost,
                                exigencyCosts:exigencyCosts,
                                remarks:remarks,
                            },
                            success:function(result){
                                if(result.code ==200){
                                    layer.closeAll()
                                    layer.msg('重新结算成功！', {icon:1,time:1000},function(){
                                        window.location.reload();
                                    });
                                }else{
                                    layer.msg('重新结算失败,数据有误', {icon:2,time:1000});
                                }
                            }
                        });

                    });
                    submit.trigger('click');
                }
                ,btn3: function(index, layero){
                    //return false 开启该代码可禁止点击该按钮关闭
                },
                success : function(layero) {
                    layero.find('.layui-layer-btn').css('text-align', 'center');
                    layero.find('.layui-layer-btn').find(".layui-layer-btn0").css("background-color","#009688");
                }
            });
        })

        //点击放大查看图片
        $(".selectImg").click(function(){
         var img = $(this).attr("data-img");
         $("#lookImg img").attr('src',img);
         layer.open({
             type:1,
             title:'查看图片',
             area:['500px','543px'],
             content:$("#lookImg")
         })
    })
        //旋转
        var deg = 0;
        $(".xuanZhuan").click(function(){
            deg += 90;
            document.getElementById("image").style.transform = "rotate(" + deg + "deg)";
        })

        //反馈
        $(".feedback").click(function(){
            var orderId = $(this).attr("data-orderId");
            layer.open({
                type: 2,
                title:"反馈封单",
                resize:false,
                area: ['700px', '60%'],
                content: "${ctx}/order/feedbackOrderYwc?orderId="+orderId
                ,btn:['完成反馈',"取消"]
                ,yes: function(index, layero){
                    var iframeWindow = window['layui-layer-iframe'+ index]
                        ,submitID = 'sureSubmit'
                        ,submit = layero.find('iframe').contents().find('#'+ submitID);

                    //监听提交
                    iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
                        var imgs;
                        layero.find('iframe').contents().find("#imgsDiv").find("input").each(function (index) {
                            if(isBlank(imgs)){
                                imgs = $(this).val();
                            }else{
                                imgs = imgs+","+$(this).val();
                            }
                        });
                        var textarea=  layero.find('iframe').contents().find("textarea").val();
                        if(isBlank(textarea)){
                            layer.msg('请输入反馈内容', {icon:2});
                            return false
                        }
                        $.ajax({
                            type:"POST",
                            url:"${ctx}/feedback/feedbackSealingSheetYwc",
                            data:{
                                orderId:orderId,
                                imgs:imgs,
                                textarea:textarea
                            },
                            success:function(result){
                                if(result.code ==200){
                                    layer.closeAll()
                                    layer.msg('反馈封单成功！', {icon:1,time:1000},function(){
                                        window.location.reload();
                                    });
                                }else if(result.code == "204"){
                                    layer.msg('反馈内容为空!', {icon:2,time:1000});
                                }else if(result.code == "400"){
                                    layer.msg('该工单不可转派，请刷新页面!', {icon:2,time:1000});
                                }else if(result.code=="205"){
                                    layer.msg("备件申请状态为已完成时才能执行反馈完成操作!",{icon:2});
                                    return;
                                }else{
                                    layer.msg('反馈失败,数据有误', {icon:2,time:1000});
                                }
                            }
                        });

                    });
                    submit.trigger('click');
                }
            });
        })

        //却换服务反馈按钮
        var fuwu = $('.fuwufankuiorder button');
        fuwu.click(function () {
            fuwu.addClass("layui-btn-primary");
            $(this).removeClass("layui-btn-primary");
            var index=fuwu.index(this);
            $(".orderRelation").addClass("layui-hide");
            $(".orderqitaxinxi").find(".orderRelation").eq(index).removeClass("layui-hide")

           if(index == 2){
               //备件信息

               orderFitting(orderId);
           }
        })

       if("${type}" == 2){
           $(".processInformation").removeClass("layui-hide");
           $(".jibenxinxi").addClass("layui-hide");
           $(".logsticInfoNew").addClass("layui-hide");
           guocheng(orderId)
       }


       if(${order.status == 1}){
           orderFitting(orderId);
       }
        function guocheng(orderId){

            $.ajax({
                type:"POST",
                url:"${ctx}/order/getOrderDetail",
                data:{
                    orderId:orderId
                },
                success:function(data){
                    if(data!=null){
                        var deatil ="";
                        for(var i =0;i<data.length;i++){
                            deatil += '<li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis"></i>';
                            deatil += '<div class="layui-timeline-content layui-text">';
                            deatil +=' <h4 class="layui-timeline-title">'+data[i].d+'</h4> <p>';
                            deatil += data[i].c+ '  </p> </div> </li>';
                        }
                        $(".guoChen").html(deatil);
                    }else{
                        layer.msg("数据有误！", {icon: 2});
                    }
                }
            });
        }

        //查看物流信息
        $(".productInfo").click(function(){
            var logisticName = $("#logisticName").val();
            var logisticNo = $("#logisticNo").val();
            var orderId = $("#orderId").val();
            addLogisticInfo(logisticName,logisticNo,orderId);
        })

        //查看已发备件信息
        $(".fitRefundInfo").click(function(){
            var logisticName = $("#logisticName").val();
            var logisticNo = $("#logisticNo").val();
            var orderId = $("#orderId").val();
            addLogisticInfo(logisticName,logisticNo,orderId);
        })

        //查看添加备件申请获取的物流信息
        $(".fitApplyInfo").click(function(){
            var logisticName = $(this).attr("data-logName");
            var logisticNo = $(this).attr("data-logNumber");
            var orderId = $("#orderId").val();
            addLogisticInfo(logisticName,logisticNo,orderId);
        })

        //查看新建，旧件返厂物流信息
        $(".returnFactoryInfo").click(function(){
            var logisticName = $(this).attr("data-logName");
            var logisticNo = $(this).attr("data-logNum");
            var orderId = $("#orderId").val();
            $.ajax({
                type:"POST",
                url:"${ctx}/main/order/logisticsDetail",
                data:{
                    orderId:orderId,
                    logisticName:logisticName,
                    logisticNo:logisticNo
                },
                success:function(data){
                    if(data!=null){
                        var deatil ="";
                        for(var i =0;i<data.length;i++){
                            deatil += '<li class="layui-timeline-item">';
                            deatil += '<i class="layui-icon layui-timeline-axis"></i>';
                            deatil += '<div class="layui-timeline-content layui-text">';
                            deatil += '<div class="layui-timeline-title">'+data[i].AcceptTime+" "+data[i].AcceptStation+'</div>';
                            deatil += '</div>';
                            deatil += '</li>';
                        }
                        $(".returnFactory").html(deatil);
                    }else{
                        layer.msg("数据有误！", {icon: 2});
                    }

                }
            })
        })

        function addLogisticInfo(logisticName,logisticNo,orderId){
            $(".logisticInfor").empty()
            $.ajax({
                type:"POST",
                url:"${ctx}/main/order/logisticsDetail",
                data:{
                    orderId:orderId,
                    logisticName:logisticName,
                    logisticNo:logisticNo
                },
                success:function(data){
                    if(data!=null){
                        var deatil ="";
                        for(var i =0;i<data.length;i++){
                            deatil += '<li class="layui-timeline-item">';
                            deatil += '<i class="layui-icon layui-timeline-axis"></i>';
                            deatil += '<div class="layui-timeline-content layui-text">';
                            deatil += '<div class="layui-timeline-title">'+data[i].AcceptTime+" "+data[i].AcceptStation+'</div>';
                            deatil += '</div>';
                            deatil += '</li>';
                        }
                        $(".logisticInfor").html(deatil);
                    }else{
                        layer.msg("数据有误！", {icon: 2});
                    }

                }
            })
        }

        function orderFitting(orderId){
            $("#fittingOrder").empty();
            $.ajax({
                type:"POST",
                url:"${ctx}/order/getOrderFittingByorderId",
                data:{
                    orderId:orderId,
                    siteId:siteId
                },
                success:function(data){
                    console.log(data)
                    if(data!=null){
                        var deatil ="";
                        for(var i =0;i<data.length;i++){
                            var status = data[i].columns.status;
                            var stname ="";
                            if(status == 1){
                                stname = "待发货";
                            }else if(status == 2){
                                stname = "备件在途";
                            }else if(status == 3){
                                stname = "已完成";
                            }
                            var fitting_code= data[i].columns.fitting_code;
                            if(isBlank(fitting_code)){
                                fitting_code="";
                            }
                            deatil +=' <tr>';
                            deatil += ' <td style="overflow:hidden;" class="text-over" title="'+data[i].columns.fitting_name+'">' + data[i].columns.fitting_name + '</td>';
                            deatil += ' <td style="overflow:hidden;" class="text-over" >' + fitting_code + '</td>';
                            deatil += ' <td style="overflow:hidden;" class="text-over" title="'+data[i].columns.apply_marks+'">' + data[i].columns.apply_marks + '</td>';
                            deatil += ' <td style="overflow:hidden;" class="text-over">' + stname + '</td>';
                            deatil += ' <td style="overflow:hidden;" class="text-over">' + data[i].columns.apply_num + '</td>';
                            deatil += ' <td style="overflow:hidden;" class="text-over">' + returOldFit(data[i].columns.old_fitting_flag) + '</td>';
                            deatil += ' <td style="overflow:hidden;" class="text-over">' + returnedOldFit(data[i].columns.return_fitting) + '</td>';
                            deatil += ' <td style="overflow:hidden;" class="text-over" title="'+data[i].columns.delivery_name+'">' + data[i].columns.delivery_name + '</td>';
                            deatil += ' <td style="overflow:hidden;" class="text-over" title="'+data[i].columns.delivery_mobile+'">' + data[i].columns.delivery_mobile + '</td>';
                            deatil += ' <td style="overflow:hidden;" class="text-over" title="'+data[i].columns.delivery_address+'">' + data[i].columns.delivery_address + '</td>';
                            deatil +=' </tr>';
                        }
                        $("#fittingOrder").html(deatil);
                    }else{
                       // layer.msg("数据有误！", {icon: 2});
                    }
                }
            });
        }
        function isPhoneNo(phone) {
            var tel = /(^1\d{10}$)|(^(\d{3,4}\-)?\d{5,9}$)/;
            return tel.test($.trim(phone));
        }
        totalChange();

    });


    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }
    function totalChange(){
        var total=0.00;
        $(".cost").each(function(index, el){
            var Fee = ($(el).val()).trim();
            if (!isNaN(parseFloat(Fee))){
                total+=parseFloat(Fee);
            }
        })
        $("#total").val(total.toFixed(2));
    }
</script>
</body>
</html>