This page was made as a personal project in connection with an educational exercise.
This is NOT the official site of the company or brand identified on the page. The creator of this page is NOT affiliated with the company or brand in any way. DO NOT enter any personal information (such as logins, passwords or credit card numbers) on this site.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
PaymentPage.html
116 lines (115 loc) · 3.41 KB
/
PaymentPage.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
<!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>Payment Page</title>
<style>
body {
background-color: rgb(245, 245, 245);
}
#ContactDetails {
border: 1px solid rgb(94, 94, 94);
width: 40%;
font-size: 19px;
font-weight: bold;
color: rgb(68, 68, 68);
background-color: rgb(255, 245, 246);
padding: 5px;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
margin: auto;
}
#ContactDetails > p > span {
color: black;
font-weight: 500;
font-size: 17px;
}
#subtotal {
border: 1px solid rgb(94, 94, 94);
width: 40%;
font-size: 17px;
font-weight: bold;
color: rgb(68, 68, 68);
padding: 5px;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
margin: auto;
margin-top: 20px;
padding-left: 10px;
}
#subtotal > h3 > span {
color: rgb(255, 112, 136);
}
input,
button {
padding: 5px;
background-color: rgb(255, 245, 246);
border-radius: 5px;
font-weight: 600;
}
#subtotal > button:last-child {
margin-top: 10px;
padding: 7px;
background-color: rgb(255, 219, 223);
border-radius: 7px;
font-weight: 800;
font-size: 18px;
color: rgb(27, 27, 27);
border: 4px solid rgb(252, 193, 199);
}
</style>
</head>
<body>
<div id="ContactDetails">
<p>Contact: <span></span></p>
<hr />
<p>Address: <span></span></p>
<hr />
<p>Mobile: <span></span></p>
</div>
<div id="subtotal">
<h3>Pay now and get <span>3% instant discount</span></h3>
<input type="text" placeholder="Gift Card Or Discount Code" />
<button>Apply</button>
<hr />
<h4>Total Items: <span></span></h4>
<h4>Subtotal: ₹<span></span></h4>
<h4>Shipping: Free</h4>
<hr />
<h3>Total: ₹<span></span></h3>
<button>Place Order</button>
</div>
</body>
</html>
<script>
let ContactDetails = JSON.parse(localStorage.getItem("ContactDetails"));
document.querySelector("#ContactDetails>p:nth-child(1)>span").innerText =
ContactDetails[0];
document.querySelector("#ContactDetails>p:nth-child(3)>span").innerText =
ContactDetails[1];
document.querySelector("#ContactDetails>p:nth-child(5)>span").innerText =
ContactDetails[2];
</script>
<script>
let cartData = JSON.parse(localStorage.getItem("cartData"));
let countItem = 0;
let Subtotal = 0;
for (let i = 0; i < cartData.length; i++) {
countItem += +cartData[i].quantity;
Subtotal += +cartData[i].quantity * +cartData[i].price;
}
document.querySelector("#subtotal>h4:nth-child(5)>span").innerText =
countItem;
document.querySelector("#subtotal>h4:nth-child(6)>span").innerText = Subtotal;
document.querySelector("#subtotal>h3:nth-child(9)>span").innerText = Subtotal;
</script>
<script>
let emptyCart = [];
document
.querySelector("#subtotal>button:last-child")
.addEventListener("click", function () {
alert("Your Order is Placed");
localStorage.setItem("cartData", JSON.stringify(emptyCart));
window.location.href = "index.html";
});
</script>