购物车

master
YDD 2021-09-07 17:48:02 +08:00
parent 22cc7a3043
commit d633ab8eec
3 changed files with 265 additions and 18 deletions

View File

@ -0,0 +1,117 @@
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
a {
text-decoration: none;
}
section {
height: 1200px;
background-color: #f5f5f5;
}
section .whole {
padding: 15px 50px;
margin: auto;
}
section .whole .whole-1 {
margin: 20px auto;
width: 1200px;
padding: 25px;
}
section .whole .whole-1 .all {
display: inline-block;
}
section .whole .whole-1 .all h2 {
font-weight: 600;
color: #cb1919;
float: left;
padding-bottom: 10px;
}
section .whole .whole-1 .opt {
border-top: 2px solid #cb1919;
}
section .whole .whole-1 .opt ul .optall table {
width: 100%;
background-color: #f3f3f3;
border: 1px solid #e0e0e0;
margin-bottom: 20px;
}
section .whole .whole-1 .opt ul .optall #checkall {
margin-left: 10px;
}
section .whole .whole-1 .opt ul .optall th {
height: 50px;
}
section .whole .whole-1 .opt ul .optall th span {
margin-left: 85px;
}
section .whole .whole-1 .opt #checklist .among {
margin-bottom: 20px;
}
section .whole .whole-1 .opt #checklist .among table {
width: 100%;
background-color: #fff;
border: 1px solid #e0e0e0;
}
section .whole .whole-1 .opt #checklist .among .box1 {
margin-left: 15px;
}
section .whole .whole-1 .opt #checklist .among th {
height: 115px;
}
section .whole .whole-1 .opt #checklist .among th:nth-child(1) {
width: 135px;
}
section .whole .whole-1 .opt #checklist .among th:nth-child(1) img {
padding: 10px;
width: 82px;
}
section .whole .whole-1 .opt #checklist .among th:nth-child(2) {
width: 500px;
}
section .whole .whole-1 .opt #checklist .among th:nth-child(3), section .whole .whole-1 .opt #checklist .among th:nth-child(4), section .whole .whole-1 .opt #checklist .among th:nth-child(6) {
width: 120px;
}
section .whole .whole-1 .opt #checklist .among th:nth-child(5) {
width: 120px;
}
section .whole .whole-1 .opt #checklist .among th:nth-child(5) input:nth-child(1), section .whole .whole-1 .opt #checklist .among th:nth-child(5) input:nth-child(3) {
width: 15px;
}
section .whole .whole-1 .opt #checklist .among th:nth-child(5) input:nth-child(2) {
width: 30px;
}
section .whole .whole-1 .opt #checklist .among span {
width: 400px;
font-size: 12px;
display: inline-block;
}

View File

@ -52,6 +52,7 @@
<canvas>
<p>发送手机验证码</p>
</canvas>
</div>
</div>
<!-- 登录 -->

View File

@ -1,32 +1,161 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>购物车</title>
<link rel="stylesheet" href="./css/layui.css">
<link rel="stylesheet" href="./css/shopcar.css">
<link rel="stylesheet" href="../../css/layui.css">
<link rel="stylesheet" href="../../css/logshoppingcar/shopcar.css">
</head>
<body>
<header>
<!-- 背景 -->
<div class="head"></div>
<!-- 我的购物车 -->
<div class="myshop">
<div class="logo">
<img src="./images/logo.png" alt="">
</div>
<div class="about">
<body>
<section>
<div class="whole">
<div class="whole-1">
<div class="all">
<h2>全部商品(20)</h2>
</div>
<!-- 选择 -->
<div class="opt">
<ul>
<li class="optall">
<table>
<th> <input type="checkbox" id="checkall">
<label for="value1">全选</label>
<span>商品</span>
</th>
<th>单价</th>
<th>数量</th>
<th>小计</th>
<th>操作</th>
</table>
</li>
</ul>
<ul id="checklist">
<li class="among">
<table>
<th> <input type="checkbox" name="arr[]" value="1" class="box1">
<label for="value1"><img src="../../img/images/1-1.png" alt=""></label>
</th>
<th><span>
竹迪&nbsp;&nbsp;客厅装饰画现代简约晶瓷画沙发背景墙挂画三联画餐厅墙画<br />靠山书房壁画抽象艺术画 11时来运转8190
</span></th>
<th>x3</th>
<th>¥1888.00</th>
<th>
<input type="button" name="minus" value="-" onclick="minus(0);">
<input type="text" name="amount" value="1">
<input type="button" name="plus" value="+" onclick="plus(0);">
</th>
<th id="price0">¥564.6</th>
<th onclick="del(1)">删除</th>
</table>
</li>
<li class="among">
<table>
<th> <input type="checkbox" name="arr[]" value="2" class="box1">
<label for="value1"><img src="../../img/images/1-2.png" alt=""></label>
</th>
<th><span>
竹迪&nbsp;&nbsp;客厅装饰画现代简约晶瓷画沙发背景墙挂画三联画餐厅墙画<br />靠山书房壁画抽象艺术画 11时来运转8190
</span></th>
<th>x3</th>
<th>¥1888.00</th>
<th>
<input type="button" name="minus" value="-" onclick="minus(0);">
<input type="text" name="amount" value="1">
<input type="button" name="plus" value="+" onclick="plus(0);">
</th>
<th id="price0">¥564.6</th>
<th onclick="del(1)">删除</th>
</table>
</li>
<li class="among">
<table>
<th> <input type="checkbox" name="arr[]" value="3" class="box1">
<label for="value1"><img src="../../img/images/1-3.png" alt=""></label>
</th>
<th><span>
竹迪&nbsp;&nbsp;客厅装饰画现代简约晶瓷画沙发背景墙挂画三联画餐厅墙画<br />靠山书房壁画抽象艺术画 11时来运转8190
</span></th>
<th>x3</th>
<th>¥1888.00</th>
<th>
<input type="button" name="minus" value="-" onclick="minus(0);">
<input type="text" name="amount" value="1">
<input type="button" name="plus" value="+" onclick="plus(0);">
</th>
<th id="price0">¥564.6</th>
<th onclick="del(1)">删除</th>
</table>
</li>
<li class="among">
<table>
<th> <input type="checkbox" name="arr[]" value="4" class="box1">
<label for="value1"><img src="../../img/images/1-4.png" alt=""></label></th>
<th><span>竹迪&nbsp;&nbsp;客厅装饰画现代简约晶瓷画沙发背景墙挂画三联画餐厅墙画<br />靠山书房壁画抽象艺术画 11时来运转8190/span></th>
<th>x3</th>
<th>¥1888.00</th>
<th>
<input type="button" name="minus" value="-" onclick="minus(0);">
<input type="text" name="amount" value="1">
<input type="button" name="plus" value="+" onclick="plus(0);">
</th>
<th id="price0">¥564.6</th>
<th onclick="del(1)">删除</th>
</table>
</li>
</li>
</ul>
</div>
</div>
</div>
</header>
<section>
<div class="whole">
<h3>全部商品</h3>
</div>
</section>
</body>
<script type="text/javascript" src="../../js/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(function () {
/*全选按钮状态显示判断*/
$(".checklist").find("input[type='checkbox']").click(function () {
/*初始化选择为TURE*/
$(".checkall")[0].checked = true;
/*获取未选中的*/
var nocheckedList = new Array();
$(".checklist").find('input:not(:checked)').each(function () {
nocheckedList.push($(this).val());
});
/*状态显示*/
if (nocheckedList.length == $(".checklist").find('input').length) {
$(".checkall")[0].checked = false;
$(".checkall")[0].indeterminate = false;
} else if (nocheckedList.length) {
$(".checkall")[0].indeterminate = true;
} else {
$(".checkall")[0].indeterminate = false;
}
});
// 全选/取消
$(".checkall").click(function () {
// alert(this.checked);
if ($(this).is(':checked')) {
$(".checklist").find('input').each(function () {
$(this).prop("checked", true);
});
} else {
$(".checklist").find('input').each(function () {
$(this).removeAttr("checked", false);
$(this).prop("checked", false); // 根据官方的建议:具有 true 和 false 两个属性的属性,如 checked, selected 或者 disabled 使用prop(),其他的使用 attr()
});
}
});
});
</script>
</html>