Java之Springboot页面thymeleaf的ajax分页页面

14 篇文章 0 订阅
<html lang="en">
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,minimal-ui">
    <meta name="format-detection" content="telephone=no">
    <meta name="screen-orientation" content="portrait"><!-- uc强制竖屏 -->
    <meta name="x5-orientation" content="portrait"><!-- QQ强制竖屏 -->
    <meta name="apple-mobile-web-app-capable" content="yes" >
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta charset="UTF-8">
    <title>历史订单</title>

    <link rel="stylesheet" href="../basic/css/bingding.css">
    <link rel="stylesheet" href="../basic/css/payment.css">
    <script type="text/javascript" src="../basic/js/binding.js"></script>
    <script type="text/javascript" src="../basic/js/jquery-3.2.1.min.js"></script>
    <style>
        #page{display:inline;}

    </style>

    <script type="text/javascript">

        //下拉框选择调用
        function Change() {
            $("#pages").html(1);//恢复默认值第一页
            paging( f());
        }
        //点击 上一页 下一页 调用
        function gradeChange() {
            paging(f());
        }

        function f() {
            var myselect = document.getElementById("pid");
            var index=myselect.selectedIndex;
            // selectedIndex代表的是你所选中项的index
            var status = myselect.options[index].value;//支付状态
            return status;
        }


      function  previousPage(){
          var page =$("#pages").text(); //当前页
          var pg=$("#pg").text(); //总页数
          if (page>1){
              page=page-1;
              $("#pages").html(page);
              gradeChange();
          }
      }
      function nextPage() {
          var page =Number($("#pages").text()); //当前页
          var pg=Number($("#pg").text()); //总页数
          if (page < pg){
              page=page+1;
              $("#pages").html(page);
              gradeChange();
          }
      }
        // Load(); //加载数据
        function paging(status) {

            var openid=$("#openid").val();
            var page =$("#pages").text(); //当前页
            // alert("status:"+status);
            // alert("openid:"+openid);
            // alert("page:"+page);
            $.ajax({
                url: "PaymentPages",
                data: {
                    start: page,
                    openid:openid,
                    status:status
                },
                type: "POST",
                dataType: "JSON",
                success: function(data) {
                    // var a=data.get("payments").length;
                    //alert("总页数:"+data.pages);
                    var pages=data.pages;

                    if(pages ==0){
                        pages=1;
                    }
                    $("#pg").html(pages);//总页数
                    $(".div_form").remove();//删除

                    var str = "";
                    for(var k in data.payments) {

                        // "+data.payments[k].id+" 支付订单id
                        str+="<div class=\"div_form\" style=\"display: block\">\n" +
                            "            <div class=\"div_text\"  >\n" +
                            "                <div >\n" +
                            "                    <div class=\"div_key1\" > "+data.payments[k].numberPlate+" </div>\n" +
                            "                    <div class=\"div_val div_valNub\" >¥"+data.payments[k].fee+"元</div>\n" +
                            "                </div>\n" +
                            "                <div>\n" +
                            "                    <div class=\"div_key\"  >停车场:"+data.payments[k].parkingRecordId+"</div>\n" +
                            "                    <div class=\"div_val  \" >* </div>\n" +
                            "                </div>\n" +
                            "                <div>\n" +
                            "                    <div class=\"div_key\"  >停车时间:"+data.payments[k].arriveTime+"</div>\n" +
                            "                    <div class=\"div_val \"  >*</div>\n" +
                            "                </div>\n";
                        if (data.payments[k].payTime!=null){


                        var pay= "          <div>\n" +
                            "                    <div class=\"div_key\"  >支付时间:"+data.payments[k].payTime+"</div>\n" +
                            "                    <div class=\"div_val \"  >*</div>\n" +
                            "                </div>" ;
                            str+=pay;//是否显示支付时间
                        }
                        str+= "             <div>\n" +
                            "                    <div class=\"div_key\">订单状态:"+data.payments[k].status+"</div>\n" +
                            "                    <div class=\"div_val\">*</div>\n" +
                            "                </div>\n" +
                            "            </div>\n" +
                            "        </div>\n" +
                            "    </div> "

                    }
                    $(".divs").html(str);
                }
            });
        }


    </script>

</head>
<body>
<div id="body">

    <div style="display: none">
        openid: <input id="openid" type="text" name="openid" th:value="${openid}"><br>
    </div>
    <div class="div_name" style="margin-top:20px; ">
        历史订单
    </div>

    <div style="width: 100%;height: 50px;margin-top: 20px;">
        <div style="float: left;width:70%;height: 50px;float: left;margin-top: 6px;"  >
            <table border="0" cellspacing="0" cellpadding="0"  >
                <tr>
                    <td align="right">
                       <a   href="javascript:void(0);" onclick="previousPage()" >[上一页]</a>  
                        <a href="#"><span id="pages" value="1">1</span>/<span id="pg" value="1" th:text="${pages}">1</span></a>  
                       <a   href="javascript:void(0);" onclick="nextPage()">[下一页]</a>  
                    </td>
                </tr>
            </table>
        </div>
        <div style="float: right;width:30%;height: 50px;" >
            <select style="width:100%; height: 30px;" id="pid" onchange="Change()">
                <option value="支付成功">支付成功</option>
                <option value="未支付">未支付</option>
                <option value="已关闭">已关闭</option>
                <option value="已退款">已退款</option>
            </select>
        </div>
    </div>
<!--    οnclick="location.href='orderInfo.html?id=xx'"-->
    <div class="divs">
        <div class="div_form" style="display: block"  th:each="payments:${payments}" >
            <div class="div_text"  >
                <div >
                    <div class="div_key1"  th:text="${payments.numberPlate}">   渝A·66666</div>
                    <div class="div_val div_valNub"  th:text="'¥'+${payments.fee}+''" >¥136元</div>
                </div>
                <div>
                    <div class="div_key" th:text="'停车场:'+${payments.parkingRecordId}">重庆日月光停车场A区</div>
                    <div class="div_val  " >* </div>
                </div>
                <div>
                    <div class="div_key" th:text="'停车时间:'+${#dates.format(payments.arriveTime,'yyyy-MM-dd HH:mm:ss')}">2019-08-29 12:25:26</div>
                    <div class="div_val "  >*</div>
                </div>
                <div>
                    <div class="div_key" th:text="'支付时间:'+${#dates.format(payments.payTime,'yyyy-MM-dd HH:mm:ss')}">2019-08-29 12:25:26</div>
                    <div class="div_val "  >*</div>
                </div>
                <div>
                    <div class="div_key" th:text="'订单状态:'+${payments.status}" >订单状态</div>
                    <div class="div_val">*</div>
                </div>
            </div>
        </div>
    </div>

    <div class="div_explain" style="background: #ffffff;">
        <div class="div_name">
            历史缴费说明
        </div>
        <div class="div_text">
            <p>1.只会显示最近<span>一年</span>的缴费情况。</p>
            <p>2.关于退款,在缴费记录时间往后一个月以内有效。</p>
        </div>
    </div>
</div>

</body></html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值