-
Notifications
You must be signed in to change notification settings - Fork 0
/
cart.html
381 lines (358 loc) · 10.5 KB
/
cart.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/cart.css">
<title>资生堂购物车</title>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="css/iconfont.css">
</head>
<body>
<!-- nav -->
<div class="header"></div>
<!-- contain -->
<div class="cartEmpty">
<h1>您的购物袋是空的.</h1>
<p>您还没有添加任何商品,马上挑选喜欢的商品</p>
<div class="all">
<div class="continueLink emptyTent">
<a href="">
<span class="knowNow">即刻了解</span>
<span class="konwMsg">资生堂十大畅销明星产品</span>
<span class="iconfont icon-arrow-right"></span>
</a>
</div>
<div class="continueClp emptyTent">
<a href="">
<span class="knowNow">即刻了解</span>
<span class="konwMsg">简单四步了解你的肌肤。并为你推荐适合的产品</span>
<span class="iconfont icon-arrow-right"></span>
</a>
</div>
</div>
</div>
<div class="shoppingCar">
<div class="cartTop">
<h1>我的购物袋</h1>
<div class="preLink">
<a href='#' onClick='javascript:history.back(-1);'>继续购物></a>
</div>
</div>
<h2 class="cartItem">
<div class="quantity">
共有<span>1</span>件商品
</div>
</h2>
<form action="" method="post">
<div class="leftColumn">
<div class="goods">
<div class="list">
<div class="itemImg">
<img src="img/pro1.jpg" alt="">
</div>
<div class="itemDetails">
<div class="name">青春日和舒缓亮眼精华啫喱</div>
<div class="size">20mL</div>
</div>
<div class="itemNum">
<button type="button" class="reduce">-</button>
<span>1</span>
<button type="button" class="add">+</button>
</div>
<div class="itemPrice">¥<span>220</span></div>
<div class="price">¥<span>220</span></div>
</div>
<div class="cartLink">
<a href="">
<span class="iconfont icon-wishlist"></span>
加入收藏
</a>
<a href="">修改</a>
<a class="del">删除</a>
</div>
</div>
<div class="goods">
<div class="list">
<div class="itemImg">
<img src="img/pro1.jpg" alt="">
</div>
<div class="itemDetails">
<div class="name">青春日和舒缓亮眼精华啫喱</div>
<div class="size">20mL</div>
</div>
<div class="itemNum">
<button type="button" class="reduce">-</button>
<span>1</span>
<button type="button" class="add">+</button>
</div>
<div class="itemPrice">¥<span>110</span></div>
<div class="price">¥<span>110</span></div>
</div>
<div class="cartLink">
<a href="">
<span class="iconfont icon-wishlist"></span>
加入收藏
</a>
<a href="">修改</a>
<a class="del">删除</a>
</div>
</div>
<div class="goods">
<div class="list">
<div class="itemImg">
<img src="img/pro1.jpg" alt="">
</div>
<div class="itemDetails">
<div class="name">青春日和舒缓亮眼精华啫喱</div>
<div class="size">20mL</div>
</div>
<div class="itemNum">
<button type="button" class="reduce">-</button>
<span>1</span>
<button type="button" class="add">+</button>
</div>
<div class="itemPrice">¥<span>10</span></div>
<div class="price">¥<span>10</span></div>
</div>
<div class="cartLink">
<a href="">
<span class="iconfont icon-wishlist"></span>
加入收藏
</a>
<a href="">修改</a>
<a class="del">删除</a>
</div>
</div>
</div>
<div class="rightColumn">
<div class="imgStat">
<img src="img/shoppingCar.png" alt="">
</div>
<div class="totalContain">
<h3 class="title">
订单概览
</h3>
<div class="totalSub">
<dt class="float-left">商品价格</dt>
<dd class="float-right">¥<span>220</span></dd>
</div>
<div class="shipping">
<dt class="float-left">运费</dt>
<dd class="float-right">¥<span>15</span></dd>
</div>
<div class="totalPrice">
<dt class="float-left">总价</dt>
<dd class="float-right">¥<span>235</span></dd>
</div>
<div class="cartAction">
<button type="submit">立即结算</button>
</div>
</div>
<div class="carFoot">
<img src="img/carFoot.png" alt="">
</div>
</div>
</form>
</div>
<!-- footer -->
<div class="footer">
<div class="lay1">
<div class="row">
<div class="col-md-4">
<div class="title">
<h3>联系我们</h3>
</div>
<div class="contains">
<a href="#" class="chat">
<i class="iconfont icon-chat"></i>
<span>在线咨询</span>
</a>
<a href="#" class="tel">
<i class="iconfont icon-phone"></i>
<span>400-821-6076</span>
</a>
</div>
</div>
<div class="col-md-4">
<div class="title">
<h3>关注我们</h3>
</div>
<div class="contains">
<a href="#" class="wechat">
<i class="iconfont icon-we-chat"></i>
</a>
<a href="#" class="weibo">
<i class="iconfont icon-weibo"></i>
</a>
<a href="#" class="redbook">
<i class="iconfont icon-xiaohongshu"></i>
</a>
</div>
</div>
<div class="col-md-4">
<div class="title">
<h3>寻找专柜</h3>
</div>
<div class="contains">
<a href="#" class="home">
<i class="iconfont icon-home"></i>
<span>专柜查询</span>
</a>
</div>
</div>
</div>
</div>
<div class="lay2">
<div class="row">
<div class="col-md-4">
<div class="contains">
<h5>关于我们</h5>
<ul>
<li>
<a href="#">品牌故事</a>
</li>
<li>
<a href="#">官网购物理由</a>
</li>
<li>
<a href="#">品牌资讯</a>
</li>
</ul>
</div>
</div>
<div class="col-md-4">
<div class="contains">
<h5>明星产品</h5>
<ul>
<li>
<a href="#">查看所有</a>
</li>
<li>
<a href="#">「傲娇精华」红妍肌活精华露</a>
</li>
<li>
<a href="#">「蓝胖子」新艳阳夏臻效水动力防晒乳</a>
</li>
<li>
<a href="#">「细管唇膏」沁色绚彩唇膏</a>
</li>
</ul>
</div>
</div>
<div class="col-md-4">
<div class="contains">
<h5>帮助中心</h5>
<ul>
<li>
<a href="#">常见问题</a>
</li>
<li>
<a href="#">退换货政策</a>
</li>
<li>
<a href="#">订单查询</a>
</li>
<li>
<a href="#">网站地图</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="lay3">
<a href="https://www.shiseido.com.cn/terms-of-use.html">使用条款</a>
<a href="https://www.shiseido.com.cn/privacy-policy.html">隐私政策</a>
<a href="https://www.shiseido.com.cn/license.html">上海工商</a>
<a href="http://www.beian.miit.gov.cn/state/outPortal/loginPortal.action;jsessionid=HYQG0rZBcOGhUvypcwqtPI3ahZUmkwGDDhKPyb2_P6hwwEn8UwU4!821559948">沪ICP备10203872号-1</a>
<a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=31011502007430">沪公网安备 31011502007430号</a>
<span>Copyright © 2019 资生堂(中国)投资有限公司</span>
</div>
</div>
</body>
</html>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) -->
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.js"></script>
<script src="js/cart.js"></script>
<script type="text/javascript">
//购物车
$(function(){
getSum();
totalPrice();
//改变数量
$(".add").click(function(){
var totalNum = $(this).prev().html();
totalNum++;
$(this).prev().html(totalNum);
let price = $(this).parent().next().next().children().html();
console.log(price);
let totalOnly = totalNum*price;
$(this).parent().next().children().html(totalOnly);
getSum();
totalPrice();
})
$(".reduce").click(function(){
var totalNum = $(this).next().html();
totalNum--;
if(totalNum == 0){
$(this).parent().parent().parent().remove();
}
$(this).next().html(totalNum);
let price = $(this).parent().next().next().children().html();
let totalOnly = totalNum*price;
$(this).parent().next().children().html(totalOnly);
getSum();
totalPrice();
})
//删除商品
$(".del").click(function(){
$(this).parent().parent().remove();
getSum();
totalPrice();
})
//总件数
function getSum(){
//获取数量的集合
let oTotalNum = $(".itemNum span");
let sum = 0;
// console.log(oTotalNum);
for(let i=0;i<oTotalNum.length;i++){
sum += parseInt(oTotalNum.eq(i).html()) ;
}
$(".quantity span").html(sum);
if(sum==0){
$(".shoppingCar").hide();
$(".cartEmpty").show();
}
}
//单品总价
function totalOnly(){
let num = $(".itemNum span").html();
let price = $(".price span").html();
let totalOnly = num*price;
// console.log(totalOnly);
$(this).parent().next().children().html(totalOnly);
}
//合计
function totalPrice(){
let oTotalPrice = $(".itemPrice span");
let total = 0;
let ship = $(".shipping span").html();
for(let i=0;i<oTotalPrice.length;i++){
total += parseInt(oTotalPrice.eq(i).html());
}
let totalPrice = total+ parseInt(ship) ;
$('.totalSub dd span').html(total);
$('.totalPrice dd span').html(totalPrice);
}
})
//加载头部
$(function(){
$(".header").load("head.html");
})
</script>