源碼請(qǐng)點(diǎn)贊關(guān)注收藏后評(píng)論區(qū)留言和私信博主
開發(fā)環(huán)境:Web服務(wù)器使用Servlet容器,數(shù)據(jù)庫(kù)采用mysql,集成開發(fā)環(huán)境為Spring Tool Suite(STS)
一、系統(tǒng)設(shè)計(jì)
電子商務(wù)平臺(tái)分為兩個(gè)子系統(tǒng) 一個(gè)是后臺(tái)管理系統(tǒng) 一個(gè)是電子商務(wù)系統(tǒng),下面分別講解著兩個(gè)子系統(tǒng)的功能需要與模塊劃分
系統(tǒng)功能需求
1:后臺(tái)管理子系統(tǒng)
要求管理員登錄成功后,才能對(duì)商品進(jìn)行管理,包括添加商品,查詢商品,修改商品以及刪除商品,除商品管理外,管理員還需要對(duì)商品類型,注冊(cè)用戶以及用戶的訂單等進(jìn)行管理
2:電子商務(wù)子系統(tǒng)
(1):非注冊(cè)用戶
具有瀏覽首頁(yè),查看商品詳情以及搜索商品的功能
(2):注冊(cè)用戶
還可以購(gòu)買商品,查看購(gòu)物車,收藏商品,查看訂單等等
系統(tǒng)模塊劃分
1:后臺(tái)管理子系統(tǒng)
模塊劃分如下
?2:電子商務(wù)子系統(tǒng)
模塊劃分如下
?二、數(shù)據(jù)庫(kù)設(shè)計(jì)
系統(tǒng)采用加載純Java數(shù)據(jù)庫(kù)驅(qū)動(dòng)程序的方式連接MYSQL數(shù)據(jù)庫(kù),創(chuàng)建數(shù)據(jù)庫(kù)shop并創(chuàng)建8張系統(tǒng)表 數(shù)據(jù)庫(kù)E-R圖如下
建表的sql語(yǔ)句此處省略 需要請(qǐng)點(diǎn)贊關(guān)注收藏后私信博主
?部分sql語(yǔ)句如下
/*
Navicat MySQL Data Transfer
Source Server : testSpringMVC
Source Server Version : 50519
Source Host : localhost:3306
Source Database : shop
Target Server Type : MYSQL
Target Server Version : 50519
File Encoding : 65001
Date: 2019-10-08 07:41:20
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `ausertable`
-- ----------------------------
DROP TABLE IF EXISTS `ausertable`;
CREATE TABLE `ausertable` (
`aname` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`apwd` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`aname`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of ausertable
-- ----------------------------
INSERT INTO ausertable VALUES ('admin', 'admin');
-- ----------------------------
-- Table structure for `busertable`
-- ----------------------------
DROP TABLE IF EXISTS `busertable`;
CREATE TABLE `busertable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`bemail` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`bpwd` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of busertable
-- ----------------------------
INSERT INTO busertable VALUES ('6', 'chenhengdl@126.com', '78f8a7ae700c91db09facb05a675432b');
-- ----------------------------
-- Table structure for `carttable`
-- ----------------------------
還沒(méi)弄
DROP TABLE IF EXISTS `carttable`;
CREATE TABLE `carttable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`busertable_id` int(11) NOT NULL,
`goodstable_id` int(11) NOT NULL,
`shoppingnum` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `bid` (`busertable_id`),
KEY `gno` (`goodstable_id`),
CONSTRAINT `bid` FOREIGN KEY (`busertable_id`) REFERENCES `busertable` (`id`),
CONSTRAINT `gno` FOREIGN KEY (`goodstable_id`) REFERENCES `goodstable` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of carttable
-- ----------------------------
-- ----------------------------
-- Table structure for `focustable`
-- ----------------------------
還沒(méi)弄
DROP TABLE IF EXISTS `focustable`;
CREATE TABLE `focustable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`goodstable_id` int(11) NOT NULL,
`busertable_id` int(11) NOT NULL,
`focustime` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `gno1` (`goodstable_id`),
KEY `bid1` (`busertable_id`),
CONSTRAINT `bid1` FOREIGN KEY (`busertable_id`) REFERENCES `busertable` (`id`),
CONSTRAINT `gno1` FOREIGN KEY (`goodstable_id`) REFERENCES `goodstable` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of focustable
-- ----------------------------
INSERT INTO focustable VALUES ('5', '29', '6', '2019-10-05 14:55:51');
-- ----------------------------
-- Table structure for `goodstable`
-- ----------------------------
還沒(méi)弄
DROP TABLE IF EXISTS `goodstable`;
CREATE TABLE `goodstable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gname` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`goprice` double DEFAULT NULL,
`grprice` double DEFAULT NULL,
`gstore` int(11) DEFAULT NULL,
`gpicture` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`isRecommend` tinyint(2) DEFAULT NULL,
`isAdvertisement` tinyint(2) DEFAULT NULL,
`goodstype_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `typeid` (`goodstype_id`),
CONSTRAINT `typeid` FOREIGN KEY (`goodstype_id`) REFERENCES `goodstype` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of goodstable
-- ----------------------------
INSERT INTO goodstable VALUES ('26', '廣告商品4', '90', '80', '1000', '201910274135059473.jpg', '0', '1', '2');
INSERT INTO goodstable VALUES ('27', '廣告商品5', '80', '30', '122', '201910274135126352.jpg', '0', '1', '3');
INSERT INTO goodstable VALUES ('28', '抱枕11號(hào)', '100', '20', '200', '201910274135150096.jpg', '1', '0', '14');
INSERT INTO goodstable VALUES ('29', '抱枕22號(hào)', '300', '200', '180', '201910274135212497.jpg', '1', '0', '15');
INSERT INTO goodstable VALUES ('32', '抱枕99', '80', '70', '80', '201910280135330014.jpg', '1', '0', '14');
DROP TABLE IF EXISTS `orderdetail`;
CREATE TABLE `orderdetail` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`orderbasetable_id` int(11) NOT NULL,
`goodstable_id` int(11) NOT NULL,
`shoppingnum` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `odsn` (`orderbasetable_id`),
KEY `gno3` (`goodstable_id`),
CONSTRAINT `gno3` FOREIGN KEY (`goodstable_id`) REFERENCES `goodstable` (`id`),
CONSTRAINT `odsn` FOREIGN KEY (`orderbasetable_id`) REFERENCES `orderbasetable` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of orderdetail
-- ----------------------------
INSERT INTO orderdetail VALUES ('5', '3', '29', '20');
INSERT INTO orderdetail VALUES ('6', '4', '33', '20');
建表后效果如下
?
?
?
?三、系統(tǒng)管理
1:添加相關(guān)依賴
在pom.xml文件中添加如下代碼
<!-- 添加MySQL依賴 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
<!-- MySQL8.x時(shí),請(qǐng)使用8.x的連接器 -->
</dependency>
<!-- MyBatis-Spring,Spring Boot應(yīng)用整合MyBatis框架的核心依賴配置 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<!-- 由于commons-fileupload組件不屬于Spring Boot,所以需要加上版本 -->
<version>1.3.3</version>
</dependency>
應(yīng)用的目錄結(jié)構(gòu)如下
?
?
?
?
?在配置文件application.properties中添加如下代碼
server.servlet.context-path=/eBusiness
###
##數(shù)據(jù)源信息配置
###
#數(shù)據(jù)庫(kù)地址
spring.datasource.url=jdbc:mysql://localhost:3306/shop?characterEncoding=utf8
#數(shù)據(jù)庫(kù)MySQL為8.x時(shí),url為jdbc:mysql://localhost:3306/springbootjpa?useSSL=false&serverTimezone=Asia/Beijing&characterEncoding=utf-8
#數(shù)據(jù)庫(kù)用戶名
spring.datasource.username=root
#數(shù)據(jù)庫(kù)密碼
spring.datasource.password=root
#數(shù)據(jù)庫(kù)驅(qū)動(dòng)
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#設(shè)置包別名(在Mapper映射文件中直接使用實(shí)體類名)
mybatis.type-aliases-package=com.ch.ebusiness.entity
#告訴系統(tǒng)在哪里去找mapper.xml文件(映射文件)
mybatis.mapperLocations=classpath:mappers/*.xml
#在控制臺(tái)輸出SQL語(yǔ)句日志
logging.level.com.ch.ebusiness.repository=debug
#關(guān)閉Thymeleaf模板引擎緩存(使頁(yè)面熱部署),默認(rèn)是開啟的
spring.thymeleaf.cache=false
#上傳文件時(shí),默認(rèn)單個(gè)上傳文件大小是1MB,max-file-size設(shè)置單個(gè)上傳文件大小
spring.servlet.multipart.max-file-size=50MB
#默認(rèn)總文件大小是10MB,max-request-size設(shè)置總上傳文件大小
spring.servlet.multipart.max-request-size=500MB
四、組件設(shè)計(jì)
包括 管理員登錄權(quán)限驗(yàn)證 前臺(tái)用戶登錄權(quán)限驗(yàn)證 驗(yàn)證碼 統(tǒng)一異常處理 工具類等等
五、后臺(tái)管理子系統(tǒng)的實(shí)現(xiàn)
管理員登錄界面如下
代碼如下
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>管理員登錄頁(yè)面</title>
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" />
<body>
<div class="container">
<div class="bg-primary" style="width:70%; height: 60px;padding-top: 1px;">
<h3 align="center">管理員登錄</h3>
</div>
<br>
<br>
<form th:action="@{/admin/login}" name="myform" method="post" th:object="${aUser}" class="form-horizontal" role="form" >
<div class="form-group has-success">
<label class="col-sm-2 col-md-2 control-label">用戶名</label>
<div class="col-sm-4 col-md-4">
<input type="text" class="form-control"
placeholder="請(qǐng)輸入管理員名"
th:field="*{aname}"/>
<span th:errors="*{aname}"></span>
</div>
</div>
<div class="form-group has-success">
<label class="col-sm-2 col-md-2 control-label">密碼</label>
<div class="col-sm-4 col-md-4">
<input type="password" class="form-control"
placeholder="請(qǐng)輸入您的密碼" th:field="*{apwd}"/>
<span th:errors="*{apwd}"></span>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit"class="btn btn-success" >登錄</button>
<button type="reset" class="btn btn-primary" >重置</button>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<font size="6" color="red">
<span th:text="${errorMessage }"></span>
</font>
</div>
</div>
</form>
</div>
</body>
</html>
?類型管理界面如下 包括增刪改查
添加類型頁(yè)面代碼如下
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>商品類型添加頁(yè)面</title>
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" />
<body>
<div th:include="admin/header"></div>
<br><br><br>
<div class="container">
<div class="bg-primary" style="width:70%; height: 60px;padding-top: 0.5px;">
<h3 align="center">添加類型</h3>
</div><br>
<form th:action="@{/type/addType}" name="myform" method="post" th:object="${goodsType}" class="form-horizontal" role="form" >
<div class="form-group has-success">
<label class="col-sm-2 col-md-2 control-label">類型名稱</label>
<div class="col-sm-4 col-md-4">
<input type="text" class="form-control"
placeholder="請(qǐng)輸入類型名"
th:field="*{typename}"/>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit"class="btn btn-success" >添加</button>
<button type="reset" class="btn btn-primary" >重置</button>
</div>
</div>
</form>
</div>
</body>
</html>
?添加商品效果如下
?代碼如下
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>商品類型添加頁(yè)面</title>
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" />
<body>
<div th:include="admin/header"></div>
<br><br><br>
<div class="container">
<div class="bg-primary" style="width:70%; height: 60px;padding-top: 0.5px;">
<h3 align="center">添加商品</h3>
</div><br>
<form th:action="@{/goods/addGoods?act=add}"
name="myform" method="post"
th:object="${goods}"
class="form-horizontal"
enctype="multipart/form-data" >
<div class="form-group has-success">
<label class="col-sm-2 col-md-2 control-label">商品名稱</label>
<div class="col-sm-4 col-md-4">
<input type="text" class="form-control"
placeholder="請(qǐng)輸入商品名"
th:field="*{gname}"/>
</div>
</div>
<div class="form-group has-success">
<label class="col-sm-2 col-md-2 control-label">商品原價(jià)</label>
<div class="col-sm-4 col-md-4">
<input type="number" class="form-control"
placeholder="請(qǐng)輸入商品原價(jià)"
th:field="*{goprice}"/>
</div>
</div>
<div class="form-group has-success">
<label class="col-sm-2 col-md-2 control-label">商品折扣價(jià)</label>
<div class="col-sm-4 col-md-4">
<input type="number" class="form-control"
placeholder="請(qǐng)輸入商品折扣價(jià)"
th:field="*{grprice}"/>
</div>
</div>
<div class="form-group has-success">
<label class="col-sm-2 col-md-2 control-label">商品庫(kù)存</label>
<div class="col-sm-4 col-md-4">
<input type="number" class="form-control"
placeholder="請(qǐng)輸入商品庫(kù)存"
th:field="*{gstore}"/>
</div>
</div>
<div class="form-group has-success">
<label class="col-sm-2 col-md-2 control-label">商品圖片</label>
<div class="col-sm-4 col-md-4">
<input type="file" placeholder="請(qǐng)選擇商品圖片" class="form-control" name="fileName"/>
</div>
</div>
<div class="form-group has-success">
<label class="col-sm-2 col-md-2 control-label">是否推薦</label>
<div class="col-sm-4 col-md-4 radio">
<label>
<input type="radio" th:field="*{isRecommend}" value="1">是
</label>
<label>
<input type="radio" th:field="*{isRecommend}" value="0">否
</label>
</div>
</div>
<div class="form-group has-success">
<label class="col-sm-2 col-md-2 control-label">是否廣告</label>
<div class="col-sm-4 col-md-4 radio">
<label>
<input type="radio" th:field="*{isAdvertisement}" value="1">是
</label>
<label>
<input type="radio" th:field="*{isAdvertisement}"s value="0">否
</label>
</div>
</div>
<div class="form-group has-success">
<label class="col-sm-2 col-md-2 control-label">商品類型</label>
<div class="col-sm-4 col-md-4">
<select class="form-control" th:field="*{goodstype_id}">
<option th:each="gty:${goodsType}" th:value="${gty.id}" th:text="${gty.typename}">
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit"class="btn btn-success" >添加</button>
<button type="reset" class="btn btn-primary" >重置</button>
</div>
</div>
</form>
</div>
</body>
</html>
其余的刪除修改頁(yè)面此處省略 有需要者點(diǎn)贊關(guān)注收藏后評(píng)論區(qū)留言或私信博主
六、前臺(tái)商務(wù)子系統(tǒng)的實(shí)現(xiàn)
導(dǎo)航頁(yè)效果如下 點(diǎn)擊即可跳轉(zhuǎn)到其他頁(yè)面
?代碼如下
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>導(dǎo)航頁(yè)</title>
<base th:href="@{/}"><!-- 不用base就使用th:src="@{/js/jquery.min.js} -->
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<style type="text/css">
.carousel{
height: 200px;
background-color: #000;
}
.carousel .item{
height: 200px;
background-color: #000;
}
.carousel img{
width: 100%;
}
</style>
</head>
<body>
<div class="container-fruid">
<div class="navbar navbar-default navbar-fixed-top" role="navigation"
style="padding-left: 30px;">
<div class="navbar-header">
<span class="navbar-brand">歡迎光臨eBusiness</span>
</div>
<ul class="nav navbar-nav">
<li><a th:href="@{user/toRegister}">注冊(cè)</a></li>
<li>
<a th:href="(${session.bUser} == null)?'user/toLogin':'#'" >
<span th:if="${session.bUser} == null" >
登錄
</span>
<span th:if="${session.bUser} != null" >
歡迎<span th:text="${session.bUser.bemail}" ></span>
</span>
</a>
</li>
<li><a th:href="@{admin/toLogin}">后臺(tái)</a></li>
</ul>
<ul class="nav navbar-nav navbar-right" style="padding-right: 30px;">
<li><a href="cart/userInfo">個(gè)人信息</a></li>
<li><a href="cart/selectCart">我的購(gòu)物車</a></li>
<li><a href="cart/myFocus">我的收藏</a></li>
<li><a href="cart/myOder">我的訂單</a></li>
<li class="dropdown"><a href="##" data-toggle="dropdown"
class="dropdown-toggle">關(guān)于我們<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="##">聯(lián)系我們</a></li>
<li><a href="##">投訴建議</a></li>
</ul>
</li>
</ul>
</div>
<!-- ************************************************** -->
<div id="carousel-example-generic" class="carousel slide"
data-ride="carousel" style="margin-top: 20px;">
<!-- Indicators 小圓圈-->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic"
th:each="advertise,adstat:${advertisementGoods}"
th:data-slide-to="${adstat.index}"
th:class="(${adstat.index}==0)? 'active' : ''"></li>
</ol>
<!-- 滾動(dòng)廣告圖片 -->
<div class="carousel-inner" role="listbox">
<div th:each="advertise,adstat:${advertisementGoods}" th:class="(${adstat.index}==0)? 'item active' : 'item'">
<img th:src="'images/' + ${advertise.gpicture}" th:alt="${adstat.index + 1}">
<div class="carousel-caption"><span th:text="${advertise.gname}"></span></div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic"
role="button" data-slide="prev"> <span
class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a> <a class="right carousel-control" href="#carousel-example-generic"
role="button" data-slide="next"> <span
class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<!-- *************************************** -->
<div class="navbar navbar-default " role="navigation">
<ul class="nav navbar-nav" style="padding-left: 50px;">
<li><a th:href="@{/}">首頁(yè)</a></li>
<li th:each="gty:${goodsType}"><a th:href="'?tid=' + ${gty.id}"><span th:text="${gty.typename}"></span></a></li>
</ul>
<form action="search" class="navbar-form navbar-right"
style="padding-right: 50px;">
<div class="form-group">
<input type="text" class="form-control" name="mykey" placeholder="請(qǐng)輸入關(guān)鍵詞" />
</div>
<button type="submit" class="btn btn-default">搜索</button>
</form>
</div>
</div>
</body>
</html>
商品詳情頁(yè)面如下
?代碼如下
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="@{/}"><!-- 不用base就使用th:src="@{/js/jquery.min.js} -->
<meta charset="UTF-8">
<title>商品頁(yè)面</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<script src="js/jquery.min.js"></script>
<script type="text/javascript" th:inline="javascript">
function focus(){
$.ajax(
{
//請(qǐng)求路徑,要注意的是url和th:inline="javascript"
url : [[@{/cart/focus}]],
//請(qǐng)求類型
type : "post",
contentType : "application/json",
//data表示發(fā)送的數(shù)據(jù)
data : JSON.stringify({
id : $("#gid").val()
}),
//成功響應(yīng)的結(jié)果
success : function(obj){//obj響應(yīng)數(shù)據(jù)
if(obj == "no"){
alert("您已收藏該商品!");
}else if(obj == "ok"){
alert("成功收藏該商品");
}else{
alert("您沒(méi)有登錄,請(qǐng)登錄!");
}
},
error : function() {
alert("處理異常!");
}
}
);
}
function putCart(){
if(!(/(^[1-9]\d*$)/.test($("#buyNumber").val()))){
alert("購(gòu)買量請(qǐng)輸入正整數(shù)!");
$("#buyNumber").focus();
return;
}
if(parseInt($("#buyNumber").val()) > parseInt($("#gstore").text())){
alert("購(gòu)買量超出庫(kù)存!");
$("#buyNumber").focus();
return;
}
//獲取路徑
var pathName=window.document.location.pathname;
//截取,得到項(xiàng)目名稱
var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
window.location.href = projectName + "/cart/putCart?id=" + $("#gid").val() + "&buyNumber=" + $("#buyNumber").val();
}
</script>
</head>
<body>
<!-- 加載header.html -->
<div th:include="user/header"></div>
<div class="container">
<div class="row">
<div class="col-xs-6 col-md-3">
<img
th:src="'images/' + ${goods.gpicture}"
style="height: 220px; width: 280px; display: block;">
</div>
<div class="col-xs-6 col-md-3">
<p>商品名:<span th:text="${goods.gname}"></span></p>
<p>
商品折扣價(jià):<span style="color: red;">¥
<span th:text="${goods.grprice}"></span>
</span>
</p>
<p>
商品原價(jià):
<span class="text-dark" style="text-decoration: line-through;"> ¥
<span th:text="${goods.goprice}"></span>
</span>
</p>
<p>
商品類型:<span th:text="${goods.typename}"></span>
</p>
<p>
庫(kù)存:<span id="gstore" th:text="${goods.gstore}"></span>
</p>
<p>
<input type="text" size="12" class="form-control" placeholder="請(qǐng)輸入購(gòu)買量" id="buyNumber" name="buyNumber"/>
<input type="hidden" name="gid" id="gid" th:value="${goods.id}"/>
</p>
<p>
<a href="javascript:focus()" class="btn btn-primary"
style="font-size: 10px;">加入收藏</a>
<a href="javascript:putCart()" class="btn btn-success"
style="font-size: 10px;">加入購(gòu)物車</a>
</p>
</div>
</div>
</div>
</body>
</html>
測(cè)試效果如下
?
如果賬號(hào)密碼不對(duì)則彈出錯(cuò)誤窗口
?
?
?
還有用戶注冊(cè) 登錄頁(yè)面 購(gòu)物車 下單頁(yè)面 個(gè)人信息 我的收藏頁(yè)面等等此處省略文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-493078.html
需要源碼請(qǐng)點(diǎn)贊關(guān)注收藏后評(píng)論區(qū)留言或 私信博主即可文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-493078.html
到了這里,關(guān)于【Spring Boot+Thymeleaf+MyBatis+mysql】實(shí)現(xiàn)電子商務(wù)平臺(tái)實(shí)戰(zhàn)(附源碼)持續(xù)更新~~ 包括sql語(yǔ)句、java、html代碼的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!