761 lines
		
	
	
		
			26 KiB
		
	
	
	
		
			HTML
		
	
	
	
			
		
		
	
	
			761 lines
		
	
	
		
			26 KiB
		
	
	
	
		
			HTML
		
	
	
	
| <!DOCTYPE html>
 | |
| <html lang="zh-CN">
 | |
| <head>
 | |
|     <meta charset="UTF-8">
 | |
|     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | |
|     <title>积分订单管理</title>
 | |
|     <style>
 | |
|         * {
 | |
|             margin: 0;
 | |
|             padding: 0;
 | |
|             box-sizing: border-box;
 | |
|         }
 | |
| 
 | |
|         body {
 | |
|             font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
 | |
|             background-color: #f5f5f5;
 | |
|             color: #333;
 | |
|         }
 | |
| 
 | |
|         .container {
 | |
|             width: 100%;
 | |
|             margin: 0 auto;
 | |
|             padding: 20px;
 | |
|         }
 | |
| 
 | |
|         .page-header {
 | |
|             background: #fff;
 | |
|             padding: 20px;
 | |
|             margin-bottom: 20px;
 | |
|             border-radius: 6px;
 | |
|             box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
 | |
|         }
 | |
| 
 | |
|         .page-title {
 | |
|             font-size: 24px;
 | |
|             font-weight: 600;
 | |
|             color: #333;
 | |
|             margin-bottom: 20px;
 | |
|         }
 | |
| 
 | |
|         .search-form {
 | |
|             background: #fff;
 | |
|             padding: 20px;
 | |
|             margin-bottom: 20px;
 | |
|             border-radius: 6px;
 | |
|             box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
 | |
|         }
 | |
| 
 | |
|         .form-row {
 | |
|             display: flex;
 | |
|             flex-wrap: wrap;
 | |
|             gap: 15px;
 | |
|             align-items: center;
 | |
|             margin-bottom: 15px;
 | |
|         }
 | |
| 
 | |
|         .form-item {
 | |
|             display: flex;
 | |
|             align-items: center;
 | |
|             gap: 8px;
 | |
|         }
 | |
| 
 | |
|         .form-label {
 | |
|             font-size: 14px;
 | |
|             color: #666;
 | |
|             white-space: nowrap;
 | |
|             min-width: 60px;
 | |
|         }
 | |
| 
 | |
|         .form-input {
 | |
|             padding: 8px 12px;
 | |
|             border: 1px solid #dcdfe6;
 | |
|             border-radius: 4px;
 | |
|             font-size: 14px;
 | |
|             width: 180px;
 | |
|             transition: border-color 0.3s;
 | |
|         }
 | |
| 
 | |
|         .form-input:focus {
 | |
|             outline: none;
 | |
|             border-color: #409eff;
 | |
|             box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
 | |
|         }
 | |
| 
 | |
|         .form-select {
 | |
|             padding: 8px 12px;
 | |
|             border: 1px solid #dcdfe6;
 | |
|             border-radius: 4px;
 | |
|             font-size: 14px;
 | |
|             width: 180px;
 | |
|             background: #fff;
 | |
|             cursor: pointer;
 | |
|             transition: border-color 0.3s;
 | |
|         }
 | |
| 
 | |
|         .form-select:focus {
 | |
|             outline: none;
 | |
|             border-color: #409eff;
 | |
|             box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
 | |
|         }
 | |
| 
 | |
|         .btn-group {
 | |
|             display: flex;
 | |
|             gap: 10px;
 | |
|             margin-top: 10px;
 | |
|         }
 | |
| 
 | |
|         .btn {
 | |
|             padding: 10px 20px;
 | |
|             border: none;
 | |
|             border-radius: 4px;
 | |
|             font-size: 14px;
 | |
|             cursor: pointer;
 | |
|             transition: all 0.3s;
 | |
|             font-weight: 500;
 | |
|         }
 | |
| 
 | |
|         .btn-primary {
 | |
|             background-color: #409eff;
 | |
|             color: #fff;
 | |
|         }
 | |
| 
 | |
|         .btn-primary:hover {
 | |
|             background-color: #66b1ff;
 | |
|         }
 | |
| 
 | |
|         .btn-success {
 | |
|             background-color: #67c23a;
 | |
|             color: #fff;
 | |
|         }
 | |
| 
 | |
|         .btn-success:hover {
 | |
|             background-color: #85ce61;
 | |
|         }
 | |
| 
 | |
|         .btn-default {
 | |
|             background-color: #fff;
 | |
|             color: #606266;
 | |
|             border: 1px solid #dcdfe6;
 | |
|         }
 | |
| 
 | |
|         .btn-default:hover {
 | |
|             color: #409eff;
 | |
|             border-color: #c6e2ff;
 | |
|             background-color: #ecf5ff;
 | |
|         }
 | |
| 
 | |
|         .table-container {
 | |
|             background: #fff;
 | |
|             border-radius: 6px;
 | |
|             box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
 | |
|             overflow: hidden;
 | |
|         }
 | |
| 
 | |
|         .table-wrapper {
 | |
|             overflow-x: auto;
 | |
|         }
 | |
| 
 | |
|         .data-table {
 | |
|             width: 100%;
 | |
|             border-collapse: collapse;
 | |
|             font-size: 14px;
 | |
|         }
 | |
| 
 | |
|         .data-table th {
 | |
|             background-color: #fafafa;
 | |
|             color: #606266;
 | |
|             font-weight: 500;
 | |
|             padding: 12px 6px;
 | |
|             text-align: left;
 | |
|             border-bottom: 1px solid #ebeef5;
 | |
|             white-space: nowrap;
 | |
|             min-width: 80px;
 | |
|             font-size: 13px;
 | |
|         }
 | |
| 
 | |
|         .data-table td {
 | |
|             padding: 12px 6px;
 | |
|             border-bottom: 1px solid #ebeef5;
 | |
|             color: #606266;
 | |
|             white-space: nowrap;
 | |
|             font-size: 13px;
 | |
|         }
 | |
| 
 | |
|         .data-table tr:hover {
 | |
|             background-color: #f5f7fa;
 | |
|         }
 | |
| 
 | |
|         .status-tag {
 | |
|             padding: 2px 8px;
 | |
|             border-radius: 12px;
 | |
|             font-size: 12px;
 | |
|             font-weight: 500;
 | |
|         }
 | |
| 
 | |
|         .status-pending {
 | |
|             background-color: #fff7e6;
 | |
|             color: #fa8c16;
 | |
|         }
 | |
| 
 | |
|         .status-processing {
 | |
|             background-color: #e6f7ff;
 | |
|             color: #1890ff;
 | |
|         }
 | |
| 
 | |
|         .status-completed {
 | |
|             background-color: #f6ffed;
 | |
|             color: #52c41a;
 | |
|         }
 | |
| 
 | |
|         .no-data {
 | |
|             text-align: center;
 | |
|             padding: 60px 20px;
 | |
|             color: #999;
 | |
|             font-size: 16px;
 | |
|         }
 | |
| 
 | |
|         .operation-btn {
 | |
|             padding: 4px 8px;
 | |
|             margin: 0 2px;
 | |
|             border: 1px solid #409eff;
 | |
|             background: transparent;
 | |
|             color: #409eff;
 | |
|             border-radius: 3px;
 | |
|             cursor: pointer;
 | |
|             font-size: 12px;
 | |
|             transition: all 0.3s;
 | |
|         }
 | |
| 
 | |
|         .operation-btn:hover {
 | |
|             background-color: #409eff;
 | |
|             color: #fff;
 | |
|         }
 | |
| 
 | |
|         .expand-btn {
 | |
|             cursor: pointer;
 | |
|             user-select: none;
 | |
|             font-size: 12px;
 | |
|             color: #409eff;
 | |
|             transition: transform 0.2s;
 | |
|         }
 | |
| 
 | |
|         .expand-btn:hover {
 | |
|             transform: scale(1.1);
 | |
|         }
 | |
| 
 | |
|         .child-table {
 | |
|             width: 100%;
 | |
|             margin: 10px 0;
 | |
|             background-color: #fafafa;
 | |
|             border-radius: 4px;
 | |
|         }
 | |
| 
 | |
|         .child-table th {
 | |
|             background-color: #f0f0f0;
 | |
|             font-weight: 500;
 | |
|             font-size: 12px;
 | |
|         }
 | |
| 
 | |
|         .child-table td {
 | |
|             font-size: 12px;
 | |
|             background-color: #fafafa;
 | |
|         }
 | |
| 
 | |
|         .parent-row:hover {
 | |
|             background-color: #f5f7fa;
 | |
|         }
 | |
| 
 | |
|         .child-row td {
 | |
|             padding: 0;
 | |
|             border-bottom: none;
 | |
|         }
 | |
| 
 | |
|         /* 三级表格样式 */
 | |
|         .level1-row {
 | |
|             background-color: #fff;
 | |
|         }
 | |
| 
 | |
|         .level1-row:hover {
 | |
|             background-color: #f5f7fa;
 | |
|         }
 | |
| 
 | |
|         .level2-container td {
 | |
|             padding: 0;
 | |
|             border-bottom: none;
 | |
|         }
 | |
| 
 | |
|         .level2-table {
 | |
|             margin: 5px 0;
 | |
|             background-color: #f8f9fa;
 | |
|         }
 | |
| 
 | |
|         .level2-table th {
 | |
|             background-color: #eef1f6;
 | |
|             font-size: 12px;
 | |
|             padding: 8px 6px;
 | |
|         }
 | |
| 
 | |
|         .level2-table td {
 | |
|             background-color: #f8f9fa;
 | |
|             font-size: 12px;
 | |
|             padding: 8px 6px;
 | |
|         }
 | |
| 
 | |
|         .level2-row:hover {
 | |
|             background-color: #ecf5ff;
 | |
|         }
 | |
| 
 | |
|         .level3-container td {
 | |
|             padding: 0;
 | |
|             border-bottom: none;
 | |
|         }
 | |
| 
 | |
|         .level3-table {
 | |
|             margin: 5px 0;
 | |
|             background-color: #fafbfc;
 | |
|         }
 | |
| 
 | |
|         .level3-table th {
 | |
|             background-color: #e8eaec;
 | |
|             font-size: 11px;
 | |
|             padding: 6px 4px;
 | |
|         }
 | |
| 
 | |
|         .level3-table td {
 | |
|             background-color: #fafbfc;
 | |
|             font-size: 11px;
 | |
|             padding: 6px 4px;
 | |
|         }
 | |
| 
 | |
|         .level3-table tr:hover {
 | |
|             background-color: #f0f9ff;
 | |
|         }
 | |
| 
 | |
|         @media (max-width: 768px) {
 | |
|             .container {
 | |
|                 padding: 10px;
 | |
|             }
 | |
| 
 | |
|             .form-row {
 | |
|                 flex-direction: column;
 | |
|                 align-items: stretch;
 | |
|             }
 | |
| 
 | |
|             .form-item {
 | |
|                 flex-direction: column;
 | |
|                 align-items: stretch;
 | |
|                 gap: 5px;
 | |
|             }
 | |
| 
 | |
|             .form-input,
 | |
|             .form-select {
 | |
|                 width: 100%;
 | |
|             }
 | |
| 
 | |
|             .btn-group {
 | |
|                 flex-wrap: wrap;
 | |
|             }
 | |
| 
 | |
|             .data-table th,
 | |
|             .data-table td {
 | |
|                 min-width: 80px;
 | |
|                 font-size: 12px;
 | |
|                 padding: 8px 6px;
 | |
|             }
 | |
|         }
 | |
|     </style>
 | |
| </head>
 | |
| <body>
 | |
|     <div class="container">
 | |
|         <div class="page-header">
 | |
|             <h1 class="page-title">积分订单管理</h1>
 | |
|         </div>
 | |
| 
 | |
|         <div class="search-form">
 | |
|             <div class="form-row">
 | |
|                 <div class="form-item">
 | |
|                     <label class="form-label">摊铺:</label>
 | |
|                     <select class="form-select" id="storeSelect">
 | |
|                         <option value="">全部</option>
 | |
|                         <option value="store1">牛牛蔬菜店</option>
 | |
|                         <option value="store2">小明水果店</option>
 | |
|                         <option value="store3">王记杂货铺</option>
 | |
|                     </select>
 | |
|                 </div>
 | |
| 
 | |
|                 <div class="form-item">
 | |
|                     <label class="form-label">商品名称:</label>
 | |
|                     <input type="text" class="form-input" placeholder="商品名称" id="productName">
 | |
|                 </div>
 | |
| 
 | |
|                 <div class="form-item">
 | |
|                     <label class="form-label">订单状态:</label>
 | |
|                     <select class="form-select" id="orderStatus">
 | |
|                         <option value="">全部订单</option>
 | |
|                         <option value="pending">待备货</option>
 | |
|                         <option value="preparing">待取货</option>
 | |
|                         <option value="shipping">待收货</option>
 | |
|                         <option value="completed">已完成</option>
 | |
|                     </select>
 | |
|                 </div>
 | |
| 
 | |
|                 <div class="btn-group">
 | |
|                     <button class="btn btn-primary" onclick="searchOrders()">查询</button>
 | |
|                     <button class="btn btn-default" onclick="resetForm()">重置</button>
 | |
|                 </div>
 | |
|             </div>
 | |
|         </div>
 | |
| 
 | |
|         <div class="table-container">
 | |
|             <div class="table-wrapper">
 | |
|                 <table class="data-table" id="ordersTable">
 | |
|                     <thead>
 | |
|                         <tr>
 | |
|                             <th style="width: 40px;"></th>
 | |
|                             <th>结算单位订单号</th>
 | |
|                             <th>摊位</th>
 | |
|                             <th>订单状态</th>
 | |
|                             <th>配送费</th>
 | |
|                             <th>打包费</th>
 | |
|                             <th>调度费</th>
 | |
|                             <th>总费用</th>
 | |
|                             <th>支付时间</th>
 | |
|                         </tr>
 | |
|                     </thead>
 | |
|                     <tbody id="ordersTableBody">
 | |
|                         <!-- 数据将通过JavaScript动态生成 -->
 | |
|                     </tbody>
 | |
|                 </table>
 | |
|             </div>
 | |
|             <div class="no-data" id="noDataMsg" style="display: none;">
 | |
|                 暂无数据
 | |
|             </div>
 | |
|         </div>
 | |
|     </div>
 | |
| 
 | |
|     <script>
 | |
|         // 模拟结算订单数据(三级表格数据)
 | |
|         const settlementOrders = [
 | |
|             {
 | |
|                 settlementOrderNo: 'SU2024010001',
 | |
|                 status: '已完成',
 | |
|                 deliveryFee: 8.00,
 | |
|                 packageFee: 2.00,
 | |
|                 dispatchFee: 3.00,
 | |
|                 totalFee: 13.00,
 | |
|                 paymentTime: '2024-01-15 14:30:22',
 | |
|                 // 店铺订单(二级表格数据)
 | |
|                 storeOrders: [
 | |
|                     {
 | |
|                         storeOrderNo: 'SO2024010001',
 | |
|                         booth: '牛牛蔬菜店',
 | |
|                         // 商品明细(三级表格数据)
 | |
|                         items: [
 | |
|                             {
 | |
|                                 productOrderNo: 'PO2024010001',
 | |
|                                 productName: '有机蔬菜礼盒',
 | |
|                                 originalPrice: 158.00,
 | |
|                                 productQuantity: 2,
 | |
|                                 pointsUsed: 200,
 | |
|                                 customerPayment: 0.00,
 | |
|                                 pointsType: '积分换购',
 | |
|                                 status: '已完成'
 | |
|                             }
 | |
|                         ]
 | |
|                     }
 | |
|                 ]
 | |
|             },
 | |
|             {
 | |
|                 settlementOrderNo: 'SU2024010002',
 | |
|                 status: '待备货',
 | |
|                 deliveryFee: 6.00,
 | |
|                 packageFee: 1.50,
 | |
|                 dispatchFee: 2.00,
 | |
|                 totalFee: 9.50,
 | |
|                 paymentTime: '2024-01-15 15:45:10',
 | |
|                 storeOrders: [
 | |
|                     {
 | |
|                         storeOrderNo: 'SO2024010002',
 | |
|                         booth: '小明水果店',
 | |
|                         items: [
 | |
|                             {
 | |
|                                 productOrderNo: 'PO2024010002',
 | |
|                                 productName: '进口苹果',
 | |
|                                 originalPrice: 105.00,
 | |
|                                 productQuantity: 1,
 | |
|                                 pointsUsed: 150,
 | |
|                                 customerPayment: 52.50,
 | |
|                                 pointsType: '积分优惠购',
 | |
|                                 status: '待备货'
 | |
|                             }
 | |
|                         ]
 | |
|                     }
 | |
|                 ]
 | |
|             },
 | |
|             {
 | |
|                 settlementOrderNo: 'SU2024010003',
 | |
|                 status: '待取货',
 | |
|                 deliveryFee: 10.00,
 | |
|                 packageFee: 3.00,
 | |
|                 dispatchFee: 4.00,
 | |
|                 totalFee: 17.00,
 | |
|                 paymentTime: '2024-01-15 16:20:35',
 | |
|                 storeOrders: [
 | |
|                     {
 | |
|                         storeOrderNo: 'SO2024010003',
 | |
|                         booth: '王记杂货铺',
 | |
|                         items: [
 | |
|                             {
 | |
|                                 productOrderNo: 'PO2024010003',
 | |
|                                 productName: '新鲜牛奶',
 | |
|                                 originalPrice: 268.00,
 | |
|                                 productQuantity: 4,
 | |
|                                 pointsUsed: 380,
 | |
|                                 customerPayment: 0.00,
 | |
|                                 pointsType: '积分换购',
 | |
|                                 status: '待取货'
 | |
|                             }
 | |
|                         ]
 | |
|                     }
 | |
|                 ]
 | |
|             },
 | |
|             {
 | |
|                 settlementOrderNo: 'SU2024010004',
 | |
|                 status: '待收货',
 | |
|                 deliveryFee: 15.00,
 | |
|                 packageFee: 4.50,
 | |
|                 dispatchFee: 5.00,
 | |
|                 totalFee: 24.50,
 | |
|                 paymentTime: '2024-01-15 17:35:28',
 | |
|                 storeOrders: [
 | |
|                     {
 | |
|                         storeOrderNo: 'SO2024010004',
 | |
|                         booth: '牛牛蔬菜店',
 | |
|                         items: [
 | |
|                             {
 | |
|                                 productOrderNo: 'PO2024010004',
 | |
|                                 productName: '精品牛肉',
 | |
|                                 originalPrice: 456.00,
 | |
|                                 productQuantity: 6,
 | |
|                                 pointsUsed: 580,
 | |
|                                 customerPayment: 228.00,
 | |
|                                 pointsType: '积分优惠购',
 | |
|                                 status: '待收货'
 | |
|                             }
 | |
|                         ]
 | |
|                     }
 | |
|                 ]
 | |
|             }
 | |
|         ];
 | |
| 
 | |
|         // 渲染三级表格数据
 | |
|         function renderTable(data = []) {
 | |
|             const tbody = document.getElementById('ordersTableBody');
 | |
|             const noDataMsg = document.getElementById('noDataMsg');
 | |
|             
 | |
|             if (data.length === 0) {
 | |
|                 tbody.innerHTML = '';
 | |
|                 noDataMsg.style.display = 'block';
 | |
|                 return;
 | |
|             }
 | |
| 
 | |
|             noDataMsg.style.display = 'none';
 | |
|             
 | |
|             tbody.innerHTML = data.map((settlementOrder, settlementIndex) => `
 | |
|                 <!-- 第一层:结算单位订单 -->
 | |
|                 <tr class="level1-row" data-settlement-index="${settlementIndex}">
 | |
|                     <td><span class="expand-btn level1-expand">▶</span></td>
 | |
|                     <td>${settlementOrder.settlementOrderNo}</td>
 | |
|                     <td>-</td>
 | |
|                     <td><span class="status-tag ${getStatusClass(settlementOrder.status)}">${settlementOrder.status}</span></td>
 | |
|                     <td>¥${settlementOrder.deliveryFee.toFixed(2)}</td>
 | |
|                     <td>¥${settlementOrder.packageFee.toFixed(2)}</td>
 | |
|                     <td>¥${settlementOrder.dispatchFee.toFixed(2)}</td>
 | |
|                     <td>¥${settlementOrder.totalFee.toFixed(2)}</td>
 | |
|                     <td>${settlementOrder.paymentTime}</td>
 | |
|                 </tr>
 | |
|                 <!-- 第二层:店铺订单 -->
 | |
|                 <tr class="level2-container" data-settlement-index="${settlementIndex}" style="display: none;">
 | |
|                     <td colspan="9">
 | |
|                         <table class="data-table child-table level2-table">
 | |
|                             <thead>
 | |
|                                 <tr>
 | |
|                                     <th style="width: 40px;"></th>
 | |
|                                     <th>店铺订单号</th>
 | |
|                                     <th>摊位</th>
 | |
|                                     <th colspan="6"></th>
 | |
|                                 </tr>
 | |
|                             </thead>
 | |
|                             <tbody>
 | |
|                                 ${settlementOrder.storeOrders.map((storeOrder, storeIndex) => `
 | |
|                                     <tr class="level2-row" data-settlement-index="${settlementIndex}" data-store-index="${storeIndex}">
 | |
|                                         <td><span class="expand-btn level2-expand">▶</span></td>
 | |
|                                         <td>${storeOrder.storeOrderNo}</td>
 | |
|                                         <td>${storeOrder.booth}</td>
 | |
|                                         <td colspan="6"></td>
 | |
|                                     </tr>
 | |
|                                     <!-- 第三层:商品详情 -->
 | |
|                                     <tr class="level3-container" data-settlement-index="${settlementIndex}" data-store-index="${storeIndex}" style="display: none;">
 | |
|                                         <td colspan="9">
 | |
|                                             <table class="data-table child-table level3-table">
 | |
|                                                 <thead>
 | |
|                                                     <tr>
 | |
|                                                         <th>商品订单号</th>
 | |
|                                                         <th>商品名称</th>
 | |
|                                                         <th>商品原价</th>
 | |
|                                                         <th>商品数量</th>
 | |
|                                                         <th>消耗积分</th>
 | |
|                                                         <th>顾客支付</th>
 | |
|                                                         <th>积分类型</th>
 | |
|                                                     </tr>
 | |
|                                                 </thead>
 | |
|                                                 <tbody>
 | |
|                                                     ${storeOrder.items.map(item => `
 | |
|                                                         <tr>
 | |
|                                                             <td>${item.productOrderNo}</td>
 | |
|                                                             <td>${item.productName}</td>
 | |
|                                                             <td>¥${item.originalPrice.toFixed(2)}</td>
 | |
|                                                             <td>${item.productQuantity}</td>
 | |
|                                                             <td>${item.pointsUsed}</td>
 | |
|                                                             <td>¥${item.customerPayment.toFixed(2)}</td>
 | |
|                                                             <td>${item.pointsType}</td>
 | |
|                                                         </tr>
 | |
|                                                     `).join('')}
 | |
|                                                 </tbody>
 | |
|                                             </table>
 | |
|                                         </td>
 | |
|                                     </tr>
 | |
|                                 `).join('')}
 | |
|                             </tbody>
 | |
|                         </table>
 | |
|                     </td>
 | |
|                 </tr>
 | |
|             `).join('');
 | |
|             
 | |
|             // 添加三级展开/折叠事件监听器
 | |
|             addExpandListeners();
 | |
|         }
 | |
| 
 | |
|         // 添加三级展开/折叠事件监听器
 | |
|         function addExpandListeners() {
 | |
|             // 第一层展开/折叠(结算单位订单)
 | |
|             document.querySelectorAll('.level1-expand').forEach(btn => {
 | |
|                 btn.addEventListener('click', function() {
 | |
|                     const settlementIndex = this.closest('tr').dataset.settlementIndex;
 | |
|                     toggleLevel2(settlementIndex, this);
 | |
|                 });
 | |
|             });
 | |
|             
 | |
|             // 第二层展开/折叠(店铺订单)
 | |
|             document.querySelectorAll('.level2-expand').forEach(btn => {
 | |
|                 btn.addEventListener('click', function() {
 | |
|                     const settlementIndex = this.closest('tr').dataset.settlementIndex;
 | |
|                     const storeIndex = this.closest('tr').dataset.storeIndex;
 | |
|                     toggleLevel3(settlementIndex, storeIndex, this);
 | |
|                 });
 | |
|             });
 | |
|         }
 | |
|         
 | |
|         // 展开/折叠第二层(店铺订单)
 | |
|         function toggleLevel2(settlementIndex, expandBtn) {
 | |
|             const level2Container = document.querySelector(`.level2-container[data-settlement-index="${settlementIndex}"]`);
 | |
|             
 | |
|             if (level2Container.style.display === 'none' || level2Container.style.display === '') {
 | |
|                 level2Container.style.display = 'table-row';
 | |
|                 expandBtn.textContent = '▼';
 | |
|             } else {
 | |
|                 level2Container.style.display = 'none';
 | |
|                 expandBtn.textContent = '▶';
 | |
|                 // 同时关闭所有第三层
 | |
|                 const level3Containers = document.querySelectorAll(`.level3-container[data-settlement-index="${settlementIndex}"]`);
 | |
|                 level3Containers.forEach(container => {
 | |
|                     container.style.display = 'none';
 | |
|                 });
 | |
|                 // 重置第二层展开按钮
 | |
|                 const level2Btns = document.querySelectorAll(`.level2-expand[data-settlement-index="${settlementIndex}"]`);
 | |
|                 level2Btns.forEach(btn => btn.textContent = '▶');
 | |
|             }
 | |
|         }
 | |
|         
 | |
|         // 展开/折叠第三层(商品详情)
 | |
|         function toggleLevel3(settlementIndex, storeIndex, expandBtn) {
 | |
|             const level3Container = document.querySelector(`.level3-container[data-settlement-index="${settlementIndex}"][data-store-index="${storeIndex}"]`);
 | |
|             
 | |
|             if (level3Container.style.display === 'none' || level3Container.style.display === '') {
 | |
|                 level3Container.style.display = 'table-row';
 | |
|                 expandBtn.textContent = '▼';
 | |
|             } else {
 | |
|                 level3Container.style.display = 'none';
 | |
|                 expandBtn.textContent = '▶';
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         // 获取状态样式类
 | |
|         function getStatusClass(status) {
 | |
|             const statusMap = {
 | |
|                 '待备货': 'status-pending',
 | |
|                 '待取货': 'status-processing',
 | |
|                 '待收货': 'status-processing',
 | |
|                 '已完成': 'status-completed'
 | |
|             };
 | |
|             return statusMap[status] || 'status-pending';
 | |
|         }
 | |
| 
 | |
|         // 搜索订单
 | |
|         function searchOrders() {
 | |
|             const storeSelect = document.getElementById('storeSelect').value;
 | |
|             const productName = document.getElementById('productName').value;
 | |
|             const orderStatus = document.getElementById('orderStatus').value;
 | |
| 
 | |
|             // 这里应该调用后端API进行搜索
 | |
|             console.log('搜索参数:', { storeSelect, productName, orderStatus });
 | |
|             
 | |
|             // 模拟搜索结果
 | |
|             let filteredOrders = [...settlementOrders];
 | |
|             
 | |
|             if (orderStatus) {
 | |
|                 const statusMap = {
 | |
|                     'pending': '待备货',
 | |
|                     'preparing': '待取货',
 | |
|                     'shipping': '待收货',
 | |
|                     'completed': '已完成'
 | |
|                 };
 | |
|                 filteredOrders = filteredOrders.filter(order => 
 | |
|                     order.status === statusMap[orderStatus]
 | |
|                 );
 | |
|             }
 | |
| 
 | |
|             renderTable(filteredOrders);
 | |
|         }
 | |
| 
 | |
|         // 重置表单
 | |
|         function resetForm() {
 | |
|             document.getElementById('storeSelect').value = '';
 | |
|             document.getElementById('productName').value = '';
 | |
|             document.getElementById('orderStatus').value = '';
 | |
|             renderTable(settlementOrders);
 | |
|         }
 | |
| 
 | |
|         // 导出订单
 | |
|         function exportOrders() {
 | |
|             alert('导出功能开发中...');
 | |
|         }
 | |
| 
 | |
|         // 查看订单
 | |
|         function viewOrder(orderNo) {
 | |
|             alert(`查看订单: ${orderNo}`);
 | |
|         }
 | |
| 
 | |
|         // 编辑订单
 | |
|         function editOrder(orderNo) {
 | |
|             alert(`编辑订单: ${orderNo}`);
 | |
|         }
 | |
| 
 | |
|         // 页面加载完成后初始化
 | |
|         document.addEventListener('DOMContentLoaded', function() {
 | |
|             renderTable(settlementOrders);
 | |
|         });
 | |
|     </script>
 | |
| </body>
 | |
| </html> |