智慧水务管理系统 - 精河县供水工程综合管理平台

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>订单管理</title>
  7. <script src="https://cdn.tailwindcss.com"></script>
  8. </head>
  9. <body class="bg-gray-50 min-h-screen">
  10. <nav class="bg-blue-600 text-white shadow-lg">
  11. <div class="container mx-auto px-4 py-4">
  12. <div class="flex justify-between items-center">
  13. <div class="flex items-center space-x-3"><span class="text-2xl">📦</span><h1 class="text-xl font-bold">电商库存管理系统</h1></div>
  14. <div class="flex space-x-4">
  15. <a href="/" class="hover:bg-blue-500 px-3 py-2 rounded">首页</a>
  16. <a href="/shops" class="hover:bg-blue-500 px-3 py-2 rounded">店铺</a>
  17. <a href="/products" class="hover:bg-blue-500 px-3 py-2 rounded">商品</a>
  18. <a href="/inventory" class="hover:bg-blue-500 px-3 py-2 rounded">库存</a>
  19. <a href="/orders" class="bg-blue-500 px-3 py-2 rounded">订单</a>
  20. </div>
  21. </div>
  22. </div>
  23. </nav>
  24. <main class="container mx-auto px-4 py-8">
  25. <div class="flex justify-between items-center mb-8">
  26. <div><h2 class="text-3xl font-bold text-gray-800">📋 订单管理</h2><p class="text-gray-600 mt-2">订单管理</p></div>
  27. </div>
  28. <div id="orderList" class="bg-white rounded-lg shadow overflow-hidden"></div>
  29. </main>
  30. <script>
  31. async function loadOrders() {
  32. const res = await fetch('/api/orders?limit=50');
  33. const data = await res.json();
  34. const container = document.getElementById('orderList');
  35. if (data.success && data.data.length > 0) {
  36. container.innerHTML = '<table class="min-w-full"><thead class="bg-gray-50"><tr><th class="px-6 py-3">订单号</th><th class="px-6 py-3">商品</th><th class="px-6 py-3">店铺</th><th class="px-6 py-3">数量</th><th class="px-6 py-3">金额</th><th class="px-6 py-3">状态</th></tr></thead><tbody>' +
  37. data.data.map(o => `<tr class="border-t"><td class="px-6 py-4">${o.order_no}</td><td class="px-6 py-4">${o.product_name}</td><td class="px-6 py-4">${o.shop_name}</td><td class="px-6 py-4">${o.quantity}</td><td class="px-6 py-4">¥${o.price}</td><td class="px-6 py-4"><span class="px-2 py-1 text-xs rounded ${o.status==='completed'?'bg-green-100 text-green-700':o.status==='shipped'?'bg-purple-100 text-purple-700':o.status==='paid'?'bg-blue-100 text-blue-700':'bg-yellow-100 text-yellow-700'}">${o.status}</span></td></tr>`).join('') + '</tbody></table>';
  38. } else {
  39. container.innerHTML = '<div class="p-8 text-center text-gray-500">暂无订单数据</div>';
  40. }
  41. }
  42. document.addEventListener('DOMContentLoaded', loadOrders);
  43. </script>
  44. </body>
  45. </html>