wyz vor 3 Jahren
Ursprung
Commit
54e3a9a1f9
26 geänderte Dateien mit 764 neuen und 216 gelöschten Zeilen
  1. +20
    -0
      README.md
  2. +23
    -23
      pom.xml
  3. +38
    -9
      src/main/java/com/wyz/demo/controller/OrderController.java
  4. +1
    -1
      src/main/java/com/wyz/demo/controller/UserController.java
  5. +15
    -1
      src/main/java/com/wyz/demo/dao/OrderRepository.java
  6. +3
    -3
      src/main/java/com/wyz/demo/dao/UserRepository.java
  7. +5
    -5
      src/main/java/com/wyz/demo/dto/OrderDTO.java
  8. +23
    -3
      src/main/java/com/wyz/demo/service/OrderService.java
  9. +62
    -5
      src/main/java/com/wyz/demo/service/impl/OrderServiceImpl.java
  10. +16
    -0
      src/main/java/com/wyz/demo/vo/CommonOrderVO.java
  11. +17
    -0
      src/main/java/com/wyz/demo/vo/DetailOrderVO.java
  12. +1
    -1
      src/main/java/com/wyz/demo/vo/SelfOrderVO.java
  13. +16
    -4
      src/main/resources/mapper/OrderMapper.xml
  14. +6
    -3
      src/main/resources/mapper/UserMapper.xml
  15. +2
    -1
      src/main/resources/static/BookInfo.html
  16. +2
    -1
      src/main/resources/static/Cart.html
  17. +5
    -4
      src/main/resources/static/FriendLink.html
  18. +113
    -32
      src/main/resources/static/Index.html
  19. +2
    -1
      src/main/resources/static/Login.html
  20. +16
    -17
      src/main/resources/static/NewOrder.html
  21. +7
    -9
      src/main/resources/static/Order.html
  22. +116
    -72
      src/main/resources/static/OrderInfo.html
  23. +232
    -0
      src/main/resources/static/PickedOrder.html
  24. +2
    -1
      src/main/resources/static/Register.html
  25. +4
    -3
      src/main/resources/static/UserInfo.html

+ 20
- 0
README.md Datei anzeigen

@ -72,6 +72,26 @@
## 自定义订单状态
0:未接单 unpick
1:已接单 pick
2:已送达 arrived
3:已完成 completed
4:已取消 canceled
5:已中止 terminated
## 后端接收ajax数据
2021/01/08

+ 23
- 23
pom.xml Datei anzeigen

@ -70,29 +70,29 @@
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- Docker maven plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.6</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>betaberry/common</repository>
<tag>0.0.1</tag>
<buildArgs>
<JAR_FILE>app.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
<!-- Docker maven plugin -->
<!-- &lt;!&ndash; Docker maven plugin &ndash;&gt;-->
<!-- <plugin>-->
<!-- <groupId>com.spotify</groupId>-->
<!-- <artifactId>dockerfile-maven-plugin</artifactId>-->
<!-- <version>1.4.6</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>default</id>-->
<!-- <goals>-->
<!-- <goal>build</goal>-->
<!-- <goal>push</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <configuration>-->
<!-- <repository>betaberry/common</repository>-->
<!-- <tag>0.0.2</tag>-->
<!-- <buildArgs>-->
<!-- <JAR_FILE>app.jar</JAR_FILE>-->
<!-- </buildArgs>-->
<!-- </configuration>-->
<!-- </plugin>-->
</plugins>
</build>

+ 38
- 9
src/main/java/com/wyz/demo/controller/OrderController.java Datei anzeigen

@ -2,13 +2,12 @@ package com.wyz.demo.controller;
import com.wyz.demo.dto.OrderDTO;
import com.wyz.demo.service.OrderService;
import com.wyz.demo.vo.OrderVO;
import com.wyz.demo.vo.CommonOrderVO;
import com.wyz.demo.vo.DetailOrderVO;
import com.wyz.demo.vo.SelfOrderVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
import java.util.List;
@ -24,16 +23,16 @@ public class OrderController {
/**
* 查询订单
* 查询某个用户自己的订单
*/
@RequestMapping(value = "/getAll", produces = "application/json")
public List<OrderVO> getAll(HttpSession sess){
@RequestMapping(value = "/own", produces = "application/json")
public List<SelfOrderVO> getOwnOrders(HttpSession sess){
String username = (String)sess.getAttribute("username");
if(username==null){
log.error("{session中没有用户名:还未登录}");
return null;
}else{
List<OrderVO> orders = orderService.getAll(username);
List<SelfOrderVO> orders = orderService.getOrdersByUsername(username);
return orders;
}
}
@ -48,4 +47,34 @@ public class OrderController {
orderService.addOrder(orderDTO,sess);
}
/**
* 返回全部待接单的订单在主页上显示
*/
@RequestMapping(value = "/all")
public List<CommonOrderVO> getAllUnpickOrders(){
return orderService.getAllUnpickOrders();
}
/**
* 获取订单详情
*/
@GetMapping(value = "/detail")
public DetailOrderVO getDetailOrder(@RequestParam("orderId") int orderId){
log.info("请求订单号:{} 的详细信息",orderId);
return orderService.getDetailOrder(orderId);
}
/**
* 接单
*/
@RequestMapping(value = "/pick")
public void pickOrder(@RequestParam("orderId") int orderId, HttpSession sess){
orderService.pickOrder(orderId, sess);
}
}

+ 1
- 1
src/main/java/com/wyz/demo/controller/UserController.java Datei anzeigen

@ -58,7 +58,7 @@ public class UserController {
@PostMapping(value = "/login")
public Message login(@RequestBody UserDTO u, HttpServletResponse resp, HttpSession sess){
log.info("this is userDTO: {}",u);
log.info("请求登录的-userDTO: {}",u);
Message msg = userService.checkUser(u, resp, sess);
return msg;

+ 15
- 1
src/main/java/com/wyz/demo/dao/OrderRepository.java Datei anzeigen

@ -1,6 +1,7 @@
package com.wyz.demo.dao;
import com.wyz.demo.po.OrderPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -8,10 +9,23 @@ public interface OrderRepository {
// 根据用户id查订单
public List<OrderPO> getOrders(int sender_id);
public List<OrderPO> getOrdersByUserId(int sender_id);
// 提交订单
public void addOrder(OrderPO orderPO);
// 返回所有 未接单 的订单
public List<OrderPO> getAllUnpickOrders();
// 根据id查订单
public OrderPO getOrderById(int id);
// 有用户接单
public void pickOrder(@Param("id") int order_id, @Param("receiver_id")int receiver_id);
}

+ 3
- 3
src/main/java/com/wyz/demo/dao/UserRepository.java Datei anzeigen

@ -14,7 +14,7 @@ public interface UserRepository {
/**
* 判断用户名是否存在
* 根据用户名获取用户
* 根据 username 获取用户
* @return
*/
public UserPO getUserByUsername(String username);
@ -35,8 +35,8 @@ public interface UserRepository {
public String getUsernameById(int id);
// // 查找用户: 根据id
// public UserPO findUserById(int id);
// 查找用户: 根据id 获取 用户
public UserPO getUserById(int id);
}

+ 5
- 5
src/main/java/com/wyz/demo/dto/OrderDTO.java Datei anzeigen

@ -7,9 +7,9 @@ import java.util.Date;
@Data
public class OrderDTO implements Serializable {
public String description; // 订单描述
public Date when; // 快递要什么时候送到
public String location; // 快递在哪里
public int price; // 价钱
public String comment; // 备注
String description; // 订单描述
Date when; // 快递要什么时候送到
String location; // 快递在哪里
int price; // 价钱
String comment; // 备注
}

+ 23
- 3
src/main/java/com/wyz/demo/service/OrderService.java Datei anzeigen

@ -1,7 +1,10 @@
package com.wyz.demo.service;
import com.wyz.demo.dto.OrderDTO;
import com.wyz.demo.vo.OrderVO;
import com.wyz.demo.vo.CommonOrderVO;
import com.wyz.demo.vo.DetailOrderVO;
import com.wyz.demo.vo.SelfOrderVO;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpSession;
import java.util.List;
@ -9,13 +12,30 @@ import java.util.List;
public interface OrderService {
/**
* 获取全部订单
* 获取某个用户自己的全部订单
*/
public List<OrderVO> getAll(String username);
public List<SelfOrderVO> getOrdersByUsername(String username);
/**
* 提交订单
*/
public void addOrder(OrderDTO orderDTO, HttpSession sess);
/**
* 获取所有未接单的订单在主页上显示
*/
public List<CommonOrderVO> getAllUnpickOrders();
/**
* 获取订单详情页
*/
public DetailOrderVO getDetailOrder(int orderId);
/**
* 接单
*/
public void pickOrder(int order_id, HttpSession sess);
}

+ 62
- 5
src/main/java/com/wyz/demo/service/impl/OrderServiceImpl.java Datei anzeigen

@ -4,8 +4,11 @@ import com.wyz.demo.dao.OrderRepository;
import com.wyz.demo.dao.UserRepository;
import com.wyz.demo.dto.OrderDTO;
import com.wyz.demo.po.OrderPO;
import com.wyz.demo.po.UserPO;
import com.wyz.demo.service.OrderService;
import com.wyz.demo.vo.OrderVO;
import com.wyz.demo.vo.CommonOrderVO;
import com.wyz.demo.vo.DetailOrderVO;
import com.wyz.demo.vo.SelfOrderVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -30,14 +33,14 @@ public class OrderServiceImpl implements OrderService {
* @Param username 用户名
*/
@Override
public List<OrderVO> getAll(String username) {
public List<SelfOrderVO> getOrdersByUsername(String username) {
int sender_id = userRepository.getIdByUsername(username);
List<OrderPO> orders = orderRepository.getOrders(sender_id);
List<OrderPO> orders = orderRepository.getOrdersByUserId(sender_id);
List<OrderVO> res = new ArrayList<>();
List<SelfOrderVO> res = new ArrayList<>();
for (OrderPO orderPO : orders) {
OrderVO orderVO = new OrderVO();
SelfOrderVO orderVO = new SelfOrderVO();
orderVO.setTimestamp(orderPO.getTimestamp());
orderVO.setDescription(orderPO.getDescription());
@ -69,4 +72,58 @@ public class OrderServiceImpl implements OrderService {
orderRepository.addOrder(orderPO);
}
@Override
public List<CommonOrderVO> getAllUnpickOrders() {
List<OrderPO> orderPOs = orderRepository.getAllUnpickOrders();
List<CommonOrderVO> commonOrderVOs = new ArrayList<>();
for (OrderPO orderPO : orderPOs) {
// log.info("获取全部订单:{}",orderPO);
CommonOrderVO commonOrderVO = new CommonOrderVO();
commonOrderVO.setId(orderPO.getId());
commonOrderVO.setDescription(orderPO.getDescription());
commonOrderVO.setWhen(orderPO.getWhen());
commonOrderVO.setLocation(orderPO.getLocation());
commonOrderVO.setSender(userRepository.getUsernameById(orderPO.getSenderId()));
commonOrderVO.setPrice(orderPO.getPrice());
commonOrderVOs.add(commonOrderVO);
}
return commonOrderVOs;
}
@Override
public DetailOrderVO getDetailOrder(int orderId) {
OrderPO orderPO = orderRepository.getOrderById(orderId);
UserPO userPO = userRepository.getUserById(orderPO.getSenderId());
DetailOrderVO detailOrderVO = new DetailOrderVO();
detailOrderVO.setDescription(orderPO.getDescription());
detailOrderVO.setWhen(orderPO.getWhen());
detailOrderVO.setLocation(orderPO.getLocation());
detailOrderVO.setSender(userPO.getUsername());
detailOrderVO.setPhone(userPO.getPhone());
detailOrderVO.setComment(orderPO.getComment());
detailOrderVO.setPrice(orderPO.getPrice());
return detailOrderVO;
}
@Override
public void pickOrder(int order_id, HttpSession sess) {
String receiver = (String)sess.getAttribute("username");
int receiver_id = userRepository.getIdByUsername(receiver);
orderRepository.pickOrder(order_id, receiver_id);
}
}

+ 16
- 0
src/main/java/com/wyz/demo/vo/CommonOrderVO.java Datei anzeigen

@ -0,0 +1,16 @@
package com.wyz.demo.vo;
import lombok.Data;
import java.util.Date;
@Data
public class CommonOrderVO {
int id;
String description;
Date when;
String location;
String sender;
int price;
}

+ 17
- 0
src/main/java/com/wyz/demo/vo/DetailOrderVO.java Datei anzeigen

@ -0,0 +1,17 @@
package com.wyz.demo.vo;
import lombok.Data;
import java.util.Date;
@Data
public class DetailOrderVO {
String description;
Date when;
String location;
String sender;
String phone;
String comment;
int price;
}

src/main/java/com/wyz/demo/vo/OrderVO.java → src/main/java/com/wyz/demo/vo/SelfOrderVO.java Datei anzeigen

@ -6,7 +6,7 @@ import lombok.Data;
import java.util.Date;
@Data
public class OrderVO {
public class SelfOrderVO {
Date timestamp;
String description;
int price;

+ 16
- 4
src/main/resources/mapper/OrderMapper.xml Datei anzeigen

@ -22,13 +22,25 @@
</insert>
<select id="getOrders" resultMap="OrderMap" parameterType="int">
<update id="pickOrder">
update `order` set `receiver_id`=#{receiver_id},`status`="已接单" where id=#{id}
</update>
<select id="getOrdersByUserId" resultMap="OrderMap" parameterType="int">
select * from `order` where sender_id = #{sender_id}
</select>
<!-- <select id="getIdByUsername" resultType="int" parameterType="java.lang.String">-->
<!-- select id from user where username = #{username}-->
<!-- </select>-->
<select id="getAllUnpickOrders" resultMap="OrderMap">
select * from `order` where `status` = "待接单"
</select>
<select id="getOrderById" resultMap="OrderMap">
select * from `order` where id = #{id}
</select>

+ 6
- 3
src/main/resources/mapper/UserMapper.xml Datei anzeigen

@ -7,21 +7,24 @@
<mapper namespace="com.wyz.demo.dao.UserRepository">
<insert id="addUser" parameterType="com.wyz.demo.po.UserPO">
insert into user (username,password,phone) values (#{username},#{password}, #{phone})
insert into `user` (username,password,phone) values (#{username},#{password}, #{phone})
</insert>
<select id="getUserByUsername" resultType="com.wyz.demo.po.UserPO" parameterType="java.lang.String">
select * from user where username = #{username}
select * from `user` where username = #{username}
</select>
<select id="getIdByUsername" resultType="int" parameterType="java.lang.String">
select id from user where username = #{username}
select id from `user` where username = #{username}
</select>
<select id="getUsernameById" resultType="java.lang.String" parameterType="int">
select username from `user` where id = #{id}
</select>
<select id="getUserById" resultType="com.wyz.demo.po.UserPO">
select * from `user`where id = #{id}
</select>
</mapper>

+ 2
- 1
src/main/resources/static/BookInfo.html Datei anzeigen

@ -72,9 +72,10 @@
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="PickedOrder.html">我的接单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">

+ 2
- 1
src/main/resources/static/Cart.html Datei anzeigen

@ -78,9 +78,10 @@
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="PickedOrder.html">我的接单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">

+ 5
- 4
src/main/resources/static/FriendLink.html Datei anzeigen

@ -119,11 +119,12 @@
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Index.html">首页</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="PickedOrder.html">我的接单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
<li class="active"><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a id="login" href="Login.html" style="display: none;">登录</a></li>
@ -187,7 +188,7 @@
<!--footer-->
<div class="navbar navbar-default navbar-static-bottom">
版权声明区
<p style="text-align: center">版权声明区</p>
</div>
</body>
</html>

+ 113
- 32
src/main/resources/static/Index.html Datei anzeigen

@ -36,6 +36,73 @@
<script>
$(function () {
// 请求拿到所有 未接单 的订单
$.ajax({
url:"/order/all",
success:function (data) {
for(var order of data){
var node = document.createElement("div");
node.setAttribute("class","col-sm-4 col-md-3");
var node2 = document.createElement("div");
node2.setAttribute("class","thumbnail");
// 订单描述
var desc = document.createElement("div");
desc.setAttribute("class","alert alert-warning");
desc.setAttribute("role","alert");
desc.setAttribute("style","height:62.55px; overflow-y: auto;");
desc.innerText = order.description;
node2.append(desc);
var others = document.createElement("div");
others.setAttribute("class","caption center");
// 订单提交者
var sender = document.createElement("p");
sender.innerText = "发布者:"+order.sender;
others.append(sender);
// 订单价格
var price = document.createElement("p");
price.innerText = "价格:"+order.price;
others.append(price);
// 订单配送时间
var when = document.createElement("p");
when.innerText = "指定收件时间:"+order.when.substring(0,19).replace("T"," ");
others.append(when);
// 订单配送地点
var location = document.createElement("p");
location.innerText = "收件地点:"+order.location
location.setAttribute("style","height:61.09px; overflow-y: auto;");
others.append(location);
var detail = document.createElement("a");
detail.setAttribute("class","btn btn-primary btn-block");
detail.setAttribute("role","button");
detail.setAttribute("href","OrderInfo.html?"+order.id);
detail.innerText = "查看详情";
others.append(detail);
node2.append(others);
node.append(node2);
$("#all-order").append(node);
}
},
error: function () {
alert("获取全部订单失败,请联系开发者wyz解决问题")
}
})
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
@ -85,9 +152,10 @@
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="PickedOrder.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">
@ -127,39 +195,52 @@
<!-- 订单详情页, 包含了所有用户待接单, 供人选择 -->
<div id="all-order" class="row">
<div class="col-sm-4 col-md-3">
<div class="thumbnail">
<a href="OrderInfo.html">
<img style="width: 100%; height: 200px; display: block;" alt="100%x200"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNDggMjAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIG1lZXQiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIj48ZGVmcyAvPjxyZWN0IGZpbGw9IiNlZWVlZWUiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIiAvPjxnPjx0ZXh0IHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7IGZvbnQtc2l6ZTogMjJweDsgZm9udC13ZWlnaHQ6IGJvbGQ7IGRvbWluYW50LWJhc2VsaW5lOiBjZW50cmFsOyBmaWxsOiAjYWFhYWFhOyIgeD0iMTMxLjE2IiB5PSIxMDAiPjM0OHgyMDA8L3RleHQ+PC9nPjwvc3ZnPg=="
data-src="holder.js/100%x200" data-holder-rendered="true">
</a>
<!-- <div class="col-sm-4 col-md-3">-->
<!-- <div class="thumbnail">-->
<!-- <a href="OrderInfo.html">-->
<!-- <img style="width: 100%; height: 200px; display: block;" alt="100%x200"-->
<!-- src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNDggMjAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIG1lZXQiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIj48ZGVmcyAvPjxyZWN0IGZpbGw9IiNlZWVlZWUiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIiAvPjxnPjx0ZXh0IHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7IGZvbnQtc2l6ZTogMjJweDsgZm9udC13ZWlnaHQ6IGJvbGQ7IGRvbWluYW50LWJhc2VsaW5lOiBjZW50cmFsOyBmaWxsOiAjYWFhYWFhOyIgeD0iMTMxLjE2IiB5PSIxMDAiPjM0OHgyMDA8L3RleHQ+PC9nPjwvc3ZnPg=="-->
<!-- data-src="holder.js/100%x200" data-holder-rendered="true">-->
<!-- </a>-->
<!-- <div class="alert alert-warning" role="alert" style="overflow-y: auto; height: 62.55px;">-->
<!-- Better check yourself, you're not looking too good.-->
<!-- </div>-->
<div class="caption center">
<h3>书名</h3>
<p>
<span>价格:</span>
<span>100.00</span>
</p>
<p><a class="btn btn-primary btn-block" role="button" href="OrderInfo.html">查看详情</a></p>
</div>
</div>
</div>
<!-- <div class="caption center">-->
<!-- <p>-->
<!-- 发布者:tony-->
<!-- </p>-->
<!-- <p>-->
<!-- <span>价格:</span>-->
<!-- <span>5</span>-->
<!-- </p>-->
<!-- <p>-->
<!-- <span>时间:</span>-->
<!-- <span>2021-2-2</span>-->
<!-- </p>-->
<!-- <p>-->
<!-- <span>地点:</span>-->
<!-- <span>第八宿舍</span>-->
<!-- </p>-->
<!-- <a class="btn btn-primary btn-block" role="button" href="OrderInfo.html">查看详情</a>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div class="col-sm-4 col-md-3">
<div class="thumbnail">
<a href="OrderInfo.html">
<img style="width: 100%; height: 200px; display: block;" alt="100%x200"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNDggMjAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIG1lZXQiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIj48ZGVmcyAvPjxyZWN0IGZpbGw9IiNlZWVlZWUiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIiAvPjxnPjx0ZXh0IHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7IGZvbnQtc2l6ZTogMjJweDsgZm9udC13ZWlnaHQ6IGJvbGQ7IGRvbWluYW50LWJhc2VsaW5lOiBjZW50cmFsOyBmaWxsOiAjYWFhYWFhOyIgeD0iMTMxLjE2IiB5PSIxMDAiPjM0OHgyMDA8L3RleHQ+PC9nPjwvc3ZnPg=="
data-src="holder.js/100%x200" data-holder-rendered="true">
</a>
<div class="caption center">
<h3>书名</h3>
<p><span>价格:</span><span>100.00</span></p>
<p><a class="btn btn-primary btn-block" role="button" href="OrderInfo.html">查看详情</a></p>
</div>
</div>
</div>
<!-- <div class="col-sm-4 col-md-3">-->
<!-- <div class="thumbnail">-->
<!-- <a href="OrderInfo.html">-->
<!-- <img style="width: 100%; height: 200px; display: block;" alt="100%x200"-->;
<!-- src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNDggMjAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIG1lZXQiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIj48ZGVmcyAvPjxyZWN0IGZpbGw9IiNlZWVlZWUiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIiAvPjxnPjx0ZXh0IHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7IGZvbnQtc2l6ZTogMjJweDsgZm9udC13ZWlnaHQ6IGJvbGQ7IGRvbWluYW50LWJhc2VsaW5lOiBjZW50cmFsOyBmaWxsOiAjYWFhYWFhOyIgeD0iMTMxLjE2IiB5PSIxMDAiPjM0OHgyMDA8L3RleHQ+PC9nPjwvc3ZnPg=="-->
<!-- data-src="holder.js/100%x200" data-holder-rendered="true">-->
<!-- </a>-->
<!-- <div class="caption center">-->
<!-- <h3>书名</h3>-->
<!-- <p><span>价格:</span><span>100.00</span></p>-->
<!-- <p><a class="btn btn-primary btn-block" role="button" href="OrderInfo.html">查看详情</a></p>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>

+ 2
- 1
src/main/resources/static/Login.html Datei anzeigen

@ -113,9 +113,10 @@
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="PickedOrder.html">我的接单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">

+ 16
- 17
src/main/resources/static/NewOrder.html Datei anzeigen

@ -29,21 +29,19 @@
}
$(function(){
$("button").click(function () {
$.ajax({
url:"/order/commit",
// data: JSON.stringify({
// description: $("input#description").val(),
// when: $("input#when").val(),
// location: $("input#location").val(),
// price: $("input#price").val(),
// comment: $("input#comment").val()
// }),
data: JSON.stringify(
$("form").serialize()
),
data: JSON.stringify({
description: $("input#description").val(),
when: $("input#when").val(),
location: $("input#location").val(),
price: $("input#price").val(),
comment: $("input#comment").val()
}),
// data: JSON.stringify(
// $("form").serialize()
// ),
contentType: "application/json; charset=utf-8",
type: "POST",
async: false,
@ -52,7 +50,7 @@
location.assign("Order.html");
},
error: function () {
alert("提交错误!!!请联系开发者wyz解决问题")
alert("请先登录!!!")
}
});
})
@ -107,10 +105,11 @@
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Index.html">首页</a></li>
<li class="active"><a href="NewOrder.html">发起订单</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="PickedOrder.html">我的接单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
@ -132,7 +131,7 @@
</div>
<div class="col-sm-12">
<form class="form-horizontal caption" action="https://www.baidu.com" method="post" onsubmit="return k();">
<form class="form-horizontal caption" action="https://www.baidu.com" method="post" onsubmit="return false;">
<div class="form-group">
<label for="description" class="col-sm-3 control-label">订单描述</label>
@ -172,7 +171,7 @@
<!-- 提示信息: 用户不存在or密码错误 -->
<!-- 提示信息: -->
<div class="form-group">
<div class="col-sm-offset-3 col-sm-8">
<p id="common" style="font-size: 10px; display: none;">&nbsp;&nbsp;&nbsp;<b>msg</b></p>

+ 7
- 9
src/main/resources/static/Order.html Datei anzeigen

@ -9,7 +9,7 @@
<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;
@ -51,12 +51,9 @@
// 发一个请求获取全部订单
// 后面可以改成每次拿10个
$.ajax({
url:"/order/getAll",
url:"/order/own",
success: function (data) {
for (var order of data){
var node = document.createElement("div");
node.setAttribute("class","col-sm-12 list-group-item");
@ -111,7 +108,7 @@
},
error: function () {
// alert("获取订单失败,请联系开发者wyz");
// alert("获取用户订单失败,请联系开发者wyz解决问题");
}
});
@ -164,10 +161,11 @@
</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="Index.html">首页</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li class="active"><a href="Order.html">我的订单</a></li>
<li><a href="PickedOrder.html">我的接单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">

+ 116
- 72
src/main/resources/static/OrderInfo.html Datei anzeigen

@ -60,7 +60,54 @@
<body>
<script>
var orderId;
// 获取url中的参数: orderId
function getOrderId() {
return window.location.search.substring(1);
}
$(function () {
// 发送请求要完整的数据
orderId = getOrderId();
$.ajax({
url:"/order/detail?orderId="+orderId,
type: "GET",
success: function (data) {
$("td#orderId").text(getOrderId());
$("td#description").text(data.description);
$("td#when").text(data.when.substring(0,19).replace("T"," "));
$("td#location").text(data.location);
$("td#sender").text(data.sender);
$("td#phone").text(data.phone);
$("td#comment").text(data.comment);
$("td#price").text(data.price);
},
error: function () {
alert("获取订单详情失败,请联系开发者wyz解决问题");
},
contentType: "application/text"
});
// 点了”接单“按钮
$("#pick").click(function () {
$.ajax({
url: "/order/pick",
data:{
orderId: orderId
},
type: "GET",
success: function () {
location.assign("/Index.html");
},
errot:function () {
alert("接单失败,请联系开发者wyz解决问题");
}
})
})
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
@ -71,6 +118,7 @@
$("#login").show();
}else{
// 已经登录了
$("#pick").show();
$("#logout").show();
}
},
@ -81,6 +129,7 @@
// 点了注销会发生什么
$("#logout").click(function () {
$("#pick").hide();
$("#logout").hide();
$("#register").show();
$("#login").show();
@ -108,10 +157,11 @@
</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="Index.html">首页</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li class="active"><a href="Order.html">我的订单</a></li>
<li><a href="PickedOrder.html">我的接单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
@ -125,6 +175,7 @@
</div><!--/.nav-collapse -->
</div>
</div>
<!--content-->
<div class="container">
<div class="row thumbnail center col-sm-12">
@ -135,98 +186,91 @@
<div class="col-sm-12 ">
<table>
<tr>
<th>订单编号:</th><td>123-131-4234-1314-131</td>
<th>订单编号:</th> <td id="orderId">...</td>
</tr>
<tr>
<th>订单描述:</th> <td id="description">...</td>
</tr>
<tr>
<th>指定收件时间:</th> <td id="when">...</td>
</tr>
<tr>
<th>订单状态:</th><td>未付款</td>
<th>收件地址</th> <td id="location">...</td>
</tr>
<tr>
<th>收货人姓名:</th><td>侯龙超</td>
<th>人姓名:</th> <td id="sender">...</td>
</tr>
<tr>
<th>货人地址</th><td>内蒙古科技大学</td>
<th>件人电话</th> <td id="phone">...</td>
</tr>
<tr>
<th>收货人电话</th><td>12345678901</td>
<th>备注</th> <td id="comment">...</td>
</tr>
</table>
</div>
<div class="col-sm-12">
<table class="table table-striped table-condensed">
<tr>
<th>书名</th>
<th>单价</th>
<th>数量</th>
<th>小计</th>
</tr>
<tr>
<td>书名</td>
<td>单价</td>
<td>数量</td>
<td>小计</td>
</tr>
<tr>
<td>书名</td>
<td>单价</td>
<td>数量</td>
<td>小计</td>
</tr>
<tr>
<td>书名</td>
<td>单价</td>
<td>数量</td>
<td>小计</td>
</tr>
<tr></tr>
</table>
<!--<div class="list-group">-->
<!--<div class="col-sm-12 list-group-item" >-->
<!--<div class="col-sm-4 line-center">-->
<!--书名-->
<!--</div>-->
<!--<div class="col-sm-3 line-center">单价</div>-->
<!--<div class="col-sm-2 line-center">数量 </div>-->
<!--<div class="col-sm-3 line-center">小计</div>-->
<!--</div>-->
<!--<div class="col-sm-12 list-group-item" >-->
<!--<div class="col-sm-4 line-center">-->
<!--书名-->
<!--</div>-->
<!--<div class="col-sm-3 line-center">单价</div>-->
<!--<div class="col-sm-2 line-center">数量 </div>-->
<!--<div class="col-sm-3 line-center">小计</div>-->
<!--</div>-->
<!--<div class="col-sm-12 list-group-item" >-->
<!--<div class="col-sm-4 line-center">-->
<!--书名-->
<!--</div>-->
<!--<div class="col-sm-3 line-center">单价</div>-->
<!--<div class="col-sm-2 line-center">数量 </div>-->
<!--<div class="col-sm-3 line-center">小计</div>-->
<!--</div>-->
<!--</div>-->
</div>
<!-- <div class="col-sm-12">-->
<!-- <table class="table table-striped table-condensed">-->
<!-- <tr>-->
<!-- <th>书名</th>-->
<!-- <th>单价</th>-->
<!-- <th>数量</th>-->
<!-- <th>小计</th>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>书名</td>-->
<!-- <td>单价</td>-->
<!-- <td>数量</td>-->
<!-- <td>小计</td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>书名</td>-->
<!-- <td>单价</td>-->
<!-- <td>数量</td>-->
<!-- <td>小计</td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>书名</td>-->
<!-- <td>单价</td>-->
<!-- <td>数量</td>-->
<!-- <td>小计</td>-->
<!-- </tr>-->
<!-- <tr></tr>-->
<!-- </table>-->
<!-- </div>-->
<div class="col-sm-12 ">
<table>
<tr>
<th> </th><th></th> <th>商品总数:</th><td>12</td> <th>订单总价:</th><td><span class="text-danger">123.0元</span></label></td>
<th></th>
<th></th>
<th></th>
<!-- <th>商品总数:</th><td>12</td>-->
<th>订单总价:</th><td><span id="price" class="text-danger">123.0元</span></label></td>
</tr>
</table>
</div>
</div>
<div></div>
<div class="col-sm-offset-7 col-sm-5" style="padding: 30px;">
<div class="col-sm-6 btn btn-success btn-block">继续购物</div>
<div class="col-sm-6 btn btn-success btn-block">提交订</div>
<!-- <div class="col-sm-6 btn btn-success btn-block">继续购物</div>-->
<div class="col-sm-6 btn btn-success btn-block" id="pick" style="display: none"></div>
</div>
</div>
<!--footer-->
<div class="navbar navbar-default navbar-static-bottom ">
版权声明区
</div>
<!--footer-->
<div class="navbar navbar-default navbar-static-bottom ">
class="p">< class="nt">p class="na">style="text-align: center">版权声明区</p>
</div>
</body>
</html>

+ 232
- 0
src/main/resources/static/PickedOrder.html Datei anzeigen

@ -0,0 +1,232 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<link rel="stylesheet" href="bootstrap-3.3.4/dist/css/bootstrap.min.css"/>
<link rel="stylesheet" href="Flat-UI-master/dist/css/flat-ui.min.css"/>
<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>
<style>
.row{
margin-left: 20px;
margin-right: 20px;;
}
.line-center{
line-height:50px;
text-align: center;
}
.row input{
width: 50px;
}
.list-group-item:hover{
background: #27ae60;
}
.list-group-item div:first-child:hover{
cursor: pointer;
}
</style>
<script>
function myClick(n){
location.href = "OrderInfo.html";
}
function btnClick(){
alert("btn");
return false;
}
</script>
</head>
<body>
<script>
$(function () {
var orders;
// 发一个请求获取全部订单
// 后面可以改成每次拿10个
$.ajax({
url:"/order/own",
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">
<div class="navbar-header">
<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>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="Index.html">首页</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li><a href="Order.html">我的订单</a></li>
<li class="active"><a href="PickedOrder.html">我的接单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<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>
</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-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>
<!-- 每个 接单 的信息 -->
<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" >
<p style="text-align: center">点击显示更多</p>
</div>
</div>
</div>
<!--footer-->
<div class="navbar navbar-default navbar-static-bottom">
<p style="text-align: center">版权声明区</p>
</div>
</body>
</html>

+ 2
- 1
src/main/resources/static/Register.html Datei anzeigen

@ -106,9 +106,10 @@
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="PickedOrder.html">我的接单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">

+ 4
- 3
src/main/resources/static/UserInfo.html Datei anzeigen

@ -120,10 +120,11 @@
</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="Index.html">首页</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="PickedOrder.html">我的接单</a></li>
<li class="active"><a href="UserInfo.html">个人中心</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">

Laden…
Abbrechen
Speichern