页面记录

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@include file="/WEB-INF/views/include/head.jsp" %>
<html>
<head>
<script src="${ctxStatic}/pgcjs/body/layer-v3.1.1/layer/layer.js"></script>
<link type="text/css" rel="stylesheet" href="${ctxStatic}/modules/designer/student.css">
<style type="text/css">
.orderShopheader div{
    float: left;
}
.item-content li{
    float: left;
    margin-right:20px;
}
.imgtitle img{
    80px;
    height:100px;
}
ul{
    padding: 0;
}
.orderitem{
    margin-top: 10px;
}
.orderShopcontent{
    border-right: 1px #ccc solid;
}
.specifi_title span {
    color: red;
    margin-right: 22px;
    font-weight: 800;
}
.ordershop {
    background-color: #efefef;
    border-bottom: 1px #ccc solid;
    padding-left: 20px;
    padding-right:20px;
    border-radius: 10px;
}
.orderShopheader{
    border-bottom: 1px #ccc solid;
    padding-top: 10px;
}
li{
    list-style: none;
}
.clearFloat:before, .clearFloat:after {
    display:table;
    content:" ";
}
.clearFloat:after{
    clear:both;
}
</style>
</head>
<body class="right-body">    
    <form:form id="alipayment" method="post" action="">    
        <input id="WIDTRorder_id" name="WIDTRorder_id" type="hidden" value=""/>
        <input id="WIDTRtrade_no" name="WIDTRtrade_no" type="hidden" value=""/>
        <input id="WIDTRout_trade_no" name="WIDTRout_trade_no" type="hidden" value="" />
        <input id="WIDTRrefund_amount" name="WIDTRrefund_amount" type="hidden" value="" />
        <input id="WIDTRrefund_reason" name="WIDTRrefund_reason" type="hidden" value="" />
        <input id="WIDTRout_request_no"  name="WIDTRout_request_no" type="hidden" value="" />
      </form:form>
    <div>
        <div class="role-type">
            <li onclick="focusByStatus(1)">待付款(${fnc:getOrderNum('1')})<span>|</span></li><li onclick="focusByStatus(2)">待发货(${fnc:getOrderNum('2')})<span>|</span></li><li onclick="focusByStatus(3)">待确认收货(${fnc:getOrderNum('3')})<span>|</span></li>
            <li onclick="focusByStatus(4)">待评价(${fnc:getOrderNum('4')})<span>|</span></li><li onclick="focusByStatus(5)">待退款(${fnc:getOrderNum('5')})<span>|</span></li><li onclick="focusByStatus(6)">退款成功(${fnc:getOrderNum('6')})<span>|</span></li>
            <li onclick="focusByStatus(7)">退款失败(${fnc:getOrderNum('7')})<span>|</span></li><li onclick="focusByStatus(8)">评价成功(${fnc:getOrderNum('8')})<span>|</span>
            <li onclick="focusByStatus(0)">交易关闭(${fnc:getOrderNum('0')})</li>
        </div>
    </div>
<div class="my-order">
    <c:forEach items="${page.list}" var="orderList">
    <div class="ordershop" style="display:block;background-color:#fefefe;margin-bottom:20px"> 
          <div class="orderShopheader clearFloat">
              <div style="margin-right: 100px;" class="order-createtime"><fmt:formatDate pattern="yyyy-MM-dd" 
            value="${orderList.createDate }" /></p></div>
              <div  class="order-ordercode">订单编号: ${orderList.orderCode}</div>
              <div style="margin-left: 100px;" class="order-username">客户:${orderList.userName}</div>
          </div>
          <div class="clearFloat">
             
              <div style="float:left" class="orderShopcontent clearFloat" style="display:block;">
              <c:forEach items="${orderList.dealOrderList}" var="oll">
                  <div class="orderitem clearFloat">
                      <ul class="clearFloat item-content">
                          <li><div class="imgtitle" style="80px;height:100px;padding: 0"><img src="${oll.imageMain}" alt=""></div></li>
                          <li style="min-height: 85px; 100px;"><div>${oll.objectName}</div></li>
                          <li style=" 260px;min-height: 85px;">
                              <div class="specifi_title">
                                    <em style="<c:if test="${oll.materialName==''||oll.materialName==null}">display:none;</c:if>font-style:normal;">面料:<span>${oll.materialName}</span></em><em style="<c:if test="${oll.colorName==''||oll.colorName==null}">display:none;</c:if>font-style:normal;">颜色:<span>${oll.colorName}</span></em>尺码:<span>${oll.sizeName}</span>
                                <c:forEach items="${oll.dealMeasureList}" var="olld">
                                    ${olld.measureName}:<span>${olld.measureData}</span>
                                 </c:forEach>
                              </div>
            
                            </li>
                          <li >${oll.quantity}</li>
                          <li ><%-- ${oll.money} --%><input id="money${oll.orderId }"  value="${oll.money }" style=" 50px;"> <a onclick="changeMoney('${oll.orderId }')">修改价格</a></li>
                      </ul>
                      <div style="margin-left: 25px;">留言:${oll.memo}</div>
                  </div>
                  </c:forEach></div>
                  <div style="float:left;position:relative;height:119px;200px;">
                     <div style="position:absolute;left:20px;top:20px;color:red;">${fns:getDictLabel(orderList.status, 'order_status', '')}</div>
                     <c:if test="${orderList.status==2 }">
                            <div style="position:absolute;left:20px;" class="confirm-btn" onclick="confirmOrder('${orderList.orderCode}')">
                                确认发货
                            </div>
                    </c:if>
                  </div>
              </div>
              
              <div class="orderAdress" style="padding-top: 10px;margin-left: 25px;border-top:1px #ccc solid;">
                      地址:${orderList.addressName}</div>
          </div>
      </c:forEach>
</div>
        
        <div class="pagination">${page}</div>
        <div class="confirm-order" id="confirmorder" style="display: none;">
                <h3>确认发货</h3>
                <input type="hidden" id="confirmorderCode"/>
                <div> 订单编号:<span id="orderCode"></span></div>
                <h4>—请录入发货物流信息—</h4>
                <div>物流公司:
                     <select id ="logisticCompanyId"  class="input-xlarge required" >
                        <option value="">-物流公司-</option> 
                        <c:forEach items="${logisticCompanies}" var="companyList">
                            <option value="${companyList.id}" id="${companyList.id}">${companyList.name}</option>
                        </c:forEach>
                    </select>
                </div>
                <div>物流单号:<input placeholder="物流单号" id="logisticCode"></div>
                <div class="save-btn"  onclick="saveLogistic()">提交</div>
        </div>
        <div class="refund-detail" style="display: none;position:relative;">
           <input type="hidden" id="refundorderId"/>
           <h4>—请认真核对退款信息—</h4>
           <div id="auto_agree" style="position:absolute;top:50px;left:455px;">时间还剩。。。</div>
           <div> 订单编号:<span id="orderCode1"></span></div>
           <div> 退款类型:<span id="refundType"></span></div>
           <div> 退款原因:<span id="goodsReturnType"><i style="display:none"></i></span></div>
           <div> 退款金额:<span id="refundMoney"></span></div>
           <div> 退款说明:<span id="description"></span></div>
           <div style="overflow: hidden;"><div style="float:left;">退款图片:</div><div style="float:left;" id="refundUrl"><ul style="margin: 0px;"></ul></div></div>
           <div> 返款状态:<span id="refundStatus"></span></div>
           <div> 备注:<span id="demo"></span></div>
           <div id="agree"  class="save-btn" onclick="agreeRefund()" style="200px;">同意退款申请</div>
           <div id="refuse"  class="save-btn" onclick="refuseRefund()" style="200px;">拒绝退款申请</div>
           <div id="confirm_refund" onclick="confirmRefund()" style="display:none;200px;height:35px;background-color: #fff;border-radius: 5px; border: 1px solid #ddd;text-align: center;font-size: 22px;line-height: 1.6;cursor: pointer;">确认退款</div>
        </div>
        <div class="logistic-detail" id="logistic_detail" style="display:none;">
           <ul></ul>
         </div>
<script type="text/javascript">
    function page(n,s){
         location="${ctxf}/dealOrder/myOrder?&pageNo="+n+"&pageSize="+s;
    }
    $(document).ready(function () {
        //设置iframe高度
         $(window.parent.document).find("#mainFrame").load(function () {  
        if($(document).height()!=null&&$(document).height()!='0'){
            parent.document.getElementById("mainFrame").height = $(document).height() + 30;  
        }
        }); 
        $(".role-type li").removeClass('selected');
        $(".role-type li").eq(0).addClass('selected');
     });
    function iframeH(){
        //设置iframe高度
        parent.document.getElementById("mainFrame").height=0+"px";
        parent.document.getElementById("mainFrame").style.height = "";
        var h = $(document.body).height() + 30;
        parent.document.getElementById("mainFrame").height = h;
    }
    //修改订单价格
    function changeMoney(orderId){
        debugger;
        var money=$("#money"+orderId).val();
         $.ajax({  
                url: "${ctxf}/deal/orderChangeMoney",  
                type: "POST",  
                data: {  
                    'money': money,
                    'orderId':orderId    
                },  
                success: function(data) {  
                    $("#money"+orderId).val(money);
                    $("#money"+orderId).css('color','red');
                }
         });  
    }
    
    //根据状态显示订单
    function focusByStatus(status){    
        $(".role-type li").removeClass('selected')
        $(".role-type li").eq(status-1).addClass('selected');
        $(".confirm-order").hide();
        $(".refund-detail").hide();
         $.ajax({  
                url: "${ctxf}/deal/orderByStatus",  
                type: "POST",  
                data: {  
                    'status': status
                },  
                success: function(data) {  
                    $(".my-order").empty();
                    var html="";
                    console.log(data.list);
                    if(data.list!=null){
                          $.each(data.list, function(commentIndex, comment){
                              html+="<div class='ordershop' style='display:block;background-color:#fefefe;margin-bottom:20px'>"+ "<div class='orderShopheader clearFloat'>"+
                              "<div style='margin-right: 100px;' class='order-createtime'>"+comment.createDate+"<p></p></div>"+
                              "<div  class='order-ordercode'>订单编号:"+ comment.orderCode+"</div>"+
                              "<div style='margin-left: 100px;' class='order-username'>客户:"+comment.userName+"</div>"+
                              "</div>";
                              html+="<div class='clearFloat'>";
                              if(comment.dealOrderList!=null){
                                  html+="<div style='float:left' class='orderShopcontent clearFloat' style='display:block;'>";
                                  $.each(comment.dealOrderList,function(i,c){
                                  html+="<div class='orderitem clearFloat'>"+"<ul class='clearFloat item-content'>"+
                                  "<li><div class='imgtitle' style='80px;height:100px;padding: 0'><img src='"+c.imageMain+"' alt=''></div></li>"+
                                  "<li style='min-height: 85px; 100px;'><div>"+c.objectName+"</div></li>"+
                                  "<li style=' 260px;min-height: 85px;'>"+
                                  "<div class='specifi_title'>"
                                  if(c.materialName!=''&&c.materialName!=undefined){
                                      html+="面料:<span>"+c.materialName+"</span>";
                                  }
                                  if(c.colorName!=''&&c.colorName!=undefined){
                                      html+="颜色:<span>"+c.colorName+"</span>";
                                  }
                                  if(c.sizeName!=''&&c.sizeName!=undefined){
                                      html+="尺码:<span>"+c.sizeName+"</span>";
                                  }
                                  if(c.dealMeasureList!=null){
                                      $.each(c.dealMeasureList,function(ii,cc){
                                          html+=cc.measureName+":<span>"+cc.measureData+"</span>"
                                      })
                                  }
                                html+= "</div></li>"+"<li>"+c.quantity+"</li><li>";
                                if(c.status==1){
                                    html+="<input id='money"+c.orderId+"'  value='"+c.money +"' style=' 50px;'>"+" <a onclick=changeMoney('"+c.orderId+"')>修改价格</a></li>";
                                }else{
                                    html+="<input id='money"+c.orderId+"'  value='"+c.money +"' style=' 50px;'></li>";
                                }
                                if(c.status==5){
                                    html+="<li><div style='position:relative;height:119px;140px;'><div style='position:absolute;left:20px;color:red;'>待退款</div><div style='position:absolute;left:80px;margin-top:0;' class='confirm-btn' onclick= refundDetail('"+c.orderId+"')>退款信息</div></div></li>"
                                }
                                html+="</ul><div style='margin-left: 25px;'>留言:";
                                if(c.sizeName!=''&&c.sizeName!=undefined){
                                    html+=c.memo;
                                  }
                                html+="</div></div>";  
                              })
                              }
                              html+="</div><div style='float:left;position:relative;height:119px;100px;'>"+ 
                              "<div style='position:absolute;left:20px;top:20px;color:red;'>";
                              if(comment.status==1){
                                       html+='待付款';
                                     }else if(comment.status==2){
                                       html+='待发货';
                                     }else if(comment.status==3){
                                       html+='待确认收货';
                                     }else if(comment.status==4){
                                       html+='待评价';
                                     }else if(comment.status==5){
                                       html+=''; 
                                     }else if(comment.status==6){
                                       html+='退款成功';
                                     }else if(comment.status==7){
                                       html+='退款失败';
                                     }else if(comment.status==8){
                                       html+='评论成功';
                                     }else{
                                       html+='交易关闭';
                                     }
                             if(comment.status==2){
                                  html+=    "</div><div style='position:absolute;left:20px;' class='confirm-btn' onclick=confirmOrder('"+comment.orderCode+"')>确认发货</div></div></div>";
                              }else if(comment.status==3){
                                  html+=    "</div><div style='position:absolute;left:20px;' class='confirm-btn' onclick= logisticDetail('"+comment.logisticCompanyId+"','"+comment.logisticCode+"')>物流信息</div></div></div>";
                              }else{
                                  html+="</div></div></div>";
                              }
                        html+="<div class='orderAdress' style='padding-top: 10px;margin-left: 25px;border-top:1px #ccc solid;'> 地址:"+comment.addressName+"</div></div>"
                  
                          })
                    }
                  $(".my-order").html(html);          
                  iframeH();
               }
            });  
    }
    
    //确认订单 
    function confirmOrder(orderCode){
        $("#orderCode").html(orderCode);
        $("#confirmorderCode").val(orderCode);
        $(".confirm-order").show();
        iframeH();
        parent.scrolltop();
    }
    
    //提交发货地址
    function saveLogistic(){
        var logisticCompanyId=$("#logisticCompanyId").val();
        var logisticCode=$("#logisticCode").val();
        if(logisticCompanyId==null||logisticCompanyId==""){
            alert('请选择承运公司');
            return false;
        }
        if(logisticCode==null||logisticCode==""){
            alert('请录入单号');
            return false;
        }
        var orderCode= $("#confirmorderCode").val();
        console.log(orderCode);
        return confirmx('确认发货吗?', '${ctxf}/deal/saveLogistic?&orderCode='+orderCode+"&logisticCompanyId="+logisticCompanyId+"&logisticCode="+logisticCode);
        
    }
    //退款详情 
    function refundDetail(orderId){        
         $.ajax({
             type: "GET",
             async: false,
             url: "${ctxf}/deal/refundOrderById",
             data:{
                  orderId:orderId
                  },
             success: function(data){
                  var goodsReturnType = "";
                  var refundType ="";              
                  var creatTime = new Date(data.applyTime);
                  creatTime.setDate(creatTime.getDate() + 7);
                  var nowTime = new Date();
                    var second = parseInt((creatTime.getTime()-nowTime.getTime())/1000);
                    var d = parseInt(second/3600/24);
                  var h = parseInt(second/3600%24);
                  var m = parseInt(second/60%60);
                  d<10?d="0"+d:d;
                  h<10?h="0"+h:h;
                  m<10?m="0"+m:m;
                  html="还剩"+d+"天"+h+"时"+m+"分自动同意退款";
                  $("#auto_agree").html(html);           
                  $("#refundorderId").val(data.orderId);
                  $("#orderCode1").html(data.orderCode);
                  $("#goodsReturnType").html(data.goodsReturnName);
                  $("#refundType").html(data.refundName);
                  $("#refundMoney").html(data.refundMoney);
                  $("#description").html(data.description);      
                  var urlhtml="";
                  if(data.dealRefundUrlList!=undefined&&data.dealRefundUrlList!=null&&data.dealRefundUrlList!=''){
                      $.each(data.dealRefundUrlList,function(ii,cc){ 
                          urlhtml+= "<li style='float:left;height:100px;100px;margin-left:5px;list-style:none;'><img src='"+cc.refundUrl+"' width='100' height='100' alt='' /></li>";
                        });
                      $("#refundUrl").find("ul").append(urlhtml);
                  }else{
                      $("#refundUrl").find("ul").html("无");
                  }
                  $("#demo").html(data.demo);
                  $("#refundStatus").attr("data-refundstatus", data.refundStatus);
                  $("#refundStatus").html(data.refundStatusName);
                  $("#confirm_refund").hide(); 
                  $("#agree").hide();
                  $("#refuse").hide();
                  $("#auto_agree").hide();
                     if(data.refundType=="2" && data.refundStatus=="3"){                      
                      $("#confirm_refund").show();
                      var html2 = "<div style='position:absolute;top:280;left:380;70px;height: 22px;text-align:center;font-size: 10px;background-color: #fff;border: 1px solid #cac1c1;border-radius: 5px;cursor: pointer;' onclick= logisticDetail('"+data.logisticId+"','"+data.logisticCode+"')>物流信息</div>";
                      $("#confirm_refund").after(html2);
                  }
                  if(data.refundStatus=="1"){
                      if(data.refundType=="2"){
                          $("#agree").show();
                      }else if(data.refundType=="1"){
                          $("#confirm_refund").show();
                      }
                      $("#refuse").show();
                      $("#auto_agree").show();
                  }
                 
            },
         });
        $(".refund-detail").show();
        iframeH();
        parent.scrolltop();
    }

     //同意退货退款申请
    function agreeRefund(){
        var refundStatus=Number($("#refundStatus").attr("data-refundstatus"))+1;
        var orderId= $("#refundorderId").val();            
        return confirmx('确认同意退货退款申请吗?', '${ctxf}/deal/agreeRefund?&orderId='+orderId+"&refundStatus="+refundStatus);        
    }
     
     //拒绝退款申请
     function refuseRefund(){
        var refundStatus=Number($("#refundStatus").attr("data-refundstatus"))+4;
        var orderId= $("#refundorderId").val();            
        return confirmx('确认拒绝退货退款申请吗?', '${ctxf}/deal/agreeRefund?&orderId='+orderId+"&refundStatus="+refundStatus);        
    }
    
    //同意退款
    function confirmRefund(){
        var orderId= $("#refundorderId").val();
        $.ajax({  
            url: "${ctxf}/deal/orderConfirmRefund",  
            type: "GET",  
            data: {  
                'orderId':orderId
            },  
            success: function(data) {
                  $("#WIDTRorder_id").val(data.orderId);
                  $("#WIDTRtrade_no").val(data.alipayCode);
                  $("#WIDTRout_trade_no").val(data.outTradeNo);
                  $("#WIDTRout_request_no").val(data.refundTradeNo);
                  $("#WIDTRrefund_amount").val(data.refundMoney);
                  $("#WIDTRrefund_reason").val(data.goodsReturnType);
                  var url='../../alipay/alipay.trade.refund.jsp';
                  $('#alipayment').attr('action',encodeURI(url));        
                  $("#alipayment").submit();
                  }                                                                 
        });  
    }
    //物流信息弹出框
    function logisticDetail(id,logisticCode){
        var logisticId = id;
        var logisticCode = logisticCode;
        console.log(logisticId);
        console.log(logisticCode);
        $.ajax({  
            url: "${ctxf}/track/trackQuery",  
            type: "GET",  
            data: {  
                'logisticId':logisticId,
                'expNo':logisticCode,
            },  
            success: function(data) {
                console.log(data);
                 var data1 = JSON.parse(data); //由JSON字符串转换为JSON对象
                 var compare = function (obj1, obj2) {//比较函数
                        var x = obj1.AcceptTime;
                        var y = obj2.AcceptTime;
                        if (x > y) {
                            return -1;
                        } else if (x < y) {
                            return 1;
                        } else {
                            return 0;
                        }
                      }
                 data1.Traces.sort(compare);
                 var html="";
                 if(data1.State==3){
                     html+="<div style='font-size: 16px;margin-bottom:10px;margin-top: 10px;color: red;'>已签收</div>";
                 }else if(data1.status==2){
                     html+="<div style='font-size: 16px;margin-bottom:10px;margin-top: 10px;color: red;'>在途中</div>";
                 }else if(data1.status==4){
                     html+="<div style='font-size: 16px;margin-bottom:10px;margin-top: 10px;color: red;'>问题件</div>";
                 }
                  $.each(data1.Traces,function(ii,cc){
                    html+= "<li style='list-style:none;'><span style='margin-right:20px;font-weight: 700;font-size:12px;'>"+cc.AcceptTime+"</span><span style='font-size:12px;'>"+cc.AcceptStation+"</span></li>";
                  })
                  $(".logistic-detail ul ").html(html);
                console.log($(".logistic-detail").html());
                layer.open({
                    type:1,
                    title:"物流信息",
                    area:["800px","300px"],
                    content:$("#logistic_detail")
                  });
            }
                                                                              
        }); 
    }

</script>
</body>
</html>
原文地址:https://www.cnblogs.com/zhoujingguoguo/p/10734545.html