@ -8,7 +8,8 @@
< script src = "bootstrap-3.3.4/dist/js/jquery-1.11.3.min.js" > < / script >
< script src = "bootstrap-3.3.4/dist/js/bootstrap.min.js" > < / script >
< script src = "Flat-UI-master/dist/js/flat-ui.min.js" > < / script >
< title > < / title >
< title > 订单< / title >
< style >
.row{
margin-left: 20px;
@ -30,6 +31,7 @@
cursor: pointer;
}
< / style >
< script >
function myClick(n){
location.href = "OrderInfo.html";
@ -38,12 +40,119 @@
alert("btn");
return false;
}
$(function(){
})
< / script >
< / head >
< body >
< script >
$(function () {
var orders;
// 发一个请求获取全部订单
// 后面可以改成每次拿10个
$.ajax({
url:"/order/getAll",
success: function (data) {
for (var order of data){
var node = document.createElement("div");
node.setAttribute("class","col-sm-12 list-group-item");
// 发布时间
var timestamp = document.createElement("div");
timestamp.setAttribute("class","col-sm-3 line-center");
timestamp.innerText = order.timestamp.substring(0,19).replace("T"," ");
node.append(timestamp)
// 描述
var description = document.createElement("div");
description.setAttribute("class","col-sm-3 line-center");
description.innerText = order.description;
node.append(description)
// 订单价格
var price = document.createElement("div");
price.setAttribute("class","col-sm-1 line-center");
price.innerText = order.price;
node.append(price)
// 接单人
var receiver = document.createElement("div");
receiver.setAttribute("class","col-sm-2 line-center");
receiver.innerText = order.receiver;
node.append(receiver)
// 订单状态
var status = document.createElement("div");
status.setAttribute("class","col-sm-1 line-center");
status.innerText = order.status;
node.append(status)
// 【操作】
var delete_op = document.createElement("button");
delete_op.setAttribute("class","btn btn-danger");
delete_op.innerText = "删除订单";
var commit_op = document.createElement("button");
commit_op.setAttribute("class","btn btn-success");
commit_op.innerText = "提交订单";
var ops = document.createElement("div");
ops.setAttribute("class","col-sm-2 line-center");
ops.append(delete_op);
ops.append(commit_op);
node.append(ops)
$("div.list-group").append(node);
}
},
error: function () {
// alert("获取订单失败,请联系开发者wyz");
}
});
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
success: function (data) {
if(data["flag"] < 0 ) {
// 还没登录
$("#register").show();
$("#login").show();
}else{
// 已经登录了
$("#logout").show();
}
},
error: function () {
console.log("error");
}
});
// 点了注销会发生什么
$("#logout").click(function () {
$("#logout").hide();
$("#register").show();
$("#login").show();
$.ajax({
url:"/user/logout",
success: function (data) {
console.log("log out success")
},
error: function () {
console.log("error");
}
});
});
})
< / script >
<!-- Static navbar -->
< div class = "navbar navbar-default navbar-static-top" role = "navigation" >
< div class = "container" >
@ -51,89 +160,75 @@
< button type = "button" class = "navbar-toggle" data-toggle = "collapse" data-target = ".navbar-collapse" >
< span class = "sr-only" > 这什么东西< / span >
< / button >
< a class = "navbar-brand" href = "Index.html" > 图书商城 < / a >
< a class = "navbar-brand" href = "Index.html" > 快递代取系统 < / a >
< / div >
< div class = "navbar-collapse collapse" >
< ul class = "nav navbar-nav" >
< li class = "active" > < a href = "Index.html" > 首页< / a > < / li >
< li > < a href = "Order.html" > 我的订单< / a > < / li >
< li > < a href = "UserInfo.html" > 个人中心< / a > < / li >
< li > < a href = "NewOrder.html" > 发起订单< / a > < / li >
< li > < a href = "FriendLink.html" > 友情链接< / a > < / li >
< / ul >
< ul class = "nav navbar-nav navbar-right hidden-sm" >
< li > < a href = "Login.html" > 登录< / a > < / li >
< li > < a href = "Register.html" > 注册< / a > < / li >
< li > < a id = "login" href = "Login.html" style = "display: none;" > 登录< / a > < / li >
< li > < a id = "register" href = "Register.html" style = "display: none" > 注册< / a > < / li >
< li > < a id = "logout" href = "#" style = "display: none" > 注销< / a > < / li >
< li >
< a href = "Cart.html" > < span class = "glyphicon glyphicon-shopping-cart" > 购物车< / span > < / a > < / li >
< a href = "Cart.html" > < span class = "glyphicon glyphicon-shopping-cart" > 购物车< / span > < / a >
< / li >
< / ul >
< / div > <!-- /.nav - collapse -->
< / div >
< / div >
<!-- content -->
< div class = "container" >
< div class = "row thumbnail center" >
< div class = "col-sm-12" >
< h1 class = "text-center" style = "margin-bottom: 30px" > 我的订单< / h1 >
< / div >
< div class = "col-sm-12 thumbnail" >
< div class = "col-sm-3 line-center" > 订单编号< / div >
< div class = "col-sm-2 line-center" > 订单状态< / div >
< div class = "col-sm-2 line-center" > 商品数量 < / div >
< div class = "col-sm-2 line-center" > 订单总价< / div >
< div class = "col-sm-3 line-center" > 操作< / div >
< div class = "col-sm-3 line-center" > 发布时间< / div >
< div class = "col-sm-3 line-center" > 描述< / div >
< div class = "col-sm-1 line-center" > 价格< / div >
< div class = "col-sm-2 line-center" > 接单人< / div >
< div class = "col-sm-1 line-center" > 状态< / div >
< div class = "col-sm-2 line-center" > 操作< / div >
< / div >
<!-- important -->
< div class = "list-group" >
<!-- <div class="col - sm - 12 list - group - item" > -->
<!-- <div class="col - sm - 3 line - center" onclick="myClick(1)">ahiudsfhjk - 23423 - 23asd - 12</div> -->
<!-- <div class="col - sm - 3 line - center">未付款</div> -->
<!-- <div class="col - sm - 1 line - center">12</div> -->
<!-- <div class="col - sm - 2 line - center">big guy</div> -->
<!-- <div class="col - sm - 1 line - center">none</div> -->
<!-- <div class="col - sm - 2 line - center"> -->
<!-- <button class="btn btn - danger">删除订单</button> -->
<!-- <button class="btn btn - success">提交订单</button> -->
<!-- </div> -->
<!-- </div> -->
< / div >
< div >
< div class = "col-sm-12 list-group-item" >
< div class = "col-sm-3 line-center" onclick = "myClick(1)" > ahiudsfhjk-23423-23asd-12< / div >
< div class = "col-sm-2 line-center" > 未付款< / div >
< div class = "col-sm-2 line-center" > 12 < / div >
< div class = "col-sm-2 line-center" > 1231.00元< / div >
< div class = "col-sm-3 line-center" >
< button class = "btn btn-danger" > 删除订单< / button >
< button class = "btn btn-success" > 提交订单< / button >
< / div >
< / div >
< div class = "col-sm-12 list-group-item" >
< div class = "col-sm-3 line-center" onclick = "myClick(2)" > ahiudsfhjk-23423-23asd-12< / div >
< div class = "col-sm-2 line-center" > 未付款< / div >
< div class = "col-sm-2 line-center" > 12 < / div >
< div class = "col-sm-2 line-center" > 1231.00元< / div >
< div class = "col-sm-3 line-center" >
< button class = "btn btn-danger" > 删除订单< / button >
< button class = "btn btn-success" > 提交订单< / button >
< / div >
< / div >
< div class = "col-sm-12 list-group-item" >
< div class = "col-sm-3 line-center" onclick = "myClick(3)" > ahiudsfhjk-23423-23asd-12< / div >
< div class = "col-sm-2 line-center" > 未付款< / div >
< div class = "col-sm-2 line-center" > 12 < / div >
< div class = "col-sm-2 line-center" > 1231.00元< / div >
< div class = "col-sm-3 line-center" >
< button class = "btn btn-danger" > 删除订单< / button >
< button class = "btn btn-success" > 提交订单< / button >
< / div >
< / div >
< div class = "col-sm-12 list-group-item" >
< div class = "col-sm-3 line-center" onclick = "myClick(4)" > ahiudsfhjk-23423-23asd-12< / div >
< div class = "col-sm-2 line-center" > 未付款< / div >
< div class = "col-sm-2 line-center" > 12 < / div >
< div class = "col-sm-2 line-center" > 1231.00元< / div >
< div class = "col-sm-3 line-center" >
< button class = "btn btn-danger" > 删除订单< / button >
< button class = "btn btn-success" > 提交订单< / button >
< / div >
< p style = "text-align: center" > 点击显示更多< / p >
< / div >
< / div >
< / div >
< / div >
<!-- footer -->
< div class = "navbar navbar-default navbar-static-bottom" >
版权声明区
< p style = "text-align: center" > 版权声明区< / p >
< / div >
< / body >
< / html >