{"status":"active","message":"自动打码脚本有重要更新，建议您立即升级以获取最新功能和修复。\n<p style=\"color: red;\">更新日志输出优化，避免日志输出过多导致页面数据沉积卡顿</p>","latest_version":"1.0.0.0.01","update_url":"https://abcdc.top/jj/auto_njukuan.user.js","force_update":false,"update_modal_code":"// update.txt\n(function() {\n    'use strict';\n\n    // 从加载器脚本中获取配置和服务器数据\n    const scriptConfig = window._myDynamicScriptConfig;\n    if (!scriptConfig || !scriptConfig.serverData) {\n        console.error('[Update Modal] 无法获取脚本配置或服务器数据。');\n        return;\n    }\n\n    const serverData = scriptConfig.serverData;\n    const currentLoaderVersion = scriptConfig.currentLoaderVersion;\n    const functionalScriptCode = serverData.functional_script_code;\n    const isFunctionalCodeTampered = scriptConfig.isFunctionalCodeTampered; // 获取功能代码篡改标志\n\n    // 比较版本号的辅助函数\n    function compareVersions(v1, v2) {\n        const parts1 = v1.split('.').map(Number);\n        const parts2 = v2.split('.').map(Number);\n        for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {\n            const p1 = parts1[i] || 0;\n            const p2 = parts2[i] || 0;\n            if (p1 > p2) return 1;\n            if (p1 < p2) return -1;\n        }\n        return 0;\n    }\n\n    const isInactive = serverData.status === 'inactive';\n    const needsUpdate = serverData.latest_version && compareVersions(serverData.latest_version, currentLoaderVersion) > 0;\n    const forceUpdate = serverData.force_update;\n    const updateUrl = serverData.update_url;\n    const message = serverData.message;\n\n    // 注入 CSS 样式 (如果尚未注入)\n    if (!document.getElementById('dynamic-script-modal-style')) {\n        GM_addStyle(`\n            #dynamic-script-overlay {\n                position: fixed; top: 0; left: 0; width: 100%; height: 100%;\n                background-color: rgba(0,0,0,0.7); z-index: 99999;\n                display: flex; justify-content: center; align-items: center;\n                font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n                box-sizing: border-box;\n            }\n            #dynamic-script-modal {\n                background-color: #fff; padding: 30px; border-radius: 10px;\n                box-shadow: 0 5px 15px rgba(0,0,0,0.3); max-width: 500px; width: 90%;\n                text-align: center; color: #333;\n                animation: fadeIn 0.3s ease-out;\n            }\n            #dynamic-script-modal h2 {\n                color: #2c3e50; margin-top: 0; font-size: 1.8em;\n            }\n            #dynamic-script-modal p {\n                font-size: 1.1em; line-height: 1.6; margin-bottom: 25px;\n                white-space: pre-wrap; /* 保持消息中的换行 */\n            }\n            .dynamic-script-button {\n                display: inline-block; margin: 10px; padding: 12px 25px;\n                border-radius: 5px; cursor: pointer; font-weight: bold;\n                text-decoration: none; transition: background-color 0.3s ease, transform 0.2s ease;\n                font-size: 1em; border: none;\n            }\n            .dynamic-script-button.primary {\n                background-color: #007bff; color: white;\n            }\n            .dynamic-script-button.primary:hover {\n                background-color: #0056b3; transform: translateY(-1px);\n            }\n            .dynamic-script-button.secondary {\n                background-color: #6c757d; color: white;\n            }\n            .dynamic-script-button.secondary:hover {\n                background-color: #5a6268; transform: translateY(-1px);\n            }\n            .dynamic-script-button.danger {\n                background-color: #dc3545; color: white;\n            }\n            .dynamic-script-button.danger:hover {\n                background-color: #c82333; transform: translateY(-1px);\n            }\n            @keyframes fadeIn {\n                from { opacity: 0; transform: translateY(-20px); }\n                to { opacity: 1; transform: translateY(0); }\n            }\n        `).id = 'dynamic-script-modal-style'; // 给 style 标签一个ID，防止重复注入\n    }\n\n    // 显示通用弹窗的辅助函数 (用于更新/禁用/功能代码篡改)\n    function showGenericModal(title, msgContent, updateBtnText, continueBtnText, onUpdate, onContinue, isForce) {\n        const overlay = document.createElement('div');\n        overlay.id = 'dynamic-script-overlay';\n        const modal = document.createElement('div');\n        modal.id = 'dynamic-script-modal';\n\n        const h2 = document.createElement('h2');\n        h2.textContent = title;\n        const p = document.createElement('p');\n        p.innerHTML = msgContent;\n\n        modal.appendChild(h2);\n        modal.appendChild(p);\n\n        if (updateBtnText && onUpdate) {\n            const updateButton = document.createElement('a');\n            updateButton.href = updateUrl; // 使用全局的 updateUrl\n            updateButton.target = '_blank';\n            updateButton.textContent = updateBtnText;\n            updateButton.className = 'dynamic-script-button primary';\n            updateButton.addEventListener('click', () => {\n                overlay.remove();\n                document.body.style.overflow = '';\n                onUpdate();\n            });\n            modal.appendChild(updateButton);\n        }\n\n        if (!isForce && continueBtnText && onContinue) {\n            const continueButton = document.createElement('button');\n            continueButton.textContent = continueBtnText;\n            continueButton.className = 'dynamic-script-button secondary';\n            continueButton.addEventListener('click', () => {\n                overlay.remove();\n                document.body.style.overflow = '';\n                onContinue();\n            });\n            modal.appendChild(continueButton);\n        }\n\n        overlay.appendChild(modal);\n        document.body.appendChild(overlay);\n        if (isForce) {\n            document.body.style.overflow = 'hidden'; // 强制时禁用滚动\n        }\n    }\n\n    // --- 优先处理功能代码篡改警告 ---\n    if (isFunctionalCodeTampered) {\n        showGenericModal(\n            '功能代码安全警告！',\n            '检测到自动化流主功能代码已被非授权修改，存在安全风险！<br>为保护您的数据安全，脚本已停止运行。<br>请立即访问更新地址重新安装脚本。',\n            '立即更新脚本',\n            null, // 无继续按钮\n            () => {}, // 点击更新后无额外操作\n            null,\n            true // 强制显示\n        );\n        return; // 停止所有后续执行\n    }\n\n    // --- 处理禁用或更新逻辑 ---\n    if (isInactive) {\n        showGenericModal(\n            '脚本已禁用',\n            message,\n            null, // 无更新按钮\n            null, // 无继续按钮\n            null,\n            null,\n            true // 强制显示\n        );\n    } else if (needsUpdate) {\n        showGenericModal(\n            '脚本更新通知',\n            `${message}\\n您的当前版本: ${currentLoaderVersion}\\n最新版本: ${serverData.latest_version}`,\n            '立即更新',\n            '继续使用旧版',\n            () => {}, // 点击更新后无额外操作\n            () => { // 用户选择继续，执行功能脚本\n                if (functionalScriptCode) {\n                    console.log('[Update Modal] 用户选择继续使用旧版。正在执行功能脚本...');\n                    eval(functionalScriptCode);\n                } else {\n                    console.warn('[Update Modal] 未找到功能脚本代码。');\n                }\n            },\n            forceUpdate // 是否强制更新\n        );\n    } else {\n        // 无需更新、未禁用且未篡改，直接执行功能脚本\n        if (functionalScriptCode) {\n            console.log('[Update Modal] 无需更新，脚本已激活且完整性检查通过。正在执行功能脚本...');\n            eval(functionalScriptCode);\n        } else {\n            console.warn('[Update Modal] 未找到功能脚本代码。');\n        }\n    }\n})();","update_modal_code_hash":"fda213d524e53de0b37bd75b37a4944c9ad43a060fed15f9c4ccefaad40aceda","functional_script_code":"// ==UserScript==\n// @name         合并处理助手（VIP2/VIP3完全隔离版 - 增强版）\n// @namespace    http://tampermonkey.net/\n// @version      5.1\n// @description  智能解析多行表格数据，VIP2和VIP3完全隔离处理，避免冲突。支持窗口大小调整、配置持久化保存\n// @author       您的名字\n// @match        https://admin2026one.com/*\n// @grant        none\n// ==/UserScript==\n\n(function () {\n    'use strict';\n\n    // ======= 配置 =======\n    const defaultPageSize = '50条/页';\n    const MAX_LOAD_WAIT_TIME = 30000;\n    const LOAD_CHECK_INTERVAL = 200;\n    const CONFIRM_BUTTON_WAIT_TIME = 5000;\n    const CONFIRM_BUTTON_CHECK_INTERVAL = 100;\n    const POPUP_CLOSE_WAIT_TIME = 3000;\n    const POPUP_CLOSE_CHECK_INTERVAL = 100;\n    const MAX_CONFIRM_RETRIES = 3;\n    const ACCOUNT_MODIFY_MAX_ATTEMPTS = 20;\n\n    // ======= 配置持久化存储键名 =======\n    const STORAGE_KEYS = {\n        WINDOW_STATE: 'auto_njukuan_window_state',\n        CONFIG: 'auto_njukuan_config'\n    };\n\n    // ======= 全局变量 =======\n    let isScriptRunning = false;\n    let isContinuousMode = false;\n    let shouldAbort = false;\n    let lastProcessedId = null;\n    let columnIndexMap = {};\n    let columnIndexReverseMap = {};\n    let alarmSoundInterval = null;\n    let isAlarmActive = false;\n    let enableConsoleLog = false;\n    let logHistory = [];\n\n    // ======= 配置保存/加载函数 =======\n    function saveWindowState() {\n        const state = {\n            width: floatWindow.offsetWidth,\n            height: floatWindow.offsetHeight,\n            top: floatWindow.offsetTop,\n            left: floatWindow.offsetLeft,\n            display: floatWindow.style.display\n        };\n        localStorage.setItem(STORAGE_KEYS.WINDOW_STATE, JSON.stringify(state));\n    }\n\n    function loadWindowState() {\n        try {\n            const saved = localStorage.getItem(STORAGE_KEYS.WINDOW_STATE);\n            if (saved) {\n                const state = JSON.parse(saved);\n                return state;\n            }\n        } catch (e) {\n            console.error('加载窗口状态失败:', e);\n        }\n        return null;\n    }\n\n    function saveConfig() {\n        const config = {\n            memberIdColumnName: document.getElementById('memberIdColumnNameInput').value,\n            vipColumnName: document.getElementById('vipColumnNameInput').value,\n            statusColumnName: document.getElementById('statusColumnNameInput').value,\n            paymentChannel: document.getElementById('paymentChannelInput').value,\n            withdrawAmount: document.getElementById('withdrawAmountInput').value,\n            pageSize: document.getElementById('pageSizeInput')?.value || defaultPageSize,\n            vipLevels: Array.from(document.getElementById('vipLevelSelect').selectedOptions).map(opt => opt.value),\n            orderStatuses: Array.from(document.getElementById('orderStatusSelect').selectedOptions).map(opt => opt.value),\n            continuousMode: document.getElementById('continuousCheckbox')?.checked || false,\n            consoleLog: document.getElementById('consoleLogCheckbox')?.checked || false\n        };\n        localStorage.setItem(STORAGE_KEYS.CONFIG, JSON.stringify(config));\n    }\n\n    function loadConfig() {\n        try {\n            const saved = localStorage.getItem(STORAGE_KEYS.CONFIG);\n            if (saved) {\n                return JSON.parse(saved);\n            }\n        } catch (e) {\n            console.error('加载配置失败:', e);\n        }\n        return null;\n    }\n\n    function applyConfig(config) {\n        if (!config) return;\n\n        if (config.memberIdColumnName !== undefined) {\n            document.getElementById('memberIdColumnNameInput').value = config.memberIdColumnName;\n        }\n        if (config.vipColumnName !== undefined) {\n            document.getElementById('vipColumnNameInput').value = config.vipColumnName;\n        }\n        if (config.statusColumnName !== undefined) {\n            document.getElementById('statusColumnNameInput').value = config.statusColumnName;\n        }\n        if (config.paymentChannel !== undefined) {\n            document.getElementById('paymentChannelInput').value = config.paymentChannel;\n        }\n        if (config.withdrawAmount !== undefined) {\n            document.getElementById('withdrawAmountInput').value = config.withdrawAmount;\n        }\n        if (config.pageSize !== undefined && document.getElementById('pageSizeInput')) {\n            document.getElementById('pageSizeInput').value = config.pageSize;\n        }\n        if (config.vipLevels && Array.isArray(config.vipLevels)) {\n            const vipSelect = document.getElementById('vipLevelSelect');\n            Array.from(vipSelect.options).forEach(opt => {\n                opt.selected = config.vipLevels.includes(opt.value);\n            });\n        }\n        if (config.orderStatuses && Array.isArray(config.orderStatuses)) {\n            const statusSelect = document.getElementById('orderStatusSelect');\n            Array.from(statusSelect.options).forEach(opt => {\n                opt.selected = config.orderStatuses.includes(opt.value);\n            });\n        }\n        if (config.continuousMode !== undefined && document.getElementById('continuousCheckbox')) {\n            document.getElementById('continuousCheckbox').checked = config.continuousMode;\n        }\n        if (config.consoleLog !== undefined && document.getElementById('consoleLogCheckbox')) {\n            document.getElementById('consoleLogCheckbox').checked = config.consoleLog;\n            enableConsoleLog = config.consoleLog;\n        }\n    }\n\n    // ======= 创建悬浮按钮和窗 =======\n    const floatToggleButton = document.createElement('button');\n    floatToggleButton.textContent = '合并处理';\n    Object.assign(floatToggleButton.style, {\n        position: 'fixed',\n        top: '10px',\n        right: '10px',\n        zIndex: 99999,\n        padding: '8px 12px',\n        background: '#007bff',\n        color: '#fff',\n        border: 'none',\n        borderRadius: '4px',\n        cursor: 'pointer',\n    });\n    document.body.appendChild(floatToggleButton);\n\n    const floatWindow = document.createElement('div');\n    // 初始样式，稍后会从保存的状态恢复\n    Object.assign(floatWindow.style, {\n        position: 'fixed',\n        top: '50px',\n        right: '10px',\n        width: '380px',\n        height: '680px',\n        minWidth: '300px',\n        minHeight: '400px',\n        maxWidth: '90vw',\n        maxHeight: '90vh',\n        background: '#f9f9f9',\n        border: '1px solid #ccc',\n        borderRadius: '6px',\n        boxShadow: '0 2px 12px rgba(0,0,0,0.1)',\n        zIndex: 99999,\n        display: 'none',\n        flexDirection: 'column',\n        overflow: 'hidden',\n    });\n    document.body.appendChild(floatWindow);\n\n    // 创建窗口头部容器（包含标题和关闭按钮）\n    const headerContainer = document.createElement('div');\n    Object.assign(headerContainer.style, {\n        position: 'relative',\n        padding: '10px',\n        background: '#007bff',\n        borderRadius: '6px 6px 0 0',\n        flexShrink: '0',\n        display: 'flex',\n        alignItems: 'center',\n        justifyContent: 'space-between',\n        userSelect: 'none',\n        cursor: 'move',\n    });\n    floatWindow.appendChild(headerContainer);\n\n    const header = document.createElement('div');\n    Object.assign(header.style, {\n        color: '#fff',\n        fontWeight: 'bold',\n        fontSize: '14px',\n        flex: '1',\n    });\n    header.textContent = '合并处理界面';\n    headerContainer.appendChild(header);\n\n    const closeBtn = document.createElement('span');\n    closeBtn.textContent = '✖';\n    Object.assign(closeBtn.style, {\n        cursor: 'pointer',\n        color: '#fff',\n        fontWeight: 'bold',\n        fontSize: '18px',\n        lineHeight: '1',\n        padding: '0 5px',\n        transition: 'background 0.2s',\n        borderRadius: '3px',\n    });\n    closeBtn.title = '关闭';\n    closeBtn.addEventListener('mouseenter', () => {\n        closeBtn.style.background = 'rgba(255,255,255,0.2)';\n    });\n    closeBtn.addEventListener('mouseleave', () => {\n        closeBtn.style.background = 'transparent';\n    });\n    headerContainer.appendChild(closeBtn);\n\n    // 创建内容区域（可滚动）\n    const contentArea = document.createElement('div');\n    Object.assign(contentArea.style, {\n        flex: '1',\n        display: 'flex',\n        flexDirection: 'column',\n        overflow: 'auto',\n        padding: '10px',\n    });\n    floatWindow.appendChild(contentArea);\n\n    const logOutput = document.createElement('pre');\n    Object.assign(logOutput.style, {\n        flex: '1',\n        background: '#fff',\n        border: '1px solid #ddd',\n        padding: '8px',\n        fontSize: '12px',\n        overflowY: 'auto',\n        whiteSpace: 'pre-wrap',\n        minHeight: '120px',\n        maxHeight: '180px',\n        borderRadius: '4px',\n    });\n    contentArea.appendChild(logOutput);\n\n    const buttonArea = document.createElement('div');\n    buttonArea.style.marginTop = '8px';\n    buttonArea.style.flexShrink = '0';\n    contentArea.appendChild(buttonArea);\n\n    const startBtn = document.createElement('button');\n    startBtn.textContent = '开始处理';\n    startBtn.style.marginRight = '8px';\n    buttonArea.appendChild(startBtn);\n\n    const abortBtn = document.createElement('button');\n    abortBtn.textContent = '中止处理';\n    abortBtn.style.display = 'none';\n    buttonArea.appendChild(abortBtn);\n\n    const continuousCheckbox = document.createElement('input');\n    continuousCheckbox.type = 'checkbox';\n    continuousCheckbox.id = 'continuousCheckbox';\n    continuousCheckbox.style.marginLeft = '12px';\n    const continuousLabel = document.createElement('label');\n    continuousLabel.htmlFor = 'continuousCheckbox';\n    continuousLabel.textContent = '持续模式';\n    continuousLabel.style.fontSize = '12px';\n    continuousLabel.style.marginLeft = '4px';\n    buttonArea.appendChild(continuousCheckbox);\n    buttonArea.appendChild(continuousLabel);\n\n    const pageSizeInput = document.createElement('input');\n    pageSizeInput.type = 'text';\n    pageSizeInput.id = 'pageSizeInput';\n    pageSizeInput.value = defaultPageSize;\n    pageSizeInput.style.width = '90px';\n    pageSizeInput.style.marginLeft = '8px';\n    pageSizeInput.title = '请输入页显示条数，如：\"50条/页\"';\n    buttonArea.appendChild(pageSizeInput);\n\n    const stopAlarmBtn = document.createElement('button');\n    stopAlarmBtn.textContent = '停止警报';\n    stopAlarmBtn.style.marginLeft = '8px';\n    stopAlarmBtn.style.display = 'none';\n    stopAlarmBtn.style.backgroundColor = '#ff4444';\n    stopAlarmBtn.style.color = '#fff';\n    stopAlarmBtn.style.border = 'none';\n    stopAlarmBtn.style.borderRadius = '4px';\n    stopAlarmBtn.style.padding = '6px 12px';\n    stopAlarmBtn.style.cursor = 'pointer';\n    buttonArea.appendChild(stopAlarmBtn);\n\n    const consoleLogCheckbox = document.createElement('input');\n    consoleLogCheckbox.type = 'checkbox';\n    consoleLogCheckbox.id = 'consoleLogCheckbox';\n    consoleLogCheckbox.style.marginLeft = '12px';\n    const consoleLogLabel = document.createElement('label');\n    consoleLogLabel.htmlFor = 'consoleLogCheckbox';\n    consoleLogLabel.textContent = '浏览器日志';\n    consoleLogLabel.style.fontSize = '12px';\n    consoleLogLabel.style.marginLeft = '4px';\n    buttonArea.appendChild(consoleLogCheckbox);\n    buttonArea.appendChild(consoleLogLabel);\n\n    const filterArea = document.createElement('div');\n    filterArea.style.marginTop = '10px';\n    filterArea.style.borderTop = '1px solid #eee';\n    filterArea.style.paddingTop = '8px';\n    filterArea.style.flexShrink = '0';\n\n    const filterTitle = document.createElement('div');\n    filterTitle.textContent = '🎯 智能筛选条件（列名模糊匹配）';\n    filterTitle.style.fontWeight = 'bold';\n    filterTitle.style.fontSize = '13px';\n    filterTitle.style.marginBottom = '8px';\n    filterTitle.style.color = '#007bff';\n    filterArea.appendChild(filterTitle);\n\n    const memberIdGroup = document.createElement('div');\n    memberIdGroup.style.marginBottom = '8px';\n    const memberIdLabel = document.createElement('label');\n    memberIdLabel.textContent = '🔑 会员ID列名称：';\n    memberIdLabel.style.fontSize = '12px';\n    memberIdLabel.style.display = 'block';\n    memberIdLabel.style.fontWeight = 'bold';\n    memberIdGroup.appendChild(memberIdLabel);\n    const memberIdInput = document.createElement('input');\n    memberIdInput.type = 'text';\n    memberIdInput.id = 'memberIdColumnNameInput';\n    memberIdInput.value = '会员ID';\n    memberIdInput.style.width = '100%';\n    memberIdInput.style.marginTop = '4px';\n    memberIdInput.style.padding = '6px';\n    memberIdInput.style.border = '1px solid #ddd';\n    memberIdInput.style.borderRadius = '4px';\n    memberIdInput.title = '输入列名关键词，如\"会员ID\"即可匹配\"会员ID（会员账号）\"';\n    memberIdGroup.appendChild(memberIdInput);\n    filterArea.appendChild(memberIdGroup);\n\n    const vipGroup = document.createElement('div');\n    vipGroup.style.marginBottom = '8px';\n    const vipLabel = document.createElement('label');\n    vipLabel.textContent = 'VIP等级列名称：';\n    vipLabel.style.fontSize = '12px';\n    vipLabel.style.display = 'block';\n    vipLabel.style.fontWeight = 'bold';\n    vipGroup.appendChild(vipLabel);\n    const vipColumnNameInput = document.createElement('input');\n    vipColumnNameInput.type = 'text';\n    vipColumnNameInput.id = 'vipColumnNameInput';\n    vipColumnNameInput.value = 'VIP等级';\n    vipColumnNameInput.style.width = '100%';\n    vipColumnNameInput.style.marginTop = '4px';\n    vipColumnNameInput.style.padding = '6px';\n    vipColumnNameInput.style.border = '1px solid #ddd';\n    vipColumnNameInput.style.borderRadius = '4px';\n    vipColumnNameInput.title = '输入VIP等级列名关键词';\n    vipGroup.appendChild(vipColumnNameInput);\n\n    const vipFilterSubGroup = document.createElement('div');\n    vipFilterSubGroup.style.marginTop = '4px';\n    const vipSubLabel = document.createElement('label');\n    vipSubLabel.textContent = '筛选VIP等级（多选）：';\n    vipSubLabel.style.fontSize = '12px';\n    vipSubLabel.style.display = 'block';\n    vipFilterSubGroup.appendChild(vipSubLabel);\n    const vipLevelSelect = document.createElement('select');\n    vipLevelSelect.id = 'vipLevelSelect';\n    vipLevelSelect.multiple = true;\n    vipLevelSelect.style.width = '100%';\n    vipLevelSelect.style.height = '80px';\n    vipLevelSelect.style.fontSize = '12px';\n    ['VIP2', 'VIP3', 'VIP1', 'VIP4', 'VIP5'].forEach(vip => {\n        const option = document.createElement('option');\n        option.value = vip;\n        option.textContent = vip;\n        if (vip === 'VIP2' || vip === 'VIP3') {\n            option.selected = true;\n        }\n        vipLevelSelect.appendChild(option);\n    });\n    vipFilterSubGroup.appendChild(vipLevelSelect);\n    vipGroup.appendChild(vipFilterSubGroup);\n    filterArea.appendChild(vipGroup);\n\n    const statusGroup = document.createElement('div');\n    statusGroup.style.marginBottom = '8px';\n    const statusLabel = document.createElement('label');\n    statusLabel.textContent = '订单状态列名称：';\n    statusLabel.style.fontSize = '12px';\n    statusLabel.style.display = 'block';\n    statusLabel.style.fontWeight = 'bold';\n    statusGroup.appendChild(statusLabel);\n    const statusColumnNameInput = document.createElement('input');\n    statusColumnNameInput.type = 'text';\n    statusColumnNameInput.id = 'statusColumnNameInput';\n    statusColumnNameInput.value = '订单状态';\n    statusColumnNameInput.style.width = '100%';\n    statusColumnNameInput.style.marginTop = '4px';\n    statusColumnNameInput.style.padding = '6px';\n    statusColumnNameInput.style.border = '1px solid #ddd';\n    statusColumnNameInput.style.borderRadius = '4px';\n    statusColumnNameInput.title = '输入订单状态列名关键词';\n    statusGroup.appendChild(statusColumnNameInput);\n\n    const statusFilterSubGroup = document.createElement('div');\n    statusFilterSubGroup.style.marginTop = '4px';\n    const statusSubLabel = document.createElement('label');\n    statusSubLabel.textContent = '筛选订单状态（多选）：';\n    statusSubLabel.style.fontSize = '12px';\n    statusSubLabel.style.display = 'block';\n    statusFilterSubGroup.appendChild(statusSubLabel);\n    const orderStatusSelect = document.createElement('select');\n    orderStatusSelect.id = 'orderStatusSelect';\n    orderStatusSelect.multiple = true;\n    orderStatusSelect.style.width = '100%';\n    orderStatusSelect.style.height = '80px';\n    orderStatusSelect.style.fontSize = '12px';\n    ['待付款', '锁定', '待审核', '已完成', '已拒绝', '已付款'].forEach(status => {\n        const option = document.createElement('option');\n        option.value = status;\n        option.textContent = status;\n        if (status === '待付款' || status === '锁定') {\n            option.selected = true;\n        }\n        orderStatusSelect.appendChild(option);\n    });\n    statusFilterSubGroup.appendChild(orderStatusSelect);\n    statusGroup.appendChild(statusFilterSubGroup);\n    filterArea.appendChild(statusGroup);\n\n    const paymentChannelGroup = document.createElement('div');\n    paymentChannelGroup.style.marginBottom = '8px';\n    const paymentChannelLabel = document.createElement('label');\n    paymentChannelLabel.textContent = '支付通道配置：';\n    paymentChannelLabel.style.fontSize = '12px';\n    paymentChannelLabel.style.display = 'block';\n    paymentChannelLabel.style.fontWeight = 'bold';\n    paymentChannelGroup.appendChild(paymentChannelLabel);\n    const paymentChannelInput = document.createElement('input');\n    paymentChannelInput.type = 'text';\n    paymentChannelInput.id = 'paymentChannelInput';\n    paymentChannelInput.value = 'AgPay';\n    paymentChannelInput.style.width = '100%';\n    paymentChannelInput.style.marginTop = '4px';\n    paymentChannelInput.style.padding = '6px';\n    paymentChannelInput.style.border = '1px solid #ddd';\n    paymentChannelInput.style.borderRadius = '4px';\n    paymentChannelInput.title = '输入VIP3审核时使用的支付通道（默认：AgPay）';\n    paymentChannelGroup.appendChild(paymentChannelInput);\n    filterArea.appendChild(paymentChannelGroup);\n\n    const withdrawAmountGroup = document.createElement('div');\n    withdrawAmountGroup.style.marginBottom = '8px';\n    const withdrawAmountLabel = document.createElement('label');\n    withdrawAmountLabel.textContent = '提现金额列名称：';\n    withdrawAmountLabel.style.fontSize = '12px';\n    withdrawAmountLabel.style.display = 'block';\n    withdrawAmountLabel.style.fontWeight = 'bold';\n    withdrawAmountGroup.appendChild(withdrawAmountLabel);\n    const withdrawAmountInput = document.createElement('input');\n    withdrawAmountInput.type = 'text';\n    withdrawAmountInput.id = 'withdrawAmountInput';\n    withdrawAmountInput.value = '提现金额';\n    withdrawAmountInput.style.width = '100%';\n    withdrawAmountInput.style.marginTop = '4px';\n    withdrawAmountInput.style.padding = '6px';\n    withdrawAmountInput.style.border = '1px solid #ddd';\n    withdrawAmountInput.style.borderRadius = '4px';\n    withdrawAmountInput.title = '输入提现金额列名关键词';\n    withdrawAmountGroup.appendChild(withdrawAmountInput);\n    filterArea.appendChild(withdrawAmountGroup);\n\n    contentArea.appendChild(filterArea);\n\n    const helpArea = document.createElement('div');\n    helpArea.style.marginTop = '10px';\n    helpArea.style.padding = '8px';\n    helpArea.style.background = '#e8f4ff';\n    helpArea.style.borderRadius = '4px';\n    helpArea.style.fontSize = '11px';\n    helpArea.style.color = '#0066cc';\n    helpArea.innerHTML = '💡 提示：• VIP2/VIP3完全隔离处理 • 避免步骤冲突 • 独立的处理流程';\n    helpArea.style.flexShrink = '0';\n    contentArea.appendChild(helpArea);\n\n    // 创建调整大小的手柄\n    const resizeHandles = {\n        right: document.createElement('div'),\n        bottom: document.createElement('div'),\n        corner: document.createElement('div')\n    };\n\n    // 右边缘调整大小手柄\n    Object.assign(resizeHandles.right.style, {\n        position: 'absolute',\n        right: '0',\n        top: '0',\n        width: '5px',\n        height: '100%',\n        cursor: 'e-resize',\n        zIndex: 1000,\n    });\n    floatWindow.appendChild(resizeHandles.right);\n\n    // 下边缘调整大小手柄\n    Object.assign(resizeHandles.bottom.style, {\n        position: 'absolute',\n        bottom: '0',\n        left: '0',\n        width: '100%',\n        height: '5px',\n        cursor: 'n-resize',\n        zIndex: 1000,\n    });\n    floatWindow.appendChild(resizeHandles.bottom);\n\n    // 右下角调整大小手柄\n    Object.assign(resizeHandles.corner.style, {\n        position: 'absolute',\n        right: '0',\n        bottom: '0',\n        width: '15px',\n        height: '15px',\n        cursor: 'se-resize',\n        zIndex: 1000,\n        background: 'linear-gradient(135deg, transparent 50%, #ccc 50%)',\n        borderRadius: '0 0 6px 0',\n    });\n    floatWindow.appendChild(resizeHandles.corner);\n\n    // ==================== 拖拽功能 ====================\n    function makeDraggable(element, handle) {\n        let pos = { top: 0, left: 0, x: 0, y: 0 };\n\n        function mouseDownHandler(e) {\n            pos = {\n                left: element.offsetLeft,\n                top: element.offsetTop,\n                x: e.clientX,\n                y: e.clientY,\n            };\n            document.addEventListener('mousemove', mouseMoveHandler);\n            document.addEventListener('mouseup', mouseUpHandler);\n            e.preventDefault();\n        }\n\n        function mouseMoveHandler(e) {\n            const dx = e.clientX - pos.x;\n            const dy = e.clientY - pos.y;\n            element.style.left = pos.left + dx + 'px';\n            element.style.top = pos.top + dy + 'px';\n            element.style.right = 'auto';\n        }\n\n        function mouseUpHandler() {\n            document.removeEventListener('mousemove', mouseMoveHandler);\n            document.removeEventListener('mouseup', mouseUpHandler);\n            saveWindowState();\n        }\n\n        handle.addEventListener('mousedown', mouseDownHandler);\n    }\n\n    // ==================== 调整大小功能 ====================\n    function makeResizable(element) {\n        let isResizing = false;\n        let startX, startY, startWidth, startHeight;\n        let resizeType = '';\n\n        function initResize(e, type) {\n            isResizing = true;\n            resizeType = type;\n            startX = e.clientX;\n            startY = e.clientY;\n            startWidth = element.offsetWidth;\n            startHeight = element.offsetHeight;\n            document.addEventListener('mousemove', doResize);\n            document.addEventListener('mouseup', stopResize);\n            e.preventDefault();\n            e.stopPropagation();\n        }\n\n        function doResize(e) {\n            if (!isResizing) return;\n\n            if (resizeType === 'right' || resizeType === 'corner') {\n                const newWidth = startWidth + (e.clientX - startX);\n                const minWidth = parseInt(window.getComputedStyle(element).minWidth) || 300;\n                const maxWidth = parseInt(window.getComputedStyle(element).maxWidth) || window.innerWidth * 0.9;\n                \n                if (newWidth >= minWidth && newWidth <= maxWidth) {\n                    element.style.width = newWidth + 'px';\n                }\n            }\n\n            if (resizeType === 'bottom' || resizeType === 'corner') {\n                const newHeight = startHeight + (e.clientY - startY);\n                const minHeight = parseInt(window.getComputedStyle(element).minHeight) || 400;\n                const maxHeight = parseInt(window.getComputedStyle(element).maxHeight) || window.innerHeight * 0.9;\n                \n                if (newHeight >= minHeight && newHeight <= maxHeight) {\n                    element.style.height = newHeight + 'px';\n                }\n            }\n        }\n\n        function stopResize() {\n            if (isResizing) {\n                isResizing = false;\n                document.removeEventListener('mousemove', doResize);\n                document.removeEventListener('mouseup', stopResize);\n                saveWindowState();\n            }\n        }\n\n        resizeHandles.right.addEventListener('mousedown', (e) => initResize(e, 'right'));\n        resizeHandles.bottom.addEventListener('mousedown', (e) => initResize(e, 'bottom'));\n        resizeHandles.corner.addEventListener('mousedown', (e) => initResize(e, 'corner'));\n    }\n\n    // ==================== 初始化窗口状态和配置 ====================\n    function initializeWindowAndConfig() {\n        // 加载并应用窗口状态\n        const windowState = loadWindowState();\n        if (windowState) {\n            if (windowState.width) floatWindow.style.width = windowState.width + 'px';\n            if (windowState.height) floatWindow.style.height = windowState.height + 'px';\n            if (windowState.top !== undefined) {\n                floatWindow.style.top = windowState.top + 'px';\n                floatWindow.style.right = 'auto';\n            }\n            if (windowState.left !== undefined) {\n                floatWindow.style.left = windowState.left + 'px';\n                floatWindow.style.right = 'auto';\n            }\n            // 确保窗口在可视区域内\n            const rect = floatWindow.getBoundingClientRect();\n            if (rect.right > window.innerWidth) {\n                floatWindow.style.left = (window.innerWidth - rect.width - 20) + 'px';\n            }\n            if (rect.bottom > window.innerHeight) {\n                floatWindow.style.top = (window.innerHeight - rect.height - 20) + 'px';\n            }\n        }\n\n        // 加载并应用配置\n        const config = loadConfig();\n        if (config) {\n            applyConfig(config);\n            addLog('✓ 已恢复上次保存的配置');\n        }\n    }\n\n    // ==================== 工具函数（共享）====================\n\n    function addLog(msg, isError = false) {\n        const time = new Date().toLocaleTimeString();\n        const line = `[${time}] ${msg}`;\n        \n        if (enableConsoleLog) {\n            if (isError) {\n                console.error(line);\n            } else {\n                console.log(line);\n            }\n        }\n        \n        logHistory.push(line);\n        if (logHistory.length > 20) {\n            logHistory.shift();\n        }\n        \n        logOutput.textContent = logHistory.join('\\n');\n        logOutput.scrollTop = logOutput.scrollHeight;\n    }\n\n    function delay(ms) {\n        return new Promise(resolve => setTimeout(resolve, ms));\n    }\n\n    function startAlarm() {\n        if (isAlarmActive) return;\n        \n        isAlarmActive = true;\n        stopAlarmBtn.style.display = 'inline-block';\n        addLog('🚨 警报已激活！数据行只有1行，请手动处理或点击\"停止警报\"按钮。', true);\n        \n        alarmSoundInterval = setInterval(() => {\n            if (!isAlarmActive) {\n                clearInterval(alarmSoundInterval);\n                return;\n            }\n            \n            try {\n                const audioContext = new (window.AudioContext || window.webkitAudioContext)();\n                const oscillator = audioContext.createOscillator();\n                const gainNode = audioContext.createGain();\n                \n                oscillator.connect(gainNode);\n                gainNode.connect(audioContext.destination);\n                \n                oscillator.frequency.value = 800;\n                oscillator.type = 'sine';\n                \n                gainNode.gain.setValueAtTime(0.1, audioContext.currentTime);\n                gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.3);\n                \n                oscillator.start(audioContext.currentTime);\n                oscillator.stop(audioContext.currentTime + 0.3);\n            } catch (e) {\n                // 静默失败\n            }\n        }, 2000);\n    }\n\n    function stopAlarm() {\n        isAlarmActive = false;\n        if (alarmSoundInterval) {\n            clearInterval(alarmSoundInterval);\n            alarmSoundInterval = null;\n        }\n        stopAlarmBtn.style.display = 'none';\n        addLog('🔕 警报已停止。');\n    }\n\n    function fuzzyMatchColumnName(searchKey, actualColumnName) {\n        if (!searchKey || !actualColumnName) return false;\n        const normalize = (str) => str.replace(/[（）\\(\\)\\s]/g, '');\n        return normalize(actualColumnName).includes(normalize(searchKey));\n    }\n\n    function getColumnIndexByFuzzyMatch(columnName) {\n        const allColumns = Object.keys(columnIndexMap);\n        for (const actualColumn of allColumns) {\n            if (fuzzyMatchColumnName(columnName, actualColumn)) {\n                return columnIndexMap[actualColumn];\n            }\n        }\n        return -1;\n    }\n\n    function getRealColumnName(columnName) {\n        const allColumns = Object.keys(columnIndexMap);\n        for (const actualColumn of allColumns) {\n            if (fuzzyMatchColumnName(columnName, actualColumn)) {\n                return actualColumn;\n            }\n        }\n        return columnName;\n    }\n\n    function clickAllResetButtons() {\n        const buttons = Array.from(document.querySelectorAll('button.el-button'));\n        let clickedCount = 0;\n        buttons.forEach(btn => {\n            if (btn.textContent.trim() === '重置') {\n                btn.click();\n                clickedCount++;\n            }\n        });\n        addLog(`点击了 ${clickedCount} 个\"重置\"按钮`);\n        return clickedCount > 0;\n    }\n\n    async function selectPageSize(pageSizeText) {\n        const paginationSizesSpan = document.querySelector('span.el-pagination__sizes');\n        if (!paginationSizesSpan) {\n            addLog('未找到分页区域 el-pagination__sizes', true);\n            return false;\n        }\n\n        const input = paginationSizesSpan.querySelector('input.el-input__inner');\n        if (!input) {\n            addLog('未找到分页显示数量输入框', true);\n            return false;\n        }\n\n        input.click();\n        addLog('点击分页页数输入框，等待下拉弹出');\n        await delay(600);\n\n        let poppers = Array.from(document.querySelectorAll('div.el-popper.is-pure.is-light.el-select__popper'));\n\n        if (poppers.length === 0) {\n            poppers = Array.from(document.querySelectorAll('div.el-popper'));\n            addLog(`使用方法2找到 ${poppers.length} 个el-popper`);\n        }\n\n        if (poppers.length === 0) {\n            const itemContainers = Array.from(document.querySelectorAll('div:has(li.el-select-dropdown__item)'));\n            addLog(`使用方法3找到 ${itemContainers.length} 个包含选项的div`);\n            poppers = itemContainers;\n        }\n\n        if (poppers.length === 0) {\n            addLog('未找到分页下拉选项弹窗', true);\n            return false;\n        }\n\n        addLog(`找到 ${poppers.length} 个候选弹窗，开始逐个检查...`);\n        let matchedItem = null;\n        let matchedPopper = null;\n\n        for (let i = 0; i < poppers.length; i++) {\n            const popper = poppers[i];\n            const isHidden = popper.getAttribute('aria-hidden') === 'true' || popper.style.display === 'none' || window.getComputedStyle(popper).display === 'none';\n            if (isHidden) {\n                addLog(`弹窗${i + 1}: 隐藏状态，跳过`);\n                continue;\n            }\n\n            const items = Array.from(popper.querySelectorAll('li.el-select-dropdown__item'));\n            if (items.length === 0) {\n                addLog(`弹窗${i + 1}: 无选项列表，跳过`);\n                continue;\n            }\n\n            addLog(`弹窗${i + 1}: 包含 ${items.length} 个选项`);\n\n            for (const li of items) {\n                const span = li.querySelector('span');\n                const itemText = span ? span.textContent.trim() : li.textContent.trim();\n                addLog(` - 选项文本: \"${itemText}\"`);\n                if (itemText === pageSizeText.trim()) {\n                    matchedItem = li;\n                    matchedPopper = popper;\n                    addLog(`✓ 找到匹配的弹窗${i + 1}，包含选项: \"${pageSizeText}\"`);\n                    break;\n                }\n            }\n\n            if (matchedItem) {\n                break;\n            }\n        }\n\n        if (!matchedItem) {\n            addLog(`分页下拉选项中未找到匹配项: \"${pageSizeText}\"，但页面可能已自动设置，继续执行`);\n            await delay(500);\n            return true;\n        }\n\n        matchedItem.click();\n        addLog(`✓ 选择分页显示数量: \"${pageSizeText}\"`);\n        await delay(1300);\n        return true;\n    }\n\n    async function waitForLoadComplete() {\n        addLog('等待页面加载完成...');\n        const startTime = Date.now();\n        while (Date.now() - startTime < MAX_LOAD_WAIT_TIME) {\n            const contentArea = document.querySelector('div.content');\n            if (contentArea && !contentArea.classList.contains('el-loading-parent--relative')) {\n                addLog('✓ 页面加载完成');\n                return true;\n            }\n\n            const loadingElements = document.querySelectorAll('.el-loading-mask');\n            if (loadingElements.length === 0) {\n                addLog('✓ 页面加载完成（无loading指示器）');\n                return true;\n            }\n\n            await delay(LOAD_CHECK_INTERVAL);\n        }\n        addLog('⚠ 等待加载超时，继续执行', true);\n        return false;\n    }\n\n    function parseMultiLineCellData(tdElement) {\n        if (!tdElement) return [];\n        \n        const divs = Array.from(tdElement.querySelectorAll('div:not(.tag-box)'));\n        if (divs.length > 0) {\n            const validLines = divs.map(div => div.textContent.trim()).filter(text => {\n                return text && text !== '0';\n            });\n            \n            if (validLines.length > 0) {\n                const firstLine = validLines[0];\n                validLines.shift();\n                addLog(`已删除第一行数据: \"${firstLine}\"`);\n            }\n            \n            return validLines;\n        }\n\n        const text = tdElement.textContent || '';\n        const lines = text.split(/[\\r\\n]+/).map(line => line.trim()).filter(line => {\n            return line && line !== '0';\n        });\n        \n        if (lines.length > 0) {\n            const firstLine = lines[0];\n            lines.shift();\n            addLog(`已删除第一行数据: \"${firstLine}\"`);\n        }\n        \n        return lines;\n    }\n\n    function extractMemberIdsFromMultiLine(multiLineData) {\n        const allIds = [];\n        const idPattern = /\\d{6,8}/g;\n        multiLineData.forEach(line => {\n            const matches = line.match(idPattern);\n            if (matches) {\n                allIds.push(...matches);\n            }\n        });\n        return allIds;\n    }\n\n    function getColumnIndexMap() {\n        const tableWrapper = document.querySelector('div.el-table__inner-wrapper');\n        if (!tableWrapper) {\n            addLog('未找到表格容器 el-table__inner-wrapper', true);\n            return {};\n        }\n\n        const headerRow = tableWrapper.querySelector('table thead tr');\n        if (!headerRow) {\n            addLog('未找到表格头部行', true);\n            return {};\n        }\n\n        const map = {};\n        const reverseMap = {};\n        const columnRowCounts = {};\n\n        const headers = Array.from(headerRow.querySelectorAll('th'));\n        headers.forEach((th, index) => {\n            const cell = th.querySelector('.cell');\n            if (cell) {\n                const headerDivs = Array.from(cell.querySelectorAll('div:not(.tag-box)'));\n                if (headerDivs.length > 0) {\n                    const headerLines = headerDivs.map(div => div.textContent.trim()).filter(text => text && text !== '0');\n                    const mainHeaderName = headerLines[0];\n                    map[mainHeaderName] = index;\n                    reverseMap[index] = mainHeaderName;\n                    columnRowCounts[index] = headerLines.length;\n                    if (headerLines.length > 1) {\n                        const fullHeaderName = headerLines.join(' ');\n                        map[fullHeaderName] = index;\n                    }\n                } else {\n                    const headerText = cell.textContent.trim();\n                    map[headerText] = index;\n                    reverseMap[index] = headerText;\n                    columnRowCounts[index] = 1;\n                }\n            } else {\n                const headerText = th.textContent.trim();\n                map[headerText] = index;\n                reverseMap[index] = headerText;\n                columnRowCounts[index] = 1;\n            }\n        });\n\n        columnIndexMap = map;\n        columnIndexReverseMap = reverseMap;\n        window.columnRowCounts = columnRowCounts;\n        addLog(`✓ 表格列名映射: ${JSON.stringify(map)}`);\n        addLog(`✓ 列名行数信息: ${JSON.stringify(columnRowCounts)}`);\n        return map;\n    }\n\n    function readTableRowsData() {\n        const rowsData = [];\n        const tableWrapper = document.querySelector('div.el-table__inner-wrapper');\n        if (!tableWrapper) {\n            addLog('未找到表格容器 el-table__inner-wrapper', true);\n            return rowsData;\n        }\n\n        getColumnIndexMap();\n\n        const rows = tableWrapper.querySelectorAll('table tbody tr');\n        if (!rows || rows.length === 0) {\n            addLog('表格暂无数据行', true);\n            return rowsData;\n        }\n\n        rows.forEach((tr, index) => {\n            const rowObj = {\n                _realData: {},\n                _multiLineData: {},\n                _indexedData: {}\n            };\n\n            const cells = tr.querySelectorAll('td');\n            cells.forEach((td, idx) => {\n                const multiLineData = parseMultiLineCellData(td);\n                rowObj._multiLineData[idx] = multiLineData;\n\n                const indexedData = {};\n                multiLineData.forEach((line, lineIndex) => {\n                    indexedData[lineIndex] = line;\n                });\n                rowObj._indexedData[idx] = indexedData;\n\n                rowObj[`col_${idx}`] = td.textContent.trim();\n\n                if (multiLineData.length === 1) {\n                    rowObj[`col_${idx}`] = multiLineData[0];\n                } else if (multiLineData.length > 1) {\n                    rowObj[`col_${idx}`] = multiLineData.join('\\n');\n                }\n            });\n\n            rowsData.push(rowObj);\n        });\n\n        return rowsData;\n    }\n\n    function checkRowFilterConditions(rowData, vipColumnName, vipLevels, statusColumnName, orderStatuses) {\n        const vipIndex = getColumnIndexByFuzzyMatch(vipColumnName);\n        const statusIndex = getColumnIndexByFuzzyMatch(statusColumnName);\n\n        if (vipIndex === -1 || statusIndex === -1) {\n            const realVipName = getRealColumnName(vipColumnName);\n            const realStatusName = getRealColumnName(statusColumnName);\n            addLog(`⚠ 未找到列 \"${realVipName}\" 或 \"${realStatusName}\"，跳过筛选`, true);\n            return true;\n        }\n\n        const vipLevel = rowData[`col_${vipIndex}`] || '';\n        const orderStatus = rowData[`col_${statusIndex}`] || '';\n\n        const vipMatch = vipLevels.length === 0 || vipLevels.some(level => vipLevel.includes(level));\n        const statusMatch = orderStatuses.length === 0 || orderStatuses.some(status => orderStatus.includes(status));\n\n        return vipMatch && statusMatch;\n    }\n\n    function smartFilterTableData(memberIdColumnName, vipColumnName, vipLevels, statusColumnName, orderStatuses) {\n        const allRows = readTableRowsData();\n        if (allRows.length === 0) {\n            addLog('表格为空，无数据可读取');\n            return { allRows: [], filteredRows: [], lastMemberId: null };\n        }\n\n        const memberIdIndex = getColumnIndexByFuzzyMatch(memberIdColumnName);\n        const filteredRows = allRows.filter(row => \n            checkRowFilterConditions(row, vipColumnName, vipLevels, statusColumnName, orderStatuses)\n        );\n\n        addLog(`✓ 表格数据读取完成：总计 ${allRows.length} 行`);\n        \n        if (vipLevels.length > 0 || orderStatuses.length > 0) {\n            const realVipName = getRealColumnName(vipColumnName);\n            const realStatusName = getRealColumnName(statusColumnName);\n            addLog(`✓ 筛选条件 - ${realVipName}: [${vipLevels.join(', ')}], ${realStatusName}: [${orderStatuses.join(', ')}]`);\n            addLog(`✓ 筛选结果：${filteredRows.length} 行匹配`);\n            \n            if (filteredRows.length > 0) {\n                const lastRow = filteredRows[filteredRows.length - 1];\n                const sampleData = {};\n                Object.keys(lastRow).forEach(key => {\n                    if (!key.startsWith('_')) {\n                        const idx = parseInt(key.replace('col_', ''));\n                        const realColumnName = columnIndexReverseMap[idx] || key;\n                        sampleData[realColumnName] = lastRow[key];\n                    }\n                });\n                addLog(`筛选后最后一行: ${JSON.stringify(sampleData)}`);\n            }\n        }\n\n        const targetRows = filteredRows.length > 0 ? filteredRows : allRows;\n        const lastRow = targetRows[targetRows.length - 1];\n        let lastMemberId = null;\n\n        if (lastRow && memberIdIndex !== -1) {\n            const multiLineData = lastRow._multiLineData[memberIdIndex] || [];\n            addLog(`会员ID列多行数据: ${JSON.stringify(multiLineData)}`);\n            \n            const indexedData = lastRow._indexedData[memberIdIndex] || {};\n            addLog(`会员ID列索引数据: ${JSON.stringify(indexedData)}`);\n            \n            const targetRowIndex = 0;\n            const targetLineData = indexedData[targetRowIndex] || (multiLineData[targetRowIndex] || '');\n            addLog(`目标行数据（行索引${targetRowIndex}）: \"${targetLineData}\"`);\n            \n            const idPattern = /\\d{6,8}/;\n            const match = targetLineData.match(idPattern);\n            if (match) {\n                lastMemberId = match[0];\n                addLog(`✓ 记录筛选后最后一行会员ID：${lastMemberId}`);\n            } else {\n                addLog(`⚠ 目标行数据\"${targetLineData}\"中未找到有效的6-8位数字ID`, true);\n            }\n        } else if (lastRow && memberIdIndex === -1) {\n            const realMemberName = getRealColumnName(memberIdColumnName);\n            addLog(`⚠ 未找到会员ID列\"${realMemberName}\"，无法提取ID`, true);\n        }\n\n        return { allRows, filteredRows, lastMemberId };\n    }\n\n    function clickAdvancedSearchButton() {\n        const allButtons = document.querySelectorAll('button, span.el-button__inner, div.el-button');\n        let targetButton = null;\n        \n        allButtons.forEach(btn => {\n            if (btn.textContent && btn.textContent.trim() === '高级搜索') {\n                if (btn.tagName === 'BUTTON') {\n                    targetButton = btn;\n                } else if (!targetButton) {\n                    const parentButton = btn.closest('button');\n                    if (parentButton) {\n                        targetButton = parentButton;\n                    }\n                }\n            }\n        });\n\n        if (targetButton) {\n            targetButton.click();\n            addLog('✓ 已点击\"高级搜索\"按钮');\n            return true;\n        } else {\n            addLog('✗ 未找到\"高级搜索\"按钮', true);\n            return false;\n        }\n    }\n\n    function findButtonByText(text) {\n        const buttons = Array.from(document.querySelectorAll('button'));\n        for (const btn of buttons) {\n            if (btn.textContent && btn.textContent.trim().includes(text)) {\n                return btn;\n            }\n        }\n        const spanButtons = Array.from(document.querySelectorAll('span.el-button__inner'));\n        for (const span of spanButtons) {\n            if (span.textContent && span.textContent.trim().includes(text)) {\n                const parentButton = span.closest('button');\n                if (parentButton) return parentButton;\n            }\n        }\n        return null;\n    }\n\n    async function waitForElementClickable(text) {\n        const startTime = Date.now();\n        while (Date.now() - startTime < CONFIRM_BUTTON_WAIT_TIME) {\n            const element = findButtonByText(text);\n            if (element) {\n                const rect = element.getBoundingClientRect();\n                const isVisible = rect.width > 0 && rect.height > 0;\n                const isDisabled = element.disabled || element.getAttribute('disabled') !== null;\n                \n                if (isVisible && !isDisabled) {\n                    return element;\n                }\n            }\n            await delay(CONFIRM_BUTTON_CHECK_INTERVAL);\n        }\n        return null;\n    }\n\n    async function waitForPopupClose() {\n        const startTime = Date.now();\n        while (Date.now() - startTime < POPUP_CLOSE_WAIT_TIME) {\n            const popup = document.querySelector('div.el-overlay.special-dialog');\n            if (!popup) {\n                addLog('✓ 高级搜索弹窗已关闭');\n                return true;\n            }\n            const isHidden = popup.style.display === 'none' || window.getComputedStyle(popup).display === 'none';\n            if (isHidden) {\n                addLog('✓ 高级搜索弹窗已隐藏');\n                return true;\n            }\n            await delay(POPUP_CLOSE_CHECK_INTERVAL);\n        }\n        addLog('⚠ 等待弹窗关闭超时', true);\n        return false;\n    }\n\n    async function waitForConfirmDialogButton() {\n        const maxWaitTime = 5000;\n        const checkInterval = 100;\n        const startTime = Date.now();\n        \n        while (Date.now() - startTime < maxWaitTime) {\n            const messageBox = document.querySelector('div.el-message-box') || \n                              document.querySelector('div.el-dialog__wrapper');\n            \n            if (messageBox) {\n                const buttons = messageBox.querySelectorAll('button');\n                for (const btn of buttons) {\n                    const btnText = btn.textContent || '';\n                    if (btnText.includes('确定')) {\n                        btn.click();\n                        return true;\n                    }\n                }\n            }\n            \n            await delay(checkInterval);\n        }\n        \n        return false;\n    }\n\n    async function waitForLoadCompleteWithTimeout(timeoutMs = 3000) {\n        addLog(`等待页面加载完成（最大等待${timeoutMs}ms）...`);\n        const startTime = Date.now();\n        \n        while (Date.now() - startTime < timeoutMs) {\n            const contentArea = document.querySelector('div.content');\n            if (contentArea && !contentArea.classList.contains('el-loading-parent--relative')) {\n                addLog('✓ 页面加载完成');\n                return true;\n            }\n\n            const loadingElements = document.querySelectorAll('.el-loading-mask');\n            if (loadingElements.length === 0) {\n                addLog('✓ 页面加载完成（无loading指示器）');\n                return true;\n            }\n\n            await delay(LOAD_CHECK_INTERVAL);\n        }\n        \n        addLog('⚠ 等待页面加载超时', true);\n        return false;\n    }\n\n    async function resetPageByTabSwitch() {\n        addLog('开始通过切换标签页重置页面...');\n        \n        try {\n            const tabContainer = document.querySelector('div.scrollbar-flex-content');\n            if (!tabContainer) {\n                addLog('⚠ 未找到标签容器 div.scrollbar-flex-content', true);\n                return false;\n            }\n            \n            const tags = tabContainer.querySelectorAll('div.tags-li');\n            if (tags.length === 0) {\n                addLog('⚠ 未找到任何标签', true);\n                return false;\n            }\n            \n            let homeTag = null;\n            let withdrawOrderTag = null;\n            \n            tags.forEach(tag => {\n                const text = tag.textContent || '';\n                if (text.includes('首页')) {\n                    homeTag = tag;\n                } else if (text.includes('提现订单列表')) {\n                    withdrawOrderTag = tag;\n                }\n            });\n            \n            if (homeTag) {\n                addLog('切换到\"首页\"标签...');\n                const clickableLink = homeTag.querySelector('a');\n                if (clickableLink) {\n                    clickableLink.click();\n                } else {\n                    homeTag.click();\n                }\n                await delay(1000);\n                addLog('✓ 已切换到\"首页\"标签');\n            } else {\n                addLog('⚠ 未找到\"首页\"标签', true);\n            }\n            \n            if (withdrawOrderTag) {\n                addLog('切换到\"提现订单列表\"标签...');\n                const clickableLink = withdrawOrderTag.querySelector('a');\n                if (clickableLink) {\n                    clickableLink.click();\n                } else {\n                    withdrawOrderTag.click();\n                }\n                await delay(1000);\n                addLog('✓ 已切换到\"提现订单列表\"标签');\n            } else {\n                addLog('⚠ 未找到\"提现订单列表\"标签', true);\n            }\n            \n            addLog('✓ 标签页重置完成');\n            return true;\n            \n        } catch (e) {\n            addLog(`⚠ 标签页重置异常: ${e.message}`, true);\n            return false;\n        }\n    }\n\n    async function fillAdvancedSearchAndConfirm(memberId) {\n        if (!memberId) {\n            addLog('⚠ 会员ID为空，跳过高级搜索填入', true);\n            return false;\n        }\n\n        addLog('等待高级搜索弹窗出现...');\n        await delay(800);\n\n        const userIdLabel = Array.from(document.querySelectorAll('label, span')).find(el => \n            el.textContent && el.textContent.includes('用户ID')\n        );\n        \n        if (!userIdLabel) {\n            addLog('⚠ 未找到\"用户ID\"标签', true);\n            return false;\n        }\n\n        const userIdInput = userIdLabel.parentElement?.querySelector('input') || \n                           userIdLabel.nextElementSibling?.querySelector('input') || \n                           userIdLabel.closest('.el-form-item')?.querySelector('input');\n        \n        if (!userIdInput) {\n            addLog('⚠ 未找到\"用户ID\"输入框', true);\n            return false;\n        }\n\n        userIdInput.value = '';\n        userIdInput.value = memberId;\n        userIdInput.dispatchEvent(new Event('input', { bubbles: true }));\n        userIdInput.dispatchEvent(new Event('change', { bubbles: true }));\n        userIdInput.dispatchEvent(new Event('blur', { bubbles: true }));\n        addLog(`✓ 已输入会员ID: ${memberId}`);\n        await delay(500);\n\n        addLog('等待\"确认\"按钮可点击...');\n        let confirmButton = await waitForElementClickable('确认');\n        \n        if (!confirmButton) {\n            addLog('⚠ 未找到可点击的\"确认\"按钮', true);\n            return false;\n        }\n\n        let popupClosed = false;\n        for (let attempt = 1; attempt <= MAX_CONFIRM_RETRIES; attempt++) {\n            addLog(`点击确认按钮（尝试 ${attempt}/${MAX_CONFIRM_RETRIES}）`);\n            confirmButton.click();\n            \n            popupClosed = await waitForPopupClose();\n            if (popupClosed) {\n                addLog('✓ 确认按钮点击成功，弹窗已关闭');\n                break;\n            }\n            \n            if (attempt < MAX_CONFIRM_RETRIES) {\n                addLog(`弹窗未关闭，${attempt}秒后重试...`);\n                await delay(1000);\n                confirmButton = await waitForElementClickable('确认');\n                if (!confirmButton) {\n                    addLog('⚠ 重试时未找到确认按钮', true);\n                    break;\n                }\n            }\n        }\n\n        if (!popupClosed) {\n            addLog('⚠ 多次尝试后弹窗仍未关闭，搜索可能未执行', true);\n            return false;\n        }\n\n        return true;\n    }\n\n    async function waitForMemberInfoPopupLoad() {\n        addLog('等待会员信息弹窗出现并加载完成...');\n        const startTime = Date.now();\n        \n        while (Date.now() - startTime < MAX_LOAD_WAIT_TIME) {\n            const dialogs = Array.from(document.querySelectorAll('div.el-dialog'));\n            const memberInfoDialog = dialogs.find(dialog => {\n                const text = dialog.textContent || '';\n                return text.includes('会员信息') && text.includes('会员ID');\n            });\n            \n            if (memberInfoDialog) {\n                addLog('✓ 会员信息弹窗已打开');\n                break;\n            }\n            \n            await delay(LOAD_CHECK_INTERVAL);\n        }\n        \n        const loadStartTime = Date.now();\n        while (Date.now() - loadStartTime < MAX_LOAD_WAIT_TIME) {\n            const dialogs = Array.from(document.querySelectorAll('div.el-dialog'));\n            const memberInfoDialog = dialogs.find(dialog => {\n                const text = dialog.textContent || '';\n                return text.includes('会员信息') && text.includes('会员ID');\n            });\n            \n            if (memberInfoDialog) {\n                const maskContainers = memberInfoDialog.querySelectorAll('div.mask-container');\n                \n                if (maskContainers.length > 0) {\n                    const maskContainer = maskContainers[0];\n                    const hasLoadingClass = maskContainer.classList.contains('el-loading-parent--relative');\n                    \n                    if (!hasLoadingClass) {\n                        addLog('✓ 会员信息弹窗内容加载完成');\n                        return true;\n                    } else {\n                        addLog('弹窗正在加载中...');\n                    }\n                }\n            }\n            \n            await delay(LOAD_CHECK_INTERVAL);\n        }\n        \n        addLog('⚠ 等待会员信息弹窗加载超时，继续执行', true);\n        return false;\n    }\n\n    async function clickAccountStatusEditIcon() {\n        const formItems = Array.from(document.querySelectorAll('div.el-form-item'));\n        \n        for (const formItem of formItems) {\n            const text = formItem.textContent || '';\n            \n            if (text.includes('账号状态')) {\n                addLog('找到账号状态区域');\n                \n                const allElements = Array.from(formItem.querySelectorAll('*'));\n                let foundAccountStatusText = false;\n                \n                for (const element of allElements) {\n                    const elemText = element.textContent || '';\n                    \n                    if (elemText === '账号状态' || elemText.includes('账号状态')) {\n                        foundAccountStatusText = true;\n                        continue;\n                    }\n                    \n                    if (foundAccountStatusText && element.tagName === 'I') {\n                        addLog('找到账号状态后面的i标签编辑图标');\n                        element.click();\n                        await delay(300);\n                        return true;\n                    }\n                }\n                \n                const svgIcons = formItem.querySelectorAll('svg');\n                if (svgIcons.length > 0) {\n                    addLog(`找到 ${svgIcons.length} 个svg图标，点击第一个`);\n                    svgIcons[0].click();\n                    await delay(300);\n                    return true;\n                }\n                \n                for (const element of allElements) {\n                    const elemText = element.textContent || '';\n                    if (elemText.includes('(') && elemText.includes(')') && elemText.length < 10) {\n                        addLog('找到编辑图标元素（括号样式）');\n                        element.click();\n                        await delay(300);\n                        return true;\n                    }\n                }\n                \n                const editButtons = formItem.querySelectorAll('button, i.el-icon-edit, span.el-icon-edit');\n                if (editButtons.length > 0) {\n                    addLog('找到编辑按钮/图标');\n                    editButtons[0].click();\n                    await delay(300);\n                    return true;\n                }\n                \n                const clickableElements = formItem.querySelectorAll('[style*=\"cursor\"], [class*=\"edit\"]');\n                for (const elem of clickableElements) {\n                    if (elem !== formItem && elem.offsetWidth > 0 && elem.offsetHeight > 0) {\n                        addLog('找到可点击的编辑元素');\n                        elem.click();\n                        await delay(300);\n                        return true;\n                    }\n                }\n                \n                break;\n            }\n        }\n        \n        return false;\n    }\n\n    async function switchToWithdrawAccountTab() {\n        addLog('步骤18：查找并点击\"提现账户\"标签页...');\n        await delay(500);\n        \n        const tabItems = Array.from(document.querySelectorAll('div.el-tabs__item.is-top'));\n        \n        if (tabItems.length === 0) {\n            addLog('⚠ 未找到标签页div，尝试其他方式查找', true);\n            const allElements = Array.from(document.querySelectorAll('*'));\n            for (const element of allElements) {\n                const text = element.textContent || '';\n                if (text === '提现账户' || text.includes('提现账户')) {\n                    const clickable = element.closest('[class*=\"tab\"]') || element.closest('[role=\"tab\"]');\n                    if (clickable) {\n                        addLog(`找到\"提现账户\"标签页: ${text}`);\n                        clickable.click();\n                        addLog('✓ 已点击\"提现账户\"标签页');\n                        await delay(800);\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        \n        addLog(`找到 ${tabItems.length} 个标签页div`);\n        \n        for (const tabItem of tabItems) {\n            const text = tabItem.textContent || '';\n            if (text.includes('提现账户')) {\n                addLog(`找到\"提现账户\"标签页: ${text}`);\n                tabItem.click();\n                addLog('✓ 已点击\"提现账户\"标签页');\n                await delay(800);\n                return true;\n            }\n        }\n        \n        addLog('⚠ 未找到包含\"提现账户\"文字的标签页', true);\n        return false;\n    }\n\n    async function waitForWithdrawAccountTableLoad() {\n        addLog('等待提现账户表格加载完成...');\n        const startTime = Date.now();\n        \n        while (Date.now() - startTime < MAX_LOAD_WAIT_TIME) {\n            const dialogs = Array.from(document.querySelectorAll('div.el-dialog'));\n            const memberInfoDialog = dialogs.find(dialog => {\n                const text = dialog.textContent || '';\n                return text.includes('会员信息') && text.includes('会员ID');\n            });\n            \n            if (memberInfoDialog) {\n                const maskContainers = memberInfoDialog.querySelectorAll('div.mask-container');\n                \n                if (maskContainers.length > 0) {\n                    const maskContainer = maskContainers[0];\n                    const hasLoadingClass = maskContainer.classList.contains('el-loading-parent--relative');\n                    \n                    if (!hasLoadingClass) {\n                        addLog('✓ 提现账户表格加载完成');\n                        return true;\n                    } else {\n                        addLog('提现账户表格正在加载中...');\n                    }\n                }\n            }\n            \n            await delay(LOAD_CHECK_INTERVAL);\n        }\n        \n        addLog('⚠ 等待提现账户表格加载超时，继续执行', true);\n        return false;\n    }\n\n    async function clickModifyButton() {\n        addLog('步骤19：在会员信息弹窗内查找并点击\"修改\"按钮...');\n        await delay(500);\n        \n        const memberInfoDialogs = Array.from(document.querySelectorAll('div.el-dialog'));\n        const memberInfoDialog = memberInfoDialogs.find(dialog => {\n            const dialogText = dialog.textContent || '';\n            return dialogText.includes('会员信息') && dialogText.includes('会员ID');\n        });\n        \n        if (!memberInfoDialog) {\n            addLog('⚠ 未找到\"会员信息\"弹窗，无法查找修改按钮', true);\n            return false;\n        }\n        \n        addLog('✓ 已定位到\"会员信息\"弹窗');\n        \n        const tableDivs = Array.from(\n            memberInfoDialog.querySelectorAll(\n                'div.el-table--fit.el-table--border.el-table--enable-row-transition.el-table.el-table--layout-fixed.is-scrolling-none'\n            )\n        );\n        \n        if (tableDivs.length === 0) {\n            addLog('⚠ 在会员信息弹窗内未找到提现账户表格div', true);\n            return false;\n        }\n        \n        addLog(`找到 ${tableDivs.length} 个表格div`);\n        const tableDiv = tableDivs[0];\n        \n        const headers = Array.from(tableDiv.querySelectorAll('th'));\n        let operationColumnIndex = -1;\n        \n        for (let i = 0; i < headers.length; i++) {\n            const headerText = headers[i].textContent || '';\n            if (headerText.includes('操作')) {\n                operationColumnIndex = i;\n                addLog(`找到\"操作\"列，索引为: ${i}`);\n                break;\n            }\n        }\n        \n        if (operationColumnIndex === -1) {\n            addLog('⚠ 未找到\"操作\"列', true);\n            return false;\n        }\n        \n        const rows = Array.from(tableDiv.querySelectorAll('tbody tr'));\n        addLog(`找到 ${rows.length} 个数据行`);\n        \n        if (rows.length === 0) {\n            addLog('⚠ 表格中没有数据行', true);\n            return false;\n        }\n        \n        const firstRow = rows[0];\n        const cells = Array.from(firstRow.querySelectorAll('td'));\n        \n        if (cells.length <= operationColumnIndex) {\n            addLog('⚠ 操作列索引超出范围', true);\n            return false;\n        }\n        \n        const operationCell = cells[operationColumnIndex];\n        \n        let buttons = Array.from(operationCell.querySelectorAll('button'));\n        addLog(`方法1（button标签）：在\"操作\"列中找到 ${buttons.length} 个按钮`);\n        \n        if (buttons.length === 0) {\n            const allClickable = Array.from(operationCell.querySelectorAll('span, a, div[onclick], [class*=\"button\"], [role=\"button\"]'));\n            addLog(`方法2（所有可点击元素）：在\"操作\"列中找到 ${allClickable.length} 个可点击元素`);\n            \n            buttons = allClickable.filter(el => {\n                const text = el.textContent || '';\n                return text.includes('修改');\n            });\n            addLog(`方法2（过滤后）：找到 ${buttons.length} 个包含\"修改\"的可点击元素`);\n        }\n        \n        if (buttons.length === 0) {\n            const allElements = operationCell.querySelectorAll('*');\n            addLog(`方法3（深度遍历）：在\"操作\"列中找到 ${allElements.length} 个所有元素`);\n            \n            const modifyElements = [];\n            allElements.forEach(el => {\n                const text = el.textContent || '';\n                if (text.includes('修改')) {\n                    const isClickable = el.hasAttribute('onclick') || \n                                       el.hasAttribute('href') ||\n                                       el.getAttribute('role') === 'button' ||\n                                       el.className && (\n                                           el.className.includes('btn') ||\n                                           el.className.includes('button') ||\n                                           el.className.includes('link') ||\n                                           el.className.includes('click')\n                                       );\n                    if (isClickable) {\n                        modifyElements.push(el);\n                    }\n                }\n            });\n            buttons = modifyElements;\n            addLog(`方法3（深度遍历+过滤）：找到 ${buttons.length} 个包含\"修改\"的可点击元素`);\n        }\n        \n        if (buttons.length === 0) {\n            addLog('⚠ 未找到任何\"修改\"按钮或可点击元素', true);\n            return false;\n        }\n        \n        addLog(`✓ 总共找到 ${buttons.length} 个\"修改\"相关元素`);\n        \n        for (let i = 0; i < buttons.length; i++) {\n            const button = buttons[i];\n            const buttonText = button.textContent || '';\n            const tagName = button.tagName || '未知';\n            const className = button.className || '无';\n            \n            addLog(`尝试点击第 ${i + 1} 个元素: 标签=${tagName}, 文本=\"${buttonText.substring(0, 20)}\", class=\"${className.substring(0, 30)}\"`);\n            \n            try {\n                button.click();\n                addLog(`✓ 已点击\"修改\"相关元素（第 ${i + 1} 个）`);\n                await delay(800);\n                return true;\n            } catch (e) {\n                addLog(`⚠ 点击第 ${i + 1} 个元素失败: ${e.message}`, true);\n                continue;\n            }\n        }\n        \n        addLog('⚠ 所有\"修改\"元素点击都失败', true);\n        return false;\n    }\n\n    async function waitForModifyAccountPopup() {\n        addLog('等待修改账号弹窗出现...');\n        const startTime = Date.now();\n        \n        while (Date.now() - startTime < MAX_LOAD_WAIT_TIME) {\n            const allDivs = Array.from(document.querySelectorAll('div.el-dialog, div.el-overlay'));\n            \n            for (const dialog of allDivs) {\n                const text = dialog.textContent || '';\n                if (text.includes('账号') && text.includes('姓名') && (text.includes('取消') || text.includes('保存'))) {\n                    addLog('✓ 修改账号弹窗已出现');\n                    return true;\n                }\n            }\n            \n            await delay(LOAD_CHECK_INTERVAL);\n        }\n        \n        addLog('⚠ 等待修改账号弹窗超时，继续执行', true);\n        return false;\n    }\n\n    async function modifyAccountNumber() {\n        addLog('步骤20：开始账号智能修改流程...');\n        \n        const accountLabels = Array.from(document.querySelectorAll('label, span'));\n        let accountInput = null;\n        \n        for (const label of accountLabels) {\n            const labelText = label.textContent || '';\n            if (labelText === '账号' || labelText.includes('账号')) {\n                accountInput = label.parentElement?.querySelector('input') || \n                               label.nextElementSibling?.querySelector('input') || \n                               label.closest('.el-form-item')?.querySelector('input');\n                if (accountInput) {\n                    addLog(`找到账号输入框，当前值: ${accountInput.value}`);\n                    break;\n                }\n            }\n        }\n        \n        if (!accountInput) {\n            addLog('⚠ 未找到账号输入框', true);\n            return false;\n        }\n        \n        const originalAccount = accountInput.value || '';\n        addLog(`原始账号: ${originalAccount}`);\n        \n        if (!originalAccount) {\n            addLog('⚠ 账号为空，无法修改', true);\n            return false;\n        }\n        \n        if (originalAccount.length < 3) {\n            addLog('⚠ 账号长度不足3位，无法修改', true);\n            return false;\n        }\n        \n        const accountDigits = originalAccount.split('');\n        const middleIndex = Math.floor(accountDigits.length / 2);\n        const originalDigit = accountDigits[middleIndex];\n        \n        addLog(`账号长度: ${accountDigits.length}, 中间位索引: ${middleIndex}, 原始数字: ${originalDigit}`);\n        \n        let success = false;\n        let modifiedAccount = '';\n        \n        for (let offset = 1; offset <= 9; offset++) {\n            let newDigitForward = parseInt(originalDigit) + offset;\n            if (newDigitForward <= 9) {\n                accountDigits[middleIndex] = newDigitForward.toString();\n                modifiedAccount = accountDigits.join('');\n                \n                addLog(`尝试正向偏移 +${offset}: ${originalAccount} -> ${modifiedAccount}`);\n                \n                accountInput.value = '';\n                accountInput.value = modifiedAccount;\n                accountInput.dispatchEvent(new Event('input', { bubbles: true }));\n                accountInput.dispatchEvent(new Event('change', { bubbles: true }));\n                \n                await delay(500);\n                \n                const saveResult = await clickSaveButton();\n                \n                if (saveResult) {\n                    await delay(1000);\n                    const hasSuccessMessage = checkSuccessMessage();\n                    \n                    if (hasSuccessMessage) {\n                        addLog(`✓ 账号修改成功！${originalAccount} -> ${modifiedAccount}`);\n                        success = true;\n                        break;\n                    } else {\n                        const hasErrorMessage = checkAccountExistsMessage();\n                        if (hasErrorMessage) {\n                            addLog(`提示：账号已存在，继续尝试其他修改...`);\n                            await delay(500);\n                        } else {\n                            addLog(`保存点击成功，但未检测到明确提示，继续尝试...`);\n                            await delay(500);\n                        }\n                    }\n                }\n                \n                accountDigits[middleIndex] = originalDigit;\n            }\n            \n            let newDigitBackward = parseInt(originalDigit) - offset;\n            if (newDigitBackward >= 0) {\n                accountDigits[middleIndex] = newDigitBackward.toString();\n                modifiedAccount = accountDigits.join('');\n                \n                addLog(`尝试负向偏移 -${offset}: ${originalAccount} -> ${modifiedAccount}`);\n                \n                accountInput.value = '';\n                accountInput.value = modifiedAccount;\n                accountInput.dispatchEvent(new Event('input', { bubbles: true }));\n                accountInput.dispatchEvent(new Event('change', { bubbles: true }));\n                \n                await delay(500);\n                \n                const saveResult = await clickSaveButton();\n                \n                if (saveResult) {\n                    await delay(1000);\n                    const hasSuccessMessage = checkSuccessMessage();\n                    \n                    if (hasSuccessMessage) {\n                        addLog(`✓ 账号修改成功！${originalAccount} -> ${modifiedAccount}`);\n                        success = true;\n                        break;\n                    } else {\n                        const hasErrorMessage = checkAccountExistsMessage();\n                        if (hasErrorMessage) {\n                            addLog(`提示：账号已存在，继续尝试其他修改...`);\n                            await delay(500);\n                        } else {\n                            addLog(`保存点击成功，但未检测到明确提示，继续尝试...`);\n                            await delay(500);\n                        }\n                    }\n                }\n                \n                accountDigits[middleIndex] = originalDigit;\n            }\n            \n            if (offset === 3 && !success) {\n                addLog('中间位修改多次未成功，尝试修改左侧数字...');\n                const leftSuccess = await tryModifyLeftOrRightDigit(accountInput, accountDigits, middleIndex - 1, originalAccount);\n                if (leftSuccess) {\n                    success = true;\n                    break;\n                }\n                \n                addLog('左侧数字修改未成功，尝试修改右侧数字...');\n                const rightSuccess = await tryModifyLeftOrRightDigit(accountInput, accountDigits, middleIndex + 1, originalAccount);\n                if (rightSuccess) {\n                    success = true;\n                    break;\n                }\n            }\n        }\n        \n        if (success) {\n            return true;\n        } else {\n            addLog('⚠ 账号修改失败，已尝试所有可能的修改方式', true);\n            return false;\n        }\n    }\n\n    async function tryModifyLeftOrRightDigit(accountInput, accountDigits, targetIndex, originalAccount) {\n        if (targetIndex < 0 || targetIndex >= accountDigits.length) {\n            addLog(`⚠ 目标索引 ${targetIndex} 超出范围`, true);\n            return false;\n        }\n        \n        const originalDigit = accountDigits[targetIndex];\n        addLog(`尝试修改索引 ${targetIndex} 的数字，原始值: ${originalDigit}`);\n        \n        for (let offset = 1; offset <= 5; offset++) {\n            let newDigitForward = parseInt(originalDigit) + offset;\n            if (newDigitForward <= 9) {\n                accountDigits[targetIndex] = newDigitForward.toString();\n                const modifiedAccount = accountDigits.join('');\n                \n                addLog(`尝试索引${targetIndex}正向偏移 +${offset}: ${originalAccount} -> ${modifiedAccount}`);\n                \n                accountInput.value = '';\n                accountInput.value = modifiedAccount;\n                accountInput.dispatchEvent(new Event('input', { bubbles: true }));\n                accountInput.dispatchEvent(new Event('change', { bubbles: true }));\n                \n                await delay(500);\n                \n                const saveResult = await clickSaveButton();\n                if (saveResult) {\n                    await delay(1000);\n                    const hasSuccessMessage = checkSuccessMessage();\n                    if (hasSuccessMessage) {\n                        addLog(`✓ 账号修改成功！${originalAccount} -> ${modifiedAccount}`);\n                        return true;\n                    } else {\n                        const hasErrorMessage = checkAccountExistsMessage();\n                        if (hasErrorMessage) {\n                            addLog(`提示：账号已存在，继续尝试...`);\n                            await delay(500);\n                        } else {\n                            addLog(`保存点击成功，但未检测到明确提示，继续尝试...`);\n                            await delay(500);\n                        }\n                    }\n                }\n                \n                accountDigits[targetIndex] = originalDigit;\n            }\n            \n            let newDigitBackward = parseInt(originalDigit) - offset;\n            if (newDigitBackward >= 0) {\n                accountDigits[targetIndex] = newDigitBackward.toString();\n                const modifiedAccount = accountDigits.join('');\n                \n                addLog(`尝试索引${targetIndex}负向偏移 -${offset}: ${originalAccount} -> ${modifiedAccount}`);\n                \n                accountInput.value = '';\n                accountInput.value = modifiedAccount;\n                accountInput.dispatchEvent(new Event('input', { bubbles: true }));\n                accountInput.dispatchEvent(new Event('change', { bubbles: true }));\n                \n                await delay(500);\n                \n                const saveResult = await clickSaveButton();\n                if (saveResult) {\n                    await delay(1000);\n                    const hasSuccessMessage = checkSuccessMessage();\n                    if (hasSuccessMessage) {\n                        addLog(`✓ 账号修改成功！${originalAccount} -> ${modifiedAccount}`);\n                        return true;\n                    } else {\n                        const hasErrorMessage = checkAccountExistsMessage();\n                        if (hasErrorMessage) {\n                            addLog(`提示：账号已存在，继续尝试...`);\n                            await delay(500);\n                        } else {\n                            addLog(`保存点击成功，但未检测到明确提示，继续尝试...`);\n                            await delay(500);\n                        }\n                    }\n                }\n                \n                accountDigits[targetIndex] = originalDigit;\n            }\n        }\n        \n        return false;\n    }\n\n    async function clickSaveButton() {\n        addLog('查找并点击\"保存\"按钮...');\n        \n        const buttons = Array.from(document.querySelectorAll('button'));\n        for (const button of buttons) {\n            const buttonText = button.textContent || '';\n            if (buttonText === '保存' || buttonText.includes('保存')) {\n                const dialog = button.closest('div.el-dialog, div.el-overlay');\n                if (dialog) {\n                    const dialogText = dialog.textContent || '';\n                    if (dialogText.includes('取消') || dialogText.includes('账号')) {\n                        addLog('找到\"保存\"按钮');\n                        button.click();\n                        addLog('✓ 已点击\"保存\"按钮');\n                        return true;\n                    }\n                }\n            }\n        }\n        \n        addLog('⚠ 未找到\"保存\"按钮', true);\n        return false;\n    }\n\n    function checkSuccessMessage() {\n        const allElements = Array.from(document.querySelectorAll('*'));\n        \n        for (const element of allElements) {\n            const text = element.textContent || '';\n            if (text.includes('操作成功') || text.includes('保存成功') || text.includes('修改成功') || text.includes('成功')) {\n                if (!element.tagName || element.tagName !== 'BUTTON') {\n                    addLog(`检测到成功提示: ${text.substring(0, 50)}`);\n                    return true;\n                }\n            }\n        }\n        \n        return false;\n    }\n\n    function checkAccountExistsMessage() {\n        const allElements = Array.from(document.querySelectorAll('*'));\n        \n        for (const element of allElements) {\n            const text = element.textContent || '';\n            if (text.includes('账号已存在') || text.includes('已存在')) {\n                if (!element.tagName || element.tagName !== 'BUTTON') {\n                    addLog(`检测到错误提示: ${text.substring(0, 50)}`);\n                    return true;\n                }\n            }\n        }\n        \n        return false;\n    }\n\n    async function closeAllPopups() {\n        addLog('步骤21：关闭所有弹窗...');\n        \n        const footerDivs = Array.from(document.querySelectorAll('div.box-bot.box-bot__center'));\n        \n        if (footerDivs.length === 0) {\n            addLog('⚠ 未找到弹窗底部div', true);\n            return false;\n        }\n        \n        addLog(`找到 ${footerDivs.length} 个弹窗底部div`);\n        \n        let closedCount = 0;\n        \n        for (const footerDiv of footerDivs) {\n            const buttons = Array.from(footerDiv.querySelectorAll('button'));\n            \n            for (const button of buttons) {\n                const buttonText = button.textContent || '';\n                if (buttonText === '关闭' || buttonText.includes('关闭')) {\n                    addLog(`找到\"关闭\"按钮`);\n                    button.click();\n                    addLog('✓ 已点击\"关闭\"按钮');\n                    closedCount++;\n                    await delay(500);\n                    break;\n                }\n            }\n        }\n        \n        if (closedCount > 0) {\n            addLog(`✓ 已关闭 ${closedCount} 个弹窗`);\n            return true;\n        } else {\n            addLog('⚠ 未找到\"关闭\"按钮', true);\n            return false;\n        }\n    }\n\n    async function clickRejectButtonOnLatestRow() {\n        addLog('步骤22：查找并点击最新一条数据的\"拒绝\"按钮...');\n        await delay(800);\n        \n        const tableWrapper = document.querySelector('div.el-table__inner-wrapper');\n        if (!tableWrapper) {\n            addLog('⚠ 未找到表格容器', true);\n            return false;\n        }\n        \n        const rows = tableWrapper.querySelectorAll('table tbody tr');\n        if (!rows || rows.length === 0) {\n            addLog('⚠ 表格暂无数据行', true);\n            return false;\n        }\n        \n        const firstRow = rows[0];\n        const cells = firstRow.querySelectorAll('td');\n        \n        for (const cell of cells) {\n            const buttons = Array.from(cell.querySelectorAll('button'));\n            for (const button of buttons) {\n                const buttonText = button.textContent || '';\n                if (buttonText === '拒绝' || buttonText.includes('拒绝')) {\n                    addLog('找到\"拒绝\"按钮');\n                    button.click();\n                    addLog('✓ 已点击\"拒绝\"按钮');\n                    await delay(800);\n                    return true;\n                }\n            }\n        }\n        \n        addLog('⚠ 未找到\"拒绝\"按钮', true);\n        return false;\n    }\n\n    async function waitForRejectDialog() {\n        addLog('等待拒绝弹窗出现...');\n        const startTime = Date.now();\n        \n        while (Date.now() - startTime < MAX_LOAD_WAIT_TIME) {\n            const rejectDialog = document.querySelector('div.el-overlay.special-dialog');\n            \n            if (rejectDialog) {\n                const isVisible = rejectDialog.style.display !== 'none' && \n                                   window.getComputedStyle(rejectDialog).display !== 'none';\n                if (isVisible) {\n                    const dialogText = rejectDialog.textContent || '';\n                    addLog(`✓ 拒绝弹窗已出现: ${dialogText.substring(0, 100)}`);\n                    return true;\n                }\n            }\n            \n            await delay(LOAD_CHECK_INTERVAL);\n        }\n        \n        addLog('⚠ 等待拒绝弹窗超时，继续执行', true);\n        return false;\n    }\n\n    async function fillRejectRemarks(remarkText) {\n        addLog('步骤23：填写拒绝弹窗备注信息...');\n        await delay(500);\n        \n        if (!remarkText) {\n            remarkText = 'Prompt do sistema: O sistema financeiro não pode transferir dinheiro para você com êxito! Ele avisa que o número da conta de retirada está incorreto❌Entre em contato com o atendimento ao cliente para alterá-lo!';\n        }\n        \n        const rejectDialog = document.querySelector('div.el-overlay.special-dialog');\n        if (!rejectDialog) {\n            addLog('⚠ 未找到拒绝弹窗', true);\n            return false;\n        }\n        \n        const textareas = Array.from(rejectDialog.querySelectorAll('textarea'));\n        \n        if (textareas.length === 0) {\n            addLog('⚠ 未找到textarea输入框', true);\n            return false;\n        }\n        \n        addLog(`找到 ${textareas.length} 个textarea输入框`);\n        \n        for (let i = 0; i < textareas.length; i++) {\n            const textarea = textareas[i];\n            \n            textarea.value = '';\n            textarea.value = remarkText;\n            \n            textarea.dispatchEvent(new Event('input', { bubbles: true }));\n            textarea.dispatchEvent(new Event('change', { bubbles: true }));\n            textarea.dispatchEvent(new Event('blur', { bubbles: true }));\n            \n            addLog(`✓ 已在第 ${i + 1} 个textarea中输入备注信息`);\n            await delay(300);\n        }\n        \n        return true;\n    }\n\n    async function clickRejectDialogSaveButton() {\n        addLog('步骤24：查找并点击拒绝弹窗中的\"保存\"按钮...');\n        await delay(500);\n        \n        const rejectDialog = document.querySelector('div.el-overlay.special-dialog');\n        if (!rejectDialog) {\n            addLog('⚠ 未找到拒绝弹窗', true);\n            return false;\n        }\n        \n        const buttons = Array.from(rejectDialog.querySelectorAll('button'));\n        \n        for (const button of buttons) {\n            const buttonText = button.textContent || '';\n            if (buttonText === '保存' || buttonText.includes('保存')) {\n                addLog('找到\"保存\"按钮');\n                button.click();\n                addLog('✓ 已点击拒绝弹窗中的\"保存\"按钮');\n                await delay(1000);\n                return true;\n            }\n        }\n        \n        addLog('⚠ 未找到拒绝弹窗中的\"保存\"按钮', true);\n        return false;\n    }\n\n    // ==================== VIP3专用函数 ====================\n    \n    function checkHasPaidOrder(allRows, statusColumnName) {\n        const statusIndex = getColumnIndexByFuzzyMatch(statusColumnName);\n        \n        if (statusIndex === -1) {\n            addLog('⚠ 未找到订单状态列', true);\n            return false;\n        }\n        \n        for (const row of allRows) {\n            const orderStatus = row[`col_${statusIndex}`] || '';\n            if (orderStatus.includes('已付款')) {\n                addLog('✓ 发现\"已付款\"状态的订单');\n                return true;\n            }\n        }\n        \n        addLog('✓ 没有发现\"已付款\"状态的订单');\n        return false;\n    }\n\n    function checkFirstRowAmountIs10(firstRow, withdrawAmountColumnName) {\n        const withdrawAmountIndex = getColumnIndexByFuzzyMatch(withdrawAmountColumnName);\n\n        if (withdrawAmountIndex === -1) {\n            addLog('⚠ 未找到提现金额列', true);\n            return false;\n        }\n\n        const multiLineData = firstRow._multiLineData[withdrawAmountIndex] || [];\n        const firstLineAmount = multiLineData.length > 0 ? multiLineData[0] : '';\n\n        addLog(`提现金额列多行数据: ${JSON.stringify(multiLineData)}`);\n        addLog(`第一行数据（提现金额）: \"${firstLineAmount}\"`);\n\n        if (firstLineAmount.includes('10') || firstLineAmount === '10') {\n            addLog('✓ 最新行提现金额为10');\n            return true;\n        }\n\n        addLog('✓ 最新行提现金额不为10');\n        return false;\n    }\n\n    async function clickAuditButtonOnLatestRow() {\n        addLog('步骤V3-2：查找并点击最新一条数据的\"审核\"按钮...');\n        await delay(500);\n        \n        const tableWrapper = document.querySelector('div.el-table__inner-wrapper');\n        if (!tableWrapper) {\n            addLog('⚠ 未找到表格容器', true);\n            return false;\n        }\n        \n        const rows = tableWrapper.querySelectorAll('table tbody tr');\n        if (!rows || rows.length === 0) {\n            addLog('⚠ 表格暂无数据行', true);\n            return false;\n        }\n        \n        const firstRow = rows[0];\n        const cells = firstRow.querySelectorAll('td');\n        \n        for (const cell of cells) {\n            const buttons = Array.from(cell.querySelectorAll('button'));\n            for (const button of buttons) {\n                const buttonText = button.textContent || '';\n                if (buttonText === '审核' || buttonText.includes('审核')) {\n                    addLog('找到\"审核\"按钮');\n                    button.click();\n                    addLog('✓ 已点击\"审核\"按钮');\n                    await delay(800);\n                    return true;\n                }\n            }\n        }\n        \n        addLog('⚠ 未找到\"审核\"按钮', true);\n        return false;\n    }\n\n    async function waitForAuditDialog() {\n        addLog('等待审核弹窗出现...');\n        const startTime = Date.now();\n        \n        while (Date.now() - startTime < MAX_LOAD_WAIT_TIME) {\n            const allDialogs = Array.from(document.querySelectorAll('div.el-dialog, div.el-overlay, div.el-message-box'));\n            \n            for (const dialog of allDialogs) {\n                const dialogText = dialog.textContent || '';\n                \n                const hasPaymentChannel = dialogText.includes('支付通道') || dialogText.includes('AgPay');\n                const hasSaveCancel = dialogText.includes('保存') && dialogText.includes('取消');\n                const hasOffline = dialogText.includes('线下交易');\n                \n                if (hasPaymentChannel && (hasSaveCancel || hasOffline)) {\n                    addLog('✓ 审核弹窗已出现');\n                    return true;\n                }\n            }\n            \n            await delay(LOAD_CHECK_INTERVAL);\n        }\n        \n        addLog('⚠ 等待审核弹窗超时，继续执行', true);\n        return false;\n    }\n\n    async function selectPaymentChannel(channelName) {\n        addLog(`步骤V3-3：选择支付通道 \"${channelName}\"...`);\n        await delay(500);\n        \n        const paymentSelectors = [\n            'div.el-form-item.is-required:has(span:contains(\"支付通道\"))',\n            'div.el-form-item:has(label:contains(\"支付通道\"))',\n            'div.el-form-item:has(span:contains(\"线下交易\"))'\n        ];\n        \n        let paymentChannelFormItem = null;\n        \n        for (const selector of paymentSelectors) {\n            try {\n                paymentChannelFormItem = document.querySelector(selector);\n                if (paymentChannelFormItem) {\n                    addLog(`使用选择器\"${selector}\"找到支付通道区域`);\n                    break;\n                }\n            } catch (e) {\n                continue;\n            }\n        }\n        \n        if (!paymentChannelFormItem) {\n            const formItems = Array.from(document.querySelectorAll('div.el-form-item.is-required'));\n            for (const formItem of formItems) {\n                const text = formItem.textContent || '';\n                if (text.includes('支付通道')) {\n                    paymentChannelFormItem = formItem;\n                    addLog('找到支付通道区域');\n                    break;\n                }\n            }\n        }\n        \n        if (!paymentChannelFormItem) {\n            addLog('⚠ 未找到支付通道表单项', true);\n            return false;\n        }\n        \n        const inputElement = paymentChannelFormItem.querySelector('input') || \n                            paymentChannelFormItem.querySelector('div.el-input');\n                            \n        if (!inputElement) {\n            addLog('⚠ 未找到支付通道输入框', true);\n            return false;\n        }\n        \n        inputElement.click();\n        addLog('✓ 已点击支付通道输入框');\n        await delay(600);\n        \n        let poppers = Array.from(document.querySelectorAll('div.el-popper.is-pure.is-light.el-select__popper'));\n        if (poppers.length === 0) {\n            poppers = Array.from(document.querySelectorAll('div.el-popper'));\n            addLog(`未找到特定弹窗，使用通用弹窗选择器，找到 ${poppers.length} 个弹窗`);\n        } else {\n            addLog(`找到 ${poppers.length} 个特定弹窗，开始查找正确的弹窗...`);\n        }\n        \n        addLog(`开始详细检查每个弹窗内容...`);\n        let matchedPopper = null;\n        let matchIndex = 0;\n        \n        let validPoppers = [];\n        for (let i = 0; i < poppers.length; i++) {\n            const popper = poppers[i];\n            \n            const isHidden = popper.style.display === 'none' || \n                            popper.getAttribute('aria-hidden') === 'true' ||\n                            window.getComputedStyle(popper).display === 'none';\n                            \n            if (!isHidden) {\n                const popperText = popper.textContent || '';\n                \n                const hasOfflineTrading = popperText.includes('线下交易');\n                const hasChannelName = popperText.includes(channelName);\n                \n                validPoppers.push({\n                    popper: popper,\n                    index: i + 1,\n                    hasOfflineTrading: hasOfflineTrading,\n                    hasChannelName: hasChannelName,\n                    textLength: popperText.length\n                });\n                \n                if (hasOfflineTrading) {\n                    addLog(`弹窗${i+1}包含\"线下交易\"，文本长度: ${popperText.length}`);\n                }\n            } else {\n                addLog(`弹窗${i+1}: 已隐藏，跳过`);\n            }\n        }\n        \n        if (validPoppers.length > 0) {\n            const offlineTradingPoppers = validPoppers.filter(p => p.hasOfflineTrading);\n            \n            if (offlineTradingPoppers.length > 0) {\n                offlineTradingPoppers.sort((a, b) => b.textLength - a.textLength);\n                matchedPopper = offlineTradingPoppers[0].popper;\n                matchIndex = offlineTradingPoppers[0].index;\n                addLog(`✓ 找到正确的支付通道弹窗（第${matchIndex}个弹窗，包含\"线下交易\"，文本长度: ${offlineTradingPoppers[0].textLength}）`);\n            } else {\n                matchedPopper = validPoppers[0].popper;\n                matchIndex = validPoppers[0].index;\n                addLog(`⚠ 未找到包含\"线下交易\"的弹窗，使用第一个可见弹窗（第${matchIndex}个）`, true);\n            }\n        }\n        \n        if (!matchedPopper) {\n            addLog('⚠ 未找到包含\"线下交易\"的支付通道下拉弹窗', true);\n            return false;\n        }\n        \n        const lis = Array.from(matchedPopper.querySelectorAll('li'));\n        addLog(`在正确弹窗中找到 ${lis.length} 个选项`);\n        \n        let optionFound = false;\n        \n        for (const li of lis) {\n            const liText = li.textContent || '';\n            if (liText.includes(channelName)) {\n                addLog(`找到支付通道选项: ${liText}`);\n                li.click();\n                addLog(`✓ 已选择支付通道: ${channelName}`);\n                optionFound = true;\n                await delay(500);\n                break;\n            }\n        }\n        \n        if (!optionFound) {\n            addLog(`⚠ 未找到支付通道选项: ${channelName}，尝试直接点击第一个选项`, true);\n            if (lis.length > 0) {\n                const firstOption = lis[0];\n                addLog(`点击第一个选项: ${firstOption.textContent}`);\n                firstOption.click();\n                await delay(500);\n                return true;\n            }\n            return false;\n        }\n        \n        return true;\n    }\n\n    async function clickAuditDialogSaveButton() {\n        addLog('步骤V3-4：查找并点击审核弹窗中的\"保存\"按钮...');\n        await delay(500);\n        \n        const auditDialog = document.querySelector('div.el-overlay.special-dialog');\n        if (!auditDialog) {\n            addLog('⚠ 未找到审核弹窗', true);\n            return false;\n        }\n        \n        const buttons = Array.from(auditDialog.querySelectorAll('button'));\n        \n        for (const button of buttons) {\n            const buttonText = button.textContent || '';\n            if (buttonText === '保存' || buttonText.includes('保存')) {\n                addLog('找到\"保存\"按钮');\n                button.click();\n                addLog('✓ 已点击审核弹窗中的\"保存\"按钮');\n                await delay(1000);\n                return true;\n            }\n        }\n        \n        addLog('⚠ 未找到审核弹窗中的\"保存\"按钮', true);\n        return false;\n    }\n\n    async function clickMemberIdToOpenMemberInfo(memberIdIndex, cells) {\n        addLog('步骤V3-5：点击会员ID进入会员信息弹窗...');\n        await delay(500);\n        \n        if (!memberIdIndex || !cells || !cells[memberIdIndex]) {\n            addLog('⚠ 会员ID索引或单元格无效', true);\n            return false;\n        }\n        \n        const memberIdCell = cells[memberIdIndex];\n        \n        const clickableDivs = memberIdCell.querySelectorAll('div.text-primary.pointer');\n        \n        if (clickableDivs.length > 0) {\n            const firstDiv = clickableDivs[0];\n            const divText = firstDiv.textContent || '';\n            addLog(`找到可点击元素: ${divText}`);\n            firstDiv.click();\n            addLog('✓ 已点击会员ID/账号元素');\n            await delay(800);\n            return true;\n        } else {\n            addLog('⚠ 未找到可点击div，尝试点击整个单元格');\n            memberIdCell.click();\n            addLog('✓ 已点击会员ID单元格');\n            await delay(800);\n            return true;\n        }\n    }\n\n    async function setAccountStatusToBanWithdraw() {\n        addLog('步骤V3-6：设置账号状态为\"禁止提现\"...');\n        \n        const accountStatusClicked = await clickAccountStatusEditIcon();\n        if (!accountStatusClicked) {\n            addLog('⚠ 未找到账号状态编辑图标', true);\n            return false;\n        }\n        \n        addLog('✓ 已点击账号状态编辑图标');\n        await delay(500);\n        \n        const allFormItems = Array.from(document.querySelectorAll('div.el-form-item'));\n        let dropdownClicked = false;\n        \n        for (const formItem of allFormItems) {\n            const text = formItem.textContent || '';\n            \n            if (text.includes('账号状态') && text.includes('取消保存')) {\n                addLog('找到账号状态下拉框区域');\n                \n                const elements = Array.from(formItem.querySelectorAll('*'));\n                let foundCancelSaveText = false;\n                \n                for (const element of elements) {\n                    const elemText = element.textContent || '';\n                    \n                    if (elemText === '取消保存' || elemText.includes('取消保存')) {\n                        foundCancelSaveText = true;\n                        continue;\n                    }\n                    \n                    if (foundCancelSaveText && element.tagName === 'DIV' && element.classList.contains('el-input')) {\n                        const clickableDiv = element.querySelector('div.el-input__inner') || element;\n                        clickableDiv.click();\n                        addLog('✓ 已点击账号状态下拉框');\n                        dropdownClicked = true;\n                        await delay(500);\n                        break;\n                    }\n                }\n                \n                if (dropdownClicked) break;\n            }\n        }\n        \n        if (!dropdownClicked) {\n            addLog('⚠ 未找到账号状态下拉框', true);\n            return false;\n        }\n        \n        await delay(500);\n        const allLiElements = Array.from(document.querySelectorAll('li'));\n        let optionClicked = false;\n        \n        for (const li of allLiElements) {\n            const liText = li.textContent || '';\n            if (liText.includes('禁止提现')) {\n                li.click();\n                addLog('✓ 已选择\"禁止提现\"');\n                optionClicked = true;\n                await delay(500);\n                break;\n            }\n        }\n        \n        if (!optionClicked) {\n            addLog('⚠ 未找到\"禁止提现\"选项', true);\n            return false;\n        }\n        \n        await delay(500);\n        const saveButtons = Array.from(document.querySelectorAll('button')).filter(btn => {\n            const btnText = btn.textContent || '';\n            return btnText.includes('保存');\n        });\n        \n        if (saveButtons.length > 0) {\n            saveButtons[0].click();\n            addLog('✓ 已点击\"保存\"按钮');\n            await delay(1000);\n            return true;\n        }\n        \n        addLog('⚠ 未找到\"保存\"按钮', true);\n        return false;\n    }\n\n    // ==================== 通用锁定流程（共享）====================\n    \n    async function lockOrderIfNeeded(firstRow, statusColumnName) {\n        const orderStatus = firstRow[`col_${getColumnIndexByFuzzyMatch(statusColumnName)}`] || '';\n        addLog(`最新一行数据的订单状态: ${orderStatus}`);\n        \n        if (orderStatus.includes('待付款')) {\n            addLog('订单状态为\"待付款\"，执行锁定流程...');\n            \n            const tableWrapper = document.querySelector('div.el-table__inner-wrapper');\n            if (!tableWrapper) {\n                addLog('⚠ 未找到表格容器', true);\n                return false;\n            }\n            \n            const rows = tableWrapper.querySelectorAll('table tbody tr');\n            if (!rows || rows.length === 0) {\n                addLog('⚠ 表格暂无数据行', true);\n                return false;\n            }\n            \n            const firstTr = rows[0];\n            const cells = firstTr.querySelectorAll('td');\n            \n            let lockButton = null;\n            cells.forEach(td => {\n                const buttons = td.querySelectorAll('button');\n                buttons.forEach(btn => {\n                    if (btn.textContent && btn.textContent.trim() === '锁定') {\n                        lockButton = btn;\n                    }\n                });\n            });\n            \n            if (lockButton) {\n                lockButton.click();\n                addLog('✓ 已点击锁定按钮');\n                await delay(500);\n                \n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止合并处理。', true);\n                    return false;\n                }\n                \n                addLog('等待确认对话框出现...');\n                await delay(600);\n                \n                const confirmDialogButtons = await waitForConfirmDialogButton();\n                if (confirmDialogButtons) {\n                    addLog('✓ 已点击确认对话框的\"确定\"按钮');\n                    await delay(500);\n                    \n                    if (shouldAbort) {\n                        addLog('检测到用户中止请求，停止合并处理。', true);\n                        return false;\n                    }\n                    \n                    addLog('等待锁定操作后的页面加载完成...');\n                    const loadCompleted = await waitForLoadCompleteWithTimeout(3000);\n                    \n                    if (!loadCompleted) {\n                        addLog('⚠ 页面加载超时，开始通过切换标签页重置...');\n                        await resetPageByTabSwitch();\n                        addLog('页面已重置，需要重新开始处理...');\n                        return 'reset';\n                    }\n                    \n                    addLog('✓ 锁定操作完成，页面已加载');\n                    return true;\n                } else {\n                    addLog('⚠ 未找到确认对话框或\"确定\"按钮', true);\n                    return false;\n                }\n            } else {\n                addLog('⚠ 未找到锁定按钮', true);\n                return false;\n            }\n        } else if (orderStatus.includes('锁定')) {\n            addLog('订单状态已为\"锁定\"，跳过锁定步骤');\n            return true;\n        } else {\n            addLog(`订单状态为\"${orderStatus}\"，不是\"待付款\"或\"锁定\"，跳过锁定步骤`);\n            return true;\n        }\n    }\n\n    // ==================== VIP2完全隔离处理函数 ====================\n    \n    async function processVIP2(firstRow, cells, memberIdIndex, statusColumnName) {\n        addLog('========== 开始执行VIP2完全隔离处理流程 ==========');\n        \n        try {\n            // VIP2步骤1：锁定订单（如果需要）\n            addLog('VIP2步骤1：检查并锁定订单...');\n            const lockResult = await lockOrderIfNeeded(firstRow, statusColumnName);\n            if (lockResult === 'reset') {\n                addLog('⚠ 锁定后页面重置，需要重新开始', true);\n                return 'reset';\n            } else if (!lockResult) {\n                addLog('⚠ 锁定流程失败', true);\n            }\n            \n            if (shouldAbort) {\n                addLog('检测到用户中止请求，停止VIP2处理。', true);\n                return 'aborted';\n            }\n            \n            // VIP2步骤2：点击会员ID\n            addLog('VIP2步骤2：点击会员ID...');\n            const memberIdCell = cells[memberIdIndex];\n            const cellText = memberIdCell.textContent || '';\n            addLog(`会员ID列内容: ${cellText}`);\n            \n            const clickableDivs = memberIdCell.querySelectorAll('div.text-primary.pointer');\n            if (clickableDivs.length > 0) {\n                const firstDiv = clickableDivs[0];\n                const divText = firstDiv.textContent || '';\n                addLog(`找到可点击元素: ${divText}`);\n                firstDiv.click();\n                addLog('✓ 已点击会员ID/账号元素');\n            } else {\n                addLog('⚠ 未找到 class=\"text-primary pointer\" 的div，尝试点击整个单元格');\n                memberIdCell.click();\n                addLog('✓ 已点击会员ID单元格');\n            }\n            \n            await waitForMemberInfoPopupLoad();\n            \n            if (shouldAbort) {\n                addLog('检测到用户中止请求，停止VIP2处理。', true);\n                return 'aborted';\n            }\n            \n            // VIP2步骤3：设置禁止提现\n            addLog('VIP2步骤3：设置账号状态为\"禁止提现\"...');\n            const accountStatusClicked = await clickAccountStatusEditIcon();\n            if (accountStatusClicked) {\n                addLog('✓ 已点击账号状态编辑图标');\n                await delay(500);\n                \n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止VIP2处理。', true);\n                    return 'aborted';\n                }\n                \n                addLog('VIP2步骤4：点击账号状态下拉框...');\n                await delay(500);\n                \n                const allFormItems = Array.from(document.querySelectorAll('div.el-form-item'));\n                let dropdownClicked = false;\n                \n                for (const formItem of allFormItems) {\n                    const text = formItem.textContent || '';\n                    if (text.includes('账号状态') && text.includes('取消保存')) {\n                        addLog('找到包含账号状态下拉框的区域');\n                        \n                        const elements = Array.from(formItem.querySelectorAll('*'));\n                        let foundCancelSaveText = false;\n                        \n                        for (const element of elements) {\n                            const elemText = element.textContent || '';\n                            if (elemText === '取消保存' || elemText.includes('取消保存')) {\n                                foundCancelSaveText = true;\n                                continue;\n                            }\n                            \n                            if (foundCancelSaveText && element.tagName === 'DIV' && element.classList.contains('el-input')) {\n                                const clickableDiv = element.querySelector('div.el-input__inner') || element;\n                                clickableDiv.click();\n                                addLog('✓ 已点击账号状态下拉框');\n                                dropdownClicked = true;\n                                await delay(500);\n                                break;\n                            }\n                        }\n                        \n                        if (dropdownClicked) break;\n                    }\n                }\n                \n                if (!dropdownClicked) {\n                    addLog('⚠ 未找到账号状态下拉框', true);\n                }\n                \n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止VIP2处理。', true);\n                    return 'aborted';\n                }\n                \n                addLog('VIP2步骤5：选择\"禁止提现\"...');\n                await delay(500);\n                \n                let optionClicked = false;\n                const allLiElements = Array.from(document.querySelectorAll('li'));\n                \n                for (const li of allLiElements) {\n                    const liText = li.textContent || '';\n                    if (liText.includes('禁止提现')) {\n                        addLog(`找到包含\"禁止提现\"的选项: ${liText}`);\n                        li.click();\n                        addLog('✓ 已选择包含\"禁止提现\"的选项');\n                        optionClicked = true;\n                        await delay(500);\n                        break;\n                    }\n                }\n                \n                if (!optionClicked) {\n                    addLog('⚠ 未找到包含\"禁止提现\"的选项', true);\n                }\n                \n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止VIP2处理。', true);\n                    return 'aborted';\n                }\n                \n                addLog('VIP2步骤6：点击保存按钮...');\n                await delay(500);\n                \n                const saveButtons = Array.from(document.querySelectorAll('button')).filter(btn => {\n                    const btnText = btn.textContent || '';\n                    return btnText.includes('保存');\n                });\n                \n                if (saveButtons.length > 0) {\n                    addLog('找到\"保存\"按钮');\n                    saveButtons[0].click();\n                    addLog('✓ 已点击\"保存\"按钮');\n                    await delay(1000);\n                } else {\n                    addLog('⚠ 未找到\"保存\"按钮', true);\n                }\n            } else {\n                addLog('⚠ 未找到账号状态编辑图标', true);\n            }\n            \n            if (shouldAbort) {\n                addLog('检测到用户中止请求，停止VIP2处理。', true);\n                return 'aborted';\n            }\n            \n            // VIP2步骤7：账号智能修改流程\n            addLog('VIP2步骤7：执行账号智能修改流程...');\n            const tabSwitchSuccess = await switchToWithdrawAccountTab();\n            if (tabSwitchSuccess) {\n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止VIP2处理。', true);\n                    return 'aborted';\n                }\n                \n                await waitForWithdrawAccountTableLoad();\n                \n                const modifyButtonClicked = await clickModifyButton();\n                if (modifyButtonClicked) {\n                    await waitForModifyAccountPopup();\n                    \n                    if (shouldAbort) {\n                        addLog('检测到用户中止请求，停止VIP2处理。', true);\n                        return 'aborted';\n                    }\n                    \n                    const modifySuccess = await modifyAccountNumber();\n                    if (modifySuccess) {\n                        addLog('✓ VIP2账号修改流程完成');\n                    } else {\n                        addLog('⚠ VIP2账号修改流程失败', true);\n                    }\n                } else {\n                    addLog('⚠ VIP2点击修改按钮失败，跳过账号修改', true);\n                }\n            } else {\n                addLog('⚠ VIP2切换到提现账户标签页失败，跳过账号修改', true);\n            }\n            \n            if (shouldAbort) {\n                addLog('检测到用户中止请求，停止VIP2处理。', true);\n                return 'aborted';\n            }\n            \n            await closeAllPopups();\n            \n            if (shouldAbort) {\n                addLog('检测到用户中止请求，停止VIP2处理。', true);\n                return 'aborted';\n            }\n            \n            // VIP2步骤8：拒绝退款流程\n            addLog('VIP2步骤8：执行拒绝退款流程...');\n            const rejectButtonClicked = await clickRejectButtonOnLatestRow();\n            if (rejectButtonClicked) {\n                const rejectDialogAppeared = await waitForRejectDialog();\n                if (rejectDialogAppeared) {\n                    if (shouldAbort) {\n                        addLog('检测到用户中止请求，停止VIP2处理。', true);\n                        return 'aborted';\n                    }\n                    \n                    const remarksFilled = await fillRejectRemarks(null);\n                    if (remarksFilled) {\n                        const rejectSaveClicked = await clickRejectDialogSaveButton();\n                        if (rejectSaveClicked) {\n                            addLog('✓ VIP2拒绝退款流程完成');\n                        } else {\n                            addLog('⚠ VIP2点击拒绝弹窗保存按钮失败', true);\n                        }\n                    } else {\n                        addLog('⚠ VIP2填写拒绝备注信息失败', true);\n                    }\n                } else {\n                    addLog('⚠ VIP2等待拒绝弹窗超时', true);\n                }\n            } else {\n                addLog('⚠ VIP2点击拒绝按钮失败', true);\n            }\n            \n            addLog('========== VIP2处理流程完成 ==========');\n            return 'completed';\n            \n        } catch (e) {\n            addLog(`VIP2处理异常: ${e.message}`, true);\n            return 'error';\n        }\n    }\n\n    // ==================== VIP3完全隔离处理函数 ====================\n    \n    async function processVIP3(firstRow, allRows, cells, memberIdIndex, statusColumnName) {\n        addLog('========== 开始执行VIP3完全隔离处理流程 ==========');\n        \n        try {\n            // VIP3步骤1：检查数据行数\n            addLog('VIP3步骤1：检查数据行数...');\n            \n            const tableWrapper = document.querySelector('div.el-table__inner-wrapper');\n            if (!tableWrapper) {\n                addLog('⚠ 未找到表格容器', true);\n                return 'continue';\n            }\n            \n            const rows = tableWrapper.querySelectorAll('table tbody tr');\n            const rowCount = rows ? rows.length : 0;\n            \n            addLog(`数据行数: ${rowCount}`);\n            \n            if (rowCount === 1) {\n                addLog('⚠ 只有1行数据，发出警报...', true);\n                startAlarm();\n                return 'alarm';\n            } else if (rowCount === 0) {\n                addLog('⚠ 没有数据行', true);\n                return 'continue';\n            } else {\n                addLog('✓ 有多行数据，继续处理');\n            }\n            \n            // VIP3步骤2：检查是否有\"已付款\"状态的订单\n            const hasPaidOrder = checkHasPaidOrder(allRows, statusColumnName);\n            \n            if (hasPaidOrder) {\n                // === 分支1：存在\"已付款\"订单 ===\n                // 流程：锁定 + 会员信息修改 + 拒绝\n                addLog('✓ 存在\"已付款\"订单，先执行锁定流程，然后执行会员信息修改+拒绝流程');\n                \n                // 先执行锁定流程\n                const lockResult = await lockOrderIfNeeded(firstRow, statusColumnName);\n                if (lockResult === 'reset') {\n                    addLog('⚠ 锁定后页面重置，需要重新开始', true);\n                    return 'reset';\n                } else if (!lockResult) {\n                    addLog('⚠ 锁定流程失败，继续下一步', true);\n                }\n                \n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止VIP3处理。', true);\n                    return 'aborted';\n                }\n                \n                // 点击会员ID进入会员信息\n                const tableWrapper2 = document.querySelector('div.el-table__inner-wrapper');\n                const rows2 = tableWrapper2.querySelectorAll('table tbody tr');\n                const firstTr2 = rows2[0];\n                const cells2 = firstTr2.querySelectorAll('td');\n                \n                const memberInfoOpened = await clickMemberIdToOpenMemberInfo(memberIdIndex, cells2);\n                if (memberInfoOpened) {\n                    if (shouldAbort) {\n                        addLog('检测到用户中止请求，停止VIP3处理。', true);\n                        return 'aborted';\n                    }\n                    \n                    // 等待会员信息弹窗加载\n                    await waitForMemberInfoPopupLoad();\n                    \n                    // 设置禁止提现\n                    const banWithdrawSet = await setAccountStatusToBanWithdraw();\n                    if (banWithdrawSet) {\n                        addLog('✓ 已设置账号状态为\"禁止提现\"');\n                        \n                        // 关闭弹窗\n                        await closeAllPopups();\n                        \n                        if (shouldAbort) {\n                            addLog('检测到用户中止请求，停止VIP3处理。', true);\n                            return 'aborted';\n                        }\n                        \n                        // 点击拒绝按钮\n                        const rejectButtonClicked = await clickRejectButtonOnLatestRow();\n                        if (rejectButtonClicked) {\n                            const rejectDialogAppeared = await waitForRejectDialog();\n                            if (rejectDialogAppeared) {\n                                if (shouldAbort) {\n                                    addLog('检测到用户中止请求，停止VIP3处理。', true);\n                                    return 'aborted';\n                                }\n                                \n                                // VIP3特定的拒绝内容\n                                const vip3RejectRemark = 'O saque falhou porque a solicitação de saque não foi enviada de acordo com o valor especificado❌Entre em contato com o gerente financeiro para processamento!';\n                                const remarksFilled = await fillRejectRemarks(vip3RejectRemark);\n                                if (remarksFilled) {\n                                    const rejectSaveClicked = await clickRejectDialogSaveButton();\n                                    if (rejectSaveClicked) {\n                                        addLog('✓ VIP3会员信息修改+拒绝流程完成');\n                                    } else {\n                                        addLog('⚠ 点击拒绝弹窗保存按钮失败', true);\n                                    }\n                                } else {\n                                    addLog('⚠ 填写拒绝备注信息失败', true);\n                                }\n                            } else {\n                                addLog('⚠ 等待拒绝弹窗超时', true);\n                            }\n                        } else {\n                            addLog('⚠ 点击拒绝按钮失败', true);\n                        }\n                    } else {\n                        addLog('⚠ 设置账号状态失败', true);\n                    }\n                } else {\n                    addLog('⚠ 打开会员信息失败', true);\n                }\n                \n                addLog('✓ VIP3处理完成');\n                addLog('========== VIP3处理流程完成 ==========');\n                return 'completed';\n                \n            } else {\n                // === 分支2：没有\"已付款\"订单 ===\n                addLog('✓ 没有\"已付款\"订单，检查最新行提现金额');\n                \n                // 获取配置\n                const withdrawAmountColumnName = document.getElementById('withdrawAmountInput').value.trim() || '提现金额';\n                const paymentChannel = document.getElementById('paymentChannelInput').value.trim() || 'AgPay';\n                \n                // 检查最新行提现金额是否为10\n                const firstRowAmountIs10 = checkFirstRowAmountIs10(firstRow, withdrawAmountColumnName);\n                \n                if (firstRowAmountIs10) {\n                    // === 分支2.1：提现金额为10 ===\n                    // 流程：锁定 + 审核\n                    addLog('✓ 最新行提现金额为10，执行审核流程');\n                    \n                    // 先锁定（使用旧脚本的锁定和加载超时处理方式）\n                    const statusIndex = getColumnIndexByFuzzyMatch(statusColumnName);\n                    const orderStatus = firstRow[`col_${statusIndex}`] || '';\n                    addLog(`订单状态: ${orderStatus}`);\n                    \n                    if (orderStatus.includes('待付款')) {\n                        addLog('订单状态为\"待付款\"，查找并点击锁定按钮...');\n                        \n                        const tableWrapper3 = document.querySelector('div.el-table__inner-wrapper');\n                        const rows3 = tableWrapper3.querySelectorAll('table tbody tr');\n                        const firstTr3 = rows3[0];\n                        const cells3 = firstTr3.querySelectorAll('td');\n                        \n                        let lockButton = null;\n                        cells3.forEach(td => {\n                            const buttons = td.querySelectorAll('button');\n                            buttons.forEach(btn => {\n                                if (btn.textContent && btn.textContent.trim() === '锁定') {\n                                    lockButton = btn;\n                                }\n                            });\n                        });\n                        \n                        if (lockButton) {\n                            lockButton.click();\n                            addLog('✓ 已点击锁定按钮');\n                            await delay(500);\n                            \n                            if (shouldAbort) {\n                                addLog('检测到用户中止请求，停止VIP3处理。', true);\n                                return 'aborted';\n                            }\n                            \n                            addLog('等待确认对话框出现...');\n                            await delay(600);\n                            \n                            const confirmDialogButtons = await waitForConfirmDialogButton();\n                            if (confirmDialogButtons) {\n                                addLog('✓ 已点击确认对话框的\"确定\"按钮');\n                                await delay(500);\n                                \n                                if (shouldAbort) {\n                                    addLog('检测到用户中止请求，停止VIP3处理。', true);\n                                    return 'aborted';\n                                }\n                                \n                                addLog('等待锁定操作后的页面加载完成...');\n                                const loadCompleted = await waitForLoadCompleteWithTimeout(3000);\n                                \n                                if (!loadCompleted) {\n                                    addLog('⚠ 页面加载超时，开始通过切换标签页重置...');\n                                    await resetPageByTabSwitch();\n                                    addLog('页面已重置，重新开始整轮处理...');\n                                    addLog('========== VIP3处理流程完成（页面重置） ==========');\n                                    return 'reset';\n                                }\n                                \n                                addLog('✓ 页面加载完成');\n                            } else {\n                                addLog('⚠ 未找到确认对话框或\"确定\"按钮', true);\n                            }\n                        } else {\n                            addLog('⚠ 未找到锁定按钮', true);\n                        }\n                    }\n                    \n                    // 点击审核按钮\n                    const auditButtonClicked = await clickAuditButtonOnLatestRow();\n                    if (auditButtonClicked) {\n                        const auditDialogAppeared = await waitForAuditDialog();\n                        if (auditDialogAppeared) {\n                            if (shouldAbort) {\n                                addLog('检测到用户中止请求，停止VIP3处理。', true);\n                                return 'aborted';\n                            }\n                            \n                            // 选择支付通道\n                            const channelSelected = await selectPaymentChannel(paymentChannel);\n                            if (channelSelected) {\n                                if (shouldAbort) {\n                                    addLog('检测到用户中止请求，停止VIP3处理。', true);\n                                    return 'aborted';\n                                }\n                                \n                                // 点击保存\n                                const auditSaveClicked = await clickAuditDialogSaveButton();\n                                if (auditSaveClicked) {\n                                    addLog('✓ VIP3审核流程完成');\n                                } else {\n                                    addLog('⚠ 点击审核弹窗保存按钮失败', true);\n                                }\n                            } else {\n                                addLog('⚠ 选择支付通道失败', true);\n                            }\n                        } else {\n                            addLog('⚠ 等待审核弹窗超时', true);\n                        }\n                    } else {\n                        addLog('⚠ 点击审核按钮失败', true);\n                    }\n                    \n                    addLog('✓ VIP3处理完成');\n                    addLog('========== VIP3处理流程完成 ==========');\n                    return 'completed';\n                    \n                } else {\n                    // === 分支2.2：提现金额不为10 ===\n                    // 流程：锁定 + 会员信息修改 + 拒绝\n                    addLog('✓ 最新行提现金额不为10，先执行锁定流程，然后执行会员信息修改流程');\n                    \n                    // 先执行锁定流程\n                    const lockResult = await lockOrderIfNeeded(firstRow, statusColumnName);\n                    if (lockResult === 'reset') {\n                        addLog('⚠ 锁定后页面重置，需要重新开始', true);\n                        return 'reset';\n                    } else if (!lockResult) {\n                        addLog('⚠ 锁定流程失败，继续下一步', true);\n                    }\n                    \n                    if (shouldAbort) {\n                        addLog('检测到用户中止请求，停止VIP3处理。', true);\n                        return 'aborted';\n                    }\n                    \n                    // 点击会员ID进入会员信息\n                    const tableWrapper4 = document.querySelector('div.el-table__inner-wrapper');\n                    const rows4 = tableWrapper4.querySelectorAll('table tbody tr');\n                    const firstTr4 = rows4[0];\n                    const cells4 = firstTr4.querySelectorAll('td');\n                    \n                    const memberInfoOpened = await clickMemberIdToOpenMemberInfo(memberIdIndex, cells4);\n                    if (memberInfoOpened) {\n                        if (shouldAbort) {\n                            addLog('检测到用户中止请求，停止VIP3处理。', true);\n                            return 'aborted';\n                        }\n                        \n                        // 等待会员信息弹窗加载\n                        await waitForMemberInfoPopupLoad();\n                        \n                        // 设置禁止提现\n                        const banWithdrawSet = await setAccountStatusToBanWithdraw();\n                        if (banWithdrawSet) {\n                            addLog('✓ 已设置账号状态为\"禁止提现\"');\n                            \n                            // 关闭弹窗\n                            await closeAllPopups();\n                            \n                            if (shouldAbort) {\n                                addLog('检测到用户中止请求，停止VIP3处理。', true);\n                                return 'aborted';\n                            }\n                            \n                            // 点击拒绝按钮\n                            const rejectButtonClicked = await clickRejectButtonOnLatestRow();\n                            if (rejectButtonClicked) {\n                                const rejectDialogAppeared = await waitForRejectDialog();\n                                if (rejectDialogAppeared) {\n                                    if (shouldAbort) {\n                                        addLog('检测到用户中止请求，停止VIP3处理。', true);\n                                        return 'aborted';\n                                    }\n                                    \n                                    // VIP3特定的拒绝内容\n                                    const vip3RejectRemark = 'O saque falhou porque a solicitação de saque não foi enviada de acordo com o valor especificado❌Entre em contato com o gerente financeiro para processamento!';\n                                    const remarksFilled = await fillRejectRemarks(vip3RejectRemark);\n                                    if (remarksFilled) {\n                                        const rejectSaveClicked = await clickRejectDialogSaveButton();\n                                        if (rejectSaveClicked) {\n                                            addLog('✓ VIP3会员信息修改+拒绝流程完成');\n                                        } else {\n                                            addLog('⚠ 点击拒绝弹窗保存按钮失败', true);\n                                        }\n                                    } else {\n                                        addLog('⚠ 填写拒绝备注信息失败', true);\n                                    }\n                                } else {\n                                    addLog('⚠ 等待拒绝弹窗超时', true);\n                                }\n                            } else {\n                                addLog('⚠ 点击拒绝按钮失败', true);\n                            }\n                        } else {\n                            addLog('⚠ 设置账号状态失败', true);\n                        }\n                    } else {\n                        addLog('⚠ 打开会员信息失败', true);\n                    }\n                    \n                    addLog('✓ VIP3处理完成');\n                    addLog('========== VIP3处理流程完成 ==========');\n                    return 'completed';\n                }\n            }\n            \n        } catch (e) {\n            addLog(`VIP3处理异常: ${e.message}`, true);\n            return 'error';\n        }\n    }\n    \n    function getSelectedFilterConditions() {\n        const memberIdColumnName = document.getElementById('memberIdColumnNameInput').value.trim() || '会员ID';\n        const vipColumnName = document.getElementById('vipColumnNameInput').value.trim() || 'VIP等级';\n        const statusColumnName = document.getElementById('statusColumnNameInput').value.trim() || '订单状态';\n        \n        const vipLevelSelect = document.getElementById('vipLevelSelect');\n        const orderStatusSelect = document.getElementById('orderStatusSelect');\n        \n        const vipLevels = Array.from(vipLevelSelect.selectedOptions).map(option => option.value);\n        const orderStatuses = Array.from(orderStatusSelect.selectedOptions).map(option => option.value);\n        \n        return { memberIdColumnName, vipColumnName, vipLevels, statusColumnName, orderStatuses };\n    }\n\n    // ==================== 主合并处理函数 ====================\n    async function runMergedProcess() {\n        if (isScriptRunning) {\n            addLog('脚本已在运行中，请等待完成。', true);\n            return;\n        }\n\n        // 开始处理前保存配置\n        saveConfig();\n\n        isScriptRunning = true;\n        shouldAbort = false;\n        let hasCompletedRound = false;\n        startBtn.disabled = true;\n        abortBtn.style.display = 'inline-block';\n\n        try {\n            while (true) {\n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，立即停止合并处理。', true);\n                    break;\n                }\n                \n                if (!isContinuousMode && hasCompletedRound) {\n                    addLog('非持续模式，已完成一轮处理，退出循环。');\n                    break;\n                }\n                \n                addLog(`\\n${'='.repeat(45)}`);\n                addLog(`=== 新一轮合并处理开始 (持续模式：${isContinuousMode ? '开启' : '关闭'}) ===`);\n                addLog(`${'='.repeat(45)}`);\n\n                // 1. 点击所有\"重置\"按钮\n                addLog('步骤1：点击\"重置\"按钮...');\n                const hasReset = clickAllResetButtons();\n                if (!hasReset) {\n                    addLog('未找到任何\"重置\"按钮，合并处理中止。', true);\n                    break;\n                }\n\n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止合并处理。', true);\n                    break;\n                }\n\n                await waitForLoadComplete();\n                await delay(500);\n\n                // 2. 设置分页显示数量\n                addLog('步骤2：设置分页显示数量...');\n                let pageSizeVal = pageSizeInput.value.trim() || defaultPageSize;\n                pageSizeInput.value = pageSizeVal;\n                const pageSizeSetOk = await selectPageSize(pageSizeVal);\n                if (!pageSizeSetOk) {\n                    addLog('设置分页显示数量失败，停止操作', true);\n                    break;\n                }\n\n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止合并处理。', true);\n                    break;\n                }\n\n                await waitForLoadComplete();\n                \n                // 3. 等待表格数据加载\n                addLog('步骤3：等待表格数据加载...');\n                await delay(800);\n                await waitForLoadComplete();\n\n                // 4. 智能筛选表格数据\n                addLog('步骤4：智能筛选表格数据...');\n                const { memberIdColumnName, vipColumnName, vipLevels, statusColumnName, orderStatuses } = getSelectedFilterConditions();\n                const { allRows, filteredRows, lastMemberId } = smartFilterTableData(\n                    memberIdColumnName, vipColumnName, vipLevels, statusColumnName, orderStatuses\n                );\n\n                const hasFilterConditions = vipLevels.length > 0 || orderStatuses.length > 0;\n                if (hasFilterConditions && filteredRows.length === 0) {\n                    addLog('⚠ 筛选条件不为空但无匹配数据，结束本轮处理', true);\n                    if (!isContinuousMode) {\n                        break;\n                    } else {\n                        addLog('持续模式：继续下一轮处理...');\n                        await delay(2000);\n                        continue;\n                    }\n                }\n\n                lastProcessedId = lastMemberId;\n\n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止合并处理。', true);\n                    break;\n                }\n\n                // 5. 点击高级搜索按钮\n                addLog('步骤5：点击\"高级搜索\"按钮...');\n                const advancedSearchClicked = clickAdvancedSearchButton();\n                if (!advancedSearchClicked) {\n                    addLog('无法点击高级搜索按钮，停止操作', true);\n                    break;\n                }\n\n                await delay(800);\n\n                // 6. 在高级搜索弹窗中输入会员ID并确认\n                addLog('步骤6：在高级搜索弹窗中输入会员ID并确认...');\n                const fillResult = await fillAdvancedSearchAndConfirm(lastMemberId);\n                if (!fillResult) {\n                    addLog('无法完成高级搜索填入，继续下一步', true);\n                }\n\n                addLog('等待页面加载完成...');\n                await waitForLoadComplete();\n                \n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止合并处理。', true);\n                    break;\n                }\n                \n                // 7. 再次设置分页显示条数\n                addLog('步骤7：再次设置分页显示条数...');\n                const pageSizeSetOk2 = await selectPageSize(pageSizeVal);\n                if (!pageSizeSetOk2) {\n                    addLog('设置分页显示数量失败，停止操作', true);\n                    break;\n                }\n                \n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止合并处理。', true);\n                    break;\n                }\n                \n                addLog('等待数据加载完成...');\n                await waitForLoadComplete();\n                \n                // 8. 重新读取搜索结果的所有数据行\n                addLog('步骤8：重新读取搜索结果的所有数据行...');\n                const { allRows: newAllRows, filteredRows: newFilteredRows } = smartFilterTableData(\n                    memberIdColumnName, vipColumnName, [], statusColumnName, []\n                );\n                \n                if (newAllRows.length === 0) {\n                    addLog('搜索结果无数据，结束本轮处理', true);\n                    if (!isContinuousMode) {\n                        break;\n                    } else {\n                        addLog('持续模式：继续下一轮处理...');\n                        await delay(2000);\n                        continue;\n                    }\n                }\n                \n                if (shouldAbort) {\n                    addLog('检测到用户中止请求，停止合并处理。', true);\n                    break;\n                }\n                \n                // 9. 检查最新一条数据行的VIP等级\n                addLog('步骤9：检查最新一条数据行的VIP等级...');\n                const firstRow = newAllRows[0];\n                const vipIndex = getColumnIndexByFuzzyMatch(vipColumnName);\n                const statusIndex = getColumnIndexByFuzzyMatch(statusColumnName);\n                const memberIdIndex = getColumnIndexByFuzzyMatch(memberIdColumnName);\n                \n                if (vipIndex === -1) {\n                    addLog(`⚠ 未找到VIP等级列\"${vipColumnName}\"`, true);\n                    addLog('✓ 本轮处理完成');\n                    hasCompletedRound = true;\n                    await delay(1000);\n                    continue;\n                }\n                \n                if (memberIdIndex === -1) {\n                    addLog(`⚠ 未找到会员ID列\"${memberIdColumnName}\"`, true);\n                    addLog('✓ 本轮处理完成');\n                    hasCompletedRound = true;\n                    await delay(1000);\n                    continue;\n                }\n                \n                const firstRowVipLevel = firstRow[`col_${vipIndex}`] || '';\n                addLog(`最新一条数据的VIP等级: ${firstRowVipLevel}`);\n                \n                const vipLevelLower = firstRowVipLevel.toLowerCase();\n                \n                // 获取表格单元格信息\n                const tableWrapper = document.querySelector('div.el-table__inner-wrapper');\n                if (!tableWrapper) {\n                    addLog('未找到表格容器', true);\n                    addLog('✓ 本轮处理完成');\n                    hasCompletedRound = true;\n                    await delay(1000);\n                    continue;\n                }\n                \n                const rows = tableWrapper.querySelectorAll('table tbody tr');\n                if (!rows || rows.length === 0) {\n                    addLog('表格暂无数据行', true);\n                    addLog('✓ 本轮处理完成');\n                    hasCompletedRound = true;\n                    await delay(1000);\n                    continue;\n                }\n                \n                const firstTr = rows[0];\n                const cells = firstTr.querySelectorAll('td');\n                \n                // ==================== VIP2完全隔离处理 ====================\n                if (vipLevelLower.includes('vip2')) {\n                    addLog('✓ 最新一条数据VIP等级为vip2，调用VIP2完全隔离处理函数');\n                    \n                    const vip2Result = await processVIP2(firstRow, cells, memberIdIndex, statusColumnName);\n                    \n                    if (vip2Result === 'reset') {\n                        hasCompletedRound = false;\n                        continue;\n                    } else if (vip2Result === 'aborted') {\n                        break;\n                    }\n                    \n                    hasCompletedRound = true;\n                    await delay(1000);\n                }\n                // ==================== VIP3完全隔离处理 ====================\n                else if (vipLevelLower.includes('vip3')) {\n                    addLog('✓ 最新一条数据VIP等级为vip3，调用VIP3完全隔离处理函数');\n                    \n                    const vip3Result = await processVIP3(firstRow, newAllRows, cells, memberIdIndex, statusColumnName);\n                    \n                    if (vip3Result === 'reset') {\n                        hasCompletedRound = false;\n                        continue;\n                    } else if (vip3Result === 'alarm') {\n                        hasCompletedRound = true;\n                        await delay(5000);\n                        continue;\n                    } else if (vip3Result === 'aborted') {\n                        break;\n                    }\n                    \n                    hasCompletedRound = true;\n                    await delay(1000);\n                }\n                // ==================== 其他VIP等级 ====================\n                else {\n                    addLog(`最新一条数据VIP等级为\"${firstRowVipLevel}\"，不是vip2或vip3，跳过操作`);\n                    addLog('✓ 本轮处理完成');\n                    hasCompletedRound = true;\n                    await delay(1000);\n                    continue;\n                }\n            }\n\n        } catch (e) {\n            addLog(`合并处理异常: ${e.message}`, true);\n            console.error(e);\n        } finally {\n            isScriptRunning = false;\n            startBtn.disabled = false;\n            abortBtn.style.display = 'none';\n            stopAlarm();\n            addLog('\\n合并处理流程结束。');\n        }\n    }\n\n    // ==================== 绑定配置自动保存事件 ====================\n    function bindConfigAutoSave() {\n        const configInputs = [\n            'memberIdColumnNameInput',\n            'vipColumnNameInput',\n            'statusColumnNameInput',\n            'paymentChannelInput',\n            'withdrawAmountInput',\n            'pageSizeInput',\n            'vipLevelSelect',\n            'orderStatusSelect',\n            'continuousCheckbox',\n            'consoleLogCheckbox'\n        ];\n\n        configInputs.forEach(id => {\n            const element = document.getElementById(id);\n            if (element) {\n                element.addEventListener('change', saveConfig);\n                if (element.tagName === 'INPUT' && element.type === 'text') {\n                    element.addEventListener('input', debounce(saveConfig, 500));\n                }\n            }\n        });\n    }\n\n    // 防抖函数\n    function debounce(func, wait) {\n        let timeout;\n        return function executedFunction(...args) {\n            const later = () => {\n                clearTimeout(timeout);\n                func(...args);\n            };\n            clearTimeout(timeout);\n            timeout = setTimeout(later, wait);\n        };\n    }\n\n    // ==================== 事件绑定 ====================\n    floatToggleButton.addEventListener('click', () => {\n        floatWindow.style.display = floatWindow.style.display === 'none' ? 'flex' : 'none';\n        saveWindowState();\n    });\n\n    closeBtn.addEventListener('click', () => {\n        floatWindow.style.display = 'none';\n        saveWindowState();\n    });\n\n    startBtn.addEventListener('click', () => {\n        isContinuousMode = continuousCheckbox.checked;\n        runMergedProcess();\n    });\n\n    abortBtn.addEventListener('click', () => {\n        if (isScriptRunning) {\n            shouldAbort = true;\n            addLog('用户点击了中止，等待当前任务结束...');\n        }\n    });\n\n    stopAlarmBtn.addEventListener('click', () => {\n        stopAlarm();\n    });\n\n    consoleLogCheckbox.addEventListener('change', () => {\n        enableConsoleLog = consoleLogCheckbox.checked;\n        addLog(enableConsoleLog ? '✓ 浏览器控制台日志已开启' : '✓ 浏览器控制台日志已关闭');\n    });\n\n    // 绑定拖拽和调整大小功能\n    makeDraggable(floatWindow, headerContainer);\n    makeResizable(floatWindow);\n\n    // 初始化窗口状态和配置\n    initializeWindowAndConfig();\n\n    // 绑定配置自动保存\n    bindConfigAutoSave();\n\n    addLog('合并处理助手脚本（VIP2/VIP3完全隔离版 - 增强版）已加载。');\n    addLog('✨ VIP2/VIP3完全隔离处理 | 独立的处理流程 | 避免步骤冲突');\n    addLog('🎨 支持窗口大小调整 | 配置自动保存\\n');\n})();\n","functional_script_code_hash":"46459246db73d67498b018d4f6b0161e77987ff217c52f8a13fe48b4b1505a3a","loader_script_hash":"a39eb8b0b53322e7ccb8d454e8110e4b6ff8a6f0a048bd21f7f279d76086a269","config":{"feature_x_enabled":true,"keyword_list":["example","test"],"salesmartly_api_key":"YOUR_SALESMARTLY_API_KEY_IF_NEEDED"}}