本文主要是介绍网上书城的老板客户的后台管理功能,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
老板客户的后台管理功能界面
- 前言
- 老板客户共同所需要用的的实体类,dao包,web包,mvc.xml配置
- 实体类(老板客户)
- dao包
- web包
- mvc.xml配置
- 界面代码所需的js样式
- 老板的后台管理功能界面代码及效果
- 书籍管理
- 书籍新增
- 未上架书籍
- 已上架书籍
- 已下架书籍
- 订单管理
- 未发货
- 已发货
- 已签收
- 订单项
- 客户的后台管理功能界面代码及效果
- 订单管理
- 未发货
- 已发货
- 已签收
前言
上次我们只写了登录注册,还有登录之后的老板、客户的后台管理界面,没有写其中的功能,今天就把后台中的功能完善
在访问项目的时候出现org.apache.catalina.core.ApplicationContextFacade@629b9065 报错是因为eclipse搭建环境问题请点击解决方法,推荐去了解一下
解决方法
老板客户共同所需要用的的实体类,dao包,web包,mvc.xml配置
实体类(老板客户)
book(之前写了),order,orderItem
订单表 order
package com.tang.entity;import java.util.Date;import com.fasterxml.jackson.annotation.JsonFormat;public class Order {private long id;private long uid;@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")private Date orderTime;private String consignee;//收货人private String phone;private String postalcode;//收货人邮编private String address;private int sendType;//发货方式:1 平邮 2 快递@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")private Date sendTime;private float orderPrice;private int orderState;//"订单状态:1 未发货 2 已发货 3 已签收 4 已撤单 默认值1public long getId() {return id;}public void setId(long id) {this.id = id;}public long getUid() {return uid;}public void setUid(long uid) {this.uid = uid;}public Date getOrderTime() {return orderTime;}public void setOrderTime(Date orderTime) {this.orderTime = orderTime;}public String getConsignee() {return consignee;}public void setConsignee(String consignee) {this.consignee = consignee;}public String getPhone() {return phone;}public void setPhone(String phone) {this.phone = phone;}public String getPostalcode() {return postalcode;}public void setPostalcode(String postalcode) {this.postalcode = postalcode;}public String getAddress() {return address;}public void setAddress(String address) {this.address = address;}public int getSendType() {return sendType;}public void setSendType(int sendType) {this.sendType = sendType;}public Date getSendTime() {return sendTime;}public void setSendTime(Date sendTime) {this.sendTime = sendTime;}public float getOrderPrice() {return orderPrice;}public void setOrderPrice(float orderPrice) {this.orderPrice = orderPrice;}public int getOrderState() {return orderState;}public void setOrderState(int orderState) {this.orderState = orderState;}@Overridepublic String toString() {return "Order [id=" + id + ", uid=" + uid + ", orderTime=" + orderTime + ", consignee=" + consignee + ", phone="+ phone + ", postalcode=" + postalcode + ", address=" + address + ", sendType=" + sendType+ ", sendTime=" + sendTime + ", orderPrice=" + orderPrice + ", orderState=" + orderState + "]";}public Order(long id, long uid, Date orderTime, String consignee, String phone, String postalcode, String address,int sendType, Date sendTime, float orderPrice, int orderState) {super();this.id = id;this.uid = uid;this.orderTime = orderTime;this.consignee = consignee;this.phone = phone;this.postalcode = postalcode;this.address = address;this.sendType = sendType;this.sendTime = sendTime;this.orderPrice = orderPrice;this.orderState = orderState;}public Order() {super();}}
订单项表 orderItem
package com.tang.entity;public class OrderItem {private long id;private long oid;//订单ID:外键private String bid;//书籍ID:外键private int quantity;public long getId() {return id;}public void setId(long id) {this.id = id;}public long getOid() {return oid;}public void setOid(long oid) {this.oid = oid;}public String getBid() {return bid;}public void setBid(String bid) {this.bid = bid;}public int getQuantity() {return quantity;}public void setQuantity(int quantity) {this.quantity = quantity;}@Overridepublic String toString() {return "OrderItem [id=" + id + ", oid=" + oid + ", bid=" + bid + ", quantity=" + quantity + "]";}public OrderItem(long id, long oid, String bid, int quantity) {super();this.id = id;this.oid = oid;this.bid = bid;this.quantity = quantity;}public OrderItem() {super();}}
dao包
BookDao(上次只写了查询跟新增的方法,这次完善bookDao)
package com.tang.dao;import java.util.List;import com.tang.entity.Book;
import com.tang.util.BaseDao;
import com.tang.util.PageBean;
import com.tang.util.StringUtils;public class BookDao extends BaseDao<Book>{//查询public List<Book> list(Book book, PageBean pageBean) throws Exception {String sql = "select * from t_easyui_book where true ";String name = book.getName();long cid = book.getCid();int state = book.getState();if (StringUtils.isNotBlank(name)) {sql += " and name like '%" + name + "%'";}if (state != 0) {sql += " and state = " + state;}if(cid != 0){sql += " and cid = " + cid;}return super.executeQuery(sql, pageBean, Book.class);}// 新增public int add(Book book) throws Exception {String sql = "insert into t_easyui_book(name,pinyin,cid,author,price,image,publishing,description,state,deployTime,sales) " +"values(?,?,?,?,?,?,?,?,?,now(),?)";return super.executeUpdate(sql, book, new String[]{"name", "pinyin", "cid", "author", "price", "image", "publishing", "description", "state", "sales"});}// 新书上架public List<Book> newsBook(Book book, PageBean pageBean) throws Exception {String sql = "select * from t_easyui_book where state = 2 order by deployTime desc";return super.executeQuery(sql, pageBean, Book.class);}// 热销书籍public List<Book> hotBook(Book book, PageBean pageBean) throws Exception {String sql = "select * from t_easyui_book where state = 2 order by sales desc";return super.executeQuery(sql, pageBean, Book.class);}// 修改public int edit(Book book) throws Exception {String sql = "update t_easyui_book set name = ?,pinyin=?,cid=?" +",author=?,price=?,image=?,publishing=?,description=?,state=?" +",sales=? where id = ?";return super.executeUpdate(sql, book, new String[]{"name", "pinyin", "cid", "author", "price", "image", "publishing", "description", "state", "sales", "id"});}// 改变书籍上架下架状态public int editState(Book book) throws Exception {String sql = "update t_easyui_book set state = ? where id = ?";return super.executeUpdate(sql, book, new String[]{"state", "id"});}// 上传图片public int editImgUrl(Book book) throws Exception {String sql = "update t_easyui_book set image=? where id = ?";return super.executeUpdate(sql, book, new String[]{"image", "id"});}}
OrderDao( 订单列表, 最新产生的订单,新增订单 撤单、、验收,发货)
package com.tang.dao;import java.util.List;import com.tang.entity.Order;
import com.tang.util.BaseDao;
import com.tang.util.PageBean;public class OrderDao extends BaseDao<Order>{// 订单列表public List<Order> list(Order order, PageBean pageBean) throws Exception {String sql = "select * from t_easyui_order where true ";long id = order.getId();int orderState = order.getOrderState();if (id != 0) {sql += " and id =" + id;}if (orderState != 0){sql += " and orderState = "+orderState;}return super.executeQuery(sql, pageBean, Order.class);}// 最新产生的订单public Order newest() throws Exception {String sql = "select * from t_easyui_order order by id desc ";return super.executeQuery(sql, null, Order.class).get(0);}// 新增订单public int add(Order order) throws Exception {String sql = "insert into t_easyui_order(`uid`,`orderTime`,`consignee`,`phone`,`postalcode`,`address`,`sendType`,`orderPrice`,`orderState`) " +"values(?,now(),?,?,?,?,?,?,?)";return super.executeUpdate(sql, order, new String[]{"uid","consignee","phone","postalcode","address","sendType","orderPrice","orderState"});}// 撤单、、验收public int cancelAndReceive(Order order) throws Exception {String sql = "update t_easyui_order set orderState=? where id = ?";return super.executeUpdate(sql, order, new String[]{"orderState","id"});}// 发货public int sendGoods(Order order) throws Exception {String sql = "update t_easyui_order set orderState=?,sendTime=now() where id = ?";return super.executeUpdate(sql, order, new String[]{"orderState","id"});}}
OrderItemDao( 新增订单项, 订单项查询)
package com.tang.dao;import java.util.List;import com.tang.entity.OrderItem;
import com.tang.util.BaseDao;
import com.tang.util.PageBean;public class OrderItemDao extends BaseDao<OrderItem>{// 新增订单项public int add(OrderItem orderItem) throws Exception {String sql = "insert into t_easyui_orderitem(oid,bid,quantity) values(?,?,?)";return executeUpdate(sql,orderItem,new String[]{"oid","bid","quantity"});}// 订单项查询public List<OrderItem> list(OrderItem orderItem, PageBean pageBean) throws Exception {String sql = "select * from t_easyui_orderitem where true ";long oid = orderItem.getOid();if (oid != 0){sql += " and oid ="+oid;}return super.executeQuery(sql,pageBean,OrderItem.class);}}
web包
BookAction
package com.tang.web;import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;import com.tang.dao.BookDao;
import com.tang.entity.Book;
import com.tang.util.DateUtil;
import com.tang.util.EasyuiResult;
import com.tang.util.PageBean;
import com.tang.util.PropertiesUtil;
import com.tang.util.ResponseUtil;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriven;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.util.Iterator;
import java.util.List;
import java.util.Queue;public class BookAction extends ActionSupport implements ModelDriven<Book> {private Book book = new Book();private BookDao bookDao = new BookDao();// 书籍名称搜索书籍结果页public String findByName(HttpServletRequest request, HttpServletResponse response) {PageBean pageBean = new PageBean();pageBean.setRequest(request);try {List<Book> list = this.bookDao.list(book, pageBean);request.setAttribute("books", list);request.setAttribute("pageBean", pageBean);} catch (Exception e) {e.printStackTrace();}return "findBook";}/* // 书籍类别搜索书籍结果页public String findByType(HttpServletRequest request, HttpServletResponse response) {PageBean pageBean = new PageBean();pageBean.setRequest(request);try {List<Book> list = this.bookDao.list(book, pageBean);request.setAttribute("books", list);request.setAttribute("pageBean", pageBean);} catch (Exception e) {e.printStackTrace();}return "findBook";}// 最新书籍public String news(HttpServletRequest request, HttpServletResponse response) {PageBean pageBean = new PageBean();pageBean.setRequest(request);try {List<Book> list = this.bookDao.newsBook(book, pageBean);ResponseUtil.writeJson(response, EasyuiResult.ok(pageBean.getTotal(), list));} catch (Exception e) {e.printStackTrace();}return null;}// 最热书籍public String hot(HttpServletRequest request, HttpServletResponse response) {PageBean pageBean = new PageBean();pageBean.setRequest(request);try {List<Book> list = this.bookDao.hotBook(book, pageBean);ResponseUtil.writeJson(response, EasyuiResult.ok(pageBean.getTotal(), list));} catch (Exception e) {e.printStackTrace();}return null;}// 加载书籍列表public String list(HttpServletRequest request, HttpServletResponse response) {PageBean pageBean = new PageBean();pageBean.setRequest(request);try {List<Book> list = this.bookDao.list(book, pageBean);ResponseUtil.writeJson(response, EasyuiResult.ok(pageBean.getTotal(), list));} catch (Exception e) {e.printStackTrace();}return null;}// 上架public String shangjia(HttpServletRequest request, HttpServletResponse response) {try {int res = this.bookDao.editState(book);ResponseUtil.writeJson(response, res);} catch (Exception e) {e.printStackTrace();}return null;}// 下架public String xiajia(HttpServletRequest request, HttpServletResponse response) {try {int res = this.bookDao.editState(book);ResponseUtil.writeJson(response, res);} catch (Exception e) {e.printStackTrace();}return null;}public String edit(HttpServletRequest request, HttpServletResponse response) {try {int res = this.bookDao.edit(book);ResponseUtil.writeJson(response, res);} catch (Exception e) {e.printStackTrace();}return null;}// 新增public String add(HttpServletRequest request, HttpServletResponse response) {try {int res = this.bookDao.add(book);ResponseUtil.writeJson(response, res);} catch (Exception e) {e.printStackTrace();}return null;}// 上传public String upload(HttpServletRequest request, HttpServletResponse response) {try {FileItemFactory factory = new DiskFileItemFactory();ServletFileUpload upload = new ServletFileUpload(factory);List<FileItem> items = upload.parseRequest(request);Iterator<FileItem> itr = items.iterator();HttpSession session = request.getSession();while (itr.hasNext()) {FileItem item = (FileItem) itr.next();if (item.isFormField()) {System.out.println("普通字段处理");book.setId(Long.valueOf(request.getParameter("id")));} else if (!"".equals(item.getName())) {String imageName = DateUtil.getCurrentDateStr();// 存入数据的的数据,以及浏览器访问图片的映射地址String serverDir = PropertiesUtil.getValue("serverDir");// 图片真实的存放位置String diskDir = PropertiesUtil.getValue("diskDir");// 图片的后缀名String subfix = item.getName().split("\\.")[1];book.setImage(serverDir + imageName + "." + subfix);item.write(new File(diskDir + imageName + "." + subfix));int res = this.bookDao.editImgUrl(book);ResponseUtil.writeJson(response, res);}}} catch (Exception e) {e.printStackTrace();}return null;}
*/@Overridepublic Book getModel() {return book;}
}
OrderAction
package com.tang.web;import java.util.List;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import com.tang.dao.OrderDao;
import com.tang.entity.Order;
import com.tang.util.EasyuiResult;
import com.tang.util.PageBean;
import com.tang.util.ResponseUtil;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriven;public class OrderAction extends ActionSupport implements ModelDriven<Order>{private Order order = new Order();private OrderDao orderDao = new OrderDao();// 订单列表public String list(HttpServletRequest request, HttpServletResponse response) {PageBean pageBean = new PageBean();pageBean.setRequest(request);try {List<Order> list = this.orderDao.list(order, pageBean);ResponseUtil.writeJson(response, EasyuiResult.ok(pageBean.getTotal(), list));} catch (Exception e) {e.printStackTrace();}return null;}// 撤单和签收public String cancelAndReceive(HttpServletRequest request, HttpServletResponse response) {try {int res = this.orderDao.cancelAndReceive(order);ResponseUtil.writeJson(response, res);} catch (Exception e) {e.printStackTrace();}return null;}// 发货public String sendGoods(HttpServletRequest request, HttpServletResponse response) {try {int res = this.orderDao.sendGoods(order);ResponseUtil.writeJson(response, res);} catch (Exception e) {e.printStackTrace();}return null;}@Overridepublic Order getModel() {return order;}}
OrderItemAction
package com.tang.web;import java.util.List;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import com.tang.dao.OrderItemDao;
import com.tang.entity.Order;
import com.tang.entity.OrderItem;
import com.tang.util.EasyuiResult;
import com.tang.util.PageBean;
import com.tang.util.ResponseUtil;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriven;public class OrderItemAction extends ActionSupport implements ModelDriven<OrderItem>{private OrderItem orderItem = new OrderItem();private OrderItemDao orderItemDao = new OrderItemDao();public String list(HttpServletRequest request, HttpServletResponse response) {PageBean pageBean = new PageBean();pageBean.setRequest(request);try {List<OrderItem> list = this.orderItemDao.list(orderItem, pageBean);ResponseUtil.writeJson(response, EasyuiResult.ok(pageBean.getTotal(),list));} catch (Exception e) {e.printStackTrace();}return null;}@Overridepublic OrderItem getModel() {return orderItem;}}
mvc.xml配置
mvc.xml
<?xml version="1.0" encoding="UTF-8"?>
<config><!--用户相关业务--><action path="/user" type="com.tang.web.UserAction"><forward name="login" path="/login.jsp" redirect=""/><forward name="register" path="/register.jsp" redirect=""/><forward name="mainTemp" path="/bg/mainTemp.jsp" redirect="false"/></action><!--权限相关业务--><action path="/permission" type="com.tang.web.PermissionAction"></action><!--书籍相关业务--><action path="/book" type="com.tang.web.BookAction"><forward name="findBook" path="/fg/findBook.jsp" redirect="false"/></action><!--书籍类别相关业务--><action path="/category" type="com.tang.web.CategoryAction"></action><!--订单功能--><action path="/order" type="com.tang.web.OrderAction"></action><!--订单项功能--><action path="/orderItem" type="com.tang.web.OrderItemAction"></action></config>
界面代码所需的js样式
main.js
$(function () {var ctx = $("#ctx").val();$('#bookMenus').tree({url:ctx+'/permission.action?methodName=menuTree',onClick: function(node){// alert(node.text); // 在用户点击的时候提示// alert($('#bookTabs').tabs('exists',node.text));if($('#bookTabs').tabs('exists',node.text)){$('#bookTabs').tabs('select',node.text)}else {var url = node.attributes.self.url;if(url){var content = '<iframe width="100%" height="100%" src="'+ctx+url+'"></iframe>>';$('#bookTabs').tabs('add',{title:node.text,content:content,closable:true,tools:[{// iconCls:'icon-mini-refresh',// handler:function(){// alert('refresh');// }}]});}}}});});
老板的后台管理功能界面代码及效果
书籍管理
书籍新增
addBook.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css"><script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script><script type="text/javascript"src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script><script src="${pageContext.request.contextPath}/static/js/main.js"></script>
<title>书籍新增</title>
</head>
<body><div style="margin:20px 0;"></div>
<div class="easyui-panel" title="新增书籍" style="width:100%;padding:30px 60px;"><form id="ff" action="${pageContext.request.contextPath}/book.action?methodName=add" method="post"><div style="margin-bottom:20px"><input class="easyui-textbox" name="name" style="width:100%" data-options="label:'书名:',required:true"></div><div style="margin-bottom:20px"><input id="cid" name="cid" value="" label="类别" ></div><div style="margin-bottom:20px"><input class="easyui-textbox" name="author" style="width:100%" data-options="label:'作者:',required:true"></div><div style="margin-bottom:20px"><input class="easyui-textbox" name="price" style="width:100%"data-options="label:'价格:',required:true"></div><div style="margin-bottom:20px"><input class="easyui-textbox" name="publishing" style="width:100%"data-options="label:'出版社:',required:true"></div><div style="margin-bottom:20px"><input class="easyui-textbox" name="description" style="width:100%;height:60px"data-options="label:'简介:',required:true"></div><%--默认未上架--%><input type="hidden" name="state" value="1"><%--默认起始销量为0--%><input type="hidden" name="sales" value="0"></form><div style="text-align:center;padding:5px 0"><a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">Submit</a><a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:80px">Clear</a></div>
</div>
<script>$(function () {$('#cid').combobox({url:'${pageContext.request.contextPath}/category.action?methodName=list',valueField:'id',textField:'name'});});function submitForm() {$('#ff').form('submit',{success:function (param) {$('#ff').form('clear');}});}function clearForm() {$('#ff').form('clear');}
</script></body>
</html>
效果图
未上架书籍
listBook1.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>未上架书籍</title>
<link rel="stylesheet" type="text/css"href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css"><script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script><script type="text/javascript"src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script><script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body><!-- 未上架书籍界面 --><table id="dg" style="style=" width:400px;height:200px;"></table><div id="tb"><input class="easyui-textbox" id="name" name="name" style="width:20%;padding-left: 10px" data-options="label:'书名:',required:true"><a id="btn-search" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">搜索</a></div><!-- 弹出框提交表单所用 --><div id="dd" class="easyui-dialog" title="编辑窗体" style="width:600px;height:450px;"data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true,buttons:'#bb'"><form id="ff" action="${pageContext.request.contextPath}/book.action?methodName=edit" method="post"><div style="margin-bottom:20px"><input class="easyui-textbox" name="name" style="width:100%" data-options="label:'书名:',required:true"></div><div style="margin-bottom:20px"><input id="cid" name="cid" value="" label="类别" ></div><div style="margin-bottom:20px"><input class="easyui-textbox" name="author" style="width:100%" data-options="label:'作者:',required:true"></div><div style="margin-bottom:20px"><input class="easyui-textbox" name="price" style="width:100%"data-options="label:'价格:',required:true"></div><div style="margin-bottom:20px"><input class="easyui-textbox" name="publishing" style="width:100%"data-options="label:'出版社:',required:true"></div><div style="margin-bottom:20px"><input class="easyui-textbox" name="description" style="width:100%;height:60px"data-options="label:'简介:',required:true"></div><%--默认未上架--%><input type="hidden" name="state" value=""><%--默认起始销量为0--%><input type="hidden" name="sales" value=""><input type="hidden" name="id" value=""><input type="hidden" name="image" value=""></form><div style="text-align:center;padding:5px 0"><a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">Submit</a><a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:80px">Clear</a></div></div><!-- 图片上传 --><div id="dd2" class="easyui-dialog" title="书籍图标上传" style="width:600px;height:450px;"data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true,buttons:'#bb'"><form id="ff2" action="" method="post" enctype="multipart/form-data"><div style="margin-bottom:20px"><input type="file" name="file"></div></form><div style="text-align:center;padding:5px 0"><a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm2()" style="width:80px">Submit</a><a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:80px">Clear</a></div></div></body><script>function shangjia() {$.messager.confirm('确认','您确认想要上架此书籍吗?',function(r){if (r){var row = $('#dg').datagrid('getSelected');if (row){$.ajax({url:'${pageContext.request.contextPath}/book.action?methodName=shangjia&state=2&id=' + row.id,success:function (data) {}})} }});}//修改function edit() {$('#cid').combobox({url:'${pageContext.request.contextPath}/category.action?methodName=list',valueField:'id',textField:'name'});var row = $('#dg').datagrid('getSelected');if (row) {$('#ff').form('load', row);$('#dd').dialog('open');}}//提交编辑信息的表单function submitForm() {$('#ff').form('submit',{success: function (param) {$('#dd').dialog('close');$('#dg').datagrid('reload');$('#ff').form('clear');}});}function clearForm() {$('#ff').form('clear');}//图片上传function upload() {$('#dd2').dialog('open');}//图片上传表单提交function submitForm2() {var row = $('#dg').datagrid('getSelected');console.log(row);// if (row) {// $('#ff2').attr("action", $('#ff2').attr("action") + "&id=" + row.id);// }$('#ff2').form('submit', {url: '${pageContext.request.contextPath}/book.action?methodName=upload&id=' + row.id,success: function (param) {$('#dd2').dialog('close');$('#dg').datagrid('reload');$('#ff2').form('clear');}})}$(function () {$("#btn-search").click(function () {$('#dg').datagrid('load', {name: $("#name").val()});});$('#dg').datagrid({url: '${pageContext.request.contextPath}/book.action?methodName=list&&state=1',fit: true,fitColumns: true,pagination: true,singleSelect: true,toolbar:'#tb',columns: [[// {field:'id',title:'id',width:100},{field: 'id', title: '书籍名称', hidden: true},{field: 'name', title: '书籍名称', width: 50},{field: 'pinyin', title: '拼音', width: 50},{field: 'cid', title: '书籍类别', width: 50, formatter: function (value, row, index) {if (row.cid == 1) {return "文艺";} else if (row.cid == 2) {return "小说";} else if (row.cid == 3) {return "青春";} else {return value;}}},{field: 'author', title: '作者', width: 50},// {field:'price',title:'价格',width:100},{field: 'image', title: '图片路径', width: 100, formatter: function (value, row, index) {return '<img style="width:80px;height: 60px;" src="' + row.image + '"></img>';}},{field: 'publishing', title: '出版社', width: 50},// {field:'desc',title:'描述',width:100},// {field:'state',title:'书籍状态',width:100},{field: 'sales', title: '销量', width: 50},{field: 'deployTime', title: '上架时间', width: 50, align: 'right'},{field: 'xxxx', title: '操作', width: 100, formatter: function (value, row, index) {return '<a href="#" onclick="upload()">图片上传</a> ' +'<a href="#" onclick="shangjia()">上架</a> ' +'<a href="#" onclick="edit();">修改</a>';}}]]});})</script>
</html>
效果图
已上架书籍
listBook2.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>已上架书籍界面</title>
<link rel="stylesheet" type="text/css"href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css"><script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script><script type="text/javascript"src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script><script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body><!-- 已上架书籍界面 --><table id="dg" style="style=" width:400px;height:200px;"></table><script>function xiajia() {$.messager.confirm('确认','您确认想要下架此书籍吗?',function(r){if (r){var row = $('#dg').datagrid('getSelected');if (row){$.ajax({url:'${pageContext.request.contextPath}/book.action?methodName=shangjia&state=3&id=' + row.id,success:function (data) {}})}}});}$(function () {$('#dg').datagrid({url: '${pageContext.request.contextPath}/book.action?methodName=list&&state=2',fit: true,fitColumns: true,pagination: true,singleSelect: true,columns: [[// {field:'id',title:'id',width:100},{field: 'id', title: '书籍名称', hidden: true},{field: 'name', title: '书籍名称', width: 50},{field: 'pinyin', title: '拼音', width: 50},{field: 'cid', title: '书籍类别', width: 50, formatter: function (value, row, index) {if (row.cid == 1) {return "文艺";} else if (row.cid == 2) {return "小说";} else if (row.cid == 3) {return "青春";} else {return value;}}},{field: 'author', title: '作者', width: 50},// {field:'price',title:'价格',width:100},{field: 'image', title: '图片路径', width: 100, formatter: function (value, row, index) {return '<img style="width:80px;height: 60px;" src="' + row.image + '"></img>';}},{field: 'publishing', title: '出版社', width: 50},// {field:'desc',title:'描述',width:100},// {field:'state',title:'书籍状态',width:100},{field: 'sales', title: '销量', width: 50},{field: 'deployTime', title: '上架时间', width: 50, align: 'right'},{field: 'xxxx', title: '操作', width: 100, formatter: function (value, row, index) {return '<a href="#" onclick="xiajia();">下架</a>';}}]]});})</script>
</body>
</html>
效果图
已下架书籍
listBook3.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>已下架书籍界面</title>
<link rel="stylesheet" type="text/css"href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css"><script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script><script type="text/javascript"src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script><script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body>
<table id="dg" style="style=" width:400px;height:200px;"></table><script>$(function () {$('#dg').datagrid({url: '${pageContext.request.contextPath}/book.action?methodName=list&&state=3',fit: true,fitColumns: true,pagination: true,singleSelect: true,columns: [[// {field:'id',title:'id',width:100},{field: 'id', title: '书籍名称', hidden: true},{field: 'name', title: '书籍名称', width: 50},{field: 'pinyin', title: '拼音', width: 50},{field: 'cid', title: '书籍类别', width: 50, formatter: function (value, row, index) {if (row.cid == 1) {return "文艺";} else if (row.cid == 2) {return "小说";} else if (row.cid == 3) {return "青春";} else {return value;}}},{field: 'author', title: '作者', width: 50},// {field:'price',title:'价格',width:100},{field: 'image', title: '图片路径', width: 100, formatter: function (value, row, index) {return '<img style="width:80px;height: 60px;" src="' + row.image + '"></img>';}},{field: 'publishing', title: '出版社', width: 50},// {field:'desc',title:'描述',width:100},// {field:'state',title:'书籍状态',width:100},{field: 'sales', title: '销量', width: 50},{field: 'deployTime', title: '上架时间', width: 50, align: 'right'}]]});})
</script>
</body>
</html>
效果图
订单管理
未发货
listOrder1.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>未发货订单界面</title>
<link rel="stylesheet" type="text/css"href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css"><script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script><script type="text/javascript"src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script><script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body>
<table id="dg" style="style=" width:400px;height:200px;"></table><script>$(function () {$('#dg').datagrid({url: '${pageContext.request.contextPath}/order.action?methodName=list&&orderState=1',fit: true,fitColumns: true,pagination: true,singleSelect: true,columns: [[// {field:'id',title:'id',width:100},{field: 'id', title: '书籍名称', hidden: true},{field: 'postalcode', title: '收货人邮编', hidden: true},{field: 'uid', title: '用户', width: 50},{field: 'consignee', title: '收货人', width: 50},{field: 'phone', title: '手机号', width: 50},{field: 'address', title: '收获人地址', width: 50},{field: 'orderPrice', title: '价格', width: 50},{field: 'sendTime', title: '发货时间', width: 50},{field: 'orderTime', title: '订单时间', width: 50},{field: 'sendType', title: '发送方式', width: 50, formatter: function (value, row, index) {if (row.sendType == 1) {return "平邮";} else if (row.sendType == 2) {return "快递";}}},{field: 'orderState', title: '订单状态', width: 100, formatter: function (value, row, index) {if (row.orderState == 1) {return "未发货";} else if (row.orderState == 2) {return "已发货";} else if (row.orderState == 3) {return "已签收";} else if (row.orderState == 4) {return "已撤单";}}},{field: 'xxxx', title: '操作', width: 100, formatter: function (value, row, index) {return '<a href="#" onclick="sendOrder();">发货</a>';}}]]});})function sendOrder() {var row = $('#dg').datagrid('getSelected');var id=0;if (row) {id = row.id;}else {alert("请勾选数据...");return;}$.messager.confirm('确认', '您确认想要发货吗?', function (r) {if (r) {$.ajax({url: '${pageContext.request.contextPath}/order.action?methodName=cancelAndReceive&&orderState=2&id='+id,success: function (data) {$('#dg').datagrid('reload');}});}})}
</script>
</body>
</html>
效果图
已发货
listOrder2.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>已发货订单界面</title><link rel="stylesheet" type="text/css"href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css"><script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script><script type="text/javascript"src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script><script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body>
<table id="dg" style="style=" width:400px;height:200px;"></table><script>$(function () {$('#dg').datagrid({url: '${pageContext.request.contextPath}/order.action?methodName=list&&orderState=2',fit: true,fitColumns: true,pagination: true,singleSelect: true,columns: [[// {field:'id',title:'id',width:100},{field: 'id', title: '书籍名称', hidden: true},{field: 'postalcode', title: '收货人邮编', hidden: true},{field: 'uid', title: '用户', width: 50},{field: 'consignee', title: '收货人', width: 50},{field: 'phone', title: '手机号', width: 50},{field: 'address', title: '收获人地址', width: 50},{field: 'orderPrice', title: '价格', width: 50},{field: 'sendTime', title: '发货时间', width: 50},{field: 'orderTime', title: '订单时间', width: 50},{field: 'sendType', title: '发送方式', width: 50, formatter: function (value, row, index) {if (row.sendType == 1) {return "平邮";} else if (row.sendType == 2) {return "快递";}}},{field: 'orderState', title: '订单状态', width: 100, formatter: function (value, row, index) {if (row.orderState == 1) {return "未发货";} else if (row.orderState == 2) {return "已发货";} else if (row.orderState == 3) {return "已签收";} else if (row.orderState == 4) {return "已撤单";}}}]]});})</script>
</body>
</html>
效果图
已签收
listOrder3.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商家订单页面</title><link rel="stylesheet" type="text/css"href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css"><script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script><script type="text/javascript"src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script><script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body><table id="dg" style="style=" width:400px;height:200px;"></table><script>$(function () {$('#dg').datagrid({url: '${pageContext.request.contextPath}/order.action?methodName=list&&orderState=3',fit: true,fitColumns: true,pagination: true,singleSelect: true,columns: [[// {field:'id',title:'id',width:100},{field: 'id', title: '书籍名称', hidden: true},{field: 'postalcode', title: '收货人邮编', hidden: true},{field: 'uid', title: '用户', width: 50},{field: 'consignee', title: '收货人', width: 50},{field: 'phone', title: '手机号', width: 50},{field: 'address', title: '收获人地址', width: 50},{field: 'orderPrice', title: '价格', width: 50},{field: 'sendTime', title: '发货时间', width: 50},{field: 'orderTime', title: '订单时间', width: 50},{field: 'sendType', title: '发送方式', width: 50, formatter: function (value, row, index) {if (row.sendType == 1) {return "平邮";} else if (row.sendType == 2) {return "快递";}}},{field: 'orderState', title: '订单状态', width: 100, formatter: function (value, row, index) {if (row.orderState == 1) {return "未发货";} else if (row.orderState == 2) {return "已发货";} else if (row.orderState == 3) {return "已签收";} else if (row.orderState == 4) {return "已撤单";}}}]]});})</script>
</body>
</html>
效果图
订单项
listOrderItem.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商家订单页面</title><link rel="stylesheet" type="text/css"href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css"><script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script><script type="text/javascript"src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script><script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body><table id="dg" style="style=" width:400px;height:200px;"></table><div id="tb"><input class="easyui-textbox" id="oid" name="oid" style="width:20%;padding-left: 10px" data-options="label:'订单号:',required:true"><a id="btn-search" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">搜索</a></div><script>$(function () {$("#btn-search").click(function () {$('#dg').datagrid('load', {oid: $("#oid").val()});});$('#dg').datagrid({url: '${pageContext.request.contextPath}/orderItem.action?methodName=list',fit: true,fitColumns: true,pagination: true,singleSelect: true,toolbar:'#tb',columns: [[// {field:'id',title:'id',width:100},{field: 'id', title: '订单项流水号', hidden: true},{field: 'oid', title: '订单号', width: 50},{field: 'bid', title: '书籍名称', width: 50},{field: 'quantity', title: '数量', width: 50}]]});})</script>
</body>
</html>
效果图
客户的后台管理功能界面代码及效果
订单管理
未发货
listMyOrder1.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商家订单页面</title><link rel="stylesheet" type="text/css"href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css"><script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script><script type="text/javascript"src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script><script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body><table id="dg" style="style=" width:400px;height:200px;"></table><script>$(function () {$('#dg').datagrid({url: '${pageContext.request.contextPath}/order.action?methodName=list&&orderState=1',fit: true,fitColumns: true,pagination: true,singleSelect: true,columns: [[// {field:'id',title:'id',width:100},{field: 'id', title: '书籍名称', hidden: true},{field: 'postalcode', title: '收货人邮编', hidden: true},{field: 'uid', title: '用户', width: 50},{field: 'consignee', title: '收货人', width: 50},{field: 'phone', title: '手机号', width: 50},{field: 'address', title: '收获人地址', width: 50},{field: 'orderPrice', title: '价格', width: 50},{field: 'sendTime', title: '发货时间', width: 50},{field: 'orderTime', title: '订单时间', width: 50},{field: 'sendType', title: '发送方式', width: 50, formatter: function (value, row, index) {if (row.sendType == 1) {return "平邮";} else if (row.sendType == 2) {return "快递";}}},{field: 'orderState', title: '订单状态', width: 100, formatter: function (value, row, index) {if (row.orderState == 1) {return "未发货";} else if (row.orderState == 2) {return "已发货";} else if (row.orderState == 3) {return "已签收";} else if (row.orderState == 4) {return "已撤单";}}},{field: 'xxxx', title: '操作', width: 100, formatter: function (value, row, index) {return '<a href="#" onclick="cancel();">撤单</a>';}}]]});})function cancel() {var row = $('#dg').datagrid('getSelected');var id=0;if (row) {id = row.id;}else {alert("请勾选数据...");return;}$.messager.confirm('确认', '您确认想要撤单吗?', function (r) {if (r) {$.ajax({url: '${pageContext.request.contextPath}/order.action?methodName=cancelAndReceive&&orderState=4&id='+id,success: function (data) {$('#dg').datagrid('reload');}});}})}</script>
</body>
</html>
效果图
已发货
listMyOrder2.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商家订单页面</title><link rel="stylesheet" type="text/css"href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css"><script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script><script type="text/javascript"src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script><script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body><table id="dg" style="style=" width:400px;height:200px;"></table><script>$(function () {$('#dg').datagrid({url: '${pageContext.request.contextPath}/order.action?methodName=list&&orderState=2',fit: true,fitColumns: true,pagination: true,singleSelect: true,columns: [[// {field:'id',title:'id',width:100},{field: 'id', title: '书籍名称', hidden: true},{field: 'postalcode', title: '收货人邮编', hidden: true},{field: 'uid', title: '用户', width: 50},{field: 'consignee', title: '收货人', width: 50},{field: 'phone', title: '手机号', width: 50},{field: 'address', title: '收获人地址', width: 50},{field: 'orderPrice', title: '价格', width: 50},{field: 'sendTime', title: '发货时间', width: 50},{field: 'orderTime', title: '订单时间', width: 50},{field: 'sendType', title: '发送方式', width: 50, formatter: function (value, row, index) {if (row.sendType == 1) {return "平邮";} else if (row.sendType == 2) {return "快递";}}},{field: 'orderState', title: '订单状态', width: 100, formatter: function (value, row, index) {if (row.orderState == 1) {return "未发货";} else if (row.orderState == 2) {return "已发货";} else if (row.orderState == 3) {return "已签收";} else if (row.orderState == 4) {return "已撤单";}}},{field: 'xxxx', title: '操作', width: 100, formatter: function (value, row, index) {return '<a href="#" onclick="receive();">签收</a>';}}]]});})function receive() {var row = $('#dg').datagrid('getSelected');var id=0;if (row) {id = row.id;}else {alert("请勾选数据...");return;}$.messager.confirm('确认', '请确认签收?', function (r) {if (r) {$.ajax({url: '${pageContext.request.contextPath}/order.action?methodName=cancelAndReceive&&orderState=3&id='+id,success: function (data) {$('#dg').datagrid('reload');}});}})}</script>
</body>
</html>
效果图
已签收
listMyOrder3.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>会员订单页面</title><link rel="stylesheet" type="text/css"href="${pageContext.request.contextPath}/static/js/easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/js/easyui/themes/icon.css"><script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script><script type="text/javascript"src="${pageContext.request.contextPath}/static/js/easyui/jquery.easyui.min.js"></script><script src="${pageContext.request.contextPath}/static/js/main.js"></script>
</head>
<body><table id="dg" style="style=" width:400px;height:200px;"></table><script>$(function () {$('#dg').datagrid({url: '${pageContext.request.contextPath}/order.action?methodName=list&&orderState=3',fit: true,fitColumns: true,pagination: true,singleSelect: true,columns: [[// {field:'id',title:'id',width:100},{field: 'id', title: '书籍名称', hidden: true},{field: 'postalcode', title: '收货人邮编', hidden: true},{field: 'uid', title: '用户', width: 50},{field: 'consignee', title: '收货人', width: 50},{field: 'phone', title: '手机号', width: 50},{field: 'address', title: '收获人地址', width: 50},{field: 'orderPrice', title: '价格', width: 50},{field: 'sendTime', title: '发货时间', width: 50},{field: 'orderTime', title: '订单时间', width: 50},{field: 'sendType', title: '发送方式', width: 50, formatter: function (value, row, index) {if (row.sendType == 1) {return "平邮";} else if (row.sendType == 2) {return "快递";}}},{field: 'orderState', title: '订单状态', width: 100, formatter: function (value, row, index) {if (row.orderState == 1) {return "未发货";} else if (row.orderState == 2) {return "已发货";} else if (row.orderState == 3) {return "已签收";} else if (row.orderState == 4) {return "已撤单";}}}]]});})</script>
</body>
</html>
效果图
这篇关于网上书城的老板客户的后台管理功能的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!