522 lines
		
	
	
		
			18 KiB
		
	
	
	
		
			HTML
		
	
	
	
			
		
		
	
	
			522 lines
		
	
	
		
			18 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>
 | |
|     <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
 | |
|     <style>
 | |
|         * {
 | |
|             margin: 0;
 | |
|             padding: 0;
 | |
|             box-sizing: border-box;
 | |
|         }
 | |
| 
 | |
|         body {
 | |
|             font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;
 | |
|             background-color: #f5f5f5;
 | |
|             color: #333;
 | |
|             overflow-x: hidden;
 | |
|         }
 | |
| 
 | |
|         .container {
 | |
|             max-width: 1400px;
 | |
|             margin: 0 auto;
 | |
|             padding: 30px;
 | |
|         }
 | |
| 
 | |
|         /* 顶部筛选区域 */
 | |
|         .filter-section {
 | |
|             background: #fff;
 | |
|             padding: 20px;
 | |
|             border-radius: 8px;
 | |
|             margin-bottom: 30px;
 | |
|             box-shadow: 0 2px 8px rgba(0,0,0,0.1);
 | |
|         }
 | |
| 
 | |
|         .filter-row {
 | |
|             display: flex;
 | |
|             align-items: center;
 | |
|             gap: 20px;
 | |
|             flex-wrap: wrap;
 | |
|         }
 | |
| 
 | |
|         .filter-item {
 | |
|             display: flex;
 | |
|             align-items: center;
 | |
|             gap: 10px;
 | |
|         }
 | |
| 
 | |
|         .filter-item label {
 | |
|             font-weight: 500;
 | |
|             color: #333;
 | |
|             min-width: 70px;
 | |
|         }
 | |
| 
 | |
|         .filter-item select,
 | |
|         .filter-item input {
 | |
|             padding: 8px 12px;
 | |
|             border: 1px solid #d9d9d9;
 | |
|             border-radius: 4px;
 | |
|             min-width: 120px;
 | |
|             font-size: 14px;
 | |
|             transition: all 0.3s ease;
 | |
|         }
 | |
| 
 | |
|         .filter-item select:focus,
 | |
|         .filter-item input:focus {
 | |
|             border-color: #1890ff;
 | |
|             box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
 | |
|             outline: none;
 | |
|         }
 | |
| 
 | |
|         .btn {
 | |
|             padding: 10px 20px;
 | |
|             border-radius: 5px;
 | |
|             font-size: 14px;
 | |
|             font-weight: 500;
 | |
|             transition: all 0.3s ease;
 | |
|             display: inline-flex;
 | |
|             align-items: center;
 | |
|             gap: 5px;
 | |
|             border: none;
 | |
|             cursor: pointer;
 | |
|         }
 | |
| 
 | |
|         .btn-primary {
 | |
|             background-color: #1890ff;
 | |
|             color: #fff;
 | |
|         }
 | |
| 
 | |
|         .btn-primary:hover {
 | |
|             background-color: #40a9ff;
 | |
|             transform: translateY(-2px);
 | |
|         }
 | |
| 
 | |
|         .btn-success {
 | |
|             background-color: #52c41a;
 | |
|             color: #fff;
 | |
|         }
 | |
| 
 | |
|         .btn-success:hover {
 | |
|             background-color: #73d13d;
 | |
|             transform: translateY(-2px);
 | |
|         }
 | |
| 
 | |
|         /* 商品整体概况 */
 | |
|         .product-overview {
 | |
|             background: #fff;
 | |
|             border-radius: 8px;
 | |
|             padding: 20px;
 | |
|             margin-bottom: 30px;
 | |
|             box-shadow: 0 2px 8px rgba(0,0,0,0.1);
 | |
|         }
 | |
| 
 | |
|         .overview-title {
 | |
|             font-size: 18px;
 | |
|             font-weight: 600;
 | |
|             margin-bottom: 20px;
 | |
|             color: #333;
 | |
|         }
 | |
| 
 | |
|         .stats-grid {
 | |
|             display: grid;
 | |
|             grid-template-columns: repeat(3, 1fr);
 | |
|             gap: 20px;
 | |
|         }
 | |
| 
 | |
|         .stat-card {
 | |
|             text-align: left;
 | |
|             padding: 0;
 | |
|         }
 | |
| 
 | |
|         .stat-label {
 | |
|             font-size: 14px;
 | |
|             color: #666;
 | |
|             margin-bottom: 8px;
 | |
|         }
 | |
| 
 | |
|         .stat-value {
 | |
|             font-size: 24px;
 | |
|             font-weight: 600;
 | |
|             color: #333;
 | |
|         }
 | |
| 
 | |
|         /* 排行榜区域 */
 | |
|         .ranking-section {
 | |
|             background: #fff;
 | |
|             border-radius: 8px;
 | |
|             padding: 20px;
 | |
|             margin-bottom: 30px;
 | |
|             box-shadow: 0 2px 8px rgba(0,0,0,0.1);
 | |
|         }
 | |
| 
 | |
|         .ranking-title {
 | |
|             font-size: 16px;
 | |
|             font-weight: 600;
 | |
|             margin-bottom: 20px;
 | |
|             color: #333;
 | |
|         }
 | |
| 
 | |
|         .ranking-grid {
 | |
|             display: grid;
 | |
|             grid-template-columns: 1fr 1fr;
 | |
|             gap: 40px;
 | |
|         }
 | |
| 
 | |
|         .ranking-table {
 | |
|             width: 100%;
 | |
|             border-collapse: collapse;
 | |
|         }
 | |
| 
 | |
|         .ranking-table th {
 | |
|             background-color: #fafafa;
 | |
|             padding: 12px;
 | |
|             text-align: left;
 | |
|             border-bottom: 1px solid #e8e8e8;
 | |
|             font-weight: 500;
 | |
|             color: #333;
 | |
|         }
 | |
| 
 | |
|         .ranking-table td {
 | |
|             padding: 12px;
 | |
|             border-bottom: 1px solid #e8e8e8;
 | |
|             color: #666;
 | |
|         }
 | |
| 
 | |
|         .ranking-table tbody tr:hover {
 | |
|             background-color: #f5f5f5;
 | |
|         }
 | |
| 
 | |
|         .no-data {
 | |
|             text-align: center;
 | |
|             color: #999;
 | |
|             padding: 40px 0;
 | |
|             font-size: 14px;
 | |
|         }
 | |
| 
 | |
|         /* 响应式设计 */
 | |
|         @media (max-width: 768px) {
 | |
|             .container {
 | |
|                 padding: 20px;
 | |
|             }
 | |
| 
 | |
|             .stats-grid {
 | |
|                 grid-template-columns: 1fr;
 | |
|             }
 | |
| 
 | |
|             .ranking-grid {
 | |
|                 grid-template-columns: 1fr;
 | |
|                 gap: 20px;
 | |
|             }
 | |
| 
 | |
|             .filter-row {
 | |
|                 flex-direction: column;
 | |
|                 align-items: flex-start;
 | |
|                 gap: 15px;
 | |
|             }
 | |
|         }
 | |
|     </style>
 | |
| </head>
 | |
| <body>
 | |
|     <div class="container">
 | |
|         <!-- 筛选区域 -->
 | |
|         <div class="filter-section">
 | |
|             <div class="filter-row">
 | |
|                 <div class="filter-item">
 | |
|                     <label for="dateRange">日期范围:</label>
 | |
|                     <select id="dateRange">
 | |
|                         <option value="today">近1天</option>
 | |
|                         <option value="week" selected>近7天</option>
 | |
|                         <option value="month">近30天</option>
 | |
|                         <option value="custom">自定义</option>
 | |
|                     </select>
 | |
|                 </div>
 | |
|                 <div class="filter-item" id="customDateRange" style="display: none;">
 | |
|                     <label for="startDate">开始日期:</label>
 | |
|                     <input type="date" id="startDate">
 | |
|                     <label for="endDate">结束日期:</label>
 | |
|                     <input type="date" id="endDate">
 | |
|                 </div>
 | |
|                 <button class="btn btn-primary" onclick="queryData()">
 | |
|                     <span>查询</span>
 | |
|                 </button>
 | |
|                 <button class="btn btn-success" onclick="exportData()">
 | |
|                     <span>导出</span>
 | |
|                 </button>
 | |
|             </div>
 | |
|         </div>
 | |
| 
 | |
|         <!-- 商品整体概况 -->
 | |
|         <div class="product-overview">
 | |
|             <h2 class="overview-title">商品整体概况</h2>
 | |
|             <div class="stats-grid">
 | |
|                 <div class="stat-card">
 | |
|                     <div class="stat-label">在售商品数</div>
 | |
|                     <div class="stat-value" id="onSaleProducts">29</div>
 | |
|                 </div>
 | |
|                 <div class="stat-card">
 | |
|                     <div class="stat-label">被访问商品数</div>
 | |
|                     <div class="stat-value" id="visitedProducts">0</div>
 | |
|                 </div>
 | |
|                 <div class="stat-card">
 | |
|                     <div class="stat-label">折扣商品数</div>
 | |
|                     <div class="stat-value" id="discountProducts">0</div>
 | |
|                 </div>
 | |
|                 <div class="stat-card">
 | |
|                     <div class="stat-label">预售商品数</div>
 | |
|                     <div class="stat-value" id="presaleProducts">17</div>
 | |
|                 </div>
 | |
|                 <div class="stat-card">
 | |
|                     <div class="stat-label">商品浏览量</div>
 | |
|                     <div class="stat-value" id="productViews">0</div>
 | |
|                 </div>
 | |
|                 <div class="stat-card">
 | |
|                     <div class="stat-label">商品加购人数</div>
 | |
|                     <div class="stat-value" id="addToCartUsers">0</div>
 | |
|                 </div>
 | |
|                 <div class="stat-card">
 | |
|                     <div class="stat-label">商品加购件数</div>
 | |
|                     <div class="stat-value" id="addToCartItems">0</div>
 | |
|                 </div>
 | |
|                 <div class="stat-card">
 | |
|                     <div class="stat-label">商品点赞件数</div>
 | |
|                     <div class="stat-value" id="productLikes">0</div>
 | |
|                 </div>
 | |
|                 <div class="stat-card">
 | |
|                     <div class="stat-label">商品支付件数</div>
 | |
|                     <div class="stat-value" id="productOrders">0</div>
 | |
|                 </div>
 | |
|             </div>
 | |
|         </div>
 | |
| 
 | |
|         <!-- 商品排行 -->
 | |
|         <div class="ranking-section">
 | |
|             <h2 class="ranking-title">商品排行</h2>
 | |
| 
 | |
|             <!-- 商品访客数TOP -->
 | |
|             <div style="margin-bottom: 40px;">
 | |
|                 <h3 style="font-size: 16px; font-weight: 500; margin-bottom: 15px; color: #333;">商品访客数TOP</h3>
 | |
|                 <div class="ranking-grid">
 | |
|                     <div>
 | |
|                         <table class="ranking-table">
 | |
|                             <thead>
 | |
|                                 <tr>
 | |
|                                     <th>排名</th>
 | |
|                                     <th>商品名称</th>
 | |
|                                     <th>访客数</th>
 | |
|                                 </tr>
 | |
|                             </thead>
 | |
|                             <tbody id="visitorRankingTable">
 | |
|                                 <tr>
 | |
|                                     <td colspan="3" class="no-data">暂无数据</td>
 | |
|                                 </tr>
 | |
|                             </tbody>
 | |
|                         </table>
 | |
|                     </div>
 | |
| 
 | |
|                     <!-- 商品支付转化率TOP -->
 | |
|                     <div>
 | |
|                         <h3 style="font-size: 16px; font-weight: 500; margin-bottom: 15px; color: #333;">商品支付转化率TOP</h3>
 | |
|                         <table class="ranking-table">
 | |
|                             <thead>
 | |
|                                 <tr>
 | |
|                                     <th>排名</th>
 | |
|                                     <th>商品名称</th>
 | |
|                                     <th>支付转化率 (%)</th>
 | |
|                                 </tr>
 | |
|                             </thead>
 | |
|                             <tbody id="conversionRankingTable">
 | |
|                                 <tr>
 | |
|                                     <td colspan="3" class="no-data">暂无数据</td>
 | |
|                                 </tr>
 | |
|                             </tbody>
 | |
|                         </table>
 | |
|                     </div>
 | |
|                 </div>
 | |
|             </div>
 | |
| 
 | |
|             <!-- 销售量TOP -->
 | |
|             <div style="margin-bottom: 40px;">
 | |
|                 <h3 style="font-size: 16px; font-weight: 500; margin-bottom: 15px; color: #333;">销售量TOP</h3>
 | |
|                 <div class="ranking-grid">
 | |
|                     <div>
 | |
|                         <table class="ranking-table">
 | |
|                             <thead>
 | |
|                                 <tr>
 | |
|                                     <th>排名</th>
 | |
|                                     <th>商品名称</th>
 | |
|                                     <th>销售量</th>
 | |
|                                 </tr>
 | |
|                             </thead>
 | |
|                             <tbody id="salesVolumeRankingTable">
 | |
|                                 <tr>
 | |
|                                     <td colspan="3" class="no-data">暂无数据</td>
 | |
|                                 </tr>
 | |
|                             </tbody>
 | |
|                         </table>
 | |
|                     </div>
 | |
| 
 | |
|                     <!-- 销售额TOP -->
 | |
|                     <div>
 | |
|                         <h3 style="font-size: 16px; font-weight: 500; margin-bottom: 15px; color: #333;">销售额TOP</h3>
 | |
|                         <table class="ranking-table">
 | |
|                             <thead>
 | |
|                                 <tr>
 | |
|                                     <th>排名</th>
 | |
|                                     <th>商品名称</th>
 | |
|                                     <th>销售额</th>
 | |
|                                 </tr>
 | |
|                             </thead>
 | |
|                             <tbody id="salesAmountRankingTable">
 | |
|                                 <tr>
 | |
|                                     <td colspan="3" class="no-data">暂无数据</td>
 | |
|                                 </tr>
 | |
|                             </tbody>
 | |
|                         </table>
 | |
|                     </div>
 | |
|                 </div>
 | |
|             </div>
 | |
| 
 | |
|             <!-- 回复率TOP -->
 | |
|             <div>
 | |
|                 <h3 style="font-size: 16px; font-weight: 500; margin-bottom: 15px; color: #333;">回复率TOP</h3>
 | |
|                 <div class="ranking-grid">
 | |
|                     <div>
 | |
|                         <table class="ranking-table">
 | |
|                             <thead>
 | |
|                                 <tr>
 | |
|                                     <th>排名</th>
 | |
|                                     <th>商品名称</th>
 | |
|                                     <th>回复率 (%)</th>
 | |
|                                 </tr>
 | |
|                             </thead>
 | |
|                             <tbody id="replyRateRankingTable">
 | |
|                                 <tr>
 | |
|                                     <td colspan="3" class="no-data">暂无数据</td>
 | |
|                                 </tr>
 | |
|                             </tbody>
 | |
|                         </table>
 | |
|                     </div>
 | |
|                     <div></div>
 | |
|                 </div>
 | |
|             </div>
 | |
|         </div>
 | |
|     </div>
 | |
| 
 | |
|     <script>
 | |
|         // 日期范围选择
 | |
|         document.getElementById('dateRange').addEventListener('change', function() {
 | |
|             const customDateRange = document.getElementById('customDateRange');
 | |
|             if (this.value === 'custom') {
 | |
|                 customDateRange.style.display = 'flex';
 | |
|             } else {
 | |
|                 customDateRange.style.display = 'none';
 | |
|             }
 | |
|         });
 | |
| 
 | |
|         // 查询数据
 | |
|         function queryData() {
 | |
|             console.log('查询数据');
 | |
|             // 这里可以添加实际的数据查询逻辑
 | |
|             // 模拟数据更新
 | |
|             loadMockData();
 | |
|         }
 | |
| 
 | |
|         // 导出数据
 | |
|         function exportData() {
 | |
|             console.log('导出数据');
 | |
|             // 这里可以添加实际的数据导出逻辑
 | |
|             alert('导出功能开发中...');
 | |
|         }
 | |
| 
 | |
|         // 加载模拟数据
 | |
|         function loadMockData() {
 | |
|             // 更新商品概况数据
 | |
|             const overviewData = {
 | |
|                 onSaleProducts: 29,
 | |
|                 visitedProducts: 15,
 | |
|                 discountProducts: 5,
 | |
|                 presaleProducts: 17,
 | |
|                 productViews: 1250,
 | |
|                 addToCartUsers: 89,
 | |
|                 addToCartItems: 156,
 | |
|                 productLikes: 234,
 | |
|                 productOrders: 67
 | |
|             };
 | |
| 
 | |
|             Object.keys(overviewData).forEach(key => {
 | |
|                 const element = document.getElementById(key);
 | |
|                 if (element) {
 | |
|                     element.textContent = overviewData[key];
 | |
|                 }
 | |
|             });
 | |
| 
 | |
|             // 更新排行榜数据
 | |
|             updateRankingTable('visitorRankingTable', [
 | |
|                 { rank: 1, name: '热销商品A', value: '156' },
 | |
|                 { rank: 2, name: '优质商品B', value: '134' },
 | |
|                 { rank: 3, name: '精选商品C', value: '98' },
 | |
|                 { rank: 4, name: '推荐商品D', value: '76' },
 | |
|                 { rank: 5, name: '特色商品E', value: '54' }
 | |
|             ]);
 | |
| 
 | |
|             updateRankingTable('conversionRankingTable', [
 | |
|                 { rank: 1, name: '爆款商品A', value: '15.6' },
 | |
|                 { rank: 2, name: '热门商品B', value: '12.3' },
 | |
|                 { rank: 3, name: '优选商品C', value: '9.8' },
 | |
|                 { rank: 4, name: '精品商品D', value: '7.6' },
 | |
|                 { rank: 5, name: '特惠商品E', value: '5.4' }
 | |
|             ]);
 | |
| 
 | |
|             updateRankingTable('salesVolumeRankingTable', [
 | |
|                 { rank: 1, name: '畅销商品A', value: '89' },
 | |
|                 { rank: 2, name: '热销商品B', value: '67' },
 | |
|                 { rank: 3, name: '优质商品C', value: '45' },
 | |
|                 { rank: 4, name: '精选商品D', value: '34' },
 | |
|                 { rank: 5, name: '推荐商品E', value: '23' }
 | |
|             ]);
 | |
| 
 | |
|             updateRankingTable('salesAmountRankingTable', [
 | |
|                 { rank: 1, name: '高端商品A', value: '¥12,560' },
 | |
|                 { rank: 2, name: '精品商品B', value: '¥9,870' },
 | |
|                 { rank: 3, name: '优选商品C', value: '¥7,650' },
 | |
|                 { rank: 4, name: '热门商品D', value: '¥5,430' },
 | |
|                 { rank: 5, name: '特色商品E', value: '¥3,210' }
 | |
|             ]);
 | |
| 
 | |
|             updateRankingTable('replyRateRankingTable', [
 | |
|                 { rank: 1, name: '服务型商品A', value: '95.6' },
 | |
|                 { rank: 2, name: '互动型商品B', value: '87.3' },
 | |
|                 { rank: 3, name: '咨询型商品C', value: '76.8' },
 | |
|                 { rank: 4, name: '体验型商品D', value: '65.4' },
 | |
|                 { rank: 5, name: '问答型商品E', value: '54.2' }
 | |
|             ]);
 | |
|         }
 | |
| 
 | |
|         // 更新排行榜表格
 | |
|         function updateRankingTable(tableId, data) {
 | |
|             const tbody = document.getElementById(tableId);
 | |
|             if (!tbody) return;
 | |
| 
 | |
|             if (data.length === 0) {
 | |
|                 tbody.innerHTML = '<tr><td colspan="3" class="no-data">暂无数据</td></tr>';
 | |
|                 return;
 | |
|             }
 | |
| 
 | |
|             tbody.innerHTML = data.map(item => `
 | |
|                 <tr>
 | |
|                     <td>${item.rank}</td>
 | |
|                     <td>${item.name}</td>
 | |
|                     <td>${item.value}</td>
 | |
|                 </tr>
 | |
|             `).join('');
 | |
|         }
 | |
| 
 | |
|         // 页面加载时初始化数据
 | |
|         document.addEventListener('DOMContentLoaded', function() {
 | |
|             loadMockData();
 | |
|         });
 | |
|     </script>
 | |
| </body>
 | |
| </html> |