IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> JavaScript知识库 -> 购物车订单管理 -> 正文阅读

[JavaScript知识库]购物车订单管理

??

我是卖家

JSP

orderDao

?

package com.hmf.dao;

import java.util.Date;
import java.util.List;

import com.hmf.entity.Order;
import com.zking.util.BaseDao;
import com.zking.util.PageBean;

public class OrderDao extends BaseDao<Order>{
?? ?
?? ?public void add(Order t) throws Exception {
?? ??? ?String sql= " insert into t_easyui_order(uid,orderTime,consignee,phone,postalcode,address,sendType,sendTime,orderPrice,orderState) values(?,now(),?,?,?,?,?,?,?,?)";
?? ??? ?super.executeUpdate(sql, t, new String[] {"uid","consignee","phone","postalcode","address","sendType","sendTime","orderPrice","orderState"});
?? ?}
?? ?
?? ?/**s
?? ? *v订单查询倒序
?? ? * @param order
?? ? * @param pageBean
?? ? * @return
?? ? * @throws Exception
?? ? */
?? ?public List<Order> list(Order order, PageBean pageBean) throws Exception {
?? ??? ?//String sql = " select * from t_easyui_order order by orderTime desc";
?? ??? ?String sql = " select * from t_easyui_order where 1=1";
?? ??? ?long id =order.getId();
?? ??? ?if(id!=0) {
?? ??? ??? ?sql += " and id = " + id;
?? ??? ?}
?? ??? ?int orderState = order.getOrderState();
?? ??? ?if(orderState != 0) {
?? ??? ??? ?sql += " and orderState = " + orderState;
?? ??? ?}
?? ??? ?sql += " order by orderTime desc";
?? ??? ?return super.executeQuery(sql, Order.class, pageBean);
?? ?}
?? ?
?? ?/**
?? ? * 修改订单
?? ? * @param t
?? ? * @throws Exception
?? ? */
?? ?public void editState(Order t) throws Exception {
?? ??? ?String sql= " update t_easyui_order set orderState=? where id=?";
?? ??? ?int orderState = t.getOrderState();
?? ??? ?if(orderState == 2) {
?? ??? ??? ?sql += " update t_easyui_order set orderState=?,sendTime=now() where id=?";
?? ??? ?}
?? ??? ?super.executeUpdate(sql, t, new String[] {"orderState","id"});
?? ?}

}
?

orderAction

package com.hmf.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hmf.dao.OrderDao;
import com.hmf.entity.Order;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.PageBean;
import com.zking.util.R;
import com.zking.util.ResponseUtil;

public class OrderAction extends ActionSupport implements ModelDriver<Order>{
?? ?
?? ?private Order order=new Order();
?? ?private OrderDao orderDao=new OrderDao();
?? ?
?? ?public Order getModel() {
?? ??? ?return null;
?? ?}
?? ?
?? ?public void list(HttpServletRequest req, HttpServletResponse resp) {
?? ??? ?PageBean pageBean=new PageBean();
?? ??? ?pageBean.setRequest(req);
?? ??? ?try {
?? ??? ??? ?List<Order> list = orderDao.list(order, pageBean);
?? ??? ??? ?ResponseUtil.writeJson(resp, new R().data("total", pageBean.getTotal()).data("rows", list));
?? ??? ?} catch (Exception e) {
?? ??? ??? ?e.printStackTrace();
?? ??? ?}
?? ?}
?? ?
?? ?
?? ?public void cancelAndReceive(HttpServletRequest req, HttpServletResponse resp) {
?? ??? ?try {
?? ??? ??? ?orderDao.editState(order);
?? ??? ??? ?ResponseUtil.writeJson(resp, 1);
?? ??? ?} catch (Exception e) {
?? ??? ??? ?e.printStackTrace();
?? ??? ??? ?try {
?? ??? ??? ??? ?ResponseUtil.writeJson(resp, 0);
?? ??? ??? ?} catch (Exception e1) {
?? ??? ??? ??? ?e1.printStackTrace();
?? ??? ??? ?}
?? ??? ?}
?? ?}
}
?

配置

效果未发货

?已发货

订单管理?

?

jap

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
? ? <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>

orderItemdao

package com.hmf.dao;

import java.util.List;

import com.hmf.entity.OrderItem;
import com.zking.util.BaseDao;
import com.zking.util.PageBean;

public class OrderItemDao extends BaseDao<OrderItem>{
?? ?public void add(OrderItem oi) throws Exception {
?? ??? ?String sql = "insert into t_easyui_orderItem(oid,bid,quantity) values(?,?,?)";
?? ??? ?super.executeUpdate(sql, oi, new String[] {"oid","bid","quantity"});
?? ?}
?? ?
?? ?public List<OrderItem> list(OrderItem orderItem, PageBean pageBean) throws Exception {
?? ??? ?String sql = " select * from t_easyui_orderItem where 1=1";
?? ??? ?long oid=orderItem.getOid();
?? ??? ?if(oid!=0) {
?? ??? ??? ?sql += " and oid ="+oid;
?? ??? ?}
?? ??? ?return super.executeQuery(sql, OrderItem.class, pageBean);
?? ?}
}
?

orderItemAction

package com.hmf.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hmf.dao.OrderItemDao;
import com.hmf.entity.OrderItem;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.PageBean;
import com.zking.util.R;
import com.zking.util.ResponseUtil;

public class OrderItemAction extends ActionSupport implements ModelDriver<OrderItem>{

?? ?private OrderItem orderItem =new OrderItem();
?? ?private OrderItemDao orderItemDao=new OrderItemDao();
?? ?
?? ?public OrderItem getModel() {
?? ??? ?return null;
?? ?}
?? ?
?? ?public void list(HttpServletRequest req, HttpServletResponse resp) {
?? ??? ?PageBean pageBean=new PageBean();
?? ??? ?pageBean.setRequest(req);
?? ??? ?try {
?? ??? ??? ?List<OrderItem> list = orderItemDao.list(orderItem, pageBean);
?? ??? ??? ?ResponseUtil.writeJson(resp, new R().data("total", pageBean.getTotal()).data("rows", list));
?? ??? ?} catch (Exception e) {
?? ??? ??? ?e.printStackTrace();
?? ??? ?}
?? ?}

}
?

配置

?

效果

我是买家

??? ?/**
?? ? * 发货 ?撤单 ?签收
?? ? * @param req
?? ? * @param resp
?? ? */
?? ?public void cancelAndReceive(HttpServletRequest req, HttpServletResponse resp) {
?? ??? ?try {
?? ??? ??? ?orderDao.editState(order);
?? ??? ??? ?ResponseUtil.writeJson(resp, 1);
?? ??? ?} catch (Exception e) {
?? ??? ??? ?e.printStackTrace();
?? ??? ??? ?try {
?? ??? ??? ??? ?ResponseUtil.writeJson(resp, 0);
?? ??? ??? ?} catch (Exception e1) {
?? ??? ??? ??? ?e1.printStackTrace();
?? ??? ??? ?}
?? ??? ?}
? ? }

?

?签收

拜拜 大家都早点睡?

  JavaScript知识库 最新文章
ES6的相关知识点
react 函数式组件 & react其他一些总结
Vue基础超详细
前端JS也可以连点成线(Vue中运用 AntVG6)
Vue事件处理的基本使用
Vue后台项目的记录 (一)
前后端分离vue跨域,devServer配置proxy代理
TypeScript
初识vuex
vue项目安装包指令收集
上一篇文章      下一篇文章      查看所有文章
加:2021-10-11 17:25:59  更:2021-10-11 17:26:18 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/18 17:57:43-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码