N-122基于springboot,vue网上订餐系统

news2024/9/20 22:13:44

开发工具:IDEA

服务器:Tomcat9.0, jdk1.8

项目构建:maven

数据库:mysql5.7

前端技术 :Vue+ElementUI 

服务端技术:springboot+mybatis+redis 

本系统分用户前台和管理后台两部分,项目采用前后端分离

主要功能如下:

(1)前台部分功能:

1.登录、注册、首页

2.购物车、商品详情、搜索商品、结算功能

3.我的订单、个人资料、退出登录、取消订单、评价等

(2)后台部分功能:

1.登录、首页、退出登录

2.用户管理:新增、修改、分页查询、删除

3.角色管理:新增、修改、分页查询、删除

4.商品分类管理:新增、修改、分页查询、删除

5.商品管理:新增、修改、分页查询、删除

6.订单管理:修改状态、查询详情、分页查询、删除

7.评论管理:分页查询、查看详情、回复

文档截图:

前台截图:

后台截图:



@RestController("AdminProductController")
@RequestMapping("/admin/product")
public class ProductController {

    @Resource
    private IProductService productService;

    /**
     * 后台保存商品数据(添加、修改)
     * @param productDTO
     * @return
     */
    @PostMapping("/save")
    public ResponseDTO<Boolean> saveProduct(@RequestBody ProductDTO productDTO){
        return productService.saveProduct(productDTO);
    }

    /**
     * 后台分页获取商品数据
     * @param pageDTO
     * @return
     */
    @PostMapping("/list")
    public ResponseDTO<PageDTO<ProductDTO>> getProductListByPage(@RequestBody PageDTO<ProductDTO> pageDTO){
        return productService.getProductListByPage(pageDTO);
    }

    /**
     * 后台删除商品数据
     * @param productDTO
     * @return
     */
    @PostMapping("/remove")
    public ResponseDTO<Boolean> removeProduct(@RequestBody ProductDTO productDTO){
        return productService.removeProduct(productDTO);
    }

    /**
     * 后台获取商品总数
     * @return
     */
    @PostMapping("/total")
    public ResponseDTO<Long> getProductTotal(){
        return productService.getProductTotal();
    }

    /**
     * 获取访问量最多的三个商品
     * @return
     */
    @PostMapping("/view_num")
    public ResponseDTO<List<ProductDTO>> getProductListByViewNum(){
        return productService.getProductListByViewNum();
    }
}

<template>
  <body
      class="html not-front not-logged-in one-sidebar sidebar-second page-node page-node- page-node-3 node-type-product uc-product-node">
  <div id="skip-link">
    <a href="#main-content" class="element-invisible element-focusable">Skip to main content</a>
  </div>
  <div id="wrapper">
    <!-- LOGIN POP UPS -->
    <div id="popup-overlay"></div>
    <div class="wrapper">
      <header>
        <the-header></the-header>
      </header>
      <div class="content clearfix">
        <div class="breadcrumbs">
          <h2 class="element-invisible">You are here</h2>
          <div class="breadcrumb">
            <router-link to="/">首页</router-link>
            » 商品详情

          </div>
        </div>
        <div id="content" class="column left-content">
          <div class="section">
            <a id="main-content"></a>
            <h1 class="title" id="page-title" v-text="product.name"></h1>
            <div class="tabs"></div>
            <div class="region region-content">
              <div id="block-system-main" class="block block-system">


                <div class="content">
                  <div id="node-3" class="node node-product clearfix" about="/product/convallis-sit-amet-tellus"
                       typeof="sioc:Item foaf:Document">

                    <div class="meal-details single">


                      <div class="image">
                        <div class="field field-name-uc-product-image field-type-image field-label-hidden">
                          <div class="field-items">
                            <div class="field-item even">
                              <div class="flex-nav-container">
                                <div class="flexslider-content flexslider clearfix" id="flexslider-1">
                                  <ul class="slides">
                                    <li><img typeof="foaf:Image" :src="product.photo" width="800" height="500" alt=""/>
                                    </li>
                                  </ul>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="date_categories">
                        <div class="created"></div>
                        <div
                            class="field field-name-field-product-category field-type-taxonomy-term-reference field-label-inline clearfix">
                          <div class="field-label"></div>
                          <div class="field-items">
                            <div class="field-item even">上架日期:{{ product.createTime }} 点击量:{{ product.viewNum }}</div>
                          </div>
                        </div>
                        <div class="clear"></div>
                      </div>

                      <div class="field field-name-body field-type-text-with-summary field-label-hidden">
                        <div class="field-items">
                          <div class="field-item even" property="content:encoded"><p v-text="product.info"></p>
                          </div>
                        </div>
                      </div>
                      <hr/>

                      <span class="price"><div class="product-info display-price uc-product-3"><span class="uc-price"
                                                                                                     v-text="'¥'+product.price"></span></div></span>
                      <div class="add-to-cart">
                        <form id="uc-product-add-to-cart-form-3">
                          <div>
                            <div class="form-actions form-wrapper" id="edit-actions">
                              <input class="node-add-to-cart form-submit" @click="addCart(product.id)" type="button"
                                     id="edit-submit-3" name="op" value="加入购物车"/>
                            </div>
                          </div>
                        </form>
                      </div>

                      <hr/>
                      <h1>商品评价</h1>
                      <template
                          v-if="product.evaluates === undefined || product.evaluates.length <= 0">
                        <el-row><h3>暂无评价</h3></el-row>
                      </template>
                      <template v-else>
                        <el-row :gutter="20" v-for="eva in product.evaluates" :key="eva.id">
                          <el-col :span="2" style="text-align: left;">
                            <div class="grid-content bg-purple">
                              <img :src="eva.userPhotoUrl|filterPhoto" class="layui-nav-img" style="height:55px; width:55px;">
                            </div>
                          </el-col>
                          <el-col :span="17" style="text-align: left;">
                            <el-row><span>{{ eva.username }}</span></el-row>
                            <el-row><span>{{ eva.evaluateTime }}</span></el-row>
                            <el-row>{{ eva.evaluateContent }}</el-row>
                          </el-col>
                          <el-col :span="5">
                            <el-rate
                                :value="eva.result"
                                disabled
                                show-score
                                text-color="#ff9900"
                                score-template="{value}">
                            </el-rate>
                          </el-col>
                        </el-row>
                      </template>

                    </div>

                    <!-- // node view full -->
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div> <!-- /.section, /#content -->

        <the-aside></the-aside>


      </div>
    </div>
    <the-footer></the-footer>
  </div>
  </body>
</template>

<script>
import TheFooter from '../components/TheFooter.vue';
import TheHeader from '../components/TheHeader.vue';
import TheAside from '../components/TheAside.vue';

export default {
  name: 'detail',
  components: {TheFooter, TheHeader, TheAside},
  data: function () {
    return {
      product: {},
      user: {}
    }
  },
  mounted() {
    this.getProduct();
    this.getUserByToken();
  },
  watch: {
    '$route.query'() {
      this.getProduct();
    }
  },
  methods: {
    getUserByToken() {
      let token = Tool.getLoginUser();
      if (Tool.isEmpty(token)) {
        this.user.token = "";
      } else {
        this.$ajax.post(process.env.VUE_APP_SERVER + "/web/user/token", {token: token}).then((response) => {
          let resp = response.data;
          if (resp.code === 0) {
            this.user = resp.data;
          }
        });
      }
    },
    addCart(productId) {
      let data = {
        productId: productId,
        userId: this.user.id,
        quantity: 1
      };
      this.$ajax.post(process.env.VUE_APP_SERVER + "/web/cart/add", data).then((response) => {
        let resp = response.data;
        if (resp.code === 0) {
          this.$message.success(resp.msg);
        } else {
          this.$message.error(resp.msg);
        }
      });
    },
    getProduct() {
      let query = this.$route.query;
      let data = {};
      if (query.productId) {
        data = {id: query.productId};
      }
      // 获取当前商品详情信息
      this.$ajax.post(process.env.VUE_APP_SERVER + "/web/product/get", data).then((response) => {
        let resp = response.data;
        if (resp.code === 0) {
          this.product = resp.data;
          this.product.photo = process.env.VUE_APP_SERVER + "/photo/view?filename=" + this.product.photo;
        }
      });
    }
  },
  filters: {
    filterPhoto(img) {
      return process.env.VUE_APP_SERVER + "/photo/view?filename=" + img;
    }
  }
}
</script>

<style>

</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/733498.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

python_day3_list

数据容器 &#xff1a; list&#xff08;列表&#xff09; tuple&#xff08;元组&#xff09; str&#xff08;字符串&#xff09; set&#xff08;集合&#xff09; dict&#xff08;字典&#xff09; 列表 list name_list [java, c, python] print(name_list) print(type…

【LeetCode每日一题合集】2023.7.3-2023.7.9

文章目录 2023.7.3——445. 两数相加 II&#xff08;大数相加/高精度加法&#xff09;2023.7.4——2679. 矩阵中的和2023.7.5——2600. K 件物品的最大和&#xff08;贪心&#xff09;代码1——贪心模拟代码2——Java一行 2023.7.6——2178. 拆分成最多数目的正偶数之和&#x…

C. Vampiric Powers, anyone? - 思维+前缀和

分析&#xff1a; 添加新元素的操作可以理解为添加任意一段以n结尾的异或和&#xff0c;当原数组总异或和与新加的元素进行异或又可以得到剩余的前缀的异或和&#xff0c;假设新加的元素的值是i到n的异或和x&#xff0c;那么总异或和sumpre^x&#xff0c;所以sum^xpre&#xff…

Git gui教程---第四篇 Git gui的使用 添加文件,并提交

添加文件&#xff0c;并提交 新建一个txt文件点击扫描重新扫描&#xff0c;未缓存改动多了我们刚刚新建的文件。 点击缓存改动&#xff0c;文件位置变换。 如果缓存选错&#xff0c;想撤销&#xff0c;在菜单栏选择“提交”&#xff0c;“从本次提交撤销”&#xff0c;文件变更…

RocketMQ重置消费位点源码分析

这里是weihubeats,觉得文章不错可以关注公众号小奏技术&#xff0c;文章首发。拒绝营销号&#xff0c;拒绝标题党 背景 最近在使用RocketMQ的重置消费位点的时候经常出现报错&#xff0c;所以就打算研究下RocketMQ是如何重置消费者的消费位点的 RocketMQ版本 5.1.0Dashboard…

基于matlab使用虚幻引擎模拟环境设计激光雷达SLAM算法(附源码)

一、前言 此示例演示如何记录来自 3D 仿真环境的合成激光雷达传感器数据&#xff0c;以及如何使用记录的数据开发同步定位和映射 &#xff08;SLAM&#xff09; 算法。 自动驾驶工具箱在Simulink中集成了虚幻引擎模拟环境。与此仿真环境相关的 Simulink 模块可以在库中找到。…

C++常用库函数——表

文章目录 1、常用数学函数2、常用字符串处理函数3、其他常用函数4、实现键盘和文件输入/输出的成员函数 1、常用数学函数 头文件 #include 或者 #include <math.h> 2、常用字符串处理函数 头文件 #include 或者 #include <string.h> 3、其他常用函数 头文件#i…

电动汽车充电站监控系统设计_kaic

1 绪论 1.1 引言 汽车工业的告诉发展&#xff0c;汽车带来的环境污染、能源短缺、资源枯竭和安全等方面的问题越来越突出。为了保持国民经济的可持续发展&#xff0c;保护人类居住环境和能源供给&#xff0c;各国政府不惜巨资&#xff0c;投入大量人力、物力&#xff0c;寻…

Docker更新后无法启动容器

前提&#xff1a; 由于使用的操作系统版本比较低&#xff0c;centos7.3&#xff0c;准备更新操作系统&#xff0c;随后执行了yum update 操作&#xff0c;结果&#xff0c;docker也从忘记了的某个版本更新到了最新的 24版本&#xff0c;导致使用的容器也没有了&#xff0c;这下…

【离散数学】实践三 PageRank体验

文章目录 PageRank算法工作原理简化版本完整版本 graphs分析graphs代码 [^4] 结语 PageRank算法工作原理 算法原理1 简化版本 若页面B,C,D…N都有链接到页面A上&#xff0c;则页面A的PageRank值如下&#xff1a; P R ( A ) ( P R ( B ) L ( B ) P R ( C ) L ( C ) P R (…

ES6: 模版字符串

前言: ES5 中我们表示字符串的时候使用 或者 "" 作用: 在 ES6 中&#xff0c;我们还有一个东西可以表示字符串&#xff0c;就是 &#xff08;反引号&#xff09; let str hello worldconsole.log(typeof str) // string和单引号还有双引号的区别: 反引号可以换行…

【设计模式】设计模式简介+七大设计原则介绍

设计模式介绍 简介 设计模式是对软件设计中普遍存在(反复出现) 的各种问题&#xff0c;所提出的解决方案。 为什么学习设计模式 软件要做大&#xff0c;要先进行设计&#xff0c;才能保证其有高的稳定性、扩展性&#xff08;容易按照新的需求添加功能&#xff09;、复用性&…

MySQL-分库分表详解(五)

♥️作者&#xff1a;小刘在C站 ♥️个人主页&#xff1a; 小刘主页 ♥️努力不一定有回报&#xff0c;但一定会有收获加油&#xff01;一起努力&#xff0c;共赴美好人生&#xff01; ♥️学习两年总结出的运维经验&#xff0c;以及思科模拟器全套网络实验教程。专栏&#xf…

前后端跨域的解决方案

对于使用Spring Boot和Vue的前后端分离项目&#xff0c;下面介绍四种常见的解决跨域问题的方式&#xff0c;并分别从Java后端的两种权限配置方法、前端代理、以及Nginx代理进行说明&#xff1a; 方案提供 使用Spring Boot的权限配置方法&#xff1a; CorsFilter过滤器&#xf…

ChatGPT 最佳实践指南之:提供参考文本

Provide reference text 提供参考文本 GPTs can confidently invent fake answers, especially when asked about esoteric topics or for citations and URLs. In the same way that a sheet of notes can help a student do better on a test, providing reference text to G…

图论之寻找桥边

目录 ①基准法 ②并查集 ③逆向思维之标记环边 ④并查集压缩路径 ①基准法 在图论中&#xff0c;一条边被称为“桥”代表这条边一旦被删除&#xff0c;这张图的连通块数量会增加。等价地说&#xff0c;一条边是一座桥当且仅当这条边不在任何环上。一张图可以有零或多座桥。…

FFmpeg5.0源码阅读—— av_read_frame

摘要&#xff1a;本文主要描述了FFmpeg中用于打开编解码器接口av_read_frame的具体调用流程&#xff0c;详细描述了该接口被调用时所作的具体工作。   关键字&#xff1a;ffmpeg、av_read_frame   读者须知&#xff1a;读者需要了解FFmpeg的基本使用流程&#xff0c;以及一…

JVM理论(二)类加载子系统

类加载流程 类加载流程 类加载器子系统负责从文件系统或者网络中加载class文件,class文件的文件头有特定的文件标识(CAFEBABE是JVM识别class文件是否合法的依据)classLoader只负责文件的加载,而执行引擎决定它是否被执行加载类的信息存放在运行时数据区的方法区中,方法区还包括…

【终端增强工具】这次,我把Terminal(终端)也接入ChatGPT了...

大家好&#xff0c;我是萌新程序员豆小匠。 为terminal&#xff08;终端&#xff09;增加自定义命令这个想法从开始学编程的时候就有了&#xff0c;但是一直没有付诸行动。 这次&#xff0c;终于抽时间完成了&#xff0c;且代码开源&#xff01; 实现的功能 先说下实现的功能…

Idea社区版创建SpringBoot

一 下载Spring Initalizr and Assistant插件 选择左上角的File->Settings->Plugins&#xff0c;在搜索框中输入Spring&#xff0c;出现的第一个Spring Boot Helper插件&#xff0c;点击Installed&#xff0c;下载插件。&#xff08;这里已经下载&#xff09; 二 创建Spr…