当前位置:   article > 正文

基于java springboot二手书交易商城微信小程序源码和论文

基于java springboot二手书交易商城微信小程序源码和论文

基于微信的二手书交易商城设计与开发

摘要:随着互联网的进一步发展,传统手机移动端应用软件所存在的问题逐渐出现在技术关注领域,原生的安卓应用软件在安装卸载过程中影响了用户的体验,一种为提高用户体验而产生的轻量级内嵌式WEB程序日益受到开发人员的关注。自微信小程序被提出以来,越来越多的互联网企业竞相研发独立小程序应用,在未来具有广阔前景。

本文基于当前流行的微信小程序应用开发技术,结合二手书交易商城的用户需求,面向小型店铺开发一套易于复用、可配置、低代码开发的微信小程序二手书交易商城系统。该系统通过目前主流Java后端开发框架SpringBoot与主流数据源配置框架MyBatis以及通用MySQL数据库搭建后台服务器项目,使用Vue前端设计框架和Element-ui界面元素实现小程序管理员系统界面,并根据微信小程序官方提供的设计文档制作了原生的二手书交易商城小程序。该小程序能够满足当前小型店铺的商业服务需求,实现了分模块动态配置,易于二次开发,便于快速搭建成型系统,具备一定经济效应。

【520】基于java springboot二手书交易商城微信小程序源码和论文

关键词:二手书交易商城,小程序,动态配置,SpringBoot,Vue


Design and Development of Online Mall Based on WeChat

Abstract: With the further development of the Internet, the problems existing in the traditional mobile terminal application software developed in the field of technological focus, the native android applications affect the user experience in the process of unloading installation, to improve the user experience and produce a lightweight embedded WEB application by developers, more and more attention. Since WeChat small program was put forward, more and more Internet enterprises compete to develop independent small program applications, which will have broad prospects in the future.

Based on the current popular WeChat small program application development technology, combined with the user needs of online shopping mall, for small shops to develop a set of easy reuse, configurable, low code development of WeChat small program online shopping mall system. The system uses the current mainstream Java backend development framework SpringBoot, the mainstream data source configuration framework Mybatis and the general MySQL database to build the backend server project, and uses the Vue front-end design framework and Element-UI interface elements to realize the small program administrator system interface. And according to the WeChat small program official design documents produced the original online mall small program. The small program can meet the current commercial service needs of small shops, realize the dynamic configuration of modules, easy to secondary development, easy to quickly build a molding system, with a certain economic effect.

Keywords: online mall, mini program, dynamic allocation, SpringBoot, Vue

  1. <template>
  2. <div>
  3. <!--面包屑导航-->
  4. <el-breadcrumb separator-class="el-icon-arrow-right">
  5. <el-breadcrumb-item :to="{path:'/home'}">首页</el-breadcrumb-item>
  6. <el-breadcrumb-item>广告管理</el-breadcrumb-item>
  7. <el-breadcrumb-item>热门商品</el-breadcrumb-item>
  8. </el-breadcrumb>
  9. <!--商品列表主体-->
  10. <el-card>
  11. <el-row :gutter="120">
  12. <!--搜索区域-->
  13. <el-col :span="10">
  14. <el-input placeholder="请输入搜索内容" v-model="queryInfo.query" clearable @clear="getGoodList">
  15. <el-button slot="append" icon="el-icon-search" @click="getGoodList"></el-button>
  16. </el-input>
  17. </el-col>
  18. <!--搜索按钮-->
  19. <el-col :span="4">
  20. <el-button type="primary" @click="addDialogVisible=true">添加商品</el-button>
  21. </el-col>
  22. </el-row>
  23. <!--用户列表 border边框 stripe隔行变色-->
  24. <el-table :data="hotGoodList" border stripe>
  25. <el-table-column label="收藏排行" type="index"></el-table-column><!--索引列-->
  26. <el-table-column label="商品图片" prop="good_image" align="center">
  27. <template slot-scope="scope">
  28. <img :src="scope.row.good_image" width="105px" height="105px">
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="商品名称" prop="good_name"></el-table-column>
  32. <el-table-column label="分类" prop="class_name"></el-table-column>
  33. <el-table-column label="单价" prop="good_price"></el-table-column>
  34. <el-table-column label="商品简介" prop="good_introduce"></el-table-column>
  35. <el-table-column label="上架状态" prop="good_state">
  36. <!--作用域插槽-->
  37. <template slot-scope="scope">
  38. <el-switch v-model="scope.row.good_state" @change="goodStateChanged(scope.row)"
  39. :active-value="1" :inactive-value="0"></el-switch>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="收藏用户数" prop="good_star">
  43. </el-table-column>
  44. <el-table-column label="操作" width="180px">
  45. <template slot-scope="scope">
  46. <!--修改-->
  47. <el-tooltip effect="dark" content="修改信息" placement="top-start" :enterable="false">
  48. <el-button type="primary" icon="el-icon-edit" size="mini"
  49. @click="showEditDialog(scope.row.good_id)"></el-button>
  50. </el-tooltip>
  51. <!--删除-->
  52. <el-tooltip effect="dark" content="删除商品" placement="top-start" :enterable="false">
  53. <el-button type="danger" icon="el-icon-delete" size="mini"
  54. @click="deleteGood(scope.row.good_id)"></el-button>
  55. </el-tooltip>
  56. <!--分类修改-->
  57. <el-tooltip effect="dark" content="修改分类" placement="top-start" :enterable="false">
  58. <el-button type="warning" icon="el-icon-setting" size="mini"
  59. @click="showClassDialog(scope.row.class_name,scope.row.good_id)"></el-button>
  60. </el-tooltip>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <!--分页组件 size-change 每页最大变化数 current-change 当前最大变化 layout功能组件-->
  65. <div>
  66. <el-pagination
  67. @size-change="handleSizeChange"
  68. @current-change="handleCurrentChange"
  69. :current-page="queryInfo.pageNum"
  70. :page-sizes="[1,2,5,100]"
  71. :page-size="queryInfo.pageSize"
  72. layout="total,sizes,prev,pager,next,jumper"
  73. :total="total">
  74. </el-pagination>
  75. </div>
  76. </el-card>
  77. <!--新增商品区域-->
  78. <el-dialog title="添加商品" :visible.sync="addDialogVisible" width="50%" @close="addDialogClosed">
  79. <!--内容主体区域-->
  80. <el-form :model="addForm" :rules="addFormRules" ref="addFormRef" label-width="70px">
  81. <el-form-item label="名称" prop="good_name">
  82. <el-input v-model="addForm.good_name"></el-input>
  83. </el-form-item>
  84. <el-form-item label="分类" prop="class_name">
  85. <el-select v-model="addForm.class_name" placeholder="请选择">
  86. <el-option
  87. v-for="item in classList"
  88. :key="item.class_id"
  89. :label="item.class_name"
  90. :value="item.class_name">
  91. <span style="float: left">{{ item.class_name }}</span>
  92. <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
  93. </el-option>
  94. </el-select>
  95. </el-form-item>
  96. <el-form-item label="图片" prop="good_image">
  97. <el-input v-model="addForm.good_image"></el-input>
  98. </el-form-item>
  99. <el-form-item label="单价" prop="good_price">
  100. <el-input v-model="addForm.good_price"></el-input>
  101. </el-form-item>
  102. <el-form-item label="简介" prop="good_introduce">
  103. <el-input v-model="addForm.good_introduce"></el-input>
  104. </el-form-item>
  105. </el-form>
  106. <!--内容底部区域-->
  107. <span slot="footer" class="dialog-footer">
  108. <el-button @click="addDialogVisible=false">取消</el-button>
  109. <el-button type="primary" @click="addGood">确定</el-button>
  110. </span>
  111. </el-dialog>
  112. <!--修改商品信息区域-->
  113. <el-dialog title="修改商品信息" :visible.sync="editDialogVisible" width="50%" @close="editDialogClosed">
  114. <!--内容主体区域-->
  115. <el-form :model="editForm" :rules="editFormRules" ref="editFormRef" label-width="70px">
  116. <el-form-item label="名称" prop="good_name">
  117. <el-input v-model="editForm.good_name"></el-input>
  118. </el-form-item>
  119. <el-form-item label="分类" prop="class_name">
  120. <el-select v-model="editForm.class_name" placeholder="请选择">
  121. <el-option
  122. v-for="item in classList"
  123. :key="item.class_id"
  124. :label="item.class_name"
  125. :value="item.class_name">
  126. <span style="float: left">{{ item.class_name }}</span>
  127. <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
  128. </el-option>
  129. </el-select>
  130. </el-form-item>
  131. <el-form-item label="图片" prop="good_image">
  132. <el-input v-model="editForm.good_image"></el-input>
  133. </el-form-item>
  134. <el-form-item label="单价" prop="good_price">
  135. <el-input v-model="editForm.good_price"></el-input>
  136. </el-form-item>
  137. <el-form-item label="简介" prop="good_introduce">
  138. <el-input v-model="editForm.good_introduce"></el-input>
  139. </el-form-item>
  140. </el-form>
  141. <!--内容底部区域-->
  142. <span slot="footer" class="dialog-footer">
  143. <el-button @click="editDialogVisible=false">取消</el-button>
  144. <el-button type="primary" @click="editGoodInfo">确定</el-button>
  145. </span>
  146. </el-dialog>
  147. <!--修改商品分类对话框-->
  148. <el-dialog title="修改商品分类" :visible.sync="classDialogVisible" width="50%" @close="classDialogClosed">
  149. <!--内容主体区域-->
  150. <el-form :model="classForm" :rules="classFormRules" ref="classFormRef" label-width="70px">
  151. <el-form-item label="分类" prop="class_name">
  152. <el-select v-model="classForm.class_name" placeholder="请选择">
  153. <el-option
  154. v-for="item in classList"
  155. :key="item.class_id"
  156. :label="item.class_name"
  157. :value="item.class_name">
  158. <span style="float: left">{{ item.class_name }}</span>
  159. <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
  160. </el-option>
  161. </el-select>
  162. </el-form-item>
  163. </el-form>
  164. <!--内容底部区域-->
  165. <span slot="footer" class="dialog-footer">
  166. <el-button @click="classDialogVisible=false">取消</el-button>
  167. <el-button type="primary" @click="classGoodInfo">确定</el-button>
  168. </span>
  169. </el-dialog>
  170. </div>
  171. </template>
  172. <script>
  173. export default {
  174. created() {
  175. this.getGoodList();
  176. this.getClassList();
  177. },
  178. methods: {
  179. //获取分类表
  180. async getClassList() {
  181. const {data: res} = await this.$http.get("getGoodClass");
  182. this.classList = res;
  183. },
  184. // 最大数
  185. handleSizeChange(newSize) {
  186. this.queryInfo.pageSize = newSize;
  187. this.getGoodList();
  188. },
  189. // pageNum的触发动作
  190. handleCurrentChange(newPage) {
  191. this.queryInfo.pageNum = newPage;
  192. this.getGoodList();
  193. },
  194. async goodStateChanged(goodInfo) {
  195. //写入新状态的值
  196. const {data: res} = await this.$http.put(`goodState?good_id=${goodInfo.good_id}&good_state=${goodInfo.good_state}`);
  197. if (res != "success") {
  198. goodInfo.good_id = !goodInfo.good_id;
  199. return this.$message.error("操作失败");
  200. }
  201. this.$message.success("操作成功");
  202. },
  203. // 按star数量获取所有商品
  204. async getGoodList() {
  205. const {data: res} = await this.$http.get("getGoodByStar", {params: this.queryInfo});
  206. this.hotGoodList = res.data;// 数据封装
  207. this.total = res.number;// 总数封装
  208. this.good_state = res.data.good_state;
  209. },
  210. // 根据主键删除商品信息
  211. async deleteGood(good_id) {
  212. const confirmResult = await this.$confirm('此操作将永久删除用户,是否继续', '提示', {
  213. confirmButtonText: '确定',
  214. cancelButtonText: '取消',
  215. type: 'warning'
  216. }).catch(err => err);
  217. if (confirmResult != 'confirm') {//取消
  218. return this.$message.info("操作取消");
  219. }
  220. const {data: res} = await this.$http.delete("deleteGood?good_id=" + good_id);
  221. if (res != "success") {
  222. return this.$message.error("删除失败");
  223. }
  224. this.$message.success("删除成功");
  225. this.getGoodList();
  226. },
  227. //添加商品对话框事件
  228. //监听添加用户操作
  229. //显示对话框
  230. async showEditDialog(good_id) {
  231. const {data: res} = await this.$http.get("getUpdateGood?good_id=" + good_id);
  232. this.editForm = res;//查询出的用户信息反填回编辑表单中
  233. this.editDialogVisible = true;//开启编辑对话框
  234. },
  235. addDialogClosed() {
  236. this.$refs.addFormRef.resetFields();
  237. },
  238. addGood() {
  239. this.$refs.addFormRef.validate(async valid => {
  240. if (!valid) return;
  241. const {data: res} = await this.$http.post("addGood", this.addForm);
  242. if (res != "success") {
  243. return this.$message.error("操作失败");
  244. }
  245. this.$message.success("操作成功");
  246. this.addDialogVisible = false;
  247. this.getGoodList();
  248. });
  249. },
  250. //修改商品信息
  251. //关闭窗口
  252. editDialogClosed() {
  253. this.$refs.editFormRef.resetField();//重置信息
  254. },
  255. //确认修改用户信息
  256. editGoodInfo() {
  257. this.$refs.editFormRef.validate(async valid => {
  258. if (!valid) return;
  259. //验证成功 发起修改请求
  260. const {data: res} = await this.$http.put("editGood", this.editForm);
  261. if (res != "success") return this.$message.error("操作失败");
  262. this.$message.success("操作成功");
  263. //隐藏
  264. this.editDialogVisible = false;
  265. this.getGoodList();
  266. })
  267. },
  268. //修改商品分类
  269. //显示分类修改对话框
  270. async showClassDialog(class_name, good_id) {
  271. this.classForm.class_name = class_name;
  272. this.classForm.good_id = good_id;
  273. this.classDialogVisible = true;
  274. },
  275. //关闭窗口
  276. classDialogClosed() {
  277. // this.$refs.classFormRef.resetField();//重置信息
  278. },
  279. //确认修改分类
  280. classGoodInfo() {
  281. this.$refs.classFormRef.validate(async valid => {
  282. if (!valid) return;
  283. //验证成功 发起修改请求
  284. const {data: res} = await this.$http.get(`updateGoodClass?class_name=${this.classForm.class_name}&good_id=${this.classForm.good_id}`);
  285. if (res != "success") return this.$message.error("操作失败");
  286. this.$message.success("操作成功");
  287. //隐藏
  288. this.classDialogVisible = false;
  289. this.getGoodList();
  290. })
  291. },
  292. },
  293. data() {
  294. return {
  295. //修改商品信息
  296. editForm: {},
  297. //显示/隐藏修改商品栏
  298. editDialogVisible: false,
  299. //修改对应id商品分类
  300. classForm: {
  301. class_name: '',
  302. good_id: ''
  303. },
  304. //显示/隐藏修改权限栏
  305. classDialogVisible: false,
  306. //分类列表
  307. classList: [],
  308. //商品列表
  309. hotGoodList: [],
  310. //查询信息实体
  311. queryInfo: {
  312. query: "",//查询信息
  313. pageNum: 1,//当前页
  314. pageSize: 5,//每页最大数
  315. },
  316. total: 0,//总记录数
  317. //添加商品
  318. addDialogVisible: false,//对话框状态
  319. // 添加表单信息
  320. addForm: {
  321. good_name: '',
  322. class_name: '',
  323. good_image: '',
  324. good_price: '',
  325. good_introduce: '',
  326. },
  327. //表单验证
  328. addFormRules: {
  329. good_name: [
  330. {required: true, message: '请输入商品名称', trigger: 'blur'},
  331. // {min: 5, max: 8, message: '长度在5到8个字符', trigger: 'blur'}
  332. ],
  333. class_name: [
  334. {required: true, message: '请选择分类名称', trigger: 'blur'},
  335. // {min: 6, max: 8, message: '长度在6到8个字符', trigger: 'blur'}
  336. ],
  337. good_image: [
  338. {required: true, message: '请上传图片', trigger: 'blur'},
  339. // {min: 5, max: 15, message: '请输入正确的邮箱地址', trigger: 'blur'}
  340. ],
  341. good_price: [
  342. {required: true, message: '请输入商品价格', trigger: 'blur'},
  343. // {min: 5, max: 15, message: '请输入正确的邮箱地址', trigger: 'blur'}
  344. ],
  345. good_introduce: [
  346. {required: true, message: '请输入商品简介', trigger: 'blur'},
  347. // {min: 5, max: 15, message: '请输入正确的邮箱地址', trigger: 'blur'}
  348. ],
  349. },
  350. //修改表单验证
  351. editFormRules: {
  352. good_name: [
  353. {required: true, message: '请输入商品名称', trigger: 'blur'},
  354. // {min: 5, max: 8, message: '长度在5到8个字符', trigger: 'blur'}
  355. ],
  356. class_name: [
  357. {required: true, message: '请选择分类名称', trigger: 'blur'},
  358. // {min: 6, max: 8, message: '长度在6到8个字符', trigger: 'blur'}
  359. ],
  360. good_image: [
  361. {required: true, message: '请上传图片', trigger: 'blur'},
  362. // {min: 5, max: 15, message: '请输入正确的邮箱地址', trigger: 'blur'}
  363. ],
  364. good_price: [
  365. {required: true, message: '请输入商品价格', trigger: 'blur'},
  366. // {min: 5, max: 15, message: '请输入正确的邮箱地址', trigger: 'blur'}
  367. ],
  368. good_introduce: [
  369. {required: true, message: '请输入商品简介', trigger: 'blur'},
  370. // {min: 5, max: 15, message: '请输入正确的邮箱地址', trigger: 'blur'}
  371. ],
  372. },
  373. classFormRules: {
  374. class_name: [
  375. {required: true, message: '请选择分类名称', trigger: 'blur'},
  376. // {min: 6, max: 8, message: '长度在6到8个字符', trigger: 'blur'}
  377. ],
  378. }
  379. }
  380. }
  381. }
  382. </script>
  383. <style scoped>
  384. </style>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/154079
推荐阅读
相关标签
  

闽ICP备14008679号