-
Notifications
You must be signed in to change notification settings - Fork 0
/
order.html
63 lines (62 loc) · 2.43 KB
/
order.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
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>管理後台</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>訂單管理</h1>
</header>
<main>
<section id="orders-section">
<h2>訂單列表</h2>
<table id="orders-table">
<thead>
<tr>
<th>ID</th>
<th>訂購人姓名</th>
<th>收件人姓名</th>
<th>是否需要發票</th>
<th>發票抬頭及地址</th>
<th>Line ID</th>
<th>總金額</th>
<th>支付狀態</th>
<th>創建時間</th>
</tr>
</thead>
<tbody>
<!-- 訂單資料將在這裡顯示 -->
</tbody>
</table>
</section>
</main>
<footer>
<p>© 2024 祥安生命有限公司. 版權所有.</p>
</footer>
<script>
document.addEventListener('DOMContentLoaded', function() {
fetch('/api/orders')
.then(response => response.json())
.then(data => {
const ordersTable = document.getElementById('orders-table').getElementsByTagName('tbody')[0];
data.forEach(order => {
const row = ordersTable.insertRow();
row.insertCell(0).textContent = order.id;
row.insertCell(1).textContent = order.sender_name;
row.insertCell(2).textContent = order.recipient_name;
row.insertCell(3).textContent = order.need_invoice ? '是' : '否';
row.insertCell(4).textContent = order.invoice_details;
row.insertCell(5).textContent = order.line_id;
row.insertCell(6).textContent = order.total_price;
row.insertCell(7).textContent = order.payment_status;
row.insertCell(8).textContent = new Date(order.created_at).toLocaleString();
});
})
.catch(error => console.error('Error fetching orders:', error));
});
</script>
</body>
</html>