// product/ozon-templates.js
// 大型 HTML 模板字符串。从 product/ozon.js 抽出来，
// 使用 var 让它们成为内容脚本隔离世界中的共享全局变量。
// 必须在 product/ozon.js 之前加载。

// === 图片预览弹窗（原 ozon.js:14-279）===
var imagePreviewHtml = `
    <div id="sku-image-modal" style="
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(10, 20, 30, 0.85);
        backdrop-filter: blur(5px);
        z-index: 1000000000;
        display: none;
        align-items: center;
        justify-content: center;
    ">
        <!-- 左箭头 -->
        <button id="prev-image" class="nav-arrow" style="
            position: fixed;
            left: 40px;
            top: 50%;
            transform: translateY(-50%);
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: linear-gradient(135deg, #1e7bff, #005bff);
            border: none;
            color: #ffffff;
            font-size: 24px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            z-index: 2;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        ">←</button>
        
        <!-- 右箭头 -->
        <button id="next-image" class="nav-arrow" style="
            position: fixed;
            right: 40px;
            top: 50%;
            transform: translateY(-50%);
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: linear-gradient(135deg, #1e7bff, #005bff);
            border: none;
            color: #ffffff;
            font-size: 24px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            z-index: 2;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        ">→</button>

        <div style="
            position: relative;
            display: flex;
            gap: 16px;
            max-width: 85%;
            height: 85vh;
        ">
            <!-- 图片容器 -->
            <div id="image-container" style="
                background: #ffffff;
                border: 1px solid #eaeaea;
                border-radius: 8px;
                padding: 12px;
                box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
                position: relative;
                height: fit-content;
                width: 450px;
                min-width: 200px;
                min-height: 280px;
                display: flex;
                align-items: center;
                justify-content: center;
                flex-shrink: 0;
            ">
                <button id="close-image-modal" style="
                    position: absolute;
                    top: -12px;
                    right: -12px;
                    width: 24px;
                    height: 24px;
                    border-radius: 50%;
                    background: #c82333;
                    border: none;
                    color: white;
                    font-size: 16px;
                    line-height: 1;
                    cursor: pointer;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
                    z-index: 2;
                ">×</button>
                
                <img style="
                    max-width: 450px;
                    max-height: calc(85vh - 24px);
                    border-radius: 6px;
                    display: block;
                    cursor: pointer;
                    transition: transform 0.2s ease;
                    min-width: 280px;
                    min-height: 180px;
                    object-fit: contain;
                " title="点击跳转到OZON详情页">
                
                <!-- 图片加载提示 -->
                <div id="image-loading" style="
                    position: absolute;
                    top: 50%;
                    left: 50%;
                    transform: translate(-50%, -50%);
                    color: #005bff;
                    font-size: 16px;
                    font-weight: 600;
                    display: none;
                    z-index: 1;
                    background: #ffffff;
                    border-radius: 12px;
                    padding: 24px;
                    border: 1px solid #e9ebef;
                    backdrop-filter: blur(10px);
                    box-shadow: 0 16px 48px rgba(10, 12, 20, 0.18), 0 0 0 1px rgba(10, 12, 20, 0.04);
                    min-width: 160px;
                ">
                    <div style="text-align: center;">
                        <div style="
                            width: 48px;
                            height: 48px;
                            border: 3px solid rgba(0, 91, 255, 0.15);
                            border-top: 3px solid #005bff;
                            border-radius: 50%;
                            animation: spin 1.2s linear infinite;
                            margin: 0 auto 16px;
                            position: relative;
                        ">
                            <div style="
                                position: absolute;
                                top: 50%;
                                left: 50%;
                                transform: translate(-50%, -50%);
                                width: 20px;
                                height: 20px;
                                background: radial-gradient(circle, #ffffff 0%, transparent 70%);
                                border-radius: 50%;
                                opacity: 0.6;
                            "></div>
                        </div>
                        <div style="
                            color: #0a0c14;
                            font-size: 14px;
                            font-weight: 600;
                            margin-bottom: 8px;
                            letter-spacing: 0.5px;
                        ">图片加载中</div>
                        <div style="
                            color: #6b7280;
                            font-size: 12px;
                            opacity: 0.8;
                            margin-bottom: 12px;
                        ">请稍候...</div>
                        <!-- 进度条 -->
                        <div style="
                            width: 100%;
                            height: 3px;
                            background: ffffff;
                            border-radius: 2px;
                            overflow: hidden;
                        ">
                            <div id="loading-progress" style="
                                height: 100%;
                                background: linear-gradient(90deg, #1e7bff, #005bff);
                                border-radius: 2px;
                                width: 0%;
                                transition: width 0.3s ease;
                                animation: progress 2s ease-in-out infinite;
                            "></div>
                        </div>
                    </div>
                </div>
                
                <style>
                    @keyframes spin {
                        0% { transform: rotate(0deg); }
                        100% { transform: rotate(360deg); }
                    }
                    
                    @keyframes progress {
                        0% { width: 0%; }
                        50% { width: 70%; }
                        100% { width: 100%; }
                    }
                    
                    #image-loading {
                        animation: fadeIn 0.3s ease-out;
                    }
                    
                    @keyframes fadeIn {
                        from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
                        to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
                    }
                    
                    /* 利润计算加载动画 */
                    .profit-loading {
                        display: inline-block;
                        width: 16px;
                        height: 16px;
                        border: 2px solid rgba(78, 205, 196, 0.3);
                        border-radius: 50%;
                        border-top-color: #1e88e5;
                        animation: spin 1s ease-in-out infinite;
                        vertical-align: middle;
                        margin-right: 4px;
                    }
					.ozonfiltrate label{ 
						color:#151515
					}
                </style>
            </div>

            <!-- 商品信息面板 -->
            <div id="product-info-panel" style="
                background:#ffffff;
                border: 1px solid #eaeaea;
                border-radius: 8px;
                padding: 16px;
                width: 500px;
                height: fit-content;
                box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
            ">
                <div style="margin-bottom: 16px;">
                    <h3 id="product-title" style="
                        font-size: 15px;
                        font-weight: 600;
                        margin: 0 0 6px 0;
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                    "></h3>
                    <div id="product-sku" style="
                        color: #666666;
                        font-size: 13px;
                        font-family: monospace;
                    "></div>
                </div>

                <div id="product-details" style="
                    display: grid;
                    grid-template-columns: 1fr 1fr;
                    gap: 8px;
                    max-height: none;
                    overflow-y: visible;
                    padding-right: 0;
                "></div>
            </div>
        </div>
    </div>
`;

// === 主控面板（原 ozon.js:503-583）===
var controlPanelHtml = `
    <div class="ozon-helper-controls">
        <style>
            .ozon-helper-controls {
                position: relative;
                z-index: 9999994;
                color: #0a0c14;
                padding: 10px;
                background: #ffffff;
                border: 1px solid #e9ebef;
                border-radius: 12px;
                text-align: center;
                font-size: 12px;
                box-shadow: 0 16px 48px rgba(10, 12, 20, 0.18), 0 0 0 1px rgba(10, 12, 20, 0.04);
                font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
            }
            .ozon-helper-controls .control-item {
                margin-bottom: 8px;
            }
             .ozon-helper-controls .control-item:last-child {
                margin-bottom: 0;
            }
            .ozon-helper-controls label {
                display: block;
                margin-bottom: 6px;
                font-weight: 600;
                color: #6b7280;
                text-align: left;
            }
            .ozon-helper-controls input {
                text-align: center;
                height: 28px;
                border-width: 1px;
                outline: 0;
                border-style: solid;
                border-color: #e9ebef;
                width: 100%;
                background: #fafbfc;
                border-radius: 6px;
                padding: 4px 8px;
                font-size: 12px;
                font-weight: 500;
                box-sizing: border-box;
                color: #0a0c14;
            }
            .ozon-helper-controls button {
                border-radius: 6px;
                color: #ffffff;
                border: none;
                background: linear-gradient(135deg, #1e7bff, #005bff);
                padding: 6px 8px;
                width: 100%;
                font-size: 12px;
                font-weight: 700;
                cursor: pointer;
                transition: all 0.2s ease;
                box-shadow: 0 4px 12px rgba(0, 91, 255, 0.25);
            }
            .ozon-helper-controls button.active {
                background: linear-gradient(135deg, #dc2626, #b91c1c);
            }
        </style>
 <div class="control-item">
            <button type="button" id="pocacewew">同步1688订单</button>
        </div>
        <div class="control-item">
            <button type="button" id="ptbewew">同步淘宝订单</button>
        </div>
        <div class="control-item">
            <button type="button" id="pddewew">同步拼多多订单</button>
        </div>
        <div class="control-item">
            <button type="button" id="poacewew">自动滚动（10s）</button>
        </div>
        <div class="control-item">
            <button type="button" id="bsoacewew">导出数据</button>
        </div>
       
    </div>
`;

// === 数据导出大弹窗（原 ozon.js showDataExportModal 内嵌）===
function buildOzonDataExportModalHtml(rateHtml) {
  return `
        <div id="ozon-data-export-modal" style="
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            z-index: 999999999;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        ">
            <div style="
                background: #ffffff;
                border-radius: 12px;
				overflow:hidden;
                width: 98%;
                max-width: 1600px;
                height: 90%;
                max-height: 1000px;
                display: flex;
                flex-direction: column;
                color: #E5E9F0;
                box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
                position: relative;
            ">
                <!-- 头部 -->
                <div style="
                    padding: 12px 24px;
                    border-bottom: 1px solid #eeeeee;
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
					background:linear-gradient(135deg, #1e88e5, #0d47a1)
                ">
                    <h3 style="margin: 0; color: #ffffff; font-size: 18px;">熊猫-数据导出中心</h3>
                    <button id="close-export-modal" style="
                        background: none;
                        border: none;
                        color: #ffffff;
                        font-size: 24px;
                        cursor: pointer;
                        padding: 0;
                        width: 32px;
                        height: 32px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        border-radius: 4px;
                        transition: all 0.2s;
                    ">&times;</button>
                    ${rateHtml}
                </div>
                
                <!-- 过滤条件区域 -->
                <div class="ozonfiltrate" style="
                    padding: 10px 24px;
                    border-bottom: 1px solid #eeeeee;
                    background: #f5f5f5;
                ">
                    <!-- 第一行：核心过滤条件 -->
                    <div style="
                        display: grid;
                        grid-template-columns: 1fr 1fr 1fr 1fr auto;
                        gap: 8px;
                        margin-bottom: 8px;
                        align-items: center;
                    ">
                        <!-- 销量过滤 -->
                        <div style="display: flex; align-items: center; gap: 6px;">
                            <label style=" font-size: 13px; font-weight: 600; min-width: 45px;">销量:</label>
                            <input type="number" id="min-sales" placeholder="最小" style="
                                background: #FFFFFF;
                                border: 1px solid #eeeeee;
                                border-radius: 4px;
                                padding: 6px 8px;
                                
                                width: 70px;
                                font-size: 13px;
                                font-weight: 500;
                            ">
                            <span style=" font-size: 13px; font-weight: 600;color:#151515">-</span>
                            <input type="number" id="max-sales" placeholder="最大" style="
                                background: #FFFFFF;
                                border: 1px solid #eeeeee;
                                border-radius: 4px;
                                padding: 6px 8px;
                                
                                width: 70px;
                                font-size: 13px;
                                font-weight: 500;
                            ">
                        </div>
                        
                        <!-- 价格过滤 -->
                        <div style="display: flex; align-items: center; gap: 6px;">
                            <label style=" font-size: 13px; font-weight: 600; min-width: 45px;">价格:</label>
                            <input type="number" id="min-price" placeholder="最小" style="
                                background: #FFFFFF;
                                border: 1px solid #eeeeee;
                                border-radius: 4px;
                                padding: 6px 8px;
                                
                                width: 70px;
                                font-size: 13px;
                                font-weight: 500;
                            ">
                            <span style=" font-size: 13px; font-weight: 600;color:#151515">-</span>
                            <input type="number" id="max-price" placeholder="最大" style="
                                background: #FFFFFF;
                                border: 1px solid #eeeeee;
                                border-radius: 4px;
                                padding: 6px 8px;
                                
                                width: 70px;
                                font-size: 13px;
                                font-weight: 500;
                            ">
                        </div>
                        
                        <!-- 品牌过滤 -->
                        <div style="display: flex; align-items: center; gap: 6px;">
                            <label style=" font-size: 13px; font-weight: 600; min-width: 45px;">品牌:</label>
                            <select id="brand-filter" style="
                                background: #FFFFFF;
                                border: 1px solid #eeeeee;
                                border-radius: 4px;
                                padding: 6px 8px;
                                
                                width: 100px;
                                font-size: 13px;
                                font-weight: 500;
                            ">
                                <option value="all" selected>全部</option>
                                <option value="без бренда">без бренда</option>
                            </select>
                        </div>
                        
                        <!-- 发货过滤 -->
                        <div style="display: flex; align-items: center; gap: 6px;">
                            <label style=" font-size: 13px; font-weight: 600; min-width: 60px;">发货方式:</label>
                            <select id="shipping-filter" style="
                                background: #FFFFFF;
                                border: 1px solid #eeeeee;
                                border-radius: 4px;
                                padding: 6px 8px;
                                
                                width: 80px;
                                font-size: 13px;
                                font-weight: 500;
                            ">
                                <option value="all" selected>全部</option>
                                <option value="FBS">FBS</option>
                                <option value="FBO">FBO</option>
                            </select>
                        </div>
                        
                        <!-- 操作按钮组 -->
                        <div style="display: flex; gap: 8px; align-items: center;">
                            
                            <button id="apply-filters" style="
                                background: #ffffff;
                                color: rgb(33, 57, 92);
                                border: none;
                                border-radius: 4px;
                                padding: 6px 12px;
                                font-size: 13px;
                                font-weight: 600;
                                cursor: pointer;
                                transition: all 0.2s;
                                min-width: 75px;
                            ">应用过滤</button>
                            <button id="clear-filters" style="
                                background: #FFFFFF;
                                
                                border: 1px solid #eeeeee;
                                border-radius: 4px;
                                padding: 6px 12px;
                                font-size: 13px;
                                font-weight: 600;
                                cursor: pointer;
                                transition: all 0.2s;
                                min-width: 75px;
                            ">清除过滤</button>
                            <button id="batch-get-weight" style="
                                background: #ffffff;
                                
                                border: none;
                                border-radius: 4px;
                                padding: 6px 12px;
                                font-size: 13px;
                                font-weight: 600;
                                cursor: pointer;
                                transition: all 0.2s;
                                min-width: 90px;
                            ">批量获取重量</button>
                            <button id="batch-get-seller-offers" style="
                                background: #ffffff;
                                color: #1e88e5;
                                border: 1px solid #1e88e5;
                                border-radius: 4px;
                                padding: 6px 12px;
                                font-size: 13px;
                                font-weight: 600;
                                cursor: pointer;
                                transition: all 0.2s;
                                min-width: 90px;
                            ">批量获取跟卖</button>
                        </div>
                    </div>
                    
                    <!-- 第二行：辅助过滤和批量操作 -->
                    <div style="
                        display: flex;
                        // grid-template-columns: 1fr 1fr 1fr 1fr auto;
                        // gap: 8px;
                        align-items: center;
                        padding-top: 8px;
                        border-top: 1px solid #eaeaea;
						flex-wrap: wrap; 
                    ">
						<div style="
						    display: flex;
						    align-items: center;
							flex:1;
						">
							<!-- 星级过滤 -->
							<div style="display: flex; align-items: center; gap: 6px;margin-right:10px">
								<label style=" font-size: 13px; font-weight: 600; min-width: 45px;">星级:</label>
								<input type="number" id="min-rating" placeholder="最小" min="0" max="5" step="0.1" style="
									background: #FFFFFF;
									border: 1px solid #eeeeee;
									border-radius: 4px;
									padding: 6px 8px;
									
									width: 70px;
									font-size: 13px;
									font-weight: 500;
								">
								<span style=" font-size: 13px; font-weight: 600;color:#151515">-</span>
								<input type="number" id="max-rating" placeholder="最大" min="0" max="5" step="0.1" style="
									background: #FFFFFF;
									border: 1px solid #eeeeee;
									border-radius: 4px;
									padding: 6px 8px;
									
									width: 70px;
									font-size: 13px;
									font-weight: 500;
								">
							</div>
							
							<!-- 加购率过滤 -->
							<div style="display: flex; align-items: center; gap: 6px;margin-right:10px">
								<label style=" font-size: 13px; font-weight: 600; min-width: 45px;">加购率:</label>
								<input type="number" id="min-conv-to-cart" placeholder="最小" min="0" max="100" step="0.01" style="
									background: #FFFFFF;
									border: 1px solid #eeeeee;
									border-radius: 4px;
									padding: 6px 8px;
									
									width: 70px;
									font-size: 13px;
									font-weight: 500;
								">
								<span style=" font-size: 13px; font-weight: 600;color:#151515">-</span>
								<input type="number" id="max-conv-to-cart" placeholder="最大" min="0" max="100" step="0.01" style="
									background: #FFFFFF;
									border: 1px solid #eeeeee;
									border-radius: 4px;
									padding: 6px 8px;
									
									width: 70px;
									font-size: 13px;
									font-weight: 500;
								">
								<span style=" font-size: 13px; font-weight: 600;color:#151515">%</span>
							</div>
							
							<!-- 重量过滤 -->
							<div style="display: flex; align-items: center; gap: 6px;margin-right:10px">
								<label style=" font-size: 13px; font-weight: 600; min-width: 60px;">重量(g):</label>
								<input type="number" id="min-weight" placeholder="最小" style="
									background: #FFFFFF;
									border: 1px solid #eeeeee;
									border-radius: 4px;
									padding: 6px 8px;
									
									width: 70px;
									font-size: 13px;
									font-weight: 500;
								">
								<span style=" font-size: 13px; font-weight: 600;color:#151515">-</span>
								<input type="number" id="max-weight" placeholder="最大" style="
									background: #FFFFFF;
									border: 1px solid #eeeeee;
									border-radius: 4px;
									padding: 6px 8px;
									
									width: 70px;
									font-size: 13px;
									font-weight: 500;
								">
							</div>
							
							<!-- 出售时间过滤 -->
							<div style="display: flex; align-items: center; gap: 6px;margin-right:10px">
								<label style=" font-size: 13px; font-weight: 600; min-width: 65px;">出售时间:</label>
								<input type="date" id="min-shelf-date" placeholder="开始" style="
									background: #FFFFFF;
									border: 1px solid #eeeeee;
									border-radius: 4px;
									padding: 6px 8px;
									
									width: 110px;
									font-size: 13px;
									font-weight: 500;
								">
								<span style=" font-size: 13px; font-weight: 600;color:#151515">-</span>
								<input type="date" id="max-shelf-date" placeholder="结束" style="
									background: #FFFFFF;
									border: 1px solid #eeeeee;
									border-radius: 4px;
									padding: 6px 8px;
									
									width: 110px;
									font-size: 13px;
									font-weight: 500;
								">
							</div>
							
							<!-- 利润率过滤 -->
                           <!-- <div style="display: flex; align-items: center; gap: 6px;margin-right:10px">
                            	<label style=" font-size: 13px; font-weight: 600; min-width: 45px;">利润率:</label>
                            	<input type="number" id="min-conv-to-profit" placeholder="最小" min="0" max="100" step="0.01" style="
                            		background: #FFFFFF;
                            		border: 1px solid #eeeeee;
                            		border-radius: 4px;
                            		padding: 6px 8px;
                                    
                            		width: 70px;
                            		font-size: 13px;
                            		font-weight: 500;
                            	">
                            	<span style=" font-size: 13px; font-weight: 600;color:#151515">-</span>
                            	<input type="number" id="max-conv-to-profit" placeholder="最大" min="0" max="100" step="0.01" style="
                            		background: #FFFFFF;
                            		border: 1px solid #eeeeee;
                            		border-radius: 4px;
                            		padding: 6px 8px;
                                    
                            		width: 70px;
                            		font-size: 13px;
                            		font-weight: 500;
                            	">
                            	<span style=" font-size: 13px; font-weight: 600;color:#151515">%</span>
                            </div>-->
                        </div>
						
						<!-- 第二行：辅助过滤和批量操作 -->
						<div style="
						">
							<!-- 批量调价功能 -->
							<div style="
							    grid-column: 5;
							    display: flex; 
							    align-items: center; 
							    gap: 6px;
							    justify-content: flex-end;
							    background: #eeeeee;
							    padding: 8px;
							    border-radius: 4px;
							    border: 1px solid #eaeaea;
							    width: fit-content;
							    margin-left: auto;
							">
							    <label style=" font-size: 13px; font-weight: 600; min-width: 65px;">批量调价:</label>
							    <select id="price-adjust-type" style="
							        background: #FFFFFF;
							        border: 1px solid #eeeeee;
							        border-radius: 4px;
							        padding: 6px 8px;
							        
							        width: 70px;
							        font-size: 13px;
							        font-weight: 500;
							    ">
							        <option value="percentage">比例</option>
							        <option value="fixed">固定</option>
							    </select>
							    <input type="number" id="price-adjust-value" placeholder="数值" step="0.01" style="
							        background: #FFFFFF;
							        border: 1px solid #eeeeee;
							        border-radius: 4px;
							        padding: 6px 8px;
							        
							        width: 70px;
							        font-size: 13px;
							        font-weight: 500;
							    ">
							    <span id="price-adjust-unit" style="color:#1e88e5;font-size:13px;font-weight:600;margin-left:4px;">%</span>
							    <select id="price-adjust-direction" style="
							        background: #FFFFFF;
							        border: 1px solid #eeeeee;
							        border-radius: 4px;
							        padding: 6px 8px;
							        
							        width: 80px;
							        font-size: 13px;
							        font-weight: 500;
							    ">
							        <option value="up">上涨</option>
							        <option value="down">下降</option>
							    </select>
							    <button id="apply-price-adjust" style="
							        background: #c82333;
							        
							        border: none;
							        border-radius: 4px;
							        padding: 6px 12px;
							        font-size: 13px;
							        font-weight: 600;
							        cursor: pointer;
							        transition: all 0.2s;
							        min-width: 75px;
									color:#ffffff
							    ">应用调价</button>
							    <button id="restore-origin-price" style="
							        background: #1e88e5;
							        color: #ffffff;
							        border: none;
							        border-radius: 4px;
							        padding: 6px 12px;
							        font-size: 13px;
							        font-weight: 600;
							        cursor: pointer;
							        transition: all 0.2s;
							        min-width: 75px;
							        margin-left: 8px;">
							        恢复原价
							    </button>
							    
							    <div style="width: 1px; height: 20px; background: #eaeaea; margin: 0 8px;"></div>
							    
							</div>
						</div>
                        
                    </div>
					
                </div>
                
                <!-- 数据表格区域 -->
                <div style="
                    flex: 1;
                    padding: 16px 24px;
                    overflow: hidden;
                    display: flex;
                    flex-direction: column;
                ">
                    <div style="
                        display: flex;
                        justify-content: space-between;
                        align-items: center;
                        margin-bottom: 16px;
                    ">
                        <div style=" font-size: 16px; font-weight: 600;color:#151515">
                            共 <span id="total-count" style="color: #1e88e5; font-weight: 700;">0</span> 条数据，已选择 <span id="selected-count" style="color: #1e88e5; font-weight: 700;">0</span> 条
                        </div>
                        <div style="flex:1;"></div>
                        <div id="profit-formula-tip" style="color: #FFD166; font-size: 13px; font-weight: 600; white-space: nowrap; text-align: left;">
                            <!-- 利润 = 售价 - 成本 - 佣金(<input type="number" id="commission-rate" value="20" min="0" max="100" step="0.1" style="width: 50px; background: #FFFFFF; border: 1px solid #eeeeee; border-radius: 2px; padding: 2px 4px; color: #FFD166; font-size: 12px; font-weight: 600; text-align: center;">%) - 物流费 - 打包费(<input type="number" id="packing-fee" value="5" min="0" max="100" step="0.1" style="width: 50px; background: #FFFFFF; border: 1px solid #eeeeee; border-radius: 2px; padding: 2px 4px; color: #FFD166; font-size: 12px; font-weight: 600; text-align: center;">元)； 利润率 = 利润 ÷ 售价 × 100% -->
                        </div>
                        <div style="display: flex; gap: 8px; align-items: center;">
                            <!-- 新增物流分组选择器 -->
                            <select id="logistics-group" style="background: #FFFFFF; border: 1px solid #eeeeee; border-radius: 4px; padding: 6px 8px;  width: 120px; font-size: 13px; font-weight: 500; margin-right: 8px;">
                                <option value="">-- 选择分组 --</option>
                            </select>
                            <!-- 店铺选择下拉框 -->
                            <select id="store" style="background: #FFFFFF; border: 1px solid #eeeeee; border-radius: 4px; padding: 6px 8px;  width: 120px; font-size: 13px; font-weight: 500; margin-right: 8px;">
                                <option value="">-- 选择店铺 --</option>
                            </select>
                            <!-- 物流方式下拉框 -->
                            <!--select id="logistics-type" style="background: #FFFFFF; border: 1px solid #eeeeee; border-radius: 4px; padding: 6px 8px;  width: 90px; font-size: 13px; font-weight: 500; margin-right: 8px;">
                                <option value="">-- 选择物流 --</option>
                            </select-->
                            <!-- 跟卖或复制下拉框 -->
                            <div style="display: flex; align-items: center; gap: 6px;">
                                <span style=" font-size: 13px; font-weight: 600;color:#151515">跟卖或复制:</span>
                                <select id="flow-or-copy" style="background: #FFFFFF; border: 1px solid #eeeeee; border-radius: 4px; padding: 6px 8px;  width: 90px; font-size: 13px; font-weight: 500;">
                                    <option value="false">跟卖</option>
                                    <option value="true">复制</option>
                                </select>
                            </div>
                            <div style="display: flex; align-items: center; gap: 6px;">
                                <span style=" font-size: 13px; font-weight: 600;color:#151515">是否跟卖品牌:</span>
                                <select id="flow-or-brand" style="background: #FFFFFF; border: 1px solid #eeeeee; border-radius: 4px; padding: 6px 8px;  width: 90px; font-size: 13px; font-weight: 500;">
                                    <option value="false">否</option>
                                    <option value="true">是</option>
                                </select>
                            </div>
                            <button id="select-all" style="
                                background: #FFFFFF;
                                
                                border: 1px solid #eeeeee;
                                border-radius: 4px;
                                padding: 8px 16px;
                                font-size: 14px;
                                font-weight: 600;
                                cursor: pointer;
                            ">全选</button>
                            <button id="select-none" style="
                                background: #FFFFFF;
                                
                                border: 1px solid #eeeeee;
                                border-radius: 4px;
                                padding: 8px 16px;
                                font-size: 14px;
                                font-weight: 600;
                                cursor: pointer;
                            ">取消全选</button>
                        </div>
                    </div>
                    
                    <div id="data-table-container" style="
                        flex: 1;
                        overflow: auto;
                        border: 1px solid #eeeeee;
                        border-radius: 6px;
                        background: #f9f9f9;
                        position: relative;
                    ">
                        <table id="data-table" style="
                            width: 100%;
                            border-collapse: collapse;
                            font-size: 13px;
                        ">
                            <thead style="
                                background: #343a40;
                                position: sticky;
                                top: 0;
                                z-index: 100;
                                box-shadow: 0 1px 0 0 #eeeeee;
                            ">
                                <tr>
                                    <th style="padding: 10px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 40px; font-size: 14px;">
                                        <input type="checkbox" id="header-checkbox" style="margin: 0;accent-color: #1e88e5; ">
                                    </th>
                                    <th style="padding: 10px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 14px;">SKU</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 13px;">价格</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 13px;">跟卖数量</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 13px;">跟卖最低价</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 13px;">重量</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 13px;">物流费</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 60px; font-size: 13px;">成本</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 90px; font-size: 13px;">利润|利润率</th>
									<th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 13px;">物流方式</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 60px; font-size: 13px;">星级</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 13px;">30天销量</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 100px; font-size: 13px;">30天销售额</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 13px;">出售时间</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 13px;">品牌</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 13px;">发货方式</th>
                                    <th style="padding: 8px 6px; text-align: left; border-bottom: 1px solid #eeeeee; color: #ffffff; font-weight: 700; min-width: 80px; font-size: 13px;">加购率</th>
                                </tr>
                            
                            </thead>
                            <tbody id="data-table-body">
                                <!-- 数据行将在这里动态生成 -->
                            </tbody>
                        </table>
                    </div>
                </div>
                
                <!-- 底部操作区域 -->
                <div style="
                    padding: 8px 24px;
                    border-top: 1px solid #eeeeee;
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    background: #eeeeee;
                ">
                    <div style="display: flex; gap: 12px; align-items: center;">
                        <!-- 进度条区域 -->
                        <div id="weight-progress-container" style="
                            display: none;
                            background: rgba(58, 90, 138, 0.1);
                            border-radius: 6px;
                            padding: 8px 12px;
                            border: 1px solid #FFFFFF;
                            min-width: 200px;
                        ">
                            <div style="
                                display: flex;
                                justify-content: space-between;
                                align-items: center;
                                margin-bottom: 6px;
                            ">
                                <span style=" font-size: 12px; font-weight: 600;color:#1e88e5;">重量获取进度</span>
                                <span id="weight-progress-text" style="color: #1e88e5; font-size: 12px; font-weight: 600;">0/0</span>
                            </div>
                            <div style="
                                width: 100%;
                                height: 6px;
                                background: #FFFFFF;
                                border-radius: 3px;
                                overflow: hidden;
                            ">
                                <div id="weight-progress-bar" style="
                                    width: 0%;
                                    height: 100%;
                                    background: linear-gradient(90deg, #1e88e5, #1e88e5);
                                    border-radius: 3px;
                                    transition: width 0.3s ease;
                                "></div>
                            </div>
                        </div>
                    </div>
                    <div style="display: flex; gap: 16px; align-items: center; margin-left: auto;">
                        <button id="save-export-data" style="
                            background: #ffffff;
                            color: #1e88e5;
                            border: 2px solid #1e88e5;
                            border-radius: 10px;
                            padding: 10px 24px;
                            font-size: 15px;
                            font-weight: 700;
                            cursor: pointer;
                            letter-spacing: 1px;
                            transition: all 0.18s cubic-bezier(.4,2,.6,1);
                            outline: none;
                        ">
                            保存
                        </button>
                        <button id="delete-selected-skus" style="
                            background: #ffffff;
                            color: #dc2626;
                            border: 2px solid #dc2626;
                            border-radius: 10px;
                            padding: 10px 24px;
                            font-size: 15px;
                            font-weight: 700;
                            cursor: pointer;
                            letter-spacing: 1px;
                            transition: all 0.18s cubic-bezier(.4,2,.6,1);
                            outline: none;
                        ">
                            删除选中SKU
                        </button>
                        <button id="copy-selected" style="
                            background:#343a40;
                            color: #ffffff;
                            border: none;
                            border-radius: 10px;
                            padding: 10px 24px;
                            font-size: 15px;
                            font-weight: 700;
                            cursor: pointer;
 box-shadow: 0 0 12px 2px #eeeeee, 0 2px 8px rgba(0,0,0,0.15);
                            letter-spacing: 1px;
                            transition: all 0.18s cubic-bezier(.4,2,.6,1);
                            outline: none;
                            position: relative;
                            overflow: hidden;
                        ">
                            <svg style="vertical-align: middle; margin-right: 8px;" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
                            复制选中数据
                        </button>
                        <button id="batch-follow-sell" style="
                            background:linear-gradient(135deg, #1e88e5, #0d47a1);
                            
                            border: none;
                            border-radius: 10px;
                            padding: 10px 24px;
                            font-size: 15px;
                            font-weight: 700;
                            cursor: pointer;
                            letter-spacing: 1px;
                            transition: all 0.18s cubic-bezier(.4,2,.6,1);
                            outline: none;
                            position: relative;
                            overflow: hidden;
							color:#ffffff;
                        ">
                            <svg style="vertical-align: middle; margin-right: 8px;" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>
                            一键跟卖选中SKU
                        </button>
                    </div>
                </div>
            </div>
        </div>
  `;
}
