{"id":8,"date":"2025-11-21T18:12:43","date_gmt":"2025-11-21T18:12:43","guid":{"rendered":"https:\/\/zngeqp.online\/?page_id=8"},"modified":"2025-11-21T19:23:32","modified_gmt":"2025-11-21T19:23:32","slug":"8-2","status":"publish","type":"page","link":"https:\/\/zngeqp.online\/index.php\/8-2\/","title":{"rendered":"AWB"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"zh\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>\u7a7a\u8fd0\u63d0\u5355\u7ba1\u7406\u7cfb\u7edf<\/title>\n    <style>\n        body { font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif; background: #f1f1f1; margin: 0; padding: 0; }\n        .container { max-width: 1400px; margin: 20px auto; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }\n        h1 { margin-top: 0; }\n        .add-form { margin-bottom: 20px; display: flex; gap: 10px; align-items: center; }\n        .add-form input { padding: 10px; font-size: 16px; border: 1px solid #ddd; border-radius: 4px; width: 150px; }\n        .add-form button { padding: 10px 20px; background: #0073aa; color: #fff; border: none; border-radius: 4px; cursor: pointer; }\n        .add-form button:hover { background: #005177; }\n        .search-form { margin-bottom: 20px; display: flex; gap: 10px; }\n        .search-form input { padding: 10px; font-size: 16px; border: 1px solid #ddd; border-radius: 4px; width: 300px; }\n        .search-form select { padding: 10px; font-size: 16px; border: 1px solid #ddd; border-radius: 4px; }\n        table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }\n        th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }\n        th { background: #f9f9f9; }\n        .status-light { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin: 0 4px; }\n        .green { background: green; }\n        .gray { background: gray; }\n        .operations { display: flex; gap: 5px; }\n        .operations button { padding: 5px 10px; font-size: 12px; border-radius: 4px; cursor: pointer; }\n        .send-btn { background: #0073aa; color: #fff; border: none; }\n        .send-btn:disabled { background: #ccc; }\n        .delete-btn { background: #a00; color: #fff; border: none; }\n        .upload-btn { background: #0073aa; color: #fff; border: none; }\n        .replace-file { color: #0073aa; text-decoration: underline; cursor: pointer; }\n        .progress-bar { width: 100%; height: 5px; background: #eee; border-radius: 5px; margin-top: 5px; }\n        .progress { height: 5px; background: #3b82f6; border-radius: 5px; width: 0; transition: width 0.3s; }\n        #awb-pagination { display: flex; gap: 10px; justify-content: center; }\n        .page-btn { padding: 8px 12px; background: #f9f9f9; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; }\n        .page-btn:hover { background: #eee; }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"container\">\n        <h1>\u63d0\u5355\u7ba1\u7406<\/h1>\n        <div class=\"add-form\">\n            <input type=\"text\" id=\"new_awb\" placeholder=\"\u63d0\u5355\u53f7\uff0c\u5982\uff1a125-12345678\" maxlength=\"12\">\n            <input type=\"number\" id=\"new_packages\" placeholder=\"\u5927\u5305\u6570\" min=\"0\">\n            <input type=\"date\" id=\"new_flight_date\">\n            <input type=\"number\" id=\"new_total_weight\" placeholder=\"\u603b\u91cd\u91cf\" min=\"0\" step=\"0.01\">\n            <button id=\"add_awb\">\u6dfb\u52a0\u63d0\u5355<\/button>\n        <\/div>\n        <div class=\"search-form\">\n            <input type=\"text\" id=\"awb_search\" placeholder=\"\u641c\u7d22\u63d0\u5355\u53f7...\">\n            <select id=\"awb_per_page\">\n                <option value=\"50\">50\/\u9875<\/option>\n                <option value=\"100\">100\/\u9875<\/option>\n                <option value=\"200\">200\/\u9875<\/option>\n                <option value=\"1000\">1000\/\u9875<\/option>\n            <\/select>\n        <\/div>\n        <table>\n            <thead>\n                <tr>\n                    <th>\u63d0\u5355\u53f7<\/th>\n                    <th>\u5927\u5305\u6570<\/th>\n                    <th>\u822a\u73ed\u65f6\u95f4<\/th>\n                    <th>\u603b\u91cd\u91cf<\/th>\n                    <th>\u63d0\u5355<\/th>\n                    <th>Manifest<\/th>\n                    <th>\u805a\u5408<\/th>\n                    <th>\u7a0e\u5355<\/th>\n                    <th>\u62a5\u5173\u5355<\/th>\n                    <th>\u6d41\u6c34<\/th>\n                    <th>\u72b6\u6001<\/th>\n                    <th>\u64cd\u4f5c<\/th>\n                <\/tr>\n            <\/thead>\n            <tbody id=\"awb-list\"><\/tbody>\n        <\/table>\n        <div id=\"awb-pagination\"><\/div>\n    <\/div>\n\n    <script>\n        let awbData = JSON.parse(localStorage.getItem('awbData')) || [];\n        window.addEventListener('beforeunload', () => localStorage.setItem('awbData', JSON.stringify(awbData)));\n\n        function addAwb() {\n            const awb = document.getElementById('new_awb').value.trim();\n            const packages = document.getElementById('new_packages').value;\n            const flight_date = document.getElementById('new_flight_date').value;\n            const total_weight = document.getElementById('new_total_weight').value;\n\n            if (!awb || !\/^\\d{3}-\\d{8}$\/.test(awb)) {\n                alert('\u63d0\u5355\u53f7\u683c\u5f0f\u5fc5\u987b\u4e3a XXX-XXXXXXXX');\n                return;\n            }\n\n            if (awbData.some(item => item.awb_number === awb)) {\n                alert('\u63d0\u5355\u53f7\u5df2\u5b58\u5728');\n                return;\n            }\n\n            const newEntry = {\n                id: Date.now(),\n                awb_number: awb,\n                packages,\n                flight_date,\n                total_weight,\n                file_qg1: '',\n                file_qg2: '',\n                file_qg3: '',\n                file_bs1: '',\n                file_bs2: '',\n                file_bs3: '',\n                sent_qg: 0,\n                sent_bs: 0\n            };\n\n            awbData.unshift(newEntry);\n            renderTable();\n            document.getElementById('new_awb').value = '';\n            document.getElementById('new_packages').value = '';\n            document.getElementById('new_flight_date').value = '';\n            document.getElementById('new_total_weight').value = '';\n        }\n\n        function renderTable() {\n            const list = document.getElementById('awb-list');\n            list.innerHTML = '';\n            const filtered = awbData.filter(item => item.awb_number.toLowerCase().includes(document.getElementById('awb_search').value.toLowerCase()));\n            filtered.forEach(item => {\n                const row = document.createElement('tr');\n                row.innerHTML = `\n                    <td>${item.awb_number}<\/td>\n                    <td>${item.packages}<\/td>\n                    <td>${item.flight_date}<\/td>\n                    <td>${item.total_weight}<\/td>\n                    <td>${getFileCell(item.id, 'qg1', item.file_qg1)}<\/td>\n                    <td>${getFileCell(item.id, 'qg2', item.file_qg2)}<\/td>\n                    <td>${getFileCell(item.id, 'qg3', item.file_qg3)}<\/td>\n                    <td>${getFileCell(item.id, 'bs1', item.file_bs1)}<\/td>\n                    <td>${getFileCell(item.id, 'bs2', item.file_bs2)}<\/td>\n                    <td>${getFileCell(item.id, 'bs3', item.file_bs3)}<\/td>\n                    <td>\n                        <span class=\"status-light ${item.sent_qg ? 'green' : 'gray'}\"><\/span>\n                        <span class=\"status-light ${item.sent_bs ? 'green' : 'gray'}\"><\/span>\n                    <\/td>\n                    <td class=\"operations\">\n                        <button class=\"send-btn\" onclick=\"sendEmail(${item.id}, 'qg')\" ${item.sent_qg ? 'disabled' : ''}>${item.sent_qg ? '\u5df2\u53d1\u6e05\u5173' : '\u53d1\u6e05\u5173'}<\/button>\n                        <button class=\"send-btn\" onclick=\"sendEmail(${item.id}, 'bs')\" ${item.sent_bs ? 'disabled' : ''}>${item.sent_bs ? '\u5df2\u53d1\u62a5\u7a0e' : '\u53d1\u62a5\u7a0e'}<\/button>\n                        <button class=\"delete-btn\" onclick=\"deleteAwb(${item.id})\">\u5220\u9664<\/button>\n                    <\/td>\n                `;\n                list.appendChild(row);\n            });\n            paginate(filtered.length);\n        }\n\n        function getFileCell(id, field, url) {\n            if (!url) {\n                return `<button class=\"upload-btn\" onclick=\"uploadFile(${id}, '${field}')\">\u4e0a\u4f20<\/button>`;\n            }\n            const name = url.name || '\u6587\u4ef6';\n            return `<a href=\"${URL.createObjectURL(url)}\" target=\"_blank\">${name}<\/a><br><small><a class=\"replace-file\" onclick=\"uploadFile(${id}, '${field}')\">\u66ff\u6362<\/a><\/small>`;\n        }\n\n        function uploadFile(id, field) {\n            const input = document.createElement('input');\n            input.type = 'file';\n            input.onchange = e => {\n                const file = e.target.files[0];\n                if (!file) return;\n                const entry = awbData.find(item => item.id === id);\n                entry[`file_${field}`] = file;\n                renderTable();\n            };\n            input.click();\n        }\n\n        function sendEmail(id, type) {\n            const entry = awbData.find(item => item.id === id);\n            const files = type === 'qg' ? [entry.file_qg1, entry.file_qg2, entry.file_qg3] : [entry.file_bs1, entry.file_bs2, entry.file_bs3];\n            if (files.some(f => !f)) return alert('\u8bf7\u5148\u4e0a\u4f20\u5b8c\u65743\u4e2a\u6587\u4ef6');\n            alert(`\u53d1\u9001 ${type === 'qg' ? '\u6e05\u5173' : '\u62a5\u7a0e'} \u90ae\u4ef6\u6210\u529f\uff01`);\n            entry[`sent_${type}`] = 1;\n            renderTable();\n        }\n\n        function deleteAwb(id) {\n            if (confirm('\u786e\u5b9a\u5220\u9664\u6b64\u63d0\u5355\u53ca\u5176\u6240\u6709\u6587\u4ef6\uff1f\u4e0d\u53ef\u6062\u590d\uff01')) {\n                awbData = awbData.filter(item => item.id !== id);\n                renderTable();\n            }\n        }\n\n        function paginate(total) {\n            const perPage = parseInt(document.getElementById('awb_per_page').value);\n            const pages = Math.ceil(total \/ perPage);\n            const pagination = document.getElementById('awb-pagination');\n            pagination.innerHTML = '';\n            for (let i = 1; i <= pages; i++) {\n                const btn = document.createElement('button');\n                btn.className = 'page-btn';\n                btn.textContent = i;\n                btn.onclick = () => {\n                    const start = (i - 1) * perPage;\n                    const rows = Array.from(document.getElementById('awb-list').children);\n                    rows.forEach((row, index) => {\n                        row.style.display = (index >= start && index < start + perPage) ? '' : 'none';\n                    });\n                };\n                pagination.appendChild(btn);\n            }\n            \/\/ \u9ed8\u8ba4\u663e\u793a\u7b2c\u4e00\u9875\n            const rows = Array.from(document.getElementById('awb-list').children);\n            rows.forEach((row, index) => {\n                row.style.display = (index < perPage) ? '' : 'none';\n            });\n        }\n\n        document.getElementById('add_awb').addEventListener('click', addAwb);\n        document.getElementById('awb_search').addEventListener('input', renderTable);\n        document.getElementById('awb_per_page').addEventListener('change', () => paginate(awbData.length));\n        renderTable();\n    <\/script>\n<\/body>\n<\/html>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7a7a\u8fd0\u63d0\u5355\u7ba1\u7406\u7cfb\u7edf \u63d0\u5355\u7ba1\u7406 \u6dfb\u52a0\u63d0\u5355 50\/\u9875100\/\u9875200\/\u98751000\/\u9875 \u63d0\u5355\u53f7 \u5927\u5305\u6570 \u822a\u73ed\u65f6\u95f4 \u603b\u91cd\u91cf \u63d0\u5355 Manifest \u805a\u5408 \u7a0e\u5355 \u62a5\u5173\u5355 \u6d41\u6c34 \u72b6\u6001 \u64cd\u4f5c<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-8","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/zngeqp.online\/index.php\/wp-json\/wp\/v2\/pages\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zngeqp.online\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/zngeqp.online\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/zngeqp.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zngeqp.online\/index.php\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":6,"href":"https:\/\/zngeqp.online\/index.php\/wp-json\/wp\/v2\/pages\/8\/revisions"}],"predecessor-version":[{"id":15,"href":"https:\/\/zngeqp.online\/index.php\/wp-json\/wp\/v2\/pages\/8\/revisions\/15"}],"wp:attachment":[{"href":"https:\/\/zngeqp.online\/index.php\/wp-json\/wp\/v2\/media?parent=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}