-
Notifications
You must be signed in to change notification settings - Fork 0
/
payment.html
487 lines (475 loc) · 17.2 KB
/
payment.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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Thanh toán</title>
<link rel="icon" type="image/x-icon" href="./library/logoko-01.png">
<link rel="stylesheet" href="./css/style.css">
<script src="https://kit.fontawesome.com/09f1ff1e12.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons+Outlined">
<script src="https://www.w3schools.com/lib/w3.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript" ></script>
<style>
.content {
display: flex;
justify-content: space-between;
margin: 30px;
}
.left {
width: 39%;
border: 2px solid wheat;
height: 450px;
}
.right {
width: 59%;
}
.left h2, .right h2 {
text-align: center;
}
.left h2 {
background-color: wheat;
font-size: 22px;
letter-spacing: 0.02em;
font-weight: 600;
}
.right h2 {
border-bottom: 1.5px solid palevioletred;
color: palevioletred;
}
.form_container {
display: flex;
margin-top: 20px;
justify-content: space-evenly;
}
.right-col1 {
width: 50%;
}
.form_row, .note {
display: flex;
flex-direction: column;
margin-bottom: 20px;
}
.form_row label {
font-weight: bold;
}
.form_row input, .form_row textarea {
border-color: #cecece;
border-radius: 0px;
border-width: 1px;
border-style: solid;
}
.form_row input {
height: 20px;
}
#add, #form-note {
resize: none;
}
#paycod, #paybanking {
font-weight: normal;
font-size: 13px;
}
::-webkit-input-placeholder {
font-size: 13px;
font-style: italic;
}
input[type=button] {
display: block;
margin-left: auto;
margin-right: auto;
background-color: wheat;
border: 1px solid black;
border-radius: 30px;
padding: 10px 30px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
}
input[type=button]:hover {
background-color: white;
color: rgb(240, 195, 111);
border: 1px solid rgb(240, 195, 111);
}
input[type=submit] {
display: block;
margin-left: auto;
margin-right: auto;
background-color: white;
color: palevioletred;
border-radius: 30px;
padding: 4px 20px;
font-size: 15px;
font-weight: bold;
cursor: pointer;
border: none;
margin-top: 5px;
}
input[type=submit]:hover{
color: white;
background-color: rgb(202, 114, 143);
}
.cart {
font-size: 12px;
height: 300px;
overflow-y: auto;
}
.product {
font-weight: 500;
}
.cart ::-webkit-scrollbar-thumb {
background: wheat !important;
}
.cart_row {
display: flex;
justify-content: space-evenly;
margin: 20px 10px;
}
.cart_row img {
width: 60px;
}
.cart_row-name {
display: flex;
flex-direction: column;
}
.cart_row-name {
width: 55%;
}
.quantity {
line-height: 80px;
}
.modifier {
color: #aaaaaa;
font-style: italic;
margin-top: 10px;
}
.price {
font-weight: bold;
line-height: 80px;
}
.detail {
display: flex;
justify-content: space-between;
margin: 20px;
font-size: 14px;
}
.detail-col {
display: flex;
flex-direction: column;
}
.detail-col span {
margin-bottom: 10px;
font-weight: 550;
letter-spacing: 0.02em;
}
.detail-col-query {
text-align: right;
}
@media screen and (max-width: 1050px) {
.form_container {
flex-direction: column;
}
.left {
width: 55%;
}
.right {
width: 43%;
}
.cart {
font-size: 14px;
}
.right-col1,.right-col2 {
width: 100%;
}
}
@media screen and (max-width: 800px) {
.content {
flex-direction: column;
}
.cart {
height: 210px;
}
.left {
width: 90%;
height: 350px;
margin-left: auto;
margin-right: auto;
}
.cart_row img {
width: 80px;
}
.right {
width: 90%;
margin-left: auto;
margin-right: auto;
margin-top: 20px;
}
}
@media screen and (max-width: 600px) {
.cart {
font-size: 13px;
}
.cart_row img {
width: 50px;
margin-top: 10px;
margin-left: 5px;
margin-right: 8px;
}
.cart_row-name {
width: 48%;
}
}
@media screen and (max-width: 500px) {
.cart {
font-size: 12px;
}
.cart_row img {
width: 45px;
margin-top: 15px;
}
}
.popup {
position: relative;
display: block;
margin: auto;
display: inline-block;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.popup .popuptext {
visibility: hidden;
width: 360px;
height: 150px;
background-color: rgb(221, 120, 154);
color: #fff;
text-align: left;
border-radius: 6px;
padding: 12px;
position: fixed;
z-index: 1;
top: 50%;
left: 50%;
margin-top: -75px; /* Negative half of height. */
margin-left: -180px; /* Negative half of width. */
}
.popuptext span {
font-size: 12px;
font-weight: 500px;
}
/*hide and show the popup */
.popup .show {
visibility: visible;
-webkit-animation: fadeIn 1s;
animation: fadeIn 1s;
}
/* Add animation (fade in the popup) */
@-webkit-keyframes fadeIn {
from {opacity: 0;}
to {opacity: 1;}
}
@keyframes fadeIn {
from {opacity: 0;}
to {opacity:1 ;}
}
.troChuot:hover{
cursor: pointer;
}
</style>
</head>
<body>
<!-- chèn html header -->
<!-- <div w3-include-html="header.html"></div> -->
<div id="header"></div>
<script>
load("header.html");
function load(url)
{
req = new XMLHttpRequest();
req.open("GET", url, false);
req.send(null);
document.getElementById("header").innerHTML = req.responseText;
}
</script>
<!-- phần nội dung -->
<div class="content">
<div class="left">
<h2>GIỎ HÀNG</h2>
<div class="cart">
<!-- <div class="cart_row">
<span class="quantity">1 x</span>
<img src="https://cdn11.bigcommerce.com/s-iakwzr7rs7/product_images/attribute_rule_images/14225_thumb_1580246010.jpg" alt="">
<div class="cart_row-name">
<span class="product">Smart Litter Odor Control Unscented Clumping Cat Litter</span>
<span class="modifier">Size 15 lb</span>
</div>
<span class="price">20.000 VND</span>
</div>
<div class="cart_row">
<span class="quantity">1 x</span>
<img src="https://cdn11.bigcommerce.com/s-iakwzr7rs7/product_images/attribute_rule_images/14225_thumb_1580246010.jpg" alt="">
<div class="cart_row-name">
<span class="product">Smart Litter Odor Control Unscented Clumping Cat Litter</span>
<span class="modifier">Size 15 lb</span>
</div>
<span class="price">20.000 VND</span>
</div>
<div class="cart_row">
<span class="quantity">1 x</span>
<img src="https://cdn11.bigcommerce.com/s-iakwzr7rs7/product_images/attribute_rule_images/14225_thumb_1580246010.jpg" alt="">
<div class="cart_row-name">
<span class="product">Smart Litter Odor Control Unscented Clumping Cat Litter</span>
<span class="modifier">Size 15 lb</span>
</div>
<span class="price">20.000 VND</span>
</div>
<div class="cart_row">
<span class="quantity">1 x</span>
<img src="https://cdn11.bigcommerce.com/s-iakwzr7rs7/product_images/attribute_rule_images/14225_thumb_1580246010.jpg" alt="">
<div class="cart_row-name">
<span class="product">Smart Litter Odor Control Unscented Clumping Cat Litter</span>
<span class="modifier">Size 15 lb</span>
</div>
<span class="price">20.000 VND</span>
</div> -->
</div>
<div class="detail">
<div class="detail-col">
<span>Tổng cộng:</span>
<span>Phí vận chuyển:</span>
<span>Thành tiền:</span>
</div>
<div class="detail-col detail-col-query">
</div>
</div>
</div>
<div class="right">
<h2>THÔNG TIN ĐẶT HÀNG</h2>
<form action="giohang.html" >
<div class="form_container">
<div class="right-col1">
<div class="form_row">
<label for="name">1. Họ tên</label>
<input type="text" name="name" id="name">
</div>
<div class="form_row">
<label for="email">2. Email</label>
<input type="text" name="email" id="email">
</div>
<div class="form_row">
<label for="phone">3. Số điện thoại</label>
<input type="text" name="phone" id="phone">
</div>
<div class="form_row">
<label for="add">4. Địa chỉ</label>
<textarea name="add" id="add" cols="30" rows="3"></textarea>
</div>
</div>
<div class="right-col2">
<div class="form_row">
<label for="payment">Hình thức thanh toán</label>
<div>
<input type="radio" name="payment" id="paymentcod" checked>
<label for="payment" id="paycod">Thanh toán khi nhận hàng</label>
</div>
<div>
<input type="radio" name="payment" id="paymentbank">
<label for="payment" id="paybanking">Chuyển khoản</label>
</div>
</div>
<div class="form_row"><textarea name="note" id="form-note" cols="30" rows="2" placeholder="Ghi chú..."></textarea></div>
</div>
</div>
<input type="button" value="HOÀN TẤT ĐẶT HÀNG" onclick="validate()">
<div class="popup">
<span class="popuptext" id="myPopup">
<h4>Cảm ơn bạn đã tin tưởng MarPet!</h4>
<span><i>Nếu bạn chọn phương thức thanh toán chuyển khoản, vui lòng chuyển đến STK sau đây:</i>
<br>Vietinbank CN Hoàng Mai
<br>Số TK : 106868087203
<br>Chủ TK: Uyên Nguyễn
<br>
</span>
<input type="submit" value="XÁC NHẬN">
</span>
</div>
</form>
</div>
<script>
function validate() {
var n = document.getElementById("name").value;
var m = document.getElementById("email").value;
var p = document.getElementById("phone").value;
var a = document.getElementById("add").value;
if ((n== "")||(m == "")||(p == "")||(a == "")) {
alert("Vui lòng nhập đủ thông tin!");
} else {showPopup()}
}
function showPopup() {
var popup = document.getElementById("myPopup");
popup.classList.toggle("show");
localStorage.clear();
}
</script>
</div>
<!-- chèn html footer -->
<!-- <div w3-include-html="footer.html"></div> -->
<div id="footer"></div>
<script>
load("footer.html");
function load(url)
{
req = new XMLHttpRequest();
req.open("GET", url, false);
req.send(null);
document.getElementById("footer").innerHTML = req.responseText;
}
</script>
<!-- function để chèn html -->
<script>
w3.includeHTML();
</script>
<script>
function formatNumber(num) {
var n = Number(num);
return n.toLocaleString("vi");
}
let cartItems = localStorage.getItem("productsInCart");
cartItems = JSON.parse(cartItems);
let productContainerInPayment = document.querySelector(".cart");
let calculateCostInPayment = document.querySelector(".detail-col-query");
const cartCost = parseInt(localStorage.getItem('totalCost'));
const shippingFee = parseInt(20000);
const totalPayable=cartCost+shippingFee;
if (cartItems && productContainerInPayment) {
productContainerInPayment.innerHTML = '';
calculateCostInPayment.innerHTML = '';
// productContainerInPayment.innerHTML = '';
Object.values(cartItems).map(item => {
if(item.thuocTinh!=""){
productContainerInPayment.innerHTML += '<div class="cart_row"><span class="quantity">'+item.quantity+' x</span><div><img class="troChuot" src="'+item.image+'" onclick="gotoChiTiet(' + item.productid + ')"></div><div class="cart_row-name"><span class="product">'+item.name+'</span><span class="modifier">'+item.thuocTinh+'</span></div><span class="price">'+formatNumber(item.price*item.quantity)+' đ</span></div>';
}
else{
productContainerInPayment.innerHTML += '<div class="cart_row"><span class="quantity">'+item.quantity+' x</span><img src="'+item.image+'" class="troChuot" onclick="gotoChiTiet(' + item.productid + ')"><div class="cart_row-name"><span class="product">'+item.name+'</span><span class="modifier"></span></div><span class="price">'+formatNumber(item.price*item.quantity)+' đ</span></div>';
}
});
calculateCostInPayment.innerHTML += '<span>'+formatNumber(cartCost)+' đ</span><span>'+formatNumber(shippingFee)+' đ</span><span>'+formatNumber(totalPayable)+' đ</span>';
}
else{
}
</script>
<!-- js mở chatbox và quay về đầu trang -->
<script src="./js/chatBox&returnTop-btn.js"></script>
<!-- js khi kéo xuống thì hiện 1 thanh nav cố định ở đầu trang web -->
<script src="./js/flat-menu.js"></script>
<!-- js xổ ra các mục nhỏ của footer khi trình duyệt thu nhỏ -->
<script src="./js/footer.js"></script>
<script src="./js/searchHeader.js"></script>
<script src="./js/products_detail.js"></script>
<script src="./js/searchdetails.js"></script>
<script src="./js/searchMobile.js"></script>
</body>
</html>