local addonName, ZLAUTO = ...

local ZL = ZLAUTO.mainFrame
local background = ZL.background
local ScrollFrame_OnMouseWheel = ZL.ScrollFrame_OnMouseWheel
local btnDelay = ZL.btnDelay
local PlayerIsML = ZL.PlayerIsML
local Prefix = ZL.Prefix
-- local CountDown = ZL.CountDown
local CreateButton = ZL.CreateButton
local pruneCrossRealm = ZL.pruneCrossRealm
local GetAuctioningCount = ZL.GetAuctioningCount
local GetStartAndIncrementBid = ZL.GetStartAndIncrementBid
local ItemAuctionFrameIsShown = ZL.ItemAuctionFrameIsShown
local tableSort = ZL.tableSort
local emptytable = ZL.emptytable
local pad_left = ZL.pad_left
local GameTooltipShow = ZL.GameTooltipShow
local GameTooltipShowAnchor = ZL.GameTooltipShowAnchor
local ConvertSecondsToTime = ZL.ConvertSecondsToTime
local CreateMenu = ZL.CreateMenu
local GetCurrentRoster = ZL.GetCurrentRoster
local LoadItemDataByID = ZL.LoadItemDataByID
local GetClassColorName = ZL.GetClassColorName
local ParseClassColorName = ZL.ParseClassColorName
local GetAveWages = ZL.GetAveWages
local CreateEditBox = ZL.CreateEditBox
local CreateResizeButton = ZL.CreateResizeButton
local ZLCreateFrame = ZL.ZLCreateFrame
local CreateHeaderButton = ZL.CreateHeaderButton
local CheckWaVersion = ZL.CheckWaVersion
local InportToStatistics = ZL.InportToStatistics
local GetWeekDay = ZL.GetWeekDay
local EditOnMouseWheel = ZL.EditOnMouseWheel
local cGetItemInfo = C_Item and C_Item.GetItemInfo or GetItemInfo
local cGetItemIcon = C_Item and C_Item.GetItemIconByID or GetItemIcon
local GetItemInfoInstant = C_Item and C_Item.GetItemInfoInstant or GetItemInfoInstant
local MyAddon = ZL.MyAddon

local NON_DISENCHANTABLE_ITEMS = {
	["11287"] = true, ["186163"] = true, ["186058"] = true, ["186056"] = true,
	["11288"] = true, ["109262"] = true, ["97832"] = true, ["97831"] = true,
	["11289"] = true, ["97830"] = true, ["97829"] = true, ["97828"] = true,
	["11290"] = true, ["97827"] = true, ["97826"] = true, ["89586"] = true,
	["20406"] = true, ["84661"] = true, ["75274"] = true, ["60223"] = true,
	["20407"] = true, ["52488"] = true, ["52487"] = true, ["52486"] = true,
	["20408"] = true, ["52485"] = true, ["52252"] = true, ["21766"] = true,
}

function ZL:CreateFloatAuctionFrame()
    ZL.FloatAuctionFrame = CreateFrame("Button", nil, ZL.AuctionFrame2, BackdropTemplateMixin and "BackdropTemplate")
    local FloatAuctionFrame = ZL.FloatAuctionFrame
    -- ZL.FloatAuctionFrame.index = 1
    -- local f = ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index]
    FloatAuctionFrame:SetPoint("LEFT", ZL.AuctionFrame2, "RIGHT", 1, 0)
    FloatAuctionFrame:SetFrameStrata("FULLSCREEN")
    FloatAuctionFrame:SetClampedToScreen(true)
    FloatAuctionFrame:SetAlpha(1)
    FloatAuctionFrame:SetScale(ZL.opt.ZLAuctionFrameScale)
    FloatAuctionFrame:SetBackdrop({
        bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark",
        edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
        tile = true, tileSize = 32, edgeSize = 6,
        insets = { left = 0, right = 0, top = 0, bottom = 0 }
    })
    FloatAuctionFrame.bidFrame = CreateFrame("Frame", nil, FloatAuctionFrame)
    local bidFrame = FloatAuctionFrame.bidFrame
    bidFrame:SetPoint("TOPLEFT", FloatAuctionFrame, "TOPLEFT")
    bidFrame.bidEditBox = CreateEditBox(bidFrame, 85, 18, 14, "RIGHT", true)
    local bidEditBox = bidFrame.bidEditBox
    bidEditBox:SetPoint("TOPLEFT", 5, -5)
    bidEditBox.Background:SetColorTexture(0,0,0,0)
    bidEditBox.Font = bidEditBox:CreateFontString()
    bidEditBox.Font:SetPoint("LEFT", bidEditBox, "LEFT", 2, 0)
    bidEditBox.Font:SetHeight(18)
    bidEditBox.Font:SetFont(GameFontNormal:GetFont(), 13)
    bidEditBox.Font:SetText("|cff595959目标价|r")
    bidEditBox.Font:SetWordWrap(false)
    bidEditBox.Font:SetJustifyH("LEFT")

    bidFrame.bidCounts = CreateEditBox(bidFrame, 40, 18, 14, "RIGHT", true)
    local bidCounts = bidFrame.bidCounts
    bidCounts:SetPoint("LEFT", bidEditBox, "RIGHT", 5, 0)
    bidCounts.Font = bidCounts:CreateFontString()
    bidCounts.Font:SetPoint("LEFT", bidCounts, "LEFT", 2, 0)
    bidCounts.Font:SetHeight(18)
    bidCounts.Font:SetFont(GameFontNormal:GetFont(), 13)
    bidCounts.Font:SetText("|cff595959数量|r")
    bidCounts.Font:SetWordWrap(false)
    bidCounts.Font:SetJustifyH("LEFT")

    bidFrame.bidBtn = CreateButton(nil, bidFrame, "出价", "LEFT", bidCounts, "RIGHT", 5, 0, 40, 18)
    local bidBtn = bidFrame.bidBtn
    bidBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")

    bidFrame.lgnoreBtn = CreateButton(nil, bidFrame, "忽略", "LEFT", bidBtn, "RIGHT", 5, 0, 40, 18)
    local lgnoreBtn = bidFrame.lgnoreBtn
    lgnoreBtn:Hide()

    bidFrame:SetSize(20+bidEditBox:GetWidth()+bidBtn:GetWidth()*2, bidEditBox:GetHeight()+10)
    bidFrame.line = bidFrame:CreateTexture(nil, "OVERLAY")
    bidFrame.line:SetColorTexture(0.5, 0.5, 0.5, 1)
    bidFrame.line:SetPoint("BOTTOMLEFT", 1, 0)
    bidFrame.line:SetPoint("TOPRIGHT", bidFrame, "BOTTOMRIGHT", -1, 1)

    FloatAuctionFrame.MLframe = CreateFrame("Frame", nil, FloatAuctionFrame)
    local MLframe = FloatAuctionFrame.MLframe
    MLframe:SetPoint("TOPLEFT", bidFrame, "BOTTOMLEFT")
    MLframe:SetSize(1, 1)

    MLframe.startbidFrame = CreateFrame("Frame", "startbidFrame", MLframe)
    local startbidFrame = MLframe.startbidFrame
    startbidFrame:SetPoint("TOPLEFT")

    startbidFrame.startbidEditbox = CreateEditBox(startbidFrame, 85, 18, 14, "RIGHT", true)
    local startbidEditbox = startbidFrame.startbidEditbox
    startbidEditbox:SetPoint("TOPLEFT", startbidFrame, "TOPLEFT", 5, -5)
    startbidEditbox.Background:SetColorTexture(0,0,0,0)
    startbidEditbox.startbidFont = startbidEditbox:CreateFontString()
    startbidEditbox.startbidFont:SetPoint("LEFT", startbidEditbox, "LEFT", 2, 0)
    startbidEditbox.startbidFont:SetHeight(18)
    startbidEditbox.startbidFont:SetFont(GameFontNormal:GetFont(), 13)
    startbidEditbox.startbidFont:SetText("|cff595959起拍价|r")
    startbidEditbox.startbidFont:SetWordWrap(false)
    startbidEditbox.startbidFont:SetJustifyH("LEFT")

    startbidFrame.incrementEditbox = CreateEditBox(startbidFrame, 85, 18, 14, "RIGHT", true)
    local incrementEditbox = startbidFrame.incrementEditbox
    incrementEditbox:SetPoint("LEFT", startbidEditbox, "RIGHT", 5, 0)
    incrementEditbox.Background:SetColorTexture(0,0,0,0)
    incrementEditbox.inrementFont = incrementEditbox:CreateFontString()
    incrementEditbox.inrementFont:SetPoint("LEFT", incrementEditbox, "LEFT", 2, 0)
    incrementEditbox.inrementFont:SetHeight(18)
    incrementEditbox.inrementFont:SetFont(GameFontNormal:GetFont(), 13)
    incrementEditbox.inrementFont:SetText("|cff595959加价|r")
    incrementEditbox.inrementFont:SetWordWrap(false)
    incrementEditbox.inrementFont:SetJustifyH("LEFT")

    startbidFrame:SetSize(bidFrame:GetWidth(), 10+startbidEditbox:GetHeight())
    startbidFrame.line = startbidFrame:CreateTexture(nil, "OVERLAY")
    startbidFrame.line:SetColorTexture(0.5, 0.5, 0.5, 1)
    startbidFrame.line:SetPoint("BOTTOMLEFT", 1, 0)
    startbidFrame.line:SetPoint("TOPRIGHT", startbidFrame, "BOTTOMRIGHT", -1, 1)

    MLframe.functionFrame = CreateFrame("Frame", nil, MLframe)
    local functionFrame = MLframe.functionFrame
    functionFrame:SetPoint("TOPLEFT", startbidFrame, "BOTTOMLEFT")
    functionFrame.CancelBtn = CreateButton(nil, functionFrame, "开始", "TOPLEFT", functionFrame, "TOPLEFT", 5, -5, 40, 18)
    local CancelBtn = functionFrame.CancelBtn
    CancelBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")

    functionFrame.PauseBtn = CreateButton(nil, functionFrame, "暂停", "LEFT", CancelBtn, "RIGHT", 5, 0, 40, 18)
    local PauseBtn = functionFrame.PauseBtn
    PauseBtn:Hide()

    functionFrame.CountDownBtn = CreateButton(nil, functionFrame, "倒数", "LEFT", CancelBtn, "RIGHT", 5, 0, 40, 18)  --"LEFT", PauseBtn, "RIGHT", 5, 0
    local CountDownBtn = functionFrame.CountDownBtn
    CountDownBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")

    functionFrame.packageBtn = CreateButton(nil, functionFrame, "打包", "LEFT", CountDownBtn, "RIGHT", 5, 0, 40, 18)
    local packageBtn = functionFrame.packageBtn
    packageBtn:Hide()

    functionFrame.reverseBidBtn = CreateButton(nil, functionFrame, "撤销", "TOPLEFT", CancelBtn, "BOTTOMLEFT", 0, -3, 40, 18)
    local reverseBidBtn = functionFrame.reverseBidBtn
    reverseBidBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    reverseBidBtn:Hide()

    functionFrame.modifyBidBtn = CreateButton(nil, functionFrame, "修改", "LEFT", reverseBidBtn, "RIGHT", 5, 0, 40, 18)
    local modifyBidBtn = functionFrame.modifyBidBtn
    modifyBidBtn:Hide()

    functionFrame.syncBtn = CreateButton(nil, functionFrame, "通报竞拍", "LEFT", CountDownBtn, "RIGHT", 5, 0, 85, 18)  --"LEFT", modifyBidBtn, "RIGHT", 5, 0
    local syncBtn = functionFrame.syncBtn
    syncBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")

    functionFrame.delAuctionBtn = CreateButton(nil, functionFrame, "删除", "LEFT", syncBtn, "RIGHT", 5, 0, 40, 18)
    local delAuctionBtn = functionFrame.delAuctionBtn
    delAuctionBtn:Hide()

    functionFrame:SetSize(bidFrame:GetWidth(), 10+CancelBtn:GetHeight()) --13+CancelBtn:GetHeight()*2
    FloatAuctionFrame:SetSize(bidFrame:GetWidth(), bidFrame:GetHeight()+startbidFrame:GetHeight()+functionFrame:GetHeight())
    FloatAuctionFrame:Hide()
    FloatAuctionFrame:SetScript("OnShow", function (self)
        local AuctionFrame = ZL.AuctionFrame2
        if AuctionFrame.bidHeaderBtn:IsShown() or ZL.opt.floatBidFrameHide then
            bidFrame:Hide()
        else
            bidFrame:Show()
        end
        if AuctionFrame.startbidHeaderBtn:IsShown() or (not PlayerIsML()) or ZL.opt.floatStartBidFrameHide then
            startbidFrame:Hide()
        else
            startbidFrame:Show()
        end
        if AuctionFrame.functionHeaderBtn:IsShown() or (not PlayerIsML()) or ZL.opt.floatFunctionFrameHide then
            functionFrame:Hide()
        else
            functionFrame:Show()
        end
        local height = 0
        if bidFrame:IsShown() then
            bidCounts:ClearAllPoints()
            if PlayerIsML() then
                bidCounts:SetPoint("LEFT", bidEditBox, "RIGHT", 5, 0)
                bidFrame:SetSize(20+bidEditBox:GetWidth()+bidCounts:GetWidth()*2, bidEditBox:GetHeight()+10)
            else
                bidCounts:SetPoint("TOPLEFT", bidEditBox, "BOTTOMLEFT", 0, -3)
                bidFrame:SetSize(10+bidEditBox:GetWidth(), bidEditBox:GetHeight()+bidCounts:GetHeight()+13)
            end
            height = bidFrame:GetHeight()
        end
        if startbidFrame:IsShown() then
            startbidFrame:ClearAllPoints()
            startbidFrame:SetPoint("TOPLEFT", FloatAuctionFrame, "TOPLEFT", 0, -height)
            height = startbidFrame:GetHeight() + height
        end
        if functionFrame:IsShown() then
            functionFrame:ClearAllPoints()
            functionFrame:SetPoint("TOPLEFT", FloatAuctionFrame, "TOPLEFT", 0, -height)
            height = functionFrame:GetHeight() + height
        end
        FloatAuctionFrame:SetSize(bidFrame:GetWidth(), height)
        local curAuction = ZL_CURRENT.auctionlist[ZL.FloatAuctionFrame.index]
        if curAuction.state and curAuction.state == "auctioning" then
            local _, bidIncrement, newBid, _bidCount, successList = ZL.GetNewBidAmount(ZL.FloatAuctionFrame.index)
            local bidCount = bidCounts:GetNumber()
            local itemCount = curAuction.itemCount
            bidCount = bidCount > 0 and bidCount or 1
            bidCount = bidCount > itemCount and itemCount or bidCount
            if bidCount > _bidCount and #successList > 0 then
                for i = #successList, 1, -1 do
                    if successList[i][2] >= bidCount then
                        newBid = successList[i][1] + bidIncrement
                        break
                    end
                end
            end
            bidEditBox:SetNumber(newBid)
        else
            bidEditBox:SetText("")
        end
    end)
    FloatAuctionFrame:SetScript("OnEnter", function (self)
        ZL.FloatAuctionFrame.OnShow()
        ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Show()
    end)
    FloatAuctionFrame:SetScript("OnLeave", function (self)
        if ZL.FloatAuctionFrame.time and (not ZL.FloatAuctionFrame.time:IsCancelled()) then
            ZL.FloatAuctionFrame.time:Cancel()
        end
        ZL.FloatAuctionFrame.OnHide()
        -- ZL.FloatAuctionFrame.time = C_Timer.NewTimer(0.01, function (self)
        --     ZL.FloatAuctionFrame.OnHide()
        -- end)
        local Frame1 = ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index]
        if (not Frame1:IsMouseOver()) and (not ZL.FloatAuctionFrame:IsMouseOver()) then
            Frame1.zlHighlight:Hide()
        end
    end)
    function FloatAuctionFrame.OnShow()
        if ZL.FloatAuctionFrame.time and (not ZL.FloatAuctionFrame.time:IsCancelled()) then
            ZL.FloatAuctionFrame.time:Cancel()
        end
        if not FloatAuctionFrame:IsShown() then
            FloatAuctionFrame:Show()
        end
    end
    function FloatAuctionFrame.OnHide()
        if not ZL.FloatAuctionFrame.index then return end
        local f = ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index]
        if (not FloatAuctionFrame:IsMouseOver()) and (not f:IsMouseOver()) then
            FloatAuctionFrame:Hide()
        end
    end
    function FloatAuctionFrame:Update()
        if ZL.FloatAuctionFrame.index and self:IsShown() then
            local f = ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index]
            local curAuction = ZL_CURRENT.auctionlist[ZL.FloatAuctionFrame.index]
            self:ClearAllPoints()
            self:SetPoint("LEFT", f, "RIGHT", 0, 0)
            do
                if f.bidFrame.bidEditBox:IsEnabled() then
                    bidEditBox:Enable()
                else
                    bidEditBox:Disable()
                end
                if f.bidFrame.bidCounts:GetNumber() == 0 then
                    bidCounts:SetText("")
                else
                    bidCounts:SetNumber(f.bidFrame.bidCounts:GetNumber())
                end

                if f.bidFrame.bidBtn:IsEnabled() then
                    bidBtn:Enable()
                else
                    bidBtn:Disable()
                end
                bidBtn:SetText(f.bidFrame.bidBtn:GetText())
                if f.bidFrame.lgnoreBtn:IsEnabled() then
                    lgnoreBtn:Enable()
                else
                    lgnoreBtn:Disable()
                end
                lgnoreBtn:SetText(f.bidFrame.lgnoreBtn:GetText())
                local sbf = f.MLframe.startbidFrame
                startbidEditbox:SetNumber(sbf.startbidEditbox:GetNumber())
                incrementEditbox:SetNumber(sbf.incrementEditbox:GetNumber())
                local funf = f.MLframe.functionFrame
                CancelBtn:SetText(funf.CancelBtn:GetText())
                if funf.CancelBtn:IsEnabled() then
                    CancelBtn:Enable()
                else
                    CancelBtn:Disable()
                end
                PauseBtn:SetText(funf.PauseBtn:GetText())
                if funf.PauseBtn:IsEnabled() then
                    PauseBtn:Enable()
                else
                    PauseBtn:Disable()
                end
                CountDownBtn:SetText(funf.CountDownBtn:GetText())
                if funf.CountDownBtn:IsEnabled() then
                    CountDownBtn:Enable()
                else
                    CountDownBtn:Disable()
                end
                packageBtn:SetText(funf.packageBtn:GetText())
                if funf.packageBtn:IsEnabled() then
                    packageBtn:Enable()
                else
                    packageBtn:Disable()
                end
                reverseBidBtn:SetText(funf.reverseBidBtn:GetText())
                if funf.reverseBidBtn:IsEnabled() then
                    reverseBidBtn:Enable()
                else
                    reverseBidBtn:Disable()
                end
                modifyBidBtn:SetText(funf.modifyBidBtn:GetText())
                if funf.modifyBidBtn:IsEnabled() then
                    modifyBidBtn:Enable()
                else
                    modifyBidBtn:Disable()
                end

                syncBtn:SetText(funf.syncBtn:GetText())
                if funf.syncBtn:IsEnabled() then
                    syncBtn:Enable()
                else
                    syncBtn:Disable()
                end
                delAuctionBtn:SetText(funf.delAuctionBtn:GetText())
                if funf.delAuctionBtn:IsEnabled() then
                    delAuctionBtn:Enable()
                else
                    delAuctionBtn:Disable()
                end
            end

            bidEditBox:SetScript("OnTextChanged", function (self)
                if strlen(self:GetText()) > 0 then
                    bidEditBox.Font:Hide()
                else
                    bidEditBox.Font:Show()
                end
                f.bidFrame.bidEditBox:SetText(self:GetText())
            end)
            bidEditBox:SetScript("OnEnter", f.bidFrame.bidEditBox:GetScript("OnEnter"))
            bidEditBox:SetScript("OnLeave", f.bidFrame.bidEditBox:GetScript("OnLeave"))
            bidEditBox:SetScript("OnMouseWheel", f.bidFrame.bidEditBox:GetScript("OnMouseWheel"))
            bidEditBox:SetScript("OnEscapePressed", f.bidFrame.bidEditBox:GetScript("OnEscapePressed"))
            bidEditBox:SetScript("OnEnterPressed", f.bidFrame.bidEditBox:GetScript("OnEnterPressed"))
            bidEditBox:SetScript("OnMouseDown", f.bidFrame.bidEditBox:GetScript("OnMouseDown"))
            bidEditBox:SetScript("OnEditFocusGained", f.bidFrame.bidEditBox:GetScript("OnEditFocusGained"))
            bidEditBox:SetScript("OnEditFocusLost", f.bidFrame.bidEditBox:GetScript("OnEditFocusLost"))

            bidCounts:SetScript("OnTextChanged", function(self)
                bidCounts.Font:Hide()
                local itemCount = ZL_CURRENT["auctionlist"][ZL.FloatAuctionFrame.index].itemCount
                local number = self:GetNumber()
                if number < 1 then
                    number = 1
                elseif number > itemCount then
                    number = itemCount
                end
                self:SetNumber(number)
                f.bidFrame.bidCounts:SetText(number)
            end)
            bidCounts:SetScript("OnEnter", f.bidFrame.bidCounts:GetScript("OnEnter"))
            bidCounts:SetScript("OnLeave", f.bidFrame.bidCounts:GetScript("OnLeave"))
            bidCounts:SetScript("OnMouseWheel", f.bidFrame.bidCounts:GetScript("OnMouseWheel"))
            bidCounts:SetScript("OnEscapePressed", f.bidFrame.bidCounts:GetScript("OnEscapePressed"))
            bidCounts:SetScript("OnEnterPressed", f.bidFrame.bidCounts:GetScript("OnEnterPressed"))
            bidCounts:SetScript("OnMouseDown", f.bidFrame.bidCounts:GetScript("OnMouseDown"))
            bidCounts:SetScript("OnEditFocusLost", f.bidFrame.bidCounts:GetScript("OnEditFocusLost"))

            bidBtn:SetScript("OnEnter", f.bidFrame.bidBtn:GetScript("OnEnter"))
            bidBtn:SetScript("OnLeave", f.bidFrame.bidBtn:GetScript("OnLeave"))
            bidBtn:SetScript("OnClick", f.bidFrame.bidBtn:GetScript("OnClick"))

            lgnoreBtn:SetScript("OnEnter", f.bidFrame.lgnoreBtn:GetScript("OnEnter"))
            lgnoreBtn:SetScript("OnLeave", f.bidFrame.lgnoreBtn:GetScript("OnLeave"))
            lgnoreBtn:SetScript("OnClick", f.bidFrame.lgnoreBtn:GetScript("OnClick"))

            local sbf = f.MLframe.startbidFrame
            startbidEditbox:SetScript("OnEditFocusGained", sbf.startbidEditbox:GetScript("OnEditFocusGained"))
            startbidEditbox:SetScript("OnTextChanged", function (self)
                sbf.startbidEditbox:SetText(self:GetText())
                local startbid = self:GetNumber() or 0
                if startbid > 0 then
                    ZL_CURRENT.auctionlist[ZL.FloatAuctionFrame.index].startbidamount = startbid
                end
            end)
            startbidEditbox:SetScript("OnMouseWheel", sbf.startbidEditbox:GetScript("OnMouseWheel"))
            startbidEditbox:SetScript("OnEnter", sbf.startbidEditbox:GetScript("OnEnter"))
            startbidEditbox:SetScript("OnLeave", sbf.startbidEditbox:GetScript("OnLeave"))
            startbidEditbox:SetScript("OnEditFocusLost", sbf.startbidEditbox:GetScript("OnEditFocusLost"))
            
            incrementEditbox:SetScript("OnEditFocusGained", sbf.incrementEditbox:GetScript("OnEditFocusGained"))
            incrementEditbox:SetScript("OnTextChanged", function (self)
                sbf.incrementEditbox:SetText(self:GetText())
                local increment = self:GetNumber() or 0
                if increment > 0 then
                    ZL_CURRENT.auctionlist[ZL.FloatAuctionFrame.index].bidIncrement = increment
                end
            end)
            incrementEditbox:SetScript("OnMouseWheel", sbf.incrementEditbox:GetScript("OnMouseWheel"))
            incrementEditbox:SetScript("OnEnter", sbf.incrementEditbox:GetScript("OnEnter"))
            incrementEditbox:SetScript("OnLeave", sbf.incrementEditbox:GetScript("OnLeave"))
            incrementEditbox:SetScript("OnEditFocusLost", sbf.incrementEditbox:GetScript("OnEditFocusLost"))

            local funf = f.MLframe.functionFrame
            packageBtn:SetScript("OnEnter", funf.packageBtn:GetScript("OnEnter"))
            packageBtn:SetScript("OnLeave", funf.packageBtn:GetScript("OnLeave"))
            packageBtn:SetScript("OnClick", funf.packageBtn:GetScript("OnClick"))

            CountDownBtn:SetScript("OnEnter", funf.CountDownBtn:GetScript("OnEnter"))
            CountDownBtn:SetScript("OnLeave", funf.CountDownBtn:GetScript("OnLeave"))
            CountDownBtn:SetScript("OnClick", funf.CountDownBtn:GetScript("OnClick"))

            PauseBtn:SetScript("OnEnter", funf.PauseBtn:GetScript("OnEnter"))
            PauseBtn:SetScript("OnLeave", funf.PauseBtn:GetScript("OnLeave"))
            PauseBtn:SetScript("OnClick", funf.PauseBtn:GetScript("OnClick"))

            CancelBtn:SetScript("OnEnter", funf.CancelBtn:GetScript("OnEnter"))
            CancelBtn:SetScript("OnLeave", funf.CancelBtn:GetScript("OnLeave"))
            CancelBtn:SetScript("OnClick", funf.CancelBtn:GetScript("OnClick"))

            reverseBidBtn:SetScript("OnEnter", funf.reverseBidBtn:GetScript("OnEnter"))
            reverseBidBtn:SetScript("OnLeave", funf.reverseBidBtn:GetScript("OnLeave"))
            reverseBidBtn:SetScript("OnClick", funf.reverseBidBtn:GetScript("OnClick"))

            modifyBidBtn:SetScript("OnEnter", funf.modifyBidBtn:GetScript("OnEnter"))
            modifyBidBtn:SetScript("OnLeave", funf.modifyBidBtn:GetScript("OnLeave"))
            modifyBidBtn:SetScript("OnClick", funf.modifyBidBtn:GetScript("OnClick"))

            syncBtn:SetScript("OnEnter", funf.syncBtn:GetScript("OnEnter"))
            syncBtn:SetScript("OnLeave", funf.syncBtn:GetScript("OnLeave"))
            syncBtn:SetScript("OnClick", funf.syncBtn:GetScript("OnClick"))

            delAuctionBtn:SetScript("OnEnter", funf.delAuctionBtn:GetScript("OnEnter"))
            delAuctionBtn:SetScript("OnLeave", funf.delAuctionBtn:GetScript("OnLeave"))
            delAuctionBtn:SetScript("OnClick", funf.delAuctionBtn:GetScript("OnClick"))
        end
    end
end

function ZL:CreateAuctionFrame2()
    ZL.AuctionFrame2 = ZLCreateFrame(nil, ZL, nil, nil, nil, true, true, "拍卖清单(|cffffffff" .. ZL.addonVersion .. "|r)")
    local AuctionFrame = ZL.AuctionFrame2
    AuctionFrame:SetScale(ZL.opt.ZLAuctionFrameScale)
    if ZL.opt.ZLAuctionFrameIsShown then
        AuctionFrame:Show()
    else
        AuctionFrame:Hide()
    end
    AuctionFrame:SetScript("OnMouseUp", function (self)
        self:StopMovingOrSizing()
        if not ZL.db.global.ZLAuctionFrame then ZL.db.global.ZLAuctionFrame = {} end
        ZL.db.global.ZLAuctionFrame.point, _, ZL.db.global.ZLAuctionFrame.relative, ZL.db.global.ZLAuctionFrame.x, ZL.db.global.ZLAuctionFrame.y = self:GetPoint()
    end)
    AuctionFrame:SetScript("OnMouseDown", function (self)
        self:StartMoving()
    end)
    AuctionFrame:SetScript("OnShow", function (self)
        self:Update()
    end)
    AuctionFrame.closeButton:SetScript("OnClick", function (self)
        ZL.opt.ZLAuctionFrameIsShown = false
        AuctionFrame:Hide()
        if (PlayerIsML() or IsInRaid(1) or (not ZL.opt.maxFrameHide)) then
            ZL.maxFrame:Show()
        else
            ZL.maxFrame:Hide()
        end
    end)
    local resizeButton = AuctionFrame.resizeButton
    -- 设置鼠标按下时开始调整大小
    resizeButton:SetScript("OnMouseDown", function(self, button)
        if button == "LeftButton" then
            AuctionFrame:StartSizing("BOTTOMRIGHT")
        end
    end)
    -- 鼠标松开时停止调整大小
    resizeButton:SetScript("OnMouseUp", function(self, button)
        AuctionFrame:StopMovingOrSizing()
        -- if not ZL.opt.ZLAuctionFrame then ZL.opt.ZLAuctionFrame = {} end
        if not ZL.db.global.ZLAuctionFrame then ZL.db.global.ZLAuctionFrame = {} end
        ZL.db.global.ZLAuctionFrame.Width,  ZL.db.global.ZLAuctionFrame.Height= AuctionFrame:GetSize()
    end)
    AuctionFrame:ClearAllPoints()
    if ZL.db.global.ZLAuctionFrame and ZL.db.global.ZLAuctionFrame.point then
        AuctionFrame:SetPoint(ZL.db.global.ZLAuctionFrame.point, UIParent, ZL.db.global.ZLAuctionFrame.relative, ZL.db.global.ZLAuctionFrame.x, ZL.db.global.ZLAuctionFrame.y)
    else
        AuctionFrame:SetPoint("CENTER")
    end
    if ZL.db.global.ZLAuctionFrame and ZL.db.global.ZLAuctionFrame.Width and ZL.db.global.ZLAuctionFrame.Height then
        AuctionFrame:SetSize(ZL.db.global.ZLAuctionFrame.Width, ZL.db.global.ZLAuctionFrame.Height)
    end

    local auctionModeFontString = AuctionFrame:CreateFontString(nil, "OVERLAY")
    auctionModeFontString:SetPoint("TOPLEFT", AuctionFrame.TitleBottom, "TOPLEFT", 3, -7)
    auctionModeFontString:SetHeight(20)
    auctionModeFontString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
    auctionModeFontString:SetWordWrap(false)
    auctionModeFontString:SetJustifyH("LEFT")
    auctionModeFontString:SetTextColor(1, 0.82, 0, 1)
    auctionModeFontString:SetText("模式：")
    AuctionFrame.auctionModeDropdown = CreateFrame("Button", nil, AuctionFrame)
    local auctionModeDropdown = AuctionFrame.auctionModeDropdown
    auctionModeDropdown:SetPoint("LEFT", auctionModeFontString, "RIGHT", 2, 0)
    auctionModeDropdown:SetSize(70, 20)
    ZL.GUI:GetClass('Dropdown'):Bind(auctionModeDropdown)
    local auctionModeDropdownFontString = auctionModeDropdown:GetFontString()
    if auctionModeDropdownFontString then
	    auctionModeDropdownFontString:SetFont(GameFontNormal:GetFont(), 13)
    end
    auctionModeDropdown:SetMenuTable({
        {text="团队", value=1},
        {text="|cff00ff00明拍|r", value=2},
        {text="|cffff0000匿名|r", value=3},
    })
    auctionModeDropdown:SetDefaultText(ZL.opt.auctionMode)

    auctionModeDropdown:SetCallback('OnSelectChanged', function ()
        local auctionMode = auctionModeDropdown:GetText()
        if auctionMode == ZL.opt.auctionMode then return end
        local msgStr
        if PlayerIsML() then
            local addonVersion, WAVersion = 2201, 1101
            local function satisfyNumbers()
                local totalMembers = 0
                local hasAddon = 0
                if ZL_PLAYERLIST.GroupMembersVersion and next(ZL_PLAYERLIST.GroupMembersVersion) and IsInRaid(1) then
                    for i = 1, MAX_RAID_MEMBERS do
                        local name, _, _, _, _, _, _, online = GetRaidRosterInfo(i)
                        if name and online then
                            totalMembers = totalMembers + 1
                            local playerVer = ZL_PLAYERLIST.GroupMembersVersion[name]
                            if playerVer then
                                playerVer = playerVer:gsub("|cffFFD100%(WA%-V[%d%.]+%)|r", "")
                                if strfind(playerVer, "WA%-V") then
                                    playerVer = playerVer:gsub("WA%-V", ""):gsub("%.", "")
                                    playerVer = tonumber(playerVer)
                                    if playerVer >= WAVersion then
                                        hasAddon = hasAddon + 1
                                    end
                                else
                                    playerVer = playerVer:gsub("V", ""):gsub("%.", "")
                                    playerVer = tonumber(playerVer)
                                    if playerVer >= addonVersion then
                                        hasAddon = hasAddon + 1
                                    end
                                end
                            end
                        end
                    end
                end
                return totalMembers, hasAddon
            end
            if auctionMode == "团队" then
                ZL.opt.auctionMode = auctionMode
                ZL.TransmitAddonInfo_Pro()
                if IsInRaid(1) then
                    msgStr = "已切换为【".. auctionMode .. "】拍卖模式！"
                    ZL.Print(msgStr)
                    SendChatMessage("已切换为【团队】拍卖模式！请直接在团队频道出价竞拍！", "RAID")
                end
            else
                local totalMembers, hasAddon = satisfyNumbers()
                if totalMembers > 0 then
                    if hasAddon == totalMembers then
                        if auctionMode == "|cffff0000匿名|r" then
                            --获取团队版本号
                            local data = {type="request", ver=ZL.addonVersion}
                            MyAddon:TransmitAddonInfo2("AUTOAUC VER", data, "RAID")
                            msgStr = "确定使用【" .. auctionMode .. "】拍卖模式么？\n确定后将发起投票，通过人数大于50%才可使用"
                            local data = {
                                type = "匿名",
                                totalMembers = totalMembers,
                            }
                            StaticPopup_Show("ZL_CHANGEAUCTIONMODE", msgStr, nil, data)
                        else
                            ZL.opt.auctionMode = auctionMode
                            ZL.TransmitAddonInfo_Pro()
                            if IsInRaid(1) then
                                msgStr = "已切换为插件【" .. auctionMode .. "】模式！未安装插件或拍卖WA字符串的将看不到拍卖窗口"
                                ZL.Print(msgStr)
                                SendChatMessage("已切换为插件【明拍】模式！未安装插件或WA字符串的将看不到拍卖窗口", "RAID")
                            end
                        end
                    else
                        msgStr = "存在未安装或版本过低的插件(要求V2.2.01及以上)\n或拍卖WA字符串(要求WA-V1.2.01及以上)，无法使用【" .. auctionMode .. "】拍卖模式！"
                        ZL.Print(msgStr, true, nil, 1, 0, 0)
                        auctionModeDropdown:SetValue(1)
                    end
                else
                    msgStr = "不在团队中，无法使用【" .. auctionMode .. "】拍卖模式！"
                    ZL.Print(msgStr)
                    auctionModeDropdown:SetValue(1)
                end
            end
        else
            msgStr = "ML功能，设置无效！"
            ZL.Print(msgStr, true, nil, 1, 0, 0)
            auctionModeDropdown:SetValue(1)
        end
    end)
    auctionModeDropdown:SetScript("OnEnter", function (self)
        local posLeft = AuctionFrame:GetLeft()
        local posRight = GetScreenWidth() - AuctionFrame:GetRight()
        if posLeft > posRight then
            GameTooltipShow(AuctionFrame, "TOPRIGHT", "TOPLEFT")
        else
            GameTooltipShow(AuctionFrame, "TOPLEFT", "TOPRIGHT")
        end
        GameTooltip:AddLine("拍卖模式")
        GameTooltip:AddLine("团队：|cffffffff团队频道出价|r|cff87CEEB(无需全团安装)|r")
        GameTooltip:AddLine("明拍：|cffffffff插件通信，在插件里可以看到出价人|r")
        GameTooltip:AddLine("匿名：|cffffffff插件通信，匿名拍卖，看不到出价人|r")
        GameTooltip:AddLine("|cff87CEEB明拍和匿名需全团安装插件或拍卖WA字符串\n否则无法看到拍卖信息|r")
        GameTooltip:AddLine("|cffff0000注：匿名拍卖需投票，通过人数大于全团\n在线人数一半才可以使用！|r")
        GameTooltip:Show()
    end)
    auctionModeDropdown:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    --批量流拍物品
    local function batchFailedItem()
        local msgStr = ""
        if not PlayerIsML() then
            msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(msgStr)
            return
        end
        if ZL.syncAll then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        AuctionFrame.iconHeaderBtn.checkBtn:SetChecked(false)
        local bathFailedList = {}
        local failedItemGUIDList = {}
        AuctionFrame.iconHeaderBtn.checkBtn:SetChecked(false)
        if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
            for index, data in ipairs(ZL_CURRENT.auctionlist) do
                local f = AuctionFrame.entries[index]
                if data.state == "waiting" and (not data.lgnore) and (not data.isPackage) and data.bindType == 1
                and data.stackCount == 1 and f.infoFrame.checkBtn:GetChecked() then
                    table.insert(bathFailedList, {itemlink=data.itemlink, itemindex=data.itemindex})
                    if data["spawnUID"] then
                        for _, value in pairs(data["spawnUID"]) do
                            if value["itemGUID"] and next(value["itemGUID"], nil) then
                                for itemGUID in pairs(value["itemGUID"]) do
                                    table.insert(failedItemGUIDList, itemGUID)
                                end
                            end
                        end
                    end
                end
                f.infoFrame.checkBtn:SetChecked(false)
            end
        end
        if #bathFailedList > 0 then
            local data = {
                ["type"] = "bathFailed",
                ["data"] = bathFailedList,
                -- ["globalConfigData"] = ZL.globalConfigData(),
            }
            MyAddon:SYNCALL(data)
            ZL.syncAll =true
            AuctionFrame.piLiangBtn:Disable()
            --将流拍物品放到指定背包
            ZL.reportFailedItem(true)
        else
            msgStr = "没有需要批量流拍的物品！"
            ZL.Print(msgStr)
        end
    end
    --批量开始拍卖
    local function bathStart(type)
        --1:待拍卖，2：流拍，3：待拍卖和流拍， 4：勾选的
        type = type or 1
        if (not ZL_CURRENT.globalConfig.allowMultipleAuctions) then
            local link = format("|cff87CEEB|Hgarrmission:%s:%s|h[%s]|h|r", "AutoAuction", "设置多拍", "设置多拍")
            ZL.Print("当前为单拍模式，不允许同时拍卖多个物品！" .. link, true)
            return
        end
        local msgStr = ""
        if not PlayerIsML() then
            msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(msgStr)
            return
        end
        if ZL.syncAll then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        ZL.GetLootItemGUID()
        AuctionFrame.iconHeaderBtn.checkBtn:SetChecked(false)
        local bathStartList = {}
        if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
            for index, data in ipairs(ZL_CURRENT.auctionlist) do
                local f = AuctionFrame.entries[index]
                if ZL.IsCanAuction(data) and (not data.lgnore) and (not data.isPackage) and data.bindType == 1 and data.stackCount == 1
                and ((type == 1 and data.state == "waiting") or (type == 2 and data.state == "failed")
                or (type == 3 and (data.state == "waiting" or data.state == "failed"))
                or (type == 4 and (data.state == "waiting" or data.state == "failed")) and f.infoFrame.checkBtn:GetChecked()) then
                    table.insert(bathStartList, data)
                end
                f.infoFrame.checkBtn:SetChecked(false)
            end
        end
        if #bathStartList > 0 then
            local data = {
                ["type"] = "bathStart",
                ["data"] = bathStartList,
                ["globalConfigData"] = ZL.globalConfigData(),
            }
            MyAddon:SYNCALL(data)
            ZL.syncAll =true
            AuctionFrame.piLiangBtn:Disable()
        else
            ZL.Print("没有符合要求的拍卖物品！")
        end
    end
    --批量取消
    local function bathStop()
        local msgStr = ""
        if not PlayerIsML() then
            msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(msgStr)
            return
        end
        if ZL.syncAll then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        AuctionFrame.iconHeaderBtn.checkBtn:SetChecked(false)
        local bathStopList = {}
        if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
            for index, data in ipairs(ZL_CURRENT.auctionlist) do
                local f = AuctionFrame.entries[index]
                if data.state == "auctioning" then
                    table.insert(bathStopList, {itemlink=data.itemlink, itemindex=data.itemindex})
                end
                f.infoFrame.checkBtn:SetChecked(false)
            end
        end
        if #bathStopList > 0 then
            local data = {
                ["type"] = "bathStop",
                ["data"] = bathStopList,
                -- ["globalConfigData"] = ZL.globalConfigData(),
            }
            MyAddon:SYNCALL(data)
            ZL.syncAll =true
            AuctionFrame.piLiangBtn:Disable()
        else
            ZL.Print("没有正在拍卖的物品！")
        end
    end
    --批量暂停
    local function bathPause()
        local msgStr = ""
        if not PlayerIsML() then
            msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(msgStr)
            return
        end
        if ZL.syncAll then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        AuctionFrame.iconHeaderBtn.checkBtn:SetChecked(false)
        local bathPauseList = {}
        if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
            for index, data in ipairs(ZL_CURRENT.auctionlist) do
                local f = AuctionFrame.entries[index]
                if data.state == "auctioning" and (not data.isPaused) then
                    table.insert(bathPauseList, {itemlink=data.itemlink, itemindex=data.itemindex})
                end
                f.infoFrame.checkBtn:SetChecked(false)
            end
        end
        if #bathPauseList > 0 then
            local data = {
                ["type"] = "bathPause",
                ["data"] = bathPauseList,
                -- ["globalConfigData"] = ZL.globalConfigData(),
            }
            MyAddon:SYNCALL(data)
            ZL.syncAll =true
            AuctionFrame.piLiangBtn:Disable()
        else
            ZL.Print("没有需要暂停的拍卖物品！")
        end
    end
    --批量继续
    local function bathContinue()
        local msgStr = ""
        if not PlayerIsML() then
            msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(msgStr)
            return
        end
        if ZL.syncAll then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        AuctionFrame.iconHeaderBtn.checkBtn:SetChecked(false)
        local bathContinueList = {}
        if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
            for index, data in ipairs(ZL_CURRENT.auctionlist) do
                local f = AuctionFrame.entries[index]
                if data.state == "auctioning" and data.isPaused then
                    table.insert(bathContinueList, {itemlink=data.itemlink, itemindex=data.itemindex})
                end
                f.infoFrame.checkBtn:SetChecked(false)
            end
        end
        if #bathContinueList > 0 then
            local data = {
                ["type"] = "bathContinue",
                ["data"] = bathContinueList,
                -- ["globalConfigData"] = ZL.globalConfigData(),
            }
            MyAddon:SYNCALL(data)
            ZL.syncAll =true
            AuctionFrame.piLiangBtn:Disable()
        else
            ZL.Print("没有需要继续的拍卖物品！")
        end
    end
    AuctionFrame.piLiangBtn = CreateFrame("Button", nil, AuctionFrame, "UIPanelButtonTemplate")
    local piLiangBtn = AuctionFrame.piLiangBtn
    piLiangBtn:SetPoint("LEFT", auctionModeDropdown, "RIGHT", 5, 2)
    piLiangBtn:SetSize(50, 26)
    piLiangBtn:SetText("批量")
    do
        local fontString = piLiangBtn:GetFontString()
        fontString:SetFont(GameFontNormal:GetFont(), 14)
    end
    piLiangBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    piLiangBtn:SetScript("OnClick", function (self, button)
        local function tempMenuTable()
            local menuList = {
                {text = "ML功能", isTitle = true},
                {isSeparator = true},
                {
                    disabled = not PlayerIsML(),
                    text = "|T130866:15:15:2:0|t " .. "开始",
                    hasArrow = PlayerIsML(),
                    notClickable = 1,
                    menuTable = {
                        {
                            text = "待拍卖",
                            func = function()
                                bathStart(1)
                            end
                        },
                        {
                            text = "流拍",
                            func = function()
                                bathStart(2)
                            end
                        },
                        {
                            text = "以上两种",
                            func = function()
                                bathStart(3)
                            end
                        },
                        {
                            text = "以上两种勾选的",
                            func = function()
                                bathStart(4)
                            end
                        },
                    },
                },
                {
                    disabled = not PlayerIsML(),
                    text = "|T137048:15:15:2:0|t " .. "取消",
                    func = function ()
                        bathStop()
                    end
                },
                {
                    disabled = not PlayerIsML(),
                    text = "|T137047:15:15:2:0|t " .. "暂停",
                    func = function ()
                        bathPause()
                    end
                },
                {
                    disabled = not PlayerIsML(),
                    text = "|T130866:15:15:2:0|t " .. "继续",
                    func = function ()
                        bathContinue()
                    end
                },
                {
                    disabled = not PlayerIsML(),
                    text = "|T576625:15:15:2:0|t " .. "流拍",
                    func = function ()
                        batchFailedItem()
                    end
                },
            }
            tinsert(menuList, {isSeparator = true})
            tinsert(menuList, {text = "关闭"})
            return menuList
        end
        ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'BOTTOMLEFT', 0, 0)
    end)

    local titleBottomGapHeight = 30
    AuctionFrame.iconHeaderBtn = CreateHeaderButton(AuctionFrame, 151, 21)
    local iconHeaderBtn = AuctionFrame.iconHeaderBtn
    iconHeaderBtn:SetPoint("TOPLEFT", AuctionFrame.TitleBottom, "BOTTOMLEFT", 3, -titleBottomGapHeight)
    iconHeaderBtn:SetText("名称/状态")
    iconHeaderBtn.infoBtn = CreateFrame("Button", nil, iconHeaderBtn)
    iconHeaderBtn.infoBtn:SetSize(20, 20)
    iconHeaderBtn.infoBtn:SetPoint("LEFT", iconHeaderBtn, "LEFT")
    iconHeaderBtn.infoBtn:SetNormalTexture(616343)
    iconHeaderBtn.infoBtn:SetHighlightTexture(616343)
    iconHeaderBtn.infoBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("提示")
        GameTooltip:AddLine("物品图标快捷键")
        GameTooltip:AddLine("|cff00ff00双击：|r|cffff0000关注/取关|r该物品", 1, 1, 1)
        GameTooltip:AddLine("关注物品开始拍卖时会强制弹窗，并且有拍卖语音提醒", 1, 1, 1)
        GameTooltip:AddLine("|cff00ff00单击：|r", 1, 1, 1)
        GameTooltip:AddLine("1、有文本框激活时，直接发送物品链接", 1, 1, 1)
        GameTooltip:AddLine("2、交易窗口打开时，待拍卖或流拍物品直接摆放到交易窗口", 1, 1, 1)
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("进度条快捷键")
        GameTooltip:AddLine("Shift+左键：|cffffffff重置倒计时|r")
        GameTooltip:Show()
    end)
    iconHeaderBtn.infoBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    iconHeaderBtn.checkBtn = CreateFrame("CheckButton", nil, iconHeaderBtn, "ChatConfigCheckButtonTemplate")
    iconHeaderBtn.checkBtn:SetPoint("TOPRIGHT", iconHeaderBtn, "TOPRIGHT")
    iconHeaderBtn.checkBtn:SetSize(20, 20)
    iconHeaderBtn.checkBtn:SetHitRectInsets(0, -iconHeaderBtn.checkBtn.Text:GetWidth(), 0, 0)
    iconHeaderBtn.checkBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("全选")
        -- GameTooltip:AddLine("待拍卖物品", 1, 1, 1)
        GameTooltip:AddLine("不含忽略和装绑物品", 1, 1, 1)
        GameTooltip:Show()
    end)
    iconHeaderBtn.checkBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)
    iconHeaderBtn.checkBtn:SetScript("OnClick", function (self)
        if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
            local isChecked = self:GetChecked()
            for index, data in ipairs(ZL_CURRENT.auctionlist) do
                if (not data.lgnore) and (not data.isPackage) and data.bindType == 1 and data.stackCount == 1 then --data.state == "waiting" and 
                    local f = AuctionFrame.entries[index]
                    f.infoFrame.checkBtn:SetChecked(isChecked)
                end
            end
        end
    end)

    AuctionFrame.functionHeaderBtn = CreateHeaderButton(AuctionFrame, 147, 21)
    local functionHeaderBtn = AuctionFrame.functionHeaderBtn
    functionHeaderBtn:SetPoint("TOPRIGHT", AuctionFrame.TitleBottom, "BOTTOMRIGHT", -20, -titleBottomGapHeight)
    functionHeaderBtn:SetText("功能按钮")

    AuctionFrame.startbidHeaderBtn = CreateHeaderButton(AuctionFrame, 147, 21)
    local startbidHeaderBtn = AuctionFrame.startbidHeaderBtn
    startbidHeaderBtn:SetPoint("RIGHT", functionHeaderBtn, "LEFT", 1, 0)
    startbidHeaderBtn:SetText("起拍价/加价")

    AuctionFrame.bidHeaderBtn = CreateHeaderButton(AuctionFrame, 147, 21)
    local bidHeaderBtn = AuctionFrame.bidHeaderBtn
    bidHeaderBtn:SetPoint("RIGHT", startbidHeaderBtn, "LEFT", 1, 0)
    bidHeaderBtn:SetText("出价")

    AuctionFrame.bidderHeaderBtn = CreateHeaderButton(AuctionFrame, 147, 21)
    local bidderHeaderBtn = AuctionFrame.bidderHeaderBtn
    bidderHeaderBtn:SetPoint("TOPLEFT", iconHeaderBtn, "TOPRIGHT", -1, 0)
    bidderHeaderBtn:SetPoint("BOTTOMRIGHT", bidHeaderBtn, "BOTTOMLEFT", 1, 0)
    bidderHeaderBtn:SetText("竞拍信息")
    do
        local texture = AuctionFrame:CreateTexture(nil, "BACKGROUND")
        texture:SetColorTexture(1, 1, 1, 0.5)
        texture:SetPoint("TOPLEFT", iconHeaderBtn, "BOTTOMLEFT", 0, 0)
        texture:SetPoint("BOTTOMRIGHT", functionHeaderBtn, "BOTTOMRIGHT", 0, -1)
    end
    bidderHeaderBtn.infoBtn = CreateFrame("Button", nil, bidderHeaderBtn)
    bidderHeaderBtn.infoBtn:SetSize(20, 20)
    bidderHeaderBtn.infoBtn:SetPoint("LEFT", bidderHeaderBtn, "LEFT")
    bidderHeaderBtn.infoBtn:SetNormalTexture(616343)
    bidderHeaderBtn.infoBtn:SetHighlightTexture(616343)
    bidderHeaderBtn.infoBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("【|cffff0000竞拍信息|r】栏快捷键")
        GameTooltip:AddLine(" ")
        GameTooltip:AddDoubleLine("左键双击:", "出价/申请重拍", nil, nil, nil, 1, 1, 1)
        GameTooltip:AddDoubleLine("右键单击:", "功能菜单", nil, nil, nil, 1, 1, 1)
        if PlayerIsML() then
            GameTooltip:AddLine(" ")
            GameTooltip:AddLine("以下为组合键+单击")
            GameTooltip:AddDoubleLine("Shift+左键:", "开始/重拍", nil, nil, nil, 1, 1, 1)
            GameTooltip:AddDoubleLine("Shift+右键:", "发送竞拍信息", nil, nil, nil, 1, 1, 1)
            -- GameTooltip:AddDoubleLine("Shift+中键:", "打包", nil, nil, nil, 1, 1, 1)
            -- GameTooltip:AddDoubleLine("Ctrl+左键:", "停止5秒倒数", nil, nil, nil, 1, 1, 1)
            -- GameTooltip:AddDoubleLine("Ctrl+右键:", "5秒倒数", nil, nil, nil, 1, 1, 1)
            -- GameTooltip:AddDoubleLine("Ctrl+中键:", "暂停/继续", nil, nil, nil, 1, 1, 1)
            -- GameTooltip:AddDoubleLine("Alt+右键:", "撤销出价", nil, nil, nil, 1, 1, 1)
        end
        GameTooltip:Show()
    end)
    bidderHeaderBtn.infoBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    AuctionFrame.MLFrame = CreateFrame("Frame", nil, AuctionFrame)
    local MLFrame = AuctionFrame.MLFrame
    -- ZL.CreateBorder(MLFrame, 1, 1, 1, 0.5, "OVERLAY", 1)
    -- MLFrame.BorderBottom:Hide()
    MLFrame:SetPoint("BOTTOMLEFT", AuctionFrame, "TOPLEFT")
    MLFrame:SetPoint("BOTTOMRIGHT", AuctionFrame, "TOPRIGHT")
    MLFrame:SetClampedToScreen(true)
    MLFrame:SetHeight(22)  --31
    MLFrame:SetScript("OnMouseUp", function (self)
        AuctionFrame:StopMovingOrSizing()
    end)
    MLFrame:SetScript("OnMouseDown", function (self)
        AuctionFrame:StartMoving()
    end)
    function ZL.saveRaidMembers()
        if not PlayerIsML() then
            local msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(msgStr)
            return
        end
        local msgStr = ""
        if IsInRaid(1) then
            if not ZL_CURRENT["GroupMembersList"] then ZL_CURRENT["GroupMembersList"] = {} end
            table.insert(ZL_CURRENT["GroupMembersList"], 1, {
                saveTime = date("%Y-%m-%d %H:%M:%S", time()),
                list = ZL.GetCurrentRoster(true),
                ML = GetClassColorName(ZL.GetMLname()),
                RL = GetClassColorName(ZL.GetRLname()),
            })
            if ZL.opt.wagesGroupMembers == 0 then
                ZL.opt.wagesGroupMembers = 1
                ZL.TransmitAddonInfo_Pro()
                msgStr = "团队名单保存成功，并已选择|cffff0000最新历史1|r名单作为工资计算！"
            else
                msgStr = "团队名单保存成功，计算工资名单为：|cffff0000历史" .. ZL.opt.wagesGroupMembers .. "|r"
            end
            ZL.SpeakText("团队名单保存成功！")
        else
            msgStr = "不在团队中，无法保存团员名单！"
        end
        ZL.Print(msgStr, true)
    end
    local saveRaidMembers = ZL.saveRaidMembers
    local function statistics()
        if ZL_CURRENT.IncomeList and #ZL_CURRENT.IncomeList > 0 then
            local data = {
                ["type"] = "statistics",
                ["data"] = ZL_CURRENT,
            }
            MyAddon:SYNCALL(data)
            local RealmName, FactionGroup, UnitGuid = ZL_CURRENT.RealmName, ZL_CURRENT.FactionGroup, ZL_CURRENT.UnitGuid
            local auctiondate = ZL_CURRENT.auctiondate
            local listkey = RealmName .. "|" .. FactionGroup .. "|" .. UnitGuid .. "|" .. auctiondate
            ZL_Statistics[listkey] = nil --强制清空数据
            InportToStatistics(ZL_CURRENT)
        end
    end
    local function reportDetailIncome()
        ZL_CURRENT.incomeConfirm = true
        statistics()
        local numGroupMembers, RLBuTie, totalincome, totalpayout, totalamount, averageamount = GetAveWages()
        local playerBuyList = ZL.GetPlayerBuyList()
        local msgStr = ""
        local function gourp()
            if ZL.mailRegOpen then
                ZL.mailRegOpen = false
                ZL.AuctionRecordFrame.playerBalanceFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
                for i = 1, 2 do
                    SendChatMessage("已停止邮寄登记！", ZL.MsgChannel())
                end
            end
            if not ZL_CURRENT["aveWages"] then
                msgStr = "没有工资成员记录！"
                ZL.Print(msgStr)
                return
            end
            local msglist = {}
            if ZL_CURRENT.IncomeList and (#ZL_CURRENT.IncomeList > 0) then
                msgStr = "{rt6}<<<小队工资>>>{rt6}"
                table.insert(msglist, msgStr)
                local currentRoster, _, MLName, RLName = ZL.GetWagesGroupMembers()
                -- 创建一个表来存储每个小队的成员信息
                local teamInfo = {}
                local amount
                -- 遍历每个团队成员
                for subgroup = 1, 8 do
                    if #currentRoster[subgroup] > 0 then
                        -- 如果该小队还没有成员信息表，则创建一个新的表
                        if (not teamInfo[subgroup]) then
                            teamInfo[subgroup] = {}
                            teamInfo[subgroup]["list"] = {}
                            teamInfo[subgroup]["teamTotalAmount"] = 0
                            teamInfo[subgroup]["qiankuan"] = false
                            teamInfo[subgroup]["isMLGroup"] = false
                            teamInfo[subgroup]["isRLGroup"] = false
                            teamInfo[subgroup]["mail"] = false
                        end
                        for _, _name in ipairs(currentRoster[subgroup]) do
                            --消费老板不统计
                            local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[_name] and ZL_CURRENT.WagesBiLi[_name].biLi) and (ZL_CURRENT.WagesBiLi[_name].biLi/100) or 1
                            if biLi > 0 then
                                local name = ParseClassColorName(_name)
                                local balanceAmount = 0
                                local playerPayToMLamount = 0
                                if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[_name] then
                                    playerPayToMLamount = ZL_CURRENT.playerPayToML[_name]
                                end
                                local totalAmount = playerBuyList[_name] and playerBuyList[_name].totalAmount or 0
                                balanceAmount = playerPayToMLamount - totalAmount
                                if _name == MLName or balanceAmount > 0 then
                                    balanceAmount = 0
                                end
                                if _name == RLName then
                                    if ZL.opt.RLBuTieType == 3 then
                                        amount = averageamount * 2
                                        teamInfo[subgroup]["isRLGroup"] = true
                                    elseif RLBuTie and RLBuTie > 0 then
                                        amount = averageamount + RLBuTie
                                        teamInfo[subgroup]["isRLGroup"] = true
                                    else
                                        amount = averageamount
                                    end
                                else
                                    amount = averageamount
                                end
                                if balanceAmount < 0 then
                                    --有欠款，则从工资里面扣除
                                    amount = amount + balanceAmount
                                    teamInfo[subgroup]["teamTotalAmount"] = teamInfo[subgroup]["teamTotalAmount"] + amount
                                    teamInfo[subgroup]["qiankuan"] = true
                                else
                                    teamInfo[subgroup]["teamTotalAmount"] = teamInfo[subgroup]["teamTotalAmount"] + amount
                                end
                                if _name == RLName then
                                    if ZL.opt.RLBuTieType == 2 then
                                        amount = amount .. "(含补贴：" .. RLBuTie .. ")"
                                    elseif ZL.opt.RLBuTieType == 3 then
                                        amount = amount .. "(团双)"
                                    elseif ZL.opt.RLBuTieType == 4 then
                                        amount = amount .. "(含提成：" .. RLBuTie .. ")"
                                    end
                                end
                                if balanceAmount < 0 then amount = amount .. "(已扣除欠款：" .. -balanceAmount .. ")" end
                                if ZL_CURRENT.mailPlayers and ZL_CURRENT.mailPlayers[_name] ~= nil then
                                    amount = amount .. "(邮寄)"
                                    teamInfo[subgroup]["mail"] = true
                                end
                                if _name == MLName then
                                    teamInfo[subgroup]["isMLGroup"] = true
                                end
                                -- 将成员名字,工资加入对应小队的表中
                                table.insert(teamInfo[subgroup]["list"], {name=name, amount=amount})
                            end
                        end
                    end
                end
                for i = 1, 8 do
                    if teamInfo[i] and #teamInfo[i]["list"] > 0 then
                        if teamInfo[i]["qiankuan"] or teamInfo[i]["mail"] or teamInfo[i]["isRLGroup"] then
                            --小队有人欠款或需要邮寄工资则通知每个人的工资
                            if teamInfo[i]["isMLGroup"] then
                                msgStr = ("===>>第%d队[M L]：%d人，总工资：%d，"):format(i, #teamInfo[i]["list"], teamInfo[i]["teamTotalAmount"])
                            else
                                msgStr = ("===>>第%d队：%d人，总工资：%d，"):format(i, #teamInfo[i]["list"], teamInfo[i]["teamTotalAmount"])
                            end
                            table.insert(msglist, msgStr)
                            for _, data in ipairs(teamInfo[i]["list"]) do
                                if data.name == ParseClassColorName(RLName) then
                                    msgStr = data.name .. "(RL)：" .. data.amount
                                else
                                    msgStr = data.name .. "：" .. data.amount
                                end
                                table.insert(msglist, msgStr)
                            end
                        else
                            if teamInfo[i]["isMLGroup"] then
                                msgStr = ("===>>第%d队[M L]：%d人，总工资：%d，每人%d"):format(i, #teamInfo[i]["list"], teamInfo[i]["teamTotalAmount"], averageamount)
                            else
                                msgStr = ("===>>第%d队：%d人，总工资：%d，每人%d"):format(i, #teamInfo[i]["list"], teamInfo[i]["teamTotalAmount"], averageamount)
                            end
                            table.insert(msglist, msgStr)
                        end
                    end
                end
                msgStr = "{rt6}感谢使用[AutoAuction]金团拍卖助手{rt6}"
                table.insert(msglist, msgStr)
                ZL.AuctionRecordFrame.playerBalanceFrame:Update()
            else
                msgStr = "当前没有收支记录！"
                table.insert(msglist, msgStr)
            end
            local index = 1
            local function sendMessage()
                if index <= #msglist then
                    SendChatMessage(msglist[index], "RAID")
                    if index == #msglist then
                        if #msglist > 1 then
                            C_Timer.NewTicker(1, function ()
                                if ZL.billMsg then
                                    ZL.billMsg = nil
                                    C_Timer.After(0.3, function ()
                                        SendChatMessage("安装AutoAuction插件后可查看账单总览和对账单", "RAID")
                                    end)
                                end
                            end, 30)
                        end
                        wipe(msglist)
                    end
                    index = index + 1
                    C_Timer.After(0.3, sendMessage)
                end
            end
            sendMessage()
        end
        if (not ZL_CURRENT["GroupMembersList"]) or #ZL_CURRENT["GroupMembersList"] == 0 then
            msgStr = "工资计算名单为：|cffff0000当前团员，请注意工资将会随人员变动而变动！\n注意：你还未保存团名名单，请注意及时保存！|r"
        elseif ZL.opt.wagesGroupMembers == 0 then
            msgStr = "工资计算名单为：|cffff0000当前团员，请注意工资将会随人员变动而变动！|r"
        end
        ZL.ScrollingMessageFrame:AddMessage(msgStr)
        local function linshi()
            local delay = 0
            if ZL.mailRegOpen then
                ZL.mailRegOpen = false
                ZL.AuctionRecordFrame.playerBalanceFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
                for i = 1, 2 do
                    SendChatMessage("已停止邮寄登记！", ZL.MsgChannel())
                end
                delay = 0.3
            end
            if not ZL_CURRENT["aveWages"] then
                msgStr = "没有工资成员记录！"
                ZL.Print(msgStr)
                return
            end
            C_Timer.After(delay, function ()
                local msglist = {}
                delay = 0.3
                if ZL_CURRENT.IncomeList and (#ZL_CURRENT.IncomeList > 0) then
                    msgStr = "{rt6}<<<收支清单>>>{rt6}"
                    SendChatMessage(msgStr, "RAID")
                    C_Timer.After(delay, function ()
                        for _, data in ipairs(ZL_CURRENT.IncomeList) do
                            msgStr = data.notes .. "：" .. ParseClassColorName(data.player) .. "(" .. data.amount .. "g)"
                            SendChatMessage(msgStr, "RAID")
                        end
                        C_Timer.After(delay, function ()
                            if RLBuTie and RLBuTie > 0 then
                                if ZL.opt.RLBuTieType == 4 then
                                    msgStr = "RL提成：(" .. -RLBuTie .. "g)"
                                else
                                    msgStr = "RL补贴：(" .. -RLBuTie .. "g)"
                                end
                                SendChatMessage(msgStr, "RAID")
                            end
                            if ZL.opt.Tbutie and ZL.opt.Tbutie > 0 then
                                msgStr = "T补贴：(" .. -ZL.opt.Tbutie .. "g)"
                                SendChatMessage(msgStr, "RAID")
                            end
                            if ZL.opt.Nbutie and ZL.opt.Nbutie > 0 then
                                msgStr = "治疗补贴：(" .. -ZL.opt.Nbutie .. "g)"
                                SendChatMessage(msgStr, "RAID")
                            end
                            if ZL.opt.DPSbutie and ZL.opt.DPSbutie > 0 then
                                msgStr = "DPS补贴：(" .. -ZL.opt.DPSbutie .. "g)"
                                SendChatMessage(msgStr, "RAID")
                            end
                            if ZL.opt.FOODbutie and ZL.opt.FOODbutie > 0 then
                                msgStr = "食物补贴：(" .. -ZL.opt.FOODbutie .. "g)"
                                SendChatMessage(msgStr, "RAID")
                            end
                            if ZL.opt.xiuXingbutie and ZL.opt.xiuXingbutie > 0 then
                                msgStr = "修星补贴：(" .. -ZL.opt.xiuXingbutie .. "g)"
                                SendChatMessage(msgStr, "RAID")
                            end
                            if ZL.opt.ANMUbutie and ZL.opt.ANMUbutie > 0 then
                                msgStr = "工具人补贴：(" .. -ZL.opt.ANMUbutie .. "g)"
                                SendChatMessage(msgStr, "RAID")
                            end
                            C_Timer.After(delay, function ()
                                msglist = {}
                                msgStr = "{rt6}<<<收支总览>>>{rt6}"
                                table.insert(msglist, msgStr)
                                msgStr = "总收入：" .. totalincome
                                table.insert(msglist, msgStr)
                                msgStr = "总支出：" .. (totalpayout == 0 and 0 or -totalpayout)
                                table.insert(msglist, msgStr)
                                msgStr = "净收入：" .. totalamount
                                table.insert(msglist, msgStr)
                                msgStr = "{rt6}<<<工资总览>>>{rt6}"
                                table.insert(msglist, msgStr)
                                if ZL.opt.RLBuTieType == 3 then
                                    msgStr = "工资人数(团双)：" .. numGroupMembers .. "人"
                                else
                                    msgStr = "工资人数：" .. numGroupMembers .. "人"
                                end
                                table.insert(msglist, msgStr)
                                msgStr = "人均工资：" .. averageamount .. "(已抹零)"
                                table.insert(msglist, msgStr)
                                local index = 1
                                local function sendMessage()
                                    if index <= #msglist then
                                        SendChatMessage(msglist[index], "RAID")
                                        if index == #msglist then
                                            wipe(msglist)
                                            C_Timer.After(delay, gourp)
                                        end
                                        index = index + 1
                                        C_Timer.After(0.3, sendMessage)
                                    end
                                end
                                sendMessage()
                            end)
                        end)
                    end)
                else
                    msgStr = "当前没有收支记录！"
                    SendChatMessage(msgStr, "RAID")
                end
            end)
        end
        --当前团队名单时，把ML自己调到后面的小队去
        if ZL.opt.wagesGroupMembers == 0 and ZL.opt.MLChangeGroup and (not InCombatLockdown()) and (UnitIsGroupLeader("player") or UnitIsGroupAssistant("player")) then
            local _list = {GetClassColorName(UnitName("player"))}
            ZL.ChangePlayerGroup(_list)
            C_Timer.After(0.5, linshi)
        else
            linshi()
        end
    end
    local function reportGroupIncome()
        ZL_CURRENT.incomeConfirm = true
        statistics()
        local numGroupMembers, RLBuTie, totalincome, totalpayout, totalamount, averageamount = GetAveWages()
        local playerBuyList = ZL.GetPlayerBuyList()
        local msgStr = ""
        local function gourp()
            local delay = 0
            if ZL.mailRegOpen then
                ZL.mailRegOpen = false
                ZL.AuctionRecordFrame.playerBalanceFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
                for i = 1, 2 do
                    SendChatMessage("已停止邮寄登记！", ZL.MsgChannel())
                end
                delay = 0.3
            end
            if not ZL_CURRENT["aveWages"] then
                msgStr = "没有工资成员记录！"
                ZL.Print(msgStr)
                return
            end
            local msglist = {}
            if ZL_CURRENT.IncomeList and (#ZL_CURRENT.IncomeList > 0) then
                msgStr = "{rt6}<<<小队工资>>>{rt6}"
                table.insert(msglist, msgStr)
                local currentRoster, _, MLName, RLName = ZL.GetWagesGroupMembers()
                -- 创建一个表来存储每个小队的成员信息
                local teamInfo = {}
                local amount
                -- 遍历每个团队成员
                for subgroup = 1, 8 do
                    if #currentRoster[subgroup] > 0 then
                        -- 如果该小队还没有成员信息表，则创建一个新的表
                        if (not teamInfo[subgroup]) then
                            teamInfo[subgroup] = {}
                            teamInfo[subgroup]["list"] = {}
                            teamInfo[subgroup]["teamTotalAmount"] = 0
                            teamInfo[subgroup]["qiankuan"] = false
                            teamInfo[subgroup]["isMLGroup"] = false
                            teamInfo[subgroup]["isRLGroup"] = false
                            teamInfo[subgroup]["mail"] = false
                        end
                        for _, _name in ipairs(currentRoster[subgroup]) do
                            --消费老板不统计
                            local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[_name] and ZL_CURRENT.WagesBiLi[_name].biLi) and (ZL_CURRENT.WagesBiLi[_name].biLi/100) or 1
                            if biLi > 0 then
                                local name = ParseClassColorName(_name)
                                local balanceAmount = 0
                                local playerPayToMLamount = 0
                                if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[_name] then
                                    playerPayToMLamount = ZL_CURRENT.playerPayToML[_name]
                                end
                                local totalAmount = playerBuyList[_name] and playerBuyList[_name].totalAmount or 0
                                balanceAmount = playerPayToMLamount - totalAmount
                                if _name == MLName or balanceAmount > 0 then
                                    balanceAmount = 0
                                end
                                if _name == RLName then
                                    if ZL.opt.RLBuTieType == 3 then
                                        amount = averageamount * 2
                                        teamInfo[subgroup]["isRLGroup"] = true
                                    elseif RLBuTie and RLBuTie > 0 then
                                        amount = averageamount + RLBuTie
                                        teamInfo[subgroup]["isRLGroup"] = true
                                    else
                                        amount = averageamount
                                    end
                                else
                                    amount = averageamount
                                end
                                if balanceAmount < 0 then
                                    --有欠款，则从工资里面扣除
                                    amount = amount + balanceAmount
                                    teamInfo[subgroup]["teamTotalAmount"] = teamInfo[subgroup]["teamTotalAmount"] + amount
                                    teamInfo[subgroup]["qiankuan"] = true
                                else
                                    teamInfo[subgroup]["teamTotalAmount"] = teamInfo[subgroup]["teamTotalAmount"] + amount
                                end
                                if _name == RLName then
                                    if ZL.opt.RLBuTieType == 2 then
                                        amount = amount .. "(含补贴：" .. RLBuTie .. ")"
                                    elseif ZL.opt.RLBuTieType == 3 then
                                        amount = amount .. "(团双)"
                                    elseif ZL.opt.RLBuTieType == 4 then
                                        amount = amount .. "(含提成：" .. RLBuTie .. ")"
                                    end
                                end
                                if balanceAmount < 0 then amount = amount .. "(已扣除欠款：" .. -balanceAmount .. ")" end
                                if ZL_CURRENT.mailPlayers and ZL_CURRENT.mailPlayers[_name] ~= nil then
                                    amount = amount .. "(邮寄)"
                                    teamInfo[subgroup]["mail"] = true
                                end
                                if _name == MLName then
                                    teamInfo[subgroup]["isMLGroup"] = true
                                end
                                -- 将成员名字,工资加入对应小队的表中
                                table.insert(teamInfo[subgroup]["list"], {name=name, amount=amount})
                            end
                        end
                    end
                end
                for i = 1, 8 do
                    if teamInfo[i] and #teamInfo[i]["list"] > 0 then
                        if teamInfo[i]["qiankuan"] or teamInfo[i]["mail"] or teamInfo[i]["isRLGroup"] then
                            --小队有人欠款或需要邮寄工资则通知每个人的工资
                            if teamInfo[i]["isMLGroup"] then
                                msgStr = ("===>>第%d队[M L]：%d人，总工资：%d，"):format(i, #teamInfo[i]["list"], teamInfo[i]["teamTotalAmount"])
                            else
                                msgStr = ("===>>第%d队：%d人，总工资：%d，"):format(i, #teamInfo[i]["list"], teamInfo[i]["teamTotalAmount"])
                            end
                            table.insert(msglist, msgStr)
                            for _, data in ipairs(teamInfo[i]["list"]) do
                                if data.name == ParseClassColorName(RLName) then
                                    msgStr = data.name .. "(RL)：" .. data.amount
                                else
                                    msgStr = data.name .. "：" .. data.amount
                                end
                                table.insert(msglist, msgStr)
                            end
                        else
                            if teamInfo[i]["isMLGroup"] then
                                msgStr = ("===>>第%d队[M L]：%d人，总工资：%d，每人%d"):format(i, #teamInfo[i]["list"], teamInfo[i]["teamTotalAmount"], averageamount)
                            else
                                msgStr = ("===>>第%d队：%d人，总工资：%d，每人%d"):format(i, #teamInfo[i]["list"], teamInfo[i]["teamTotalAmount"], averageamount)
                            end
                            table.insert(msglist, msgStr)
                        end
                    end
                end
                msgStr = "{rt6}感谢使用[AutoAuction]金团拍卖助手{rt6}"
                table.insert(msglist, msgStr)
                ZL.AuctionRecordFrame.playerBalanceFrame:Update()
            else
                msgStr = "当前没有收支记录！"
                table.insert(msglist, msgStr)
            end
            local index = 1
            local function sendMessage()
                if index <= #msglist then
                    SendChatMessage(msglist[index], "RAID")
                    if index == #msglist then
                        if #msglist > 1 then
                            C_Timer.NewTicker(1, function ()
                                if ZL.billMsg then
                                    ZL.billMsg = nil
                                    C_Timer.After(0.3, function ()
                                        SendChatMessage("安装AutoAuction插件后可查看账单总览和对账单", "RAID")
                                    end)
                                end
                            end, 30)
                        end
                        wipe(msglist)
                    end
                    index = index + 1
                    C_Timer.After(0.3, sendMessage)
                end
            end
            sendMessage()
        end
        if (not ZL_CURRENT["GroupMembersList"]) or #ZL_CURRENT["GroupMembersList"] == 0 then
            msgStr = "工资计算名单为：|cffff0000当前团员，请注意工资将会随人员变动而变动！\n注意：你还未保存团名名单，请注意及时保存！|r"
        elseif ZL.opt.wagesGroupMembers == 0 then
            msgStr = "工资计算名单为：|cffff0000当前团员，请注意工资将会随人员变动而变动！|r"
        end
        ZL.ScrollingMessageFrame:AddMessage(msgStr)
        --当前团队名单时，把ML自己调到后面的小队去
        if ZL.opt.wagesGroupMembers == 0 and ZL.opt.MLChangeGroup and (not InCombatLockdown()) and (UnitIsGroupLeader("player") or UnitIsGroupAssistant("player")) then
            local _list = {GetClassColorName(UnitName("player"))}
            ZL.ChangePlayerGroup(_list)
            C_Timer.After(0.5, gourp)
        else
            gourp()
        end
    end
    function ZL.reportIncomeConfirm(isGroup)
        if not IsInRaid(1) then
            ZL.Print("不在团队中，无法通报！")
            return
        end
        local WagesGroupMembers, msg = ZL.GetWagesGroupMembers()
        if not WagesGroupMembers then
            ZL.Print("没有团队成员数据，无法计算工资！", nil, nil, 1, 0, 0)
            return
        end
        msg = ParseClassColorName(msg)
        local numGroupMembers = GetAveWages()
        local msgStr = "工资成员名单为：|cff00ff00" .. msg .. "|r\n工资人数为：|cff00ff00" .. numGroupMembers .. "|r人，请选择？\n\n"
        local wagesGroupMembersIndex = (ZL_CURRENT["globalConfig"] and ZL_CURRENT["globalConfig"]["wagesGroupMembers"]) and ZL_CURRENT["globalConfig"]["wagesGroupMembers"] or 0
        if wagesGroupMembersIndex == 0 then
            if not StaticPopupDialogs["ZL_reportDetailIncomeConfirm"] then
                StaticPopupDialogs["ZL_reportDetailIncomeConfirm"] = {
                    text = "%s",
                    button1 = "保存名单并通报",
                    button2 = "取消",
                    OnShow = function(self)
                        self.editBox:SetNumeric(false)
                        self.editBox:SetAutoFocus(false)
                        if self.editBox2 then self.editBox2:Hide() end
                        if self.editBox3 then self.editBox3:Hide() end
                        if self.editBox4 then self.editBox4:Hide() end
                        if self.editBox5 then self.editBox5:Hide() end
                        if self.editBox6 then self.editBox6:Hide() end
                        if self.editBox7 then self.editBox7:Hide() end
                        if self.dropDown then self.dropDown:Hide() end
                    end,
                    OnAccept = function(self, data)
                        saveRaidMembers()
                        if data then
                            reportGroupIncome()
                        else
                            reportDetailIncome()
                        end
                    end,
                    OnCancel = function(self, data)
                    end,
                    whileDead = true,
                    hideOnEscape = true,
                    preferredIndex = 3,  -- 避免与其他弹出窗口冲突
                }
            end
            StaticPopup_Show("ZL_reportDetailIncomeConfirm", msgStr, nil ,isGroup)
        else
            if not StaticPopupDialogs["ZL_reportDetailIncomeConfirm2"] then
                StaticPopupDialogs["ZL_reportDetailIncomeConfirm2"] = {
                    text = "%s",
                    button1 = "通报",
                    button2 = "取消",
                    OnShow = function(self)
                        self.editBox:SetNumeric(false)
                        self.editBox:SetAutoFocus(false)
                        if self.editBox2 then self.editBox2:Hide() end
                        if self.editBox3 then self.editBox3:Hide() end
                        if self.editBox4 then self.editBox4:Hide() end
                        if self.editBox5 then self.editBox5:Hide() end
                        if self.editBox6 then self.editBox6:Hide() end
                        if self.editBox7 then self.editBox7:Hide() end
                        if self.dropDown then self.dropDown:Hide() end
                    end,
                    OnAccept = function(self, data)
                        if data then
                            reportGroupIncome()
                        else
                            reportDetailIncome()
                        end
                    end,
                    OnCancel = function(self, data)
                    end,
                    whileDead = true,
                    hideOnEscape = true,
                    preferredIndex = 3,  -- 避免与其他弹出窗口冲突
                }
            end
            StaticPopup_Show("ZL_reportDetailIncomeConfirm2", msgStr, nil, isGroup)
        end
    end
    local reportIncomeConfirm = ZL.reportIncomeConfirm
    local function reportDebtPlayer()
        local numGroupMembers, RLBuTie, totalincome, totalpayout, totalamount, averageamount = GetAveWages()
        local playerBuyList = ZL.GetPlayerBuyList()
        local msgStr = ""
        if next(playerBuyList, nil) then
            local count = 0
            local msglist = {}
            msgStr = "欠款通报："
            table.insert(msglist, msgStr)
            for name, data in pairs(playerBuyList) do
                local balanceAmount = 0
                local playerPayToMLamount = 0
                if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
                    playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
                end
                balanceAmount = playerPayToMLamount - data.totalAmount
                if balanceAmount < 0 and (not PlayerIsML(name)) then
                    msgStr = ("%s：%dg"):format(ParseClassColorName(name), -balanceAmount)
                    table.insert(msglist, msgStr)
                    count = count + 1
                end
            end
            msgStr = "请以上欠款人员仔细核对，如有误，请及时提出！"
            table.insert(msglist, msgStr)
            local index = 1
            local function sendMessage()
                if index <= #msglist then
                    SendChatMessage(msglist[index], "RAID")
                    if index == #msglist then
                        wipe(msglist)
                    end
                    index = index + 1
                    C_Timer.After(0.3, sendMessage)
                end
            end
            if count > 0 then
                sendMessage()
            else
                msgStr = "没有欠款成员！"
                ZL.Print(msgStr)
            end
        else
            msgStr = "没有欠款成员！"
            ZL.Print(msgStr)
        end
    end
    function ZL.reportConsumerRanking()
        local numGroupMembers, RLBuTie, totalincome, totalpayout, totalamount, averageamount = GetAveWages()
        local playerBuyList = ZL.GetPlayerBuyList()
        local msgStr = ""
        if next(playerBuyList, nil) then
            local msglist = {}
            local tempList = {}
            for name, value in pairs(playerBuyList) do
                table.insert(tempList, {name=name, totalAmount=value.totalAmount})
            end
            if #tempList > 1 then
                table.sort(tempList, function (a, b)
                    return a.totalAmount > b.totalAmount
                end)
            end
            table.insert(msglist, "<<<消费排名>>>")
            for index, data in ipairs(tempList) do
                if data.totalAmount > 0 then
                    msgStr = index .. "、" .. ParseClassColorName(data.name) .. "：" .. data.totalAmount
                    table.insert(msglist, msgStr)
                end
            end
            local index = 1
            local function sendMessage()
                if index <= #msglist then
                    SendChatMessage(msglist[index], "RAID")
                    if index == #msglist then
                        wipe(msglist)
                    end
                    index = index + 1
                    C_Timer.After(0.3, sendMessage)
                end
            end
            sendMessage()
        else
            ZL.Print("没有消费记录")
        end
    end
    local reportConsumerRanking = ZL.reportConsumerRanking
    --流拍通报/将流拍物品放到指定背包
    function ZL.reportFailedItem(failedItemToBag)
        local msgStr = ""
        if not PlayerIsML() then
            msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(msgStr)
            return
        end
        local msglist = {}
        local failedCount = 0 --总的可以交易流拍物品数量
        local failedItemList = {}
        local failedItemGUIDList = {}
        if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
            for _, data in ipairs(ZL_CURRENT.auctionlist) do
                if data.state == "failed" and data.bindType == 1 and data.spawnUID then
                    for _, value in pairs(data.spawnUID) do
                        if value.itemGUID and next(value.itemGUID, nil) then
                            for key, _ in pairs(value.itemGUID) do
                                --判断是否在背包
                                local bag, slot = ZL.FindItemInBag(key)
                                if bag then
                                    table.insert(failedItemGUIDList, key)
                                    --判断是否还有交易剩余时间
                                    if (not ZL.ToolTip) then
                                        ZL.ToolTip = CreateFrame("GameTooltip", "TradeTimeRemainingTooltip", nil, "GameTooltipTemplate")
                                    end
                                    ZL.ToolTip:SetOwner(UIParent, "ANCHOR_NONE")
                                    ZL.ToolTip:ClearLines()
                                    ZL.ToolTip:SetBagItem(bag, slot)
                                    for i = 1, ZL.ToolTip:NumLines() do
                                        local text = _G["TradeTimeRemainingTooltipTextLeft"..i]:GetText()
                                        if text then
                                            local timeRemaining = text:match(BIND_TRADE_TIME_REMAINING:gsub("%%s", "(.+)"))
                                            if timeRemaining then
                                                local hour = tonumber(timeRemaining:match("(%d+)" .. "小时")) or 0
                                                local min = tonumber(timeRemaining:match("(%d+)" .. "分钟")) or 0
                                                if not failedItemList[data.itemlink] then failedItemList[data.itemlink] = {timeRemaining={}, count=0} end
                                                failedItemList[data.itemlink].count = (failedItemList[data.itemlink].count or 0) + 1
                                                tinsert(failedItemList[data.itemlink].timeRemaining, hour*60+min)
                                                if not failedItemList[data.itemlink].startbidamount then failedItemList[data.itemlink].startbidamount = data.startbidamount end
                                                break
                                            end
                                        end
                                    end
                                end
                            end
                        end
                    end
                end
            end
        else
            msgStr = "没有流拍物品！"
            ZL.Print(msgStr)
            return
        end
        if failedItemToBag then
            if #failedItemGUIDList > 0 then
                --将流拍物品放到指定背包
                local index = 1
                local function changeBag()
                    if index <= #failedItemGUIDList then
                        local itemGUID = failedItemGUIDList[index]
                        local function linshi()
                            if InCombatLockdown() or UnitIsDeadOrGhost("player") then
                                C_Timer.After(0.5, linshi)
                            else
                                C_Timer.After(0.5, function ()
                                    local num = C_Container.GetContainerNumFreeSlots(ZL.opt.liupaiBagId)
                                    if num > 1 then
                                        ZL.PutAuctionItemInBag(itemGUID, ZL.opt.liupaiBagId, ZL.opt.liupaiDirection)
                                    else
                                        ZL.PutAuctionItemInBag(itemGUID, ZL.opt.liupaiBagId2, ZL.opt.liupaiDirection)
                                    end
                                    index = index + 1
                                    C_Timer.After(0.5, changeBag)
                                end)
                            end
                        end
                        linshi()
                    end
                end
                changeBag()
            end
        else
            if next(failedItemList, nil) then
                for itemlink, data in pairs(failedItemList) do
                    failedCount = failedCount + data.count
                    if data.count > 1 then
                        msgStr = itemlink .. "x" .. data.count .. "(" .. data.startbidamount .. ")"
                    else
                        msgStr = itemlink .. "(" .. data.startbidamount .. ")"
                    end
                    if #data.timeRemaining > 1 then
                        --剩余最小的时间排到最前面，默认为升序
                        table.sort(data.timeRemaining)
                    end
                    msgStr = msgStr .. "(" .. math.floor(data.timeRemaining[1] / 60) .. "小时" .. data.timeRemaining[1] % 60 .."分钟)"
                    table.insert(msglist, msgStr)
                end
                msgStr = "可交易流拍物品详细清单如下："
                SendChatMessage(msgStr, "RAID")
                C_Timer.After(0.3, function ()
                    for _, msg in ipairs(msglist) do
                        SendChatMessage(msg, "RAID")
                    end
                    wipe(msglist)
                    wipe(failedItemList)
                    C_Timer.After(0.5, function ()
                        msgStr = "以上流拍物品总件数：" .. failedCount .. "件，有需要的，在团队频道发送物品链接+出价！"
                        SendChatMessage(msgStr, "RAID")
                        MyAddon:TransmitAddonInfo("AUTOAUC SOUND", {type="系统", soundName=msgStr})
                        msgStr = "如有流拍未通报的可能是：已分解或已无法交易或不在背包。"
                        SendChatMessage(msgStr, "RAID")
                    end)
                end)
            else
                msgStr = "包里没有可交易的流拍物品，可能已分解、过期或不在背包！"
                ZL.Print(msgStr)
            end
        end
    end
    local reportFailedItem = ZL.reportFailedItem
    --重置拍卖清单
    function ZL.resetAuction()
        --"您确定要重置当前拍卖记录么？确定将清空当前拍卖记录，并保存到历史记录中！"
        if (ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0) or (ZL_CURRENT.WagesBiLi and next(ZL_CURRENT.WagesBiLi))
        or (ZL_CURRENT.buyerItemList and #ZL_CURRENT.buyerItemList > 0) then
            local msgStr = "|cffffff00重置并保存|r：可到|cff4080FF历史拍卖|r中恢复\n\n为当前拍卖记录输入一个名字"
            StaticPopup_Show("ZL_RESETCURRENT", msgStr)
        else
            local msgStr = "没有拍卖物品记录，已直接清空！"
            ZL.Print(msgStr, true)
            ZL_CURRENT = {}
            ZL_PLAYERLIST = {}
            ZL.CreateAuctionInfo()
            auctionModeDropdown:SetValue(1)
            local chatType
            if IsInRaid(1) then
                chatType = "RAID"
            elseif IsInGroup(1) then
                chatType = "PARTY"
            elseif IsInGuild() then
                chatType = "GUILD"
            end
            if chatType then
                --获取团队版本号
                local data = {type="request", ver=ZL.addonVersion}
                MyAddon:TransmitAddonInfo2("AUTOAUC VER", data, chatType, nil, "BULK")
            end
            if not PlayerIsML() and ZL.GetMLname() then
                MyAddon:TransmitAddonInfo2("AUTOAUC REQ", "auctioning", "WHISPER", ZL.GetMLname())
            end
        end
        if PlayerIsML() then
            MyAddon:TransmitAddonInfo("AUTOAUC RESET", "重置")
        end
    end
    local resetAuction = ZL.resetAuction
    --发送拍卖WA字符串
    function ZL.sendWAString(isCheckVerOnly, chatType)
        chatType = chatType or "RAID"
        if not ZL.checkWAIsLoaded() then return end
        local WaString = [=[
!WA:2!u3xx3TXXvcEMDEJVSZz(fGf(OzAmgega8drP1YNdijKigdsWbeuAu0ObBtIMK9yq0CaAQpsSZHooYYYwkYowYjX2X2YF74iBh7zDKLKTEEFB(nSJai5t5VWw36RUQQRQ7MukXEvCKqx19ERBDRBDRB91T(Ro6F76)TT(BB9cz66TPFB3ooDRTyJQvMRC9L9A719F8Vg9NVSLBVnABF(goNZ))w3ZxBLv654)x9L2DwEnVUZ752XFPPkpxJY13iLaKnxXR762(n3OPV76o0V(R24Vz5n757ToaXIB0Y23PUZzC64))1EtuQ2(UlFc3w(Rnzj0NDTx231RtVXR3Z3UR)F3VSLxtc2RTe5Ftp0qlTIBh3ERn0KO)X)V7)8)()R)Z)MT(Rp8)N2ElB3oL9MDTB605mPosWp96M6N8mdrZVvlVoZzVUdcG0qrwAtCrMMMFLELA1QwNQE2TCAHGzQM4V7LYUtl(h5KHcrFPegYDf5eS4LAMu(R50jvxh)n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Pox23nLyyMibGTYyBa9IxQo0IJeqKdtC4WyV7h6AUOSYTKcASxL(rS0qHPByjYStJn7G0DMRyowyEYldViUyafd3BVD(yXciiX4NiWsgr45naHTtDULM5lZoXPZ(NU3XftgsRGSPIXb(jOAvofTBOtWsW((ymKee)KD8CG4sgN8M(j)2wqX54(3p5nyHRXdtnyhbtkeXdnliNGBhWeUS)UG1YN0TKmJWE)2oD40fj(t2fO2S3wC6yJOCPHB3Z)okN9Il9zxwzQBS0x9PP)W7tCj8cDkgl7KNfHnxn0VfHgxkw3cItiYyTOjoSO4CCS3HvbIem7a3NHmgoWFU0N6JsFPlN(YFr2RCUmxEk1(ak6i0IMGeb6PnG)elU2NOIOHqrbZ5QLgHJ37oLYzUuPIjm2GM)Nw9YngRHElmoTngTMAqj8vo5sN(tvUWBRwZmt(zkV3NO8v3dQm2dUitb18TWH0VBfKKuLGjORPjiblCDvT7YC77V0c3(4IKtahEEsY7q(9MTUXA262UUeSUXfxiHm2DXFsYyKdcDZbsrp3jgxC4aKy0t3FoONFwLl8Hl95FCMB(UzN(8zU9CzU5nqLvp0cWcnf585BMddnZHiPyjxGwZ0V3LGndgRj5IfvJJa14xLRgpq9qx1ZClPO(iJKcmOPCT7Q8hMaQ2VgRduZlYAyMRGzkL5VnyPxT5GzkdtPdts6VWzUUsWfEUr2(BSU1hFN9ipyCHxU8hnfECytjxiFYS4dgLpw4XfwD5l9X4HJQdidg4uphJ(Ww21kwXkAzAWJoMWudbN87nhxC16HMEtIo2f1dFu2KJcB3hwmGqYH1(WZkfCJoC1LJ(E2r(xh4)a
]=]
        WaString = gsub(WaString, "\n", "")
        local received = ZL.StringToTable(WaString, true)
        if type(received) ~= "table" or (not received.d) or type(received.d) ~= "table" then
            ZL.Print("内置WA字符串错误！请到帮助里联系作者修复！", true, nil, 1, 0, 0)
            received = nil
            WaString = nil
            return
        end
        local data = received.d
        local receivedVer
        if data["authorOptions"] and #data["authorOptions"] > 0 then
            local authorOption = data["authorOptions"][1]
            if authorOption["type"] == "description" and authorOption["text"] then
                receivedVer = (authorOption["text"]):match("^|cff00ff00版本号：WA%-V(%d+%.%d+%.%d+)|r$")
                if receivedVer then
                    ZL.WAVersion = "V" .. receivedVer
                    receivedVer = gsub(receivedVer, "%.", "")
                    receivedVer = tonumber(receivedVer)
                end
            end
        end
        if not receivedVer then
            ZL.Print("内置WA字符串错误！请联系作者修复！", true, nil, 1, 0, 0)
            ZL.WAVersion = nil
            received = nil
            WaString = nil
            data = nil
            return
        end
        local dataID = "[AutoAuction]金团拍卖助手"
        local myWaVer, myData
        if _G["WeakAurasSaved"].displays[dataID] then
            myData = CopyTable(_G["WeakAurasSaved"].displays[dataID])
        end
        if myData and myData["authorOptions"] and #myData["authorOptions"] > 0 then
            local authorOption = myData["authorOptions"][1]
            if authorOption["type"] == "description" and authorOption["text"] then
                myWaVer = (authorOption["text"]):match("^|cff00ff00版本号：WA%-V(%d+%.%d+%.%d+)|r$")
                myWaVer = gsub(myWaVer, "%.", "")
                myWaVer = tonumber(myWaVer)
            end
        end
        if (not myWaVer) or (myWaVer < receivedVer) then
            WeakAuras.Add(data)
        end
        if isCheckVerOnly then
            received = nil
            WaString = nil
            data = nil
            return
        end
        -- 获取团员版本号
        local whisperList = {}
        local whisperList2 = {} --插件更新提示
        if ZL_PLAYERLIST.GroupMembersVersion and next(ZL_PLAYERLIST.GroupMembersVersion) and IsInRaid(1) then
            for i = 1, MAX_RAID_MEMBERS do
                local name, _, _, _, _, _, _, online = GetRaidRosterInfo(i)
                if name and online and (not PlayerIsML(name)) then
                    local playerVer = ZL_PLAYERLIST.GroupMembersVersion[name]
                    if playerVer then
                        if strfind(playerVer, "WA%-V") then
                            playerVer = playerVer:gsub("WA%-V", ""):gsub("%.", "")
                            playerVer = tonumber(playerVer)
                            if playerVer < receivedVer then
                                tinsert(whisperList, name)
                            end
                        else
                            playerVer = playerVer:gsub("V", ""):gsub("%.", "")
                            playerVer = tonumber(playerVer)
                            local myaddonVer = ZL.addonVersion:gsub("V", ""):gsub("%.", "")
                            myaddonVer = tonumber(myaddonVer)
                            if playerVer < myaddonVer then
                                tinsert(whisperList2, name)
                            end
                        end
                    else
                        tinsert(whisperList, name)
                    end
                end
            end
        end
        if #whisperList == 0 and IsInRaid(1) and (chatType == "WHISPER" or chatType == "RAID") then
            ZL.Print("没有需要更新WA字符串的成员！")
        else
            ZL.sendStringFromWA(whisperList, dataID, true, chatType)
            ZL.Print("发送WA字符串过程中，|cffff0000不要加载UI和进出副本|r，容易造成传输中断", true)
        end
        received = nil
        WaString = nil
        data = nil
        myData = nil
        whisperList = nil
    end
    local sendWAString = ZL.sendWAString
    --保存团队名单
    function ZL.saveGroupMembers()
        if not PlayerIsML() then
            local msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(msgStr)
            return
        end
        local msgStr = ""
        if IsInRaid(1) then
            if not ZL_CURRENT["GroupMembersList"] then ZL_CURRENT["GroupMembersList"] = {} end
            table.insert(ZL_CURRENT["GroupMembersList"], 1, {
                saveTime = date("%Y-%m-%d %H:%M:%S", time()),
                list = ZL.GetCurrentRoster(true),
                ML = GetClassColorName(ZL.GetMLname()),
                RL = GetClassColorName(ZL.GetRLname()),
            })
            -- if #ZL_CURRENT["GroupMembersList"] > 5 then
            --     table.remove(ZL_CURRENT["GroupMembersList"], 6)
            -- end
            if ZL.opt.wagesGroupMembers == 0 then
                ZL.opt.wagesGroupMembers = 1
                ZL.TransmitAddonInfo_Pro()
                msgStr = "团队名单保存成功，并已选择|cffff0000最新历史1|r名单作为工资计算！"
            else
                msgStr = "团队名单保存成功，计算工资名单为：|cffff0000历史" .. ZL.opt.wagesGroupMembers .. "|r"
            end
            ZL.SpeakText("团队名单保存成功！")
        else
            msgStr = "不在团队中，无法保存团员名单！"
        end
        ZL.Print(msgStr)
    end
    local saveGroupMembers = ZL.saveGroupMembers
    --全部登记邮寄
    local function sendMailAll()
        if not PlayerIsML() then
            ZL.Print("ML权限！")
            return
        end
        local msgStr = ""
        if (not ZL_CURRENT["mailPlayers"]) then ZL_CURRENT["mailPlayers"] = {} end
        --为当前团队名单时，保存一次名单
        if ZL.opt.wagesGroupMembers == 0 then ZL.saveRaidMembers() end
        ZL.mailRegOpen = false
        ZL.AuctionRecordFrame.playerBalanceFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
        local currentRoSter = ZL.GetWagesGroupMembers()
        if currentRoSter then
            for _, data in ipairs(currentRoSter) do
                if #data > 0 then
                    for _, name in ipairs(data) do
                        local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
                        if (not PlayerIsML(name)) and (biLi > 0) and (ZL_CURRENT["mailPlayers"][name] == nil) and ((not ZL_CURRENT.tradeGongZi) or (not ZL_CURRENT.tradeGongZi[name])) then
                            ZL_CURRENT["mailPlayers"][name] = false
                        end
                    end
                end
            end
            msgStr = "已登记全部邮寄工资"
            SendChatMessage(msgStr, ZL.MsgChannel())
            MyAddon:TransmitAddonInfo("AUTOAUC SOUND", {type="系统", soundName=msgStr})
            ZL.Print(msgStr)
        else
            msgStr = "没有需要邮寄的成员！"
            ZL.Print(msgStr)
        end
    end
    --关闭邮寄登记
    function ZL.stopMailReg()
        if ZL.mailRegOpen then
            ZL.mailRegOpen = nil
            ZL.AuctionRecordFrame.playerBalanceFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
            for i = 1, 2 do
                SendChatMessage("已停止邮寄登记！", ZL.MsgChannel())
            end
        end
        if ZL_CURRENT.mailPlayers and next(ZL_CURRENT.mailPlayers, nil) and (not InCombatLockdown()) and (UnitIsGroupLeader("player") or UnitIsGroupAssistant("player")) then
            local mailPlayerList = {}
            for name, _ in pairs(ZL_CURRENT.mailPlayers) do
                table.insert(mailPlayerList, name)
            end
            ZL.ChangePlayerGroup(mailPlayerList)
        end
    end
    --同步数据
    function ZL.syncDada()
        local msgStr
        if not IsInRaid(1) then
            msgStr = "不在团队中，无法同步数据"
            ZL.Print(msgStr)
            return
        end
        if ZL.syncDadaCD and ZL.syncDadaCD > 0 then
            msgStr = "同步数据CD中，剩余|cffffffff" .. ZL.syncDadaCD .. "|r秒"
            ZL.Print(msgStr)
            return
        end
        if PlayerIsML() then
            if ZL.syncAll then
                ZL.Print("通信被占用，请稍后重试。")
                return
            end
            if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
                local data = {
                    ["type"] = "all",
                    ["data"] = ZL_CURRENT,
                }
                MyAddon:SYNCALL(data)
                ZL.syncAll = true
            else
                msgStr = "没有拍卖数据需要同步"
            end
            if msgStr then
                ZL.Print(msgStr)
            end
        else
            msgStr = "已发送同步拍卖数据请求，等待回应..."
            ZL.Print(msgStr, true)
            MyAddon:TransmitAddonInfo2("AUTOAUC REQ", "auctioning", "WHISPER", ZL.GetMLname())
        end
        ZL.syncDadaCD = 15
        C_Timer.NewTicker(1, function (self)
            if ZL.syncDadaCD <= 0 then
                self:Cancel()
            else
                ZL.syncDadaCD = ZL.syncDadaCD - 1
            end
        end)
    end
    local syncDada = ZL.syncDada
    local btnWidth, btnHeight, btnFontSize = 43, 22, 14

    MLFrame.reportBtn = CreateButton(nil, MLFrame, "通报", "TOPLEFT", MLFrame, "TOPLEFT", 0, 0, btnWidth, btnHeight, btnFontSize) --"BOTTOMLEFT", recordBtn, "TOPLEFT", 0, 0, 
    local reportBtn = MLFrame.reportBtn
    reportBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    reportBtn.BorderTop:Hide()
    reportBtn.BorderLeft:Hide()
    reportBtn.BorderBottom:Hide()
    reportBtn.BorderRight:Hide()
    reportBtn:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            if PlayerIsML () then
                reportIncomeConfirm()
            else
                ZL.Print("你不是M L，无法发送收支详情。")
            end
        elseif button == "RightButton" then
            local function tempMenuTable()
                local menuList = {}
                menuList = {
                    {text = "ML功能", isTitle = true},
                    {
                        disabled = not PlayerIsML(),
                        text = "|T130781:13:13:0:0|t 详细收支",
                        func = function ()
                            reportIncomeConfirm()
                        end
                    },
                    {
                        disabled = not PlayerIsML(),
                        text = "|T384751:13:13:0:0|t 小队工资",  --526421
                        func = function ()
                            reportIncomeConfirm(true)
                        end
                    },
                    {isSeparator = true},
                    {
                        disabled = not PlayerIsML(),
                        text = "|TInterface\\AddOns\\" .. addonName .. "\\Images\\rem.png:13:13:0:0|t 欠款名单",
                        func = function ()
                            reportDebtPlayer()
                        end
                    },
                    {
                        disabled = not PlayerIsML(),
                        text = "|TInterface\\AddOns\\" .. addonName .. "\\Images\\consumeRanking.png:13:13:0:0|t 消费排名",
                        func = function ()
                            reportConsumerRanking()
                        end
                    },
                    {isSeparator = true},
                    {
                        disabled = not PlayerIsML(),
                        text = "|TInterface\\AddOns\\" .. addonName .. "\\Images\\rules.png:13:13:0:0|t " .. ((ZL.opt.rulesString and #ZL.opt.rulesString > 0) and "拍卖规则" or "设置拍卖规则"),
                        func = function ()
                            if ZL.opt.rulesString and #ZL.opt.rulesString > 0 then
                                local announceStrings = emptytable("")
                                for line in string.gmatch(ZL.opt.rulesString, "[^\n]+") do
                                    for word in string.gmatch(line, "%S+") do
                                        if strlen(announceStrings[#announceStrings]) + 1 + strlen(word) > 255 then
                                            tinsert(announceStrings, word)
                                        else
                                            if strlen(announceStrings[#announceStrings]) > 0 then
                                                announceStrings[#announceStrings] = announceStrings[#announceStrings] .. " " .. word
                                            else
                                                announceStrings[#announceStrings] = word
                                            end
                                        end
                                    end
                                    tinsert(announceStrings, "")
                                end
                                local index = 1
                                local function sendMessage()
                                    if index <= #announceStrings then
                                        SendChatMessage(announceStrings[index], "RAID")
                                        if index == #announceStrings then
                                            wipe(announceStrings)
                                            announceStrings = nil
                                            return
                                        end
                                        index = index + 1
                                        C_Timer.After(0.3, sendMessage)
                                    end
                                end
                                sendMessage()
                            else
                                ZL.Print("没有拍卖规则，请先输入！")
                                ZL.OpenAceConfigDialog("金团拍卖助手", "notification")
                            end
                        end,
                        tooltipMore = function(tip, data, button)
                            tip:AddLine("拍卖规则")
                            if ZL.opt.rulesString and #ZL.opt.rulesString>0 then
                                local announceStrings = emptytable("")
                                for line in string.gmatch(ZL.opt.rulesString, "[^\n]+") do
                                    for word in string.gmatch(line, "%S+") do
                                        if strlen(announceStrings[#announceStrings]) + 1 + strlen(word) > 255 then
                                            tinsert(announceStrings, word)
                                        else
                                            if strlen(announceStrings[#announceStrings]) > 0 then
                                                announceStrings[#announceStrings] = announceStrings[#announceStrings] .. " " .. word
                                            else
                                                announceStrings[#announceStrings] = word
                                            end
                                        end
                                    end
                                    tinsert(announceStrings, "")
                                end
                                for _, word in ipairs(announceStrings) do
                                    tip:AddLine(word, 1, 1, 1)
                                end
                            else
                                tip:AddLine("没有拍卖规则，请先设置", 1, 1, 1, true)
                            end
                        end,
                        hasArrow = (ZL.opt.rulesString and #ZL.opt.rulesString > 0) and true or nil,
                        menuTable = {
                            {
                                text = "修改拍卖规则",
                                func = function ()
                                    ZL.OpenAceConfigDialog("金团拍卖助手", "notification")
                                    ZL.GUI:CloseMenu()
                                end
                            }
                        }
                    },
                }
                tinsert(menuList, {isSeparator = true})
                tinsert(menuList, {text = "关闭"})
                return menuList
            end
            ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'BOTTOMLEFT', 0, 0)
        end
    end)
    reportBtn:SetScript("OnEnter", function (self)
        local numGroupMembers, _, totalincome, totalpayout = ZL.GetAveWages()
        if numGroupMembers then
            local left, _, width = AuctionFrame:GetRect()
            local right = GetScreenWidth() - (left + width)
            if left >= right then
                GameTooltipShow(AuctionFrame, "TOPRIGHT", "TOPLEFT", 0, btnHeight)
            else
                GameTooltipShow(AuctionFrame, "TOPLEFT", "TOPRIGHT", 0, btnHeight)
            end
            local playerBuyList = ZL.GetPlayerBuyList()
            local msg = select(2, ZL.GetWagesGroupMembers())
            if msg then
                GameTooltip:AddLine(msg)
            end
            local butie = {}
            butie = ZL_CURRENT.butie
            local count = (ZL_CURRENT["IncomeList"] and #ZL_CURRENT["IncomeList"] or 0)
            if (#butie + count) > 0 then
                GameTooltip:AddLine("当前收支记录：", 1, 1, 1)
                GameTooltip:AddDoubleLine("名称", "玩家(总金额/数量)")
                if count > 0 then
                    for _, data in ipairs(ZL_CURRENT.IncomeList) do
                        local itemId = string.match(data.notes, "|c........|Hitem:(%d+):")
                        if itemId then
                            local itemLevel = select(4, cGetItemInfo(itemId)) or "未知"
                            GameTooltip:AddDoubleLine(
                                "|T" .. cGetItemIcon(data.notes) .. ":12|t " .. data.notes .. "(" .. itemLevel .. ")",
                                data.player .. "(" .. data.amount .. "/" .. (data.itemCount or 1) .. ")", 1, 1, 1, 1, 1, 1
                            )
                        else
                            GameTooltip:AddDoubleLine(
                                "|T:12|t " .. data.notes,
                                data.player .. "(" .. data.amount .. ")", 1, 1, 1, 1, 1, 1
                            )
                        end
                    end
                end
                if #butie > 0 then
                    for _, data in ipairs(butie) do
                        local itemId = string.match(data.notes, "|c........|Hitem:(%d+):")
                        if itemId then
                            GameTooltip:AddDoubleLine(
                                "|T" .. cGetItemIcon(data.notes) .. ":12|t " .. data.notes,
                                data.player .. "(" .. data.amount .. ")", 1, 1, 1, 1, 1, 1)
                        else
                            GameTooltip:AddDoubleLine(
                                "|T:12|t |cff9173ff" .. data.notes .. "|r",
                                data.player .. "(" .. data.amount .. ")", 1, 1, 1, 1, 1, 1)
                        end
                    end
                end
                GameTooltip:AddLine(" ")
                GameTooltip:AddDoubleLine("总收入：|cffffffff" .. totalincome .. "|rg", "总支出：|cffffffff" .. (totalpayout == 0 and 0 or -totalpayout) .. "|rg")
                if ZL.opt.RLBuTieType == 3 then
                    GameTooltip:AddDoubleLine(
                        "净收入：|cffffffff" .. (totalincome + totalpayout) .. "|rg",
                        "人数(|cffffffff团双|r)：|cffffffff" .. numGroupMembers .. "|r人"
                    )
                else
                    GameTooltip:AddDoubleLine(
                        "净收入：|cffffffff" .. (totalincome + totalpayout) .. "|rg",
                        "人数：|cffffffff" .. numGroupMembers .. "|r人"
                    )
                end
                GameTooltip:AddLine(ZL_CURRENT["aveWages"] and "人均工资：|cffffffff" .. ZL_CURRENT["aveWages"] .. "|rg" or " ")
                GameTooltip:AddLine(" ")
                GameTooltip:AddDoubleLine("左键：|cffffffff详细收支|r", "右键：|cffffffff更多功能|r")
            else
                GameTooltip:AddLine("当前没有收入记录！")
                GameTooltip:AddLine(" ")
                GameTooltip:AddLine("左键：|cffffffff详细收支|r")
                GameTooltip:AddLine("右键：|cffffffff更多功能|r")
            end
            
            GameTooltip:Show()
            if not ZL.opt.xiaoFeiToolTipHide then
                if (not ZL.xiaoFeiToolTip) then
                    ZL.xiaoFeiToolTip = CreateFrame("GameTooltip", "xiaoFeiToolTip", UIParent, "GameTooltipTemplate") --GameTooltipTemplate,SharedTooltipTemplate
                    ZL.xiaoFeiToolTip:SetClampedToScreen(false)
                end
                _G["xiaoFeiToolTip"]:ClearAllPoints()
                _G["xiaoFeiToolTip"]:ClearLines()
                _G["xiaoFeiToolTip"]:SetOwner(self, "ANCHOR_NONE")
                if left >= right then
                    _G["xiaoFeiToolTip"]:SetPoint("TOPRIGHT", GameTooltip, "TOPLEFT", 0, 0)
                else
                    _G["xiaoFeiToolTip"]:SetPoint("TOPLEFT", GameTooltip, "TOPRIGHT", 0, 0)
                end
                _G["xiaoFeiToolTip"]:AddLine("消费排名(前10)：")
                if next(playerBuyList, nil) then
                    _G["xiaoFeiToolTip"]:AddDoubleLine("名字", "消费金额")
                    local tempList = {}
                    for name, value in pairs(playerBuyList) do
                        table.insert(tempList, {name=name, totalAmount=value.totalAmount})
                    end
                    if #tempList > 1 then
                        table.sort(tempList, function (a, b)
                            return a.totalAmount > b.totalAmount
                        end)
                    end
                    for index, data in ipairs(tempList) do
                        if data.totalAmount > 0  then
                            if index <= 3 then
                                _G["xiaoFeiToolTip"]:AddDoubleLine(data.name, data.totalAmount, 1, 0, 0, 1, 0, 0)
                            elseif index <= 10 then
                                _G["xiaoFeiToolTip"]:AddDoubleLine(data.name, data.totalAmount, 1, 1, 1, 1, 1, 1)
                            end
                        end
                    end
                else
                    _G["xiaoFeiToolTip"]:AddLine("暂时无人消费", 1, 1, 1)
                end
                _G["xiaoFeiToolTip"]:Show()
                
            end
            if not ZL.opt.debtToolTipHide then
                if (not ZL.debtToolTip) then
                    ZL.debtToolTip = CreateFrame("GameTooltip", "debtToolTip", UIParent, "GameTooltipTemplate") --GameTooltipTemplate,SharedTooltipTemplate
                    ZL.debtToolTip:SetClampedToScreen(false)
                end
                _G["debtToolTip"]:ClearAllPoints()
                _G["debtToolTip"]:ClearLines()
                _G["debtToolTip"]:SetOwner(self, "ANCHOR_NONE")
                if ZL.opt.xiaoFeiToolTipHide then
                    _G["debtToolTip"]:SetPoint("TOPRIGHT", GameTooltip, "TOPLEFT", 0, 0)
                else
                    _G["debtToolTip"]:SetPoint("TOPRIGHT", _G["xiaoFeiToolTip"], "BOTTOMRIGHT", 0, 0)
                end
                _G["debtToolTip"]:AddLine("欠款名单：")
                if next(playerBuyList, nil) then
                    _G["debtToolTip"]:AddDoubleLine("玩家名字", "欠款")
                    local isDebt = false
                    for name, data in pairs(playerBuyList) do
                        local balanceAmount = 0
                        local playerPayToMLamount = 0
                        if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
                            playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
                        end
                        balanceAmount = playerPayToMLamount - data.totalAmount
                        if PlayerIsML(name) then
                            balanceAmount = 0
                        end
                        if balanceAmount < 0 then
                            isDebt = true
                            local isExist = false
                            for i = 1, MAX_RAID_MEMBERS do
                                local _name, _, subgroup = GetRaidRosterInfo(i)
                                if _name and GetClassColorName(_name) == name then
                                    name = name .. "(" .. subgroup .. "队)"
                                    isExist = true
                                    break
                                end
                            end
                            if (not isExist) then
                                name = name .. "(已离队)"
                            end
                            _G["debtToolTip"]:AddDoubleLine(name, balanceAmount, 1, 1, 1, 1, 1, 1)
                        end
                    end
                    if not isDebt then
                        _G["debtToolTip"]:AddLine("没有欠款记录！", 1, 1, 1)
                    end
                else
                    _G["debtToolTip"]:AddLine("没有欠款记录！", 1, 1, 1)
                end
                _G["debtToolTip"]:Show()
            end
            if ZL.xiaoFeiToolTip and ZL.debtToolTip then
                local maxWidth = max(_G["xiaoFeiToolTip"]:GetWidth(), _G["debtToolTip"]:GetWidth())
                _G["xiaoFeiToolTip"]:SetWidth(maxWidth)
                _G["debtToolTip"]:SetWidth(maxWidth)
            end
        else
            if not ZL.opt.hideBtnTooltip then
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("提示")
                GameTooltip:AddLine("左键：|cffffffff详细收支|r")
                GameTooltip:AddLine("右键：|cffffffff更多功能|r")
                GameTooltip:Show()
            end
        end
    end)
    reportBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
        if ZL.debtToolTip then ZL.debtToolTip:Hide() end
        if ZL.xiaoFeiToolTip then ZL.xiaoFeiToolTip:Hide() end
    end)
    MLFrame.windowsBtn = CreateButton(nil, MLFrame, "窗口", "LEFT", reportBtn, "RIGHT", 0, 0, btnWidth, btnHeight, btnFontSize)
    local windowsBtn = MLFrame.windowsBtn
    windowsBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    windowsBtn.BorderTop:Hide()
    windowsBtn.BorderLeft:Hide()
    windowsBtn.BorderBottom:Hide()
    windowsBtn.BorderRight:Hide()
    windowsBtn:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            ZL.AuctionRecordFrame:Show()
            _G["ZLAuctionRecordFrameTab3"]:Click()
        elseif button == "RightButton" then
            local function tempMenuTable()
                local menuList = {}
                menuList = {
                    {
                        text = "|A:auctionhouse-icon-coin-gold:13:13|a 工资分配",
                        func = function ()
                            ZL.AuctionRecordFrame:Show()
                            _G["ZLAuctionRecordFrameTab3"]:Click()
                        end
                    },
                    {
                        text = "|TInterface\\AddOns\\AutoAuction\\Images\\shouzhi.png:13:13:0:0|t 当前收支",
                        func = function ()
                            ZL.AuctionRecordFrame:Show()
                            _G["ZLAuctionRecordFrameTab2"]:Click()
                        end
                    },
                    {
                        text = "|TInterface\\AddOns\\AutoAuction\\Images\\histroy.png:13:13:0:0|t 历史拍卖",
                        func = function ()
                            ZL.AuctionRecordFrame:Show()
                            _G["ZLAuctionRecordFrameTab1"]:Click()
                        end
                    },
                    {isSeparator = true},
                    {
                        text = "|T528409:13:13:0:0|t 账单总览",
                        func = function ()
                            ZL.ReconciliationFrame:Hide()
                            ZL.OverviewFrame:Update(ZL_CURRENT)
                            ZL.OverviewFrame:Show()
                        end
                    },
                    {
                        text = "|T132065:13:13:0:0|t 拾取记录",
                        func = function ()
                            ZL.ReconciliationFrame:Hide()
                            ZL.OverviewFrame:Update(ZL_PLAYERLIST.lootList)
                            ZL.OverviewFrame:Show()
                        end
                    },
                    {
                        text = "|TInterface\\AddOns\\AutoAuction\\Images\\bill.png:13:13:0:0|t 对账单",
                        func = function ()
                            ZL.OverviewFrame:Hide()
                            ZL.ReconciliationFrame:Show()
                        end
                    },
                    {isSeparator = true},
                    {
                        text = "|A:auctionhouse-icon-favorite:13:13:0:0|a 关注物品",
                        func = function ()
                            ZL.ConcernFrame:Show()
                        end
                    },
                }
                if PlayerIsML() then
                    tinsert(menuList, {
                        text = "|TInterface\\AddOns\\AutoAuction\\Images\\remain.png:13:13:0:0|t 剩余时间",
                        func = function ()
                            if not ZL.opt.remainingTradeTimeBtnValue then
                                ZL.opt.remainingTradeTimeBtnValue = true
                                ZL.ZLRemainingTradeTimeFrame:Show()
                                ZL.GetRemainingTradeTime()
                            else
                                ZL.opt.remainingTradeTimeBtnValue = false
                                ZL.ZLRemainingTradeTimeFrame:Hide()
                                if ZL.UpdateRemainingTradeTime then
                                    ZL.UpdateRemainingTradeTime:Cancel()
                                end
                            end
                        end
                    })
                end
                tinsert(menuList, {isSeparator = true})
                tinsert(menuList, {
                    text = "包装备设置",
                    func = function()
                        if not ZL.BuyItemsFrame then ZL:CreateBuyItemsFrame() end
                        ZL.BuyItemsFrame:Show()
                    end,
                })
                tinsert(menuList, {
                    text = "物品拍卖设置",
                    func = function()
                        ZL.ItemSettingFrame:Show()
                    end,
                })
                -- tinsert(menuList, {
                --     text = "补贴设置",
                --     -- disabled = 1,
                --     func = function()
                --         ZL.SubsidyFrame:Show()
                --     end,
                -- })
                tinsert(menuList, {isSeparator = true})
                tinsert(menuList, {
                    text = "|TInterface\\AddOns\\AutoAuction\\Images\\overview.png:13:13:0:0|t 信息总览",
                    func = function()
                        ZL.RolesOverViewFrame.locked = true
                        ZL.opt.ZLRolesOverViewFrameIsShown = true
                        ZL.GetOwnRolesData()
                        ZL.RolesOverViewFrame:Show()
                    end,
                })
                tinsert(menuList, {isSeparator = true})
                if ZL.opt.hideBtnTooltip then
                    tinsert(menuList, {
                        text = "打开按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = nil
                        end,
                    })
                else
                    tinsert(menuList, {
                        text = "关闭按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = true
                            GameTooltip:Hide()
                        end,
                    })
                end
                tinsert(menuList, {isSeparator = true})
                tinsert(menuList, {text = "关闭"})
                return menuList
            end
            ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'BOTTOMLEFT', 0, 0)
        end
    end)
    windowsBtn:SetScript("OnEnter", function (self)
        if PlayerIsML() then
            local left, _, width = AuctionFrame:GetRect()
            local right = GetScreenWidth() - (left + width)
            if left >= right then
                GameTooltipShow(AuctionFrame, "TOPRIGHT", "TOPLEFT", 0, btnHeight)
            else
                GameTooltipShow(AuctionFrame, "TOPLEFT", "TOPRIGHT", 0, btnHeight)
            end
            local RemainingTradeItems = ZL.GetRemainingTradeTime(true)
            if #RemainingTradeItems > 0 then
                GameTooltip:AddLine("装备交易剩余时间(ML功能)：", 1, 1, 1)
                GameTooltip:AddDoubleLine("名称", "剩余时间")
                for _, data in ipairs(RemainingTradeItems) do
                    if (data.hour*60 + data.min) <= 30 then
                        GameTooltip:AddDoubleLine(data.itemLink, "|cffff0000" .. data.timeRemaining .. "|r", 1, 1, 1, 1, 1, 1)
                    else
                        GameTooltip:AddDoubleLine(data.itemLink, data.timeRemaining, 1, 1, 1, 1, 1, 1)
                    end
                end
            else
                GameTooltip:AddLine("没有交易剩余时间的装备！")
            end
            GameTooltip:AddLine(" ")
            GameTooltip:AddDoubleLine("左键：|cffffffff工资分配|r", "右键：|cffffffff更多功能|r")
            GameTooltip:Show()
        else
            if not ZL.opt.hideBtnTooltip then
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("提示")
                GameTooltip:AddLine("左键：|cffffffff工资分配|r")
                GameTooltip:AddLine("右键：|cffffffff更多功能|r")
                GameTooltip:Show()
            end
        end
    end)
    windowsBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)
    MLFrame.failedBtn2 = CreateButton(nil, MLFrame, "流拍", "LEFT", windowsBtn, "RIGHT", 0, 0, btnWidth, btnHeight, btnFontSize)
    local failedBtn2 = MLFrame.failedBtn2
    failedBtn2:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    failedBtn2.BorderTop:Hide()
    failedBtn2.BorderLeft:Hide()
    failedBtn2.BorderBottom:Hide()
    failedBtn2.BorderRight:Hide()
    failedBtn2:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            reportFailedItem()
        elseif button == "RightButton" then
            local function tempMenuTable()
                local menuList = {}
                menuList = {
                    {
                        disabled = not PlayerIsML(),
                        text = "|T130979:15:15:2:0|t " .. "流拍物品通报",
                        func = function ()
                            reportFailedItem()
                        end
                    },
                    {
                        disabled = not PlayerIsML(),
                        text = "|T576625:15:15:2:0|t " .. "批量流拍物品",
                        func = function ()
                            batchFailedItem()
                        end
                    },
                    {isSeparator=true},
                    {
                        disabled = (not PlayerIsML()) or InCombatLockdown(),
                        text = "|T132853:13:13:5:0|t " .. (InCombatLockdown() and "分解流拍物品(战斗中)" or "分解流拍物品"),
                        func = function ()
                            if not InCombatLockdown() then
                                if not ZL.DisenchantingFrame then ZL:CreateDisenchantingFrame() end
                                if not ZL.DisenchantingLgnoreFrame then ZL:CreateDisenchantingLgnoreFrame() end
                                ZL.DisenchantingFrame:Show()
                            else
                                ZL.Print("战斗中，无法使用分解功能！")
                            end
                        end
                    },
                    {
                        disabled = not PlayerIsML(),
                        text = "|T133633:13:13:5:0|t " .. "放到指定背包",
                        func = function ()
                            reportFailedItem(true)
                        end
                    },
                }
                tinsert(menuList, {isSeparator = true})
                if ZL.opt.hideBtnTooltip then
                    tinsert(menuList, {
                        text = "打开按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = nil
                        end,
                    })
                else
                    tinsert(menuList, {
                        text = "关闭按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = true
                            GameTooltip:Hide()
                        end,
                    })
                end
                tinsert(menuList, {isSeparator = true})
                tinsert(menuList, {text = "关闭"})
                return menuList
            end
            ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'BOTTOMLEFT', 0, 0)
        end
    end)
    failedBtn2:SetScript("OnEnter", function (self)
        if not ZL.opt.hideBtnTooltip then
            GameTooltipShow(self, "BOTTOM", "TOP")
            GameTooltip:AddLine("提示")
            GameTooltip:AddLine("左键：|cffffffff流拍通报|r")
            GameTooltip:AddLine("右键：|cffffffff更多功能|r")
            GameTooltip:Show()
        end
    end)
    failedBtn2:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)
    MLFrame.resetBtn = CreateButton(nil, MLFrame, "重置", "LEFT", failedBtn2, "RIGHT", 0, 0, btnWidth, btnHeight, btnFontSize)
    local resetBtn = MLFrame.resetBtn
    resetBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    resetBtn.BorderTop:Hide()
    resetBtn.BorderLeft:Hide()
    resetBtn.BorderBottom:Hide()
    resetBtn.BorderRight:Hide()
    resetBtn:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            resetAuction()
        elseif button == "RightButton" then
            local function tempMenuTable()
                local menuList = {}
                menuList = {
                    {
                        text = "|TInterface\\AddOns\\" .. addonName .. "\\Images\\reset.png:15:15:2:0|t " .. "重置拍卖清单",
                        func = function ()
                            resetAuction()
                        end
                    },
                    {
                        disabled = not PlayerIsML(),
                        text = "|TInterface\\AddOns\\" .. addonName .. "\\Images\\new.png:15:15:2:0|t " .. "创建拍卖物品",
                        tooltipMore = function(tip)
                            tip:AddLine("手动创建方法")
                            tip:AddLine("1、Ctr+右键：|cffffffff背包物品|r")
                            tip:AddLine("2、右键：|cffffffff物品链接|r")
                            tip:AddLine("3、直接点击按钮创建")
                        end,
                        func = function ()
                            if not PlayerIsML() then
                                local msgStr = "你不是ML，无法使用这个功能！"
                                ZL.Print(msgStr)
                                return
                            end
                            StaticPopup_Show("ZL_ADDAUCTIONITEM")
                        end
                    },
                    {isSeparator = true},
                    {
                        disabled = not PlayerIsML(),
                        text = "|TInterface\\AddOns\\" .. addonName .. "\\Images\\add.png:15:15:2:0|t " .. "手动登记收入",
                        func = function ()
                            if not PlayerIsML() then
                                local msgStr = "你不是ML，无法使用这个功能！"
                                ZL.ScrollingMessageFrame:AddMessage(msgStr)
                                return
                            end
                            local data = {
                                ["type"] = "收入"
                            }
                            StaticPopup_Show("ZL_ADDINCOME", "收入", nil, data)
                        end
                    },
                    {
                        disabled = not PlayerIsML(),
                        text = "|TInterface\\AddOns\\" .. addonName .. "\\Images\\rem.png:15:15:2:0|t " .. "手动登记支出",
                        func = function ()
                            if not PlayerIsML() then
                                local msgStr = "你不是ML，无法使用这个功能！"
                                ZL.ScrollingMessageFrame:AddMessage(msgStr)
                                return
                            end
                            local data = {
                                ["type"] = "支出"
                            }
                            StaticPopup_Show("ZL_ADDINCOME", "支出", nil, data)
                        end
                    },
                }
                tinsert(menuList, {isSeparator = true})
                if ZL.opt.hideBtnTooltip then
                    tinsert(menuList, {
                        text = "打开按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = nil
                        end,
                    })
                else
                    tinsert(menuList, {
                        text = "关闭按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = true
                            GameTooltip:Hide()
                        end,
                    })
                end
                tinsert(menuList, {isSeparator = true})
                tinsert(menuList, {text = "关闭"})
                return menuList
            end
            ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'BOTTOMLEFT', 0, 0)
        end
    end)
    resetBtn:SetScript("OnEnter", function (self)
        if not ZL.opt.hideBtnTooltip then
            GameTooltipShow(self, "BOTTOM", "TOP")
            GameTooltip:AddLine("提示")
            GameTooltip:AddLine("左键：|cffffffff重置拍卖清单|r")
            GameTooltip:AddLine("右键：|cffffffff更多功能|r")
            GameTooltip:Show()
        end
    end)
    resetBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)
    MLFrame.WABtn = CreateButton(nil, MLFrame, "WA", "LEFT", resetBtn, "RIGHT", 0, 0, btnWidth, btnHeight, btnFontSize)
    local WABtn = MLFrame.WABtn
    WABtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    WABtn.BorderTop:Hide()
    WABtn.BorderLeft:Hide()
    WABtn.BorderBottom:Hide()
    WABtn.BorderRight:Hide()
    WABtn:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            if (not IsInRaid(1)) then
                ZL.Print("不在团队中！")
                return
            end
            -- if (not PlayerIsML()) then
            --     ZL.Print("ML功能，您无法使用！")
            --     return
            -- end
            sendWAString()
        elseif button == "RightButton" then
            local function tempMenuTable()
                local menuList = {}
                menuList = {
                    {
                        -- disabled = (not PlayerIsML()) or (not IsInRaid(1)),
                        text = "|TInterface\\AddOns\\" .. addonName .. "\\Images\\shareWA.png:13:13:0:0|t 发送拍卖WA",
                        notClickable = 1,
                        func = function ()
                            -- sendWAString()
                            ZL.GUI:CloseMenu()
                        end,
                        hasArrow = true,
                        menuTable = {
                            {
                                disabled = not IsInRaid(1),
                                text = "团队",
                                func = function ()
                                    sendWAString()
                                end,
                            },
                            {
                                disabled = not IsInGroup(1),
                                text = "小队",
                                func = function ()
                                    sendWAString(nil, "PARTY")
                                end,
                            },
                            {
                                disabled = not IsInGuild(),
                                text = "公会",
                                func = function ()
                                    sendWAString(nil, "GUILD")
                                end,
                            },
                            {
                                disabled = not IsInGroup(1),
                                text = "密语",
                                func = function ()
                                    sendWAString(nil, "WHISPER")
                                end,
                                tooltipMore = function(tip)
                                    tip:SetText("密语方式发送给团队成员")
                                end,
                            },
                            {
                                text = "说",
                                func = function ()
                                    sendWAString(nil, "SAY")
                                end,
                            },
                        },
                    },
                    {
                        -- disabled = (not PlayerIsML()) or (not IsInRaid(1)),
                        text = "|TInterface\\AddOns\\" .. addonName .. "\\Images\\stateWA.png:13:13:0:0|t WA发送进度",
                        func = function ()
                            if not ZL.WaLoadStateFrame then
                                ZL:CreateWaLoadStateFrame()
                            else
                                if ZL.WaLoadStateFrame:IsShown() then
                                    ZL.WaLoadStateFrame:Hide()
                                else
                                    ZL.WaLoadStateFrame:Show()
                                end
                            end
                        end
                    },
                    {isSeparator = true},
                    {
                        -- disabled = not IsInRaid(1),
                        text = "|T851904:13:13:0:0|t 刷新版本信息",
                        func = function ()
                            ZL_PLAYERLIST = ZL_PLAYERLIST or {}
                            ZL_PLAYERLIST.GroupMembersVersion = {}
                            local chatType
                            if IsInRaid(1) then
                                chatType = "RAID"
                            elseif IsInGroup(1) then
                                chatType = "PARTY"
                            elseif IsInGuild() then
                                chatType = "GUILD"
                            end
                            if chatType then
                                local data = {type="request", ver=ZL.addonVersion}
                                MyAddon:TransmitAddonInfo2("AUTOAUC VER", data, chatType, nil, "BULK")
                            end
                        end
                    },
                }
                tinsert(menuList, {isSeparator = true})
                if ZL.opt.hideBtnTooltip then
                    tinsert(menuList, {
                        text = "打开按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = nil
                        end,
                    })
                else
                    tinsert(menuList, {
                        text = "关闭按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = true
                            GameTooltip:Hide()
                        end,
                    })
                end
                tinsert(menuList, {isSeparator = true})
                tinsert(menuList, {text = "关闭"})
                return menuList
            end
            ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'BOTTOMLEFT', 0, 0)
        end
    end)
    WABtn:SetScript("OnEnter", function (self)
        if ZL_PLAYERLIST.GroupMembersVersion and next(ZL_PLAYERLIST.GroupMembersVersion) then
            local left, _, width = AuctionFrame:GetRect()
            local right = GetScreenWidth() - (left + width)
            if left >= right then
                GameTooltipShow(AuctionFrame, "TOPRIGHT", "TOPLEFT", 0, btnHeight)
            else
                GameTooltipShow(AuctionFrame, "TOPLEFT", "TOPRIGHT", 0, btnHeight)
            end
            if IsInRaid(1) then
                local totalMembers, hasAddon = ZL.GetGroupMembersAndHasAddon()
                GameTooltip:AddLine("团员版本信息|cffffffff(" .. hasAddon .. "/" .. totalMembers .. ")|r")
                for i = 1, MAX_RAID_MEMBERS do
                    local name, rank, _, _, _, _, _, online, _, _, isML = GetRaidRosterInfo(i)
                    if name then
                        local txt = GetClassColorName(name)
                        if rank == 2 then
                            txt = txt .. "|TInterface\\GroupFrame\\UI-Group-LeaderIcon:12|t"
                        elseif rank == 1 then
                            txt = txt .. "|TInterface\\GroupFrame\\UI-GROUP-ASSISTANTICON:12|t"
                        end
                        if isML then
                            txt = txt .. "|TInterface\\GroupFrame\\UI-Group-MasterLooter:12|t"
                        end
                        if online then
                            if ZL_PLAYERLIST.GroupMembersVersion[name] then
                                GameTooltip:AddDoubleLine(txt, ZL_PLAYERLIST.GroupMembersVersion[name], 1, 1, 1, 1, 1, 1)
                            else
                                GameTooltip:AddDoubleLine(txt, "|cffffd100未安装|r", 1, 1, 1, 1, 1, 1)
                            end
                        else
                            GameTooltip:AddDoubleLine(txt, "|cffff0000离线|r", 1, 1, 1, 1, 1, 1)
                        end
                    end
                end
            elseif IsInGroup(1) then
                GameTooltip:AddLine("队伍版本信息")
                for i = 1, GetNumGroupMembers() do
                    local unitId
                    if i == 1 then
                        unitId = "player"  -- 玩家自己
                    else
                        unitId = "party"..(i-1)  -- 其他小队成员
                    end
                    local name = UnitName(unitId)
                    if name then
                        local txt = GetClassColorName(name)
                        if UnitIsConnected(unitId) then
                            if ZL_PLAYERLIST.GroupMembersVersion[name] then
                                GameTooltip:AddDoubleLine(txt, ZL_PLAYERLIST.GroupMembersVersion[name], 1, 1, 1, 1, 1, 1)
                            else
                                GameTooltip:AddDoubleLine(txt, "|cffffd100未安装|r", 1, 1, 1, 1, 1, 1)
                            end
                        else
                            GameTooltip:AddDoubleLine(txt, "|cffff0000离线|r", 1, 1, 1, 1, 1, 1)
                        end
                    end
                end
            elseif IsInGuild() then
                C_GuildInfo.GuildRoster()
                ZL.GUILD_ROSTER_UPDATE = nil
                GameTooltip:AddLine("公会成员版本信息")
                for i = 1, GetNumGuildMembers() do
                    local name, _, _, _, _, _, _, _, isOnline, _, class = GetGuildRosterInfo(i)
                    if isOnline then
                        name = name:match("^([^-]+)")
                        local txt = GetClassColorName(name, class)
                        if ZL_PLAYERLIST.GroupMembersVersion[name] then
                            GameTooltip:AddDoubleLine(txt, ZL_PLAYERLIST.GroupMembersVersion[name], 1, 1, 1, 1, 1, 1)
                        else
                            GameTooltip:AddDoubleLine(txt, "|cffffd100未安装|r", 1, 1, 1, 1, 1, 1)
                        end
                    end
                end
            end
            GameTooltip:AddLine(" ")
            GameTooltip:AddLine("左键：|cffffffff发送拍卖WA|r")
            GameTooltip:AddLine("右键：|cffffffff更多功能|r")
            GameTooltip:Show()
        else
            if not ZL.opt.hideBtnTooltip then
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("提示")
                GameTooltip:AddLine("左键：|cffffffff发送拍卖WA|r")
                GameTooltip:AddLine("右键：|cffffffff更多功能|r")
                GameTooltip:Show()
            end
        end
    end)
    WABtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)
    MLFrame.saveBtn = CreateButton(nil, MLFrame, "保存", "LEFT", WABtn, "RIGHT", 0, 0, btnWidth, btnHeight, btnFontSize)
    local saveBtn = MLFrame.saveBtn
    saveBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    saveBtn.BorderTop:Hide()
    saveBtn.BorderLeft:Hide()
    saveBtn.BorderBottom:Hide()
    saveBtn.BorderRight:Hide()
    saveBtn:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            saveGroupMembers()
        elseif button == "RightButton" then
            local function tempMenuTable()
                ZL.opt.wagesGroupMembers = (ZL_CURRENT["globalConfig"] and ZL_CURRENT["globalConfig"]["wagesGroupMembers"]) and ZL_CURRENT["globalConfig"]["wagesGroupMembers"] or ZL.opt.wagesGroupMembers
                local function groupmembers()
                    local menuList = {}
                    if IsInRaid(1) then
                        local members = ZL.GetCurrentRoster()
                        local groupList = {}
                        for i = 1, #members do
                            if #members[i] > 0 then
                                local memberList = {}
                                for _, name in ipairs(members[i]) do
                                    tinsert(memberList, {
                                        text = name,
                                        func = function ()
                                            ZL.GUI:CloseMenu()
                                        end,
                                    })
                                end
                                tinsert(groupList, {
                                    text = "小队 " .. i,
                                    hasArrow = 1,
                                    menuTable = memberList,
                                    func = function ()
                                        ZL.GUI:CloseMenu()
                                    end,
                                })
                            end
                        end
                        tinsert(menuList, {
                            text = "当前成员",
                            checkable = 1,
                            isNotRadio = nil,
                            checked = ZL_CURRENT.globalConfig.wagesGroupMembers == 0 and true or nil,
                            disabled = not PlayerIsML(),
                            hasArrow = 1,
                            menuTable = groupList,
                            func = function ()
                                ZL.opt.wagesGroupMembers = 0
                                ZL.TransmitAddonInfo_Pro()
                                ZL.GUI:CloseMenu()
                                ZL.Print("已选择|cffff0000当前成员|r作为工资计算名单", true)
                            end
                        })
                    end
                    --不在团队中时，按照最新保存时间生成历史保存名单
                    local currentRoster = ZL_CURRENT["GroupMembersList"]
                    if currentRoster and #currentRoster > 0 then
                        for index, data in ipairs(currentRoster) do
                            local groupList = {}
                            if data["saveTime"] then
                                tinsert(groupList, {text=data["saveTime"], isTitle=true})
                            end
                            local members = data.list
                            for i = 1, #members do
                                if #members[i] > 0 then
                                    local memberList = {}
                                    for _, name in ipairs(members[i]) do
                                        tinsert(memberList, {
                                            text = name,
                                            func = function ()
                                                ZL.GUI:CloseMenu()
                                            end,
                                        })
                                    end
                                    tinsert(groupList, {
                                        text = "小队 " .. i,
                                        hasArrow = 1,
                                        menuTable = memberList,
                                        func = function ()
                                            ZL.GUI:CloseMenu()
                                        end,
                                    })
                                end
                            end
                            local checked
                            if ZL.opt.wagesGroupMembers == 0 and (not IsInRaid(1)) and index == 1 then
                                checked = true
                            else
                                checked = (ZL.opt.wagesGroupMembers == index and true or false)
                            end
                            tinsert(menuList, {
                                text = "历史" .. index,
                                checkable = 1,
                                isNotRadio = nil,
                                checked = checked,
                                disabled = not PlayerIsML(),
                                hasArrow = 1,
                                menuTable = groupList,
                                func = function ()
                                    ZL.opt.wagesGroupMembers = index
                                    ZL.TransmitAddonInfo_Pro()
                                    ZL.GUI:CloseMenu()
                                    ZL.Print("已选择|cffff0000历史" .. index .. "|r作为工资计算名单", true)
                                end
                            })
                        end
                    end
                    if #menuList == 0 then
                        tinsert(menuList, {text = "没有名单数据", isTitle = true})
                    end
                    return menuList
                end
                local menuList = {}
                menuList = {
                    {
                        disabled = not PlayerIsML(),
                        text = "|TInterface\\AddOns\\" .. addonName .. "\\Images\\save.png:15:15:2:0|t 保存团员名单",
                        func = function ()
                            saveGroupMembers()
                        end
                    },
                    {
                        disabled = not PlayerIsML(),
                        text = "|T:15:15:2:0|t 选择团员名单",
                        hasArrow = 1,
                        menuTable = groupmembers(),
                    },
                    {isSeparator = true},
                }
                tinsert(menuList, {
                    text = "|TInterface\\AddOns\\" .. addonName .. "\\Images\\sync.png:15:15:2:0|t " .. (PlayerIsML() and "同步所有数据" or "同步ML数据") .. ((ZL.syncDadaCD and ZL.syncDadaCD>0) and "(" .. ZL.syncDadaCD .. ")" or ""),
                    disabled = (ZL.syncDadaCD and ZL.syncDadaCD > 0) or (not IsInRaid(1)),
                    func = function ()
                        syncDada()
                    end
                })
                tinsert(menuList, {isSeparator = true})
                if ZL.opt.hideBtnTooltip then
                    tinsert(menuList, {
                        text = "打开按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = nil
                        end,
                    })
                else
                    tinsert(menuList, {
                        text = "关闭按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = true
                            GameTooltip:Hide()
                        end,
                    })
                end
                tinsert(menuList, {isSeparator = true})
                tinsert(menuList, {text = "关闭"})
                return menuList
            end
            ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'BOTTOMLEFT', 0, 0)
        end
    end)
    saveBtn:SetScript("OnEnter", function (self)
        if not ZL.opt.hideBtnTooltip then
            GameTooltipShow(self, "BOTTOM", "TOP")
            GameTooltip:AddLine("提示")
            GameTooltip:AddLine("左键：|cffffffff保存团员名单|r")
            GameTooltip:AddLine("右键：|cffffffff更多功能|r")
            GameTooltip:Show()
        end
    end)
    saveBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    MLFrame.mailBtn = CreateButton(nil, MLFrame, "邮寄", "LEFT", saveBtn, "RIGHT", 0, 0, btnWidth, btnHeight, btnFontSize)
    local mailBtn = MLFrame.mailBtn
    mailBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    mailBtn.BorderTop:Hide()
    mailBtn.BorderLeft:Hide()
    mailBtn.BorderBottom:Hide()
    mailBtn.BorderRight:Hide()
    mailBtn:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            sendMailAll()
        elseif button == "RightButton" then
            local function tempMenuTable()
                ZL.opt.wagesGroupMembers = (ZL_CURRENT["globalConfig"] and ZL_CURRENT["globalConfig"]["wagesGroupMembers"]) and ZL_CURRENT["globalConfig"]["wagesGroupMembers"] or ZL.opt.wagesGroupMembers
                local menuList = {}
                menuList = {
                    {text = "ML功能", isTitle = true},
                    {
                        disabled = not PlayerIsML(),
                        text = "登记全部邮寄",
                        func = function ()
                            sendMailAll()
                            ZL.GUI:CloseMenu()
                        end,
                    },
                    {
                        disabled = not PlayerIsML(),
                        text = "全部取消邮寄",
                        func = function ()
                            if ZL_CURRENT["mailPlayers"] and next(ZL_CURRENT["mailPlayers"], nil) then
                                local isNeed
                                for name, value in pairs(ZL_CURRENT["mailPlayers"]) do
                                    if value == false then --已邮寄过的不可以取消
                                        ZL_CURRENT["mailPlayers"][name] = nil
                                        isNeed = true
                                    end
                                end
                                if isNeed then
                                    ZL.Print("已全部取消邮寄工资！")
                                else
                                    ZL.Print("没有需要取消邮寄的成员！")
                                end
                            else
                                ZL.Print("没有需要邮寄的成员！")
                            end
                            ZL.GUI:CloseMenu()
                        end,
                    },
                    {isSeparator = true},
                    {
                        disabled = not PlayerIsML(),
                        text = ZL.mailRegOpen and "关闭邮寄登记" or "打开邮寄登记",
                        func = function ()
                            if not  ZL.mailRegOpen then
                                ZL.mailRegOpen = true
                                ZL.AuctionRecordFrame.playerBalanceFrame.mailConfirmBtn:SetText("|cff948cff邮寄登记中|r")
                                for i = 1, 2 do
                                    SendChatMessage("有需要邮寄的，【私聊】我发送：邮寄，插件自动登记！", (UnitIsGroupLeader("player") or UnitIsRaidOfficer("player")) and "RAID_WARNING" or "RAID")
                                end
                            else
                                ZL.stopMailReg()
                            end
                            ZL.GUI:CloseMenu()
                        end,
                    },
                    {
                        text = "邮寄名单",
                        hasArrow = 1,
                        menuTable = function ()
                            local mailList = {}
                            local members, msg, ML = ZL.GetWagesGroupMembers()
                            if not members then
                                tinsert(mailList, {text="没有名单数据", isTitle=true})
                            else
                                tinsert(mailList, {text="选择邮寄工资名单", isTitle=true})
                                tinsert(mailList, {text=msg, isTitle=true})
                                for i = 1, #members do
                                    if #members[i] > 0 then
                                        local memberList = {}
                                        for _, name in ipairs(members[i]) do
                                            tinsert(memberList, {
                                                text = function ()
                                                    if ZL_CURRENT.tradeGongZi and ZL_CURRENT.tradeGongZi[name] then
                                                        return name .. "(已交易工资)"
                                                    elseif (ZL_CURRENT.mailPlayers and ZL_CURRENT.mailPlayers[name] == true) then
                                                        return name .. "(已邮寄工资)"
                                                    elseif ML == name then
                                                        return name .. "|T132065:13:13:0:0|t"
                                                    else
                                                        return name
                                                    end
                                                end,
                                                checkable = 1,
                                                isNotRadio = 1,
                                                -- checked = function ()
                                                --     if ZL_CURRENT.tradeGongZi and ZL_CURRENT.tradeGongZi[name] then
                                                --         return nil
                                                --     elseif (ZL_CURRENT.mailPlayers and ZL_CURRENT.mailPlayers[name] ~= nil) then
                                                --         return true
                                                --     else
                                                --         return nil
                                                --     end
                                                -- end,
                                                checked = (ZL_CURRENT.mailPlayers and ZL_CURRENT.mailPlayers[name] ~= nil) and true or false,
                                                disabled = function ()
                                                    if (ZL_CURRENT.tradeGongZi and ZL_CURRENT.tradeGongZi[name]) or
                                                    (ZL_CURRENT.mailPlayers and ZL_CURRENT.mailPlayers[name] == true) or
                                                    name == ML or (not PlayerIsML()) then
                                                        return true
                                                    else
                                                        return nil
                                                    end
                                                end,
                                                keepShownOnClick = 1,
                                                func = function (owner, data)
                                                    if not ZL_CURRENT.mailPlayers then ZL_CURRENT.mailPlayers = {} end
                                                    ZL_CURRENT.mailPlayers[name] = data.checked
                                                    if data.checked then
                                                        ZL_CURRENT.mailPlayers[name] = false
                                                    else
                                                        ZL_CURRENT.mailPlayers[name] = nil
                                                    end
                                                end,
                                            })
                                        end
                                        tinsert(mailList, {
                                            text = "小队 " .. i,
                                            hasArrow = 1,
                                            menuTable = memberList,
                                            func = function ()
                                                ZL.GUI:CloseMenu()
                                            end,
                                        })
                                    end
                                end
                            end
                            return mailList
                        end,
                        func = function ()
                            ZL.GUI:CloseMenu()
                        end,
                    },
                    {isSeparator = true},
                }
                
                if ZL.opt.hideBtnTooltip then
                    tinsert(menuList, {
                        text = "打开按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = nil
                        end,
                    })
                else
                    tinsert(menuList, {
                        text = "关闭按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = true
                            GameTooltip:Hide()
                        end,
                    })
                end
                tinsert(menuList, {isSeparator = true})
                tinsert(menuList, {text = "关闭"})
                return menuList
            end
            ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'BOTTOMLEFT', 0, 0)
        end
    end)
    mailBtn:SetScript("OnEnter", function (self)
        if not ZL.opt.hideBtnTooltip then
            GameTooltipShow(self, "BOTTOM", "TOP")
            GameTooltip:AddLine("提示")
            GameTooltip:AddLine("左键：|cffffffff登记全部邮寄|r")
            GameTooltip:AddLine("|cffffffff通过一键交易工资的不会登记邮寄|r")
            GameTooltip:AddLine("右键：|cffffffff更多功能|r")
            GameTooltip:Show()
        end
    end)
    mailBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    AuctionFrame.settingBtn = CreateFrame("Button", nil, AuctionFrame)
    local settingBtn = AuctionFrame.settingBtn
    settingBtn:SetPoint("TOPLEFT", AuctionFrame, "TOPLEFT", 5, -6)
    settingBtn:SetSize(14, 14)
    local texture = "Interface\\Buttons\\UI-OptionsButton.blp"
    settingBtn:SetNormalTexture(texture)
    settingBtn:SetHighlightTexture(texture)
    settingBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    settingBtn:SetScript("OnClick", function (self, button)
        ZL.OpenAceConfigDialog("金团拍卖助手")
    end)
    settingBtn:SetScript("OnEnter", function (self)
        local posLeft = AuctionFrame:GetLeft()
        local posRight = GetScreenWidth() - AuctionFrame:GetRight()
        if posLeft > posRight then
            GameTooltipShow(AuctionFrame, "TOPRIGHT", "TOPLEFT")
        else
            GameTooltipShow(AuctionFrame, "TOPLEFT", "TOPRIGHT")
        end
        GameTooltip:AddLine("金团拍卖助手(|cffffffff" .. ZL.addonVersion .. "|r)")
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("左键：|cffffffff打开设置窗口|r")
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("温馨提示")
        GameTooltip:AddLine("|cff87CEEB拍卖系统主要通过插件通信同步数据|r")
        GameTooltip:AddLine("因API问题，插件通信有严格的限制；", 1, 1, 1)
        GameTooltip:AddLine("频繁或传输大数据消息时可能存在", 1, 1, 1)
        GameTooltip:AddLine("消息延迟情况，并非BUG；", 1, 1, 1)
        GameTooltip:AddLine("登录和加载UI时会受到更严格限制，", 1, 1, 1)
        GameTooltip:AddLine("这时建议过2分钟后再使用拍卖功能", 1, 1, 1)
        GameTooltip:Show()
    end)
    settingBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)
    function ZL.sortRollNumber()
        local rollListArr = {}
        if next(ZL.rollList) then
            for key, value in pairs(ZL.rollList) do
                tinsert(rollListArr, {key, value[1], value[2]})
            end
            -- 自定义排序
            table.sort(rollListArr, function(a, b)
                if a[2] ~= b[2] then
                    return a[2] > b[2]  -- ROLL点数降序
                else
                    return a[3] < b[3]  -- ROLL时间升序
                end
            end)
        end
        return rollListArr
    end
    local sortRollNumber = ZL.sortRollNumber
    function ZL.updateRollGameToolTip(self)
        if not GameTooltip:IsShown() then return end
        GameTooltip:Hide()
        if ZL.rollList and next(ZL.rollList) then
            local posLeft = AuctionFrame:GetLeft()
            local posRight = GetScreenWidth() - AuctionFrame:GetRight()
            if posLeft > posRight then
                GameTooltipShow(AuctionFrame, "TOPRIGHT", "TOPLEFT")
            else
                GameTooltipShow(AuctionFrame, "TOPLEFT", "TOPRIGHT")
            end
        else
            GameTooltipShow(self, "BOTTOM", "TOP")
        end
        if (ZL.rollTimer and (not ZL.rollTimer:IsCancelled())) or (not PlayerIsML()) or (not IsInRaid(1)) then
            GameTooltip:AddLine("ROLL")
        else
            GameTooltip:AddLine("开始记录ROLL点数")
        end
        if ZL.rollList and next(ZL.rollList) then
            local arr = sortRollNumber()
            GameTooltip:AddDoubleLine("玩家名", "点数")
            for _, data in ipairs(arr) do
                GameTooltip:AddDoubleLine(data[1], data[2], 1, 1, 1, 1, 1, 1)
            end
        end
        GameTooltip:Show()
    end
    local updateRollGameToolTip = ZL.updateRollGameToolTip
    AuctionFrame.rollBtn = CreateFrame("Button", nil, AuctionFrame)
    local rollBtn = AuctionFrame.rollBtn
    rollBtn:SetPoint("LEFT", settingBtn, "RIGHT", 8, -1)
    rollBtn:SetSize(18, 18)
    rollBtn:SetNormalTexture(130772)
    rollBtn:SetHighlightTexture(130772)
    rollBtn:SetScript("OnClick", function (self, button)
        if (ZL.rollTimer and (not ZL.rollTimer:IsCancelled())) or (not PlayerIsML()) or (not IsInRaid(1)) then
            RandomRoll(1, 100)
        else
            MyAddon:TransmitAddonInfo("AUTOAUC ROLL", {type="start", rollCountDown=ZL.opt.rollCountDown})
        end
    end)
    rollBtn:SetScript("OnEnter", function (self)
        if ZL.rollList and next(ZL.rollList) then
            local posLeft = AuctionFrame:GetLeft()
            local posRight = GetScreenWidth() - AuctionFrame:GetRight()
            if posLeft > posRight then
                GameTooltipShow(AuctionFrame, "TOPRIGHT", "TOPLEFT")
            else
                GameTooltipShow(AuctionFrame, "TOPLEFT", "TOPRIGHT")
            end
        else
            GameTooltipShow(self, "BOTTOM", "TOP")
        end
        if (ZL.rollTimer and (not ZL.rollTimer:IsCancelled())) or (not PlayerIsML()) or (not IsInRaid(1)) then
            GameTooltip:AddLine("ROLL")
        else
            GameTooltip:AddLine("开始记录ROLL点数")
        end
        if ZL.rollList and next(ZL.rollList) then
            local arr = sortRollNumber()
            GameTooltip:AddDoubleLine("玩家名", "点数")
            for _, data in ipairs(arr) do
                GameTooltip:AddDoubleLine(data[1], data[2], 1, 1, 1, 1, 1, 1)
            end
        end
        GameTooltip:Show()
    end)
    rollBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    AuctionFrame.helpBtn = CreateFrame("Button", nil, AuctionFrame)
    local helpBtn = AuctionFrame.helpBtn
    helpBtn:SetPoint("RIGHT", AuctionFrame.closeButton, "LEFT", 0, 0)
    helpBtn:SetSize(14, 14)
    local texture = [[Interface\GossipFrame\ActiveQuestIcon.blp]]
    helpBtn:SetNormalTexture(texture)
    helpBtn:SetHighlightTexture(texture)
    -- helpBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    helpBtn:SetScript("OnEnter", function (self)
        local posLeft = AuctionFrame:GetLeft()
        local posRight = GetScreenWidth() - AuctionFrame:GetRight()
        if posLeft > posRight then
            GameTooltipShow(AuctionFrame, "TOPRIGHT", "TOPLEFT")
        else
            GameTooltipShow(AuctionFrame, "TOPLEFT", "TOPRIGHT")
        end
        GameTooltip:AddLine("点击查看帮助反馈")
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("下面为斜杠快捷命令，可添加到宏里")
        for _, key in ipairs(ZL.commandInfoKeyList) do
            local value = ZL.commandInfo[key]
            if value and value.label then
                if value.key == "" then
                    GameTooltip:AddLine("|cffffaa00/aa|r - " .. value.label, 1, 1, 1)
                else
                    GameTooltip:AddLine("|cffffaa00/aa " .. value.key .. "|r - " .. value.label, 1, 1, 1)
                end
            end
        end
        GameTooltip:Show()
    end)
    helpBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)
    helpBtn:SetScript("OnClick", function (self)
        ZL.OpenAceConfigDialog("金团拍卖助手", "help")
    end)

    AuctionFrame.StateFrame = CreateFrame("Frame", nil, AuctionFrame)
    local StateFrame = AuctionFrame.StateFrame
    StateFrame:SetPoint("BOTTOMLEFT", AuctionFrame, "BOTTOMLEFT")
    StateFrame:SetPoint("BOTTOMRIGHT", AuctionFrame, "BOTTOMRIGHT")
    StateFrame:SetHeight(50)
    StateFrame.BorderTop = StateFrame:CreateTexture(nil, "OVERLAY") --BACKGROUND  OVERLAY
    StateFrame.BorderTop:SetColorTexture(1, 1, 1, 0.5)
    StateFrame.BorderTop:SetPoint("TOPLEFT", 0, 1)
    StateFrame.BorderTop:SetPoint("BOTTOMRIGHT", StateFrame, "TOPRIGHT", 0, 0)

    local function StateFrameBtn_Set(self)
        local tableId = self:GetID()
        local btnText = self:GetText()
        ZL.opt.ZLAuctionFrameTabId = tableId
        StateFrame.AllBtn:SetText("全部")
        StateFrame.WaitingBtn:SetText("待拍卖")
        StateFrame.AuctioningBtn:SetText("拍卖中")
        StateFrame.SuccessBtn:SetText("成功")
        StateFrame.FailedBtn:SetText("流拍")
        StateFrame.LgnoreBtn:SetText("忽略")
        StateFrame.ConcernBtn:SetText("关注")
        self:SetText("|cffffffff" .. btnText .. "|r")
        ZL.AuctionListSort()
    end
    local function stateCounts()
        local total = 0 --总拍卖数：已经打包的不计算在内
        local waitingCounts = 0 --忽略的和已经打包的不计算在内
        local autioningCounts = 0 --忽略的和已经打包的不计算在内
        local successCounts = 0 --忽略的和已经打包的不计算在内
        local failedCounts = 0 --忽略的和已经打包的不计算在内
        local lgnoreCounts = 0 --已经打包的不计算在内
        local concernCounts = 0 --已经打包的不计算在内
        local packageCounts = 0 --打包物品数
        local itemId
        local selectCharKey = ZL.GetClassColorName(UnitName("player")) .. " - " .. GetRealmName()
        if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
            for _, data in ipairs(ZL_CURRENT.auctionlist) do
                if data.isPackage then
                    packageCounts = packageCounts + 1
                else
                    total = total + 1
                    if data.lgnore then
                        lgnoreCounts = lgnoreCounts + 1
                    else
                        itemId = data.itemId
                        if ZL.opt.concernList and ZL.opt.concernList[selectCharKey]
                        and ZL.opt.concernList[selectCharKey]["itemList"][itemId] then
                            concernCounts = concernCounts + 1
                        end
                        if data.state == "waiting" then
                            waitingCounts = waitingCounts + 1
                        elseif data.state == "auctioning" then
                            autioningCounts = autioningCounts + 1
                        elseif data.state == "success" then
                            successCounts = successCounts + 1
                        elseif data.state == "failed" then
                            failedCounts = failedCounts + 1
                        end
                    end
                end
            end
        end
        return total, waitingCounts, autioningCounts, successCounts, failedCounts, lgnoreCounts, concernCounts, packageCounts
    end
    StateFrame.AllBtn = CreateButton("ZL_NewAuctionFrameTab0", StateFrame, "全部", "TOPLEFT", StateFrame, "TOPLEFT", 3, -5, 45, 20, 15)
    local AllBtn = StateFrame.AllBtn
    AllBtn:SetID(0)
    AllBtn:SetScript("OnClick", StateFrameBtn_Set)
    AllBtn:SetScript("OnEnter", function (self)
        local total, waitingCounts, autioningCounts, successCounts, failedCounts, lgnoreCounts, concernCounts, packageCounts = stateCounts()
        GameTooltipShow(self, "BOTTOM", "TOP")
        -- GameTooltip:AddLine("统计")
        GameTooltip:AddDoubleLine("总计：", total, nil, nil, nil, 1, 1, 1)
        GameTooltip:AddDoubleLine("待拍卖：", waitingCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:AddDoubleLine("拍卖中：", autioningCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:AddDoubleLine("成功：", successCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:AddDoubleLine("流拍：", failedCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:AddDoubleLine("忽略：", lgnoreCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:AddDoubleLine("关注：", concernCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:AddDoubleLine("打包：", packageCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:Show()
    end)
    AllBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    StateFrame.WaitingBtn = CreateButton("ZL_NewAuctionFrameTab5", StateFrame, "待拍卖", "LEFT", AllBtn, "RIGHT", 3, 0, 65, 20, 15)
    local WaitingBtn = StateFrame.WaitingBtn
    WaitingBtn:SetID(5)
    WaitingBtn:SetScript("OnClick", StateFrameBtn_Set)
    WaitingBtn:SetScript("OnEnter", function (self)
        local waitingCounts = select(2, stateCounts())
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddDoubleLine("待拍卖：", waitingCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:Show()
    end)
    WaitingBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    StateFrame.AuctioningBtn = CreateButton("ZL_NewAuctionFrameTab1", StateFrame, "拍卖中", "LEFT", WaitingBtn, "RIGHT", 3, 0, 65, 20, 15)
    local AuctioningBtn = StateFrame.AuctioningBtn
    AuctioningBtn:SetID(1)
    AuctioningBtn:SetScript("OnClick", StateFrameBtn_Set)
    AuctioningBtn:SetScript("OnEnter", function (self)
        local autioningCounts = select(3, stateCounts())
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddDoubleLine("拍卖中：", autioningCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:Show()
    end)
    AuctioningBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)
    AuctioningBtn.SpellHighlightTexture = AuctioningBtn:CreateTexture("SpellHighlightTexture1", "OVERLAY", nil, 1)
    local SpellHighlightTexture = AuctioningBtn.SpellHighlightTexture
    SpellHighlightTexture:SetAtlas("bags-newitem")
    SpellHighlightTexture:SetSize(85, 26)
    SpellHighlightTexture:SetPoint("CENTER")
    SpellHighlightTexture:SetBlendMode("ADD")  -- 通常 ADD 模式需要设置 BlendMode

    -- 创建 SpellHighlightAnim 动画组（循环播放）
    AuctioningBtn.SpellHighlightAnim = SpellHighlightTexture:CreateAnimationGroup() --"SpellHighlightAnim"
    local SpellHighlightAnim = AuctioningBtn.SpellHighlightAnim
    SpellHighlightAnim:SetLooping("REPEAT")

    -- 第一个 Alpha 动画（淡入）
    local alpha1 = SpellHighlightAnim:CreateAnimation("Alpha")
    alpha1:SetChildKey("SpellHighlightTexture")
    alpha1:SetSmoothing("OUT")
    alpha1:SetDuration(0.75)
    alpha1:SetOrder(1)
    alpha1:SetFromAlpha(0)
    alpha1:SetToAlpha(1)

    -- 第二个 Alpha 动画（淡出）
    local alpha2 = SpellHighlightAnim:CreateAnimation("Alpha")
    alpha2:SetChildKey("SpellHighlightTexture")
    alpha2:SetSmoothing("IN")
    alpha2:SetDuration(0.75)
    alpha2:SetOrder(2)
    alpha2:SetFromAlpha(1)
    alpha2:SetToAlpha(0)

    StateFrame.SuccessBtn = CreateButton("ZL_NewAuctionFrameTab2", StateFrame, "成功", "LEFT", AuctioningBtn, "RIGHT", 3, 0, 45, 20, 15)
    local SuccessBtn = StateFrame.SuccessBtn
    SuccessBtn:SetID(2)
    SuccessBtn:SetScript("OnClick", StateFrameBtn_Set)
    SuccessBtn:SetScript("OnEnter", function (self)
        local successCounts = select(4, stateCounts())
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddDoubleLine("成功：", successCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:Show()
    end)
    SuccessBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    StateFrame.FailedBtn = CreateButton("ZL_NewAuctionFrameTab3", StateFrame, "流拍", "LEFT", SuccessBtn, "RIGHT", 3, 0, 45, 20, 15)
    local FailedBtn = StateFrame.FailedBtn
    FailedBtn:SetID(3)
    FailedBtn:SetScript("OnClick", StateFrameBtn_Set)
    FailedBtn:SetScript("OnEnter", function (self)
        local failedCounts = select(5, stateCounts())
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddDoubleLine("流拍：", failedCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:Show()
    end)
    FailedBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    StateFrame.LgnoreBtn = CreateButton("ZL_NewAuctionFrameTab4", StateFrame, "忽略", "TOPLEFT", AllBtn, "BOTTOMLEFT", 0, -3, 45, 20, 15)
    local LgnoreBtn = StateFrame.LgnoreBtn
    LgnoreBtn:SetID(4)
    LgnoreBtn:SetScript("OnClick", StateFrameBtn_Set)
    LgnoreBtn:SetScript("OnEnter", function (self)
        local lgnoreCounts = select(6, stateCounts())
        GameTooltipShow(self, "TOP", "BOTTOM")
        GameTooltip:AddDoubleLine("忽略：", lgnoreCounts, nil, nil, nil, 1, 1, 1)
        GameTooltip:Show()
    end)
    LgnoreBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    StateFrame.levelSortBtn = CreateButton(nil, StateFrame, "装等|cff00ff00↓|r", "LEFT", LgnoreBtn, "RIGHT", 3, 0, 65, 20, 15)
    local levelSortBtn = StateFrame.levelSortBtn
    do
        local BtnName
        if ZL.opt.levelSort == "down" then
            BtnName = "|cffffffff装等↓|r"
        elseif ZL.opt.levelSort == "up" then
            BtnName = "|cffffffff装等↑|r"
        else
            BtnName = "装等"
        end
        levelSortBtn:SetText(BtnName)
    end
    levelSortBtn:SetScript("OnClick", function (self)
        ZL.opt.timeSort = false
        StateFrame.timeSortBtn:SetText("时间")
        if ZL.opt.levelSort == false then
            ZL.opt.levelSort = "down"
            levelSortBtn:SetText("|cffffffff装等↓|r")
        elseif ZL.opt.levelSort == "down" then
            ZL.opt.levelSort = "up"
            levelSortBtn:SetText("|cffffffff装等↑|r")
        else
            ZL.opt.levelSort = "down"
            levelSortBtn:SetText("|cffffffff装等↓|r")
        end
        ZL.AuctionListSort()
        if ZL.opt.levelSort then
            GameTooltipShow(self, "BOTTOM", "TOP")
            if ZL.opt.levelSort == "up" then
                GameTooltip:AddLine("装等高的在|cff00ff00后面|r排序", 1, 1, 1)
            else
                GameTooltip:AddLine("装等高的在|cff00ff00前面|r排序", 1, 1, 1)
            end
            GameTooltip:Show()
        end
    end)
    levelSortBtn:SetScript("OnEnter", function (self)
        if ZL.opt.levelSort then
            GameTooltipShow(self, "TOP", "BOTTOM")
            if ZL.opt.levelSort == "up" then
                GameTooltip:AddLine("装等高的在|cff00ff00后面|r", 1, 1, 1)
            else
                GameTooltip:AddLine("装等高的在|cff00ff00前面|r", 1, 1, 1)
            end
            GameTooltip:Show()
        end
    end)
    levelSortBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    StateFrame.timeSortBtn = CreateButton(nil, StateFrame, "时间↑", "LEFT", levelSortBtn, "RIGHT", 3, 0, 65, 20, 15)
    local timeSortBtn = StateFrame.timeSortBtn
    do
        local BtnName
        if ZL.opt.timeSort == "down" then
            BtnName = "|cffffffff时间↓|r"
        elseif ZL.opt.timeSort == "up" then
            BtnName = "|cffffffff时间↑|r"
        else
            BtnName = "时间"
        end
        timeSortBtn:SetText(BtnName)
    end
    timeSortBtn:SetScript("OnClick", function (self)
        ZL.opt.levelSort = false
        levelSortBtn:SetText("装等")
        if ZL.opt.timeSort == false then
            ZL.opt.timeSort = "up"
            timeSortBtn:SetText("|cffffffff时间↑|r")
        elseif ZL.opt.timeSort == "down" then
            ZL.opt.timeSort = "up"
            timeSortBtn:SetText("|cffffffff时间↑|r")
        else
            ZL.opt.timeSort = "down"
            timeSortBtn:SetText("|cffffffff时间↓|r")
        end
        ZL.AuctionListSort()
        if ZL.opt.timeSort then
            GameTooltipShow(self, "BOTTOM", "TOP")
            if ZL.opt.timeSort == "up" then
                GameTooltip:AddLine("新创建的在|cff00ff00后面|r排序", 1, 1, 1)
            else
                GameTooltip:AddLine("新创建的在|cff00ff00前面|r排序", 1, 1, 1)
            end
            GameTooltip:Show()
        end
    end)
    timeSortBtn:SetScript("OnEnter", function (self)
        if ZL.opt.timeSort then
            GameTooltipShow(self, "TOP", "BOTTOM")
            if ZL.opt.timeSort == "up" then
                GameTooltip:AddLine("新创建的在|cff00ff00后面|r", 1, 1, 1)
            else
                GameTooltip:AddLine("新创建的在|cff00ff00前面|r", 1, 1, 1)
            end
            GameTooltip:Show()
        end
    end)
    timeSortBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    StateFrame.ConcernBtn = CreateButton("ZL_NewAuctionFrameTab6", StateFrame, "关注", "LEFT", timeSortBtn, "RIGHT", 3, 0, 45, 20, 15)
    local ConcernBtn = StateFrame.ConcernBtn
    ConcernBtn:SetID(6)
    ConcernBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    ConcernBtn:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            StateFrameBtn_Set(self)
        else
            ZL.ConcernFrame:Show()
        end
    end)
    ConcernBtn:SetScript("OnEnter", function (self)
        local concernCounts = select(7, stateCounts())
        GameTooltipShow(self, "TOP", "BOTTOM")
        GameTooltip:AddLine("关注：|cffffffff" .. concernCounts .. "|r")
        GameTooltip:AddLine("右键：|cffffffff打开关注物品窗口|r")
        GameTooltip:Show()
    end)
    ConcernBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    StateFrame.BillBtn = CreateButton(nil, StateFrame, "|cff00aaff账单|r", "LEFT", ConcernBtn, "RIGHT", 3, 0, 45, 20, 15)  --"|cff00aaff账单|r"
    local BillBtn = StateFrame.BillBtn
    BillBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    BillBtn:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            if IsShiftKeyDown() then
                ZL.OverviewFrame:Hide()
                ZL.ReconciliationFrame:Show()
            else
                ZL.ReconciliationFrame:Hide()
                ZL.OverviewFrame:Update(ZL_CURRENT)
                ZL.OverviewFrame:Show()
            end
        elseif button == "RightButton" then
            ZL.ReconciliationFrame:Hide()
            ZL.OverviewFrame:Update(ZL_PLAYERLIST.lootList)
            ZL.OverviewFrame:Show()
        end
    end)
    BillBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "TOP", "BOTTOM")
        GameTooltip:AddLine("提示")
        GameTooltip:AddLine("左键：|cffffffff拍卖账单|r")
        GameTooltip:AddLine("右键：|cffffffff拾取记录|r")
        GameTooltip:AddLine("Shift+左键：|cffffffff对账单|r")
        if not PlayerIsML() then
            GameTooltip:AddLine("注意", 1, 0, 0)
            GameTooltip:AddLine("拍卖账单数据可能存在延迟", 1, 1, 1)
        end
        GameTooltip:Show()
    end)
    BillBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    --创建滚动条
    AuctionFrame.scrollFrame = CreateFrame("ScrollFrame", nil, AuctionFrame, "UIPanelScrollFrameTemplate")
    AuctionFrame.scrollFrame:SetFrameLevel(AuctionFrame:GetFrameLevel() + 1) -- 设置为比父框架高1级
    AuctionFrame.scrollFrame:SetPoint("TOPLEFT", iconHeaderBtn, "BOTTOMLEFT", -2, 0)
    AuctionFrame.scrollFrame:SetPoint("BOTTOMRIGHT", StateFrame, "TOPRIGHT", 0, 0)
    AuctionFrame.scrollFrame:SetClipsChildren(true) --必须设置为true，scrollFrame所有的子元素才会被剪切
    AuctionFrame.scrollFrame:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel) --重设滑动条鼠标滚轮事件
    --重设ScrollBar位置，放置到scrollFrame内，防止被剪切掉
    AuctionFrame.scrollFrame.ScrollBar:ClearAllPoints()
    AuctionFrame.scrollFrame.ScrollBar:SetPoint("TOPLEFT", functionHeaderBtn, "BOTTOMRIGHT", 0, -18)
    AuctionFrame.scrollFrame.ScrollBar:SetPoint("BOTTOMRIGHT", AuctionFrame.scrollFrame, "BOTTOMRIGHT", 0, 15)
    AuctionFrame.scrollFrame.content = CreateFrame("Frame", nil, AuctionFrame.scrollFrame)
    local content = AuctionFrame.scrollFrame.content
    content:SetPoint("TOPLEFT", AuctionFrame.scrollFrame, "TOPLEFT", 0, 0)
    AuctionFrame.scrollFrame:SetScrollChild(content)
    --动态调整滚动框架中的子框架
    content:SetSize(AuctionFrame.scrollFrame:GetWidth()-AuctionFrame.scrollFrame.ScrollBar:GetWidth(), 500)
    local infoColumnWidth, bidderColumnWidth, bidColumnWidth = iconHeaderBtn:GetWidth(), 130, bidHeaderBtn:GetWidth()
    local startbidColumnWidth, functionColumnWidth = startbidHeaderBtn:GetWidth(), functionHeaderBtn:GetWidth()
    local function zlHighlightOnShow(v)
        ZL.BidderListFrame.index = v
        local Frame1 = AuctionFrame.entries[v]
        Frame1.zlHighlight:Show()
        if ZL.BidderListFrame:IsShown() then
            ZL.BidderListFrame:ClearAllPoints()
            ZL.BidderListFrame:SetPoint("TOPRIGHT", Frame1.bidderFrame, "BOTTOMRIGHT", 0, 0)
            ZL.BidderListFrame:Update(v)
        end
        ZL.FloatAuctionFrame.index = v
        if PlayerIsML() then
            if (not ((bidHeaderBtn:IsShown() or ZL.opt.bidColumnHide) and (startbidHeaderBtn:IsShown() or ZL.opt.startbidColumnHide) and (functionHeaderBtn:IsShown() or ZL.opt.functionColumnHide)))
            and (not (ZL.opt.floatBidFrameHide and ZL.opt.floatStartBidFrameHide and ZL.opt.floatFunctionFrameHide)) then
                ZL.FloatAuctionFrame.OnShow()
            end
        else
            if (not bidHeaderBtn:IsShown()) and (not ZL.opt.floatBidFrameHide) then
                ZL.FloatAuctionFrame.OnShow()
            end
        end
        ZL.FloatAuctionFrame:Update()
    end
    local function zlHighlightOnHide(v)
        local Frame1 = AuctionFrame.entries[v]
        if (not Frame1:IsMouseOver()) and (not ZL.FloatAuctionFrame:IsMouseOver()) then
            Frame1.zlHighlight:Hide()
        end
        if ZL.FloatAuctionFrame.time and (not ZL.FloatAuctionFrame.time:IsCancelled()) then
            ZL.FloatAuctionFrame.time:Cancel()
        end
        ZL.FloatAuctionFrame.time = C_Timer.NewTimer(0.01, function ()
            ZL.FloatAuctionFrame.OnHide()
        end)
    end
    function ZL.startOrCanelAuction(v, quickFailed, notCancel)
        local Frame1 = AuctionFrame.entries[v]
        if ZL.syncAll or Frame1.sync then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        local CancelBtn = Frame1.MLframe.functionFrame.CancelBtn
        if not CancelBtn:IsEnabled() then return end
        if IsInRaid(1) then
            local curAuctionList = ZL_CURRENT.auctionlist[v]
            if CancelBtn:GetText() == "取消" then
                if (not notCancel) then
                    local auction = ZL_CURRENT.auctionlist[v]
                    local data = {
                        type = "取消拍卖",
                        data2 = {itemlink=auction.itemlink, itemindex=auction.itemindex},
                        -- globalConfigData = ZL.globalConfigData(),
                    }
                    MyAddon:TransmitAddonInfo("AUTOAUC SYNC2", data)
                    Frame1.sync = true
                    CancelBtn:Disable()
                    C_Timer.After(10, function ()
                        Frame1.sync = nil
                        CancelBtn:Enable()
                    end)
                end
            else
                if (not quickFailed) and (not ZL_CURRENT.globalConfig.allowMultipleAuctions) and (GetAuctioningCount() > 0 )then
                    ZL.ScrollingMessageFrame:AddMessage("当前为单拍模式，不允许同时拍卖多个物品！")
                    return
                end
                local isExist = false --判断是否有相同物品正在拍卖中
                if ZL_CURRENT.auctionlist then
                    for _, data in ipairs(ZL_CURRENT.auctionlist) do
                        if (data.index ~= v) and (data.itemId == curAuctionList.itemId) and (data.state == "auctioning") then
                            isExist = true
                            break
                        end
                    end
                end
                if isExist then
                    local msgStr = "已有相同的物品正在拍卖，无法同时进行！"
                    ZL.Print(msgStr)
                else
                    ZL.GetLootItemGUID()
                    local msgStr = ""
                    if not ZL.IsCanAuction(curAuctionList) then
                        msgStr = curAuctionList.itemlink .. "无法拍卖，原因可能是：物品不存在或已无法交易"
                        -- SendChatMessage(msgStr, ZL.MsgChannel())
                        ZL.Print(msgStr)
                        return
                    end
                    --如果是流拍的物品重新拍卖，检测流拍物品是否在流拍包里，如果在移动到其他包里
                    if curAuctionList.state == "failed" and ZL.opt.liupaiToggle and curAuctionList["spawnUID"] and next(curAuctionList["spawnUID"], nil) then
                        local itemList = {}
                        for _, value in pairs(curAuctionList["spawnUID"]) do
                            if value["itemGUID"] and next(value["itemGUID"], nil) then
                                for key, _ in pairs(value["itemGUID"]) do
                                    local bagID, slotIndex = ZL.FindItemInBag(key)
                                    if bagID and (bagID == ZL.opt.liupaiBagId or bagID == ZL.opt.liupaiBagId2) then
                                        --从第一个背包开始查询空闲的格子，如果不是流拍背包，也不是自己拍到的背包，则放进去
                                        local targetBagID, targetslotIndex
                                        local currentInfo
                                        for _bagID = 0, NUM_BAG_SLOTS do
                                            if _bagID ~= ZL.opt.liupaiBagId and (ZL.opt.selfToggle and _bagID ~= ZL.opt.selfBagId) then
                                                for _slotIndex = 1, C_Container.GetContainerNumSlots(_bagID) do
                                                    currentInfo = C_Container.GetContainerItemInfo(_bagID, _slotIndex)
                                                    if not currentInfo then
                                                        targetBagID = _bagID
                                                        targetslotIndex = _slotIndex
                                                        break
                                                    end
                                                end
                                            end
                                        end
                                        currentInfo = nil
                                        if targetBagID then
                                            table.insert(itemList, {
                                                bagID = bagID, slotIndex = slotIndex,
                                                targetBagID = targetBagID, targetslotIndex = targetslotIndex,
                                            })
                                        end
                                    end
                                end
                            end
                        end

                        if #itemList > 0 then
                            local index = 1
                            local function linshi()
                                if index <= #itemList then
                                    if not (InCombatLockdown() or UnitIsDeadOrGhost("player")) then
                                        C_Container.PickupContainerItem(itemList[index]["bagID"], itemList[index]["slotIndex"])
                                        C_Container.PickupContainerItem(itemList[index]["targetBagID"], itemList[index]["targetslotIndex"])
                                        index = index + 1
                                        C_Timer.After(1, linshi)
                                    else
                                        C_Timer.After(0.2, linshi)
                                    end
                                end
                            end
                            linshi()
                        end
                    end
                    local isRestart = CancelBtn:GetText()
                    local tradeId = curAuctionList.tradeId
                    local data = {
                        type = "开始拍卖",
                        quickFailed = quickFailed,
                        isRestart = isRestart,
                        tradeId = tradeId,
                        data2 = ZL_CURRENT.auctionlist[v],
                        syncIndex = v,
                        globalConfigData = ZL.globalConfigData(),
                    }
                    MyAddon:TransmitAddonInfo("AUTOAUC SYNC1", data)
                    Frame1.sync = true
                    CancelBtn:Disable()
                    C_Timer.After(10, function ()
                        Frame1.sync = nil
                        CancelBtn:Enable()
                    end)
                end
            end
        else
            local msgStr = "团队模式才能进行拍卖行为！"
            ZL.Print(msgStr)
        end
    end
    local startOrCanelAuction = ZL.startOrCanelAuction
    local function quickStartAuction(v)
        if IsInRaid(1) then
            local Frame1 = AuctionFrame.entries[v]
            local CancelBtn =  Frame1.MLframe.functionFrame.CancelBtn
            if CancelBtn:GetText() == "开始" then
                local data = {
                    ["type"] = "指定人员",
                    ["index"] = v,
                }
                StaticPopup_Show("ZL_ADDINCOME", "收入", nil, data)
            end
        else
            local msgStr = "团队模式才能进行拍卖相关行为！"
            ZL.Print(msgStr)
        end
    end
    local function pauseOrResumeAuction(v)
        local Frame1 = AuctionFrame.entries[v]
        if ZL.syncAll or Frame1.sync then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        local CancelBtn = Frame1.MLframe.functionFrame.CancelBtn
        if not CancelBtn:IsEnabled() then return end
        local curAuctionList = ZL_CURRENT.auctionlist[v]
        local dateType
        if not curAuctionList["isPaused"] then
            dateType = "暂停拍卖"
        else
            dateType = "继续拍卖"
        end
        local data = {
            type = dateType,
            data2 = {itemlink=curAuctionList.itemlink, itemindex=curAuctionList.itemindex},
            -- globalConfigData = ZL.globalConfigData(),
        }
        MyAddon:TransmitAddonInfo("AUTOAUC SYNC3", data)
        Frame1.sync = true
        CancelBtn:Disable()
        C_Timer.After(10, function ()
            Frame1.sync = nil
            CancelBtn:Enable()
        end)
    end
    local function packageAuction(v)
        local Frame1 = AuctionFrame.entries[v]
        if ZL.syncAll or Frame1.sync then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        local currentAuctionList = ZL_CURRENT.auctionlist[v]
        local itemlink = currentAuctionList.itemlink
        --拾取绑定的物品加入到打包里面，警告提醒
        if currentAuctionList.bindType == 1 then
            local msgStr = itemlink .. "为|cff00ff00拾取绑定|r物品，确认加入到打包拍卖里？"
            StaticPopup_Show("ZL_ISPACKAGE", msgStr, nil, v)
        else
            ZL.AddToPackage(v)
        end
    end
    function ZL.syncAuction(v)
        local Frame1 = AuctionFrame.entries[v]
        if ZL.syncAll or Frame1.sync then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        local syncBtn = Frame1.MLframe.functionFrame.syncBtn
        if not syncBtn:IsEnabled() then return end
        local data = {
            type = "同步单个",
            data2 = ZL_CURRENT.auctionlist[v],
            globalConfigData = ZL.globalConfigData(),
        }
        MyAddon:TransmitAddonInfo("AUTOAUC SYNC13", data)
        Frame1.sync = true
        syncBtn:Disable()
        C_Timer.After(10, function ()
            Frame1.sync = nil
            syncBtn:Enable()
        end)
    end
    local syncAuction = ZL.syncAuction
    local function sendAuctionInfo(v)
        local Frame1 = AuctionFrame.entries[v]
        if ZL.syncAll or Frame1.sync then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        local syncBtn = Frame1.MLframe.functionFrame.syncBtn
        if not syncBtn:IsEnabled() then return end
        local auction = ZL_CURRENT.auctionlist[v]
        local data = {
            type = "竞拍信息",
            data2 = {itemlink=auction.itemlink, itemindex=auction.itemindex},
            -- globalConfigData = ZL.globalConfigData(),
        }
        MyAddon:TransmitAddonInfo("AUTOAUC SYNC4", data)
        Frame1.sync = true
        syncBtn:Disable()
        C_Timer.After(10, function ()
            Frame1.sync = nil
            syncBtn:Enable()
        end)
    end
    local function revokeBidAmount(v, other)
        local syncBtn = AuctionFrame.entries[v].MLframe.functionFrame.syncBtn
        if not syncBtn:IsEnabled() then return end
        local curAuctionList = ZL_CURRENT.auctionlist[v]
        local bidderlist = ZL_CURRENT.auctionlist[v].bidderlist
        if bidderlist and #bidderlist > 0 then
            if not other then
                MyAddon:TransmitAddonInfo("AUTOAUC REVOKE", {
                    itemlink=curAuctionList.itemlink, itemindex=curAuctionList.itemindex, playerName=bidderlist[1].bidder
                })
                -- ZL.Print("发送数据中，请稍等...")
                syncBtn:Disable()
            else
                local data = {itemlink=curAuctionList.itemlink, itemindex=curAuctionList.itemindex, index=v}
                StaticPopup_Show("ZL_REVOKEBID", nil, nil, data, ZL.GroupMembersDropdown)
            end
        else
            ZL.Print("当前无人出价！")
        end
    end
    local function modifyBidRecord(v)
        if ZL_CURRENT.globalConfig.auctionMode == "|cffff0000匿名|r" then
            ZL.Print("|cffff0000匿名|r模式不支持修改出价记录。")
            return
        end
        ZL.BidderListFrame.index = v
        local BidderListFrame = ZL.BidderListFrame
        if BidderListFrame:IsShown() then
            BidderListFrame:Hide()
        else
            local Frame1 = AuctionFrame.entries[v]
            BidderListFrame:ClearAllPoints()
            BidderListFrame:SetPoint("TOPRIGHT", Frame1.bidderFrame, "BOTTOMRIGHT", 0, 0)
            BidderListFrame:Show()
            BidderListFrame:Update(v)
        end
    end
    local function coundownAuction(v)
        local Frame1 = AuctionFrame.entries[v]
        if ZL.syncAll or Frame1.sync then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        local CountDownBtn = Frame1.MLframe.functionFrame.CountDownBtn
        if not CountDownBtn:IsEnabled() then return end
        local auction = ZL_CURRENT.auctionlist[v]
        local data = {
            type = "手动倒数",
            data2 = {itemlink=auction.itemlink, itemindex=auction.itemindex},
            -- globalConfigData = ZL.globalConfigData(),
        }
        MyAddon:TransmitAddonInfo("AUTOAUC SYNC5", data)
        Frame1.sync = true
        CountDownBtn:Disable()
        C_Timer.After(10, function ()
            Frame1.sync = nil
            CountDownBtn:Enable()
        end)
    end
    local function resetAuctionTime(v)
        local Frame1 = AuctionFrame.entries[v]
        if ZL.syncAll or Frame1.sync then
            ZL.Print("通信被占用，请稍后重试。")
            return
        end
        local CountDownBtn = Frame1.MLframe.functionFrame.CountDownBtn
        if not CountDownBtn:IsEnabled() then return end
        local curAuctionList = ZL_CURRENT.auctionlist[v]
        --取消倒数，重置拍卖时间
        if curAuctionList.state == "auctioning" and (((curAuctionList.endTime or 0) - time() > 0) or curAuctionList.isPaused) then
            local data = {
                type = "取消倒数",
                data2 = {itemlink=curAuctionList.itemlink, itemindex=curAuctionList.itemindex},
                resetAuctionTimeTimer = curAuctionList.endTime,
                -- globalConfigData = ZL.globalConfigData(),
            }
            MyAddon:TransmitAddonInfo("AUTOAUC SYNC5", data)
            Frame1.sync = true
            CountDownBtn:Disable()
            C_Timer.After(10, function ()
                Frame1.sync = nil
                CountDownBtn:Enable()
            end)
        end
    end
    local function concernItem(itemId)
        local selectCharKey = ZL.GetClassColorName(UnitName("player")) .. " - " .. GetRealmName()
        if (not ZL.opt.concernList) or (not ZL.opt.concernList[selectCharKey]) or
        (not ZL.opt.concernList[selectCharKey]["itemList"][itemId]) then
            ZL.addItem(itemId)
        else
            ZL.deleteItem(itemId)
        end
    end

    AuctionFrame.entries = setmetatable({}, {
        __index = function (t, v)
            local Frame1 = CreateFrame("Button", nil, content)
            Frame1:Hide()
            Frame1.maxAutoBid = nil
            Frame1:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
            end)
            Frame1:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
            end)
            if v > 1 then
                Frame1:SetPoint("TOPLEFT", t[v - 1], "BOTTOMLEFT", 0, -1)
                Frame1:SetPoint("BOTTOMRIGHT", t[v - 1], "BOTTOMRIGHT", 0, -47)
            else
                Frame1:SetPoint("TOPLEFT", content, "TOPLEFT", 3, -1)
                Frame1:SetPoint("BOTTOMRIGHT", content, "TOPRIGHT", -1, -47)
            end
            ZL.CreateBorder(Frame1, 1, 1, 1, 0.5, "OVERLAY")
            Frame1.auctioningFrame = CreateFrame("Frame", nil, Frame1)
            local auctioningFrame = Frame1.auctioningFrame
            auctioningFrame:SetAllPoints()
            ZL.CreateBorder(auctioningFrame, 0, 1, 0, 1, "OVERLAY")
            auctioningFrame:Hide()
            do
                local texture = Frame1:CreateTexture(nil, "BACKGROUND")
                texture:SetColorTexture(1, 0.82, 0, 0.2)
                texture:SetPoint("TOPLEFT")
                texture:SetPoint("BOTTOMRIGHT")
                texture:SetBlendMode("ADD")
                Frame1.zlHighlight = texture
                Frame1.zlHighlight:Hide()
            end

            Frame1.Background = Frame1:CreateTexture(nil,"BACKGROUND")
            Frame1.Background:SetPoint("TOPLEFT")
            Frame1.Background:SetPoint("BOTTOMRIGHT")
            if v%2 == 0 then
                Frame1.Background:SetColorTexture(0, 0, 0, .8)
            else
                Frame1.Background:SetColorTexture(0.15, 0.15, 0.15, .8)
            end

            Frame1.infoFrame = CreateFrame("Frame", nil, Frame1)
            local infoFrame = Frame1.infoFrame
            infoFrame:SetPoint("TOPLEFT")
            infoFrame.timerBtn = CreateFrame("Button", nil, infoFrame)
            local timerBtn = infoFrame.timerBtn
            timerBtn:SetSize(40, 40)
            timerBtn:SetPoint("LEFT", Frame1, "LEFT", 2, 0)
            timerBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                local itemlink = ZL_CURRENT.auctionlist[v].itemlink
                if itemlink == "[打包拍卖]" then
                    ZL.PackageListFrame.index = v
                    local itemList = ZL_CURRENT.auctionlist[v]["itemList"]
                    if itemList and next(itemList, nil) then
                        ZL.PackageListFrame:Update(v)
                        ZL.PackageListFrame.OnShow()
                    else
                        GameTooltip:AddLine("没有打包拍卖物品", 1, 1, 1)
                    end
                else
                    local uiScale, x, y = UIParent:GetEffectiveScale(), GetCursorPosition()
                    x, y = x/uiScale, y/uiScale
                    local screenWidth = GetScreenWidth() / 2
                    ZL.OnEnterBagHighLight(v)
                    if x < screenWidth then
                        GameTooltipShow(self, "TOPLEFT", "BOTTOMRIGHT", 5)
                    else
                        GameTooltipShow(self, "TOPRIGHT", "TOPLEFT", -5)
                    end
                    GameTooltip:SetHyperlink(itemlink)
                    GameTooltip:Show()
                    if _G["ShoppingTooltip1"] and _G["ShoppingTooltip1"]:IsShown() then
                        _G["ShoppingTooltip1"]:ClearAllPoints()
                        if x < screenWidth then
                            _G["ShoppingTooltip1"]:SetPoint("TOPLEFT", GameTooltip, "TOPRIGHT", 0, 0)
                        else
                            _G["ShoppingTooltip1"]:SetPoint("TOPRIGHT", GameTooltip, "TOPLEFT", 0, 0)
                        end
                    end
                    if _G["ShoppingTooltip2"] and _G["ShoppingTooltip2"]:IsShown() then
                        _G["ShoppingTooltip2"]:ClearAllPoints()
                        if x < screenWidth then
                            _G["ShoppingTooltip2"]:SetPoint("TOPLEFT", _G["ShoppingTooltip1"], "TOPRIGHT", 0, 0)
                        else
                            _G["ShoppingTooltip2"]:SetPoint("TOPRIGHT", _G["ShoppingTooltip1"], "TOPLEFT", 0, 0)
                        end
                    end
                end
            end)
            timerBtn:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
                GameTooltip:Hide()
                ZL.ItemDateBar:Hide()
                ZL.ItemWeekDayBar:Hide()
                if ZL.PackageListFrame and ZL.PackageListFrame.time and (not ZL.PackageListFrame.time:IsCancelled()) then
                    ZL.PackageListFrame.time:Cancel()
                end
                if ZL.PackageListFrame:IsShown() then
                    ZL.PackageListFrame.time = C_Timer.NewTimer(0.01, function (self)
                        ZL.PackageListFrame.OnHide(timerBtn)
                    end)
                end
            end)
            timerBtn:SetScript("OnClick", function (self, button)
                local auctionlist = ZL_CURRENT.auctionlist[v]
                local edit = GetCurrentKeyBoardFocus()
                if edit then
                    edit:Insert(auctionlist.itemlink)
                elseif _G["TradeFrame"]:IsShown() then
                    if auctionlist.state == "waiting" or auctionlist.state == "failed" then
                        local itemList = {}
                        for _, data1 in pairs(auctionlist.spawnUID) do
                            for itemGuid in pairs(data1.itemGUID) do
                                local bagID, slotIndex = ZL.FindItemInBag(itemGuid)
                                if bagID and slotIndex then
                                    tinsert(itemList, {bagID, slotIndex})
                                end
                            end
                        end
                        if #itemList > 0 then
                            local function PickupContainerItemToTrade(ibag, islot)
                                C_Container.PickupContainerItem(ibag, islot)
                                for i = 1, 6 do
                                    local name = GetTradePlayerItemInfo(i)
                                    if (not name) then
                                        ClickTradeButton(i)
                                        break
                                    end
                                end
                            end
                            local index = 1
                            local function linshi()
                                if index <= #itemList then
                                    PickupContainerItemToTrade(itemList[index][1], itemList[index][2])
                                    index = index + 1
                                    C_Timer.After(0.3, linshi)
                                end
                            end
                            linshi()
                        end
                    end
                end
                -- HandleModifiedItemClick(itemlink)
            end)
            timerBtn:SetScript("OnDoubleClick", function (self, button)
                local itemId = ZL_CURRENT.auctionlist[v].itemId
                concernItem(itemId)
            end)
            -- local itemId = 46017
            timerBtn.icon = timerBtn:CreateTexture(nil, "OVERLAY")
            local icon = timerBtn.icon
            icon:SetAllPoints(timerBtn)
            -- icon:SetTexture(cGetItemIcon(itemId))
            timerBtn.itemNumbersIcon = timerBtn:CreateTexture(nil, "OVERLAY", nil, 7)
            local itemNumbersIcon = timerBtn.itemNumbersIcon
            itemNumbersIcon:SetSize(20, 20)
            itemNumbersIcon:SetPoint("TOPLEFT", timerBtn, "TOPLEFT")
            do
                timerBtn.concern = timerBtn:CreateTexture(nil, "OVERLAY", nil, 7)
                local concern = timerBtn.concern
                concern:SetPoint("CENTER")
                concern:SetHeight(20)
                concern:SetWidth(20)
                concern:SetAtlas("VignetteKill")
                concern:Hide()
            end

            timerBtn.level = timerBtn:CreateFontString(nil, "OVERLAY")
            timerBtn.level:SetPoint("BOTTOMRIGHT", timerBtn, "BOTTOMRIGHT", -2, -2)
            timerBtn.level:SetFont(GameFontNormal:GetFont(), 12, "OUTLINE")
            timerBtn.level:SetWordWrap(false)
            timerBtn.level:SetHeight(18)
            timerBtn.level:SetJustifyH("RIGHT")
            timerBtn.level:SetTextColor(0.95, 0.95, 0.95, 1)

            timerBtn.itemindex = timerBtn:CreateFontString(nil, "OVERLAY")
            timerBtn.itemindex:SetPoint("BOTTOMLEFT", timerBtn, "BOTTOMLEFT", 2, -2)
            timerBtn.itemindex:SetFont(GameFontNormal:GetFont(), 12, "OUTLINE")
            timerBtn.itemindex:SetWordWrap(false)
            timerBtn.itemindex:SetHeight(18)
            timerBtn.itemindex:SetJustifyH("RIGHT")
            timerBtn.itemindex:SetTextColor(0.95, 0.95, 0.95, 1)

            timerBtn.count = timerBtn:CreateFontString(nil, "OVERLAY")
            timerBtn.count:SetPoint("TOPRIGHT", timerBtn, "TOPRIGHT", -2, 0)
            timerBtn.count:SetFont(GameFontNormal:GetFont(), 12, "OUTLINE")
            timerBtn.count:SetWordWrap(false)
            timerBtn.count:SetHeight(18)
            timerBtn.count:SetJustifyH("LEFT")
            timerBtn.count:SetTextColor(0.95, 0.95, 0.95, 1)
        
            infoFrame.itemName = infoFrame:CreateFontString(nil, "OVERLAY")
            infoFrame.itemName:SetPoint("TOPLEFT", timerBtn, "TOPRIGHT", 2, 1)
            infoFrame.itemName:SetFont(GameFontNormal:GetFont(), 13)
            infoFrame.itemName:SetWordWrap(false)
            infoFrame.itemName:SetSize(93, 20)
            infoFrame.itemName:SetJustifyH("LEFT")

            infoFrame.sb = CreateFrame("StatusBar", nil, infoFrame)
            local sb = infoFrame.sb
            sb:SetPoint("TOPLEFT", infoFrame.itemName, "BOTTOMLEFT", 0, -1)
            sb:SetPoint("BOTTOMRIGHT", infoFrame.itemName, "BOTTOMRIGHT", 8, -20)
            ZL.CreateBorder(sb, 1, 1, 1, 0.5, "OVERLAY", 1)
            do
                local texture = sb:CreateTexture(nil,"BACKGROUND")
                texture:SetColorTexture(1, 1, 1, 1)
                texture:SetPoint("TOPLEFT")
                texture:SetPoint("BOTTOMRIGHT")
                sb:SetStatusBarTexture(texture)
            end
            sb:SetStatusBarColor(0.02, 0.69, 0.15)
            sb:SetMinMaxValues(0, ZL.opt.auctionTimer)
            sb:SetValue(0)
            sb:SetScript("OnMouseDown", function (self, button)
                if button == "LeftButton" and IsShiftKeyDown() then
                    resetAuctionTime(v)
                end
            end)
            sb:SetScript("OnEnter", function (self)
                GameTooltipShowAnchor(self)
                GameTooltip:AddLine("进度条")
                GameTooltip:AddLine("Shift+左键：|cffffffff重置倒计时|r")
                GameTooltip:Show()
            end)
            sb:SetScript("OnLeave", function ()
                GameTooltip:Hide()
            end)
            sb.timeString = sb:CreateFontString(nil, "OVERLAY")
            local timeString = sb.timeString
            timeString:SetPoint("RIGHT", sb, "RIGHT", -2, 0)
            timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            timeString:SetWordWrap(false)
            timeString:SetJustifyH("RIGHT")
            timeString:SetTextColor(0.95, 0.95, 0.95, 1)

            sb.buweiString = sb:CreateFontString(nil, "OVERLAY")
            local buweiString = sb.buweiString
            buweiString:SetPoint("LEFT", sb, "LEFT", 2, 0)
            buweiString:SetWidth(50)
            buweiString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            buweiString:SetWordWrap(false)
            buweiString:SetJustifyH("LEFT")
            buweiString:SetTextColor(0.95, 0.95, 0.95, 1)
        
            infoFrame:SetSize(16+timerBtn:GetWidth()+infoFrame.itemName:GetWidth(), Frame1:GetHeight())

            infoFrame.checkBtn = CreateFrame("CheckButton", nil, infoFrame, "ChatConfigCheckButtonTemplate")
            infoFrame.checkBtn:SetPoint("TOPRIGHT", infoFrame, "TOPRIGHT")
            infoFrame.checkBtn:SetSize(15, 15)
            infoFrame.checkBtn.Text:SetText("")
            infoFrame.checkBtn:SetHitRectInsets(0, -infoFrame.checkBtn.Text:GetWidth(), 0, 0)

            infoFrame.line1 = infoFrame:CreateTexture(nil, "OVERLAY")
            infoFrame.line1:SetColorTexture(0.3, 0.3, 0.3, 1)
            infoFrame.line1:SetPoint("TOPRIGHT")
            infoFrame.line1:SetSize(1, Frame1:GetHeight())
            iconHeaderBtn:SetWidth(infoFrame:GetWidth()+1)
        
            Frame1.MLframe = CreateFrame("Frame", nil, Frame1)
            local MLframe = Frame1.MLframe
            MLframe:SetPoint("TOPRIGHT")
            MLframe:SetSize(1, 1)
            MLframe.functionFrame = CreateFrame("Frame", nil, MLframe)
            local functionFrame = MLframe.functionFrame
            functionFrame:SetPoint("TOPRIGHT")
        
            functionFrame.packageBtn = CreateButton(nil, functionFrame, "打包", "TOPRIGHT", functionFrame, "TOPRIGHT", -5, -3, 40, 18)
            local packageBtn = functionFrame.packageBtn
            packageBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
            end)
            packageBtn:SetScript("OnLeave", function (self)
                -- Frame1.zlHighlight:Hide()
                zlHighlightOnHide(v)
            end)
            packageBtn:SetScript("OnClick", function (self)
                packageAuction(v)
            end)

            functionFrame.CountDownBtn = CreateButton(nil, functionFrame, "倒数", "TOPRIGHT", functionFrame, "TOPRIGHT", -5, -3, 40, 18)  --"RIGHT", packageBtn, "LEFT", -5, 0
            local CountDownBtn = functionFrame.CountDownBtn
            CountDownBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
            local function tempMenuTable()
                local menuList = {
                    {
                        text = "|TInterface\\AddOns\\AutoAuction\\Images\\5countdown_normal.png:14:14:2:2|t " .. "5秒倒数",
                        func = function ()
                            coundownAuction(v)
                        end
                    },
                    {
                        text = "|TInterface\\AddOns\\AutoAuction\\Images\\reset_time.png:14:14:2:0|t " .. "重置倒计时",
                        func = function ()
                            resetAuctionTime(v)
                        end
                    },
                    {isSeparator = true}
                }
                if ZL.opt.hideBtnTooltip then
                    tinsert(menuList, {
                        text = "打开按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = nil
                        end,
                    })
                else
                    tinsert(menuList, {
                        text = "关闭按钮提示",
                        func = function()
                            ZL.opt.hideBtnTooltip = true
                            GameTooltip:Hide()
                        end,
                    })
                end
                tinsert(menuList, {isSeparator = true})
                tinsert(menuList, {text = "关闭"})
                return menuList
            end
            CountDownBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                if not ZL.opt.hideBtnTooltip then
                    GameTooltipShow(self, "BOTTOMRIGHT", "TOPRIGHT")
                    GameTooltip:AddLine("提示：")
                    GameTooltip:AddLine("左键：|cffffffff有人出价5秒倒数|r")
                    GameTooltip:AddLine("　　　|cffffffff没人出价直接流拍|r")
                    GameTooltip:AddLine("右键：|cffffffff更多功能|r")
                    GameTooltip:Show()
                end
                -- ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'TOPRIGHT', 0, 30)
            end)
            CountDownBtn:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)
            CountDownBtn:SetScript("OnClick", function (self, button)
                if button == "LeftButton" then
                    ZL.GUI:CloseMenu()
                    coundownAuction(v)
                elseif button == "RightButton" then
                    ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'TOPRIGHT', 0, 30)
                end
            end)

            functionFrame.PauseBtn = CreateButton(nil, functionFrame, "暂停", "RIGHT", CountDownBtn, "LEFT", -5, 0, 40, 18)
            local PauseBtn = functionFrame.PauseBtn
            PauseBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
            end)
            PauseBtn:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
            end)
            PauseBtn:SetScript("OnClick", function (self, button)
                pauseOrResumeAuction(v)
                btnDelay(self)
            end)

            functionFrame.CancelBtn = CreateButton(nil, functionFrame, "开始", "RIGHT", CountDownBtn, "LEFT", -5, 0, 40, 18)  --"RIGHT", PauseBtn, "LEFT", -5, 0
            local CancelBtn = functionFrame.CancelBtn
            CancelBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
            CancelBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                if not ZL.opt.hideBtnTooltip then
                    local state = ZL_CURRENT.auctionlist[v].state
                    GameTooltipShow(self, "BOTTOMRIGHT", "TOPRIGHT")
                    GameTooltip:AddLine("提示：")
                    if state == "waiting" then
                        GameTooltip:AddLine("|cff00ff00左键|r：开始", 1, 1, 1)
                        GameTooltip:AddLine("|cff00ff00Shift+左键|r：流拍", 1, 1, 1)
                    elseif state == "auctioning" then
                        GameTooltip:AddLine("|cff00ff00左键|r：取消拍卖", 1, 1, 1)
                    elseif state == "failed" then
                        GameTooltip:AddLine("|cff00ff00左键|r：开始", 1, 1, 1)
                    elseif state == "success" then
                        GameTooltip:AddLine("|cff00ff00左键|r：重拍", 1, 1, 1)
                        GameTooltip:AddLine("|cff00ff00Shift+左键|r：流拍", 1, 1, 1)
                    end
                    GameTooltip:AddLine("|cff00ff00右键|r：更多功能", 1, 1, 1)
                    GameTooltip:Show()
                end
            end)
            CancelBtn:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)
            CancelBtn:SetScript("OnClick", function (self, button)
                if IsInRaid(1) then
                    local curAuctionList = ZL_CURRENT.auctionlist[v]
                    if button == "LeftButton" then
                        ZL.GUI:CloseMenu()
                        if (not IsModifierKeyDown()) then
                            startOrCanelAuction(v)
                        elseif IsShiftKeyDown() and (not IsControlKeyDown()) and (not IsAltKeyDown()) then
                            if ZL_CURRENT.auctionlist[v].state == "waiting" or ZL_CURRENT.auctionlist[v].state == "success" then
                                startOrCanelAuction(v, true)
                            end
                        end
                    elseif button == "RightButton" then
                        if (not IsModifierKeyDown()) then
                            local function tempMenuTable()
                                local menuList = {}
                                if self:GetText() == "开始" then
                                    tinsert(menuList, {
                                        text = "|T130866:18:18:2:0|t " .. "开始拍卖",
                                        func =function ()
                                            startOrCanelAuction(v)
                                        end
                                    })
                                    if curAuctionList.state == "waiting" then
                                        tinsert(menuList, {
                                            text = "|T576625:18:18:2:0|t " .. "直接流拍",
                                            func =function ()
                                                startOrCanelAuction(v, true)
                                            end
                                        })
                                    end
                                    tinsert(menuList, {
                                        text = "|T384756:18:18:2:0|t " .. "快速拍卖",
                                        func =function ()
                                            quickStartAuction(v)
                                        end
                                    })
                                elseif self:GetText() == "重拍" then
                                    tinsert(menuList, {
                                        text = "|T130866:18:18:2:0|t " .. "重拍",
                                        func =function ()
                                            startOrCanelAuction(v)
                                        end
                                    })
                                    tinsert(menuList, {
                                        text = "|T576625:18:18:2:0|t " .. "快速流拍",
                                        func =function ()
                                            startOrCanelAuction(v, true)
                                        end
                                    })
                                elseif self:GetText() == "取消" then
                                    tinsert(menuList, {
                                        text = "|T137048:18:18:2:0|t " .. "取消",
                                        func =function ()
                                            startOrCanelAuction(v)
                                        end
                                    })
                                    if curAuctionList["isPaused"] then
                                        tinsert(menuList, {
                                            text = "|T130866:18:18:2:0|t " .. "继续",
                                            func =function ()
                                                pauseOrResumeAuction(v)
                                            end
                                        })
                                    else
                                        tinsert(menuList, {
                                            text = "|T137047:18:18:2:0|t " .. "暂停",
                                            func =function ()
                                                pauseOrResumeAuction(v)
                                            end
                                        })
                                    end
                                end
                                tinsert(menuList, {isSeparator = true})
                                if ZL.opt.hideBtnTooltip then
                                    tinsert(menuList, {
                                        text = "打开按钮提示",
                                        func = function()
                                            ZL.opt.hideBtnTooltip = nil
                                        end,
                                    })
                                else
                                    tinsert(menuList, {
                                        text = "关闭按钮提示",
                                        func = function()
                                            ZL.opt.hideBtnTooltip = true
                                            GameTooltip:Hide()
                                        end,
                                    })
                                end
                                tinsert(menuList, {isSeparator = true})
                                tinsert(menuList, {text = "关闭"})
                                return menuList
                            end
                            ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'TOPRIGHT', 0, 30)
                        elseif IsShiftKeyDown() and (not IsControlKeyDown()) and (not IsAltKeyDown()) then
                            quickStartAuction(v)
                        end
                    end
                else
                    local msgStr = "团队模式才能进行拍卖相关行为！"
                    ZL.Print(msgStr)
                end
            end)

            functionFrame.reverseBidBtn = CreateButton(nil, functionFrame, "撤销", "TOPLEFT", CancelBtn, "BOTTOMLEFT", 0, -3, 40, 18)
            local reverseBidBtn = functionFrame.reverseBidBtn
            reverseBidBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
            reverseBidBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("提示：")
                GameTooltip:AddLine("左键点击：|cffffffff撤销第一名出价|r")
                GameTooltip:AddLine("右键点击：|cffffffff按名字撤销出价|r")
                GameTooltip:Show()
            end)
            reverseBidBtn:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)
            reverseBidBtn:SetScript("OnClick", function (self, button)
                if button == "LeftButton" then
                    revokeBidAmount(v)
                elseif button == "RightButton" then
                    revokeBidAmount(v, true)
                end
                btnDelay(self)
            end)

            functionFrame.modifyBidBtn = CreateButton(nil, functionFrame, "修改", "LEFT", reverseBidBtn, "RIGHT", 5, 0, 40, 18)
            local modifyBidBtn = functionFrame.modifyBidBtn
            modifyBidBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("修改出价人和出价")
                GameTooltip:AddLine("如果记录错了，可打开记录窗口修改", 1, 1, 1)
                GameTooltip:Show()
            end)
            modifyBidBtn:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)
            modifyBidBtn:SetScript("OnClick", function (self)
                modifyBidRecord(v)
            end)

            functionFrame.syncBtn = CreateButton(nil, functionFrame, "通报竞拍", "TOPLEFT", CancelBtn, "BOTTOMLEFT", 0, -3, 85, 18)  --"LEFT", modifyBidBtn, "RIGHT", 5, 0
            local syncBtn = functionFrame.syncBtn
            syncBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
            syncBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                if not ZL.opt.hideBtnTooltip then
                    GameTooltipShow(self, "BOTTOMRIGHT", "TOPRIGHT")
                    GameTooltip:AddLine("提示：")
                    GameTooltip:AddLine("|cff00ff00左键|r：通报竞拍信息", 1, 1, 1)
                    GameTooltip:AddLine("|cff00ff00右键|r：更多功能", 1, 1, 1)
                    GameTooltip:Show()
                end
            end)
            syncBtn:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)
            syncBtn:SetScript("OnClick", function (self, button)
                local state = CancelBtn:GetText()
                local curAuctionList = ZL_CURRENT.auctionlist[v]
                local itemlink = curAuctionList.itemlink
                local bidderlist = curAuctionList.bidderlist
                if button == "RightButton" then
                    local function tempMenuTable2()
                        local menuList = {}
                        if state == "开始" then
                            if curAuctionList.itemlink ~= "[打包拍卖]" then
                                tinsert(menuList, {
                                    text = "|T346111:16:16:2:0|t " .. "打包拍卖",
                                    func = function ()
                                        packageAuction(v)
                                    end
                                })
                            end
                            tinsert(menuList, {
                                text = "|T136813:16:16:2:0|t " .. "删除拍卖",
                                func = function ()
                                    if ZL.syncAll or Frame1.sync then
                                        ZL.Print("通信被占用，请稍后重试。")
                                        return
                                    end
                                    local msgStr = "警告！确定删除" .. ZL_CURRENT.auctionlist[v].itemlink .. "的拍卖记录?"
                                    StaticPopup_Show("ZL_DELETEAUCTIONWARNING", msgStr, nil, v)
                                end
                            })
                        elseif state == "重拍" then

                        elseif state == "取消" then
                            tinsert(menuList, {
                                text = "|T130979:16:16:2:0|t " .. "通报竞拍信息",
                                func = function ()
                                    sendAuctionInfo(v)
                                end
                            })
                            if #bidderlist > 0 then
                                tinsert(menuList, {isSeparator = true})
                                tinsert(menuList, {
                                    text = "撤销第一名出价",
                                    func = function ()
                                        revokeBidAmount(v)
                                    end
                                })
                                if #bidderlist > 1 then
                                    tinsert(menuList, {
                                        text = "按名字撤销出价",
                                        func = function ()
                                            revokeBidAmount(v, true)
                                        end
                                    })
                                end
                                tinsert(menuList, {
                                    text = "修改出价记录",
                                    func = function ()
                                        modifyBidRecord(v)
                                    end
                                })
                            end
                        end
                        if #menuList > 0 then
                            tinsert(menuList, {isSeparator = true})
                        end
                        tinsert(menuList, {
                            text = "|TInterface\\AddOns\\AutoAuction\\Images\\sync.png:16:16:2:-1|t " .. "同步数据",
                            func = function ()
                                syncAuction(v)
                            end
                        })
                        tinsert(menuList, {isSeparator = true})
                        if ZL.opt.hideBtnTooltip then
                            tinsert(menuList, {
                                text = "打开按钮提示",
                                func = function()
                                    ZL.opt.hideBtnTooltip = nil
                                end,
                            })
                        else
                            tinsert(menuList, {
                                text = "关闭按钮提示",
                                func = function()
                                    ZL.opt.hideBtnTooltip = true
                                    GameTooltip:Hide()
                                end,
                            })
                        end
                        tinsert(menuList, {isSeparator = true})
                        tinsert(menuList, {text = "关闭"})
                        return menuList
                    end
                    ZL.GUI:ToggleMenu(self, tempMenuTable2(), 'TOPLEFT', self, 'TOPRIGHT', 0, 30)
                elseif button == "LeftButton" then
                    ZL.GUI:CloseMenu()
                    local msgStr
                    if curAuctionList.state == "waiting" then
                        msgStr = itemlink .. "待拍卖状态，无法发送竞拍信息"
                    elseif curAuctionList.state == "failed" then
                        msgStr = itemlink .. "已流拍，无法发送竞拍信息"
                    elseif curAuctionList.state == "success" then
                        msgStr = itemlink .. "已拍卖成功，无法发送竞拍信息"
                    else
                        sendAuctionInfo(v)
                    end
                    if msgStr then ZL.Print(msgStr) end
                end
            end)

            functionFrame.delAuctionBtn = CreateButton(nil, functionFrame, "删除", "LEFT", syncBtn, "RIGHT", 5, 0, 40, 18)
            local delAuctionBtn = functionFrame.delAuctionBtn
            delAuctionBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "LEFT", "RIGHT")
                GameTooltip:AddLine("注意：")
                GameTooltip:AddLine("删除后如需恢复请手动重新创建拍卖！", 1, 1, 1)
                GameTooltip:AddLine("只支持删除\"待拍卖\"和\"流拍\"中的物品", 1, 1, 1)
                GameTooltip:Show()
            end)
            delAuctionBtn:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)
            delAuctionBtn:SetScript("OnClick", function (self)
                if ZL.syncAll or Frame1.sync then
                    ZL.Print("通信被占用，请稍后重试。")
                    return
                end
                local msgStr = "警告！确定删除" .. ZL_CURRENT.auctionlist[v].itemlink .. "的拍卖记录?"
                StaticPopup_Show("ZL_DELETEAUCTIONWARNING", msgStr, nil, v)
            end)

            functionFrame:SetSize(5+2*(CancelBtn:GetWidth()+5), Frame1:GetHeight())  --5+4*(CancelBtn:GetWidth()+5), Frame1:GetHeight()

            functionFrame.line = functionFrame:CreateTexture(nil, "OVERLAY")
            functionFrame.line:SetColorTexture(0.3, 0.3, 0.3, 1)
            functionFrame.line:SetPoint("TOPLEFT", functionFrame, "TOPLEFT")
            functionFrame.line:SetSize(1, Frame1:GetHeight())
        
            MLframe.startbidFrame = CreateFrame("Frame", nil, MLframe)
            local startbidFrame = MLframe.startbidFrame
            startbidFrame:SetPoint("TOPRIGHT", functionFrame, "TOPLEFT")
        
            startbidFrame.startbidEditbox = CreateEditBox(startbidFrame, 90, 18, 14, "RIGHT", true)
            local startbidEditbox = startbidFrame.startbidEditbox
            startbidEditbox:SetPoint("TOPRIGHT", startbidFrame, "TOPRIGHT", -5, -3)
            startbidEditbox.startbidFont = startbidEditbox:CreateFontString()
            startbidEditbox.startbidFont:SetPoint("LEFT", startbidEditbox, "LEFT", 2, 0)
            startbidEditbox.startbidFont:SetHeight(18)
            startbidEditbox.startbidFont:SetFont(GameFontNormal:GetFont(), 13)
            -- startbidEditbox.startbidFont:SetTextColor(0.95, 0.95, 0.95, 1)
            startbidEditbox.startbidFont:SetText("|cff595959起拍价|r")
            startbidEditbox.startbidFont:SetWordWrap(false)
            startbidEditbox.startbidFont:SetJustifyH("LEFT")

            startbidEditbox:SetScript("OnEditFocusGained", function (self)
                self.startbidFont:Hide()
                self:HighlightText()
                ZL.FloatAuctionFrame.MLframe.startbidFrame.startbidEditbox.startbidFont:Hide()
            end)
            startbidEditbox:SetScript("OnTextChanged", function (self)
                local startbid = self:GetNumber() or 0
                if startbid > 0 then
                    ZL_CURRENT.auctionlist[v].startbidamount = startbid
                end
            end)
            startbidEditbox:SetScript("OnMouseWheel", function(self, delta)
                EditOnMouseWheel(self, delta)
            end)
            startbidEditbox:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("起拍价")
                GameTooltip:AddLine("支持鼠标滚轮", 1, 1, 1)
                GameTooltip:Show()
            end)
            startbidEditbox:SetScript("OnLeave", function (self)
                -- Frame1.zlHighlight:Hide()
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)
            startbidEditbox:SetScript("OnEditFocusLost", function (self)
                self:HighlightText(0, 0)
                startbidEditbox.startbidFont:Show()
                ZL.FloatAuctionFrame.MLframe.startbidFrame.startbidEditbox.startbidFont:Show()
            end)
            
            startbidFrame.incrementEditbox = CreateEditBox(startbidFrame, 90, 18, 14, "RIGHT", true)
            local incrementEditbox = startbidFrame.incrementEditbox
            incrementEditbox:SetPoint("TOPRIGHT", startbidEditbox, "BOTTOMRIGHT", 0, -3)
            incrementEditbox.inrementFont = incrementEditbox:CreateFontString()
            incrementEditbox.inrementFont:SetPoint("LEFT", incrementEditbox, "LEFT", 2, 0)
            incrementEditbox.inrementFont:SetHeight(18)
            incrementEditbox.inrementFont:SetFont(GameFontNormal:GetFont(), 13)
            -- incrementEditbox.inrementFont:SetTextColor(0.95, 0.95, 0.95, 1)
            incrementEditbox.inrementFont:SetText("|cff595959加价|r")
            incrementEditbox.inrementFont:SetWordWrap(false)
            incrementEditbox.inrementFont:SetJustifyH("LEFT")
            incrementEditbox:SetScript("OnEditFocusGained", function (self)
                self.inrementFont:Hide()
                self:HighlightText()
                ZL.FloatAuctionFrame.MLframe.startbidFrame.incrementEditbox.inrementFont:Hide()
            end)
            incrementEditbox:SetScript("OnTextChanged", function (self)
                local increment = self:GetNumber() or 0
                if increment > 0 then
                    ZL_CURRENT.auctionlist[v].bidIncrement = increment
                end
            end)
            incrementEditbox:SetScript("OnMouseWheel", function(self, delta)
                EditOnMouseWheel(self, delta)
            end)
            incrementEditbox:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("加价幅度")
                GameTooltip:AddLine("支持鼠标滚轮", 1, 1, 1)
                GameTooltip:Show()
            end)
            incrementEditbox:SetScript("OnLeave", function (self)
                -- Frame1.zlHighlight:Hide()
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)
            incrementEditbox:SetScript("OnEditFocusLost", function (self)
                self:HighlightText(0, 0)
                incrementEditbox.inrementFont:Show()
                ZL.FloatAuctionFrame.MLframe.startbidFrame.incrementEditbox.inrementFont:Show()
            end)

            startbidFrame:SetSize(10+startbidFrame.startbidEditbox:GetWidth(), Frame1:GetHeight())
        
            startbidFrame.line = startbidFrame:CreateTexture(nil, "OVERLAY")
            startbidFrame.line:SetColorTexture(0.3, 0.3, 0.3, 1)
            startbidFrame.line:SetPoint("TOPLEFT")
            startbidFrame.line:SetSize(1, Frame1:GetHeight())
        
            -- MLframe:SetSize(startbidFrame:GetWidth()+functionFrame:GetWidth(), Frame1:GetHeight())
            functionHeaderBtn:SetWidth(functionFrame:GetWidth()+1)
            startbidHeaderBtn:SetWidth(startbidFrame:GetWidth()+1)
        
            Frame1.bidFrame = CreateFrame("Frame", nil, Frame1)
            local bidFrame = Frame1.bidFrame
            bidFrame:SetPoint("RIGHT", startbidFrame, "LEFT")
            bidFrame:SetSize(95, Frame1:GetHeight())
            bidFrame.bidEditBox = CreateEditBox(bidFrame, bidFrame:GetWidth()-10, 18, 14, "RIGHT", true)
            local bidEditBox = bidFrame.bidEditBox
            bidEditBox:SetPoint("TOPLEFT", bidFrame, "TOPLEFT", 5, -3)
            bidEditBox.Font = bidEditBox:CreateFontString()
            bidEditBox.Font:SetPoint("LEFT", bidEditBox, "LEFT", 2, 0)
            bidEditBox.Font:SetHeight(18)
            bidEditBox.Font:SetFont(GameFontNormal:GetFont(), 13)
            bidEditBox.Font:SetText("|cff595959目标价|r")
            bidEditBox.Font:SetWordWrap(false)
            bidEditBox.Font:SetJustifyH("LEFT")
            bidEditBox:SetScript("OnTextChanged", function (self)
                if strlen(self:GetText()) > 0 then
                    bidEditBox.Font:Hide()
                else
                    bidEditBox.Font:Show()
                end
            end)
            bidEditBox:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("目标价")
                GameTooltip:AddLine("支持鼠标滚轮\n按Enter键或右键直接竞价", 1, 1, 1)
                GameTooltip:Show()
            end)
            bidEditBox:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)
            bidEditBox:SetScript("OnMouseWheel", function(self, delta)
                if self:HasFocus() then
                    local curAuctionList = ZL_CURRENT.auctionlist[v]
                    local itemCount = curAuctionList.itemCount
                    local bidderlist = curAuctionList.bidderlist
                    tableSort(bidderlist)
                    local bidCount = bidFrame.bidCounts:GetNumber()
                    bidCount = bidCount > 0 and bidCount or 1
                    bidCount = bidCount > itemCount and itemCount or bidCount
                    local _, bidIncrement, tarbidamount, _bidCount, successList = ZL.GetNewBidAmount(v)
                    if bidCount > _bidCount and #successList > 0 then
                        for i = #successList, 1, -1 do
                            if successList[i][2] >= bidCount then
                                tarbidamount = successList[i][1] + bidIncrement
                                break
                            end
                        end
                    end
                    local number = self:GetNumber()
                    if delta > 0 then
                        number = number + bidIncrement
                    else
                        number = number - bidIncrement
                    end
                    if number < tarbidamount then
                        number = tarbidamount
                    end
                    self:SetNumber(number)
                end
            end)
            bidEditBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
            bidEditBox:SetScript("OnEnterPressed", function ()
                Frame1.bidFrame.bidBtn:Click()
                self:ClearFocus()
            end)
            bidEditBox:SetScript("OnMouseDown", function(self, button)
                if button == "RightButton" and self:HasFocus() then
                    Frame1.bidFrame.bidBtn:Click()
                    C_Timer.After(0.5, function ()
                        self:ClearFocus()
                    end)
                end
            end)
            bidEditBox:SetScript("OnEditFocusGained", function (self)
                ZL.GUI:ToggleMenu(self, ZL.bidMenuTable(v), 'TOPLEFT', self, 'TOPRIGHT')
            end)
            bidEditBox:SetScript("OnEditFocusLost",function (self)
                self:HighlightText(0, 0)
                ZL.GUI:CloseMenu()
            end)

            bidFrame.bidCounts = CreateEditBox(bidFrame, 40, 18, 14, "RIGHT", true)
            local bidCounts = bidFrame.bidCounts
            bidCounts:SetPoint("TOPLEFT", bidEditBox, "BOTTOMLEFT", 0, -3)
            bidCounts.Font = bidCounts:CreateFontString()
            bidCounts.Font:SetPoint("LEFT", bidCounts, "LEFT", 2, 0)
            bidCounts.Font:SetHeight(18)
            bidCounts.Font:SetFont(GameFontNormal:GetFont(), 13)
            bidCounts.Font:SetText("|cff595959数量|r")
            bidCounts.Font:SetWordWrap(false)
            bidCounts.Font:SetJustifyH("LEFT")
            bidCounts:SetScript("OnTextChanged", function (self)
                if strlen(self:GetText()) > 0 then
                    bidCounts.Font:Hide()
                    local itemCount = ZL_CURRENT["auctionlist"][v].itemCount
                    local number = self:GetNumber()
                    if number < 1 then
                        number = 1
                    elseif number > itemCount then
                        number = itemCount
                    end
                    self:SetNumber(number)
                else
                    bidCounts.Font:Show()
                end
            end)
            bidCounts:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
            bidCounts:SetScript("OnEnterPressed", function(self) self:ClearFocus() end)
            bidCounts:SetScript("OnEditFocusLost",function (self)
                self:HighlightText(0, 0)
            end)
            bidCounts:SetScript("OnMouseWheel", function(self, delta)
                if self:HasFocus() then
                    local itemCount = ZL_CURRENT["auctionlist"][v].itemCount
                    local number = self:GetNumber()
                    if delta > 0 then
                        number = number + 1
                    else
                        number = number - 1
                    end
                    if number < 1 then
                        number = 1
                    elseif number > itemCount then
                        number = itemCount
                    end
                    self:SetNumber(number)
                end
            end)
            bidCounts:SetScript("OnMouseDown", function(self, button)
                if button == "RightButton" and self:HasFocus() then
                    C_Timer.After(0.5, function ()
                        self:ClearFocus()
                    end)
                end
            end)
            bidCounts:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "TOPLEFT", "BOTTOMRIGHT")
                GameTooltip:AddLine("竞拍数量")
                GameTooltip:AddLine("默认为1", 1, 1, 1)
                GameTooltip:AddLine("支持鼠标滚轮", 1, 1, 1)
                GameTooltip:Show()
            end)
            bidCounts:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)

            bidFrame.bidBtn = CreateButton(nil, bidFrame, "出价", "LEFT", bidCounts, "RIGHT", 5, 0, 40, 18)
            local bidBtn = bidFrame.bidBtn
            bidBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
            bidBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "TOPLEFT", "BOTTOMRIGHT")
                if bidBtn:GetText() == "出价" then
                    local itemCount = ZL_CURRENT.auctionlist[v].itemCount
                    local _, bidIncrement, tarbidamount, bidCount, successList = ZL.GetNewBidAmount(v)
                    GameTooltip:AddLine("出价方式")
                    GameTooltip:AddLine("|cffffd100左键：|r单次或目标出价", 1, 1, 1)
                    GameTooltip:AddLine("  目标价为空或小于最低\n  出价则按照最低出价", 1, 1, 1)
                    GameTooltip:AddLine("  目标价大于最低出价则\n  按照目标价出价", 1, 1, 1)
                    GameTooltip:AddLine("|cffffd100右键：|r自动出价", 1, 1, 1)
                    GameTooltip:AddLine("-------------------", 1, 1, 1)
                    GameTooltip:AddDoubleLine("出价", "最大数量")
                    if #successList == 0 then
                        GameTooltip:AddDoubleLine(tarbidamount, bidCount, 1, 1, 1, 1, 1, 1)
                    else
                        local bidamount = 0
                        for index, data in ipairs(successList) do
                            if data[1] ~= bidamount then
                                GameTooltip:AddDoubleLine(data[1]+bidIncrement, data[2], 1, 1, 1, 1, 1, 1)
                                bidamount = data[1]
                            end
                            if index == #successList and data[3] < itemCount then
                                GameTooltip:AddDoubleLine(tarbidamount, itemCount-data[3], 1, 1, 1, 1, 1, 1)
                            end
                        end
                    end
                elseif bidBtn:GetText() == "停止" then
                    GameTooltip:AddLine("自动出价模式")
                    GameTooltip:AddLine("心里价：|cffffd100" .. Frame1.maxAutoBid .."|rg", 1, 1, 1)
                    GameTooltip:AddLine("每2秒按照最低加价幅度竞价", 1, 1, 1)
                else
                    GameTooltip:AddLine("申请重拍")
                end
                GameTooltip:Show()
            end)
            bidBtn:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)
            local function stopAutoBid()
                local curAuctionList = ZL_CURRENT.auctionlist[v]
                Frame1.maxAutoBid = nil
                bidEditBox:Enable()
                bidBtn:SetText("出价")
                bidFrame.lgnoreBtn:Enable()
                if Frame1.autoBid then
                    if (not Frame1.autoBid:IsCancelled()) then
                        Frame1.autoBid:Cancel()
                    end
                    Frame1.autoBid = nil
                    local bidderlist = curAuctionList.bidderlist
                    local isSelf
                    local totalBidCount = 0
                    local msgStr = ""
                    for _, bidData in ipairs(bidderlist) do
                        if totalBidCount < curAuctionList.itemCount then
                            local count = bidData["bidCount"] or 1
                            local newTotalBidCount = totalBidCount + count
                            if newTotalBidCount > curAuctionList.itemCount then
                                count = curAuctionList.itemCount - totalBidCount
                            end
                            totalBidCount = newTotalBidCount
                            if ParseClassColorName(bidData.bidder) == UnitName("player") then
                                isSelf = true
                                break
                            end
                        else
                            break
                        end
                    end
                    if isSelf then
                        msgStr = curAuctionList.itemlink .. "自动出价结束，竞价|cff00ff00成功|r！"
                    else
                        msgStr = curAuctionList.itemlink .. "自动出价结束，竞价|cffff0000失败|r！"
                    end
                    ZL.ScrollingMessageFrame:AddMessage(msgStr)
                end
            end
            bidBtn:SetScript("OnClick", function(self, button)
                local curAuctionList = ZL_CURRENT.auctionlist[v]
                local itemCount = curAuctionList.itemCount
                if bidBtn:GetText() == "出价" then
                    if button == "LeftButton" then
                        local bidderlist = curAuctionList.bidderlist
                        tableSort(bidderlist)
                        local isSelf = false
                        local totalBidCount = 0
                        local bidCount = bidCounts:GetNumber()
                        bidCount = bidCount > 0 and bidCount or 1
                        bidCount = bidCount > itemCount and itemCount or bidCount
                        for _, bidData in ipairs(bidderlist) do
                            if totalBidCount < curAuctionList.itemCount then
                                local count = bidData["bidCount"] or 1
                                local newTotalBidCount = totalBidCount + count
                                if newTotalBidCount > curAuctionList.itemCount then
                                    count = curAuctionList.itemCount - totalBidCount
                                end
                                totalBidCount = newTotalBidCount
                                if ParseClassColorName(bidData.bidder) == UnitName("player") then
                                    if bidData.bidCount >= bidCount then
                                        isSelf = true
                                    end
                                    break
                                end
                            else
                                break
                            end
                        end
                        if (not isSelf) then
                            local _, bidIncrement, newBid, _bidCount, successList = ZL.GetNewBidAmount(v)
                            local msgStr = ""
                            if bidCount > _bidCount and #successList > 0 then
                                for i = #successList, 1, -1 do
                                    if successList[i][2] >= bidCount then
                                        newBid = successList[i][1] + bidIncrement
                                        break
                                    end
                                end
                            end
                            newBid = (bidEditBox:GetNumber() > newBid) and bidEditBox:GetNumber() or newBid
                            if bidCount == 1 then
                                msgStr = tostring(newBid)
                            else
                                msgStr = tostring(newBid) .. "x" .. bidCount
                            end
                            local inventoryCount, bagCount, itemBankCount, itemTotalCount = ZL.GetItemNumbers(curAuctionList.itemId)
                            if inventoryCount and itemTotalCount >= 1 and (not curAuctionList.confirmBid) then
                                --弹出警告窗口
                                local msgStr2 = "你总共拥有" .. curAuctionList.itemlink .. "|cff00ff00" .. itemTotalCount .. "|r个\n|cff00ff00装备:|r" .. inventoryCount .. "，|cff00ff00背包:|r" .. bagCount .. "，|cff00ff00银行:|r" .. itemBankCount .. "\n确定继续竞价？"
                                StaticPopup_Show("ZL_CONFIRMBID", msgStr2, nil, {itemlink=curAuctionList.itemlink, msgStr=msgStr, index=v})
                                return
                            end
                            if ZL_CURRENT.globalConfig.auctionMode == "团队" then
                                if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                                    SendChatMessage(msgStr, "RAID")
                                else
                                    SendChatMessage(curAuctionList.itemlink .. msgStr, "RAID")
                                end
                            else
                                MyAddon:TransmitAddonInfo2("AUTOAUC BID", curAuctionList.itemlink .. msgStr)
                            end
                        else
                            ZL.Print("你已经是有效最高出价者，无需竞价！")
                        end
                        local editbox = GetCurrentKeyBoardFocus()
                        if editbox then
                            editbox:ClearFocus()
                        end
                    else
                        local data = {index=v, f=Frame1}
                        StaticPopup_Show("ZL_AUTOBID", curAuctionList.itemlink, nil, data)
                    end
                elseif bidBtn:GetText() == "停止" then
                    stopAutoBid()
                else
                    SendChatMessage("申请重拍：" .. curAuctionList.itemlink, "WHISPER", nil, ZL.GetMLname())
                    local data = {
                        itemlink = curAuctionList.itemlink,
                        itemindex = curAuctionList.itemindex,
                    }
                    MyAddon:TransmitAddonInfo2("AUTOAUC RETAKE", data, "WHISPER", ZL.GetMLname())
                    bidBtn:Disable()
                    C_Timer.After(1, function ()
                        bidBtn:Enable()
                    end)
                end
                ZL.FloatAuctionFrame:Update()
            end)

            bidFrame.lgnoreBtn = CreateButton(nil, bidFrame, "忽略", "LEFT", bidBtn, "RIGHT", 5, 0, 40, 18)
            local lgnoreBtn = bidFrame.lgnoreBtn
            lgnoreBtn:Hide()
            lgnoreBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
            end)
            lgnoreBtn:SetScript("OnLeave", function (self)
                -- Frame1.zlHighlight:Hide()
                zlHighlightOnHide(v)
            end)
            lgnoreBtn:SetScript("OnClick", function(self)
                if lgnoreBtn:GetText() == "忽略" then
                    lgnoreBtn:SetText("恢复")
                    ZL_CURRENT.auctionlist[v].lgnore = true
                    --如果关注物品则取消关注
                    local itemId = ZL_CURRENT.auctionlist[v].itemId
                    ZL.deleteItem(itemId)
                else
                    lgnoreBtn:SetText("忽略")
                    ZL_CURRENT.auctionlist[v].lgnore = false
                end
                AuctionFrame:Update()
            end)

            bidFrame.line = bidFrame:CreateTexture(nil, "OVERLAY")
            bidFrame.line:SetColorTexture(0.3, 0.3, 0.3, 1)
            bidFrame.line:SetPoint("TOPLEFT")
            bidFrame.line:SetSize(1, Frame1:GetHeight())
            bidHeaderBtn:SetWidth(bidFrame:GetWidth()+1)

            Frame1.bidderFrame = CreateFrame("Button", nil, Frame1)
            local bidderFrame = Frame1.bidderFrame
            bidderFrame:SetPoint("TOPLEFT", infoFrame, "TOPRIGHT")
            bidderFrame:SetPoint("BOTTOMRIGHT", bidFrame, "BOTTOMLEFT")

            bidderFrame.playerNameString = Frame1:CreateFontString(nil, "OVERLAY")
            local playerNameString = bidderFrame.playerNameString
            playerNameString:SetPoint("TOPLEFT", bidderFrame, "TOPLEFT", 5, -2)
            playerNameString:SetPoint("BOTTOMRIGHT", bidderFrame, "BOTTOMRIGHT", -5, 2)
            playerNameString:SetFont(GameFontNormal:GetFont(), 13)
            playerNameString:SetWordWrap(true)
            playerNameString:SetJustifyH("LEFT")
            playerNameString:SetTextColor(0.95, 0.95, 0.95, 1)
            bidderFrame:RegisterForClicks("LeftButtonUp", "RightButtonUp", "MiddleButtonUp")
            bidderFrame:SetScript("OnEnter", function (self)
                GameTooltipShow(self, "TOPRIGHT", "BOTTOMRIGHT")
                local auctionList = ZL_CURRENT["auctionlist"][v]
                if (not PlayerIsML()) or (not ZL.BidderListFrame:IsShown()) then
                    if auctionList and auctionList.bidderlist and (#auctionList.bidderlist > 0)then
                        local bidderlist = auctionList.bidderlist
                        tableSort(bidderlist)
                        
                        GameTooltip:AddLine("出价记录")
                        GameTooltip:AddDoubleLine("名字", "单价*数量")
                        local totalBidCount = 0
                        for _, bidData in ipairs(bidderlist) do
                            local bidderName
                            local bidderAmount
                            if ParseClassColorName(bidData["bidder"]) == UnitName("player") then
                                bidderName = "|cff00ff00你|r"
                            else
                                if ZL_CURRENT.globalConfig.auctionMode == "|cffff0000匿名|r" and auctionList.state == "auctioning" then
                                    bidderName = "***"
                                else
                                    bidderName = bidData["bidder"]
                                end
                            end
                            if totalBidCount < auctionList.itemCount then
                                local count = bidData["bidCount"] or 1
                                local newTotalBidCount = totalBidCount + count
                                if newTotalBidCount > auctionList.itemCount then
                                    count = auctionList.itemCount - totalBidCount
                                end
                                bidderAmount = "|cffff0000" .. tostring(bidData.bidamount) .. "x" .. tostring(count) .. "|r"
                                totalBidCount = newTotalBidCount
                            else
                                bidderAmount = bidData.bidamount  .. "x" .. bidData.bidCount
                            end
                            GameTooltip:AddDoubleLine(bidderName, bidderAmount, 1, 1, 1, 1, 1, 1)
                        end
                        GameTooltip:AddLine(" ")
                    end
                end
                if auctionList.state == "auctioning" then
                    GameTooltip:AddLine("左键双击可|cff00ff00直接出价|r", 1, 1, 1)
                elseif auctionList.state == "failed" then
                    if not PlayerIsML() then
                        GameTooltip:AddLine("左键双击可|cff00ff00申请重拍|r", 1, 1, 1)
                    end
                end
                GameTooltip:AddLine("<右键> 更多功能", 1, 1, 1)
                GameTooltip:Show()
                zlHighlightOnShow(v)
                ZL.BagHighLight()
                ZL.OnEnterBagHighLight(v)
            end)
            bidderFrame:SetScript("OnLeave", function (self)
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)
            bidderFrame:SetScript("OnClick", function (self, button)
                if PlayerIsML() and IsModifierKeyDown() then
                    local curAuctionList = ZL_CURRENT.auctionlist[v]
                    if button == "LeftButton" then
                        if IsShiftKeyDown() and (not IsControlKeyDown()) and (not IsAltKeyDown()) then
                            --只按下Shift+左键点击：开始/重拍
                            startOrCanelAuction(v, nil, true)
                        elseif (not IsShiftKeyDown()) and IsControlKeyDown() and (not IsAltKeyDown()) then
                            --只按下Ctr+左键点击：停止5秒倒数 ，刷新拍卖计时
                            resetAuctionTime(v)
                        elseif (not IsShiftKeyDown()) and (not IsControlKeyDown()) and IsAltKeyDown() then
                            --只按下Alt+左键：快速流拍

                        end
                    elseif button == "RightButton" then
                        if IsShiftKeyDown() and (not IsControlKeyDown()) and (not IsAltKeyDown()) and PlayerIsML() then
                            --只按下Shift+右键点击：竞拍信息
                            if curAuctionList.state == "auctioning" then
                                sendAuctionInfo(v)
                            end
                        elseif (not IsShiftKeyDown()) and IsControlKeyDown() and (not IsAltKeyDown()) then
                            --只按下Ctr+右键点击：5秒倒数
                            if (curAuctionList.endTime or 0) - time() > 5 then
                                coundownAuction(v)
                            end
                        elseif (not IsShiftKeyDown()) and (not IsControlKeyDown()) and IsAltKeyDown() then
                            --只按下Alt+右键点击：撤销出价
                            reverseBidBtn:Click()
                        end
                    elseif button == "MiddleButton" then
                        if IsShiftKeyDown() and (not IsControlKeyDown()) and (not IsAltKeyDown()) then
                            --只按下Shift+中键点击：打包
                            packageBtn:Click()
                        elseif (not IsShiftKeyDown()) and IsControlKeyDown() and (not IsAltKeyDown()) then
                            --只按下Ctr+中键点击：暂停/继续
                            PauseBtn:Click()
                        elseif (not IsShiftKeyDown()) and (not IsControlKeyDown()) and IsAltKeyDown() then
                            --只按下Alt+中键点击：
                        end
                    end
                end
                if button == "RightButton" and (not IsModifierKeyDown()) then
                    local function BidMenuTable(index)
                        local menuList = {}
                        local curAuctionList = ZL_CURRENT.auctionlist[index]
                        local Frame1 = ZL.AuctionFrame2.entries[index]
                        local itemCount = curAuctionList.itemCount
                        local bidCount = Frame1.bidFrame.bidCounts:GetNumber()
                        bidCount = bidCount > 0 and bidCount or 1
                        bidCount = bidCount > itemCount and itemCount or bidCount
                        local _, bidIncrement, tarbidamount, _bidCount, successList = ZL.GetNewBidAmount(index)
                        if bidCount > _bidCount and #successList > 0 then
                            for i = #successList, 1, -1 do
                                if successList[i][2] >= bidCount then
                                    tarbidamount = successList[i][1] + bidIncrement
                                    break
                                end
                            end
                        end
                        bidIncrement = max(bidIncrement, ZL.opt.quickBidIncrement)
                        tarbidamount = math.ceil(tarbidamount / bidIncrement) * bidIncrement
                        for i = 1, 10 do
                            local wantBid = tarbidamount + bidIncrement * (i-1)
                            tinsert(menuList, {
                                text = wantBid,
                                func = function ()
                                    local bidderlist = curAuctionList.bidderlist
                                    ZL.tableSort(bidderlist)
                                    local isSelf = false
                                    local totalBidCount = 0
                                    bidCount = Frame1.bidFrame.bidCounts:GetNumber()
                                    bidCount = bidCount > 0 and bidCount or 1
                                    bidCount = bidCount > itemCount and itemCount or bidCount
                                    for _, bidData in ipairs(bidderlist) do
                                        if totalBidCount < curAuctionList.itemCount then
                                            local count = bidData["bidCount"] or 1
                                            local newTotalBidCount = totalBidCount + count
                                            if newTotalBidCount > curAuctionList.itemCount then
                                                count = curAuctionList.itemCount - totalBidCount
                                            end
                                            totalBidCount = newTotalBidCount
                                            if ZL.ParseClassColorName(bidData.bidder) == UnitName("player") then
                                                if bidData.bidCount >= bidCount then
                                                    isSelf = true
                                                end
                                                break
                                            end
                                        else
                                            break
                                        end
                                    end
                                    if (not isSelf) then
                                        local msgStr = ""
                                        local _, _bidIncrement, newBid, __bidCount, _successList = ZL.GetNewBidAmount(index)
                                        if bidCount > __bidCount and #_successList > 0 then
                                            for j = #_successList, 1, -1 do
                                                if _successList[j][2] >= bidCount then
                                                    newBid = _successList[j][1] + _bidIncrement
                                                    break
                                                end
                                            end
                                        end
                                        if wantBid >= newBid then
                                            if bidCount == 1 then
                                                msgStr = tostring(wantBid)
                                            else
                                                msgStr = tostring(wantBid) .. "x" .. bidCount
                                            end
                                            if ZL_CURRENT.globalConfig.auctionMode == "团队" then
                                                if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                                                    SendChatMessage(msgStr, "RAID")
                                                else
                                                    SendChatMessage(curAuctionList.itemlink .. msgStr, "RAID")
                                                end
                                            else
                                                MyAddon:TransmitAddonInfo2("AUTOAUC BID", curAuctionList.itemlink .. msgStr)
                                            end
                                        else
                                            msgStr = "出价过低，当前竞拍数量".. bidCount .. "至少出价：|cffffd100" .. newBid .."|rg"
                                            ZL.Print(msgStr, true)
                                        end
                                    else
                                        ZL.Print("你已经是有效最高出价者，无需竞价！")
                                    end
                                    ZL.GUI:CloseMenu()
                                end
                            })
                        end
                        tinsert(menuList, {isSeparator = true})
                        tinsert(menuList, {
                            text = "设置幅度",
                            func = function ()
                                ZL.GUI:CloseMenu()
                                StaticPopup_Show("ZL_QUICKBIDINCREMENT", nil, nil)
                            end
                        })
                        tinsert(menuList, {isSeparator = true})
                        tinsert(menuList, {text="关闭", func = function ()
                            ZL.GUI:CloseMenu()
                        end})
                        return menuList
                    end
                    local function tempMenuTable()
                        local state = CancelBtn:GetText()
                        local selectCharKey = ZL.GetClassColorName(UnitName("player")) .. " - " .. GetRealmName()
                        local curAuctionList = ZL_CURRENT.auctionlist[v]
                        local itemId = curAuctionList.itemId
                        local bidderlist = curAuctionList.bidderlist
                        local menuList = {{text="左键双击出价", isTitle=true}}
                        if curAuctionList.state == "auctioning" then
                            if not Frame1.maxAutoBid then
                                tinsert(menuList, {
                                    text = "自动出价",
                                    func = function()
                                        local data = {index=v, f=Frame1}
                                        StaticPopup_Show("ZL_AUTOBID", curAuctionList.itemlink, nil, data)
                                    end
                                })
                            else
                                tinsert(menuList, {
                                    text = "停止自动出价",
                                    func = function()
                                        stopAutoBid()
                                    end
                                })
                            end

                            tinsert(menuList, {
                                text = "快速出价",
                                hasArrow = 1,
                                -- notClickable = 1,
                                menuTable = BidMenuTable(v),
                            })
                        end
                        if PlayerIsML() then
                            tinsert(menuList, {isSeparator = true})
                            if state == "开始" then
                                tinsert(menuList, {
                                    text = "|T130866:18:18:2:0|t " .. "开始拍卖",
                                    func =function ()
                                        startOrCanelAuction(v)
                                    end
                                })
                                if curAuctionList.state == "waiting" then
                                    tinsert(menuList, {
                                        text = "|T576625:18:18:2:0|t " .. "直接流拍",
                                        func =function ()
                                            startOrCanelAuction(v, true)
                                        end
                                    })
                                end
                                tinsert(menuList, {
                                    text = "|T384756:18:18:2:0|t " .. "快速拍卖",
                                    func =function ()
                                        quickStartAuction(v)
                                    end
                                })
                            elseif state == "重拍" then
                                tinsert(menuList, {
                                    text = "|T130866:18:18:2:0|t " .. "重拍",
                                    func =function ()
                                        startOrCanelAuction(v)
                                    end
                                })
                                tinsert(menuList, {
                                    text = "|T576625:18:18:2:0|t " .. "快速流拍",
                                    func =function ()
                                        startOrCanelAuction(v, true)
                                    end
                                })
                            elseif state == "取消" then
                                tinsert(menuList, {
                                    text = "|T137048:18:18:2:0|t " .. "取消",
                                    func =function ()
                                        startOrCanelAuction(v)
                                    end
                                })
                                if curAuctionList["isPaused"] then
                                    tinsert(menuList, {
                                        text = "|T130866:18:18:2:0|t " .. "继续",
                                        func =function ()
                                            pauseOrResumeAuction(v)
                                        end
                                    })
                                else
                                    tinsert(menuList, {
                                        text = "|T137047:18:18:2:0|t " .. "暂停",
                                        func =function ()
                                            pauseOrResumeAuction(v)
                                        end
                                    })
                                end
                            end

                            if curAuctionList.state == "auctioning" then
                                tinsert(menuList, {isSeparator = true})
                                tinsert(menuList, {
                                    text = "|TInterface\\AddOns\\AutoAuction\\Images\\5countdown_normal.png:14:14:2:2|t " .. "5秒倒数",
                                    func = function ()
                                        coundownAuction(v)
                                    end
                                })
                                tinsert(menuList, {
                                    text = "|TInterface\\AddOns\\AutoAuction\\Images\\reset_time.png:14:14:2:0|t " .. "重置倒计时",
                                    func = function ()
                                        resetAuctionTime(v)
                                    end
                                })
                            end

                            if state == "开始" then
                                tinsert(menuList, {isSeparator = true})
                                if curAuctionList.itemlink ~= "[打包拍卖]" then
                                    tinsert(menuList, {
                                        text = "|T346111:16:16:2:0|t " .. "打包拍卖",
                                        func = function ()
                                            packageAuction(v)
                                        end
                                    })
                                end
                                tinsert(menuList, {
                                    text = "|T136813:16:16:2:0|t " .. "删除拍卖",
                                    func = function ()
                                        if ZL.syncAll or Frame1.sync then
                                            ZL.Print("通信被占用，请稍后重试。")
                                            return
                                        end
                                        local msgStr = "警告！确定删除" .. ZL_CURRENT.auctionlist[v].itemlink .. "的拍卖记录?"
                                        StaticPopup_Show("ZL_DELETEAUCTIONWARNING", msgStr, nil, v)
                                    end
                                })
                            elseif state == "取消" then
                                tinsert(menuList, {isSeparator = true})
                                tinsert(menuList, {
                                    text = "|T130979:16:16:2:0|t " .. "通报竞拍信息",
                                    func = function ()
                                        sendAuctionInfo(v)
                                    end
                                })
                                if #bidderlist > 0 then
                                    tinsert(menuList, {isSeparator = true})
                                    tinsert(menuList, {
                                        text = "撤销第一名出价",
                                        func = function ()
                                            revokeBidAmount(v)
                                        end
                                    })
                                    if #bidderlist > 1 then
                                        tinsert(menuList, {
                                            text = "按名字撤销出价",
                                            func = function ()
                                                revokeBidAmount(v, true)
                                            end
                                        })
                                    end
                                    tinsert(menuList, {
                                        text = "修改出价记录",
                                        func = function ()
                                            modifyBidRecord(v)
                                        end
                                    })
                                end
                            end
                            tinsert(menuList, {isSeparator = true})
                            tinsert(menuList, {
                                text = "|TInterface\\AddOns\\AutoAuction\\Images\\sync.png:16:16:2:-1|t " .. "同步数据",
                                func = function ()
                                    syncAuction(v)
                                end
                            })
                        end
                        tinsert(menuList, {isSeparator = true})
                        if (not ZL.opt.concernList) or (not ZL.opt.concernList[selectCharKey]) or
                        (not ZL.opt.concernList[selectCharKey]["itemList"][itemId]) then
                            tinsert(menuList, {
                                text = "|A:auctionhouse-icon-favorite:15:15:2:2|a " .. "关注", --VignetteKill
                                func = function ()
                                    ZL.addItem(itemId)
                                end
                            })
                        else
                            tinsert(menuList, {
                                text = "|A:auctionhouse-icon-favorite-off:15:15:2:2|a " .. "取消关注",
                                func = function ()
                                    ZL.deleteItem(itemId)
                                end
                            })
                        end
                        tinsert(menuList, {
                            text = "|T130775:15:15:2:0|t " .. (curAuctionList["lgnore"] and "取消忽略" or "忽略"),
                            func = function ()
                                lgnoreBtn:Click()
                            end
                        })
                        tinsert(menuList, {isSeparator = true})
                        tinsert(menuList, {text = "关闭"})
                        return menuList
                    end
                    ZL.GUI:ToggleMenu(self, tempMenuTable(), 'TOPLEFT', self, 'TOPRIGHT', 0, 30)
                end
            end)
            bidderFrame:SetScript("OnDoubleClick", function (self, button)
                if (not IsModifierKeyDown()) then
                    if button == "LeftButton" then
                        bidBtn:Click()
                    elseif button == "RightButton" then
                        -- lgnoreBtn:Click()
                    end
                end
            end)

            infoColumnWidth, bidderColumnWidth, bidColumnWidth = infoFrame:GetWidth(), 130, bidFrame:GetWidth()
            startbidColumnWidth, functionColumnWidth = startbidFrame:GetWidth(), functionFrame:GetWidth()

            local totalWidth = infoColumnWidth + bidderColumnWidth --固定最小尺寸
            local function updateUI(width)
                if PlayerIsML() then
                    if (ZL.opt.bidColumnHide or (ZL.opt.bidEditBoxHide and ZL.opt.bidBtnHide and ZL.opt.bidCountsHide)) and
                    (ZL.opt.startbidColumnHide or (ZL.opt.startBidHide and ZL.opt.inrementHide)) and
                    (ZL.opt.functionColumnHide or (ZL.opt.startBtnHide and ZL.opt.pauseBtnHide and ZL.opt.countdownBtnHide and
                    ZL.opt.packageBtnHide and ZL.opt.reverseBidBtnHide and ZL.opt.syncBtnHide and ZL.opt.delAuctionBtnHide)) then
                        --都隐藏
                        functionFrame:Hide()
                        startbidFrame:Hide()
                        bidFrame:Hide()
                    elseif (not ZL.opt.bidColumnHide) and
                    (ZL.opt.startbidColumnHide or (ZL.opt.startBidHide and ZL.opt.inrementHide)) and
                    (ZL.opt.functionColumnHide or (ZL.opt.startBtnHide and ZL.opt.pauseBtnHide and ZL.opt.countdownBtnHide and
                    ZL.opt.packageBtnHide and ZL.opt.reverseBidBtnHide and ZL.opt.syncBtnHide and ZL.opt.delAuctionBtnHide)) then
                        --只显示出价列
                        functionFrame:Hide()
                        startbidFrame:Hide()
                        if width < totalWidth + bidColumnWidth then
                            bidFrame:Hide()
                        else
                            bidFrame:Show()
                        end
                    elseif (ZL.opt.bidColumnHide or (ZL.opt.bidEditBoxHide and ZL.opt.bidBtnHide and ZL.opt.bidCountsHide)) and
                    (not ZL.opt.startbidColumnHide) and
                    (ZL.opt.functionColumnHide or (ZL.opt.startBtnHide and ZL.opt.pauseBtnHide and ZL.opt.countdownBtnHide and
                    ZL.opt.packageBtnHide and ZL.opt.reverseBidBtnHide and ZL.opt.syncBtnHide and ZL.opt.delAuctionBtnHide)) then
                        --只显示起拍价/加价列
                        functionFrame:Hide()
                        bidFrame:Hide()
                        if width < totalWidth + startbidColumnWidth then
                            startbidFrame:Hide()
                        else
                            startbidFrame:Show()
                        end
                    elseif (ZL.opt.bidColumnHide or (ZL.opt.bidEditBoxHide and ZL.opt.bidBtnHide and ZL.opt.bidCountsHide)) and
                    (ZL.opt.startbidColumnHide or (ZL.opt.startBidHide and ZL.opt.inrementHide)) and
                    (not ZL.opt.functionColumnHide) then
                        --只显示功能按钮列
                        bidFrame:Hide()
                        startbidFrame:Hide()
                        if width < totalWidth + functionColumnWidth then
                            functionFrame:Hide()
                        else
                            functionFrame:Show()
                        end
                    elseif (not ZL.opt.bidColumnHide) and (not ZL.opt.startbidColumnHide) and
                    (ZL.opt.functionColumnHide or (ZL.opt.startBtnHide and ZL.opt.pauseBtnHide and ZL.opt.countdownBtnHide and
                    ZL.opt.packageBtnHide and ZL.opt.reverseBidBtnHide and ZL.opt.syncBtnHide and ZL.opt.delAuctionBtnHide)) then
                        --显示出价和起拍价/加价列
                        local width1 = totalWidth + startbidColumnWidth + bidColumnWidth
                        local width2 = totalWidth + bidColumnWidth
                        functionFrame:Hide()
                        if width >= width1 then
                            --显示出价和起拍价/加价列
                            startbidFrame:Show()
                            bidFrame:Show()
                        elseif width >= width2 and width < width1 then
                            --显示出价列
                            startbidFrame:Hide()
                            bidFrame:Show()
                        else
                            --都隐藏
                            startbidFrame:Hide()
                            bidFrame:Hide()
                        end
                    elseif (not ZL.opt.bidColumnHide) and
                    (ZL.opt.startbidColumnHide or (ZL.opt.startBidHide and ZL.opt.inrementHide)) and
                    (not ZL.opt.functionColumnHide) then
                        --显示出价和功能按钮列
                        local width1 = totalWidth + bidColumnWidth + functionColumnWidth
                        local width2 = totalWidth + bidColumnWidth
                        startbidFrame:Hide()
                        if width >= width1 then
                            --显示出价和功能按钮列
                            functionFrame:Show()
                            bidFrame:Show()
                        elseif width >= width2 and width < width1 then
                            --显示出价
                            functionFrame:Hide()
                            bidFrame:Show()
                        else
                            --都隐藏
                            functionFrame:Hide()
                            bidFrame:Hide()
                        end
                    elseif (ZL.opt.bidColumnHide or (ZL.opt.bidEditBoxHide and ZL.opt.bidBtnHide and ZL.opt.bidCountsHide)) and
                    (not ZL.opt.startbidColumnHide) and (not ZL.opt.functionColumnHide) then
                        --显示起拍价/加价和功能按钮列
                        local width1 = totalWidth + startbidColumnWidth + functionColumnWidth
                        local width2 = totalWidth + startbidColumnWidth
                        bidFrame:Hide()
                        if width >= width1 then
                            --显示起拍价/加价和功能按钮列
                            startbidFrame:Show()
                            functionFrame:Show()
                        elseif width >= width2 and width < width1 then
                            --显示起拍价列
                            functionFrame:Hide()
                            startbidFrame:Show()
                        else
                            --都隐藏
                            startbidFrame:Hide()
                            functionFrame:Hide()
                        end
                    elseif (not ZL.opt.bidColumnHide) and (not ZL.opt.startbidColumnHide) and (not ZL.opt.functionColumnHide) then
                        --全部显示
                        local width1 = totalWidth + functionColumnWidth + startbidColumnWidth + bidColumnWidth
                        local width2 = totalWidth + startbidColumnWidth + bidColumnWidth
                        local width3 = totalWidth + bidColumnWidth
                        if width >= width1 then
                            --全部显示
                            functionFrame:Show()
                            startbidFrame:Show()
                            bidFrame:Show()
                        elseif width >= width2 and width < width1 then
                            --显示出价和起拍价
                            functionFrame:Hide()
                            startbidFrame:Show()
                            bidFrame:Show()
                        elseif width >= width3 and width < width2 then
                            --显示出价列
                            functionFrame:Hide()
                            startbidFrame:Hide()
                            bidFrame:Show()
                        else
                            --都隐藏
                            functionFrame:Hide()
                            startbidFrame:Hide()
                            bidFrame:Hide()
                        end
                    end
                else
                    --不是ML，出价列和功能按钮列都是强制隐藏
                    functionFrame:Hide()
                    startbidFrame:Hide()
                    if (ZL.opt.bidColumnHide or (ZL.opt.bidEditBoxHide and ZL.opt.bidBtnHide and ZL.opt.bidCountsHide)) then
                        --都隐藏
                        bidFrame:Hide()
                    else
                        local width1 = totalWidth + bidColumnWidth
                        if width >= width1 then
                            --显示出价列
                            bidFrame:Show()
                        else
                            --都隐藏
                            bidFrame:Hide()
                        end
                    end
                end
                do
                    if ZL.opt.itemLevelHide then
                        timerBtn.level:Hide()
                    else
                        timerBtn.level:Show()
                    end

                    if ZL.opt.itemCountHide then
                        timerBtn.count:Hide()
                    else
                        timerBtn.count:Show()
                    end

                    if ZL.opt.itemIndexHide then
                        timerBtn.itemindex:Hide()
                    else
                        timerBtn.itemindex:Show()
                    end

                    if ZL.opt.itemNameHide then
                        infoFrame.itemName:Hide()
                    else
                        infoFrame.itemName:Show()
                    end

                    if ZL.opt.bidEditBoxHide then
                        bidEditBox:Hide()
                    else
                        bidEditBox:Show()
                    end

                    if ZL.opt.bidBtnHide then
                        bidBtn:Hide()
                    else
                        bidBtn:Show()
                    end

                    if ZL.opt.bidCountsHide then
                        bidCounts:Hide()
                    else
                        bidCounts:Show()
                    end

                    if ZL.opt.startBidHide then
                        startbidEditbox:Hide()
                        startbidEditbox.startbidFont:Hide()
                    else
                        startbidEditbox:Show()
                        startbidEditbox.startbidFont:Show()
                    end

                    if ZL.opt.inrementHide then
                        incrementEditbox:Hide()
                        incrementEditbox.inrementFont:Hide()
                    else
                        incrementEditbox:Show()
                        incrementEditbox.inrementFont:Show()
                    end

                    if ZL.opt.startBtnHide then
                        CancelBtn:Hide()
                    else
                        CancelBtn:Show()
                    end

                    if ZL.opt.pauseBtnHide then
                        PauseBtn:Hide()
                    else
                        PauseBtn:Show()
                    end

                    if ZL.opt.countdownBtnHide then
                        CountDownBtn:Hide()
                    else
                        CountDownBtn:Show()
                    end

                    if ZL.opt.packageBtnHide then
                        packageBtn:Hide()
                    else
                        packageBtn:Show()
                    end

                    if ZL.opt.reverseBidBtnHide then
                        reverseBidBtn:Hide()
                    else
                        reverseBidBtn:Show()
                    end

                    if ZL.opt.modifyBidBtnHide then
                        modifyBidBtn:Hide()
                    else
                        modifyBidBtn:Show()
                    end

                    if ZL.opt.syncBtnHide then
                        syncBtn:Hide()
                    else
                        syncBtn:Show()
                    end

                    if ZL.opt.delAuctionBtnHide then
                        delAuctionBtn:Hide()
                    else
                        delAuctionBtn:Show()
                    end
                end

                if infoFrame.itemName:IsShown() then
                    sb:SetPoint("TOPLEFT", infoFrame.itemName, "BOTTOMLEFT", 0, -1)
                    sb:SetPoint("BOTTOMRIGHT", infoFrame.itemName, "BOTTOMRIGHT", 8, -20)
                else
                    sb:SetPoint("TOPLEFT", infoFrame.itemName, "TOPLEFT", 0, -2)
                    sb:SetPoint("BOTTOMRIGHT", infoFrame.itemName, "BOTTOMRIGHT", 8, -20)
                end

                if startbidFrame:IsShown() then
                    startbidFrame:ClearAllPoints()
                    if functionFrame:IsShown() then
                        startbidFrame:SetPoint("TOPRIGHT", functionFrame, "TOPLEFT")
                    else
                        startbidFrame:SetPoint("TOPRIGHT", Frame1, "TOPRIGHT")
                    end

                    if startbidEditbox:IsShown() and incrementEditbox:IsShown() then
                        startbidEditbox:ClearAllPoints()
                        startbidEditbox:SetPoint("TOPRIGHT", startbidFrame, "TOPRIGHT", -5, -3)
                        incrementEditbox:ClearAllPoints()
                        incrementEditbox:SetPoint("TOPRIGHT", startbidEditbox, "BOTTOMRIGHT", 0, -3)
                    elseif (not startbidEditbox:IsShown()) and incrementEditbox:IsShown() then
                        incrementEditbox:ClearAllPoints()
                        incrementEditbox:SetPoint("RIGHT", startbidFrame, "RIGHT", -5, 0)
                    elseif startbidEditbox:IsShown() and (not incrementEditbox:IsShown()) then
                        startbidEditbox:ClearAllPoints()
                        startbidEditbox:SetPoint("RIGHT", startbidFrame, "RIGHT", -5, 0)
                    end
                end
                bidderFrame:ClearAllPoints()
                bidderFrame:SetPoint("TOPLEFT", infoFrame, "TOPRIGHT")
                if bidFrame:IsShown() then
                    bidFrame:ClearAllPoints()
                    if startbidFrame:IsShown() then
                        bidFrame:SetPoint("TOPRIGHT", startbidFrame, "TOPLEFT")
                    elseif functionFrame:IsShown() then
                        bidFrame:SetPoint("TOPRIGHT", functionFrame, "TOPLEFT")
                    else
                        bidFrame:SetPoint("TOPRIGHT", Frame1, "TOPRIGHT")
                    end

                    bidderFrame:SetPoint("BOTTOMRIGHT", bidFrame, "BOTTOMLEFT")

                    if bidEditBox:IsShown() then
                        bidEditBox:ClearAllPoints()
                        if bidBtn:IsShown() or bidCounts:IsShown() then
                            bidEditBox:SetPoint("TOPLEFT", bidFrame, "TOPLEFT", 5, -3)
                        else
                            bidEditBox:SetPoint("LEFT", bidFrame, "LEFT", 5, 0)
                        end
                    end
                    if bidCounts:IsShown() then
                        bidCounts:ClearAllPoints()
                        if bidEditBox:IsShown() then
                            bidCounts:SetPoint("TOPLEFT", bidEditBox, "BOTTOMLEFT", 0, -3)
                        elseif bidBtn:IsShown() then
                            bidCounts:SetPoint("LEFT", bidFrame, "LEFT", 5, 0)
                        else
                            bidCounts:SetPoint("CENTER", bidFrame, "CENTER")
                        end
                    end
                    if bidBtn:IsShown() then
                        bidBtn:ClearAllPoints()
                        if bidCounts:IsShown() then
                            bidBtn:SetPoint("LEFT", bidCounts, "RIGHT", 5, 0)
                        elseif bidEditBox:IsShown() then
                            bidBtn:SetPoint("TOPLEFT", bidEditBox, "BOTTOMLEFT", 0, -3)
                        else
                            bidBtn:SetPoint("CENTER", bidFrame, "CENTER")
                        end
                    end
                    -- if lgnoreBtn:IsShown() then
                    --     lgnoreBtn:ClearAllPoints()
                    --     if bidBtn:IsShown() then
                    --         lgnoreBtn:SetPoint("LEFT", bidBtn, "RIGHT", 5, 0)
                    --     elseif bidEditBox:IsShown() then
                    --         lgnoreBtn:SetPoint("TOPLEFT", bidEditBox, "BOTTOMLEFT", 0, -3)
                    --     else
                    --         lgnoreBtn:SetPoint("CENTER", bidFrame, "CENTER")
                    --     end
                    -- end
                elseif startbidFrame:IsShown() then
                    bidderFrame:SetPoint("BOTTOMRIGHT", startbidFrame, "BOTTOMLEFT")
                elseif functionFrame:IsShown() then
                    bidderFrame:SetPoint("BOTTOMRIGHT", functionFrame, "BOTTOMLEFT")
                else
                    bidderFrame:SetPoint("BOTTOMRIGHT", Frame1, "BOTTOMRIGHT")
                end
            end
            Frame1:SetScript("OnShow", function (self)
                local width = self:GetWidth()
                updateUI(width)
            end)
            Frame1:SetScript("OnSizeChanged", function (self, width)
                updateUI(width)
            end)
            function Frame1:SetValues(index)
                self.index = index  --框架在数组中的索引
                local curAuction = ZL_CURRENT.auctionlist[index]
                local itemId = curAuction.itemId
                local itemlink = curAuction.itemlink
                local itemindex = curAuction.itemindex
                local state = curAuction.state
                local startbidamount = curAuction.startbidamount
                local bidIncrement = curAuction.bidIncrement
                local countdownremaining = (curAuction.endTime or 0) - time()
                local isPaused = curAuction.isPaused
                local itemCount = curAuction.itemCount
                local bidderlist = curAuction.bidderlist
                local lgnore = curAuction.lgnore
                local itemSubType = curAuction.itemSubType
                local bindType = curAuction.bindType
                local itemLevel = curAuction.itemLevel
                local isPackage = curAuction.isPackage
                --"Interface\\FriendsFrame\\UI-FriendsFrame-HighlightBar"
                --"Interface\\GLUES\\CharacterSelect\\Glues-CharacterSelect-Highlight"
                local selectCharKey = ZL.GetClassColorName(UnitName("player")) .. " - " .. GetRealmName()
                if (not ZL.opt.concernList) or (not ZL.opt.concernList[selectCharKey]) or
                (not ZL.opt.concernList[selectCharKey]["itemList"][itemId]) then
                    self.infoFrame.timerBtn.concern:Hide()
                else
                    self.infoFrame.timerBtn.concern:Show()
                    curAuction.lgnore = false
                end
                --bindType == 2 表示装绑
                local _itemlink = itemlink
                if itemlink == "[打包拍卖]" then _itemlink = "|cff0000ff[打包拍卖]|r" end
                if itemLevel and itemLevel > 0 then
                    timerBtn.level:SetText(tostring(itemLevel))
                else
                    timerBtn.level:SetText(" ")
                end
                if itemSubType then
                    buweiString:SetTextScale(1)
                    if bindType == 2 then
                        buweiString:SetText("|cffffd100" .. itemSubType .. "|r")
                    else
                        buweiString:SetText(itemSubType)
                    end
                    do
                        local bili = buweiString:GetWidth()/(buweiString:GetUnboundedStringWidth()+5)
                        if bili < 1 then
                            buweiString:SetTextScale(bili)
                        else
                            buweiString:SetTextScale(1)
                        end
                    end
                else
                    buweiString:SetText(" ")
                end

                if itemCount ~= 1 then
                    timerBtn.count:SetText(tostring(itemCount))
                else
                    timerBtn.count:SetText(" ")
                end

                if itemindex ~= 1 then
                    timerBtn.itemindex:SetText(tostring(itemindex))
                else
                    timerBtn.itemindex:SetText(" ")
                end
                infoFrame.itemName:SetTextScale(1)
                infoFrame.itemName:SetText(_itemlink)
                local bili = infoFrame.itemName:GetWidth()/(infoFrame.itemName:GetUnboundedStringWidth()+5)
                if bili < 1 then
                    infoFrame.itemName:SetTextScale(bili)
                else
                    infoFrame.itemName:SetTextScale(1)
                end
                if itemId ~= 0 then
                    icon:SetTexture(cGetItemIcon(itemId)) --   C_Item.GetItemIconByID不需要先缓存，C_Item.GetItemInfo需要先缓存
                    local itemTotalCount = select(4, ZL.GetItemNumbers(itemId))
                    if itemTotalCount > 0 then
                        itemNumbersIcon:SetTexture([[interface/raidframe/readycheck-ready]])
                    else
                        itemNumbersIcon:SetTexture()
                    end
                else
                    icon:SetTexture("Interface\\AddOns\\" .. addonName .. "\\Images\\ZL.tga")
                    itemNumbersIcon:SetTexture()
                end

                startbidEditbox:SetNumber(startbidamount)
                incrementEditbox:SetNumber(bidIncrement)

                if lgnore then
                    lgnoreBtn:SetText("恢复")
                else
                    lgnoreBtn:SetText("忽略")
                end
                local auctionTimer = ZL_CURRENT.globalConfig.auctionTimer
                local auctionTimerRefresh = ZL_CURRENT.globalConfig.auctionTimerRefresh
                local maxValue = max(auctionTimer, auctionTimerRefresh)
                sb:SetMinMaxValues(0, maxValue)
                sb:SetValue(0)
                if state == "waiting" or state == "failed" then
                    Frame1.auctioningFrame:Hide()
                    if Frame1.countDownTimer then
                        if not Frame1.countDownTimer:IsCancelled() then
                            Frame1.countDownTimer:Cancel()
                        end
                        Frame1.countDownTimer = nil
                    end
                    curAuction.confirmBid = nil
                    if state == "waiting" then
                        timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
                        timeString:SetTextColor(0.95, 0.95, 0.95, 1)
                        timeString:SetText("待拍卖")
                        bidBtn:Disable()
                        bidBtn:SetText("出价")
                    elseif state == "failed" then
                        timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
                        timeString:SetTextColor(0.95, 0.95, 0.95, 1)
                        timeString:SetText("|cffff0000流拍！|r")
                        if PlayerIsML() then
                            bidBtn:Disable()
                        else
                            bidBtn:Enable()
                        end
                        bidBtn:SetText("重拍")
                    end
                    playerNameString:SetText("|cff00ff00起拍价:|r" .. startbidamount)
                    bidEditBox:SetNumber(startbidamount)
                    bidEditBox:Disable()

                    Frame1.maxAutoBid = nil
                    lgnoreBtn:Enable()
                    if itemlink == "[打包拍卖]" or isPackage then
                        packageBtn:Disable()
                    else
                        packageBtn:Enable()
                    end
                    PauseBtn:SetText("暂停")
                    PauseBtn:Disable()
                    CancelBtn:SetText("开始")
                    CancelBtn:Enable()
                    CountDownBtn:Disable()
                    reverseBidBtn:Disable()
                    modifyBidBtn:Disable()
                    delAuctionBtn:Enable()
                elseif (state == "auctioning") then
                    Frame1.auctioningFrame:Show()
                    if countdownremaining > 0 then
                        sb:SetValue(countdownremaining)
                        timeString:SetText(ConvertSecondsToTime(countdownremaining))
                        if not Frame1.countDownTimer then
                            Frame1.countDownTimer = C_Timer.NewTicker(1, function (self)
                                AuctionFrame:CountDown(v)
                            end)
                        end
                    end
                    if isPaused then
                        timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
                        timeString:SetTextColor(0.95, 0.95, 0.95, 1)
                        timeString:SetText("|cffff0000暂停中|r")
                        bidEditBox:Disable()
                        bidBtn:Disable()
                        if self.maxAutoBid then
                            bidBtn:SetText("停止")
                            lgnoreBtn:Disable()
                        else
                            bidBtn:SetText("出价")
                            lgnoreBtn:Enable()
                        end
                        PauseBtn:SetText("继续")
                        PauseBtn:Enable()
                    else
                        if ZL.IsCandidate(index) then
                            if self.maxAutoBid then
                                bidEditBox:Disable()
                                bidBtn:Enable()
                                bidBtn:SetText("停止")
                                lgnoreBtn:Disable()
                            else
                                bidEditBox:Enable()
                                bidBtn:Enable()
                                bidBtn:SetText("出价")
                                lgnoreBtn:Enable()
                            end
                        else
                            timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
                            timeString:SetTextColor(0.95, 0.95, 0.95, 1)
                            timeString:SetText("|cffff0000无法竞拍|r")
                            bidEditBox:Disable()
                            bidBtn:Disable()
                            bidBtn:SetText("出价")
                            lgnoreBtn:Enable()
                        end
                        PauseBtn:SetText("暂停")
                        PauseBtn:Enable()
                    end
                    if bidderlist and (#bidderlist > 0) then --如果有人出价
                        tableSort(bidderlist)
                        local bidderText = ""
                        local totalBidCount = 0
                        for num, bidData in ipairs(bidderlist) do
                            if totalBidCount < itemCount then
                                local count = bidData["bidCount"] or 1
                                local newTotalBidCount = totalBidCount + count
                                if newTotalBidCount > itemCount then
                                    count = itemCount - totalBidCount
                                end
                                if ParseClassColorName(bidData["bidder"]) == UnitName("player") then
                                    if num == 1 then
                                        if count > 1 then
                                            bidderText = "你|cffffd100(" .. bidData.bidamount .. "x" .. count .. ")|r"
                                        else
                                            bidderText = "你|cffffd100(" .. bidData.bidamount .. ")|r"
                                        end
                                    else
                                        if count > 1 then
                                            bidderText = "你|cffffd100(" .. bidData.bidamount .. "x" .. count .. ")|r\n" .. bidderText
                                        else
                                            bidderText = "你|cffffd100(" .. bidData.bidamount .. ")|r\n" .. bidderText
                                        end
                                    end
                                else
                                    if ZL_CURRENT.globalConfig.auctionMode == "|cffff0000匿名|r" then
                                        if num == 1 then
                                            if count > 1 then
                                                bidderText = "*|cffffd100(" .. bidData.bidamount .. "x" .. count .. ")|r"
                                            else
                                                bidderText = "*|cffffd100(" .. bidData.bidamount .. ")|r"
                                            end
                                        else
                                            if count > 1 then
                                                bidderText = bidderText .. "\n*|cffffd100(" .. bidData.bidamount .. "x" .. count .. ")|r"
                                            else
                                                bidderText = bidderText .. "\n*|cffffd100(" .. bidData.bidamount .. ")|r"
                                            end
                                        end
                                    else
                                        if num == 1 then
                                            if count > 1 then
                                                bidderText = bidData.bidder .. "|cffffd100(" .. bidData.bidamount .. "x" .. count .. ")|r"
                                            else
                                                bidderText = bidData.bidder .. "|cffffd100(" .. bidData.bidamount .. ")|r"
                                            end
                                        else
                                            if count > 1 then
                                                bidderText = bidderText .. "\n" .. bidData.bidder .. "|cffffd100(" .. bidData.bidamount .. "x" .. count .. ")|r"
                                            else
                                                bidderText = bidderText .. "\n" .. bidData.bidder .. "|cffffd100(" .. bidData.bidamount .. ")|r"
                                            end
                                        end
                                    end
                                end
                                totalBidCount = newTotalBidCount
                            else
                                break
                            end
                        end
                        playerNameString:SetText(bidderText)
                    else
                        playerNameString:SetText("|cff00ff00起拍价:|r" .. startbidamount)
                    end
                    packageBtn:Disable()
                    PauseBtn:Enable()
                    CancelBtn:Enable()
                    CancelBtn:SetText("取消")
                    CountDownBtn:Enable()
                    reverseBidBtn:Enable()
                    modifyBidBtn:Enable()
                    delAuctionBtn:Disable()
                elseif state == "success" then
                    Frame1.auctioningFrame:Hide()
                    if Frame1.countDownTimer then
                        if not Frame1.countDownTimer:IsCancelled() then
                            Frame1.countDownTimer:Cancel()
                        end
                        Frame1.countDownTimer = nil
                    end
                    curAuction.confirmBid = nil
                    timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
                    timeString:SetTextColor(0.95, 0.95, 0.95, 1)
                    timeString:SetText("|cff00ff00成功|r")
                    if bidderlist and (#bidderlist > 0) then --如果有人出价
                        tableSort(bidderlist)
                        local bidderText = ""
                        local totalBidCount = 0
                        for num, bidData in ipairs(bidderlist) do
                            if totalBidCount < itemCount then
                                local count = bidData["bidCount"] or 1
                                local newTotalBidCount = totalBidCount + count
                                if newTotalBidCount > itemCount then
                                    count = itemCount - totalBidCount
                                end
                                if ParseClassColorName(bidData["bidder"]) == UnitName("player") then
                                    if num == 1 then
                                        if count > 1 then
                                            bidderText = "你|cffffd100(" .. bidData.bidamount .. "x" .. count .. ")|r"
                                        else
                                            bidderText = "你|cffffd100(" .. bidData.bidamount .. ")|r"
                                        end
                                    else
                                        if count > 1 then
                                            bidderText = "你|cffffd100(" .. bidData.bidamount .. "x" .. count .. ")|r\n" .. bidderText
                                        else
                                            bidderText = "你|cffffd100(" .. bidData.bidamount .. ")|r\n" .. bidderText
                                        end
                                    end
                                else
                                    if num == 1 then
                                        if count > 1 then
                                            bidderText = bidData.bidder .. "|cffffd100(" .. bidData.bidamount .. "x" .. count .. ")|r"
                                        else
                                            bidderText = bidData.bidder .. "|cffffd100(" .. bidData.bidamount .. ")|r"
                                        end
                                    else
                                        if count > 1 then
                                            bidderText = bidderText .. "\n" .. bidData.bidder .. "|cffffd100(" .. bidData.bidamount .. "x" .. count .. ")|r"
                                        else
                                            bidderText = bidderText .. "\n" .. bidData.bidder .. "|cffffd100(" .. bidData.bidamount .. ")|r"
                                        end
                                    end
                                end
                                totalBidCount = newTotalBidCount
                            else
                                break
                            end
                        end
                        playerNameString:SetText(bidderText)
                    end
                    bidEditBox:SetNumber(startbidamount)
                    bidEditBox:Disable()
                    bidBtn:Disable()
                    bidBtn:SetText("出价")
                    Frame1.maxAutoBid = nil
                    lgnoreBtn:Enable()
                    packageBtn:Disable()
                    PauseBtn:SetText("暂停")
                    PauseBtn:Disable()
                    CancelBtn:SetText("重拍")
                    CancelBtn:Enable()
                    CountDownBtn:Disable()
                    reverseBidBtn:Disable()
                    modifyBidBtn:Disable()
                    delAuctionBtn:Disable()
                end
                if (not ZL_CURRENT.globalConfig) or ZL_CURRENT.globalConfig.auctionMode == "|cffff0000匿名|r" then
                    modifyBidBtn:Disable()
                end
            end
            t[v] = Frame1
            return Frame1
        end
    })

    local function AuctionFrameSizeChange(width)
        local totalWidth = infoColumnWidth + bidderColumnWidth + 24 --固定最小尺寸
        AuctionFrame.scrollFrame.content:SetWidth(width-AuctionFrame.scrollFrame.ScrollBar:GetWidth())
        if PlayerIsML() then
            if (ZL.opt.bidColumnHide or (ZL.opt.bidEditBoxHide and ZL.opt.bidBtnHide and ZL.opt.bidCountsHide)) and
            (ZL.opt.startbidColumnHide or (ZL.opt.startBidHide and ZL.opt.inrementHide)) and
            (ZL.opt.functionColumnHide or (ZL.opt.startBtnHide and ZL.opt.pauseBtnHide and ZL.opt.countdownBtnHide and
            ZL.opt.packageBtnHide and ZL.opt.reverseBidBtnHide and ZL.opt.syncBtnHide and ZL.opt.delAuctionBtnHide)) then
                --都隐藏
                functionHeaderBtn:Hide()
                startbidHeaderBtn:Hide()
                bidHeaderBtn:Hide()
            elseif (not ZL.opt.bidColumnHide) and
            (ZL.opt.startbidColumnHide or (ZL.opt.startBidHide and ZL.opt.inrementHide)) and
            (ZL.opt.functionColumnHide or (ZL.opt.startBtnHide and ZL.opt.pauseBtnHide and ZL.opt.countdownBtnHide and
            ZL.opt.packageBtnHide and ZL.opt.reverseBidBtnHide and ZL.opt.syncBtnHide and ZL.opt.delAuctionBtnHide)) then
                --只显示出价列
                functionHeaderBtn:Hide()
                startbidHeaderBtn:Hide()
                if width < totalWidth + bidColumnWidth then
                    bidHeaderBtn:Hide()
                else
                    bidHeaderBtn:Show()
                end
            elseif (ZL.opt.bidColumnHide or (ZL.opt.bidEditBoxHide and ZL.opt.bidBtnHide and ZL.opt.bidCountsHide)) and
            (not ZL.opt.startbidColumnHide) and
            (ZL.opt.functionColumnHide or (ZL.opt.startBtnHide and ZL.opt.pauseBtnHide and ZL.opt.countdownBtnHide and
            ZL.opt.packageBtnHide and ZL.opt.reverseBidBtnHide and ZL.opt.syncBtnHide and ZL.opt.delAuctionBtnHide)) then
                --只显示起拍价/加价列
                functionHeaderBtn:Hide()
                bidHeaderBtn:Hide()
                if width < totalWidth + startbidColumnWidth then
                    startbidHeaderBtn:Hide()
                else
                    startbidHeaderBtn:Show()
                end
            elseif (ZL.opt.bidColumnHide or (ZL.opt.bidEditBoxHide and ZL.opt.bidBtnHide and ZL.opt.bidCountsHide)) and
            (ZL.opt.startbidColumnHide or (ZL.opt.startBidHide and ZL.opt.inrementHide)) and
            (not ZL.opt.functionColumnHide) then
                --只显示功能按钮列
                bidHeaderBtn:Hide()
                startbidHeaderBtn:Hide()
                if width < totalWidth + functionColumnWidth then
                    functionHeaderBtn:Hide()
                else
                    functionHeaderBtn:Show()
                end
            elseif (not ZL.opt.bidColumnHide) and (not ZL.opt.startbidColumnHide) and
            (ZL.opt.functionColumnHide or (ZL.opt.startBtnHide and ZL.opt.pauseBtnHide and ZL.opt.countdownBtnHide and
            ZL.opt.packageBtnHide and ZL.opt.reverseBidBtnHide and ZL.opt.syncBtnHide and ZL.opt.delAuctionBtnHide)) then
                --显示出价和起拍价/加价列
                local width1 = totalWidth + startbidColumnWidth + bidColumnWidth
                local width2 = totalWidth + bidColumnWidth
                functionHeaderBtn:Hide()
                if width >= width1 then
                    --显示出价和起拍价/加价列
                    startbidHeaderBtn:Show()
                    bidHeaderBtn:Show()
                elseif width >= width2 and width < width1 then
                    --显示出价列
                    startbidHeaderBtn:Hide()
                    bidHeaderBtn:Show()
                else
                    --都隐藏
                    startbidHeaderBtn:Hide()
                    bidHeaderBtn:Hide()
                end
            elseif (not ZL.opt.bidColumnHide) and
            (ZL.opt.startbidColumnHide or (ZL.opt.startBidHide and ZL.opt.inrementHide)) and
            (not ZL.opt.functionColumnHide) then
                --显示出价和功能按钮列
                local width1 = totalWidth + bidColumnWidth + functionColumnWidth
                local width2 = totalWidth + bidColumnWidth
                startbidHeaderBtn:Hide()
                if width >= width1 then
                    --显示出价和功能按钮列
                    functionHeaderBtn:Show()
                    bidHeaderBtn:Show()
                elseif width >= width2 and width < width1 then
                    --显示出价
                    functionHeaderBtn:Hide()
                    bidHeaderBtn:Show()
                else
                    --都隐藏
                    functionHeaderBtn:Hide()
                    bidHeaderBtn:Hide()
                end
            elseif (ZL.opt.bidColumnHide or (ZL.opt.bidEditBoxHide and ZL.opt.bidBtnHide and ZL.opt.bidCountsHide)) and
            (not ZL.opt.startbidColumnHide) and (not ZL.opt.functionColumnHide) then
                --显示起拍价/加价和功能按钮列
                local width1 = totalWidth + startbidColumnWidth + functionColumnWidth
                local width2 = totalWidth + startbidColumnWidth
                bidHeaderBtn:Hide()
                if width >= width1 then
                    --显示起拍价/加价和功能按钮列
                    startbidHeaderBtn:Show()
                    functionHeaderBtn:Show()
                elseif width >= width2 and width < width1 then
                    --显示起拍价列
                    functionHeaderBtn:Hide()
                    startbidHeaderBtn:Show()
                else
                    --都隐藏
                    startbidHeaderBtn:Hide()
                    functionHeaderBtn:Hide()
                end
            elseif (not ZL.opt.bidColumnHide) and (not ZL.opt.startbidColumnHide) and (not ZL.opt.functionColumnHide) then
                --全部显示
                local width1 = totalWidth + functionColumnWidth + startbidColumnWidth + bidColumnWidth
                local width2 = totalWidth + startbidColumnWidth + bidColumnWidth
                local width3 = totalWidth + bidColumnWidth
                if width >= width1 then
                    --全部显示
                    functionHeaderBtn:Show()
                    startbidHeaderBtn:Show()
                    bidHeaderBtn:Show()
                elseif width >= width2 and width < width1 then
                    --显示出价和起拍价
                    functionHeaderBtn:Hide()
                    startbidHeaderBtn:Show()
                    bidHeaderBtn:Show()
                elseif width >= width3 and width < width2 then
                    --显示出价列
                    functionHeaderBtn:Hide()
                    startbidHeaderBtn:Hide()
                    bidHeaderBtn:Show()
                else
                    --都隐藏
                    functionHeaderBtn:Hide()
                    startbidHeaderBtn:Hide()
                    bidHeaderBtn:Hide()
                end
            end
        else
            --不是ML，出价列和功能按钮列都是强制隐藏
            functionHeaderBtn:Hide()
            startbidHeaderBtn:Hide()
            if (ZL.opt.bidColumnHide or (ZL.opt.bidEditBoxHide and ZL.opt.bidBtnHide and ZL.opt.bidCountsHide)) then
                --都隐藏
                bidHeaderBtn:Hide()
            else
                local width1 = totalWidth + bidColumnWidth
                if width >= width1 then
                    --显示出价列
                    bidHeaderBtn:Show()
                else
                    --都隐藏
                    bidHeaderBtn:Hide()
                end
            end

        end
        if startbidHeaderBtn:IsShown() then
            startbidHeaderBtn:ClearAllPoints()
            if functionHeaderBtn:IsShown() then
                startbidHeaderBtn:SetPoint("TOPRIGHT", functionHeaderBtn, "TOPLEFT", 1, 0)
            else
                startbidHeaderBtn:SetPoint("TOPRIGHT", AuctionFrame.TitleBottom, "BOTTOMRIGHT", -20, -titleBottomGapHeight)
            end
        end
        bidderHeaderBtn:ClearAllPoints()
        bidderHeaderBtn:SetPoint("TOPLEFT", iconHeaderBtn, "TOPRIGHT", -1, 0)
        if bidHeaderBtn:IsShown() then
            bidHeaderBtn:ClearAllPoints()
            if startbidHeaderBtn:IsShown() then
                bidHeaderBtn:SetPoint("TOPRIGHT", startbidHeaderBtn, "TOPLEFT", 1, 0)
            elseif functionHeaderBtn:IsShown() then
                bidHeaderBtn:SetPoint("TOPRIGHT", functionHeaderBtn, "TOPLEFT", 1, 0)
            else
                bidHeaderBtn:SetPoint("TOPRIGHT", AuctionFrame.TitleBottom, "BOTTOMRIGHT", -20, -titleBottomGapHeight)
            end

            bidderHeaderBtn:SetPoint("BOTTOMRIGHT", bidHeaderBtn, "BOTTOMLEFT", 1, 0)
        elseif startbidHeaderBtn:IsShown() then
            bidderHeaderBtn:SetPoint("BOTTOMRIGHT", startbidHeaderBtn, "BOTTOMLEFT", 1, 0)
        elseif functionHeaderBtn:IsShown() then
            bidderHeaderBtn:SetPoint("BOTTOMRIGHT", functionHeaderBtn, "BOTTOMLEFT", 1, 0)
        else
            bidderHeaderBtn:SetPoint("TOPRIGHT", AuctionFrame.TitleBottom, "BOTTOMRIGHT", -20, -titleBottomGapHeight)
        end
    end
    AuctionFrame.scrollFrame:SetScript("OnSizeChanged", function (self, width)
        AuctionFrameSizeChange(width)
    end)
    function AuctionFrame:CountDown(_index)
        local curAuction = ZL_CURRENT.auctionlist[_index]
        local Frame1 = AuctionFrame.entries[_index]
        local sb = Frame1.infoFrame.sb
        local timeString = sb.timeString
        if curAuction.isPaused then
            timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            timeString:SetText("|cffff0000暂停中|r")
            return
        end
        local itemId = curAuction.itemId
        local itemlink = curAuction.itemlink
        local itemindex = curAuction.itemindex
        local countdownremaining = (curAuction.endTime or 0) - time()
        local bidderlist = curAuction.bidderlist
        countdownremaining = countdownremaining > 0 and countdownremaining  or 0
        sb:SetValue(countdownremaining)
        local isCandidate = ZL.IsCandidate(_index)
        if isCandidate then
            timeString:SetText(ConvertSecondsToTime(countdownremaining))
        else
            timeString:SetText("|cffff0000无法竞拍|r")
        end
        if countdownremaining > 59 then
            timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            timeString:SetTextColor(0.95, 0.95, 0.95, 1)
            sb:SetStatusBarColor(0.02, 0.69, 0.15)
        elseif countdownremaining > 5 then
            if isCandidate then
                timeString:SetFont(GameFontNormal:GetFont(), 18, "OUTLINE")
            else
                timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            end
            timeString:SetTextColor(1, 0.82, 0, 1)
            sb:SetStatusBarColor(1, 0, 0)
        elseif countdownremaining > 0 then
            if isCandidate then
                timeString:SetFont(GameFontNormal:GetFont(), 18, "OUTLINE")
            else
                timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            end
            timeString:SetTextColor(1, 0.82, 0, 1)
            sb:SetStatusBarColor(1, 0, 0)
            -- 5秒倒数
            local msgStr = ""
            tableSort(bidderlist)
            if #bidderlist > 0 then
                local totalBidCount = 0
                for _, bidData in ipairs(bidderlist) do
                    if totalBidCount < curAuction.itemCount then
                        local count = bidData["bidCount"] or 1
                        local newTotalBidCount = totalBidCount + count
                        if newTotalBidCount > curAuction.itemCount then
                            count = curAuction.itemCount - totalBidCount
                        end
                        if ZL_CURRENT.globalConfig.auctionMode == "|cffff0000匿名|r" then
                            if count  > 1 then
                                msgStr = msgStr .. "匿名(" .. bidData.bidamount .. "x" .. count .. ")，"
                            else
                                msgStr = msgStr .. "匿名(" .. bidData.bidamount .. ")，"
                            end
                        else
                            if count  > 1 then
                                msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. "x" .. count .. ")，"
                            else
                                msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. ")，"
                            end
                        end
                        totalBidCount = newTotalBidCount
                    else
                        break
                    end
                end
                if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                    msgStr = ("%s倒数：%d"):format(msgStr, countdownremaining)
                else
                    msgStr = ("%s%s倒数：%d"):format(curAuction.itemlink, msgStr, countdownremaining)
                end
            else
                if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                    msgStr = ("无人出价，倒数：%d" ):format(countdownremaining)
                else
                    msgStr = ("%s无人出价，倒数：%d" ):format(curAuction.itemlink, countdownremaining)
                end
            end
            ZL.Print(msgStr)
            if PlayerIsML() then
                SendChatMessage(msgStr, ZL.MsgChannel())
            end
            if ZL.opt.IsVoiceReminder and (((not ZL_CURRENT.globalConfig) or (not ZL_CURRENT.globalConfig.YYSound)) or PlayerIsML()) then
                C_VoiceChat.StopSpeakingText()
                PlaySoundFile("Interface\\AddOns\\" .. addonName .. "\\sound\\" .. ZL.SoundType .. "\\count\\" .. tostring(countdownremaining) .. ".mp3", "Master")
            end
        else
            if Frame1.countDownTimer then
                Frame1.countDownTimer:Cancel()
                Frame1.countDownTimer = nil
            end
            curAuction.confirmBid = nil
            curAuction.endTime = nil
            curAuction.index = nil
            timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            timeString:SetTextColor(0.95, 0.95, 0.95, 1)
            sb:SetStatusBarColor(0.02, 0.69, 0.15)
            local msgStr = ""
            local info
            if bidderlist and #bidderlist > 0 then --如果有人出价
                tableSort(bidderlist)
                local isSelf = false
                local failedSpawnUIDList = {}
                local successSpawnUIDList = {}
                local successBidderList = {}
                local successBidderCount = 0
                local successIndex
                if PlayerIsML() then
                    --如果出价大于1万，则下次起拍价不低于5000 , 大于2W，下次不低于1W，作者定制专用
                    if bidderlist[1].bidamount >= 10000 and PlayerIsML() and ZL.opt.autoAddStartBid then
                        local startbid = 5000
                        if bidderlist[1].bidamount >= 20000 then
                            startbid = 10000
                        end
                        local increment = 100
                        local isExist = false
                        for index, data in ipairs(ZL_SETTING.itemIdSetting) do
                            if data.itemId == itemId then
                                isExist = true
                                if (data.startbid < 5000 and startbid == 5000) or (data.startbid < 10000 and startbid == 10000) then
                                    ZL_SETTING.itemIdSetting[index].startbid = startbid
                                end
                            end
                        end
                        if not isExist then
                            local function func(itemlink)
                                table.insert(ZL_SETTING.itemIdSetting, {itemId=itemId, startbid=startbid, increment=increment, itemlink=itemlink})
                                ZL.ItemSettingFrame.itemIdFrame:Update()
                            end
                            LoadItemDataByID(itemId, func)
                        end
                    end
                end
                for _successIndex, bidData in ipairs(bidderlist) do
                    if successBidderCount < curAuction.itemCount then
                        local count = bidData["bidCount"] or 1
                        if (successBidderCount + count) >= curAuction.itemCount then
                            count = curAuction.itemCount - successBidderCount
                            ZL_CURRENT.auctionlist[_index].bidderlist[_successIndex].bidCount = count
                        end
                        successIndex = _successIndex
                        successBidderCount = successBidderCount + count
                        if PlayerIsML(bidData.bidder) then
                            isSelf = true
                            --ML拍到的物品直接记录到已支付
                            if not ZL_CURRENT.playerPayToML then ZL_CURRENT.playerPayToML = {} end
                            local oldPayToML = ZL_CURRENT.playerPayToML[bidData.bidder] and ZL_CURRENT.playerPayToML[bidData.bidder] or 0
                            ZL_CURRENT.playerPayToML[bidData.bidder] = oldPayToML + bidData.bidamount*bidData.bidCount
                            ZL.AuctionRecordFrame.playerBalanceFrame:Update()
                        end
                        if count == 1 then
                            msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. ")，"
                        else
                            msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. "x" .. count .. ")，"
                        end
                        --判断获胜者可以交易哪几个物品
                        if curAuction["spawnUID"] and next(curAuction["spawnUID"], nil) then
                            local linshiList = {[bidData.bidder]={}}
                            for key, spawnData in pairs(curAuction["spawnUID"]) do
                                if (not spawnData["candidates"]) or (not next(spawnData["candidates"], nil)) or (spawnData["candidates"][bidData.bidder] == true) then
                                    table.insert(linshiList[bidData.bidder], key)
                                end
                            end
                            linshiList.spawnUIDCount = #linshiList[bidData.bidder]
                            table.insert(successBidderList, linshiList)
                        end
                    else
                        break
                    end
                end
                curAuction = ZL_CURRENT.auctionlist[_index]
                --按照可交易物品数量升序排列，交易物品数量少的优先选择
                table.sort(successBidderList, function (a, b)
                    return a.spawnUIDCount < b.spawnUIDCount
                end)
                --将获胜者数据添加到收支数据库
                local tradeId = tostring(curAuction.itemId) .. tostring(time())
                ZL_CURRENT.auctionlist[_index].tradeId = tradeId
                local stackCount = curAuction.stackCount
                local itmeGUIDUsedList = {}
                if not ZL_CURRENT["IncomeList"] then ZL_CURRENT["IncomeList"] = {} end
                for i = 1, successIndex do
                    local itemGUID
                    local name = bidderlist[i].bidder
                    local bidCount = bidderlist[i].bidCount
                    local hasCount = 0
                    if #successBidderList > 0 then
                        for _, data in ipairs(successBidderList) do
                            local isBreak
                            if data[name] and #data[name] > 0 then
                                for _, spawnkey in ipairs(data[name]) do
                                    local spawnData = curAuction["spawnUID"][spawnkey]
                                    if stackCount == 1 then
                                        if not spawnData["successBidder"] then
                                            spawnData["successBidder"] = {
                                                [name] = {
                                                    count = 1,
                                                    amount = bidderlist[i]["bidamount"], --因为数量是1，所以要填单价
                                                },
                                            }
                                            for key, value in pairs(spawnData["itemGUID"]) do
                                                if not itmeGUIDUsedList[key] then
                                                    itemGUID = key
                                                    itmeGUIDUsedList[key] = true
                                                    value["isUsed"] = name
                                                    break
                                                end
                                            end
                                            hasCount = hasCount + 1
                                        end
                                    else
                                        --堆叠数大于1，拾取绑定的物品目前是橙片，会提前分配给获胜者
                                        --堆叠数大于1，统一放在“其他”里面，只有一个spawnkey
                                        if not spawnData["successBidder"] then spawnData["successBidder"] = {} end
                                        spawnData["successBidder"][name] = {
                                            count = bidCount,
                                            amount = bidderlist[i]["bidamount"] * bidCount,
                                        }
                                        for key, value in pairs(spawnData["itemGUID"]) do
                                            if not itmeGUIDUsedList[key] then
                                                itemGUID = key
                                                itmeGUIDUsedList[key] = true
                                                value["isUsed"] = name
                                                break
                                            end
                                        end
                                        local bagID, slotIndex = ZL.FindItemInBag(itemGUID)
                                        if bagID and slotIndex then
                                            info = C_Container.GetContainerItemInfo(bagID, slotIndex)
                                            hasCount = hasCount + info.stackCount
                                        end
                                    end
                                    if hasCount >= bidCount then
                                        --如果已经分配的数量大于竞拍数量，需要将此堆物品进行分堆，待完善
                                        isBreak = true
                                        break
                                    end
                                end
                            end
                            if isBreak then break end
                        end
                    end
                    curAuction = ZL_CURRENT.auctionlist[_index]
                    local itemList = {}
                    if curAuction.itemlink == "[打包拍卖]" then
                        itemList = curAuction.itemList
                        for _itemlink, _ in pairs(itemList) do
                            itemList[_itemlink].isTraded = (curAuction.itemId==45038 or curAuction.itemId==50274 or PlayerIsML(name)) and true or false
                        end
                    else
                        local itemGUIDList = {}
                        local spawnUIDList = {}
                        for key, value in pairs(curAuction["spawnUID"]) do
                            if value["successBidder"] and value["successBidder"][name] then
                                if not spawnUIDList[key] then spawnUIDList[key]= {} end
                                spawnUIDList[key]["bossName"] = value["bossName"]
                                if value["itemGUID"] and next(value["itemGUID"], nil) then
                                    for itemGUID_key, itemGUID_value in pairs(value["itemGUID"]) do
                                        if itemGUID_value["isUsed"] == name then
                                            table.insert(itemGUIDList, itemGUID_key)
                                        end
                                    end
                                end
                            end
                        end
                        itemList[itemlink] = {
                            itemCount = bidderlist[i].bidCount,
                            stackCount = curAuction.stackCount,
                            itemindex = {itemindex},
                            itemGUID = itemGUIDList,
                            spawnUID = spawnUIDList,
                            isTraded = (curAuction.itemId==45038 or curAuction.itemId==50274 or PlayerIsML(name)) and true or false,
                        }
                    end
                    table.insert(ZL_CURRENT["IncomeList"], {
                        player=name, amount=bidderlist[i].bidamount*bidderlist[i].bidCount, notes=itemlink,
                        tradeId = tradeId, itemList = itemList,itemCount = bidderlist[i].bidCount
                    })
                end
                ZL.AuctionRecordFrame.currentIncomeFrame:Update()
                ZL.AuctionRecordFrame.playerBalanceFrame:Update()
                if PlayerIsML() and isSelf then
                    local selfList = {}
                    for _, value in pairs(curAuction["spawnUID"]) do
                        if value["itemGUID"] and next(value["itemGUID"], nil) then
                            for itemGUID_key, itemGUID_value in pairs(value["itemGUID"]) do
                                if itemGUID_value.isUsed == GetClassColorName(UnitName("player")) then
                                    --将自己拍卖到的物品添加到数据库，交易剩余时间提醒的时候过滤
                                    if not ZL_CURRENT.SelfAuction then ZL_CURRENT.SelfAuction = {} end
                                    ZL_CURRENT.SelfAuction[itemGUID_key] = true
                                    tinsert(selfList, itemGUID_key)
                                end
                            end
                        end
                    end
                    local selfIndex = 1
                    --自己拍卖到的物品放到指定背包
                    local function linshi()
                        if selfIndex <= #selfList then
                            if not (InCombatLockdown() or UnitIsDeadOrGhost("player")) then
                                local itemGUID_key = selfList[selfIndex]
                                ZL.PutAuctionItemInBag(itemGUID_key, ZL.opt.selfBagId, ZL.opt.selfDirection)
                                selfIndex = selfIndex + 1
                                
                            end
                            C_Timer.After(0.5, linshi)
                        end
                    end
                    linshi()
                end
                --如果获胜物品总数小于拍卖物品数量则拆单，没拍卖的创建流拍
                if successBidderCount < curAuction.itemCount then
                    if stackCount == 1 then
                        for key, value in pairs(curAuction["spawnUID"]) do
                            if (not value["successBidder"]) or (value["successBidder"] and (not next(value["successBidder"], nil))) then
                                failedSpawnUIDList[key] = {
                                    ["bossName"] = value["bossName"],
                                    ["itemGUID"] = value["itemGUID"],
                                }
                            else
                                successSpawnUIDList[key] = value
                            end
                        end
                    else
                        for key, value in pairs(curAuction["spawnUID"]) do
                            if not failedSpawnUIDList[key] then failedSpawnUIDList[key] = {["bossName"] = value["bossName"], ["itemGUID"]={}} end
                            if value["itemGUID"] and next(value["itemGUID"], nil) then
                                for itemGUID_key, itemGUID_value in pairs(value["itemGUID"]) do
                                    if not itemGUID_value["isUsed"] then
                                        failedSpawnUIDList[key]["itemGUID"][itemGUID_key] = {}
                                    end
                                end
                            end
                            successSpawnUIDList[key] = value
                            if successSpawnUIDList[key]["itemGUID"] and next(successSpawnUIDList[key]["itemGUID"], nil) then
                                for _, itemGUID_value in pairs(successSpawnUIDList[key]["itemGUID"]) do
                                    if not itemGUID_value["isUsed"] then
                                        itemGUID_value = nil
                                    end
                                end
                            end
                        end
                    end

                    local liuPaiItemCount = curAuction.itemCount - successBidderCount
                    local sendData = {type="拍卖拆单", data={}, globalConfigData = ZL.globalConfigData()}
                    local data = {}
                    ZL_CURRENT.auctionlist[_index].state = "success"
                    ZL_CURRENT.auctionlist[_index].endTime = nil
                    ZL_CURRENT.auctionlist[_index].itemCount = successBidderCount
                    ZL_CURRENT.auctionlist[_index].spawnUID = successSpawnUIDList
                    Frame1:SetValues(_index)
                    data = {
                        type = "拍卖成功",
                        data2 = ZL_CURRENT.auctionlist[_index],
                    }
                    table.insert(sendData.data, data)
                    --开始创建流拍拍卖记录
                    local _itemindex
                    if ZL_CURRENT.auctionlist and (#ZL_CURRENT.auctionlist > 0) then
                        for _, _data in ipairs(ZL_CURRENT.auctionlist) do
                            if (_data.itemlink == itemlink) then
                                _itemindex = _data.itemindex
                            end
                        end
                    end
                    _itemindex = _itemindex and (_itemindex + 1) or 1
                    local data2 = ZL_CURRENT.auctionlist[_index]
                    data = {
                        type = "流拍",
                        data2 = {
                            ["type"] = data2.type,
                            ["itemId"] = data2.itemId,
                            ["itemlink"] = data2.itemlink,
                            ["itemindex"] = _itemindex,
                            ["itemCount"] = liuPaiItemCount,
                            ["itemLevel"] = data2.itemLevel,
                            ["bindType"] = data2.bindType,
                            ["startbidamount"] = data2.startbidamount,
                            ["bidIncrement"] = data2.bidIncrement,
                            ["state"] = "failed",
                            ["endTime"] = data2.endTime,
                            ["isPaused"] = data2.isPaused,
                            ["stackCount"] = data2.stackCount,
                            ["spawnUID"] = failedSpawnUIDList,
                            ["bidderlist"] = {},
                            ["sourceGUID"] = data2.sourceGUID,
                            ["tradeId"] = nil,
                            ["lgnore"] = false,
                            ["itemSubType"] = data2.itemSubType,
                            ["createTime"] = date("%Y-%m-%d %H:%M:%S", GetServerTime()),
                        },
                    }
                    table.insert(ZL_CURRENT.auctionlist, data.data2)
                    local itemGUIDList = {}
                    curAuction= ZL_CURRENT.auctionlist[#ZL_CURRENT.auctionlist]
                    for _, value in pairs(curAuction["spawnUID"]) do
                        if value["itemGUID"] and next(value["itemGUID"], nil) then
                            for itemGUID_key in pairs(value["itemGUID"]) do
                                table.insert(itemGUIDList, itemGUID_key)
                            end
                        end
                    end
                    --开始同步给其他团员
                    table.insert(sendData.data, data)
                    msgStr = ("%s%d个拍卖成功！获胜者：%s祝贺！%d个流拍！"):format(itemlink, successBidderCount, msgStr, liuPaiItemCount)
                    if PlayerIsML() then
                        --将流拍物品放到指定背包
                        ZL.reportFailedItem(true)
                    end
                else
                    ZL_CURRENT.auctionlist[_index].state = "success"
                    ZL_CURRENT.auctionlist[_index].endTime = nil
                    msgStr = ("%s拍卖成功！获胜者：%s祝贺！"):format(itemlink, msgStr)
                end
                if PlayerIsML() then
                    SendChatMessage(msgStr, ZL.MsgChannel())
                end
                ZL.Print(msgStr)
                if ZL.opt.IsVoiceReminder and (((not ZL_CURRENT.globalConfig) or (not ZL_CURRENT.globalConfig.YYSound)) or PlayerIsML()) then
                    C_VoiceChat.StopSpeakingText()
                    PlaySoundFile("Interface\\AddOns\\" .. addonName .. "\\sound\\" .. ZL.SoundType .. "\\拍卖成功.mp3", "Master")
                end
                timeString:SetText("|cff00FF00成功|r")
            else
                ZL_CURRENT.auctionlist[_index].state = "failed"
                ZL_CURRENT.auctionlist[_index].endTime = nil
                timeString:SetText("|cffff0000流拍|r")
                ZL.Print(itemlink .. "已流拍")
                if ZL.opt.IsVoiceReminder and (((not ZL_CURRENT.globalConfig) or (not ZL_CURRENT.globalConfig.YYSound)) or PlayerIsML()) then
                    C_VoiceChat.StopSpeakingText()
                    PlaySoundFile("Interface\\AddOns\\" .. addonName .. "\\sound\\" .. ZL.SoundType .. "\\物品已流拍.mp3", "Master")
                end
                if PlayerIsML() then
                    ZL.reportFailedItem(true)
                    msgStr = ("%s 已流拍！"):format(itemlink)
                    SendChatMessage(msgStr, ZL.MsgChannel())
                end
            end
            ZL.AuctionListSort()
            if info then info = nil end
            if ZL.DisenchantingFrame and (not ZL.DisenchantingFrame.hasSpellcastSucceeded) and ZL.DisenchantingFrame:IsShown() then
                ZL.DisenchantingFrame:Update()
            end
            if PlayerIsML() and (not ZL_CURRENT.globalConfig.allowMultipleAuctions) then _G["ZL_NewAuctionFrameTab5"]:Click() end
        end
    end
    function AuctionFrame:Update()
        local height = 0
        local auctionMode
        if IsInRaid(1) then
            if ZL_CURRENT.globalConfig and ZL_CURRENT.globalConfig.auctionMode then
                auctionMode = ZL_CURRENT.globalConfig.auctionMode
            else
                auctionMode = ZL.opt.auctionMode
            end
        else
            auctionMode = ZL.opt.auctionMode
        end
        auctionModeDropdown:SetDefaultText(auctionMode)
        if PlayerIsML() then
            auctionModeDropdown:Enable()
        else
            auctionModeDropdown:Disable()
        end
        for _, f in ipairs(AuctionFrame.entries) do f:Hide() end
        if ZL_CURRENT.auctionlist and (#ZL_CURRENT.auctionlist > 0) then
            for num, data in ipairs(ZL_CURRENT.auctionlist) do
                local f = self.entries[num]
                f:SetValues(num)
                if ItemAuctionFrameIsShown(data) then
                    f:Show()
                    zlHighlightOnHide(num)
                    f:SetPoint("TOPLEFT", content, "TOPLEFT", 3, -1-height)
                    f:SetPoint("BOTTOMRIGHT", content, "TOPRIGHT", -1, -47-height)
                    if PlayerIsML() and (not data.lgnore) and (not data.isPackage) and data.bindType == 1 and data.stackCount == 1 then -- and data.state == "waiting"
                        f.infoFrame.checkBtn:Show()
                    else
                        f.infoFrame.checkBtn:SetChecked(false)
                        f.infoFrame.checkBtn:Hide()
                    end
                    height = height + f:GetHeight()
                end
            end
        end
        height = height > 0 and height or 50
        content:SetSize(AuctionFrame.scrollFrame:GetWidth()-AuctionFrame.scrollFrame.ScrollBar:GetWidth(), height)
        ZL.FloatAuctionFrame:Hide()
        if ZL.opt.ZLAuctionFrameTabId ~= 1 and GetAuctioningCount() >= 1 then
            StateFrame.AuctioningBtn.SpellHighlightTexture:Show()
            StateFrame.AuctioningBtn.SpellHighlightAnim:Play()
        else
            StateFrame.AuctioningBtn.SpellHighlightTexture:Hide()
            StateFrame.AuctioningBtn.SpellHighlightAnim:Stop()
        end
        AuctionFrameSizeChange(AuctionFrame:GetWidth())
    end
end

function ZL:CreateWAStringFrame()
    ZL.WaStringFrame = ZLCreateFrame(nil, nil, nil, nil, nil, true, true)
    local WaStringFrame = ZL.WaStringFrame
    WaStringFrame:SetPoint("CENTER")
    WaStringFrame:SetResizable(false)
    WaStringFrame:SetSize(GetScreenWidth()-100, GetScreenHeight()-100)
    WaStringFrame.resizeButton:Hide()
    --创建滚动条
    WaStringFrame.scrollFrame = CreateFrame("ScrollFrame", nil, WaStringFrame, "UIPanelScrollFrameTemplate")
    WaStringFrame.scrollFrame:SetFrameLevel(WaStringFrame:GetFrameLevel() + 1) -- 设置为比父框架高1级
    WaStringFrame.scrollFrame:SetPoint("TOPLEFT", WaStringFrame.TitleBottom, "BOTTOMLEFT", 0, -2)
    WaStringFrame.scrollFrame:SetPoint("BOTTOMRIGHT", WaStringFrame, "BOTTOMRIGHT", 0, 2)
    WaStringFrame.scrollFrame:SetClipsChildren(true) --必须设置为true，scrollFrame所有的子元素才会被剪切
    WaStringFrame.scrollFrame:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel) --重设滑动条鼠标滚轮事件
    --重设ScrollBar位置，放置到scrollFrame内，防止被剪切掉
    WaStringFrame.scrollFrame.ScrollBar:ClearAllPoints()
    WaStringFrame.scrollFrame.ScrollBar:SetPoint("TOPLEFT", WaStringFrame.scrollFrame, "TOPRIGHT", -10, -16)
    WaStringFrame.scrollFrame.ScrollBar:SetPoint("BOTTOMRIGHT", WaStringFrame.scrollFrame, "BOTTOMRIGHT", -10, 15)

    WaStringFrame.scrollFrame.editBox = CreateFrame("EditBox", nil, WaStringFrame.scrollFrame)
    local editBox = WaStringFrame.scrollFrame.editBox
    editBox:SetPoint("TOPLEFT", WaStringFrame.scrollFrame, "TOPLEFT", 0, 0)
    editBox:SetSize(WaStringFrame.scrollFrame:GetWidth()-20, 100)
    WaStringFrame.scrollFrame:SetScrollChild(editBox)
    editBox:EnableMouse(true)
    editBox:SetAutoFocus(true)
    editBox:SetMultiLine(true)
    editBox:HighlightText()
    editBox:SetCursorPosition(0)
    editBox:SetTextInsets(4, 4, 0, 0)
    editBox:SetFont(GameFontNormal:GetFont(), 12, "")
    editBox:SetTextColor(0.95, 0.95, 0.95)
end
--创建显示拍卖主窗口的框架
function ZL:CreateMaxAuctionFrame()
    ZL.maxFrame = CreateFrame("Frame", "AuctionFrameMaxFrame", self) --BackdropTemplate
    local maxFrame = ZL.maxFrame
    maxFrame:SetPoint("CENTER")
    maxFrame:SetSize(80, 18)
    maxFrame:SetFrameStrata("DIALOG")
    maxFrame:SetClampedToScreen(true)  --不能超出游戏屏幕，false可以超出游戏屏幕
    maxFrame:SetMovable(true)
    maxFrame:SetScript("OnMouseUp", function (self)
        self:StopMovingOrSizing()
        if not ZL.db.global.ZLAuctionFrameMaxFrame then ZL.db.global.ZLAuctionFrameMaxFrame = {} end
        ZL.db.global.ZLAuctionFrameMaxFrame.point, _, ZL.db.global.ZLAuctionFrameMaxFrame.relative, ZL.db.global.ZLAuctionFrameMaxFrame.x, ZL.db.global.ZLAuctionFrameMaxFrame.y = self:GetPoint()
    end)
    maxFrame:SetScript("OnMouseDown", function (self)
        self:StartMoving()
    end)
    maxFrame:ClearAllPoints()
    if ZL.db.global.ZLAuctionFrameMaxFrame and ZL.db.global.ZLAuctionFrameMaxFrame.point then
        maxFrame:SetPoint(ZL.db.global.ZLAuctionFrameMaxFrame.point, UIParent, ZL.db.global.ZLAuctionFrameMaxFrame.relative, ZL.db.global.ZLAuctionFrameMaxFrame.x, ZL.db.global.ZLAuctionFrameMaxFrame.y)
    else
        maxFrame:SetPoint("CENTER")
    end
    maxFrame.ag = maxFrame:CreateAnimationGroup()
    maxFrame.anim = maxFrame.ag:CreateAnimation("Alpha")
    local anim = maxFrame.anim
    anim:SetOrder(1)
    anim:SetFromAlpha(0.1)
    anim:SetToAlpha(1)
    anim:SetDuration(1.2)
    maxFrame.ag:SetToFinalAlpha(1)
    maxFrame.ag:SetLooping("BOUNCE")

    maxFrame.maxBtn = CreateFrame("Button", "AuctionFrameMinmaxBtn", maxFrame, BackdropTemplateMixin and "BackdropTemplate")
    local maxBtn = maxFrame.maxBtn
    maxBtn:SetPoint("RIGHT", maxFrame, "RIGHT")
    maxBtn:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up")
    maxBtn:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight")
    maxBtn:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-DOWN")
    maxBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    maxBtn:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            if IsShiftKeyDown() then
                ZL.opt.maxFrameFlashingReminder = false
                if ZL.maxFrame.ag:IsPlaying() then
                    ZL.maxFrame.ag:Stop()
                end
            else
                maxFrame:Hide()
                ZL.AuctionFrame2:Show()
                ZL.opt.ZLAuctionFrameIsShown = true
            end
        elseif button == "RightButton" then
            if IsShiftKeyDown() then
                ZL.opt.maxFrameFlashingReminder = true
            end
        end
    end)
    maxBtn:SetScript("OnEnter", function(self)
        GameTooltipShow(self, "BottomRight", "TopRight")
        GameTooltip:AddLine("提示")
        GameTooltip:AddLine("左键点击：|cffffffff打开拍卖窗口|r")
        GameTooltip:AddLine("shift+左键点击：|cffffffff不再闪烁提醒|r")
        GameTooltip:AddLine("shift+右键点击：|cffffffff有拍卖中物品时闪烁提醒|r")
        GameTooltip:Show()
    end)
    maxBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)
    maxFrame.fontString = maxFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
    maxFrame.fontString:SetPoint("RIGHT", maxBtn, "LEFT", 0, 0)
    maxFrame.fontString:SetText("拍卖清单")
    maxBtn:SetSize(15, maxFrame.fontString:GetHeight())
    maxFrame:SetScript("OnUpdate", function(self)
        local curAuctionList = ZL_CURRENT.auctionlist
        local count = 0
        if curAuctionList and #curAuctionList >= 1 then
            for _, data in ipairs(curAuctionList) do
                if (data.state == "auctioning") and (not data.lgnore) then
                    count = count + 1
                end
            end
        end
        if count == 0 then
            maxFrame.fontString:SetText("拍卖清单")
            if ZL.maxFrame.ag:IsPlaying() then
                ZL.maxFrame.ag:Stop()
            end
        else
            maxFrame.fontString:SetText("拍卖清单|cffffffff[" .. count .. "]|r")
            if ZL.opt.maxFrameFlashingReminder and (not ZL.maxFrame.ag:IsPlaying()) then
                ZL.maxFrame.ag:Play()
            end
        end
    end)
    -- if ZL.opt.ZLAuctionFrameIsShown then
    --     maxFrame:Hide()
    -- else
    --     maxFrame:Show()
    -- end
    if (not ZL.opt.ZLAuctionFrameIsShown) and (PlayerIsML() or IsInRaid(1) or (not ZL.opt.maxFrameHide)) then
        ZL.maxFrame:Show()
    else
        ZL.maxFrame:Hide()
    end
end

--创建显示交易剩余时间窗口
function ZL:CreateZLRemainingTradeTimeFrame()
    ZL.ZLRemainingTradeTimeFrame = CreateFrame("Frame", "ZLRemainingTradeTimeFrame", self, "BackdropTemplate")
    local ZLRemainingTradeTimeFrame = ZL.ZLRemainingTradeTimeFrame
    ZLRemainingTradeTimeFrame:SetSize(200, 50)
    ZLRemainingTradeTimeFrame:SetPoint("CENTER")
    ZLRemainingTradeTimeFrame:SetClampedToScreen(true)
    ZLRemainingTradeTimeFrame:SetFrameStrata("HIGH")
    ZLRemainingTradeTimeFrame:SetMovable(true)
    ZLRemainingTradeTimeFrame:SetScale(ZL.opt.ZLRemainingTradeTimeFrameScale)
    ZLRemainingTradeTimeFrame:SetScript("OnMouseDown", function(self) self:StartMoving() end)
    ZLRemainingTradeTimeFrame:SetScript("OnMouseUp", function(self) self:StopMovingOrSizing() end)
    
    ZLRemainingTradeTimeFrame.RemainingTradeTimeText = ZLRemainingTradeTimeFrame:CreateFontString()
    local RemainingTradeTimeText = ZLRemainingTradeTimeFrame.RemainingTradeTimeText
    RemainingTradeTimeText:SetFontObject(GameFontHighlightLarge)
    RemainingTradeTimeText:SetSize(200, 75)
    RemainingTradeTimeText:SetPoint("TOPLEFT", ZLRemainingTradeTimeFrame, "TOPLEFT")
    RemainingTradeTimeText:SetFont(GameFontNormal:GetFont(), 12)
    RemainingTradeTimeText:SetWordWrap(true)
    RemainingTradeTimeText:SetJustifyH("LEFT")

    if ZL.opt.remainingTradeTimeBtnValue then
        ZLRemainingTradeTimeFrame:Show()
    else
        ZLRemainingTradeTimeFrame:Hide()
    end
   
end
--创建物品拍卖设置框架
function ZL:CreateItemSettingFrame()
    ZL.ItemSettingFrame = CreateFrame("Frame", "ItemSettingFrame", ZL, "UIPanelDialogTemplate")
    local ItemSettingFrame = ZL.ItemSettingFrame
    ItemSettingFrame:SetSize(460, 350)
    ItemSettingFrame:SetPoint("CENTER", UIParent, "CENTER")
    ItemSettingFrame:SetFrameStrata("HIGH")
    ItemSettingFrame:SetClampedToScreen(true)  --不能超出游戏屏幕，false可以超出游戏屏幕
    ItemSettingFrame:SetMovable(true)
    ItemSettingFrame:SetHitRectInsets(0, 0, 0, ItemSettingFrameDialogBG:GetHeight()+3) --设置鼠标可点击区域
    ItemSettingFrame:SetScale(ZL.opt.ZLItemSettingFrameScale)
    ItemSettingFrame:SetScript("OnMouseUp", function (self)
        self:StopMovingOrSizing()
    end)
    ItemSettingFrame:SetScript("OnMouseDown", function (self)
        self:StartMoving()
    end)
    ItemSettingFrame:SetScript("OnShow", function (self)
        ZL.opt.ItemSettingFrameIsShown = true
        self.itemIdFrame:Update()
        self.itemLevelFrame:Update()
        self.filterFrame:Update()
    end)
    if WOW_PROJECT_ID ~= 1 then
        _G["ItemSettingFrameClose"]:ClearAllPoints()
        _G["ItemSettingFrameClose"]:SetPoint("TOPRIGHT", ItemSettingFrame, "TOPRIGHT", 2, 1)
    end
    -- ItemSettingFrame:SetScript("OnHide", function ()
    --     ZL.opt.ItemSettingFrameIsShown = false
    -- end)
    _G["ItemSettingFrameClose"]:HookScript("OnClick", function ()
        ZL.opt.ItemSettingFrameIsShown = false
    end)
    ItemSettingFrame.Title:SetText("物品拍卖设置")
    ItemSettingFrame:Hide()

    ItemSettingFrame.itemIdFrame = CreateFrame("Frame", nil, ItemSettingFrame)
    local itemIdFrame = ItemSettingFrame.itemIdFrame
    itemIdFrame:SetPoint("TOPLEFT", ItemSettingFrameDialogBG, "TOPLEFT")
    itemIdFrame:SetSize(ItemSettingFrameDialogBG:GetWidth(), 50)
    
    itemIdFrame.itemIdEditbox = CreateFrame("EditBox", "itemIdFrameitemIdEditbox", itemIdFrame, "InputBoxTemplate")
    local itemIdEditbox = itemIdFrame.itemIdEditbox
    itemIdEditbox:SetPoint("TOPLEFT", itemIdFrame, "TOPLEFT", 28, -5)
    itemIdEditbox:SetSize(60, 20)
    itemIdEditbox:SetAutoFocus(false)
    itemIdEditbox:SetFont(GameFontNormal:GetFont(), 12, "")
    itemIdEditbox:SetNumeric(true)
    itemIdEditbox:SetScript("OnEnterPressed", function ()
        itemIdFrame.SerchBtn:Click()
    end)
    itemIdEditbox:SetScript("OnMouseUp", function (self)
        if (select(1, GetCursorInfo())) == "item" then
            self:SetText(select(2, GetCursorInfo()))
            ClearCursor()
        end
    end)
    itemIdFrame.itemIdFont = itemIdFrame:CreateFontString()
    local itemIdFont = itemIdFrame.itemIdFont
    itemIdFont:SetPoint("TOP", itemIdEditbox, "BOTTOM", -2, -5)
    itemIdFont:SetFont(GameFontNormal:GetFont(), 12)
    itemIdFont:SetTextColor(1, 0.82, 0)
    itemIdFont:SetText("物品ID")
    itemIdFont:SetWordWrap(false)
    itemIdFont:SetJustifyH("LEFT")

    itemIdFrame.startBidEditbox = CreateFrame("EditBox", "itemIdFramestartBidEditbox", itemIdFrame, "InputBoxTemplate")
    local startBidEditbox = itemIdFrame.startBidEditbox
    startBidEditbox:SetPoint("LEFT", itemIdEditbox, "RIGHT", 10, 0)
    startBidEditbox:SetSize(55, 20)
    startBidEditbox:SetAutoFocus(false)
    startBidEditbox:SetFont(GameFontNormal:GetFont(), 12, "")
    startBidEditbox:SetNumeric(true)
    itemIdFrame.startBidFont = itemIdFrame:CreateFontString()
    local startBidFont = itemIdFrame.startBidFont
    startBidFont:SetPoint("TOP", startBidEditbox, "BOTTOM", -2, -5)
    startBidFont:SetFont(GameFontNormal:GetFont(), 12)
    startBidFont:SetTextColor(1, 0.82, 0)
    startBidFont:SetText("起拍价")
    startBidFont:SetWordWrap(false)
    startBidFont:SetJustifyH("LEFT")

    itemIdFrame.incrementEditbox = CreateFrame("EditBox", "itemIdFrameincrementEditbox", itemIdFrame, "InputBoxTemplate")
    local incrementEditbox = itemIdFrame.incrementEditbox
    incrementEditbox:SetPoint("LEFT", startBidEditbox, "RIGHT", 9, 0)
    incrementEditbox:SetSize(40, 20)
    incrementEditbox:SetAutoFocus(false)
    incrementEditbox:SetFont(GameFontNormal:GetFont(), 12, "")
    incrementEditbox:SetNumeric(true)
    itemIdFrame.incrementFont = itemIdFrame:CreateFontString()
    local incrementFont = itemIdFrame.incrementFont
    incrementFont:SetPoint("TOP", incrementEditbox, "BOTTOM", -2, -5)
    incrementFont:SetFont(GameFontNormal:GetFont(), 12)
    incrementFont:SetTextColor(1, 0.82, 0)
    incrementFont:SetText("加价")
    incrementFont:SetWordWrap(false)
    incrementFont:SetJustifyH("LEFT")

    itemIdFrame.itemNameFont = itemIdFrame:CreateFontString()
    local itemNameFont = itemIdFrame.itemNameFont
    itemNameFont:SetPoint("LEFT", incrementFont, "RIGHT", 15, 0)
    itemNameFont:SetFont(GameFontNormal:GetFont(), 12)
    itemNameFont:SetTextColor(1, 0.82, 0)
    itemNameFont:SetText("名称")
    itemNameFont:SetWordWrap(false)
    itemNameFont:SetJustifyH("LEFT")

    itemIdFrame.AddBtn = CreateButton(nil, itemIdFrame, "添加", "LEFT", incrementEditbox, "RIGHT", 5, 0, 40)
    itemIdFrame.AddBtn:SetScript("OnClick", function ()
        local itemId = itemIdEditbox:GetNumber() or 0
        local startbid = startBidEditbox:GetNumber() or 0
        local increment = incrementEditbox:GetNumber() or 100
        if (itemId > 0) and (startbid > 0) then
            local isExist = false
            for index, data in ipairs(ZL_SETTING.itemIdSetting) do
                if data.itemId == itemId then
                    isExist = true
                    ZL_SETTING.itemIdSetting[index].startbid = startbid
                    ZL_SETTING.itemIdSetting[index].increment = increment
                end
            end
            if isExist then
                for _, f in ipairs(itemIdFrame.entries) do
                    f:Hide()
                end
                local f = itemIdFrame.entries[1]
                f:Show()
                f:SetValues(itemId, startbid, increment, select(2, cGetItemInfo(itemId)))
                local msgStr = Prefix("物品ID已存在！起拍价和每次最低出价已更新！")
                ZL.Print(msgStr)
            else
                local function func(itemlink)
                    table.insert(ZL_SETTING.itemIdSetting, {itemId=itemId, startbid=startbid, increment=increment, itemlink=itemlink})
                    itemIdFrame:Update()
                end
                LoadItemDataByID(itemId, func, itemIdFrame.AddBtn)
            end
            itemIdEditbox:SetText("")
            startBidEditbox:SetText("")
            incrementEditbox:SetText("")
        else
            local msgStr = "信息填写不完整！"
            ZL.Print(msgStr)
            GameTooltipShow(self, "BOTTOM", "TOP")
            GameTooltip:AddLine(msgStr)
            GameTooltip:Show()
            C_Timer.After(3, function ()
                GameTooltip:Hide()
            end)
        end
    end)
    itemIdFrame.AddBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "TOPLEFT", "BOTTOMRIGHT")
        GameTooltip:AddLine("添加物品的三种方式：")
        GameTooltip:AddLine("1、直接输入物品ID，起拍价和加价，按\"添加\"按钮；", 1, 1, 1, false)
        GameTooltip:AddLine("2、鼠标点击物品到\"物品ID\"输入框，自动获取物品ID，\n     然后输入起拍价和加价，按\"添加\"按钮；", 1, 1, 1, false)
        GameTooltip:AddLine("3、鼠标点击物品到已存在物品的图标上，自动替换为\n     新的物品ID，保留原起拍价和加价。", 1, 1, 1, false)
        GameTooltip:Show()
    end)
    itemIdFrame.AddBtn:SetScript("OnLeave", function () GameTooltip:Hide() end)
    itemIdFrame.SerchBtn = CreateButton(nil, itemIdFrame, "搜索", "LEFT", itemIdFrame.AddBtn, "RIGHT", 0, 0, 40)
    itemIdFrame.SerchBtn:SetScript("OnClick", function ()
        local itemId = itemIdEditbox:GetNumber() or 0
        if itemId > 0 then
            local isExist = false
            local startbid, increment, itemlink
            for _, data in ipairs(ZL_SETTING.itemIdSetting) do
                if data.itemId == itemId then
                    isExist = true
                    startbid = data.startbid
                    increment = data.increment
                    itemlink = data.itemlink
                end
            end
            if isExist then
                for _, f in ipairs(itemIdFrame.entries) do f:Hide() end
                local f = itemIdFrame.entries[1]
                f:Show()
                f:SetValues(itemId, startbid, increment, itemlink)
            else
                local msgStr = "物品ID不存在！"
                ZL.Print(msgStr)
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine(msgStr)
                GameTooltip:Show()
                C_Timer.After(3, function ()
                    GameTooltip:Hide()
                end)
            end
        else
            itemIdFrame:Update()
        end
    end)
    itemIdFrame.SerchBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "TOPLEFT", "BOTTOMRIGHT")
        GameTooltip:AddLine("物品ID如果为空，则展示所有存在的；否则只展示输入的物品ID！", 1, 1, 1, true)
        GameTooltip:Show()
    end)
    itemIdFrame.SerchBtn:SetScript("OnLeave", function () GameTooltip:Hide() end)
    itemIdFrame.autoAddStartBid = CreateFrame("CheckButton", nil, itemIdFrame, "ChatConfigCheckButtonTemplate")
    itemIdFrame.autoAddStartBid:SetPoint("LEFT", itemIdFrame.SerchBtn, "RIGHT", 20, 0)
    itemIdFrame.autoAddStartBid.Text:SetText("自动添加")
    itemIdFrame.autoAddStartBid.Text:SetFont(GameFontNormal:GetFont(), 12, "")
    itemIdFrame.autoAddStartBid:SetHitRectInsets(0, -itemIdFrame.autoAddStartBid.Text:GetWidth(), 0, 0)
    itemIdFrame.autoAddStartBid:SetChecked(ZL.opt.autoAddStartBid)
    itemIdFrame.autoAddStartBid:SetScript("OnClick", function (self)
        ZL.opt.autoAddStartBid = self:GetChecked()
    end)
    itemIdFrame.autoAddStartBid:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "LEFT", "RIGHT", itemIdFrame.autoAddStartBid.Text:GetWidth(), 0)
        GameTooltip:AddLine("作者专用：", 1, 0, 0)
        GameTooltip:AddLine("当拍卖成交价大于1万，自动添加到\n这里，下次起步价不低于5000", 1, 1, 1)
        GameTooltip:Show()
    end)
    itemIdFrame.autoAddStartBid:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    --设置TAB事件
    do
        local editboxList = {"itemIdFrameitemIdEditbox", "itemIdFramestartBidEditbox", "itemIdFrameincrementEditbox"}
        local function OnTabPressed(self)
            EditBox_HandleTabbing(self, editboxList)
        end
        itemIdEditbox:SetScript("OnTabPressed", OnTabPressed)
        startBidEditbox:SetScript("OnTabPressed", OnTabPressed)
        incrementEditbox:SetScript("OnTabPressed", function (self)
            local itemId = itemIdEditbox:GetNumber() or 0
            local startbid = startBidEditbox:GetNumber() or 0
            local increment = incrementEditbox:GetNumber() or 0
            if (itemId > 0) and (startbid > 0) and (increment > 0) then
                itemIdFrame.AddBtn:Click()
            else
                OnTabPressed(self)
            end
        end)
    end
    ItemSettingFrame.itemLevelFrame = CreateFrame("Frame", nil, ItemSettingFrame)
    local itemLevelFrame = ItemSettingFrame.itemLevelFrame
    itemLevelFrame:SetPoint("TOPLEFT", ItemSettingFrameDialogBG, "TOPLEFT")
    itemLevelFrame:SetSize(ItemSettingFrameDialogBG:GetWidth(), 50)

    itemLevelFrame.minLevelEditbox = CreateFrame("EditBox", "itemLevelFrameminLevelEditbox", itemLevelFrame, "InputBoxTemplate")
    local minLevelEditbox = itemLevelFrame.minLevelEditbox
    minLevelEditbox:SetPoint("TOPLEFT", itemLevelFrame, "TOPLEFT", 10, -5)
    minLevelEditbox:SetSize(45, 20)
    minLevelEditbox:SetAutoFocus(false)
    minLevelEditbox:SetFont(GameFontNormal:GetFont(), 12, "")
    minLevelEditbox:SetNumeric(true)

    itemLevelFrame.minLevelEditbox.linefont = itemLevelFrame.minLevelEditbox:CreateFontString()
    local linefont = itemLevelFrame.minLevelEditbox.linefont
    linefont:SetPoint("LEFT", minLevelEditbox, "RIGHT", 2, 0)
    linefont:SetFont(GameFontNormal:GetFont(), 12)
    linefont:SetTextColor(1, 0.82, 0)
    linefont:SetText("-")
    linefont:SetWordWrap(false)
    linefont:SetJustifyH("CENTER")

    itemLevelFrame.minLevelFont = itemLevelFrame:CreateFontString()
    local minLevelFont = itemLevelFrame.minLevelFont
    minLevelFont:SetPoint("TOP", minLevelEditbox, "BOTTOM", -2, -5)
    minLevelFont:SetFont(GameFontNormal:GetFont(), 12)
    minLevelFont:SetTextColor(1, 0.82, 0)
    minLevelFont:SetText("最小装等")
    minLevelFont:SetWordWrap(false)
    minLevelFont:SetJustifyH("LEFT")

    itemLevelFrame.maxLevelEditbox = CreateFrame("EditBox", "itemLevelFramemaxLevelEditbox", itemLevelFrame, "InputBoxTemplate")
    local maxLevelEditbox = itemLevelFrame.maxLevelEditbox
    maxLevelEditbox:SetPoint("LEFT", linefont, "RIGHT", 8, 0)
    maxLevelEditbox:SetSize(45, 20)
    maxLevelEditbox:SetAutoFocus(false)
    maxLevelEditbox:SetFont(GameFontNormal:GetFont(), 12, "")
    maxLevelEditbox:SetNumeric(true)
    itemLevelFrame.maxLevelFont = itemLevelFrame:CreateFontString()
    local maxLevelFont = itemLevelFrame.maxLevelFont
    maxLevelFont:SetPoint("TOP", maxLevelEditbox, "BOTTOM", -2, -5)
    maxLevelFont:SetFont(GameFontNormal:GetFont(), 12)
    maxLevelFont:SetTextColor(1, 0.82, 0)
    maxLevelFont:SetText("最大装等")
    maxLevelFont:SetWordWrap(false)
    maxLevelFont:SetJustifyH("LEFT")

    itemLevelFrame.sanJianStartBidEditbox = CreateFrame("EditBox", "itemLevelFrameSanJianStartBidEditbox", itemLevelFrame, "InputBoxTemplate")
    local sanJianStartBidEditbox = itemLevelFrame.sanJianStartBidEditbox
    sanJianStartBidEditbox:SetPoint("LEFT", maxLevelEditbox, "RIGHT", 10, 0)
    sanJianStartBidEditbox:SetSize(60, 20)
    sanJianStartBidEditbox:SetAutoFocus(false)
    sanJianStartBidEditbox:SetFont(GameFontNormal:GetFont(), 12, "")
    sanJianStartBidEditbox:SetNumeric(true)
    itemLevelFrame.sanJianStartBidFont = itemLevelFrame:CreateFontString()
    local sanJianStartBidFont = itemLevelFrame.sanJianStartBidFont
    sanJianStartBidFont:SetPoint("TOP", sanJianStartBidEditbox, "BOTTOM", -2, -5)
    sanJianStartBidFont:SetFont(GameFontNormal:GetFont(), 12)
    sanJianStartBidFont:SetTextColor(1, 0.82, 0)
    sanJianStartBidFont:SetText("散件")
    sanJianStartBidFont:SetWordWrap(false)
    sanJianStartBidFont:SetJustifyH("LEFT")

    itemLevelFrame.taoZhuangStartBidEditbox = CreateFrame("EditBox", "itemLevelFrameTaoZhuangStartBidEditbox", itemLevelFrame, "InputBoxTemplate")
    local taoZhuangStartBidEditbox = itemLevelFrame.taoZhuangStartBidEditbox
    taoZhuangStartBidEditbox:SetPoint("LEFT", sanJianStartBidEditbox, "RIGHT", 10, 0)
    taoZhuangStartBidEditbox:SetSize(60, 20)
    taoZhuangStartBidEditbox:SetAutoFocus(false)
    taoZhuangStartBidEditbox:SetFont(GameFontNormal:GetFont(), 12, "")
    taoZhuangStartBidEditbox:SetNumeric(true)
    itemLevelFrame.taoZhuangStartBidFont = itemLevelFrame:CreateFontString()
    local taoZhuangStartBidFont = itemLevelFrame.taoZhuangStartBidFont
    taoZhuangStartBidFont:SetPoint("TOP", taoZhuangStartBidEditbox , "BOTTOM", -2, -5)
    taoZhuangStartBidFont:SetFont(GameFontNormal:GetFont(), 12)
    taoZhuangStartBidFont:SetTextColor(1, 0.82, 0)
    taoZhuangStartBidFont:SetText("套装")
    taoZhuangStartBidFont:SetWordWrap(false)
    taoZhuangStartBidFont:SetJustifyH("LEFT")

    itemLevelFrame.wuQiStartBidEditbox = CreateFrame("EditBox", "itemLevelFrameWuQiStartBidEditbox", itemLevelFrame, "InputBoxTemplate")
    local wuQiStartBidEditbox = itemLevelFrame.wuQiStartBidEditbox
    wuQiStartBidEditbox:SetPoint("LEFT", taoZhuangStartBidEditbox, "RIGHT", 10, 0)
    wuQiStartBidEditbox:SetSize(60, 20)
    wuQiStartBidEditbox:SetAutoFocus(false)
    wuQiStartBidEditbox:SetFont(GameFontNormal:GetFont(), 12, "")
    wuQiStartBidEditbox:SetNumeric(true)
    itemLevelFrame.wuQiStartBidFont = itemLevelFrame:CreateFontString()
    local wuQiStartBidFont = itemLevelFrame.wuQiStartBidFont
    wuQiStartBidFont:SetPoint("TOP", wuQiStartBidEditbox , "BOTTOM", -2, -5)
    wuQiStartBidFont:SetFont(GameFontNormal:GetFont(), 12)
    wuQiStartBidFont:SetTextColor(1, 0.82, 0)
    wuQiStartBidFont:SetText("武器/饰品")
    wuQiStartBidFont:SetWordWrap(false)
    wuQiStartBidFont:SetJustifyH("LEFT")

    itemLevelFrame.incrementEditbox = CreateFrame("EditBox", "itemLevelFrameincrementEditbox", itemLevelFrame, "InputBoxTemplate")
    local incrementEditbox = itemLevelFrame.incrementEditbox
    incrementEditbox:SetPoint("LEFT", wuQiStartBidEditbox , "RIGHT", 10, 0)
    incrementEditbox:SetSize(60, 20)
    incrementEditbox:SetAutoFocus(false)
    incrementEditbox:SetFont(GameFontNormal:GetFont(), 12, "")
    incrementEditbox:SetNumeric(true)
    itemLevelFrame.incrementFont = itemLevelFrame:CreateFontString()
    local incrementFont = itemLevelFrame.incrementFont
    incrementFont:SetPoint("TOP", incrementEditbox, "BOTTOM", -2, -5)
    incrementFont:SetFont(GameFontNormal:GetFont(), 12)
    incrementFont:SetTextColor(1, 0.82, 0)
    incrementFont:SetText("最低加价")
    incrementFont:SetWordWrap(false)
    incrementFont:SetJustifyH("LEFT")
    itemLevelFrame.AddBtn = CreateButton(nil, itemLevelFrame, "+", "LEFT", incrementEditbox, "RIGHT", 2, 0, 24)
    itemLevelFrame.AddBtn:SetScript("OnClick", function (self)
        local minLevel = minLevelEditbox:GetNumber() or 0
        local maxLevel = maxLevelEditbox:GetNumber() or 0
        local sanJianStartBid = sanJianStartBidEditbox:GetNumber() or 0
        local taoZhuangStartBid = taoZhuangStartBidEditbox:GetNumber() or 0
        local wuQiStartBid = wuQiStartBidEditbox:GetNumber() or 0
        local increment = incrementEditbox:GetNumber() or 0
        if minLevel <= 0 or maxLevel <= 0 or increment <= 0 then
            GameTooltipShow(self, "LEFT", "RIGHT")
            GameTooltip:AddLine("错误")
            GameTooltip:AddLine("请输入大于0的数！", 1, 1, 1)
            GameTooltip:Show()
            C_Timer.After(2, function ()
                GameTooltip:Hide()
            end)
            return
        end
        if sanJianStartBid == 0 and taoZhuangStartBid == 0 and wuQiStartBid == 0 then
            GameTooltipShow(self, "LEFT", "RIGHT")
            GameTooltip:AddLine("错误")
            GameTooltip:AddLine("散件、套装、武器/饰品至少一项输入大于0的数", 1, 1, 1)
            GameTooltip:Show()
            C_Timer.After(2, function ()
                GameTooltip:Hide()
            end)
            return
        end
        if maxLevel < minLevel then
            GameTooltipShow(self, "LEFT", "RIGHT")
            GameTooltip:AddLine("错误")
            GameTooltip:AddLine("最大装等不能小于最小装等！", 1, 1, 1)
            GameTooltip:Show()
            C_Timer.After(2, function ()
                GameTooltip:Hide()
            end)
        end
        for _, d in ipairs(ZL_SETTING["itemLevelSetting"]) do
            if ((d.minLevel <= minLevel) and (d.maxLevel >= minLevel)) or ((d.minLevel <= maxLevel) and (d.maxLevel >= maxLevel)) then
                GameTooltipShow(self, "LEFT", "RIGHT")
                GameTooltip:AddLine("警告")
                GameTooltip:AddLine("装等存在重叠范围，请修改！", 1, 1, 1)
                GameTooltip:Show()
                C_Timer.After(2, function ()
                    GameTooltip:Hide()
                end)
                return
            end
        end
        table.insert(ZL_SETTING["itemLevelSetting"], {
            minLevel = minLevel, maxLevel = maxLevel,
            sanJianStartBid = sanJianStartBid, taoZhuangStartBid = taoZhuangStartBid,
            wuQiStartBid = wuQiStartBid, increment = increment,
        })
        table.sort(ZL_SETTING["itemLevelSetting"], function (a, b)
            return a.minLevel < b.minLevel
        end)
        itemLevelFrame:Update()
        minLevelEditbox:SetText("")
        maxLevelEditbox:SetText("")
        sanJianStartBidEditbox:SetText("")
        taoZhuangStartBidEditbox:SetText("")
        wuQiStartBidEditbox:SetText("")
        incrementEditbox:SetText("")
    end)
    itemLevelFrame.AddBtn:SetScript("onLeave", function ()
        GameTooltip:Hide()
    end)
    itemLevelFrame:Hide()
    --设置TAB事件
    do
        local editboxList = {
            "itemLevelFrameminLevelEditbox", "itemLevelFramemaxLevelEditbox",
            "itemLevelFrameSanJianStartBidEditbox", "itemLevelFrameTaoZhuangStartBidEditbox",
            "itemLevelFrameWuQiStartBidEditbox", "itemLevelFrameincrementEditbox"
        }
        local function OnTabPressed(self)
            EditBox_HandleTabbing(self, editboxList)
        end
        minLevelEditbox:SetScript("OnTabPressed", OnTabPressed)
        maxLevelEditbox:SetScript("OnTabPressed", OnTabPressed)
        sanJianStartBidEditbox:SetScript("OnTabPressed", OnTabPressed)
        taoZhuangStartBidEditbox:SetScript("OnTabPressed", OnTabPressed)
        wuQiStartBidEditbox:SetScript("OnTabPressed", OnTabPressed)
        incrementEditbox:SetScript("OnTabPressed", OnTabPressed)
    end

    ItemSettingFrame.filterFrame = CreateFrame("Frame", nil, ItemSettingFrame)
    local filterFrame = ItemSettingFrame.filterFrame
    filterFrame:SetPoint("TOPLEFT", ItemSettingFrameDialogBG, "TOPLEFT")
    filterFrame:SetSize(ItemSettingFrameDialogBG:GetWidth(), 50)

    filterFrame.filterItemIdEditbox = CreateFrame("EditBox", "itemIdFrameitemIdEditbox", filterFrame, "InputBoxTemplate")
    local filterItemIdEditbox = filterFrame.filterItemIdEditbox
    filterItemIdEditbox:SetPoint("TOPLEFT", filterFrame, "TOPLEFT", 31, -5)
    filterItemIdEditbox:SetSize(100, 20)
    filterItemIdEditbox:SetAutoFocus(false)
    filterItemIdEditbox:SetFont(GameFontNormal:GetFont(), 12, "")
    filterItemIdEditbox:SetNumeric(true)
    filterItemIdEditbox:SetScript("OnEnterPressed", function ()
        filterFrame.AddBtn:Click()
    end)
    filterItemIdEditbox:SetScript("OnMouseUp", function (self)
        if (select(1, GetCursorInfo())) == "item" then
            self:SetText(select(2, GetCursorInfo()))
            ClearCursor()
        end
    end)

    filterFrame.AddBtn = CreateButton(nil, filterFrame, "添加", "LEFT", filterItemIdEditbox, "RIGHT", 5, 0, 40)
    filterFrame.AddBtn:SetScript("OnClick", function (self)
        local itemId = filterItemIdEditbox:GetNumber() or 0
        if (itemId > 0) then
            local isExist = false
            for _, data in ipairs(ZL_SETTING.filterItemId) do
                if data.itemId == itemId then
                    isExist = true
                end
            end
            if isExist then
                for _, f in ipairs(filterFrame.entries) do
                    f:Hide()
                end
                local f = filterFrame.entries[1]
                f:Show()
                f:SetValues(itemId, select(2, cGetItemInfo(itemId)))
                local msgStr = "物品ID已存在！"
                ZL.Print(msgStr)
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine(msgStr)
                GameTooltip:Show()
                C_Timer.After(3, function ()
                    GameTooltip:Hide()
                end)
            else
                local function func(itemlink)
                    table.insert(ZL_SETTING.filterItemId, {itemId=itemId, itemlink=itemlink, loot=true, auction=true})
                    filterFrame:Update()
                end
                LoadItemDataByID(itemId, func, filterFrame.AddBtn)
            end
            filterItemIdEditbox:SetText("")
        else
            local msgStr = "信息填写不完整！"
            ZL.Print(msgStr)
            GameTooltipShow(self, "BOTTOM", "TOP")
            GameTooltip:AddLine(msgStr)
            GameTooltip:Show()
            C_Timer.After(3, function ()
                GameTooltip:Hide()
            end)
        end
        filterItemIdEditbox:ClearFocus()
    end)
    filterFrame.AddBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "TOPLEFT", "BOTTOMRIGHT")
        GameTooltip:AddLine("添加物品的三种方式：")
        GameTooltip:AddLine("1、直接输入物品ID，按\"添加\"按钮；", 1, 1, 1, false)
        GameTooltip:AddLine("2、鼠标点击物品到\"物品ID\"输入框，自动获取物品ID，\n     按\"添加\"按钮；", 1, 1, 1, false)
        GameTooltip:AddLine("3、鼠标点击物品到已存在物品的图标上，自动替换为\n     新的物品ID", 1, 1, 1, false)
        GameTooltip:Show()
    end)
    filterFrame.AddBtn:SetScript("OnLeave", function () GameTooltip:Hide() end)
    filterFrame.SerchBtn = CreateButton(nil, filterFrame, "搜索", "LEFT", filterFrame.AddBtn, "RIGHT", 0, 0, 40)
    filterFrame.SerchBtn:SetScript("OnClick", function ()
        local itemId = filterItemIdEditbox:GetNumber() or 0
        if itemId > 0 then
            local isExist = false
            local itemlink
            for _, data in ipairs(ZL_SETTING.filterItemId) do
                if data.itemId == itemId then
                    isExist = true
                    itemlink = data.itemlink
                end
            end
            if isExist then
                for _, f in ipairs(filterFrame.entries) do f:Hide() end
                local f = filterFrame.entries[1]
                f:Show()
                f:SetValues(itemId, itemlink)
            else
                local msgStr = "物品ID不存在！"
                ZL.Print(msgStr)
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine(msgStr)
                GameTooltip:Show()
                C_Timer.After(3, function ()
                    GameTooltip:Hide()
                end)
            end
        else
            filterFrame:Update()
        end
    end)
    filterFrame.SerchBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "TOPLEFT", "BOTTOMRIGHT")
        GameTooltip:AddLine("物品ID如果为空，则展示所有存在的；否则只展示输入的物品ID！", 1, 1, 1, true)
        GameTooltip:Show()
    end)
    filterFrame.SerchBtn:SetScript("OnLeave", function () GameTooltip:Hide() end)

    filterFrame.filterItemIdFont = filterFrame:CreateFontString()
    local filterItemIdFont = filterFrame.filterItemIdFont
    filterItemIdFont:SetPoint("TOPLEFT", filterItemIdEditbox, "BOTTOMLEFT", 5, -5)
    filterItemIdFont:SetFont(GameFontNormal:GetFont(), 12)
    filterItemIdFont:SetTextColor(1, 0.82, 0)
    filterItemIdFont:SetText("物品ID")
    filterItemIdFont:SetWordWrap(false)
    filterItemIdFont:SetJustifyH("LEFT")

    filterFrame.filterItemNameFont = filterFrame:CreateFontString()
    local filterItemNameFont = filterFrame.filterItemNameFont
    filterItemNameFont:SetPoint("LEFT", filterItemIdFont, "RIGHT", 50, 0)
    filterItemNameFont:SetFont(GameFontNormal:GetFont(), 12)
    filterItemNameFont:SetTextColor(1, 0.82, 0)
    filterItemNameFont:SetText("名称")
    filterItemNameFont:SetWordWrap(false)
    filterItemNameFont:SetJustifyH("LEFT")
    filterFrame:Hide()


    --创建滚动条
    ItemSettingFrame.scrollFrame = CreateFrame("ScrollFrame", nil, ItemSettingFrame, "UIPanelScrollFrameTemplate")
    ItemSettingFrame.scrollFrame:SetPoint("TOPLEFT", _G["ItemSettingFrameDialogBG"], "TOPLEFT", 3, -50)
    ItemSettingFrame.scrollFrame:SetPoint("BOTTOMRIGHT", _G["ItemSettingFrameDialogBG"], "BOTTOMRIGHT", -3, 4)
    ItemSettingFrame.scrollFrame:SetClipsChildren(true) --必须设置为true，scrollFrame所有的子元素才会被剪切
    ItemSettingFrame.scrollFrame:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel) --重设滑动条鼠标滚轮事件
    --重设ScrollBar位置，放置到scrollFrame内，防止被剪切掉
    ItemSettingFrame.scrollFrame.ScrollBar:ClearAllPoints()
    ItemSettingFrame.scrollFrame.ScrollBar:SetPoint("TOPLEFT", ItemSettingFrame.scrollFrame, "TOPRIGHT", -10, -15)
    ItemSettingFrame.scrollFrame.ScrollBar:SetPoint("BOTTOMRIGHT", ItemSettingFrame.scrollFrame, "BOTTOMRIGHT", -5, 15)

    local function Tab_OnClick(self)
        local frame = self:GetParent()
        local tabId = self:GetID()
        if tabId == 1 then
            itemIdFrame:Show()
            itemLevelFrame:Hide()
            filterFrame:Hide()
        elseif tabId == 2 then
            itemIdFrame:Hide()
            itemLevelFrame:Show()
            filterFrame:Hide()
        elseif tabId == 3 then
            itemIdFrame:Hide()
            itemLevelFrame:Hide()
            filterFrame:Show()
        end
        PanelTemplates_SetTab(frame, tabId)
        local scrollchild = frame.scrollFrame:GetScrollChild()
        if scrollchild then
            scrollchild:Hide()
        end
        frame.scrollFrame:SetScrollChild(self.content)
        self.content:Show()
    end

    local function CreateTab(frame, numTabs, ...)
        frame.numTabs = numTabs
        local contents = {}
        local frameName = frame:GetName()
        local template = ""
        for i = 1, numTabs do
            if WOW_PROJECT_ID == 1 then
                template = "PanelTabButtonTemplate"
            else --if WOW_PROJECT_ID == 11 or WOW_PROJECT_ID == 2 then
                template = "CharacterFrameTabButtonTemplate"
            end
            local tab = CreateFrame("Button", frameName.."Tab"..i, frame, template)
            tab:SetID(i)
            tab:SetText(select(i, ...))
            tab:SetScript("OnClick", Tab_OnClick)
            if WOW_PROJECT_ID == 1 then
                if i ==1 then
                    tab:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 5, 7)
                else
                    tab:SetPoint("TOPLEFT", _G[frameName.."Tab"..(i-1)], "TOPRIGHT", 1, 0)
                end
            else --if WOW_PROJECT_ID == 11 or WOW_PROJECT_ID == 2 then
                if i ==1 then
                    tab:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 0, 5)
                else
                    tab:SetPoint("TOPLEFT", _G[frameName.."Tab"..(i-1)], "TOPRIGHT", -20, 0)
                end
            end
            tab.content = CreateFrame("Frame", nil, frame.scrollFrame)
            tab.content:SetPoint("TOPLEFT", frame.scrollFrame, "TOPLEFT")
            tab.content:SetSize(frame.scrollFrame:GetWidth() - 40, 600)
            tab.content:Hide()
            table.insert(contents, tab.content)
        end
        Tab_OnClick(_G[frameName.."Tab1"])
        return unpack(contents)
    end

    local itemIdContent, itemLevelContent, itemFilterContent = CreateTab(ItemSettingFrame, 3, "按物品", "按装等", "过滤")

    itemIdFrame.entries = setmetatable({}, {
        __index = function(t, v)
            local f = CreateFrame("Frame", nil, itemIdContent)
            if v > 1 then
                f:SetPoint("TOPLEFT", t[v - 1], "BOTTOMLEFT", 0, -8)
                f:SetPoint("TOPRIGHT", t[v - 1], "BOTTOMRIGHT", 0, -8)
            else
                f:SetPoint("TOPLEFT", itemIdContent, "TOPLEFT", 0, -5)
                f:SetPoint("TOPRIGHT", itemIdContent, "TOPRIGHT", 0, -5)
            end
            f:SetHeight(15)

            f.itemicon = CreateFrame("Button", nil, f)
            f.itemicon:SetSize(18, 18)
            f.itemicon:EnableMouse(true)
            f.itemicon:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
            f.itemicon:SetPoint("LEFT", f, "LEFT", 2, 0)
            f.itemicon:SetScript("OnEnter", function()
                GameTooltip:ClearAllPoints()
                GameTooltip:ClearLines()
                GameTooltip:SetOwner(f, "ANCHOR_NONE")
                GameTooltip:SetHyperlink("item:" .. f.itemId)
                GameTooltip:SetPoint("RIGHT", f, "LEFT", -5, 0)
                GameTooltip:Show()
            end)
            f.itemicon:SetScript("OnLeave", function() GameTooltip:Hide() end)
            f.itemicon:SetScript("OnMouseUp", function (self)
                if (select(1, GetCursorInfo())) == "item" then
                    local _, itemId, itemlink = GetCursorInfo()
                    local isExist = false
                    for _, data in ipairs(ZL_SETTING.itemIdSetting) do
                        if data.itemId == itemId then
                            isExist = true
                            break
                        end
                    end
                    if (not isExist) then
                        ZL_SETTING.itemIdSetting[v].itemId = itemId
                        ZL_SETTING.itemIdSetting[v].itemlink = itemlink
                        itemIdFrame:Update()
                        ClearCursor()
                    else
                        local msgStr = "物品ID已存在！"
                        ZL.Print(msgStr)
                        GameTooltipShow(self, "BOTTOM", "TOP")
                        GameTooltip:AddLine(msgStr)
                        GameTooltip:Show()
                        C_Timer.After(3, function ()
                            GameTooltip:Hide()
                        end)
                    end
                    
                end
            end)

            f.itemIdBox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
            f.itemIdBox:SetPoint("LEFT", f.itemicon, "RIGHT", 5, 0)
            f.itemIdBox:SetSize(60, 15)
            f.itemIdBox:SetFont(GameFontNormal:GetFont(), 12, "")
            f.itemIdBox:SetMultiLine(false)
            f.itemIdBox:SetTextColor(1, 1, 1)
            f.itemIdBox:SetJustifyH("LEFT")
            f.itemIdBox:SetAutoFocus(false)
            f.itemIdBox:SetNumeric(true)
            f.itemIdBox:Disable()

            f.startBidBox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
            f.startBidBox:SetPoint("LEFT", f.itemIdBox, "RIGHT", 9, 0)
            f.startBidBox:SetSize(55, 15)
            f.startBidBox:SetFont(GameFontNormal:GetFont(), 12, "")
            f.startBidBox:SetMultiLine(false)
            f.startBidBox:SetTextColor(1, 1, 1)
            f.startBidBox:SetJustifyH("RIGHT")
            f.startBidBox:SetAutoFocus(false)
            f.startBidBox:SetNumeric(true)
            f.startBidBox:SetTextInsets(0, 2, 0, 0)
            f.startBidBox:SetScript("OnEnterPressed", function(self)
                ZL_SETTING.itemIdSetting[v].startbid = self:GetNumber() > 0 and self:GetNumber() or ZL_SETTING.itemIdSetting[v].startbid
                self:ClearFocus()
            end)
            f.startBidBox:SetScript("OnEscapePressed", function(self)
                self:SetNumber(ZL_SETTING.itemIdSetting[v].startbid)
                self:ClearFocus()
            end)

            f.incrementBox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
            f.incrementBox:SetPoint("LEFT", f.startBidBox, "RIGHT", 9, 0)
            f.incrementBox:SetSize(40, 15)
            f.incrementBox:SetFont(GameFontNormal:GetFont(), 12, "")
            f.incrementBox:SetMultiLine(false)
            f.incrementBox:SetTextColor(1, 1, 1)
            f.incrementBox:SetJustifyH("RIGHT")
            f.incrementBox:SetAutoFocus(false)
            f.incrementBox:SetNumeric(true)
            f.incrementBox:SetTextInsets(0, 2, 0, 0)
            f.incrementBox:SetScript("OnEnterPressed", function(self)
                ZL_SETTING.itemIdSetting[v].increment = self:GetNumber() > 0 and self:GetNumber() or ZL_SETTING.itemIdSetting[v].increment
                self:ClearFocus()
            end)
            f.incrementBox:SetScript("OnEscapePressed", function(self)
                self:SetNumber(ZL_SETTING.itemIdSetting[v].increment)
                self:ClearFocus()
            end)

            f.itemNameFont = f:CreateFontString(nil, "BACKGROUND")
            f.itemNameFont:SetPoint("LEFT", f.incrementBox, "RIGHT", 5, 0)
            f.itemNameFont:SetSize(120, 15)
            f.itemNameFont:SetFont(GameFontNormal:GetFont(), 12)
            f.itemNameFont:SetTextColor(1, 1, 1)
            f.itemNameFont:SetWordWrap(false)
            f.itemNameFont:SetJustifyH("LEFT")

            f.del = CreateButton(nil, f, "-", "LEFT", f.itemNameFont, "RIGHT", 2, 0, 20, 20)
            f.del:SetScript("OnClick", function (self)
                table.remove(ZL_SETTING.itemIdSetting, v)
                itemIdFrame:Update()
            end)
            function f:SetValues(itemId, startbid, increment, itemlink)
                self.itemicon:SetNormalTexture(cGetItemIcon(itemId))
				self.itemIdBox:SetNumber(itemId)
                self.startBidBox:SetNumber(startbid)
                self.incrementBox:SetNumber(increment)
                self.itemNameFont:SetTextScale(1)
                self.itemNameFont:SetText(itemlink)
                local bili = self.itemNameFont:GetWidth()/(self.itemNameFont:GetUnboundedStringWidth()+5)
                bili = bili <= 1 and bili or 1
                self.itemNameFont:SetTextScale(bili)
				self.itemId = itemId
            end
            t[v] = f
            return f
        end
    })
    function itemIdFrame:Update()
        for _, f in ipairs(self.entries) do f:Hide() end
        if ZL_SETTING.itemIdSetting and #ZL_SETTING.itemIdSetting > 0 then
            table.sort(ZL_SETTING.itemIdSetting, function (a, b)
                if a.itemId < b.itemId then
                    return true
                end
                return false
            end)
            for num, data in ipairs(ZL_SETTING.itemIdSetting) do
                local f = self.entries[num]
                f:Show()
                f:SetValues(data.itemId, data.startbid, data.increment, data.itemlink)
            end
            itemIdContent:SetHeight(20 * #ZL_SETTING.itemIdSetting - 5)
        end
    end

    itemLevelFrame.entries = setmetatable({}, {
        __index = function(t, v)
            local f = CreateFrame("Frame", nil, itemLevelContent)
            if v > 1 then
                f:SetPoint("TOPLEFT", t[v - 1], "BOTTOMLEFT", 0, -8)
                f:SetPoint("TOPRIGHT", t[v - 1], "BOTTOMRIGHT", 0, -8)
            else
                f:SetPoint("TOPLEFT", itemLevelContent, "TOPLEFT", 0, -5)
                f:SetPoint("TOPRIGHT", itemLevelContent, "TOPRIGHT", 0, -5)
            end
            f:SetHeight(15)

            f.minLevelbox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
            f.minLevelbox:SetPoint("TOPLEFT", f, "TOPLEFT", 7, 0)
            f.minLevelbox:SetSize(45, 15)
            f.minLevelbox:SetFont(GameFontNormal:GetFont(), 12, "THICKOUTLINE")
            f.minLevelbox:SetMultiLine(false)
            f.minLevelbox:SetTextColor(0.57, 0.45, 1)
            f.minLevelbox:SetJustifyH("LEFT")
            f.minLevelbox:SetAutoFocus(false)
            f.minLevelbox:SetNumeric(true)
            f.minLevelbox:Disable()

            f.minLevelbox.linefont = f.minLevelbox:CreateFontString(nil, "BACKGROUND")
            local linefontf = f.minLevelbox.linefont
            linefontf:SetPoint("LEFT", f.minLevelbox, "RIGHT", 2, 0)
            linefontf:SetFont(GameFontNormal:GetFont(), 12)
            linefontf:SetTextColor(1, 0.82, 0)
            linefontf:SetText("-")
            linefontf:SetWordWrap(false)
            linefontf:SetJustifyH("CENTER")

            f.maxLevelbox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
            f.maxLevelbox:SetPoint("LEFT", linefontf, "RIGHT", 8, 0)
            f.maxLevelbox:SetSize(45, 15)
            f.maxLevelbox:SetFont(GameFontNormal:GetFont(), 12, "THICKOUTLINE")
            f.maxLevelbox:SetMultiLine(false)
            f.maxLevelbox:SetTextColor(0.57, 0.45, 1)
            f.maxLevelbox:SetJustifyH("LEFT")
            f.maxLevelbox:SetAutoFocus(false)
            f.maxLevelbox:SetNumeric(true)
            f.maxLevelbox:Disable()

            f.sanJianStartbidbox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
            f.sanJianStartbidbox:SetPoint("LEFT", f.maxLevelbox, "RIGHT", 10, 0)
            f.sanJianStartbidbox:SetSize(60, 15)
            f.sanJianStartbidbox:SetFont(GameFontNormal:GetFont(), 12, "")
            f.sanJianStartbidbox:SetMultiLine(false)
            f.sanJianStartbidbox:SetTextColor(1, 1, 1)
            f.sanJianStartbidbox:SetJustifyH("LEFT")
            f.sanJianStartbidbox:SetAutoFocus(false)
            f.sanJianStartbidbox:SetNumeric(true)
            f.sanJianStartbidbox:SetScript("OnEnterPressed", function(self)
                ZL_SETTING.itemLevelSetting[v].sanJianStartBid= self:GetNumber() > 0 and self:GetNumber() or ZL_SETTING.itemLevelSetting[v].sanJianStartBid
                self:ClearFocus()
            end)
            f.sanJianStartbidbox:SetScript("OnEscapePressed", function(self)
                self:SetNumber(ZL_SETTING.itemLevelSetting[v].sanJianStartBid)
                self:ClearFocus()
            end)

            f.taoZhuangStartbidbox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
            f.taoZhuangStartbidbox:SetPoint("LEFT", f.sanJianStartbidbox, "RIGHT", 10, 0)
            f.taoZhuangStartbidbox:SetSize(60, 15)
            f.taoZhuangStartbidbox:SetFont(GameFontNormal:GetFont(), 12, "")
            f.taoZhuangStartbidbox:SetMultiLine(false)
            f.taoZhuangStartbidbox:SetTextColor(1, 1, 1)
            f.taoZhuangStartbidbox:SetJustifyH("LEFT")
            f.taoZhuangStartbidbox:SetAutoFocus(false)
            f.taoZhuangStartbidbox:SetNumeric(true)
            f.taoZhuangStartbidbox:SetScript("OnEnterPressed", function(self)
                ZL_SETTING.itemLevelSetting[v].taoZhuangStartBid= self:GetNumber() > 0 and self:GetNumber() or ZL_SETTING.itemLevelSetting[v].taoZhuangStartBid
                self:ClearFocus()
            end)
            f.taoZhuangStartbidbox:SetScript("OnEscapePressed", function(self)
                self:SetNumber(ZL_SETTING.itemLevelSetting[v].taoZhuangStartBid)
                self:ClearFocus()
            end)

            f.wuQiStartbidbox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
            f.wuQiStartbidbox:SetPoint("LEFT", f.taoZhuangStartbidbox, "RIGHT", 10, 0)
            f.wuQiStartbidbox:SetSize(60, 15)
            f.wuQiStartbidbox:SetFont(GameFontNormal:GetFont(), 12, "")
            f.wuQiStartbidbox:SetMultiLine(false)
            f.wuQiStartbidbox:SetTextColor(1, 1, 1)
            f.wuQiStartbidbox:SetJustifyH("LEFT")
            f.wuQiStartbidbox:SetAutoFocus(false)
            f.wuQiStartbidbox:SetNumeric(true)
            f.wuQiStartbidbox:SetScript("OnEnterPressed", function(self)
                ZL_SETTING.itemLevelSetting[v].wuQiStartBid= self:GetNumber() > 0 and self:GetNumber() or ZL_SETTING.itemLevelSetting[v].wuQiStartBid
                self:ClearFocus()
            end)
            f.wuQiStartbidbox:SetScript("OnEscapePressed", function(self)
                self:SetNumber(ZL_SETTING.itemLevelSetting[v].wuQiStartBid)
                self:ClearFocus()
            end)

            f.incrementbox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
            f.incrementbox:SetPoint("LEFT", f.wuQiStartbidbox, "RIGHT", 10, 0)
            f.incrementbox:SetSize(60, 15)
            f.incrementbox:SetFont(GameFontNormal:GetFont(), 12, "")
            f.incrementbox:SetMultiLine(false)
            f.incrementbox:SetTextColor(1, 1, 1)
            f.incrementbox:SetJustifyH("LEFT")
            f.incrementbox:SetAutoFocus(false)
            f.incrementbox:SetNumeric(true)
            f.incrementbox:SetScript("OnEnterPressed", function(self)
                ZL_SETTING.itemLevelSetting[v].increment = self:GetNumber() > 0 and self:GetNumber() or ZL_SETTING.itemLevelSetting[v].increment
                self:ClearFocus()
            end)
            f.incrementbox:SetScript("OnEscapePressed", function(self)
                self:SetNumber(ZL_SETTING.itemLevelSetting[v].increment)
                self:ClearFocus()
            end)
            f.del = CreateButton(nil, f, "-", "LEFT", f.incrementbox, "RIGHT", 2, 0, 24)
            f.del:SetScript("OnClick", function (self)
                table.remove(ZL_SETTING.itemLevelSetting, v)
                itemLevelFrame:Update()
            end)

            function f:SetValues(minLevel, maxLevel, sanJianStartBid, taoZhuangStartBid, wuQiStartBid, increment)
                self.minLevelbox:SetNumber(minLevel)
                self.maxLevelbox:SetNumber(maxLevel)
                self.sanJianStartbidbox:SetNumber(sanJianStartBid)
                self.taoZhuangStartbidbox:SetNumber(taoZhuangStartBid)
                self.wuQiStartbidbox:SetNumber(wuQiStartBid)
                self.incrementbox:SetNumber(increment)
            end

            t[v] = f
            return f
        end
    })
    function itemLevelFrame:Update()
        for _, f in ipairs(self.entries) do f:Hide() end
        for num, data in ipairs(ZL_SETTING.itemLevelSetting) do
            local f = self.entries[num]
            f:Show()
            f:SetValues(data.minLevel, data.maxLevel, data.sanJianStartBid, data.taoZhuangStartBid, data.wuQiStartBid, data.increment)
        end
        itemLevelContent:SetHeight(20 * #ZL_SETTING.itemLevelSetting - 5)
    end

    filterFrame.entries = setmetatable({}, {
        __index = function(t, v)
            local f = CreateFrame("Frame", nil, itemFilterContent)
            if v > 1 then
                f:SetPoint("TOPLEFT", t[v - 1], "BOTTOMLEFT", 0, -8)
                f:SetPoint("TOPRIGHT", t[v - 1], "BOTTOMRIGHT", 0, -8)
            else
                f:SetPoint("TOPLEFT", itemFilterContent, "TOPLEFT", 0, -5)
                f:SetPoint("TOPRIGHT", itemFilterContent, "TOPRIGHT", 0, -5)
            end
            f:SetHeight(15)

            f.itemicon = CreateFrame("Button", nil, f)
            f.itemicon:SetSize(18, 18)
            f.itemicon:EnableMouse(true)
            f.itemicon:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
            f.itemicon:SetPoint("LEFT", f, "LEFT", 2, 0)
            f.itemicon:SetScript("OnEnter", function()
                GameTooltip:ClearAllPoints()
                GameTooltip:ClearLines()
                GameTooltip:SetOwner(f, "ANCHOR_NONE")
                GameTooltip:SetHyperlink("item:" .. f.itemId)
                GameTooltip:SetPoint("RIGHT", f, "LEFT", -5, 0)
                GameTooltip:Show()
            end)
            f.itemicon:SetScript("OnLeave", function() GameTooltip:Hide() end)
            f.itemicon:SetScript("OnMouseUp", function (self)
                if (select(1, GetCursorInfo())) == "item" then
                    local _, itemId, itemlink = GetCursorInfo()
                    local isExist = false
                    for _, data in ipairs(ZL_SETTING.filterItemId) do
                        if data.itemId == itemId then
                            isExist = true
                        end
                    end
                    if (not isExist) then
                        ZL_SETTING.filterItemId[v].itemId = itemId
                        ZL_SETTING.filterItemId[v].itemlink = itemlink
                        filterFrame:Update()
                        ClearCursor()
                    else
                        local msgStr = "物品ID已存在！"
                        ZL.Print(msgStr)
                        GameTooltipShow(self, "BOTTOM", "TOP")
                        GameTooltip:AddLine(msgStr)
                        GameTooltip:Show()
                        C_Timer.After(3, function ()
                            GameTooltip:Hide()
                        end)
                    end
                    
                end
            end)

            f.itemIdBox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
            f.itemIdBox:SetPoint("LEFT", f.itemicon, "RIGHT", 8, 0)
            f.itemIdBox:SetSize(60, 15)
            f.itemIdBox:SetFont(GameFontNormal:GetFont(), 12, "")
            f.itemIdBox:SetMultiLine(false)
            f.itemIdBox:SetTextColor(1, 1, 1)
            f.itemIdBox:SetJustifyH("LEFT")
            f.itemIdBox:SetAutoFocus(false)
            f.itemIdBox:SetNumeric(true)
            f.itemIdBox:Disable()

            f.itemNameFont = f:CreateFontString(nil, "BACKGROUND")
            f.itemNameFont:SetPoint("LEFT", f.itemIdBox, "RIGHT", 5, 0)
            f.itemNameFont:SetSize(130, 15)
            f.itemNameFont:SetFont(GameFontNormal:GetFont(), 12)
            f.itemNameFont:SetTextColor(1, 1, 1)
            f.itemNameFont:SetWordWrap(false)
            f.itemNameFont:SetJustifyH("LEFT")

            f.lootCheckButton = CreateFrame("CheckButton", nil, f, "ChatConfigCheckButtonTemplate")
            f.lootCheckButton:SetPoint("LEFT", f.itemNameFont, "RIGHT", -3, 0)
            f.lootCheckButton.Text:SetText("不自动拾取")
            f.lootCheckButton.Text:SetFont(GameFontNormal:GetFont(), 10, "")
            f.lootCheckButton.tooltip = "勾选后不自动分配给ML"
            f.lootCheckButton:SetHitRectInsets(0, -f.lootCheckButton.Text:GetWidth(), 0, 0)
            f.lootCheckButton:SetScript("OnClick", function (self)
                ZL_SETTING["filterItemId"][v].loot = f.lootCheckButton:GetChecked()
            end)
            f.auctionCheckButton = CreateFrame("CheckButton", nil, f, "ChatConfigCheckButtonTemplate")
            f.auctionCheckButton:SetPoint("LEFT", f.lootCheckButton, "RIGHT", f.lootCheckButton.Text:GetWidth(), 0)
            f.auctionCheckButton.Text:SetText("不自动创建拍卖")
            f.auctionCheckButton.Text:SetFont(GameFontNormal:GetFont(), 10, "")
            f.auctionCheckButton.tooltip = "勾选后不自动创建拍卖"
            f.auctionCheckButton:SetHitRectInsets(0, -f.auctionCheckButton.Text:GetWidth(), 0, 0)
            f.auctionCheckButton:SetScript("OnClick", function (self)
                ZL_SETTING["filterItemId"][v].auction = f.auctionCheckButton:GetChecked()
            end)

            f.del = CreateButton(nil, f, "-", "LEFT", f.auctionCheckButton, "RIGHT", f.auctionCheckButton.Text:GetWidth()-2, 0, 20, 20)
            f.del:SetScript("OnClick", function (self)
                table.remove(ZL_SETTING.filterItemId, v)
                filterFrame:Update()
            end)
            function f:SetValues(v, itemId, itemlink)
                self.itemicon:SetNormalTexture(cGetItemIcon(itemId))
				self.itemIdBox:SetNumber(itemId)
                self.itemNameFont:SetTextScale(1)
                self.itemNameFont:SetText(itemlink)
                self.lootCheckButton:SetChecked(ZL_SETTING["filterItemId"][v].loot)
                self.auctionCheckButton:SetChecked(ZL_SETTING["filterItemId"][v].auction)
                local bili = self.itemNameFont:GetWidth()/(self.itemNameFont:GetUnboundedStringWidth()+5)
                bili = bili <= 1 and bili or 1
                self.itemNameFont:SetTextScale(bili)
				self.itemId = itemId
            end
            t[v] = f
            return f
        end
    })
    function filterFrame:Update()
        for _, f in ipairs(self.entries) do f:Hide() end
        for num, data in ipairs(ZL_SETTING.filterItemId) do
            local f = self.entries[num]
            f:Show()
            f:SetValues(num, data.itemId, data.itemlink)
        end
        itemFilterContent:SetHeight(20 * #ZL_SETTING.filterItemId - 5)
    end
end

--创建历史拍卖记录和当前拍卖收入记录框架
function ZL:CreateAuctionRecordFrame()
    ZL.AuctionRecordFrame = CreateFrame("Frame", "ZLAuctionRecordFrame", ZL, "UIPanelDialogTemplate")
    local AuctionRecordFrame = ZL.AuctionRecordFrame
    AuctionRecordFrame:SetSize(595, 500) --330, 350
    AuctionRecordFrame:SetResizeBounds(595, 300, 595, GetScreenHeight()/ZL.opt.ZLAuctionRecordFrameScale-30)
    AuctionRecordFrame:SetPoint("CENTER", UIParent, "CENTER")
    AuctionRecordFrame:SetFrameStrata("HIGH")
    AuctionRecordFrame:SetClampedToScreen(true)  --不能超出游戏屏幕，false可以超出游戏屏幕
    AuctionRecordFrame:SetMovable(true)
    AuctionRecordFrame:SetResizable(true)
    -- AuctionRecordFrame:SetHitRectInsets(0, 0, 0, ZLAuctionRecordFrameDialogBG:GetHeight()+3) --设置鼠标可点击区域
    AuctionRecordFrame:SetScale(ZL.opt.ZLAuctionRecordFrameScale)
    AuctionRecordFrame:SetScript("OnMouseUp", function (self)
        self:StopMovingOrSizing()
    end)
    AuctionRecordFrame:SetScript("OnMouseDown", function (self)
        self:StartMoving()
    end)
    AuctionRecordFrame:SetScript("OnShow", function (self)
        ZL.opt.ZLAuctionRecordFrameIsShown = true
        self.historyFrame:Update()
        self.currentIncomeFrame:Update()
        self.playerBalanceFrame:Update()
    end)
    -- 创建右下角的拉伸角标
    CreateResizeButton(AuctionRecordFrame)

    AuctionRecordFrame.Title:SetText("拍卖记录")
    if WOW_PROJECT_ID ~= 1 then
        _G["ZLAuctionRecordFrameClose"]:ClearAllPoints()
        _G["ZLAuctionRecordFrameClose"]:SetPoint("TOPRIGHT", AuctionRecordFrame, "TOPRIGHT", 2, 1)
    end
    _G["ZLAuctionRecordFrameClose"]:HookScript("OnClick", function ()
        ZL.opt.ZLAuctionRecordFrameIsShown = false
    end)
    AuctionRecordFrame:Hide()

    AuctionRecordFrame.historyFrame = CreateFrame("Frame", nil, AuctionRecordFrame)
    local historyFrame = AuctionRecordFrame.historyFrame
    historyFrame:SetPoint("TOPLEFT", ZLAuctionRecordFrameDialogBG, "TOPLEFT")
    historyFrame:SetSize(ZLAuctionRecordFrameDialogBG:GetWidth(), 50)
    -- background(historyFrame)

    historyFrame.ClearHistoryBtn = CreateButton(nil, historyFrame, "清空历史记录", "TOPLEFT", historyFrame, "TOPLEFT", 5, -5, 100)
    local ClearHistoryBtn = historyFrame.ClearHistoryBtn
    ClearHistoryBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    ClearHistoryBtn:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            StaticPopup_Show("ZL_CLEARHISTORYWARNING")
        elseif button == "RightButton" then
            ZL.OpenAceConfigDialog("金团拍卖助手", "dataSave")
        end
    end)
    ClearHistoryBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("提示：")
        GameTooltip:AddLine("左键：|cffffffff清空全部拍卖记录|r")
        GameTooltip:AddLine("右键：|cffffffff设置保存拍卖记录天数|r")
        GameTooltip:Show()
    end)
    ClearHistoryBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    historyFrame.nameFont = historyFrame:CreateFontString()
    local nameFont = historyFrame.nameFont
    nameFont:SetPoint("TOPLEFT", ClearHistoryBtn, "BOTTOMLEFT", 5, -8)
    nameFont:SetWidth(170)
    nameFont:SetFont(GameFontNormal:GetFont(), 15)
    nameFont:SetTextColor(1, 0.82, 0)
    nameFont:SetText("名       称")
    nameFont:SetWordWrap(false)
    nameFont:SetJustifyH("CENTER")

    historyFrame.TotalIncomeFont = historyFrame:CreateFontString()
    local TotalIncomeFont = historyFrame.TotalIncomeFont
    TotalIncomeFont:SetPoint("LEFT", nameFont, "RIGHT", 5, 0)
    TotalIncomeFont:SetWidth(80)
    TotalIncomeFont:SetFont(GameFontNormal:GetFont(), 15)
    TotalIncomeFont:SetTextColor(1, 0.82, 0)
    TotalIncomeFont:SetText("净收入(g)")
    TotalIncomeFont:SetWordWrap(false)
    TotalIncomeFont:SetJustifyH("CENTER")

    historyFrame.auctionDateFont = historyFrame:CreateFontString()
    local auctionDateFont = historyFrame.auctionDateFont
    auctionDateFont:SetPoint("LEFT", TotalIncomeFont, "RIGHT", 5, 0)
    auctionDateFont:SetWidth(170)
    auctionDateFont:SetFont(GameFontNormal:GetFont(), 15)
    auctionDateFont:SetTextColor(1, 0.82, 0)
    auctionDateFont:SetText("创建时间")
    auctionDateFont:SetWordWrap(false)
    auctionDateFont:SetJustifyH("CENTER")
    historyFrame:Hide()

    AuctionRecordFrame.currentIncomeFrame = CreateFrame("Frame", nil, AuctionRecordFrame)
    local currentIncomeFrame = AuctionRecordFrame.currentIncomeFrame
    currentIncomeFrame:SetPoint("TOPLEFT", ZLAuctionRecordFrameDialogBG, "TOPLEFT")
    currentIncomeFrame:SetSize(ZLAuctionRecordFrameDialogBG:GetWidth(), 50)
    currentIncomeFrame:SetScript("OnMouseDown", function ()
        -- ClearFocus()
    end)

    currentIncomeFrame.totalIncomeFont = currentIncomeFrame:CreateFontString()
    local totalIncomeFont = currentIncomeFrame.totalIncomeFont
    totalIncomeFont:SetPoint("TOPLEFT", currentIncomeFrame, "TOPLEFT", 5, -5)
    totalIncomeFont:SetFont(GameFontNormal:GetFont(), 14)
    totalIncomeFont:SetTextColor(1, 1, 1)
    totalIncomeFont:SetText("净收入:")
    totalIncomeFont:SetWordWrap(false)
    totalIncomeFont:SetJustifyH("LEFT")

    currentIncomeFrame.notesFont = currentIncomeFrame:CreateFontString()
    local notesFont = currentIncomeFrame.notesFont
    notesFont:SetPoint("TOPLEFT", totalIncomeFont, "BOTTOMLEFT", 0, -8)
    notesFont:SetWidth(210)
    notesFont:SetFont(GameFontNormal:GetFont(), 15)
    notesFont:SetTextColor(1, 0.82, 0)
    notesFont:SetText("名      称")
    notesFont:SetWordWrap(false)
    notesFont:SetJustifyH("CENTER")

    currentIncomeFrame.playerFont = currentIncomeFrame:CreateFontString()
    local playerFont = currentIncomeFrame.playerFont
    playerFont:SetPoint("LEFT", notesFont, "RIGHT", 0, 0)
    playerFont:SetWidth(135)
    playerFont:SetFont(GameFontNormal:GetFont(), 15)
    playerFont:SetTextColor(1, 0.82, 0)
    playerFont:SetText("玩家名字")
    playerFont:SetWordWrap(false)
    playerFont:SetJustifyH("CENTER")

    currentIncomeFrame.amountFont = currentIncomeFrame:CreateFontString()
    local amountFont = currentIncomeFrame.amountFont
    amountFont:SetPoint("LEFT", playerFont, "RIGHT", 0, 0)
    amountFont:SetWidth(80)
    amountFont:SetFont(GameFontNormal:GetFont(), 15)
    amountFont:SetTextColor(1, 0.82, 0)
    amountFont:SetText("总金额")
    amountFont:SetWordWrap(false)
    amountFont:SetJustifyH("CENTER")

    currentIncomeFrame.bidCountFont = currentIncomeFrame:CreateFontString()
    local bidCountFont = currentIncomeFrame.bidCountFont
    bidCountFont:SetPoint("LEFT", amountFont, "RIGHT", -5, 0)
    bidCountFont:SetWidth(45)
    bidCountFont:SetFont(GameFontNormal:GetFont(), 15)
    bidCountFont:SetTextColor(1, 0.82, 0)
    bidCountFont:SetText("数量")
    bidCountFont:SetWordWrap(false)
    bidCountFont:SetJustifyH("CENTER")
    currentIncomeFrame:Hide()

    AuctionRecordFrame.playerBalanceFrame = CreateFrame("Frame", nil, AuctionRecordFrame)
    local playerBalanceFrame = AuctionRecordFrame.playerBalanceFrame
    playerBalanceFrame:SetPoint("TOPLEFT", ZLAuctionRecordFrameDialogBG, "TOPLEFT")
    playerBalanceFrame:SetSize(ZLAuctionRecordFrameDialogBG:GetWidth(), 50)

    local function mailConfirmBtnRightClick()
        if ZL.mailRegOpen then
            ZL.mailRegOpen = false
            playerBalanceFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
            for i = 1, 2 do
                SendChatMessage("已停止邮寄登记！", ZL.MsgChannel())
            end
        end
        if ZL_CURRENT.mailPlayers and next(ZL_CURRENT.mailPlayers, nil) and (not InCombatLockdown()) and (UnitIsGroupLeader("player") or UnitIsGroupAssistant("player")) then
            local mailPlayerList = {}
            for name, _ in pairs(ZL_CURRENT.mailPlayers) do
                table.insert(mailPlayerList, name)
            end
            ZL.ChangePlayerGroup(mailPlayerList)
        end
    end

    playerBalanceFrame.mailConfirmBtn = CreateButton(nil, playerBalanceFrame, "|cffffffff邮寄登记|r", "TOPLEFT", playerBalanceFrame, "TOPLEFT", 5, -8, 80)
    playerBalanceFrame.mailConfirmBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    playerBalanceFrame.mailConfirmBtn:SetScript("OnClick", function (self, button)
        if PlayerIsML() then
            if button == "LeftButton" then
                if IsShiftKeyDown() then
                    if (not ZL_CURRENT["mailPlayers"]) then ZL_CURRENT["mailPlayers"] = {} end
                    --为当前团队名单时，保存一次名单
                    if ZL.opt.wagesGroupMembers == 0 then ZL.saveRaidMembers() end
                    ZL.mailRegOpen = false
                    playerBalanceFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
                    local currentRoSter = ZL.GetWagesGroupMembers()
                    if currentRoSter then
                        for _, data in ipairs(currentRoSter) do
                            if #data > 0 then
                                for _, name in ipairs(data) do
                                    local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
                                    if (not PlayerIsML(name)) and (biLi > 0) and (ZL_CURRENT["mailPlayers"][name] == nil) and ((not ZL_CURRENT.tradeGongZi) or (not ZL_CURRENT.tradeGongZi[name])) then
                                        ZL_CURRENT["mailPlayers"][name] = false
                                    end
                                end
                            end
                        end
                        local msgStr = "已登记全部邮寄工资！"
                        SendChatMessage(msgStr, ZL.MsgChannel())
                        MyAddon:TransmitAddonInfo("AUTOAUC SOUND", {type="系统", soundName=msgStr})
                        ZL.Print(msgStr)
                    else
                        ZL.Print("没有需要邮寄的成员！")
                    end
                else
                    ZL.mailRegOpen = true
                    playerBalanceFrame.mailConfirmBtn:SetText("|cff948cff邮寄登记中|r")
                    for i = 1, 2 do
                        SendChatMessage("有需要邮寄的，【私聊】我发送：邮寄，插件自动登记！", (UnitIsGroupLeader("player") or UnitIsRaidOfficer("player")) and "RAID_WARNING" or "RAID")
                    end
                end
            elseif button == "RightButton" then
                if IsShiftKeyDown() then
                    if ZL_CURRENT["mailPlayers"] and next(ZL_CURRENT["mailPlayers"], nil) then
                        for name, _ in pairs(ZL_CURRENT["mailPlayers"]) do
                            ZL_CURRENT["mailPlayers"][name] = nil
                        end
                    end
                else
                    mailConfirmBtnRightClick()
                end
            end
        else
            local msgStr = "你不是ML，无法使用当前功能"
            ZL.Print(msgStr)
        end
    end)
    playerBalanceFrame.mailConfirmBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "LEFT", "RIGHT")
        if ZL_CURRENT.mailPlayers and next(ZL_CURRENT.mailPlayers, nil) then
            GameTooltip:AddLine("邮寄名单：", 1, 1, 1)
            GameTooltip:AddDoubleLine("名字", "小队")
            for name, value in pairs(ZL_CURRENT.mailPlayers) do
                local isExist = false
                for i = 1, MAX_RAID_MEMBERS do
                    local _name, _, subgroup = GetRaidRosterInfo(i)
                    if _name and GetClassColorName(_name) == name then
                        if value then
                            name = name .. "(已邮寄)"
                        end
                        GameTooltip:AddDoubleLine(name, subgroup .. "队", 1, 1, 1, 1, 1, 1)
                        isExist = true
                        break
                    end
                end
                if (not isExist) then
                    if value then
                        name = name .. "(已邮寄)"
                    end
                    GameTooltip:AddDoubleLine(name, "已离队", 1, 1, 1, 1, 0, 0)
                end
            end
        else
            GameTooltip:AddLine("没有需要邮寄工资的成员！")
        end
        GameTooltip:AddLine(" ")
        if ZL.mailRegOpen then
            GameTooltip:AddLine("状态：|cff948cff已开放登记|r")
        else
            GameTooltip:AddLine("状态：|cffffffff已关闭登记|r")
        end
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("左键：|cffffffff开始接受登记邮寄工资信息|r")
        GameTooltip:AddLine("右键：|cffffffff关闭登记邮寄工资信息\n并将需要邮寄工资的成员调到后面小队|r")
        GameTooltip:AddLine("Shift+左键：|cffffffff全部邮寄并关闭邮寄登记，\n如为当前团队，则保存名单|r")
        GameTooltip:AddLine("Shift+右键：|cffffffff全部取消邮寄|r")
        GameTooltip:Show()
    end)
    playerBalanceFrame.mailConfirmBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)
    playerBalanceFrame.mailConfirmDropDown = CreateFrame("FRAME", nil, playerBalanceFrame, "UIDropDownMenuTemplate")
    UIDropDownMenu_SetWidth(playerBalanceFrame.mailConfirmDropDown , 8)
    playerBalanceFrame.mailConfirmDropDown:SetPoint("LEFT", playerBalanceFrame.mailConfirmBtn, "RIGHT", -15, -2)
    playerBalanceFrame.mailConfirmDropDown:SetScale(1)
    UIDropDownMenu_Initialize(playerBalanceFrame.mailConfirmDropDown, function (self, level, menuList)
        local currentRoster = ZL.GetWagesGroupMembers()
        if not currentRoster then return end
        local info = UIDropDownMenu_CreateInfo()
        wipe(info)
        if (level or 1) == 1 then
            info.isTitle = 1
            info.text = "选择邮寄工资名单(ML功能)"
            info.notCheckable = 1
            UIDropDownMenu_AddButton(info, level)
            local msg = select(2, ZL.GetWagesGroupMembers())
            if msg then
                info.text = msg
                info.notCheckable = 1
                UIDropDownMenu_AddButton(info, level)
            end
            info.isTitle = nil
            info.notCheckable = nil
            info.disabled = nil
            for i = 1, #currentRoster do
                if #currentRoster[i] > 0 then
                    info.isNotRadio = 1
                    info.notCheckable = 1
                    info.keepShownOnClick = 1
                    info.text = "小队 " .. i
                    info.hasArrow = true
                    info.menuList = currentRoster[i]
                    UIDropDownMenu_AddButton(info, level)
                end
            end
        else
            for _, name in ipairs(menuList) do
                if not PlayerIsML(name) then
                    info.isNotRadio = 1
                    info.text = name
                    info.hasArrow = false
                    info.checked = (ZL_CURRENT.mailPlayers and ZL_CURRENT.mailPlayers[name] ~= nil) and true or false
                    info.keepShownOnClick = 1
                    info.func = function()
                        if PlayerIsML() then
                            if ZL_CURRENT.tradeGongZi and ZL_CURRENT.tradeGongZi[name] then
                                info.checked = false
                                local msgStr = "|cffff0000工资已交易过，无需登记邮寄！|r"
                                ZL.Print(msgStr)
                                return
                            end
                            if not ZL_CURRENT.mailPlayers then ZL_CURRENT.mailPlayers = {} end
                            if ZL_CURRENT.mailPlayers[name] ~= nil then
                                ZL_CURRENT.mailPlayers[name] = nil
                            else
                                ZL_CURRENT.mailPlayers[name] = false
                            end
                            info.checked = (ZL_CURRENT.mailPlayers and ZL_CURRENT.mailPlayers[name] ~= nil) and true or false
                        else
                            local msgStr = "你不是ML，无法使用这个功能！"
                            ZL.Print(msgStr)
                        end
                    end
                    if PlayerIsML() then
                        if ZL_CURRENT.tradeGongZi and ZL_CURRENT.tradeGongZi[name] then
                            info.text = name .. "(已交易工资)"
                            info.checked = false
                            info.disabled = true
                        else
                            info.disabled = false
                        end
                    else
                        info.disabled = true
                    end
                    UIDropDownMenu_AddButton(info, level)
                end
            end
        end
    end)

    playerBalanceFrame.SendMailBtn = CreateButton(nil, playerBalanceFrame, "一键邮寄", "LEFT", playerBalanceFrame.mailConfirmDropDown, "RIGHT", -5, 2)
    playerBalanceFrame.SendMailBtn:Disable()
    playerBalanceFrame.SendMailBtn:SetScript("OnClick", function (self)
        if not PlayerIsML() then
            local msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(msgStr)
            return
        end
        local WagesGroupMembers, _, _, RL = ZL.GetWagesGroupMembers()
        if not WagesGroupMembers then
            local msgStr = "没有团队成员数据，无法邮寄工资！"
            ZL.Print(msgStr)
            return
        end
        local NeedMailNums = ZL.GetNeedMailNums()
        if NeedMailNums == 0 then
            local msgStr = "没有需要邮寄工资的成员！"
            ZL.Print(msgStr)
            return
        end
        local wagesGroupMembersIndex = (ZL_CURRENT["globalConfig"] and ZL_CURRENT["globalConfig"]["wagesGroupMembers"]) and ZL_CURRENT["globalConfig"]["wagesGroupMembers"] or 0
        if wagesGroupMembersIndex == 0 and ZL.AuctionRecordFrame.playerBalanceFrame.wagesNumber:GetNumber() <= 0 then
            local msgStr = "你选择的是：|cffff0000当前团队名单|r，请输入具体的工资人数后再邮寄工资！"
            ZL.Print(msgStr, true)
            return
        end
        local playerBuyList = ZL.GetPlayerBuyList()
        for _, data in ipairs(WagesGroupMembers) do
            if #data > 0 then
                for _, name in ipairs(data) do
                    if ZL_CURRENT["mailPlayers"][name] == false then
                        local balanceAmount = 0
                        local playerPayToMLamount = 0
                        local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
                        local buTie = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].buTie) and ZL_CURRENT.WagesBiLi[name].buTie or 0
                        if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
                            playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
                        end
                        local amount = playerPayToMLamount - (playerBuyList[name] and playerBuyList[name].totalAmount or 0)
                        amount = amount > 0 and 0 or amount
                        if RL and RL == name then
                            if ZL.opt.RLBuTieType == 3 then
                                balanceAmount = ZL_CURRENT["aveWages"] * biLi * 2 + amount
                            else
                                balanceAmount = ZL_CURRENT["aveWages"] * biLi + amount
                            end
                        else
                            balanceAmount = ZL_CURRENT["aveWages"] * biLi + amount
                        end
                        balanceAmount = math.floor(balanceAmount)
                        local moneyToMail = balanceAmount + buTie
                        if moneyToMail > 0 then
                            if (GetMoney() < (moneyToMail*10000 + 30)) then
                                ZL.ScrollingMessageFrame:AddMessage("身上G不够，已停止邮寄！", 1, 0, 0)
                                return
                            end
                            local function _sendMail()
                                if ZL.Recipient then
                                    C_Timer.After(0.2, _sendMail)
                                else
                                    if ZL.StopSendMail then
                                        ZL.StopSendMail = nil
                                        return
                                    end
                                    ZL.Recipient = name
                                    ZL.moneyToMail = moneyToMail
                                    local targetName = ParseClassColorName(name)
                                    local gongZi = balanceAmount
                                    ClearSendMail()
                                    SetSendMailMoney(moneyToMail * 10000)
                                    local contentText = ""
                                    if buTie > 0 then
                                        contentText = "尊敬的" .. targetName .. "勇士：\n\n　　感谢您的付出，这是您的工资：" .. gongZi .. "g，补贴：" .. buTie .. "g，请及时查收，期待您下次加入！\n\n\n　　　　　　　" .. date("%Y-%m-%d %H:%M", GetServerTime())
                                    else
                                        contentText = "尊敬的" .. targetName .. "勇士：\n\n　　感谢您的付出，这是您的工资，请及时查收，期待您下次加入！\n\n\n　　　　　　　" .. date("%Y-%m-%d %H:%M", GetServerTime())
                                    end
                                    --添加为好友
                                    local UnitGuid = ZL_CURRENT["UnitGUID"] and ZL_CURRENT["UnitGUID"][name]
                                    local isFriend = C_FriendList.IsFriend(UnitGuid)
                                    local delay = 0
                                    if UnitGuid and (not isFriend) then
                                        C_FriendList.AddFriend(targetName)
                                        -- 初始化好友状态
                                        C_FriendList.ShowFriends()
                                        delay = 0.5
                                    end
                                    local function linshi()
                                        if C_FriendList.IsFriend(UnitGuid) then
                                            C_Timer.After(delay, function ()
                                                SendMail(targetName, "<AutoAuction>工资：" .. moneyToMail .. " g", contentText)
                                                --删除刚添加的好友
                                                if not isFriend then
                                                    C_Timer.After(1, function ()
                                                        C_FriendList.RemoveFriend(targetName)
                                                    end)
                                                end
                                            end)
                                        else
                                            C_Timer.After(0.3, linshi)
                                        end
                                    end
                                    linshi()
                                end
                            end
                            _sendMail()
                        end
                    end
                end
            end
        end
    end)
    playerBalanceFrame.wagesCheckButton = CreateFrame("CheckButton", nil, playerBalanceFrame, "ChatConfigCheckButtonTemplate")
    playerBalanceFrame.wagesCheckButton:SetPoint("LEFT", playerBalanceFrame.SendMailBtn , "RIGHT", 0, 0)
    playerBalanceFrame.wagesCheckButton.Text:SetText("所有人工资")
    playerBalanceFrame.wagesCheckButton.Text:SetFont(GameFontNormal:GetFont(), 13, "")
    playerBalanceFrame.wagesCheckButton.Text:SetTextColor(1, 0.82, 0)
    playerBalanceFrame.wagesCheckButton.Text:ClearAllPoints()
    playerBalanceFrame.wagesCheckButton.Text:SetPoint("LEFT", playerBalanceFrame.wagesCheckButton , "RIGHT", -3, 0)
    playerBalanceFrame.wagesCheckButton:SetHitRectInsets(0, -playerBalanceFrame.wagesCheckButton.Text:GetWidth(), 0, 0)
    playerBalanceFrame.wagesCheckButton.tooltip = "勾选将显示全部成员工资\n不勾选显示欠款或有需要交易装备名单\n|cffffffff打开邮箱或交易中不生效|r"
    playerBalanceFrame.wagesCheckButton:SetChecked(ZL.opt.showAllWages)
    playerBalanceFrame.wagesCheckButton:SetScript("OnClick", function ()
        ZL.opt.showAllWages = playerBalanceFrame.wagesCheckButton:GetChecked()
        playerBalanceFrame:Update()
    end)

    playerBalanceFrame.butieMail = playerBalanceFrame:CreateFontString()
    local butieMail = playerBalanceFrame.butieMail
    butieMail:SetPoint("LEFT", playerBalanceFrame.wagesCheckButton, "RIGHT", 80, 0)
    butieMail:SetFont(GameFontNormal:GetFont(), 13)
    butieMail:SetTextColor(1, 0.82, 0)
    butieMail:SetWordWrap(false)
    butieMail:SetJustifyH("LEFT")

    playerBalanceFrame.wagesNumberFont = playerBalanceFrame:CreateFontString()
    local wagesNumberFont = playerBalanceFrame.wagesNumberFont
    wagesNumberFont:SetPoint("TOPLEFT", playerBalanceFrame.mailConfirmBtn, "BOTTOMLEFT", 0, -5)
    wagesNumberFont:SetHeight(20)
    wagesNumberFont:SetFont(GameFontNormal:GetFont(), 13)
    wagesNumberFont:SetTextColor(1, 0.82, 0)
    wagesNumberFont:SetWordWrap(false)
    wagesNumberFont:SetJustifyH("LEFT")
    wagesNumberFont:SetText("工资人数")

    playerBalanceFrame.wagesNumber = CreateEditBox(playerBalanceFrame, 45, 20, 14, "RIGHT", true)
    local wagesNumber = playerBalanceFrame.wagesNumber
    wagesNumber:SetPoint("LEFT", wagesNumberFont, "RIGHT", 5, 0)
    wagesNumber:SetScript("OnTextChanged", function (self)
        playerBalanceFrame:Update()
    end)
    wagesNumber:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "LEFT", "RIGHT")
        GameTooltip:AddLine("注意：非特殊情况不需要手动输入！", 1, 0, 0)
        GameTooltip:AddLine("手动输入后，无论是当前名单还是历史名单\n都将按照输入人数计算工资！\n并且工资比例不生效！")
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("仅在忘记保存团员名单时使用\n并且所有成员都将按照100%比例计算工资", 1, 0, 0)
        GameTooltip:Show()
    end)
    wagesNumber:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    playerBalanceFrame.SendMsgBtn = CreateButton(nil, playerBalanceFrame, "通报", "LEFT", wagesNumber, "RIGHT", 13, 0, 40)
    local SendMsgBtn = playerBalanceFrame.SendMsgBtn
    SendMsgBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    SendMsgBtn:SetScript("OnClick", function (self, button)
        local msgStr
        if not PlayerIsML() then
            msgStr = "你不是ML，无法使用该功能！"
            ZL.Print(msgStr)
            return
        end
        if button == "LeftButton" then
            if IsShiftKeyDown() then
                ZL.reportConsumerRanking()
            else
                ZL.reportIncomeConfirm()
            end
        elseif button == "RightButton" then
            ZL.reportIncomeConfirm(true)
        end
    end)
    SendMsgBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "LEFT", "RIGHT")
        local playerBuyList = ZL.GetPlayerBuyList()
        local msg = select(2, ZL.GetWagesGroupMembers())
        if msg then
            GameTooltip:AddLine(msg)
        end
        if next(playerBuyList, nil) then
            GameTooltip:AddLine("消费排名(前10)：")
            GameTooltip:AddDoubleLine("名字", "消费金额")
            local tempList = {}
            for name, value in pairs(playerBuyList) do
                table.insert(tempList, {name=name, totalAmount=value.totalAmount})
            end
            if #tempList > 1 then
                table.sort(tempList, function (a, b)
                    return a.totalAmount > b.totalAmount
                end)
            end
            for index, data in ipairs(tempList) do
                if data.totalAmount > 0  then
                    if index <= 3 then
                        GameTooltip:AddDoubleLine(data.name, data.totalAmount, 1, 0, 0, 1, 0, 0)
                    elseif index <= 10 then
                        GameTooltip:AddDoubleLine(data.name, data.totalAmount, 1, 1, 1, 1, 1, 1)
                    end
                end
            end
        else
            GameTooltip:AddLine("暂时无人消费")
        end
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("左键：|cffffffff通报详细清单工资|r")
        GameTooltip:AddLine("右键：|cffffffff通报小队工资|r")
        GameTooltip:AddLine("Shift+左键：|cffffffff通报消费排名|r")
        GameTooltip:Show()
    end)
    SendMsgBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    playerBalanceFrame.groupFont = playerBalanceFrame:CreateFontString()
    local groupFont = playerBalanceFrame.groupFont
    groupFont:SetPoint("TOPLEFT", wagesNumberFont, "BOTTOMLEFT", 0, -10)
    groupFont:SetWidth(15)
    groupFont:SetFont(GameFontNormal:GetFont(), 15)
    groupFont:SetTextColor(1, 0.82, 0)
    groupFont:SetTextScale(1)
    groupFont:SetText("队")
    groupFont:SetWordWrap(false)
    groupFont:SetJustifyH("CENTER")
    local bili = groupFont:GetWidth()/(groupFont:GetUnboundedStringWidth()+3)
    bili = bili <= 1 and bili or 1
    groupFont:SetTextScale(bili)

    playerBalanceFrame.playerNameFont = playerBalanceFrame:CreateFontString()
    local playerNameFont = playerBalanceFrame.playerNameFont
    playerNameFont:SetPoint("LEFT", groupFont, "RIGHT", 8, 0)
    playerNameFont:SetWidth(130)
    playerNameFont:SetFont(GameFontNormal:GetFont(), 15)
    playerNameFont:SetTextColor(1, 0.82, 0)
    playerNameFont:SetText("玩家名字")
    playerNameFont:SetWordWrap(false)
    playerNameFont:SetJustifyH("CENTER")

    playerBalanceFrame.playerBalanceFont = playerBalanceFrame:CreateFontString()
    local playerBalanceFont = playerBalanceFrame.playerBalanceFont
    playerBalanceFont:SetPoint("LEFT", playerNameFont, "RIGHT", 5, 0)
    playerBalanceFont:SetWidth(60)
    playerBalanceFont:SetFont(GameFontNormal:GetFont(), 15)
    playerBalanceFont:SetTextColor(1, 0.82, 0)
    playerBalanceFont:SetText("工资")
    playerBalanceFont:SetWordWrap(false)
    playerBalanceFont:SetJustifyH("CENTER")

    playerBalanceFrame.biLiFont = playerBalanceFrame:CreateFontString()
    local biLiFont = playerBalanceFrame.biLiFont
    biLiFont:SetPoint("LEFT", playerBalanceFont, "RIGHT", 0, 0)
    biLiFont:SetWidth(50)
    biLiFont:SetFont(GameFontNormal:GetFont(), 14)
    biLiFont:SetTextColor(1, 0.82, 0)
    biLiFont:SetTextScale(1)
    biLiFont:SetText("比例(%)")
    biLiFont:SetWordWrap(false)
    biLiFont:SetJustifyH("CENTER")
    local _bili = biLiFont:GetWidth()/(biLiFont:GetUnboundedStringWidth()+5)
    _bili = _bili <= 1 and _bili or 1
    biLiFont:SetTextScale(_bili)

    playerBalanceFrame.qianKuanFont = playerBalanceFrame:CreateFontString()
    local qianKuanFont = playerBalanceFrame.qianKuanFont
    qianKuanFont:SetPoint("LEFT", biLiFont, "RIGHT", 5, 0)
    qianKuanFont:SetWidth(60)
    qianKuanFont:SetFont(GameFontNormal:GetFont(), 15)
    qianKuanFont:SetTextColor(1, 0.82, 0)
    qianKuanFont:SetText("欠款")
    qianKuanFont:SetWordWrap(false)
    qianKuanFont:SetJustifyH("CENTER")

    playerBalanceFrame.buTieFont = playerBalanceFrame:CreateFontString()
    local buTieFont = playerBalanceFrame.buTieFont
    buTieFont:SetPoint("LEFT", qianKuanFont, "RIGHT", 0, 0)
    buTieFont:SetWidth(50)
    buTieFont:SetFont(GameFontNormal:GetFont(), 15)
    buTieFont:SetTextColor(1, 0.82, 0)
    buTieFont:SetText("补贴")
    buTieFont:SetWordWrap(false)
    buTieFont:SetJustifyH("CENTER")

    playerBalanceFrame.totalFont = playerBalanceFrame:CreateFontString()
    local totalFont = playerBalanceFrame.totalFont
    totalFont:SetPoint("LEFT", buTieFont, "RIGHT", 5, 0)
    totalFont:SetWidth(60)
    totalFont:SetFont(GameFontNormal:GetFont(), 15)
    totalFont:SetTextColor(1, 0.82, 0)
    totalFont:SetText("总计")
    totalFont:SetWordWrap(false)
    totalFont:SetJustifyH("CENTER")

    playerBalanceFrame:Hide()

    --创建滚动条
    AuctionRecordFrame.scrollFrame = CreateFrame("ScrollFrame", nil, AuctionRecordFrame, "UIPanelScrollFrameTemplate")
    AuctionRecordFrame.scrollFrame:SetPoint("TOPLEFT", _G["ZLAuctionRecordFrameDialogBG"], "TOPLEFT", 3, -50)
    AuctionRecordFrame.scrollFrame:SetPoint("BOTTOMRIGHT", _G["ZLAuctionRecordFrameDialogBG"], "BOTTOMRIGHT", -3, 4)
    AuctionRecordFrame.scrollFrame:SetClipsChildren(true) --必须设置为true，scrollFrame所有的子元素才会被剪切
    AuctionRecordFrame.scrollFrame:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel) --重设滑动条鼠标滚轮事件
    --重设ScrollBar位置，放置到scrollFrame内，防止被剪切掉
    AuctionRecordFrame.scrollFrame.ScrollBar:ClearAllPoints()
    AuctionRecordFrame.scrollFrame.ScrollBar:SetPoint("TOPLEFT", AuctionRecordFrame.scrollFrame, "TOPRIGHT", -10, -15)
    AuctionRecordFrame.scrollFrame.ScrollBar:SetPoint("BOTTOMRIGHT", AuctionRecordFrame.scrollFrame, "BOTTOMRIGHT", -5, 15)

    local function Tab_OnClick(self)
        local frame = self:GetParent()
        local tabId = self:GetID()
        AuctionRecordFrame.scrollFrame:ClearAllPoints()
        if tabId == 1 then
            AuctionRecordFrame.scrollFrame:SetPoint("TOPLEFT", _G["ZLAuctionRecordFrameDialogBG"], "TOPLEFT", 3, -50)
            historyFrame:Show()
            currentIncomeFrame:Hide()
            playerBalanceFrame:Hide()
            if historyFrame.Update then historyFrame:Update() end
        elseif tabId == 2 then
            AuctionRecordFrame.scrollFrame:SetPoint("TOPLEFT", _G["ZLAuctionRecordFrameDialogBG"], "TOPLEFT", 3, -50)
            historyFrame:Hide()
            currentIncomeFrame:Show()
            playerBalanceFrame:Hide()
            currentIncomeFrame:Update()
        elseif tabId == 3 then
            AuctionRecordFrame.scrollFrame:SetPoint("TOPLEFT", _G["ZLAuctionRecordFrameDialogBG"], "TOPLEFT", 3, -80)
            historyFrame:Hide()
            currentIncomeFrame:Hide()
            playerBalanceFrame:Show()
            playerBalanceFrame:Update()
        end
        AuctionRecordFrame.scrollFrame:SetPoint("BOTTOMRIGHT", _G["ZLAuctionRecordFrameDialogBG"], "BOTTOMRIGHT", -3, 4)
        PanelTemplates_SetTab(frame, tabId)
        local scrollchild = frame.scrollFrame:GetScrollChild()
        if scrollchild then
            scrollchild:Hide()
        end
        frame.scrollFrame:SetScrollChild(self.content)
        self.content:Show()
    end

    local function CreateTab(frame, numTabs, ...)
        frame.numTabs = numTabs
        local contents = {}
        local frameName = frame:GetName()
        local template = ""
        for i = 1, numTabs do
            if WOW_PROJECT_ID == 1 then
                template = "PanelTabButtonTemplate"
            else --if WOW_PROJECT_ID == 11 or WOW_PROJECT_ID == 2 then
                template = "CharacterFrameTabButtonTemplate"
            end
            local tab = CreateFrame("Button", frameName.."Tab"..i, frame, template)
            tab:SetID(i)
            tab:SetText(select(i, ...))
            local fontString = tab:GetFontString()
            fontString:SetFont(GameFontNormal:GetFont(), 14)
            tab:SetScript("OnClick", Tab_OnClick)
            if WOW_PROJECT_ID == 1 then
                if i ==1 then
                    tab:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 5, 7)
                else
                    tab:SetPoint("TOPLEFT", _G[frameName.."Tab"..(i-1)], "TOPRIGHT", 1, 0)
                end
            else --if WOW_PROJECT_ID == 11 or WOW_PROJECT_ID == 2 then
                if i ==1 then
                    tab:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 0, 5)
                else
                    tab:SetPoint("TOPLEFT", _G[frameName.."Tab"..(i-1)], "TOPRIGHT", -20, 0)
                end
            end
            tab.content = CreateFrame("Frame", nil, frame.scrollFrame)
            tab.content:SetPoint("TOPLEFT", frame.scrollFrame, "TOPLEFT")
            tab.content:SetSize(frame.scrollFrame:GetWidth() - 40, 600)
            tab.content:Hide()
            table.insert(contents, tab.content)
        end
        Tab_OnClick(_G[frameName.."Tab1"])
        return unpack(contents)
    end

    local historyContent, currentIncomeContent, playerBalanceContent = CreateTab(AuctionRecordFrame, 3, "历史", "收支", "工资")

    currentIncomeFrame.dropDown = CreateFrame("FRAME", "ZLcurrentIncomeFrameDropDown", currentIncomeContent, "UIDropDownMenuTemplate")
    UIDropDownMenu_SetWidth(currentIncomeFrame.dropDown, 8)
    currentIncomeFrame.dropDown:SetScale(1)
    currentIncomeFrame.dropDown:Hide()
    UIDropDownMenu_Initialize(currentIncomeFrame.dropDown, function (self, level, menuList)
        local currentRoster, msg = ZL.GetWagesGroupMembers()
        if not currentRoster then return end
        local info = UIDropDownMenu_CreateInfo()
        if (level or 1) == 1 then
            if msg then
                info.text = msg
                info.notCheckable = 1
                UIDropDownMenu_AddButton(info, level)
            end
            info.isTitle = nil
            info.notCheckable = nil
            info.disabled = nil
            for i = 1, #currentRoster do
                if #currentRoster[i] > 0 then
                    info.text = "小队 " .. i
                    info.hasArrow = true
                    info.menuList = currentRoster[i]
                    UIDropDownMenu_AddButton(info, level)
                end
            end
        else
            for _, name in ipairs(menuList) do
                info.text = name
                info.hasArrow = false
                info.func = function()
                    --如果原来的名字是ML，则需将SelfAuction数据清除掉, ZL_CURRENT.IncomeList[v].isTraded改成false
                    local v = currentIncomeFrame.currenIndex
                    local f = currentIncomeFrame.entries[v]
                    local textName = f.playerbox:GetText()
                    local incomelist = ZL_CURRENT.IncomeList[v]
                    if PlayerIsML(textName) then
                        if ZL_CURRENT["playerPayToML"] and ZL_CURRENT["playerPayToML"][textName] then
                            ZL_CURRENT["playerPayToML"][textName] = ZL_CURRENT["playerPayToML"][textName] - incomelist.amount
                        end
                        if incomelist["itemList"] and next(incomelist["itemList"], nil) then
                            for key, data in pairs(incomelist["itemList"]) do
                                local itemId = string.match(key, "|c........|Hitem:(%d+):")
                                if itemId and (tonumber(itemId)==45038 or tonumber(itemId)==50274) then
                                    ZL_CURRENT.IncomeList[v]["itemList"][key].isTraded = true
                                else
                                    ZL_CURRENT.IncomeList[v]["itemList"][key].isTraded = false
                                end
                                if data.itemGUID and #data.itemGUID > 0 then
                                    for _, value in ipairs(data.itemGUID) do
                                        ZL_CURRENT["SelfAuction"][value] = nil
                                    end
                                end
                            end
                        end
                    end
                    if incomelist.tradeId then
                        --修改拍卖清单的记录
                        local spawnLIst = {}
                        if incomelist.itemList and next(incomelist.itemList, nil) then
                            for _, value in pairs(incomelist.itemList) do
                                if value["spawnUID"] and next(value["spawnUID"], nil) then
                                    for key2 in pairs(value["spawnUID"]) do
                                        spawnLIst[key2] = true
                                    end
                                end
                            end
                        end
                        if ZL_CURRENT.auctionlist then
                            for _, data in ipairs(ZL_CURRENT.auctionlist) do
                                if data.tradeId == incomelist.tradeId then
                                    if data["spawnUID"] and next(data["spawnUID"], nil) then
                                        for key, value in pairs(data["spawnUID"]) do
                                            if spawnLIst[key] then
                                                if value.successBidder and next(value.successBidder, nil) then
                                                    for palyerName, value2 in pairs(value.successBidder) do
                                                        if palyerName == textName then
                                                            value.successBidder[name] = value2
                                                            value.successBidder[palyerName] = nil
                                                        end
                                                    end
                                                end
                                                if value["itemGUID"] and next(value["itemGUID"], nil) then
                                                    for _, value2 in pairs(value["itemGUID"]) do
                                                        if value2["isUsed"] == textName then
                                                            value2["isUsed"] = name
                                                        end
                                                    end
                                                end
                                            end
                                        end
                                    end
                                    break
                                end
                            end
                        end
                    end
                    f.playerbox:SetText(name)
                    ZL_CURRENT.IncomeList[v].player = name
                    if PlayerIsML(name) then
                        if not ZL_CURRENT["playerPayToML"] then ZL_CURRENT["playerPayToML"] = {} end
                        ZL_CURRENT["playerPayToML"][name] = ZL_CURRENT["playerPayToML"][name] + incomelist.amount
                        if incomelist["itemList"] and next(incomelist["itemList"], nil) then
                            for key, data in pairs(incomelist["itemList"]) do
                                ZL_CURRENT.IncomeList[v]["itemList"][key].isTraded = true
                                if data.itemGUID and #data.itemGUID > 0 then
                                    for _, value in ipairs(data.itemGUID) do
                                        ZL_CURRENT["SelfAuction"][value] = true
                                    end
                                end
                            end
                        end
                    end
                    info.checked = true
                    CloseDropDownMenus()
                end
                UIDropDownMenu_AddButton(info, level)
            end
        end
    end)
    local function OnEnter(self)
        self:GetParent():SetNormalTexture("Interface\\FriendsFrame\\UI-FriendsFrame-HighlightBar")
    end
    local function OnLeave(self)
        local normalTexture = self:GetParent():GetNormalTexture()
        if normalTexture then
            normalTexture:Hide()
        end
    end
    historyFrame.entries = setmetatable({}, {
        __index = function(t, v)
            local f = CreateFrame("Button", nil, historyContent)
            if v > 1 then
                f:SetPoint("TOPLEFT", t[v - 1], "BOTTOMLEFT", 0, 0)
                f:SetPoint("TOPRIGHT", t[v - 1], "BOTTOMRIGHT", 0, 0)
            else
                f:SetPoint("TOPLEFT", historyContent, "TOPLEFT", 0, -8)
                f:SetPoint("TOPRIGHT", historyContent, "TOPRIGHT", 0, -8)
            end
            f:SetHeight(25)
            f:SetScript("OnEnter", function (self)
                self:SetNormalTexture("Interface\\FriendsFrame\\UI-FriendsFrame-HighlightBar")
            end)
            f:SetScript("OnLeave", function (self)
                local normalTexture = self:GetNormalTexture()
                if normalTexture then
                    normalTexture:Hide()
                end
            end)
            f.nameEditBox = CreateEditBox(f, 170, 25, 13, "LEFT")
            f.nameEditBox:SetPoint("LEFT", f, "LEFT", 5, 0)
            f.nameEditBox:Disable()
            f.nameEditBox:SetScript("OnEnter", function (self)
                OnEnter(self)
                GameTooltipShow(self, "RIGHT", "LEFT")
                GameTooltip:AddLine(self:GetText())
                GameTooltip:Show()
            end)
            f.nameEditBox:SetScript("OnLeave", function (self)
                OnLeave(self)
                GameTooltip:Hide()
            end)

            f.totalIncomeBox = CreateEditBox(f, 80, 25, 13, "RIGHT")
            f.totalIncomeBox:SetPoint("LEFT", f.nameEditBox, "RIGHT", 0, 0)
            f.totalIncomeBox:SetTextInsets(0, 2, 0, 0)
            f.totalIncomeBox:Disable()
            f.totalIncomeBox:SetScript("OnEnter", function (self)
                OnEnter(self)
            end)
            f.totalIncomeBox:SetScript("OnLeave", function (self)
                OnLeave(self)
            end)

            f.auctiondateBox = CreateEditBox(f, 170, 25, 13, "RIGHT")
            f.auctiondateBox:SetPoint("LEFT", f.totalIncomeBox, "RIGHT", 0, 0)
            f.auctiondateBox:SetTextInsets(0, 2, 0, 0)
            f.auctiondateBox:Disable()
            f.auctiondateBox:SetScript("OnEnter", function (self)
                OnEnter(self)
            end)
            f.auctiondateBox:SetScript("OnLeave", function (self)
                OnLeave(self)
            end)

            f.del = CreateButton(nil, f, "-", "LEFT", f.auctiondateBox, "RIGHT", 0, 0, 25, 25)
            f.del:RegisterForClicks("LeftButtonUp", "RightButtonUp")
            f.del:SetScript("OnClick", function (self, button)
                if button == "LeftButton" then
                    StaticPopup_Show("ZL_DELETEHISTORYWARNING", nil, nil, v)
                elseif button == "RightButton" then
                    ZL.OverviewFrame:Show()
                    ZL.OverviewFrame:Update(ZL_HISTORY[v])
                end
            end)
            f.del:SetScript("OnEnter", function (self)
                OnEnter(self)
                GameTooltipShow(self, "LEFT", "RIGHT")
                local count1 = ZL_HISTORY[v].IncomeList and #ZL_HISTORY[v].IncomeList or 0
                local count2 = ZL_HISTORY[v].butie and #ZL_HISTORY[v].butie or 0
                if count1 + count2 > 0 then
                    GameTooltip:AddLine("收支记录：")
                    GameTooltip:AddDoubleLine("名称", "玩家    ".. pad_left("金额", 20))
                    if count1 > 0 then
                        for _, data in ipairs(ZL_HISTORY[v].IncomeList) do
                            local itemId = string.match(data.notes, "|c........|Hitem:(%d+):")
                            local amount = ""
                            if data.amount > 0 then
                                amount = pad_left(tostring(data.amount), 9)
                            else
                                amount = pad_left(tostring(data.amount), 8)
                            end
                            if itemId then
                                GameTooltip:AddDoubleLine(
                                    "|T" .. cGetItemIcon(data.notes) .. ":12|t " .. data.notes,
                                    data.player .. "        " .. amount .. "|cffffd100g|r", 1, 1, 1, 1, 1, 1)
                            else
                                GameTooltip:AddDoubleLine(
                                    "|T:12|t " .. data.notes,
                                    data.player .. "        " .. amount .. "|cffffd100g|r", 1, 1, 1, 1, 1, 1)
                            end
                        end
                    end
                    if count2 > 0 then
                        for _, data in ipairs(ZL_HISTORY[v].butie) do
                            local itemId = string.match(data.notes, "|c........|Hitem:(%d+):")
                            local amount = ""
                            if data.amount > 0 then
                                amount = pad_left(tostring(data.amount), 9)
                            else
                                amount = pad_left(tostring(data.amount), 8)
                            end
                            if itemId then
                                GameTooltip:AddDoubleLine(
                                    "|T" .. cGetItemIcon(data.notes) .. ":12|t " .. data.notes,
                                    data.player .. "        " .. amount .. "|cffffd100g|r", 1, 1, 1, 1, 1, 1)
                            else
                                GameTooltip:AddDoubleLine(
                                    "|T:12|t " .. data.notes,
                                    data.player .. "        " .. amount .. "|cffffd100g|r", 1, 1, 1, 1, 1, 1)
                            end
                        end
                    end
                else
                    GameTooltip:AddLine("没有收支记录！")
                end
                GameTooltip:AddLine(" ")
                GameTooltip:AddLine("左键：|cffffffff删除该条拍卖记录，注意无法恢复！|r")
                GameTooltip:AddLine("右键：|cffffffff查看账单|r")
                GameTooltip:Show()
            end)
            f.del:SetScript("OnLeave", function (self)
                GameTooltip:Hide()
                OnLeave(self)
            end)
            f.res = CreateButton(nil, f, "", "LEFT", f.del, "RIGHT", 0, 0, 25, 25)
            f.res:SetNormalTexture("Interface\\Buttons\\UI-RotationLeft-Button-Up")
            f.res:SetPushedTexture("Interface\\Buttons\\UI-RotationLeft-Button-Down")
            f.res:SetScript("OnClick", function ()
                local msgStr
                if PlayerIsML() or (not IsInRaid(1)) then
                    if GetAuctioningCount() > 0 then
                        ZL.Print("存在正在拍卖中的物品，无法切换！")
                        return
                    end
                    if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
                        local totalincome = 0
                        if ZL_CURRENT.IncomeList and #ZL_CURRENT.IncomeList > 0 then
                            for _, fdata in ipairs(ZL_CURRENT.IncomeList) do
                                totalincome = totalincome + fdata.amount
                            end
                        end
                        ZL_CURRENT.totalincome = totalincome
                        table.insert(ZL_HISTORY, ZL_CURRENT)
                    end
                    ZL_CURRENT = ZL_HISTORY[v]
                    table.remove(ZL_HISTORY, v)
                    do
                        if ZL_CURRENT.auctionlist and (#ZL_CURRENT.auctionlist > 0) then
                            for num, _ in ipairs(ZL_CURRENT.auctionlist) do
                                local ff = ZL.AuctionFrame2.entries[num]
                                ff:SetValues(num)
                            end
                        end
                    end
                    ZL.AuctionFrame2:Update()
                    C_Timer.After(ZL.syncDadaCD or 0, function ()
                        ZL.syncDada() --ML切换后需要全团同步数据
                    end)
                    historyFrame:Update()
                    currentIncomeFrame:Update()
                    playerBalanceFrame:Update()
                else
                    msgStr = "团队中ML才能切换。"
                    ZL.Print(msgStr)
                end
            end)
            f.res:SetScript("OnEnter", function (self)
                OnEnter(self)
                GameTooltipShow(self, "LEFT", "RIGHT", 3, 0)
                GameTooltip:AddLine("恢复到当前拍卖清单")
                GameTooltip:AddLine("注意：当前拍卖清单会转为历史清单！", 1, 1, 1)
                GameTooltip:Show()
            end)
            f.res:SetScript("OnLeave", function (self)
                GameTooltip:Hide()
                OnLeave(self)
            end)
            function f:SetValues(name, totalincome, auctiondate)
                self.nameEditBox:SetText(name)
                self.totalIncomeBox:SetNumber(totalincome or 0)
                self.auctiondateBox:SetText(auctiondate)
            end
            t[v] = f
            return f
        end
    })
    function historyFrame:Update()
        for _, f in ipairs(self.entries) do f:Hide() end
        if next(ZL_HISTORY, nil) then
            if #ZL_HISTORY > 1 then
                table.sort(ZL_HISTORY, function (a, b)
                    return a.auctiondate > b.auctiondate
                end)
            end
            for num, data in ipairs(ZL_HISTORY) do
                local f = self.entries[num]
                f:Show()
                f:SetValues(data.name, data.totalincome, data.auctiondate)
            end
            historyContent:SetHeight(20 * #ZL_HISTORY - 5)
        else
            historyContent:SetHeight(5)
        end
    end
    currentIncomeFrame.entries = setmetatable({}, {
        __index = function(t, v)
            local f = CreateFrame("Button", nil, currentIncomeContent)
            if v > 1 then
                f:SetPoint("TOPLEFT", t[v - 1], "BOTTOMLEFT", 0, 0)
                f:SetPoint("TOPRIGHT", t[v - 1], "BOTTOMRIGHT", 0, 0)
            else
                f:SetPoint("TOPLEFT", currentIncomeContent, "TOPLEFT", 0, -8)
                f:SetPoint("TOPRIGHT", currentIncomeContent, "TOPRIGHT", 0, -8)
            end
            f:SetHeight(25)
            f:SetScript("OnEnter", function (self)
                self:SetNormalTexture("Interface\\FriendsFrame\\UI-FriendsFrame-HighlightBar")
            end)
            f:SetScript("OnLeave", function (self)
                local normalTexture = self:GetNormalTexture()
                if normalTexture then
                    normalTexture:Hide()
                end
            end)
            f.itemicon = CreateFrame("Button", nil, f)
            f.itemicon:SetSize(24, 24)
            f.itemicon:EnableMouse(true)
            f.itemicon:SetPoint("LEFT", f, "LEFT", 0, 0)
            f.itemicon:SetScript("OnEnter", function(self)
                OnEnter(self)
                local itemId = string.match(f.notes, "|c........|Hitem:(%d+):")
                if itemId then
                    GameTooltipShow(self, "RIGHT", "LEFT", -5)
                    GameTooltip:SetHyperlink(f.notes)
                    GameTooltip:Show()
                elseif f.notes == "[打包拍卖]" then
                    GameTooltipShow(self, "RIGHT", "LEFT", -5)
                    local data, index = ZL.FetchDataFromItemId(f.notes, 1)
                    if data then
                        local itemList = data["itemList"]
                        if itemList and next(itemList, nil) then
                            GameTooltip:AddLine("打包拍卖清单")
                            GameTooltip:AddLine(" ")
                            for _itemlink, _data in pairs(itemList) do
                                local _itemId = string.match(_itemlink, "|c........|Hitem:(%d+):")
                                if _itemId then
                                    GameTooltip:AddDoubleLine(
                                        "|T" .. cGetItemIcon(_itemlink) .. ":12|t " .. _itemlink,
                                        _data.itemCount, 1, 1, 1, 1, 1, 1
                                    )
                                else
                                    GameTooltip:AddDoubleLine(_itemlink, _data.itemCount, 1, 1, 1, 1, 1, 1)
                                end
                            end
                        end
                    end
                    GameTooltip:Show()
                end
                
            end)
            f.itemicon:SetScript("OnLeave", function(self)
                GameTooltip:Hide()
                OnLeave(self)
            end)

            f.notesbox = CreateEditBox(f, 180, 25, 14, "LEFT")
            f.notesbox:SetPoint("LEFT", f.itemicon, "RIGHT", 5, 0)
            f.notesbox:Disable()
            f.notesbox:SetScript("OnEnterPressed", function (self)
                if (strlen(self:GetText()) > 0) then
                    if (self:GetText() ~= ZL_CURRENT.IncomeList[v].notes) then
                        ZL_CURRENT.IncomeList[v].notes = self:GetText()
                    end
                else
                    self:SetText(ZL_CURRENT.IncomeList[v].notes)
                end
                self:ClearFocus()
                currentIncomeFrame:Update()
            end)
            f.notesbox:SetScript("OnEscapePressed", function (self)
                self:SetText(ZL_CURRENT.IncomeList[v].notes)
                self:ClearFocus()
            end)
            f.notesbox:SetScript("OnMouseUp", function (self)
                if (select(1, GetCursorInfo())) == "item" then
                    self:SetText(select(3, GetCursorInfo()))
                    ClearCursor()
                end
            end)
            -- f.notesbox:SetScript("OnEditFocusGained", function (self)
            --     ZL.focusEditBox = self
            -- end)
            -- f.notesbox:SetScript("OnEditFocusLost", function (self)
            --     if ZL.focusEditBox == self then ZL.focusEditBox = nil end
            -- end)
            f.notesbox:SetScript("OnEnter", function (self)
                OnEnter(self)
                GameTooltipShow(self,"BOTTOM", "TOP")
                GameTooltip:AddLine("如需输入物品名，|cffffd100Shift+左键|r\n点击背包物品或拍卖图标", 1, 1, 1)
                GameTooltip:Show()
            end)
            f.notesbox:SetScript("OnLeave", function (self)
                GameTooltip:Hide()
                OnLeave(self)
            end)

            f.playerbox = CreateEditBox(f, 135, 25, 14, "LEFT")
            f.playerbox:SetPoint("LEFT", f.notesbox, "RIGHT", 0, 0)
            f.playerbox:Disable()
            -- f.playerbox:SetScript("OnEnterPressed", function (self)
            --     self:ClearFocus()
            -- end)
            -- f.playerbox:SetScript("OnEscapePressed", function (self)
            --     self:SetText(ZL_CURRENT.IncomeList[v].player)
            --     self:ClearFocus()
            -- end)
            -- f.playerbox:SetScript("OnEnter", function (self)
            --     OnEnter(self)
            --     if PlayerIsML() then
            --         currentIncomeFrame.currenIndex = v
            --         currentIncomeFrame.dropDown:SetPoint("RIGHT", self, "RIGHT", 18, -2)
            --         _G["ZLcurrentIncomeFrameDropDown"]:SetFrameLevel(f.playerbox:GetFrameLevel() + 1)
            --         currentIncomeFrame.dropDown:Show()
            --     else
            --         currentIncomeFrame.dropDown:Hide()
            --     end
            -- end)
            f.playerbox:SetScript("OnLeave", function (self)
                OnLeave(self)
            end)
            -- f.playerbox:SetScript("OnEditFocusLost", function (self)
            --     currentIncomeFrame.dropDown:Hide()
            -- end)
            f.amountbox = CreateEditBox(f, 80, 25, 14, "RIGHT")
            f.amountbox:SetPoint("LEFT", f.playerbox, "RIGHT", 0, 0)
            f.amountbox:SetTextInsets(0, 2, 0, 0)
            f.amountbox:SetScript("OnEnterPressed", function (self)
                if (strlen(self:GetText()) > 0) then
                    if (self:GetNumber() ~= ZL_CURRENT.IncomeList[v].amount) then
                        ZL_CURRENT.IncomeList[v].amount = self:GetNumber()
                        local incomelist = ZL_CURRENT.IncomeList[v]
                        local textName = incomelist["player"]
                        if incomelist.tradeId then
                            local spawnLIst = {}
                            if incomelist.itemList and next(incomelist.itemList, nil) then
                                for _, value in pairs(incomelist.itemList) do
                                    if value["spawnUID"] and next(value["spawnUID"], nil) then
                                        for key2 in pairs(value["spawnUID"]) do
                                            spawnLIst[key2] = true
                                        end
                                    end
                                end
                            end
                            if ZL_CURRENT.auctionlist then
                                for _, data in ipairs(ZL_CURRENT.auctionlist) do
                                    if data.tradeId == incomelist.tradeId then
                                        if data["spawnUID"] and next(data["spawnUID"], nil) then
                                            for key, value in pairs(data["spawnUID"]) do
                                                if spawnLIst[key] then
                                                    if value.successBidder and next(value.successBidder, nil) then
                                                        for palyerName in pairs(value.successBidder) do
                                                            if palyerName == textName then
                                                                value.successBidder[palyerName ].amount = incomelist["amount"]
                                                            end
                                                        end
                                                    end
                                                end
                                            end
                                        end
                                        break
                                    end
                                end
                            end
                        end
                    end
                else
                    self:SetText(ZL_CURRENT.IncomeList[v].amount)
                end
                self:ClearFocus()
                currentIncomeFrame:Update()
            end)
            f.amountbox:SetScript("OnEscapePressed", function (self)
                self:SetText(ZL_CURRENT.IncomeList[v].amount)
                self:ClearFocus()
            end)
            f.amountbox:SetScript("OnEnter", function (self)
                OnEnter(self)
                GameTooltipShow(self, "LEFT", "RIGHT")
                GameTooltip:AddLine("注意：")
                GameTooltip:AddLine("如需修改，只允许填写|cffffd100数字|r！", 1, 1, 1)
                GameTooltip:AddLine("按Enter键保存", 1, 1, 1)
                GameTooltip:Show()
            end)
            f.amountbox:SetScript("OnLeave", function (self)
                OnLeave(self)
                GameTooltip:Hide()
            end)
            f.bidCountBox = CreateEditBox(f, 35, 25, 14, "RIGHT")
            f.bidCountBox:Disable()
            f.bidCountBox:SetPoint("LEFT", f.amountbox, "RIGHT", 0, 0)
            f.bidCountBox:SetTextInsets(0, 2, 0, 0)
            f.bidCountBox:SetScript("OnEnterPressed", function (self)
                local incomeData = ZL_CURRENT.IncomeList[v]
                if (strlen(self:GetText()) > 0) then
                    if (self:GetNumber() ~= incomeData.itemCount) then
                        ZL_CURRENT.IncomeList[v].itemCount = self:GetNumber()
                        if incomeData.itemList and incomeData.itemList[incomeData.notes] then
                            ZL_CURRENT.IncomeList[v].itemList[incomeData.notes].itemCount = self:GetNumber()
                        end
                    end
                else
                    self:SetText(ZL_CURRENT.IncomeList[v].itemCount)
                end
                self:ClearFocus()
                currentIncomeFrame:Update()
            end)
            f.bidCountBox:SetScript("OnEscapePressed", function (self)
                self:SetText(ZL_CURRENT.IncomeList[v].itemCount)
                self:ClearFocus()
            end)
            f.bidCountBox:SetScript("OnEnter", function (self)
                OnEnter(self)
                GameTooltipShow(self, "LEFT", "RIGHT")
                GameTooltip:AddLine("注意：")
                GameTooltip:AddLine("不允许直接修改数量", 1, 1, 1)
                GameTooltip:AddLine("如需修改请重新拍卖", 1, 1, 1)
                -- GameTooltip:AddLine("如需修改，只允许填写|cffffd100数字|r！", 1, 1, 1)
                -- GameTooltip:AddLine("按Enter键保存", 1, 1, 1)
                GameTooltip:Show()
            end)
            f.bidCountBox:SetScript("OnLeave", function (self)
                OnLeave(self)
                GameTooltip:Hide()
            end)

            f.del = CreateButton(nil, f, "-", "LEFT", f.bidCountBox, "RIGHT", 0, 0, 25, 25)
            f.del:SetScript("OnClick", function (self)
                local incomedata = ZL_CURRENT["IncomeList"][v]
                if incomedata then
                    if incomedata["tradeId"] then
                        if ZL_CURRENT.auctionlist and next(ZL_CURRENT.auctionlist, nil) then
                            for num, data in pairs(ZL_CURRENT.auctionlist) do
                                if data["tradeId"] == incomedata["tradeId"] then
                                    local frame = ZL.AuctionFrame2.entries[num]
                                    frame.MLframe.functionFrame.CancelBtn:Click()
                                    break
                                end
                            end
                        end
                    else
                        table.remove(ZL_CURRENT["IncomeList"], v)
                        ZL.AuctionRecordFrame.currentIncomeFrame:Update()
                        ZL.AuctionRecordFrame.playerBalanceFrame:Update()
                        local data = {
                            type = "删除拍卖记录",
                            index = v,
                            globalConfigData = ZL.globalConfigData(),
                        }
                        MyAddon:TransmitAddonInfo("AUTOAUC SYNC12", data)
                    end
                end
            end)
            f.del:SetScript("OnLeave", function (self)
                GameTooltip:Hide()
                OnLeave(self)
            end)
            function f:SetValues(notes, player, amount, itemCount)
                local itemId = string.match(notes, "|c........|Hitem:(%d+):")
                f.itemicon:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
                if itemId then
                    self.itemicon:SetNormalTexture(cGetItemIcon(notes))
                elseif notes == "[打包拍卖]" then
                    self.itemicon:SetNormalTexture("Interface\\AddOns\\" .. addonName .. "\\Images\\ZL.tga")
                else
                    self.itemicon:ClearNormalTexture()
                end
                self.notesbox:SetText(notes)
                self.playerbox:SetText(player)
                self.amountbox:SetNumber(amount)
                if itemCount then
                    self.bidCountBox:SetNumber(itemCount)
                end
            end

            t[v] = f
            return f
        end
    })
    function currentIncomeFrame:Update()
        for _, f in ipairs(self.entries) do f:Hide() end
        -- if PlayerIsML() then
        --     currentIncomeFrame.dropDown:Hide()
        -- end
        local _, RLBuTie, _, _, totalamount, averageamount = ZL.GetAveWages()
        if (not ZL_CURRENT["aveWages"]) then return end
        local count = (ZL_CURRENT["IncomeList"] and #ZL_CURRENT["IncomeList"] or 0)
        if count > 0 then
            for num, data in ipairs(ZL_CURRENT["IncomeList"]) do
                local f = self.entries[num]
                f:Show()
                if PlayerIsML() then
                    if data["tradeId"] then
                        f.notesbox:Disable()
                        f.notesbox:SetScript("OnEnter", function (self)
                            OnEnter(self)
                            GameTooltipShow(self,"BOTTOM", "TOP")
                            GameTooltip:AddLine("拍卖自动录入")
                            GameTooltip:AddLine("禁止直接修改名称\n不同物品可以通过手动录入添加", 1, 1, 1)
                            GameTooltip:Show()
                        end)
                        f.bidCountBox:Disable()
                        f.bidCountBox:SetScript("OnEnter", function (self)
                            OnEnter(self)
                            GameTooltipShow(self, "LEFT", "RIGHT")
                            GameTooltip:AddLine("拍卖自动录入")
                            GameTooltip:AddLine("不允许直接修改数量", 1, 1, 1)
                            GameTooltip:AddLine("如需修改请重新拍卖", 1, 1, 1)
                            GameTooltip:Show()
                        end)
                        f.del:SetScript("OnEnter", function (self)
                            OnEnter(self)
                            GameTooltipShow(self, "LEFT", "RIGHT")
                            GameTooltip:AddLine("拍卖自动录入")
                            GameTooltip:AddLine("不可手动删除，如需删除可重新拍卖", 1, 0, 0)
                            GameTooltip:AddLine("点击后会自动重新拍卖", 1, 0, 0)
                            GameTooltip:AddLine("注意：重拍后此拍卖所有关联收入将都被删除", 1, 0, 0)
                            GameTooltip:Show()
                        end)
                    else
                        f.notesbox:Enable()
                        f.notesbox:SetScript("OnEnter", function (self)
                            OnEnter(self)
                            GameTooltipShow(self,"BOTTOM", "TOP")
                            GameTooltip:AddLine("手动录入")
                            GameTooltip:AddLine("如需输入物品名，|cffffd100Shift+左键|r\n点击背包物品或拍卖图标", 1, 1, 1)
                            GameTooltip:Show()
                        end)
                        f.bidCountBox:Enable()
                        f.bidCountBox:SetScript("OnEnter", function (self)
                            OnEnter(self)
                            GameTooltipShow(self, "LEFT", "RIGHT")
                            GameTooltip:AddLine("手动录入")
                            GameTooltip:AddLine("如需修改，只允许填写|cffffd100数字|r！", 1, 1, 1)
                            GameTooltip:AddLine("按Enter键保存", 1, 1, 1)
                            GameTooltip:Show()
                        end)
                        f.del:SetScript("OnEnter", function (self)
                            OnEnter(self)
                            GameTooltipShow(self, "LEFT", "RIGHT")
                            GameTooltip:AddLine("手动录入")
                            GameTooltip:AddLine("点击可删除，不可恢复！", 1, 0, 0)
                            GameTooltip:AddLine("如需修改，直接在文本框编辑后按Enter键", 1, 1, 1)
                            GameTooltip:Show()
                        end)
                    end
                    -- f.playerbox:Enable()
                    f.playerbox:SetScript("OnEnter", function (self)
                        OnEnter(self)
                        if PlayerIsML() then
                            currentIncomeFrame.currenIndex = num
                            currentIncomeFrame.dropDown:SetPoint("RIGHT", self, "RIGHT", 18, -2)
                            _G["ZLcurrentIncomeFrameDropDown"]:SetFrameLevel(f.playerbox:GetFrameLevel() + 1)
                            currentIncomeFrame.dropDown:Show()
                        else
                            currentIncomeFrame.dropDown:Hide()
                        end
                    end)
                    f.amountbox:Enable()
                    f.amountbox:SetScript("OnEnter", function (self)
                        OnEnter(self)
                        GameTooltipShow(self, "LEFT", "RIGHT")
                        GameTooltip:AddLine("注意：")
                        GameTooltip:AddLine("如需修改，只允许填写|cffffd100数字|r！", 1, 1, 1)
                        GameTooltip:AddLine("按Enter键保存", 1, 1, 1)
                        GameTooltip:Show()
                    end)
                    f.del:Show()

                else
                    f.notesbox:Disable()
                    f.notesbox:SetScript("OnEnter", function (self)
                        OnEnter(self)
                    end)
                    f.playerbox:Disable()
                    f.playerbox:SetScript("OnEnter", function (self)
                        OnEnter(self)
                    end)
                    f.amountbox:Disable()
                    f.amountbox:SetScript("OnEnter", function (self)
                        OnEnter(self)
                    end)
                    f.bidCountBox:Disable()
                    f.bidCountBox:SetScript("OnEnter", function (self)
                        OnEnter(self)
                    end)
                    f.del:Hide()
                end
                f:SetValues(data.notes, data.player, data.amount, data.itemCount)
                f.notes = data.notes
            end
        end
        local butie = ZL_CURRENT.butie
        if butie and #butie > 0 then
            for num, data in ipairs(butie) do
                local f = self.entries[num+count]
                f:Show()
                f.notesbox:Disable()
                f.playerbox:Disable()
                f.amountbox:Disable()
                f.bidCountBox:Disable()
                f.del:Hide()
                f:SetValues("|cff9173ff" .. data.notes .. "|r", data.player, data.amount)
                f.notes = data.notes
                f.notesbox:SetScript("OnEnter", function (self)
                    OnEnter(self)
                    GameTooltip:Hide()
                end)
                f.playerbox:SetScript("OnEnter", function (self)
                    OnEnter(self)
                    currentIncomeFrame.dropDown:Hide()
                end)
                f.amountbox:SetScript("OnEnter", function (self)
                    OnEnter(self)
                    GameTooltip:Hide()
                end)
                f.bidCountBox:SetScript("OnEnter", function (self)
                    OnEnter(self)
                    GameTooltip:Hide()
                end)
            end
        end
        local height = 5
        count = (count + #butie)
        if count > 0 then
            height = 20 * count - 5
        end
        currentIncomeContent:SetHeight(height)
        totalIncomeFont:SetText("净收入:|cffffd100" .. totalamount .. "|r")
    end
    playerBalanceFrame.entries = setmetatable({}, {
        __index = function(t, v)
            local f = CreateFrame("Button", nil, playerBalanceContent)
            if v > 1 then
                f:SetPoint("TOPLEFT", t[v - 1], "BOTTOMLEFT", 0, 0)
                f:SetPoint("TOPRIGHT", t[v - 1], "BOTTOMRIGHT", 0, 0)
            else
                f:SetPoint("TOPLEFT", playerBalanceContent, "TOPLEFT", 0, -8)
                f:SetPoint("TOPRIGHT", playerBalanceContent, "TOPRIGHT", 25, -8)
            end
            f:SetHeight(25)
            f:SetScript("OnEnter", function (self)
                self:SetNormalTexture("Interface\\FriendsFrame\\UI-FriendsFrame-HighlightBar")
            end)
            f:SetScript("OnLeave", function (self)
                local normalTexture = self:GetNormalTexture()
                if normalTexture then
                    normalTexture:Hide()
                end
            end)
            f.groupFont = f:CreateFontString()
            f.groupFont:SetPoint("LEFT", f, "LEFT", 5, 0)
            f.groupFont:SetWidth(15)
            f.groupFont:SetFont(GameFontNormal:GetFont(), 14)
            f.groupFont:SetTextColor(1, 1, 1)
            -- f.groupFont:SetText("1")
            f.groupFont:SetWordWrap(false)
            f.groupFont:SetJustifyH("LEFT")
            --ZL.CreateEditBox(parent, width, heigth, fontSize, justifyH, numeric, multiLine)
            f.nameEditBox = CreateEditBox(f, 130, 25, 14, "LEFT")
            f.nameEditBox:SetPoint("LEFT", f.groupFont, "RIGHT", 5, 0)
            f.nameEditBox:Disable()
            f.nameEditBox:SetScript("OnMouseDown", function (self, button)
                if IsShiftKeyDown() then
                    ChatEdit_ActivateChat(ChatEdit_ChooseBoxForSend())
                    HandleModifiedItemClick(ZL.ParseClassColorName(self:GetText()))
                    ChatEdit_ChooseBoxForSend():HighlightText()
                    local msgStr = "已发送到聊天窗口，按Ctr+V复制"
                    ZL.ScrollingMessageFrame:AddMessage(msgStr, 1, 1, 0)
                end
            end)
            f.nameEditBox:SetScript("OnEnter", function (self)
                GameTooltipShow(self,"LEFT", "RIGHT")
                GameTooltip:AddLine("Shift+左键：|cffffffff获取名字|r")
                GameTooltip:Show()
                OnEnter(self)
            end)
            f.nameEditBox:SetScript("OnLeave", function (self)
                GameTooltip:Hide()
                OnLeave(self)
            end)
            f.balanceEditBox = CreateEditBox(f, 65, 25, 14, "RIGHT")
            f.balanceEditBox:SetPoint("LEFT", f.nameEditBox, "RIGHT")
            f.balanceEditBox:SetTextInsets(0, 3, 0, 0)
            f.balanceEditBox:Disable()
            f.balanceEditBox:SetScript("OnEnter", function (self)
                OnEnter(self)
            end)
            f.balanceEditBox:SetScript("OnLeave", function (self)
                OnLeave(self)
            end)

            f.biLiEditBox = CreateEditBox(f, 45, 25, 14, "RIGHT", true)
            f.biLiEditBox:SetPoint("LEFT", f.balanceEditBox, "RIGHT", 0, 0)
            f.biLiEditBox:SetTextInsets(0, 3, 0, 0)
            f.biLiEditBox:SetNumber(100)
            f.biLiEditBox:SetScript("OnEnter", function (self)
                OnEnter(self)
                GameTooltipShow(self,"LEFT", "RIGHT")
                GameTooltip:AddLine("输入0-100的任意整数(ML功能)")
                GameTooltip:AddLine("0：|cffffffff表示老板，不参与工资人数计算|r")
                GameTooltip:AddLine("50：|cffffffff半G，按全工资的50%|r")
                GameTooltip:AddLine("100：|cffffffff全工资|r")
                GameTooltip:AddLine(" ")
                GameTooltip:AddLine("激活输入框，输入或鼠标滚轮设置\n工资比例，按Enter键或右键保存！")
                GameTooltip:Show()
            end)
            f.biLiEditBox:SetScript("OnLeave", function (self)
                OnLeave(self)
                GameTooltip:Hide()
            end)
            f.biLiEditBox:SetScript("OnEscapePressed",function (self)
                local name = f.nameEditBox:GetText()
                local WagesBiLi = ZL_CURRENT.WagesBiLi
                if WagesBiLi and WagesBiLi[name] and WagesBiLi[name]["biLi"] then
                    self:SetNumber(WagesBiLi[name]["biLi"])
                else
                    self:SetNumber(100)
                end
                self:ClearFocus()
            end)
            f.biLiEditBox:SetScript("OnEnterPressed", function (self)
                local biLi = self:GetNumber()
                if biLi <= 0 then
                    self:SetNumber(0)
                elseif biLi > 100 then
                    self:SetNumber(100)
                end
                self:HighlightText(0, 0)
                biLi = self:GetNumber()
                local name = f.nameEditBox:GetText()
                local WagesBiLi = ZL_CURRENT.WagesBiLi
                if ((not WagesBiLi) or (not WagesBiLi[name]) or (not WagesBiLi[name]["biLi"]) or (WagesBiLi[name]["biLi"] ~= biLi)) then
                    if not ZL_CURRENT.WagesBiLi then ZL_CURRENT.WagesBiLi = {} end
                    if not ZL_CURRENT.WagesBiLi[name] then ZL_CURRENT.WagesBiLi[name] = {} end
                    if biLi == 100 then
                        ZL_CURRENT.WagesBiLi[name]["biLi"] = nil
                    else
                        ZL_CURRENT.WagesBiLi[name]["biLi"] = biLi
                    end
                    playerBalanceFrame:Update()
                end
                self:ClearFocus()
            end)
            f.biLiEditBox:SetScript("OnMouseWheel", function (self, delta)
                if self:HasFocus() then
                    local number = self:GetNumber()
                    if delta > 0 then
                        number = number + 10
                    else
                        number = number - 10
                    end
                    if number < 0 then
                        number = 0
                    elseif number > 100 then
                        number = 100
                    end
                    self:SetNumber(number)
                end
            end)
            f.biLiEditBox:SetScript("OnMouseDown", function(self, button)
                if button == "RightButton" and self:HasFocus() then
                    local biLi = self:GetNumber()
                    if biLi <= 0 then
                        self:SetNumber(0)
                    elseif biLi > 100 then
                        self:SetNumber(100)
                    end
                    self:HighlightText(0, 0)
                    biLi = self:GetNumber()
                    local name = f.nameEditBox:GetText()
                    local WagesBiLi = ZL_CURRENT.WagesBiLi
                    if ((not WagesBiLi) or (not WagesBiLi[name]) or (not WagesBiLi[name]["biLi"]) or (WagesBiLi[name]["biLi"] ~= biLi)) then
                        if not ZL_CURRENT.WagesBiLi then ZL_CURRENT.WagesBiLi = {} end
                        if not ZL_CURRENT.WagesBiLi[name] then ZL_CURRENT.WagesBiLi[name] = {} end
                        if biLi == 100 then
                            ZL_CURRENT.WagesBiLi[name]["biLi"] = nil
                        else
                            ZL_CURRENT.WagesBiLi[name]["biLi"] = biLi
                        end
                        playerBalanceFrame:Update()
                    end
                    C_Timer.After(0.3, function ()
                        self:ClearFocus()
                    end)
                end
            end)
            f.biLiEditBox:SetScript("OnTextChanged", function (self)
                local biLi = self:GetNumber()
                if biLi <= 0 then
                    self:SetNumber(0)
                elseif biLi > 100 then
                    self:SetNumber(100)
                end
            end)
            f.biLiEditBox:SetScript("OnEditFocusLost",function (self)
                self:HighlightText(0, 0)
                local biLi = self:GetNumber()
                local name = f.nameEditBox:GetText()
                local WagesBiLi = ZL_CURRENT.WagesBiLi
                if (not WagesBiLi) or (not WagesBiLi[name]) or (not WagesBiLi[name]["biLi"]) or (wagesNumber:GetNumber() > 0) then
                    self:SetNumber(100)
                elseif biLi ~= WagesBiLi[name]["biLi"] then
                    self:SetNumber(WagesBiLi[name]["biLi"])
                end
            end)

            f.qianKuanEditBox = CreateEditBox(f, 65, 25, 14, "RIGHT")
            f.qianKuanEditBox:SetPoint("LEFT", f.biLiEditBox, "RIGHT")
            f.qianKuanEditBox:SetTextInsets(0, 3, 0, 0)
            f.qianKuanEditBox:Disable()
            f.qianKuanEditBox:SetScript("OnEnter", function (self)
                OnEnter(self)
            end)
            f.qianKuanEditBox:SetScript("OnLeave", function (self)
                OnLeave(self)
            end)

            f.buTieEditBox = CreateEditBox(f, 55, 25, 14, "RIGHT", true)
            f.buTieEditBox:SetPoint("LEFT", f.qianKuanEditBox, "RIGHT", 0, 0)
            f.buTieEditBox:SetTextInsets(0, 3, 0, 0)
            f.buTieEditBox:SetScript("OnEnter", function (self)
                OnEnter(self)
                GameTooltipShow(self, "LEFT", "RIGHT")
                GameTooltip:AddLine("注意(ML功能)：", 1, 0, 0)
                GameTooltip:AddLine("仅供邮寄补贴用，不参与工资计算！", 1, 1, 1)
                GameTooltip:AddLine("如需计算补贴支出，请到设置里面进行添加！", 1, 1, 1)
                GameTooltip:AddLine(" ")
                GameTooltip:AddLine("激活输入框，输入或鼠标滚轮设置\n补贴金额，按Enter键或右键保存！")
                GameTooltip:Show()
            end)
            f.buTieEditBox:SetScript("OnLeave", function (self)
                OnLeave(self)
                GameTooltip:Hide()
            end)
            f.buTieEditBox:SetScript("OnEscapePressed",function (self)
                local name = f.nameEditBox:GetText()
                local WagesBiLi = ZL_CURRENT.WagesBiLi
                if WagesBiLi and WagesBiLi[name] and WagesBiLi[name]["buTie"] then
                    self:SetNumber(WagesBiLi[name]["buTie"])
                else
                    self:SetText("")
                end
                self:ClearFocus()
            end)
            f.buTieEditBox:SetScript("OnMouseWheel", function (self, delta)
                if self:HasFocus() then
                    local number = self:GetNumber()
                    if delta > 0 then
                        number = number + 100
                    else
                        number = number - 100
                    end
                    if number < 0 then
                        number = 0
                    end
                    self:SetNumber(number)
                end
            end)
            f.buTieEditBox:SetScript("OnMouseDown", function(self, button)
                if button == "RightButton" and self:HasFocus() then
                    local buTie = self:GetNumber()
                    if buTie <= 0 then
                        self:SetNumber(0)
                    end
                    self:HighlightText(0, 0)
                    buTie = self:GetNumber()
                    local name = f.nameEditBox:GetText()
                    local WagesBiLi = ZL_CURRENT.WagesBiLi
                    if ((not WagesBiLi) or (not WagesBiLi[name]) or (not WagesBiLi[name]["buTie"]) or (WagesBiLi[name]["buTie"] ~= buTie)) then
                        if not ZL_CURRENT.WagesBiLi then ZL_CURRENT.WagesBiLi = {} end
                        if not ZL_CURRENT.WagesBiLi[name] then ZL_CURRENT.WagesBiLi[name] = {} end
                        if buTie == 0 then
                            ZL_CURRENT.WagesBiLi[name]["buTie"] = nil
                        else
                            ZL_CURRENT.WagesBiLi[name]["buTie"] = buTie
                        end
                        playerBalanceFrame:Update()
                    end
                    C_Timer.After(0.3, function ()
                        self:ClearFocus()
                    end)
                end
            end)
            f.buTieEditBox:SetScript("OnEnterPressed", function (self)
                local buTie = self:GetNumber()
                if buTie <= 0 then
                    self:SetNumber(0)
                end
                self:HighlightText(0, 0)
                buTie = self:GetNumber()
                local name = f.nameEditBox:GetText()
                local WagesBiLi = ZL_CURRENT.WagesBiLi
                if ((not WagesBiLi) or (not WagesBiLi[name]) or (not WagesBiLi[name]["buTie"]) or (WagesBiLi[name]["buTie"] ~= buTie)) then
                    if not ZL_CURRENT.WagesBiLi then ZL_CURRENT.WagesBiLi = {} end
                    if not ZL_CURRENT.WagesBiLi[name] then ZL_CURRENT.WagesBiLi[name] = {} end
                    if buTie == 0 then
                        ZL_CURRENT.WagesBiLi[name]["buTie"] = nil
                    else
                        ZL_CURRENT.WagesBiLi[name]["buTie"] = buTie
                    end
                    playerBalanceFrame:Update()
                end
            end)
            f.buTieEditBox:SetScript("OnTextChanged", function (self)
                local biLi = self:GetNumber()
                if biLi <= 0 then
                    self:SetNumber(0)
                end
            end)
            f.buTieEditBox:SetScript("OnEditFocusLost",function (self)
                -- self:HighlightText(0, 0)
                self:ClearHighlightText()
                local buTie = self:GetNumber()
                local name = f.nameEditBox:GetText()
                local WagesBiLi = ZL_CURRENT.WagesBiLi
                if (not WagesBiLi) or (not WagesBiLi[name]) or (not WagesBiLi[name]["buTie"]) then
                    self:SetNumber(0)
                elseif buTie ~= WagesBiLi[name]["buTie"] then
                    self:SetNumber(WagesBiLi[name]["buTie"])
                end
            end)

            f.totalEditBox = CreateEditBox(f, 65, 25, 14, "RIGHT")
            f.totalEditBox:SetPoint("LEFT", f.buTieEditBox, "RIGHT", 0, 0)
            f.totalEditBox:SetTextInsets(0, 3, 0, 0)
            f.totalEditBox:Disable()
            f.totalEditBox:SetScript("OnEnter", function (self)
                OnEnter(self)
            end)
            f.totalEditBox:SetScript("OnLeave", function (self)
                OnLeave(self)
            end)
            f.add = CreateButton(nil, f, "+", "LEFT", f.totalEditBox, "RIGHT", 2, 0, 20, 25)
            f.add:SetScript("OnClick", function (self)
                if not PlayerIsML() then
                    local msgStr = "你不是ML，无法使用这个功能！"
                    ZL.Print(msgStr)
                    return
                end
                StaticPopup_Show("ZL_ADDTOPLAYER", f.nameEditBox:GetText(), nil, f.nameEditBox:GetText())
            end)
            f.add:SetScript("OnEnter", function (self)
                OnEnter(self)
                GameTooltipShow(self, "LEFT", "RIGHT")
                GameTooltip:AddLine("使用场景：")
                GameTooltip:AddLine("购买物品后，让其他角色帮忙代交", 1, 1, 1)
                GameTooltip:AddLine("插件无法记录，需手动添加", 1, 1, 1)
                GameTooltip:Show()
            end)
            f.add:SetScript("OnLeave", function (self)
                OnLeave(self)
                GameTooltip:Hide()
            end)
            f.rem = CreateButton(nil, f, "-", "LEFT", f.add, "RIGHT", 0, 0, 20, 25)
            f.rem:SetScript("OnClick", function (self)
                if not PlayerIsML() then
                    local msgStr = "你不是ML，无法使用这个功能！"
                    ZL.Print(msgStr)
                    return
                end
                StaticPopup_Show("ZL_REMFROMPLAYER", f.nameEditBox:GetText(), nil, f.nameEditBox:GetText())
            end)
            f.rem:SetScript("OnEnter", function (self)
                OnEnter(self)
            end)
            f.rem:SetScript("OnLeave", function (self)
                OnLeave(self)
            end)
            f.trade = CreateButton(nil, f, "清单", "LEFT", f.rem, "RIGHT", 0, 0, 30, 25, 10)
            f.trade:SetScript("OnEnter",function (self)
                OnEnter(self)
                GameTooltipShow(self, "LEFT", "RIGHT")
                local name = f.nameEditBox:GetText()
                local playerBuyList = ZL.GetPlayerBuyList()
                local _, _, ML, RL = ZL.GetWagesGroupMembers()
                local _, RLBuTie = GetAveWages()
                local name_table = playerBuyList[name]
                local balance = 0 --欠款
                if name_table and name_table.items and #name_table.items > 0 then
                    if ML and name == ML then
                        GameTooltip:AddLine("消费清单|cffffffff(ML)|r:")
                    elseif RL and name == RL then
                        GameTooltip:AddLine("消费清单|cffffffff(RL)|r:")
                    else
                        GameTooltip:AddLine("消费清单:")
                    end
                    GameTooltip:AddDoubleLine("名称", "是否已交易")
                    local items = name_table.items
                    for _, data in ipairs(items) do
                        local itemId = tonumber(string.match(data.notes, "|c........|Hitem:(%d+):"))
                        if itemId then
                            if data.isTraded then
                                GameTooltip:AddDoubleLine(data["notes"], "是", 1, 1, 1, 1, 1, 1)
                            else
                                GameTooltip:AddDoubleLine(data["notes"], "否", 1, 1, 1, 1, 0, 0)
                            end
                        else
                            GameTooltip:AddDoubleLine(data["notes"], "-", 1, 1, 1, 1, 1, 1)
                        end
                    end
                    GameTooltip:AddLine(" ")
                    local playerPayToMLamount = 0
                    if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
                        playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
                    end
                    balance = playerPayToMLamount - name_table.totalAmount
                    if PlayerIsML(name) or balance > 0 then
                        balance = 0
                    end
                    if balance < 0 then
                        GameTooltip:AddLine(("总消费：|cffffffff%d|rg，欠款：|cffffffff%d|rg"):format(name_table.totalAmount, -balance))
                    else
                        GameTooltip:AddLine(("总消费：|cffffffff%d|rg，已全部结清！"):format(name_table.totalAmount))
                    end
                else
                    GameTooltip:AddLine("没有消费记录")
                end
                local balanceAmount = 0 --工资
                local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
                local buTie = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].buTie) and ZL_CURRENT.WagesBiLi[name].buTie or 0
                local text = ""
                if biLi <= 0 then
                    text = "工　资：|cffffffff消费老板|r"
                else
                    if RL and RL == name then
                        if ZL.opt.RLBuTieType == 3 then
                            balanceAmount = math.floor(ZL_CURRENT["aveWages"] * biLi * 2) + balance
                            text = "工　资：|cffffffff" .. balanceAmount .. "|rg，|cffffffff团双|r"
                        elseif ZL.opt.RLBuTieType == 4 then
                            balanceAmount = math.floor(ZL_CURRENT["aveWages"] * biLi) + balance
                            text = "工　资：|cffffffff" .. balanceAmount .. "|rg，提成：|cffffffff" .. RLBuTie .. "|rg"
                        elseif ZL.opt.RLBuTieType == 2 then
                            balanceAmount = math.floor(ZL_CURRENT["aveWages"] * biLi) + balance
                            text = "工　资：|cffffffff" .. balanceAmount .. "|rg，补贴：|cffffffff" .. RLBuTie .. "|rg"
                        else
                            balanceAmount = math.floor(ZL_CURRENT["aveWages"] * biLi) + balance
                            text = "工　资：|cffffffff" .. balanceAmount .. "|rg"
                        end
                    else
                        balanceAmount = math.floor(ZL_CURRENT["aveWages"] * biLi) + balance
                        text = "工　资：|cffffffff" .. balanceAmount .. "|rg"
                        -- if buTie > 0 then
                        --     text = text .. "，补贴：|cffffffff" .. buTie .. "|rg"
                        -- end
                    end
                end
                GameTooltip:AddLine(text)
                if (not ZL_CURRENT["mailPlayers"]) or (ZL_CURRENT["mailPlayers"][name] == nil) then
                    if ZL_CURRENT.tradeGongZi and ZL_CURRENT.tradeGongZi[name] then
                        GameTooltip:AddLine("工资已交易")
                    else
                        GameTooltip:AddLine("等待交易工资")
                    end
                elseif ZL_CURRENT["mailPlayers"][name] == false then
                    GameTooltip:AddLine("待邮寄")
                elseif ZL_CURRENT["mailPlayers"][name] == true then
                    GameTooltip:AddLine("已邮寄")
                end

                -- GameTooltip:AddLine(" ")
                -- GameTooltip:AddLine("左键：|cffffffff交易装备和欠款|r")
                -- GameTooltip:AddLine("右键：|cffffffff交易工资和补贴|r")
                GameTooltip:Show()
            end)
            f.trade:SetScript("OnLeave", function (self)
                GameTooltip:Hide()
                OnLeave(self)
            end)
            f.mail = CreateButton(nil, f, "邮寄", "LEFT", f.trade, "RIGHT", 0, 0, 30, 25, 10)
            f.mail:SetScript("OnClick", function (self)
                if not PlayerIsML() then
                    local msgStr = "你不是ML，无法使用这个功能！"
                    ZL.Print(msgStr)
                    return
                end
                if (not _G["MailFrame"]) or (not _G["MailFrame"]:IsShown()) then
                    ZL.Print("先打开邮箱！")
                    return
                end
                local wagesGroupMembersIndex = (ZL_CURRENT["globalConfig"] and ZL_CURRENT["globalConfig"]["wagesGroupMembers"]) and ZL_CURRENT["globalConfig"]["wagesGroupMembers"] or 0
                if wagesGroupMembersIndex == 0 and ZL.AuctionRecordFrame.playerBalanceFrame.wagesNumber:GetNumber() <= 0 then
                    local msgStr = "你选择的是：|cffff0000当前团队名单|r，请输入具体的工资人数后再邮寄工资！"
                    ZL.Print(msgStr, true)
                    return
                end
                if ZL.Recipient then
                    ZL.Print("前面邮件发送还未结束，请稍后重试！")
                    return
                end
                local targetName = ParseClassColorName(f.nameEditBox:GetText())
                local moneyToMail = tonumber(f.totalEditBox:GetText())
                if moneyToMail <= 0 then return end
                local gongZi = tonumber(f.balanceEditBox:GetText())
                local buTie = f.buTieEditBox:GetNumber()
                if (GetMoney() < (moneyToMail*10000 + 30)) then
                    ZL.ScrollingMessageFrame:AddMessage("身上G不够，已停止邮寄！", 1, 0, 0)
                    return
                end
                ZL.Recipient = f.nameEditBox:GetText()
                ZL.moneyToMail = moneyToMail
                ClearSendMail()
                SetSendMailMoney(moneyToMail * 10000)
                local contentText = ""
                if buTie > 0 then
                    contentText = "尊敬的" .. targetName .. "勇士：\n\n　　感谢您的付出，这是您的工资：" .. gongZi .. "g，补贴：" .. buTie .. "g，请及时查收，期待您下次加入！\n\n\n　　　　　　　" .. date("%Y-%m-%d %H:%M", GetServerTime())
                else
                    contentText = "尊敬的" .. targetName .. "勇士：\n\n　　感谢您的付出，这是您的工资，请及时查收，期待您下次加入！\n\n\n　　　　　　　" .. date("%Y-%m-%d %H:%M", GetServerTime())
                    -- contentText = "尊敬的" .. targetName .. "勇士：\n\n　　感谢您的付出，补发[堕落黑暗之刃]拍卖所得3000G，这是您的补发工资：" .. gongZi .. "g，请及时查收，期待您下次加入！\n\n\n　　　　　　　" .. date("%Y-%m-%d %H:%M", GetServerTime())
                end
                --添加为好友
                local UnitGuid = ZL_CURRENT["UnitGUID"] and ZL_CURRENT["UnitGUID"][f.nameEditBox:GetText()]
                local isFriend = C_FriendList.IsFriend(UnitGuid)
                local delay = 0
                if UnitGuid and (not isFriend) then
                    C_FriendList.AddFriend(targetName)
                    delay = 0.5
                end
                local function linshi()
                    if C_FriendList.IsFriend(UnitGuid) then
                        C_Timer.After(delay, function ()
                            SendMail(targetName, "<AutoAuction>工资：" .. moneyToMail .. " g", contentText)
                            --删除刚添加的好友
                            if not isFriend then
                                C_Timer.After(1, function ()
                                    C_FriendList.RemoveFriend(targetName)
                                end)
                            end
                            -- ZL_CURRENT["mailPlayers"][f.nameEditBox:GetText()] = true
                            -- playerBalanceFrame:Update()
                        end)
                    else
                        C_Timer.After(0.3, linshi)
                    end
                end
                linshi()
            end)
            f.mail:SetScript("OnEnter", function (self)
                OnEnter(self)
            end)
            f.mail:SetScript("OnLeave", function (self)
                OnLeave(self)
            end)
            function f:SetValues(playerName, balanceAmount, group, biLi, buTie, qianKuan)
                group = group or 1
                if group % 2 == 0 then
                    group = "|cff0070de" .. tostring(group) .. "|r"
                else
                    group = tostring(group)
                end
                self.groupFont:SetText(group)
                self.nameEditBox:SetText(playerName)
                self.balanceEditBox:SetText(balanceAmount)
                self.biLiEditBox:SetNumber(biLi)
                self.qianKuanEditBox:SetText(qianKuan)
                self.buTieEditBox:SetNumber(buTie)
                local total = tonumber(ParseClassColorName(balanceAmount)) + tonumber(ParseClassColorName(qianKuan)) + buTie
                if total <= 0 then
                    total = "|cffff0000" .. tostring(total) .. "|r"
                    f.mail:Disable()
                else
                    if _G["MailFrame"] and _G["MailFrame"]:IsShown() then
                        f.mail:Enable()
                    else
                        f.mail:Disable()
                    end
                end
                self.totalEditBox:SetText(total)
                if PlayerIsML() then
                    f.biLiEditBox:Enable()
                    f.buTieEditBox:Enable()
                else
                    f.biLiEditBox:Disable()
                    f.buTieEditBox:Disable()
                end
            end
            t[v] = f
            return f
        end
    })
    function playerBalanceFrame:Update()
        for _, f in ipairs(self.entries) do f:Hide() end
        local playerBuyList = ZL.GetPlayerBuyList()
        local WagesGroupMembers, _, _, RL = ZL.GetWagesGroupMembers()
        local numGroupMembers, RLBuTie, totalincome, totalpayout, totalamount, averageamount = GetAveWages()
        local index = 1
        local totalBuTieMail = 0
        if _G["MailFrame"] and _G["MailFrame"]:IsShown() then --如果是打开邮箱了，则只显示名单内需要邮寄的
            -- playerBalanceFont:SetText("工资")
            if (not ZL_CURRENT["aveWages"]) then return end
            if ZL_CURRENT["mailPlayers"] and next(ZL_CURRENT["mailPlayers"], nil) and WagesGroupMembers then
                playerBalanceFrame.SendMailBtn:Enable()
                local group
                for _group, data in ipairs(WagesGroupMembers) do
                    if #data > 0 then
                        for _, name in ipairs(data) do
                            if ZL_CURRENT["mailPlayers"][name] == false then
                                group = _group
                                local balanceAmount = 0
                                local playerPayToMLamount = 0
                                local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
                                biLi = wagesNumber:GetNumber() > 0 and 1 or biLi
                                local buTie = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].buTie) and ZL_CURRENT.WagesBiLi[name].buTie or 0
                                totalBuTieMail = totalBuTieMail + buTie
                                if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
                                    playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
                                end
                                local amount = playerPayToMLamount - (playerBuyList[name] and playerBuyList[name].totalAmount or 0)
                                amount = amount > 0 and 0 or amount
                                if PlayerIsML(name) then amount = 0 end
                                if RL and RL == name then
                                    if ZL.opt.RLBuTieType == 3 then
                                        balanceAmount = ZL_CURRENT["aveWages"] * biLi * 2
                                    else
                                        balanceAmount = ZL_CURRENT["aveWages"] * biLi
                                    end
                                else
                                    balanceAmount = ZL_CURRENT["aveWages"] * biLi
                                end
                                balanceAmount = math.floor(balanceAmount)
                                if balanceAmount + amount + buTie ~= 0 then
                                    local f = self.entries[index]
                                    f:Show()
                                    local _balanceAmount
                                    if balanceAmount < 0 then
                                        _balanceAmount = "|cffff0000" .. tostring(balanceAmount) .. "|r"
                                    else
                                        _balanceAmount = balanceAmount
                                    end
                                    if amount < 0 then
                                        amount = "|cffff0000" .. tostring(amount) .. "|r"
                                    end
                                    f:SetValues(name, _balanceAmount, group, biLi*100, buTie, amount)
                                    index = index + 1
                                end
                            end
                        end
                    end
                end
            end
        elseif ZL.isTrading and ZL.tradePartner and (playerBuyList[ZL.tradePartner]) then --如果在交易中则工资窗口第一个显示交易对象的记录
            -- playerBalanceFont:SetText("欠款")
            local balanceAmount = 0
            local playerPayToMLamount = 0
            local name = ZL.tradePartner
            local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
            biLi = wagesNumber:GetNumber() > 0 and 1 or biLi
            local buTie = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].buTie) and ZL_CURRENT.WagesBiLi[name].buTie or 0
            if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[ZL.tradePartner] then
                playerPayToMLamount = ZL_CURRENT.playerPayToML[ZL.tradePartner]
            end
            local amount = playerPayToMLamount - (playerBuyList[name] and playerBuyList[name].totalAmount or 0)
            amount = amount > 0 and 0 or amount
            if amount < 0 then
                amount = "|cffff0000" .. tostring(amount) .. "|r"
            end
            local group
            for _group, data in ipairs(WagesGroupMembers) do
                if #data > 0 then
                    for _, _name in ipairs(data) do
                        if name == _name then
                            group = _group
                            break
                        end
                    end
                end
            end
            if RL and RL == name then
                if ZL.opt.RLBuTieType == 3 then
                    balanceAmount = ZL_CURRENT["aveWages"] * biLi * 2
                else
                    balanceAmount = ZL_CURRENT["aveWages"] * biLi
                end
            else
                balanceAmount = ZL_CURRENT["aveWages"] * biLi
            end
            balanceAmount = math.floor(balanceAmount)
            if balanceAmount < 0 then
                balanceAmount = "|cffff0000" .. tostring(balanceAmount) .. "|r"
            end
            local f = self.entries[index]
            f:Show()
            f:SetValues(name, balanceAmount, group, biLi*100, buTie, amount)
            -- f.mail:Disable()
            index = index + 1
        elseif ZL.opt.showAllWages then
            if (not ZL_CURRENT["aveWages"]) then return end
            if WagesGroupMembers then
                for group, data in ipairs(WagesGroupMembers) do
                    if #data > 0 then
                        for _, name in ipairs(data) do
                            local balanceAmount
                            local playerPayToMLamount = 0
                            local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
                            biLi = wagesNumber:GetNumber() > 0 and 1 or biLi
                            local buTie = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].buTie) and ZL_CURRENT.WagesBiLi[name].buTie or 0
                            totalBuTieMail = totalBuTieMail + buTie
                            if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
                                playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
                            end
                            local amount = playerPayToMLamount - (playerBuyList[name] and playerBuyList[name].totalAmount or 0)
                            amount = amount > 0 and 0 or amount
                            if PlayerIsML(name) then amount = 0 end
                            if amount < 0 then
                                amount = "|cffff0000" .. tostring(amount) .. "|r"
                            end
                            if RL and RL == name then
                                if ZL.opt.RLBuTieType == 3 then
                                    balanceAmount = ZL_CURRENT["aveWages"] * biLi * 2
                                else
                                    balanceAmount = ZL_CURRENT["aveWages"] * biLi
                                end
                            else
                                balanceAmount = ZL_CURRENT["aveWages"] * biLi
                            end
                            balanceAmount = math.floor(balanceAmount)
                            local f = self.entries[index]
                            f:Show()
                            local _balanceAmount
                            if balanceAmount < 0 then
                                _balanceAmount = "|cffff0000" .. tostring(balanceAmount) .. "|r"
                            else
                                _balanceAmount = balanceAmount
                            end
                            f:SetValues(name, _balanceAmount, group, biLi*100, buTie, amount)
                            -- if ZL_CURRENT["mailPlayers"] and ZL_CURRENT["mailPlayers"][name] == false and balanceAmount > 0 then
                            --     f.mail:Enable()
                            -- else
                            --     f.mail:Disable()
                            -- end
                            index = index + 1
                        end
                    end
                end
            end
        else
            -- playerBalanceFont:SetText("欠款")
            for name, data in pairs(playerBuyList) do
                local balanceAmount = 0
                local playerPayToMLamount = 0
                local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
                biLi = wagesNumber:GetNumber() > 0 and 1 or biLi
                local buTie = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].buTie) and ZL_CURRENT.WagesBiLi[name].buTie or 0
                if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
                    playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
                end
                local amount = playerPayToMLamount - (playerBuyList[name] and playerBuyList[name].totalAmount or 0)
                amount = amount > 0 and 0 or amount
                if RL and RL == name then
                    if ZL.opt.RLBuTieType == 3 then
                        balanceAmount = ZL_CURRENT["aveWages"] * biLi * 2
                    else
                        balanceAmount = ZL_CURRENT["aveWages"] * biLi
                    end
                else
                    balanceAmount = ZL_CURRENT["aveWages"] * biLi
                end
                balanceAmount = math.floor(balanceAmount)
                if balanceAmount < 0 then
                    balanceAmount = "|cffff0000" .. tostring(balanceAmount) .. "|r"
                end
                local group
                for _group, _data in ipairs(WagesGroupMembers) do
                    if #_data > 0 then
                        for _, _name in ipairs(_data) do
                            if name == _name then
                                group = _group
                                break
                            end
                        end
                    end
                end
                local IsNotTrade = false
                for _, items in ipairs(data) do
                    if items.isTraded == false then
                        IsNotTrade = true
                        break
                    end
                end
                if PlayerIsML(name) then
                    amount = 0
                    IsNotTrade = false
                end
                if amount < 0 or IsNotTrade then
                    amount = "|cffff0000" .. tostring(amount) .. "|r"
                    local f = self.entries[index]
                    f:Show()
                    f:SetValues(name, balanceAmount, group, biLi*100, buTie, amount)
                    -- f.mail:Disable()
                    index = index + 1
                end
            end
        end
        if index > 1 then
            playerBalanceContent:SetHeight(25 * (index-1) - 5)
        else
            playerBalanceContent:SetHeight(5)
        end
        if totalBuTieMail > 0 then
            butieMail:Show()
            if totalBuTieMail <= -totalpayout then
                butieMail:SetText("输入补贴：|cffffffff" .. totalBuTieMail .. "|r， 总支出：|cffffffff" .. (totalpayout < 0 and -totalpayout or 0) .. "|r")
            else
                butieMail:SetText("输入补贴：|cffff0000" .. totalBuTieMail .. "|r， 总支出：|cffffffff" .. (totalpayout < 0 and -totalpayout or 0) .. "|r")
            end
        else
            butieMail:Hide()
        end
    end
end

--创建出价记录框架
function ZL:CreateBidderListFrame()
    ZL.BidderListFrame = CreateFrame("Frame", "ZLBidderListFrame", ZL, BackdropTemplateMixin and "BackdropTemplate") --
    local BidderListFrame = ZL.BidderListFrame
    BidderListFrame:SetSize(180, 100)
    BidderListFrame:SetPoint("CENTER")
    BidderListFrame:SetFrameStrata("DIALOG")
    BidderListFrame:SetFrameLevel(ZL.AuctionFrame2:GetFrameLevel() + 10)
    BidderListFrame:SetAlpha(1)
    BidderListFrame:SetBackdrop({
        bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark",
        edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
        tile = true, tileSize = 32, edgeSize = 6,
        insets = { left = 0, right = 0, top = 0, bottom = 0 }
    })
    BidderListFrame.closeButton = CreateFrame("Button", nil, BidderListFrame, "UIPanelCloseButton")
    BidderListFrame.closeButton:SetPoint("TOPRIGHT", BidderListFrame, "TOPRIGHT", 0, 0)
    BidderListFrame.closeButton:SetSize(25, 25)
    BidderListFrame.closeButton:SetScript("OnClick", function (self)
        BidderListFrame:Hide()
    end)
    BidderListFrame:SetScript("OnShow", function (self)
        if ZL.BidderListFrame.index then
            BidderListFrame:Update(ZL.BidderListFrame.index)
        end
    end)
    BidderListFrame:SetScript("OnEnter", function (self)
        ZL.AuctionFrame2.entries[ZL.BidderListFrame.index].zlHighlight:Show()
        -- ZL.BidderListFrame.OnShow()
    end)
    BidderListFrame:SetScript("OnLeave", function (self)
        ZL.AuctionFrame2.entries[ZL.BidderListFrame.index].zlHighlight:Hide()
        if not BidderListFrame:IsMouseOver() then
            BidderListFrame:Hide()
        end
        -- if ZL.BidderListFrame.time and (not ZL.BidderListFrame.time:IsCancelled()) then
        --     ZL.BidderListFrame.time:Cancel()
        -- end
        -- ZL.BidderListFrame.time = C_Timer.NewTimer(0.3, function (self)
        --     ZL.BidderListFrame.OnHide()
        -- end)
        -- GameTooltip:Hide()
    end)
    BidderListFrame:SetScript("OnShow", function ()
        -- local index = ZL.BidderListFrame.index
        -- local auctionList = ZL_CURRENT.auctionlist[index]
        -- if (not PlayerIsML()) or auctionList.state ~= "auctioning" or (auctionList.state == "auctioning" and (not auctionList["bidderlist"] or #auctionList["bidderlist"]==0)) then
        --     BidderListFrame.dropDown:Hide()
        -- end
    end)

    BidderListFrame.TitleFont = BidderListFrame:CreateFontString()
    local TitleFont = BidderListFrame.TitleFont
    TitleFont:SetPoint("TOP", BidderListFrame, "TOP", 0, -5)
    TitleFont:SetFont(GameFontNormal:GetFont(), 14)
    TitleFont:SetTextColor(1, 0.82, 0)
    TitleFont:SetText("修改出价记录")
    TitleFont:SetWordWrap(false)
    TitleFont:SetJustifyH("LEFT")
    
    BidderListFrame.PlayerNameFont = BidderListFrame:CreateFontString()
    local PlayerNameFont = BidderListFrame.PlayerNameFont
    PlayerNameFont:SetPoint("TOPLEFT", BidderListFrame, "TOPLEFT", 5, -10-TitleFont:GetHeight())
    PlayerNameFont:SetWidth(80)
    PlayerNameFont:SetFont(GameFontNormal:GetFont(), 12)
    PlayerNameFont:SetTextColor(1, 0.82, 0)
    PlayerNameFont:SetText("玩家名")
    PlayerNameFont:SetWordWrap(false)
    PlayerNameFont:SetJustifyH("LEFT")

    BidderListFrame.BidAmountFont = BidderListFrame:CreateFontString()
    local BidAmountFont = BidderListFrame.BidAmountFont
    BidAmountFont:SetPoint("LEFT", PlayerNameFont, "RIGHT", 5, 0)
    BidAmountFont:SetWidth(60)
    BidAmountFont:SetFont(GameFontNormal:GetFont(), 12)
    BidAmountFont:SetTextColor(1, 0.82, 0)
    BidAmountFont:SetText("单价")
    BidAmountFont:SetWordWrap(false)
    BidAmountFont:SetJustifyH("RIGHT")
    BidderListFrame:Hide()

    -- function BidderListFrame.OnShow()
    --     if ZL.BidderListFrame.time and (not ZL.BidderListFrame.time:IsCancelled()) then
    --         ZL.BidderListFrame.time:Cancel()
    --     end
    --     if not BidderListFrame:IsShown() then
    --         BidderListFrame:Show()
    --     end
    -- end
    -- function BidderListFrame.OnHide(frame)
    --     if ((not frame) or (not frame:IsMouseOver())) and (not BidderListFrame:IsMouseOver()) then
    --         BidderListFrame:Hide()
    --     end
    -- end
    BidderListFrame:Hide()
    BidderListFrame.entries = setmetatable({}, {
        __index = function(t, v)
            local f = CreateFrame("Frame", nil, BidderListFrame)
            if v > 1 then
                f:SetPoint("TOPLEFT", t[v - 1], "BOTTOMLEFT", 0, -1)
                f:SetPoint("TOPRIGHT", t[v - 1], "BOTTOMRIGHT", 0, -1)
            else
                f:SetPoint("TOPLEFT", PlayerNameFont, "BOTTOMLEFT", 0, -3)
                f:SetPoint("TOPRIGHT", PlayerNameFont, "BOTTOMRIGHT", 0, -3)
            end
            f:SetHeight(16)

            f.nameEditBox = CreateEditBox(f, 80, 16, 12, "LEFT")
            f.nameEditBox:SetPoint("LEFT", f, "LEFT", 0, 0)
            -- f.nameEditBox:Disable()
            f.nameEditBox:SetScript("OnMouseDown", function (self)
                local index = ZL.BidderListFrame.index
                local function tempfunc()
                    local menuList = {}
                    local WagesGroupMembers, msg = ZL.GetWagesGroupMembers()
                    if WagesGroupMembers and msg then
                        tinsert(menuList, {text=msg, isTitle = true})
                        for i, data in ipairs(WagesGroupMembers) do
                            if #data > 0 then
                                local memberList = {}
                                for _, playerName in ipairs(data) do
                                    tinsert(memberList, {
                                        text=playerName,
                                        func = function ()
                                            local curAuctionList = ZL_CURRENT.auctionlist[index]
                                            local bidderlist = curAuctionList.bidderlist
                                            for _, data in ipairs(bidderlist) do
                                                if data.bidder == playerName then
                                                    ZL.Print("名字已存在，请重新选择！")
                                                    return
                                                end
                                            end
                                            f.nameEditBox:SetText(playerName)
                                            f.nameEditBox:ClearFocus()
                                            local data = {
                                                type = "修改名字",
                                                data2 = {
                                                    itemlink = curAuctionList.itemlink,
                                                    itemindex = curAuctionList.itemindex,
                                                    oldName = curAuctionList.bidderlist[v].bidder,
                                                    newName = playerName,
                                                },
                                            }
                                            MyAddon:TransmitAddonInfo("AUTOAUC SYNC6", data)
                                            for _, ff in ipairs(BidderListFrame.entries) do
                                                ff.nameEditBox:Disable()
                                                ff.bidAmountEditBox:Disable()
                                                ff.delBtn:Disable()
                                            end
                                        end,
                                    })
                                end
                                tinsert(menuList, {
                                    text = i .. "队",
                                    func = function ()
                                        self:ClearFocus()
                                    end,
                                    hasArrow = true,
                                    menuTable = memberList,
                                })
                            end
                        end
                        tinsert(menuList, {isSeparator = true})
                        tinsert(menuList, {text = CANCEL, func = function() self:ClearFocus() end})
                    end
                    return menuList
                end
                ZL.GUI:ToggleMenu(self, tempfunc(), 'cursor')
            end)

            f.nameEditBox:SetScript("OnEnter", function (self)
                local index = ZL.BidderListFrame.index
                ZL.AuctionFrame2.entries[index].zlHighlight:Show()
            end)
            f.nameEditBox:SetScript("OnLeave", function ()
                local index = ZL.BidderListFrame.index
                ZL.AuctionFrame2.entries[index].zlHighlight:Hide()
            end)

            f.bidAmountEditBox = CreateEditBox(f, 60, 16, 12, "RIGHT")
            f.bidAmountEditBox:SetPoint("LEFT", f.nameEditBox, "RIGHT", 5, 0)
            f.bidAmountEditBox:SetScript("OnEnter", function (self)
                local index = ZL.BidderListFrame.index
                ZL.AuctionFrame2.entries[index].zlHighlight:Show()
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("修改出价")
                GameTooltip:AddLine("支持鼠标滚轮修改\n按Enter或右键保存", 1, 1, 1)
                GameTooltip:Show()
            end)
            f.bidAmountEditBox:SetScript("OnLeave", function (self)
                local index = ZL.BidderListFrame.index
                ZL.AuctionFrame2.entries[index].zlHighlight:Hide()
                GameTooltip:Hide()
            end)
            f.bidAmountEditBox:SetScript("OnMouseWheel", function(self, delta)
                if self:HasFocus() then
                    local number = tonumber(ParseClassColorName(self:GetText()))
                    if delta > 0 then
                        number = number + 100
                    else
                        number = number - 100
                    end
                    if number < 0 then
                        number = 0
                    end
                    self:SetNumber(number)
                end
            end)
            local function changeBidAmount(self)
                local index = ZL.BidderListFrame.index
                local curAuctionList = ZL_CURRENT.auctionlist[index]
                local bidAmount = self:GetText()
                bidAmount = bidAmount:gsub("|cffff0000", ""):gsub("|r", "")
                bidAmount = tonumber(bidAmount)
                bidAmount = (bidAmount > 0 and bidAmount) or 0
                if bidAmount> 0 and bidAmount ~= curAuctionList.bidderlist[v].bidamount then
                    local data = {
                        type = "修改出价",
                        data2 = {
                            itemlink = curAuctionList.itemlink,
                            itemindex = curAuctionList.itemindex,
                            oldName = curAuctionList.bidderlist[v].bidder,
                            newBidAmount = bidAmount,
                        },
                    }
                    MyAddon:TransmitAddonInfo("AUTOAUC SYNC6", data)
                    for _, ff in ipairs(BidderListFrame.entries) do 
                        ff.nameEditBox:Disable()
                        ff.bidAmountEditBox:Disable()
                    end
                else
                    self:SetText(ZL_CURRENT.auctionlist[index].bidderlist[v].bidamount)
                end
                self:ClearFocus()
            end
            f.bidAmountEditBox:SetScript("OnEnterPressed", function (self)
                changeBidAmount(self)
            end)
            f.bidAmountEditBox:SetScript("OnMouseDown", function (self, button)
                if button == "RightButton" and self:HasFocus() then
                    C_Timer.After(0.5, function ()
                        changeBidAmount(self)
                    end)
                end
            end)
            f.bidAmountEditBox:SetScript("OnEscapePressed", function (self)
                local index = ZL.BidderListFrame.index
                BidderListFrame:Update(index)
            end)

            f.delBtn = CreateButton(nil, f, "-", "LEFT", f.bidAmountEditBox, "RIGHT", 3, 0, 20, 16)
            f.delBtn:SetScript("OnEnter", function (self)
                local index = ZL.BidderListFrame.index
                ZL.AuctionFrame2.entries[index].zlHighlight:Show()
                GameTooltipShow(self, "LEFT", "RIGHT")
                GameTooltip:AddLine("撤销出价")
                GameTooltip:Show()
            end)
            f.delBtn:SetScript("OnLeave", function ()
                local index = ZL.BidderListFrame.index
                ZL.AuctionFrame2.entries[index].zlHighlight:Hide()
                GameTooltip:Hide()
            end)
            f.delBtn:SetScript("OnClick", function (self)
                local index = ZL.BidderListFrame.index
                local curAuctionList = ZL_CURRENT.auctionlist[index]
                local playerName = f.nameEditBox:GetText()
                if playerName and #playerName > 0 then
                    MyAddon:TransmitAddonInfo("AUTOAUC REVOKE", {
                        itemlink=curAuctionList.itemlink, itemindex=curAuctionList.itemindex, playerName=playerName
                    })
                end
            end)

            function f:SetValues(player, amount, state)
                self.nameEditBox:SetText(player)
                self.bidAmountEditBox:SetText(amount)
                if PlayerIsML() and state == "auctioning" then
                    self.bidAmountEditBox:Enable()
                else
                    self.bidAmountEditBox:Disable()
                end
                f:Show()
            end

            t[v] = f
            return f
        end
    })

    function BidderListFrame:Update(v)
        for _, f in ipairs(self.entries) do f:Hide() end
        local curAuctionList = ZL_CURRENT.auctionlist[v]
        local bidderList = curAuctionList.bidderlist
        -- if (not PlayerIsML()) or curAuctionList.state ~= "auctioning" or (curAuctionList.state == "auctioning" and (not curAuctionList["bidderlist"] or #curAuctionList["bidderlist"]==0)) then
        --     BidderListFrame.dropDown:Hide()
        -- end
        tableSort(bidderList)
        local totalBidCount = 0
        for index, bidData in ipairs(bidderList) do
            local f = self.entries[index]
            if totalBidCount < curAuctionList.itemCount then
                local count = bidData["bidCount"] or 1
                local newTotalBidCount = totalBidCount + count
                if newTotalBidCount > curAuctionList.itemCount then
                    count = curAuctionList.itemCount - totalBidCount
                end
                f:SetValues(bidData.bidder, "|cffff0000" .. tostring(bidData.bidamount) .. "|r", curAuctionList.state)
                totalBidCount = newTotalBidCount
            else
                f:SetValues(bidData.bidder, bidData.bidamount, curAuctionList.state)
            end
        end
        local height = 20 + TitleFont:GetHeight() + BidAmountFont:GetHeight()
        height = height + #bidderList * 15
        height = height < 100 and 100 or height
        self:SetHeight(height)
        -- BidderListFrame:ClearAllPoints()
        -- BidderListFrame:SetPoint("LEFT", ZL.AuctionFrame2.entries[v].Frame1, "RIGHT", 0, -10)
    end
end

--创建打包拍卖清单框架
function ZL:CreatePackageListFrame()
    ZL.PackageListFrame = CreateFrame("Frame", "ZLPackageListFrame", ZL, BackdropTemplateMixin and "BackdropTemplate")
    local PackageListFrame = ZL.PackageListFrame
    PackageListFrame:SetSize(190, 100)
    PackageListFrame:SetPoint("CENTER")
    PackageListFrame:SetFrameStrata("DIALOG")
    PackageListFrame:SetFrameLevel(ZL.AuctionFrame2:GetFrameLevel() + 10)
    PackageListFrame:SetAlpha(1)
    PackageListFrame:SetBackdrop({
        bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark",
        edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
        tile = true, tileSize = 32, edgeSize = 6,
        insets = { left = 0, right = 0, top = 0, bottom = 0 }
    })
    PackageListFrame:SetScript("OnEnter", function (self)
        ZL.PackageListFrame.OnShow()
    end)
    PackageListFrame:SetScript("OnLeave", function (self)
        if ZL.PackageListFrame.time and (not ZL.PackageListFrame.time:IsCancelled()) then
            ZL.PackageListFrame.time:Cancel()
        end
        ZL.PackageListFrame.time = C_Timer.NewTimer(0.01, function (self)
            ZL.PackageListFrame.OnHide()
        end)
    end)
    PackageListFrame.TitleFont = PackageListFrame:CreateFontString()
    local TitleFont = PackageListFrame.TitleFont
    TitleFont:SetPoint("TOP", PackageListFrame, "TOP", 0, -5)
    TitleFont:SetFont(GameFontNormal:GetFont(), 14)
    TitleFont:SetTextColor(1, 0.82, 0)
    TitleFont:SetText("打包清单")
    TitleFont:SetWordWrap(false)
    TitleFont:SetJustifyH("LEFT")

    PackageListFrame.ItemNameFont = PackageListFrame:CreateFontString()
    local ItemNameFont = PackageListFrame.ItemNameFont
    ItemNameFont:SetPoint("TOPLEFT", PackageListFrame, "TOPLEFT", 10, -10-TitleFont:GetHeight())
    ItemNameFont:SetWidth(120)
    ItemNameFont:SetFont(GameFontNormal:GetFont(), 12)
    ItemNameFont:SetTextColor(1, 0.82, 0)
    ItemNameFont:SetText("名称")
    ItemNameFont:SetWordWrap(false)
    ItemNameFont:SetJustifyH("LEFT")

    PackageListFrame.ItemCount = PackageListFrame:CreateFontString()
    local ItemCount = PackageListFrame.ItemCount
    ItemCount:SetPoint("LEFT", ItemNameFont, "RIGHT", 5, 0)
    ItemCount:SetWidth(30)
    ItemCount:SetFont(GameFontNormal:GetFont(), 12)
    ItemCount:SetTextColor(1, 0.82, 0)
    ItemCount:SetText("数量")
    ItemCount:SetWordWrap(false)
    ItemCount:SetJustifyH("RIGHT")
    PackageListFrame:Hide()

    function PackageListFrame.OnShow()
        if ZL.PackageListFrame.time and (not ZL.PackageListFrame.time:IsCancelled()) then
            ZL.PackageListFrame.time:Cancel()
        end
        if not PackageListFrame:IsShown() then
            PackageListFrame:Show()
        end
    end
    function PackageListFrame.OnHide(frame)
        if ((not frame) or (not frame:IsMouseOver())) and (not PackageListFrame:IsMouseOver()) then
            PackageListFrame:Hide()
        end
    end
    PackageListFrame.entries = setmetatable({}, {
        __index = function(t, v)
            local f = CreateFrame("Frame", nil, PackageListFrame)
            if v > 1 then
                f:SetPoint("TOPLEFT", t[v - 1], "BOTTOMLEFT", 0, 0)
                f:SetPoint("TOPRIGHT", t[v - 1], "BOTTOMRIGHT", 0, 0)
            else
                f:SetPoint("TOPLEFT", ItemNameFont, "BOTTOMLEFT", 0, -3)
                f:SetPoint("TOPRIGHT", ItemNameFont, "BOTTOMRIGHT", 0, -3)
            end
            f:SetHeight(15)

            f.itemicon = CreateFrame("Button", nil, f)
            f.itemicon:SetSize(14, 14)
            f.itemicon:EnableMouse(true)
            f.itemicon:SetPoint("LEFT", f, "LEFT", 0, 0)
            f.itemicon:SetScript("OnEnter", function(self)
                local itemLink = f.ItemName:GetText()
                local itemId = string.match(itemLink, "|c........|Hitem:(%d+):")
                if itemId then
                    GameTooltip:ClearAllPoints()
                    GameTooltip:ClearLines()
                    GameTooltip:SetOwner(self, "ANCHOR_NONE")
                    GameTooltip:SetHyperlink(itemLink)
                    GameTooltip:SetPoint("RIGHT", f, "LEFT", -5, 0)
                    GameTooltip:Show()
                end
            end)
            f.itemicon:SetScript("OnLeave", function() GameTooltip:Hide() end)

            f.ItemName = f:CreateFontString()
            f.ItemName:SetPoint("LEFT", f.itemicon, "RIGHT", 3, 0)
            f.ItemName:SetWidth(103)
            f.ItemName:SetFont(GameFontNormal:GetFont(), 12)
            f.ItemName:SetWordWrap(false)
            f.ItemName:SetJustifyH("LEFT")

            f.ItemCount = f:CreateFontString()
            f.ItemCount:SetPoint("LEFT", f.ItemName, "RIGHT", 5, 0)
            f.ItemCount:SetWidth(30)
            f.ItemCount:SetFont(GameFontNormal:GetFont(), 12)
            f.ItemCount:SetWordWrap(false)
            f.ItemCount:SetJustifyH("RIGHT")

            f.del = CreateButton(nil, f, "-", "LEFT", f.ItemCount, "RIGHT", 4, 2, 14, 14)
            f.del:SetScript("OnClick", function ()
                local itemLink = f.ItemName:GetText()
                local itemindexList = ZL_CURRENT.auctionlist[ZL.PackageListFrame.index]["itemList"][itemLink]["itemindex"]
                --先把需要剔除的物品isPackage清楚
                if itemindexList and #itemindexList > 0 then
                    for _, _itemindex in ipairs(itemindexList) do
                        local _, index = ZL.FetchDataFromItemId(itemLink, _itemindex)
                        if index then
                            ZL_CURRENT.auctionlist[index]["isPackage"] = nil
                        end
                    end
                end
                --将需要删除的打包物品发送给其他成员
                local fdata = {
                    type = "删除打包里面的物品",
                    itemLink = itemLink,
                    globalConfigData = ZL.globalConfigData(),
                }
                MyAddon:TransmitAddonInfo("AUTOAUC SYNC15", fdata, "BULK")
                --ML开始删除自己的打包物品
                ZL_CURRENT.auctionlist[ZL.PackageListFrame.index]["itemList"][itemLink] = nil
                PackageListFrame:Update(ZL.PackageListFrame.index)
                ZL.AuctionFrame2:Update()
            end)

            function f:SetValues(itemName, itemCount)
                local itemId = string.match(itemName, "|c........|Hitem:(%d+):")
                if itemId then
                    self.itemicon:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
                    self.itemicon:SetNormalTexture(cGetItemIcon(itemName))
                end
                self.ItemName:SetText(itemName)
                self.ItemCount:SetText(itemCount)
                if PlayerIsML() then
                    f.del:Show()
                else
                    f.del:Hide()
                end
                f:Show()
            end

            t[v] = f
            return f
        end
    })

    function PackageListFrame:Update(v)
        for _, f in ipairs(self.entries) do f:Hide() end
        local itemList = ZL_CURRENT.auctionlist[v]["itemList"]
        local index = 0
        if itemList and next(itemList, nil) then
            for itemlink, data in pairs(itemList) do
                index = index + 1
                local f = self.entries[index]
                f:SetValues(itemlink, data.itemCount)
                if ZL_CURRENT.auctionlist[v].state == "auctioning" then
                    f.del:Hide()
                end
            end
        end
        local height = 20 + TitleFont:GetHeight() + ItemCount:GetHeight()
        height = height + index * 15
        if height < 100 then
            height = 100
        end
        self:SetHeight(height)
        PackageListFrame:ClearAllPoints()
        PackageListFrame:SetPoint("RIGHT", ZL.AuctionFrame2.entries[v].infoFrame.timerBtn, "LEFT", 0, -10)
    end
end

--创建交易时显示拍卖记录框架选择按钮
function ZL:CreateShowAuctionRecordFrame()
    ZL.ShowAuctionRecordFrame = CreateFrame("Frame", nil, ZL)
    local ShowAuctionRecordFrame = ZL.ShowAuctionRecordFrame
    ShowAuctionRecordFrame:SetSize(100, 20)
    ShowAuctionRecordFrame:SetPoint("CENTER", UIParent, "CENTER")
    ShowAuctionRecordFrame:SetFrameStrata("HIGH")

    ShowAuctionRecordFrame.CheckButton = CreateFrame("CheckButton", nil, ShowAuctionRecordFrame, "ChatConfigCheckButtonTemplate")
    ShowAuctionRecordFrame.CheckButton:SetPoint("LEFT", ShowAuctionRecordFrame, "LEFT")
    ShowAuctionRecordFrame.CheckButton.Text:SetText("工资窗口")
    ShowAuctionRecordFrame.CheckButton.Text:SetFont(GameFontNormal:GetFont(), 14, "")
    ShowAuctionRecordFrame.CheckButton:SetHitRectInsets(0, -ShowAuctionRecordFrame.CheckButton.Text:GetWidth(), 0, 0)
    ShowAuctionRecordFrame.CheckButton.tooltip = "勾选交易时显示工资窗口"
    ShowAuctionRecordFrame.CheckButton:SetChecked(ZL.opt.ShowAuctionRecordFrameCheckButtonValue)
    ShowAuctionRecordFrame.CheckButton:SetScript("OnClick", function (self)
        ZL.opt.ShowAuctionRecordFrameCheckButtonValue = ShowAuctionRecordFrame.CheckButton:GetChecked()
        if ZL.opt.ShowAuctionRecordFrameCheckButtonValue then
            if (not ZL.AuctionRecordFrame:IsShown()) then
                ZL.AuctionRecordFrame:Show()
            else
                ZL.AuctionRecordFrame.playerBalanceFrame:Update()
            end
            _G["ZLAuctionRecordFrameTab3"]:Click()
            ZL.AuctionRecordFrame:ClearAllPoints()
            ZL.AuctionRecordFrame:SetPoint("TOPLEFT", _G["TradeFrame"], "TOPRIGHT")
        else
            ZL.AuctionRecordFrame:Hide()
            ZL.opt.ZLAuctionRecordFrameIsShown = false
        end
    end)
    local function GetPlayerSubgroupAndMembers(playerName)
        -- 查找指定成员所在的队伍
        local subgroup
        for i = 1, MAX_RAID_MEMBERS do
            local name, _, group = GetRaidRosterInfo(i)
            if name and name == playerName then
                subgroup = group
                break
            end
        end
        if not subgroup then
            return nil, nil -- 如果未找到成员
        end
        -- 获取该队伍的所有成员名字
        local members = {}
        for i = 1, MAX_RAID_MEMBERS do
            local name, _, group = GetRaidRosterInfo(i)
            if name and group == subgroup then
                table.insert(members, GetClassColorName(name))
            end
        end
        return subgroup, members
    end
    ShowAuctionRecordFrame.DisenchantingBtn = CreateButton(nil, ShowAuctionRecordFrame, "流拍", "RIGHT", ShowAuctionRecordFrame.CheckButton, "LEFT", -45, 0, 50)
    ShowAuctionRecordFrame.DisenchantingBtn:SetScript("OnClick", function (self)
        local msgStr = ""
        if not PlayerIsML() then
            msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(msgStr)
            return
        end
        local function PickupContainerItemToTrade(ibag, islot)
            C_Container.PickupContainerItem(ibag, islot)
            for i = 1, 6 do
                local name = GetTradePlayerItemInfo(i)
                if (not name) then
                    ClickTradeButton(i)
                    break
                end
            end
        end
        local function GetFailedItemList()
            local failedItemList = {}
            if ZL_CURRENT.auctionlist then
                for _, data in ipairs(ZL_CURRENT.auctionlist) do
                    local itemId = data.itemId
                    if data.state == "failed" and data.bindType == 1 and data.spawnUID and ((not ZL.disenchantingLgnoreList) or (not ZL.disenchantingLgnoreList[tostring(itemId)]))
                    and ((not ZL.opt.disenchantingLgnoreList) or (not ZL.opt.disenchantingLgnoreList[tostring(itemId)])) and (not NON_DISENCHANTABLE_ITEMS[tostring(itemId)]) and ZL.IsDisenchantAble(itemId) then
                        for _, value in pairs(data.spawnUID) do
                            if value.itemGUID and next(value.itemGUID, nil) then
                                for key, _ in pairs(value.itemGUID) do
                                    --判断是否在背包
                                    local bag, slot = ZL.FindItemInBag(key)
                                    if bag then
                                        tinsert(failedItemList, {bag, slot})
                                        if #failedItemList >= 6 then  --每次最多只能交易6个
                                            return failedItemList
                                        end
                                        break
                                    end
                                end
                            end
                        end
                    end
                end
            end
            return failedItemList
        end
        if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
            local failedItemList = GetFailedItemList()
            if #failedItemList > 0 then
                local index = 1
                local function tempfuc()
                    if index <= #failedItemList then
                        PickupContainerItemToTrade(failedItemList[index][1], failedItemList[index][2])
                        index = index + 1
                        C_Timer.After(0.3, tempfuc)
                    end
                end
                tempfuc()
            else
                msgStr = "没有流拍物品！"
                ZL.Print(msgStr)
            end
        else
            msgStr = "没有流拍物品！"
            ZL.Print(msgStr)
        end
    end)
    ShowAuctionRecordFrame.DisenchantingBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("快速交易流拍物品给\n其他人分解(|cffffffffML功能|r)")
        GameTooltip:Show()
    end)
    ShowAuctionRecordFrame.DisenchantingBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)
    ShowAuctionRecordFrame.TradeGroupWagesBtn = CreateButton(nil, ShowAuctionRecordFrame, "小队", "RIGHT", ShowAuctionRecordFrame.DisenchantingBtn, "LEFT", -5, 0, 50)
    ShowAuctionRecordFrame.TradeGroupWagesBtn:SetScript("OnClick", function (self)
        if not PlayerIsML() then
            local msgStr = "小队交易工资为ML功能，您无法使用，请使用单个交易功能！"
            ZL.Print(msgStr)
            return
        end
        if not ZL_CURRENT.incomeConfirm then
            local link = format("|cff87CEEB|Hgarrmission:%s:%s|h[%s]|h|r", "AutoAuction", "通报详细收支", "通报详细收支")
            local msgStr = "还未通报过|cffffffff详细收支|r，无法使用小队交易功能！" .. link
            ZL.Print(msgStr, true)
            return
        end
        local wagesGroupMembersIndex = (ZL_CURRENT["globalConfig"] and ZL_CURRENT["globalConfig"]["wagesGroupMembers"]) and ZL_CURRENT["globalConfig"]["wagesGroupMembers"] or 0
        if wagesGroupMembersIndex == 0 and ZL.AuctionRecordFrame.playerBalanceFrame.wagesNumber:GetNumber() <= 0 then
            ZL.AuctionRecordFrame:Show()
            _G["ZLAuctionRecordFrameTab3"]:Click()
            local msgStr = "你选择的是：|cffff0000当前团队名单|r，请输入具体的工资人数后再邮寄工资！"
            ZL.Print(msgStr, true)
            return
        end
        local noColorName = GetUnitName("npc")
        local tradePartner = GetClassColorName(noColorName)
        local playerBuyList = ZL.GetPlayerBuyList()
        local _, _, _, RL = ZL.GetWagesGroupMembers()
        GetAveWages()
        local msgStr
        if (not ZL_CURRENT["aveWages"]) then
            msgStr = "无法计算工资！"
            ZL.Print(msgStr)
            return
        end
        if not IsInRaid(1) then
            msgStr = "不在团队中，无法小队交易工资！"
            ZL.Print(msgStr)
            return
        end
        local subgroup, members = GetPlayerSubgroupAndMembers(noColorName)
        if not subgroup then
            msgStr = "【" .. tradePartner .. "】不在团队中，无法小队交易工资！"
            ZL.Print(msgStr)
            return
        end
        local _subgroup = GetPlayerSubgroupAndMembers(UnitName("player"))
        if subgroup == _subgroup then
            msgStr = "【" .. tradePartner .. "】跟你在一个小队，无法小队交易工资，请使用单个交易！"
            ZL.Print(msgStr)
            return
        end
        if ZL_CURRENT.tradeGroupGongZi and ZL_CURRENT.tradeGroupGongZi[tostring(subgroup)] then
            msgStr = subgroup .. "队|cffff0000已交易过工资，不要重复交易哦！|r"
            ZL.Print(msgStr)
            return
        end
        local groupTotal = 0
        local gongziList = {}
        local isFuGongzi, isMail = {}, {}
        for _, name in ipairs(members) do
            local balanceAmount
            local playerPayToMLamount = 0
            local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
            local buTie = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].buTie) and ZL_CURRENT.WagesBiLi[name].buTie or 0
            if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
                playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
            end
            local amount = playerPayToMLamount - (playerBuyList[name] and playerBuyList[name].totalAmount or 0)  --欠款
            amount = amount > 0 and 0 or amount
            if PlayerIsML(name) then amount = 0 end
            if RL and RL == name then
                if ZL.opt.RLBuTieType == 3 then
                    balanceAmount = ZL_CURRENT["aveWages"] * biLi * 2
                else
                    balanceAmount = ZL_CURRENT["aveWages"] * biLi
                end
            else
                balanceAmount = ZL_CURRENT["aveWages"] * biLi
            end
            balanceAmount = math.floor(balanceAmount)
            local total = balanceAmount+amount+buTie
            groupTotal = groupTotal + total
            gongziList[name] = total
            if total < 0 then
                isFuGongzi[name] = total
            end
            if ZL_CURRENT["mailPlayers"] and ZL_CURRENT["mailPlayers"][name] ~= nil then
                tinsert(isMail, name)
            end
        end
        if next(isFuGongzi) then
            msgStr = "存在负工资成员："
            for name, gongzi in pairs(isFuGongzi) do
                msgStr = msgStr .. name .. "(" .. gongzi .. ")，"
            end
            msgStr = msgStr .. "无法交易工资！"
            ZL.Print(msgStr)
            return
        end
        if #isMail > 0 then
            msgStr = "存在需邮寄工资成员：" .. table.concat(isMail, "，") .. "，无法交易工资"
            ZL.Print(msgStr)
            return
        end
        if groupTotal <= 0 then
            msgStr = "【" .. subgroup .. "队】工资合计：" .. groupTotal .. "，无法交易工资！"
            ZL.Print(msgStr)
            return
        end
        if GetMoney() < groupTotal*10000 then
            msgStr = "|cffff0000金币不足，无法交易工资！|r"
            ZL.Print(msgStr)
            return
        end
        -- MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, groupTotal * 10000)
        ChatEdit_ActivateChat(ChatEdit_ChooseBoxForSend())
        ChatEdit_InsertLink(groupTotal)
        ChatEdit_ChooseBoxForSend():HighlightText()
        ZL.Print("自动输入金额已被禁用，请复制然后直接粘贴")
        -- if GetPlayerTradeMoney() > 0 then
        --     ClearCursor()
        --     PickupTradeMoney(GetPlayerTradeMoney())
        --     ClearCursor()
        -- end
        -- ClearCursor()
        -- PickupPlayerMoney(groupTotal*10000)
        -- _G["TradePlayerItem1ItemButton"]:Click()
        ZL.ShowAuctionRecordFrame.PlayerTradeMoneyText:Show()
        ZL.tradeGongZi = nil
        ZL.tradeName = noColorName
        ZL.tradeGroupGongZi = gongziList
        ZL.tradeGroup = subgroup
        C_Timer.After(0.5, function ()
            AcceptTrade()
        end)
        ZL.tradeGroupMsg = {}
        msgStr =  "【" .. subgroup .. "队】工资合计：" .. groupTotal .. "，负责发工资人：{rt4}" .. noColorName .. "{rt4}，清单如下："
        tinsert(ZL.tradeGroupMsg, msgStr)
        for name, gongzi in pairs(gongziList) do
            msgStr = ParseClassColorName(name) .. "：" .. gongzi
            tinsert(ZL.tradeGroupMsg, msgStr)
        end
    end)
    ShowAuctionRecordFrame.TradeGroupWagesBtn:SetScript("OnEnter", function (self)
        local noColorName
        if PlayerIsML() then
            noColorName = GetUnitName("npc")
        else
            noColorName = UnitName("player")
        end
        local tradePartner = GetClassColorName(noColorName)
        local playerBuyList = ZL.GetPlayerBuyList()
        local _, _, _, RL = ZL.GetWagesGroupMembers()
        GetAveWages()
        GameTooltipShow(self, "LEFT", "RIGHT")
        if (not ZL_CURRENT["aveWages"]) then
            GameTooltip:AddLine("无法计算工资！")
        else
            if not IsInRaid(1) then
                GameTooltip:AddLine("不在团队中，无法小队交易工资！")
            else
                local subgroup, members = GetPlayerSubgroupAndMembers(noColorName)
                if not subgroup then
                    GameTooltip:AddLine("【" .. tradePartner .. "】不在团队中，无法小队交易工资！")
                else
                    if PlayerIsML() then
                        GameTooltip:AddLine("【|cffffffff" .. subgroup .. "队|r】工资")
                    else
                        GameTooltip:AddLine("【|cffffffff本队|r】工资(|cffffffff" .. subgroup .. "队|r)")
                    end
                    GameTooltip:AddDoubleLine("玩家名", "工资合计")
                    local groupTotal = 0
                    for _, name in ipairs(members) do
                        local balanceAmount
                        local playerPayToMLamount = 0
                        local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
                        local buTie = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].buTie) and ZL_CURRENT.WagesBiLi[name].buTie or 0
                        if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
                            playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
                        end
                        local amount = playerPayToMLamount - (playerBuyList[name] and playerBuyList[name].totalAmount or 0)  --欠款
                        amount = amount > 0 and 0 or amount
                        if PlayerIsML(name) then amount = 0 end
                        if RL and RL == name then
                            if ZL.opt.RLBuTieType == 3 then
                                balanceAmount = ZL_CURRENT["aveWages"] * biLi * 2
                            else
                                balanceAmount = ZL_CURRENT["aveWages"] * biLi
                            end
                        else
                            balanceAmount = ZL_CURRENT["aveWages"] * biLi
                        end
                        balanceAmount = math.floor(balanceAmount)
                        local total = balanceAmount+amount+buTie
                        groupTotal = groupTotal + total
                        if total <= 0 then
                            total = "|cffff0000" .. tostring(total) .. "|r"
                        end
                        if ZL_CURRENT["mailPlayers"] and ZL_CURRENT["mailPlayers"][name] ~= nil then
                            total = total .. "(邮寄)"
                        end
                        if PlayerIsML() then
                            GameTooltip:AddDoubleLine(name, total, 1, 1, 1, 1, 1, 1)
                        else
                            if ZL_PLAYERLIST.otherTradeGongZi and ZL_PLAYERLIST.otherTradeGongZi[name] then
                                GameTooltip:AddDoubleLine(name .. "|cffff0000(已交易)|r", total, 1, 1, 1, 1, 1, 1)
                            else
                                GameTooltip:AddDoubleLine(name, total, 1, 1, 1, 1, 1, 1)
                            end
                        end
                    end
                    GameTooltip:AddDoubleLine("小队总计", groupTotal)
                    if ZL_CURRENT.tradeGroupGongZi and ZL_CURRENT.tradeGroupGongZi[tostring(subgroup)] and PlayerIsML() then
                        GameTooltip:AddLine("已交易过小队工资！", 1, 0, 0)
                    end
                end
            end
            
        end
        GameTooltip:Show()
    end)
    ShowAuctionRecordFrame.TradeGroupWagesBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    ShowAuctionRecordFrame.TradePlayerWagesBtn = CreateButton(nil, ShowAuctionRecordFrame, "单个", "RIGHT", ShowAuctionRecordFrame.TradeGroupWagesBtn, "LEFT", -5, 0, 50)
    ShowAuctionRecordFrame.TradePlayerWagesBtn:SetScript("OnClick", function (self)
        ZL.ShowAuctionRecordFrame.PlayerTradeMoneyText:Show()
        local wagesGroupMembersIndex = (ZL_CURRENT["globalConfig"] and ZL_CURRENT["globalConfig"]["wagesGroupMembers"]) and ZL_CURRENT["globalConfig"]["wagesGroupMembers"] or 0
        if wagesGroupMembersIndex == 0 and ZL.AuctionRecordFrame.playerBalanceFrame.wagesNumber:GetNumber() <= 0 then
            ZL.AuctionRecordFrame:Show()
            _G["ZLAuctionRecordFrameTab3"]:Click()
            local msgStr = "你选择的是：|cffff0000当前团队名单|r，请输入具体的工资人数后再邮寄工资！"
            ZL.Print(msgStr, true)
            return
        end
        local noColorName = GetUnitName("npc")
        local name = GetClassColorName(noColorName)
        local playerBuyList = ZL.GetPlayerBuyList()
        local _, _, _, RL = ZL.GetWagesGroupMembers()
        -- local numGroupMembers, RLBuTie, totalincome, totalpayout, totalamount, averageamount = GetAveWages()
        local msgStr
        if (not ZL_CURRENT["aveWages"]) then
            msgStr = "无法计算工资！"
            ZL.Print(msgStr)
            return
        end
        if PlayerIsML() then
            if ZL_CURRENT.tradeGongZi and ZL_CURRENT.tradeGongZi[name] then
                msgStr = name .. "|cffff0000已交易过工资！|r"
                ZL.Print(msgStr)
                return
            end
        else
            if not ZL_PLAYERLIST.groupGongZi then
                msgStr = "未指定你交易本小队工资！"
                ZL.Print(msgStr)
                return
            elseif ZL_PLAYERLIST.otherTradeGongZi and ZL_PLAYERLIST.otherTradeGongZi[name] then
                msgStr = name .. "|cffff0000已交易过工资！|r"
                ZL.Print(msgStr)
                return
            else
                local subgroup = GetPlayerSubgroupAndMembers(noColorName)
                local _subgroup = GetPlayerSubgroupAndMembers(UnitName("player"))
                if subgroup ~= _subgroup then
                    msgStr = name .. "|cffff0000不是本队成员，无法交易工资！|r"
                    ZL.Print(msgStr)
                    return
                end
            end
        end
        if ZL_CURRENT["mailPlayers"] and ZL_CURRENT["mailPlayers"][name] == true then
            msgStr = "|cffff0000工资已经邮寄！|r"
            ZL.Print(msgStr)
            return
        end

        local balanceAmount
        local playerPayToMLamount = 0
        local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
        local buTie = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].buTie) and ZL_CURRENT.WagesBiLi[name].buTie or 0
        if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
            playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
        end
        local amount = playerPayToMLamount - (playerBuyList[name] and playerBuyList[name].totalAmount or 0)  --欠款
        amount = amount > 0 and 0 or amount
        if PlayerIsML(name) then amount = 0 end
        if RL and RL == name then
            if ZL.opt.RLBuTieType == 3 then
                balanceAmount = ZL_CURRENT["aveWages"] * biLi * 2
            else
                balanceAmount = ZL_CURRENT["aveWages"] * biLi
            end
        else
            balanceAmount = ZL_CURRENT["aveWages"] * biLi
        end
        balanceAmount = math.floor(balanceAmount)
        local total = balanceAmount+amount+buTie
        if total <= 0 then
            msgStr = "【" .. name .. "】合计工资为：" .. total .. "，无法交易工资！"
            ZL.Print(msgStr)
            return
        end
        if GetMoney() < total*10000 then
            msgStr = "|cffff0000金币不足，无法交易工资！|r"
            ZL.Print(msgStr)
            return
        end

        -- MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, total * 10000)
        ChatEdit_ActivateChat(ChatEdit_ChooseBoxForSend())
        ChatEdit_InsertLink(total)
        ChatEdit_ChooseBoxForSend():HighlightText()
        ZL.Print("自动输入金额已被禁用，请复制然后直接粘贴")
        -- if GetPlayerTradeMoney() > 0 then
        --     ClearCursor()
        --     PickupTradeMoney(GetPlayerTradeMoney())
        --     ClearCursor()
        -- end
        -- ClearCursor()
        -- PickupPlayerMoney(total*10000)
        -- _G["TradePlayerItem1ItemButton"]:Click()
        ZL.ShowAuctionRecordFrame.PlayerTradeMoneyText:Show()
        ZL.tradeGroupGongZi = nil
        ZL.tradeGroup = nil
        if PlayerIsML() then
            ZL.tradeGongZi = total
            ZL.otherTradeGongZi = nil
        else
            ZL.tradeGongZi = nil
            ZL.otherTradeGongZi = total
        end
        ZL.tradeName = name
        C_Timer.After(0.5, function ()
            AcceptTrade()
        end)
        msgStr = "工资：" .. balanceAmount
        if amount < 0 then
            msgStr = msgStr .. "，欠款：" .. amount
        end
        if buTie > 0 then
            msgStr = msgStr .. "，补贴：" .. buTie
        end
        if amount < 0 or buTie > 0 then
            msgStr = msgStr .. "，合计：" .. total
        end
        msgStr = msgStr .. "，请及时确认交易！"
        SendChatMessage(msgStr, "WHISPER", nil, noColorName)
    end)
    ShowAuctionRecordFrame.TradePlayerWagesBtn:SetScript("OnEnter", function (self)
        local noColorName = GetUnitName("npc")
        local name = GetClassColorName(noColorName)
        local playerBuyList = ZL.GetPlayerBuyList()
        local WagesGroupMembers, _, _, RL = ZL.GetWagesGroupMembers()
        local numGroupMembers, RLBuTie, totalincome, totalpayout, totalamount, averageamount = GetAveWages()
        GameTooltipShow(self, "BOTTOM", "TOP")
        if (not ZL_CURRENT["aveWages"]) then
            GameTooltip:AddLine("无法计算工资！")
        else
            GameTooltip:AddLine("【" .. name .. "】工资")
            local balanceAmount
            local playerPayToMLamount = 0
            local biLi = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].biLi) and (ZL_CURRENT.WagesBiLi[name].biLi/100) or 1
            local buTie = (ZL_CURRENT.WagesBiLi and ZL_CURRENT.WagesBiLi[name] and ZL_CURRENT.WagesBiLi[name].buTie) and ZL_CURRENT.WagesBiLi[name].buTie or 0
            if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
                playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
            end
            local amount = playerPayToMLamount - (playerBuyList[name] and playerBuyList[name].totalAmount or 0)  --欠款
            amount = amount > 0 and 0 or amount
            if PlayerIsML(name) then amount = 0 end
            if RL and RL == name then
                if ZL.opt.RLBuTieType == 3 then
                    balanceAmount = ZL_CURRENT["aveWages"] * biLi * 2
                else
                    balanceAmount = ZL_CURRENT["aveWages"] * biLi
                end
            else
                balanceAmount = ZL_CURRENT["aveWages"] * biLi
            end
            balanceAmount = math.floor(balanceAmount)
            local total = balanceAmount+amount+buTie
            if total <= 0 then
                total = "|cffff0000" .. tostring(total) .. "|r"
            end
            GameTooltip:AddDoubleLine("工资：", balanceAmount, 1, 1, 1, 1, 1, 1)
            GameTooltip:AddDoubleLine("欠款：", amount, 1, 1, 1, 1, 1, 1)
            GameTooltip:AddDoubleLine("补贴：", buTie, 1, 1, 1, 1, 1, 1)
            GameTooltip:AddDoubleLine("合计：", total)
            if PlayerIsML() then
                if ZL_CURRENT.tradeGongZi and ZL_CURRENT.tradeGongZi[name] then
                    GameTooltip:AddLine("|cffff0000已交易过工资！|r")
                elseif ZL_CURRENT["mailPlayers"] and ZL_CURRENT["mailPlayers"][name] == true then
                    GameTooltip:AddLine("|cffff0000工资已经邮寄！|r")
                end
            else
                if ZL_PLAYERLIST.otherTradeGongZi and ZL_PLAYERLIST.otherTradeGongZi[name] then
                    GameTooltip:AddLine("|cffff0000已交易过工资！|r")
                else
                    local subgroup = GetPlayerSubgroupAndMembers(noColorName)
                    local _subgroup = GetPlayerSubgroupAndMembers(UnitName("player"))
                    if subgroup ~= _subgroup then
                        GameTooltip:AddLine("|cffff0000警告！不是小队成员！|r")
                    end
                end
            end
        end
        GameTooltip:Show()
    end)
    ShowAuctionRecordFrame.TradePlayerWagesBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)
    ShowAuctionRecordFrame.PlayerTradeMoneyText = ShowAuctionRecordFrame:CreateFontString()
    local PlayerTradeMoneyText = ShowAuctionRecordFrame.PlayerTradeMoneyText
    PlayerTradeMoneyText:SetFont(GameFontNormal:GetFont(), 13)
    PlayerTradeMoneyText:SetPoint("BOTTOMRIGHT", _G["TradePlayerInputMoneyInsetBg"], "TOPRIGHT")
    PlayerTradeMoneyText:SetSize(170, 20)
    PlayerTradeMoneyText:SetJustifyH("RIGHT")
    PlayerTradeMoneyText:Hide()
    ShowAuctionRecordFrame:Hide()
end

--创建提示保存数据框架
function ZL:CreateReloadUIFrame()
    ZL.ReloadUIFrame = CreateFrame("Frame", nil, self, "BackdropTemplate")
    local ReloadUIFrame = ZL.ReloadUIFrame
    ReloadUIFrame:SetSize(50, 50)
    ReloadUIFrame:SetPoint("TOP", UIParent, "TOP", 0, -80)
    ReloadUIFrame:SetClampedToScreen(true)
    ReloadUIFrame:SetFrameStrata("HIGH")

    ReloadUIFrame.remindText = ReloadUIFrame:CreateFontString()
    local remindText = ReloadUIFrame.remindText
    remindText:SetFontObject(GameFontHighlightLarge)
    remindText:SetHeight(75)
    remindText:SetPoint("CENTER", ReloadUIFrame, "CENTER")
    remindText:SetFont(GameFontNormal:GetFont(), 20)
    remindText:SetWordWrap(false)
    remindText:SetJustifyH("CENTER")
    remindText:SetText("|T137006:20|t|cfffffff0提醒：请及时加载用户界面(|r|cffffd100/rl|r|cfffffff0)保存数据哦|r|T137006:20|t")

    -- local texture1 = ReloadUIFrame:CreateTexture(nil, "BACKGROUND")
    -- texture1:SetPoint("RIGHT", remindText, "LEFT")
    -- texture1:SetSize(20, 20)
    -- texture1:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcon_6")
    
    -- local texture2 = ReloadUIFrame:CreateTexture(nil, "BACKGROUND")
    -- texture2:SetPoint("LEFT", remindText, "RIGHT")
    -- texture2:SetSize(20, 20)
    -- texture2:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcon_6")
    -- ZL.ReloadUIFrame:Hide()
end

--创建滚动消息框架
function ZL:CreateScrollingMessageFrame()
    ZL.ScrollingMessageFrame = CreateFrame("ScrollingMessageFrame", "MyScrollingMessageFrame", UIParent)
    local ScrollingMessageFrame = ZL.ScrollingMessageFrame
    ScrollingMessageFrame:SetSize(1000, 150)
    ScrollingMessageFrame:SetPoint("TOP", UIParent, "TOP", 0, 0)
    ScrollingMessageFrame:SetFrameStrata("FULLSCREEN_DIALOG")
    ScrollingMessageFrame:SetClampedToScreen(true)  --不能超出游戏屏幕，false可以超出游戏屏幕
    ScrollingMessageFrame:SetFont(GameFontNormal:GetFont(), 20, "OUTLINE")
    ScrollingMessageFrame:SetJustifyH("CENTER")
    ScrollingMessageFrame:SetJustifyV("TOP")
    ScrollingMessageFrame:SetMaxLines(5)
    ScrollingMessageFrame:SetSpacing(3)
    ScrollingMessageFrame:SetFadeDuration(2)
    ScrollingMessageFrame:SetTimeVisible(6)
    ScrollingMessageFrame:SetHyperlinksEnabled(true)
    ScrollingMessageFrame:SetScript("OnHyperlinkEnter", function(self, link)
        local itemID = GetItemInfoInstant(link)
        if itemID then
            GameTooltip:SetOwner(self, "ANCHOR_CURSOR", 0, 0)
            GameTooltip:ClearLines()
            GameTooltip:SetHyperlink(link)
            GameTooltip:Show()
        end
    end)
    ScrollingMessageFrame:SetScript("OnHyperlinkLeave", function(self)
        GameTooltip:Hide()
    end)
    ScrollingMessageFrame:SetScript("OnHyperlinkClick", function (self, link, _, button)
        local linkType, missionID, txt, arg4 = strsplit(":", link)
        if linkType == "garrmission" then
            if missionID == "AutoAuction" then
                if txt == "通报详细收支" then
                    ZL.reportIncomeConfirm()
                elseif txt == "保存团员名单" then
                    ZL.saveGroupMembers()
                elseif txt == "设置多拍" then
                    ZL.opt.allowMultipleAuctions = true
                    ZL.TransmitAddonInfo_Pro()
                    C_Timer.NewTicker(0.2, function (self)
                        if ZL_CURRENT.globalConfig.allowMultipleAuctions then
                            self:Cancel()
                            local _link = format("|cff87CEEB|Hgarrmission:%s:%s|h[%s]|h|r", "AutoAuction", "设置单拍", "改为单拍")
                            local msg = "已切换为|cffffffff多拍模式|r "
                            ZL.Print(msg .. _link, true)
                            ZL.SpeakText(msg)
                        end
                    end)
                elseif txt == "设置单拍" then
                    ZL.opt.allowMultipleAuctions = false
                    ZL.TransmitAddonInfo_Pro()
                    C_Timer.NewTicker(0.2, function (self)
                        if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                            self:Cancel()
                            local _link = format("|cff87CEEB|Hgarrmission:%s:%s|h[%s]|h|r", "AutoAuction", "设置多拍", "设置多拍")
                            local msg = "已切换为|cffffffff单拍模式|r "
                            ZL.Print(msg .. _link, true)
                            ZL.SpeakText(msg)
                        end
                    end)
                elseif txt == "历史记录" then
                    ZL.AuctionRecordFrame:Show()
                    _G["ZLAuctionRecordFrameTab1"]:Click()
                end
            end
        end
    end)
end

--创建监控拍卖WA发送状态窗口
function ZL:CreateWaLoadStateFrame()
    ZL.WaLoadStateFrame = ZLCreateFrame("ZLWaLoadStateFrame", nil, nil, nil, nil, true, true, "拍卖WA发送状态")
    local WaLoadStateFrame = ZL.WaLoadStateFrame
    WaLoadStateFrame:SetPoint("CENTER")
    WaLoadStateFrame:SetResizable(true)
    WaLoadStateFrame:SetSize(420, 220)
    WaLoadStateFrame:SetResizeBounds(420, 220, 420, GetScreenHeight()-110) -- 设置最小尺寸，以避免框架被缩小到看不见
    -- tinsert(UISpecialFrames, WaLoadStateFrame:GetName())
    WaLoadStateFrame.closeButton:SetScript("OnClick", function (self)
        WaLoadStateFrame:Hide()
    end)
    WaLoadStateFrame:SetScript("OnMouseUp", function (self)
        self:StopMovingOrSizing()
        if not ZL.db.global.ZLWaLoadStateFrame then ZL.db.global.ZLWaLoadStateFrame = {} end
        ZL.db.global.ZLWaLoadStateFrame.point, _, ZL.db.global.ZLWaLoadStateFrame.relative, ZL.db.global.ZLWaLoadStateFrame.x, ZL.db.global.ZLWaLoadStateFrame.y = self:GetPoint()
    end)
    WaLoadStateFrame:SetScript("OnMouseDown", function (self)
        self:StartMoving()
    end)
    local resizeButton = WaLoadStateFrame.resizeButton
    -- 设置鼠标按下时开始调整大小
    resizeButton:SetScript("OnMouseDown", function(self, button)
        if button == "LeftButton" then
            WaLoadStateFrame:StartSizing("BOTTOMRIGHT")
        end
    end)
    -- 鼠标松开时停止调整大小
    resizeButton:SetScript("OnMouseUp", function(self, button)
        WaLoadStateFrame:StopMovingOrSizing()
        if not ZL.db.global.ZLWaLoadStateFrame then ZL.db.global.ZLWaLoadStateFrame = {} end
        ZL.db.global.ZLWaLoadStateFrame.Width,  ZL.db.global.ZLWaLoadStateFrame.Height= WaLoadStateFrame:GetSize()
    end)
    WaLoadStateFrame:ClearAllPoints()
    if ZL.db.global.ZLWaLoadStateFrame and ZL.db.global.ZLWaLoadStateFrame.point then
        WaLoadStateFrame:SetPoint(ZL.db.global.ZLWaLoadStateFrame.point, UIParent, ZL.db.global.ZLWaLoadStateFrame.relative, ZL.db.global.ZLWaLoadStateFrame.x, ZL.db.global.ZLWaLoadStateFrame.y)
    else
        WaLoadStateFrame:SetPoint("CENTER")
    end
    if ZL.db.global.ZLWaLoadStateFrame and ZL.db.global.ZLWaLoadStateFrame.Height then
        WaLoadStateFrame:SetSize(420, ZL.db.global.ZLWaLoadStateFrame.Height)
    end
    --创建滚动条
    WaLoadStateFrame.scrollFrame = CreateFrame("ScrollFrame", nil, WaLoadStateFrame, "UIPanelScrollFrameTemplate")
    WaLoadStateFrame.scrollFrame:SetFrameLevel(WaLoadStateFrame:GetFrameLevel() + 1) -- 设置为比父框架高1级
    WaLoadStateFrame.scrollFrame:SetPoint("TOPLEFT", WaLoadStateFrame.TitleBottom, "BOTTOMLEFT", 0, -2)
    WaLoadStateFrame.scrollFrame:SetPoint("BOTTOMRIGHT", WaLoadStateFrame, "BOTTOMRIGHT", 0, 2)
    WaLoadStateFrame.scrollFrame:SetClipsChildren(true) --必须设置为true，scrollFrame所有的子元素才会被剪切
    WaLoadStateFrame.scrollFrame:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel) --重设滑动条鼠标滚轮事件
    --重设ScrollBar位置，放置到scrollFrame内，防止被剪切掉
    WaLoadStateFrame.scrollFrame.ScrollBar:ClearAllPoints()
    WaLoadStateFrame.scrollFrame.ScrollBar:SetPoint("TOPLEFT", WaLoadStateFrame.scrollFrame, "TOPRIGHT", -10, -16)
    WaLoadStateFrame.scrollFrame.ScrollBar:SetPoint("BOTTOMRIGHT", WaLoadStateFrame.scrollFrame, "BOTTOMRIGHT", -10, 15)
    WaLoadStateFrame.scrollFrame.content = CreateFrame("Frame", nil, WaLoadStateFrame.scrollFrame)
    local content = WaLoadStateFrame.scrollFrame.content
    content:SetPoint("TOPLEFT", WaLoadStateFrame.scrollFrame, "TOPLEFT", 0, 0)
    content:SetSize(WaLoadStateFrame.scrollFrame:GetWidth()-20, 100)
    WaLoadStateFrame.scrollFrame:SetScrollChild(content)
    WaLoadStateFrame.entries = setmetatable({}, {
        __index = function (t, v)
            local f = CreateFrame("Frame", nil, content)
            if v > 1 then
                f:SetPoint("TOPLEFT", t[v - 1], "BOTTOMLEFT", 0, -1)
                f:SetPoint("BOTTOMRIGHT", t[v - 1], "BOTTOMRIGHT", 0, -20)
            else
                f:SetPoint("TOPLEFT", content, "TOPLEFT", 3, -1)
                f:SetPoint("BOTTOMRIGHT", content, "TOPRIGHT", -1, -20)
            end
            f.btn = CreateButton(nil, f, "-", "RIGHT", f, "RIGHT", 0, 0, f:GetHeight(), f:GetHeight())
            local btn = f.btn
            btn:SetScript("OnEnter", function (self)
                GameTooltipShow(self, "Left", "Right", 20, 0)
                GameTooltip:AddLine("重置")
                GameTooltip:AddLine("重置后可以申请重新传输", 1, 1, 1)
                GameTooltip:Show()
            end)
            btn:SetScript("OnLeave", function ()
                GameTooltip:Hide()
            end)
            btn:SetScript("OnClick", function ()
                local target = f.sb.playerName:GetText()
                if target and target ~= "" and ZL.WaLoadInfo and ZL.WaLoadInfo[target] then
                    ZL.WaLoadInfo[target] = nil
                    ZL.sendStringFromWA({target}, "[AutoAuction]金团拍卖助手", true, "WHISPER")
                    SendChatMessage("已重置传输次数，点击字符串可重新传输", "WHISPER", nil, target)
                end
                f:SetValues(0, 0, 0, 0, 0, "", "")
            end)
            f.sb = CreateFrame("StatusBar", nil, f)
            local sb = f.sb
            sb:SetPoint("TOPLEFT")
            sb:SetPoint("BOTTOMRIGHT", btn, "BOTTOMLEFT", -5, 0)
            do
                local texture = sb:CreateTexture(nil,"BACKGROUND")
                texture:SetColorTexture(1, 1, 1, 1)
                texture:SetPoint("TOPLEFT")
                texture:SetPoint("BOTTOMRIGHT")
                sb:SetStatusBarTexture(texture)
            end
            ZL.CreateBorder(sb, 1, 1, 1, 0.5, "OVERLAY", 1)
            sb.playerName = sb:CreateFontString(nil, "OVERLAY")
            local playerName = sb.playerName
            playerName:SetPoint("LEFT", sb, "LEFT", 2, 0)
            playerName:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            playerName:SetWordWrap(false)
            playerName:SetJustifyH("RIGHT")
            playerName:SetTextColor(0.95, 0.95, 0.95, 1)

            sb.loadState = sb:CreateFontString(nil, "OVERLAY")
            local loadState = sb.loadState
            loadState:SetPoint("RIGHT", sb, "RIGHT", -2, 0)
            loadState:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            loadState:SetWordWrap(false)
            loadState:SetJustifyH("RIGHT")
            loadState:SetTextColor(0.95, 0.95, 0.95, 1)

            function f:SetValues(maxValue, value, r, g, b, _playerName, _loadState)
                sb:SetMinMaxValues(0, maxValue)
                sb:SetValue(value)
                sb:SetStatusBarColor(r, g, b)
                playerName:SetText(_playerName)
                loadState:SetText(_loadState)
            end

            t[v] = f
            return f
        end
    })
    -- C_Timer.After(1, function ()
    --     WaLoadStateFrame:Show()
    -- end)
end

--创建竞拍成功历史物品日均价趋势图
function ZL:CreateItemDateBar()
    ZL.ItemDateBar = CreateFrame("Frame", "ZLItemDateBar", ZL)
    local itemDateBar = ZL.ItemDateBar
    itemDateBar:SetSize(300, 50)
    itemDateBar:SetPoint("CENTER")
    itemDateBar:SetFrameStrata("TOOLTIP")
    itemDateBar:SetFrameLevel(GameTooltip:GetFrameLevel() + 1)
    itemDateBar:SetClampedToScreen(false)
    ZL.CreateBorder(itemDateBar, 0.2, 0.6, 1, 0.5, "OVERLAY", 1)
    itemDateBar.Background = itemDateBar:CreateTexture(nil,"BACKGROUND")
    itemDateBar.Background:SetColorTexture(0, 0, 0, .7)
    itemDateBar.Background:SetAllPoints()
    itemDateBar.Title = itemDateBar:CreateFontString(nil, "OVERLAY")
    itemDateBar.Title:SetFont(GameFontNormal:GetFont(), 13, "")
    itemDateBar.Title:SetTextColor(0.2, 0.6, 1)
    itemDateBar.Title:SetWordWrap(false)
    itemDateBar.Title:SetJustifyH("CENTER")
    itemDateBar.Title:SetPoint("TOP", itemDateBar, "TOP", 0, -5)
    itemDateBar.Title:SetText("日均价趋势图")
    itemDateBar:Hide()

    itemDateBar.entries = setmetatable({}, {
        __index = function (t, v)
            local frame = CreateFrame("Button", nil, itemDateBar)
            frame:SetSize(1, 1)
            frame:SetPoint("CENTER", itemDateBar, "CENTER")
            frame.line = frame:CreateLine(nil, "OVERLAY", nil, -1)
            frame.line:SetThickness(2)
            frame.line:SetColorTexture(0, 1, 0, 1) -- 绿色折线

            frame.point = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
            frame.point:SetText("●") -- 使用圆形字符
            frame.point:SetFont(GameFontNormal:GetFont(), 8, "")
            frame.point:SetTextColor(1, 0, 0, 1) -- 设置颜色（红色）
            frame.point:SetPoint("CENTER")

            frame.line:SetStartPoint("CENTER", frame.point)
            frame.line:SetEndPoint("CENTER", frame.point, 10, 0)

            frame.label = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
            frame.label:SetPoint("BOTTOM", frame.point, "TOP", 0, 5)
            frame.label:SetText("")

            function frame:SetValues(x, y, previousPoint)
                frame.point:ClearAllPoints()
                frame.point:SetPoint("CENTER", itemDateBar, "BOTTOMLEFT", x, y)
                if previousPoint then
                    frame.line:SetStartPoint("CENTER", previousPoint)
                    frame.line:SetEndPoint("CENTER", frame.point)
                    frame.line:Show()
                else
                    frame.line:Hide()
                end
            end

            t[v] = frame
            return frame
        end
    })
end

--创建竞拍成功历史物品星期均价趋势图
function ZL:CreateItemWeekDayBar()
    ZL.ItemWeekDayBar = CreateFrame("Frame", "ZLItemWeekDayBa", ZL)
    local itemWeekDayBar = ZL.ItemWeekDayBar
    itemWeekDayBar:SetSize(300, 50)
    itemWeekDayBar:SetFrameStrata("TOOLTIP")
    itemWeekDayBar:SetPoint("TOP", ZL.itemDateBar, "BOTTOM")
    itemWeekDayBar:SetFrameLevel(GameTooltip:GetFrameLevel() + 1)
    itemWeekDayBar:SetClampedToScreen(false)
    ZL.CreateBorder(itemWeekDayBar, 0.2, 0.6, 1, 0.5, "OVERLAY", 1)
    itemWeekDayBar.Background = itemWeekDayBar:CreateTexture(nil,"BACKGROUND")
    itemWeekDayBar.Background:SetColorTexture(0, 0, 0, .7)
    itemWeekDayBar.Background:SetAllPoints()
    itemWeekDayBar.Title = itemWeekDayBar:CreateFontString(nil, "OVERLAY")
    itemWeekDayBar.Title:SetFont(GameFontNormal:GetFont(), 13, "")
    itemWeekDayBar.Title:SetTextColor(0.2, 0.6, 1)
    itemWeekDayBar.Title:SetWordWrap(false)
    itemWeekDayBar.Title:SetJustifyH("CENTER")
    itemWeekDayBar.Title:SetPoint("TOP", itemWeekDayBar, "TOP", 0, -5)
    itemWeekDayBar.Title:SetText("星期均价趋势图")
    itemWeekDayBar:Hide()
    local weekList = {
		"周一", "周二", "周三", "周四", "周五", "周六", "周日",
	}

    itemWeekDayBar.entries = setmetatable({}, {
        __index = function (t, v)
            local bar = CreateFrame("Frame", nil, itemWeekDayBar)
            bar:SetSize(5, 5)
            bar:SetPoint("BOTTOMLEFT", itemWeekDayBar, "BOTTOMLEFT", 5, 0)
            bar.texture = bar:CreateTexture()
            bar.texture:SetAllPoints()
            -- 添加柱子数值标签
            bar.label = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
            bar.label:SetPoint("TOP", bar, "BOTTOM", 0, -5)
            bar.label:SetText(weekList[v]:gsub("周", ""))
            bar.label:SetFont(GameFontNormal:GetFont(), 13, "")
            if v % 2 == 0 then
                bar.texture:SetColorTexture(0.2, 0.6, 1, 0.8) -- 蓝色柱子
                bar.label:SetTextColor(0.2, 0.6, 1, 0.8)
            else
                bar.texture:SetColorTexture(1, 1, 1, 1)
                bar.label:SetTextColor(1, 1, 1, 1)
            end
            t[v] = bar
            return bar
        end
    })
end

--创建总览界面
function ZL:CreateOverviewFrame()
    ZL.OverviewFrame = ZLCreateFrame("ZLOverviewFrame", ZL, nil, nil, "DIALOG", false, true, "账单总览")
    local OverviewFrame = ZL.OverviewFrame
    OverviewFrame.Background:SetColorTexture(0, 0, 0, 0.95)
    OverviewFrame:SetPoint("CENTER")
    OverviewFrame:SetResizable(false)
    local maxlevel = max(ZL.maxFrame:GetFrameLevel(), ZL.AuctionFrame2:GetFrameLevel())
    OverviewFrame:SetFrameLevel(maxlevel + 10)
    OverviewFrame.resizeButton:Hide()
    OverviewFrame:SetSize(GetScreenWidth()-65, GetScreenHeight()-50)
    OverviewFrame:Hide()

    -- 注册 ESC 键关闭窗口
    tinsert(UISpecialFrames, OverviewFrame:GetName())

    local UIScale = UIParent:GetScale()
    local height = 20
    local gapwidth = 20/UIScale
    local gapheight = 0
    local itemNamewidth = 160/UIScale
    local playerNamewidth = 100/UIScale
    local amountwidth = 70/UIScale
    local BOSSwidth =(GetScreenWidth()-40-23-2*gapwidth-3*(itemNamewidth+playerNamewidth+amountwidth-3))/3
    local board_r, board_g, board_b, board_a = 0.24, 0.25, 0.3, 1--0.24, 0.25, 0.3
    OverviewFrame.BOSSHeaderBtn1 = CreateHeaderButton(OverviewFrame, BOSSwidth, 21)
    local BOSSHeaderBtn1 = OverviewFrame.BOSSHeaderBtn1
    BOSSHeaderBtn1:SetPoint("TOPLEFT", OverviewFrame.TitleBottom, "BOTTOMLEFT", 3, -5)
    BOSSHeaderBtn1:SetText("|cff00aaff项目|r")

    OverviewFrame.itemNameHeaderBtn1 = CreateHeaderButton(OverviewFrame, itemNamewidth, 21)
    local itemNameHeaderBtn1 = OverviewFrame.itemNameHeaderBtn1
    itemNameHeaderBtn1:SetPoint("TOPLEFT", BOSSHeaderBtn1, "TOPRIGHT", -1, 0)
    itemNameHeaderBtn1:SetText("|cff00d100物品名称×数量|r")

    OverviewFrame.playerNameHeaderBtn1 = CreateHeaderButton(OverviewFrame, playerNamewidth, 21)
    local playerNameHeaderBtn1 = OverviewFrame.playerNameHeaderBtn1
    playerNameHeaderBtn1:SetPoint("TOPLEFT", itemNameHeaderBtn1, "TOPRIGHT", -1, 0)
    playerNameHeaderBtn1:SetText("|cff00d100买家名字|r")

    OverviewFrame.amountHeaderBtn1 = CreateHeaderButton(OverviewFrame, amountwidth, 21)
    local amountHeaderBtn1 = OverviewFrame.amountHeaderBtn1
    amountHeaderBtn1:SetPoint("TOPLEFT", playerNameHeaderBtn1, "TOPRIGHT", -1, 0)
    amountHeaderBtn1:SetText("|cff00d100总金额|r")

    do
        local texture = amountHeaderBtn1:CreateTexture(nil, "BACKGROUND")
        texture:SetColorTexture(1,1,1,0.5)
        texture:SetPoint("TOPLEFT", BOSSHeaderBtn1, "BOTTOMLEFT", 0, 0)
        texture:SetPoint("BOTTOMRIGHT", amountHeaderBtn1, "BOTTOMRIGHT", 0, -1)
    end

    OverviewFrame.BOSSHeaderBtn2 = CreateHeaderButton(OverviewFrame, BOSSwidth, 21)
    local BOSSHeaderBtn2 = OverviewFrame.BOSSHeaderBtn2
    BOSSHeaderBtn2:SetPoint("TOPLEFT", amountHeaderBtn1, "TOPRIGHT", gapwidth, 0)
    BOSSHeaderBtn2:SetText("|cff00aaff项目|r")

    OverviewFrame.itemNameHeaderBtn2 = CreateHeaderButton(OverviewFrame, itemNamewidth, 21)
    local itemNameHeaderBtn2 = OverviewFrame.itemNameHeaderBtn2
    itemNameHeaderBtn2:SetPoint("TOPLEFT", BOSSHeaderBtn2, "TOPRIGHT", -1, 0)
    itemNameHeaderBtn2:SetText("|cff00d100物品名称×数量|r")

    OverviewFrame.playerNameHeaderBtn2 = CreateHeaderButton(OverviewFrame, playerNamewidth, 21)
    local playerNameHeaderBtn2 = OverviewFrame.playerNameHeaderBtn2
    playerNameHeaderBtn2:SetPoint("TOPLEFT", itemNameHeaderBtn2, "TOPRIGHT", -1, 0)
    playerNameHeaderBtn2:SetText("|cff00d100买家名字|r")

    OverviewFrame.amountHeaderBtn2 = CreateHeaderButton(OverviewFrame, amountwidth, 21)
    local amountHeaderBtn2 = OverviewFrame.amountHeaderBtn2
    amountHeaderBtn2:SetPoint("TOPLEFT", playerNameHeaderBtn2, "TOPRIGHT", -1, 0)
    amountHeaderBtn2:SetText("|cff00d100总金额|r")

    do
        local texture = amountHeaderBtn2:CreateTexture(nil, "BACKGROUND")
        texture:SetColorTexture(1,1,1,0.5)
        texture:SetPoint("TOPLEFT", BOSSHeaderBtn2, "BOTTOMLEFT", 0, 0)
        texture:SetPoint("BOTTOMRIGHT", amountHeaderBtn2, "BOTTOMRIGHT", 0, -1)
    end

    OverviewFrame.BOSSHeaderBtn3 = CreateHeaderButton(OverviewFrame, BOSSwidth, 21)
    local BOSSHeaderBtn3 = OverviewFrame.BOSSHeaderBtn3
    BOSSHeaderBtn3:SetPoint("TOPLEFT", amountHeaderBtn2, "TOPRIGHT", gapwidth, 0)
    BOSSHeaderBtn3:SetText("|cff00aaff项目|r")

    OverviewFrame.itemNameHeaderBtn3 = CreateHeaderButton(OverviewFrame, itemNamewidth, 21)
    local itemNameHeaderBtn3 = OverviewFrame.itemNameHeaderBtn3
    itemNameHeaderBtn3:SetPoint("TOPLEFT", BOSSHeaderBtn3, "TOPRIGHT", -1, 0)
    itemNameHeaderBtn3:SetText("|cff00d100物品名称×数量|r")

    OverviewFrame.playerNameHeaderBtn3 = CreateHeaderButton(OverviewFrame, playerNamewidth, 21)
    local playerNameHeaderBtn3 = OverviewFrame.playerNameHeaderBtn3
    playerNameHeaderBtn3:SetPoint("TOPLEFT", itemNameHeaderBtn3, "TOPRIGHT", -1, 0)
    playerNameHeaderBtn3:SetText("|cff00d100买家名字|r")

    OverviewFrame.amountHeaderBtn3 = CreateHeaderButton(OverviewFrame, amountwidth, 21)
    local amountHeaderBtn3 = OverviewFrame.amountHeaderBtn3
    amountHeaderBtn3:SetPoint("TOPLEFT", playerNameHeaderBtn3, "TOPRIGHT", -1, 0)
    amountHeaderBtn3:SetText("|cff00d100总金额|r")
    do
        local texture = amountHeaderBtn3:CreateTexture(nil, "BACKGROUND")
        texture:SetColorTexture(1,1,1,0.5)
        texture:SetPoint("TOPLEFT", BOSSHeaderBtn3, "BOTTOMLEFT", 0, 0)
        texture:SetPoint("BOTTOMRIGHT", amountHeaderBtn3, "BOTTOMRIGHT", 0, -1)
    end

    --创建滚动条
    OverviewFrame.scrollFrame = CreateFrame("ScrollFrame", nil, OverviewFrame, "UIPanelScrollFrameTemplate")
    OverviewFrame.scrollFrame:SetFrameLevel(OverviewFrame:GetFrameLevel() + 1) -- 设置为比父框架高1级
    OverviewFrame.scrollFrame:SetPoint("TOPLEFT", BOSSHeaderBtn1, "BOTTOMLEFT", 0, 0)
    OverviewFrame.scrollFrame:SetPoint("BOTTOMRIGHT", OverviewFrame, "BOTTOMRIGHT", 0, 3)
    OverviewFrame.scrollFrame:SetClipsChildren(true) --必须设置为true，scrollFrame所有的子元素才会被剪切
    OverviewFrame.scrollFrame:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel) --重设滑动条鼠标滚轮事件
    --重设ScrollBar位置，放置到scrollFrame内，防止被剪切掉
    OverviewFrame.scrollFrame.ScrollBar:ClearAllPoints()
    OverviewFrame.scrollFrame.ScrollBar:SetPoint("TOPLEFT", OverviewFrame.scrollFrame, "TOPRIGHT", -20, -16)
    OverviewFrame.scrollFrame.ScrollBar:SetPoint("BOTTOMRIGHT", OverviewFrame.scrollFrame, "BOTTOMRIGHT", 0, 16)
    OverviewFrame.scrollFrame.content = CreateFrame("Frame", nil, OverviewFrame.scrollFrame)
    local content = OverviewFrame.scrollFrame.content
    content:SetPoint("TOPRIGHT", OverviewFrame.scrollFrame, "TOPRIGHT", 0, 0)
    content:SetSize(OverviewFrame.scrollFrame:GetWidth()-20, 100)
    OverviewFrame.scrollFrame:SetScrollChild(content)

    OverviewFrame.playerModel = CreateFrame("PlayerModel", "ZLPlayerModel", OverviewFrame)
    local playerModel = OverviewFrame.playerModel
    playerModel:SetPoint("CENTER")
    playerModel:SetSize(200, 200)
    -- playerModel:SetUnit("player")
    playerModel:SetCreature(25305)
    playerModel:SetFacing(-0.4)
    playerModel:SetAnimation(69)
    playerModel:SetAlpha(0.4)
    playerModel:SetFrameLevel(content:GetFrameLevel()+5)
    if ZL.opt.overviewFramePlayerModelHide then
        playerModel:Hide()
    else
        playerModel:Show()
    end

    local function OnEnter(self)
        self:GetParent():SetNormalTexture("Interface\\FriendsFrame\\UI-FriendsFrame-HighlightBar")
    end
    local function OnLeave(self)
        self:GetParent():ClearNormalTexture()
    end
    local function GroupMembersActivityMenu(self)
        local menuList = {}
        local WagesGroupMembers, msg = ZL.GetWagesGroupMembers()
        if WagesGroupMembers and msg then
            tinsert(menuList, {text=msg, isTitle = true})
            for i, data in ipairs(WagesGroupMembers) do
                if #data > 0 then
                    local memberList = {}
                    for _, playerName in ipairs(data) do
                        tinsert(memberList, {
                            text=playerName,
                            func = function ()
                                self:SetText(playerName)
                                OverviewFrame.playerNameChange(self)
                            end,
                        })
                    end
                    tinsert(menuList, {
                        text = i .. "队",
                        func = function ()
                            self:ClearFocus()
                        end,
                        hasArrow = true,
                        menuTable = memberList,
                    })
                end
            end
            tinsert(menuList, {isSeparator = true})
            tinsert(menuList, {text = CANCEL, func = function() self:ClearFocus() end})
        end
        return menuList
    end
    OverviewFrame.entries = setmetatable({}, {
        __index = function (t, v)
            local f = CreateFrame("Button", nil, content)
            f:SetSize((BOSSwidth+itemNamewidth+playerNamewidth+amountwidth-3), height)
            
            f.Background = f:CreateTexture(nil,"BACKGROUND")
            f.Background:SetPoint("TOPLEFT")
            f.Background:SetPoint("BOTTOMRIGHT")
            f.Background:SetColorTexture(0.15, 0.15, 0.15, 1)
            f:SetScript("OnEnter", function (self)
                self:SetNormalTexture("Interface\\FriendsFrame\\UI-FriendsFrame-HighlightBar")
            end)
            f:SetScript("OnLeave", function (self)
                self:ClearNormalTexture()
            end)

            f.bossfontstring = f:CreateFontString(nil, "OVERLAY")
            f.bossfontstring:SetPoint("TOPLEFT", 3, 0)
            -- f.bossfontstring:SetPoint("BOTTOMLEFT", 0, 0)
            f.bossfontstring:SetWidth(BOSSwidth-6)
            f.bossfontstring:SetFont(GameFontNormal:GetFont(), 15, "THICKOUTLINE")
            f.bossfontstring:SetWordWrap(true)
            f.bossfontstring:SetJustifyH("CENTER")
            f.bossfontstring:SetJustifyV("MIDDLE")
            f.bossfontstring:SetTextColor(0.95, 0.95, 0.95, 1)

            f.itemicon = CreateButton(nil, f, "", "TOPLEFT", f.bossfontstring, "TOPRIGHT", 2, 0, 20, 20)
            f.itemicon:SetScript("OnEnter", function(self)
                OnEnter(self)
            end)
            f.itemicon:SetScript("OnLeave", function(self)
                OnLeave(self)
            end)
            f.itemicon:SetScript("OnDoubleClick", function (self, button)
                local itemlink = f.itemlink
                if (not itemlink) or itemlink == "" then return end
                local itemId = tonumber(itemlink:match("|Hitem:(%d+):"))
                if itemId then
                    local selectCharKey = ZL.GetClassColorName(UnitName("player")) .. " - " .. GetRealmName()
                    if (not ZL.opt.concernList) or (not ZL.opt.concernList[selectCharKey]) or
                    (not ZL.opt.concernList[selectCharKey]["itemList"][itemId]) then
                        ZL.addItem(itemId)
                    else
                        ZL.deleteItem(itemId)
                    end
                    ZL.AuctionFrame2:Update()
                end
            end)
            
            f.itemicon.itemNumbersIcon = f.itemicon:CreateTexture(nil, "OVERLAY")
            local itemNumbersIcon = f.itemicon.itemNumbersIcon
            itemNumbersIcon:SetPoint("TOP", f.itemicon, "TOP")
            itemNumbersIcon:SetSize(15,15)
            -- itemNumbersIcon:SetAllPoints(f.itemicon)

            f.level = f.itemicon:CreateFontString(nil, "OVERLAY")
            f.level:SetPoint("BOTTOMLEFT", 1, 0)
            f.level:SetPoint("BOTTOMRIGHT", -1, 0)
            f.level:SetFont(GameFontNormal:GetFont(), 8, "OUTLINE")
            f.level:SetWordWrap(true)
            f.level:SetJustifyH("LEFT")
            f.level:SetTextColor(0.95, 0.95, 0.95, 1)

            f.itemNamebox = CreateEditBox(f, itemNamewidth-f.itemicon:GetWidth()-1, 20, 12, "RIGHT", nil, nil, board_r, board_g, board_b, board_a)
            f.itemNamebox:SetPoint("LEFT", f.itemicon, "RIGHT", 0, 0)
            f.itemNamebox.Background:SetColorTexture(0,0,0,0)
            f.itemNamebox.BorderRight:Hide()
            -- f.itemNamebox:Disable()
            f.itemNamebox:SetScript("OnEnter", function (self)
                OnEnter(self)
                if self:HasFocus() and ZL_PLAYERLIST.lootList then
                    local txt = f.itemNamebox.fontstring:GetText()
                    local itemName, itemCount
                    if string.match(txt, "|cff00ff00×") then
                        itemName, itemCount = string.match(txt, "^(.-)|cff00ff00×(%d+)|r$")
                        itemCount = tonumber(itemCount)
                    else
                        itemName = txt
                        itemCount = 1
                    end
                    local bossName = ParseClassColorName(f.bossfontstring:GetText())
                    local data = ZL_PLAYERLIST.lootList[bossName][itemName]
                    local playerName = f.playerNamebox.fontstring:GetText()
                    local maxCount
                    if playerName == "拾取1" then
                        maxCount = data["拾取1"]["counts"]
                    else
                        maxCount = data["拾取1"]["counts"] + itemCount
                    end
                    GameTooltipShow(self, "TOPLEFT", "TOPRIGHT")
                    GameTooltip:AddLine("修改数量")
                    GameTooltip:AddLine("最大不超过|cff00ff00" .. maxCount .. "|r", 1, 1, 1)
                    GameTooltip:AddLine("物品名称不可修改", 1, 0, 0)
                    GameTooltip:AddLine("激活输入框，输入或鼠标滚轮修改\n数量，按Enter键或右键保存！", 1, 1, 1)
                    GameTooltip:Show()
                else
                    local itemlink = f.itemlink
                    if (not itemlink) or itemlink == "" then return end
                    local itemId = tonumber(itemlink:match("|Hitem:(%d+):"))
                    if itemId then
                        local uiScale, x, y = UIParent:GetEffectiveScale(), GetCursorPosition()
                        x, y = x/uiScale, y/uiScale
                        local screenWidth = GetScreenWidth() / 2
                        if x < screenWidth then
                            GameTooltipShow(self, "TOPLEFT", "TOPRIGHT")
                        else
                            GameTooltipShow(self, "TOPRIGHT", "TOPLEFT")
                        end
                        GameTooltip:ClearLines()
                        GameTooltip:SetHyperlink(itemlink)
                        GameTooltip:Show()
                        if _G["ShoppingTooltip1"] and _G["ShoppingTooltip1"]:IsShown() then
                            _G["ShoppingTooltip1"]:ClearAllPoints()
                            if x < screenWidth then
                                _G["ShoppingTooltip1"]:SetPoint("TOPLEFT", GameTooltip, "TOPRIGHT", 0, 0)
                            else
                                _G["ShoppingTooltip1"]:SetPoint("TOPRIGHT", GameTooltip, "TOPLEFT", 0, 0)
                            end
                        end
                        if _G["ShoppingTooltip2"] and _G["ShoppingTooltip2"]:IsShown() then
                            _G["ShoppingTooltip2"]:ClearAllPoints()
                            if x < screenWidth then
                                _G["ShoppingTooltip2"]:SetPoint("TOPLEFT", _G["ShoppingTooltip1"], "TOPRIGHT", 0, 0)
                            else
                                _G["ShoppingTooltip2"]:SetPoint("TOPRIGHT", _G["ShoppingTooltip1"], "TOPLEFT", 0, 0)
                            end
                        end
                    end
                end
            end)
            f.itemNamebox:SetScript("OnLeave", function (self)
                OnLeave(self)
                GameTooltip:Hide()
            end)
            f.itemNamebox:SetScript("OnEditFocusGained", function (self)
                if not ZL_PLAYERLIST.lootList then return end
                f.itemNamebox.fontstring:Hide()
                GameTooltip:Hide()
                local txt = f.itemNamebox.fontstring:GetText()
                local itemName, itemCount
                if string.match(txt, "|cff00ff00×") then
                    itemName, itemCount = string.match(txt, "^(.-)|cff00ff00×(%d+)|r$")
                    itemCount = tonumber(itemCount)
                else
                    itemName = txt
                    itemCount = 1
                end
                if f.playerNamebox.fontstring:GetText() ~= "拾取1" then
                    self:SetText(itemCount)
                else
                    self:SetText(1)
                end
                self:HighlightText()
                local bossName = ParseClassColorName(f.bossfontstring:GetText())
                local data = ZL_PLAYERLIST.lootList[bossName][itemName]
                local playerName = f.playerNamebox.fontstring:GetText()
                local maxCount
                if playerName == "拾取1" then
                    maxCount = data["拾取1"]["counts"]
                else
                    maxCount = data["拾取1"]["counts"] + itemCount
                end
                GameTooltipShow(self, "TOPLEFT", "TOPRIGHT")
                GameTooltip:AddLine("修改数量")
                GameTooltip:AddLine("最大不超过|cff00ff00" .. maxCount .. "|r", 1, 1, 1)
                GameTooltip:AddLine("物品名称不可修改", 1, 0, 0)
                GameTooltip:AddLine("激活输入框，输入或鼠标滚轮修改\n数量，按Enter键或右键保存！", 1, 1, 1)
                GameTooltip:Show()
            end)
            f.itemNamebox:SetScript("OnEditFocusLost", function (self)
                self:HighlightText(0, 0)
                f.itemNamebox.fontstring:Show()
                self:SetText("")
            end)
            f.itemNamebox:SetScript("OnMouseWheel", function (self, delta)
                if self:HasFocus() then
                    local number = self:GetNumber()
                    local txt = f.itemNamebox.fontstring:GetText()
                    local itemCount = tonumber(txt:match("×(%d+)")) or 1
                    local playerName = f.playerNamebox.fontstring:GetText()
                    if playerName ~= "拾取1" then
                        number = number > 0 and number or itemCount
                    end
                    if delta > 0 then
                        number = number + 1
                    else
                        number = number - 1
                    end
                    number = number > 0 and number or 0
                    self:SetNumber(number)
                end
            end)
            f.itemNamebox:SetScript("OnTextChanged", function (self)
                if OverviewFrame.dataType == 2 and ZL_PLAYERLIST.lootList then
                    local txt = f.itemNamebox.fontstring:GetText()
                    local itemName, itemCount
                    if string.match(txt, "|cff00ff00×") then
                        itemName, itemCount = string.match(txt, "^(.-)|cff00ff00×(%d+)|r$")
                        itemCount = tonumber(itemCount)
                    else
                        itemName = txt
                        itemCount = 1
                    end
                    local bossName = ParseClassColorName(f.bossfontstring:GetText())
                    local data = ZL_PLAYERLIST.lootList[bossName][itemName]
                    local playerName = f.playerNamebox.fontstring:GetText()
                    local maxCount
                    if playerName == "拾取1" then
                        maxCount = data["拾取1"]["counts"]
                    else
                        maxCount = data["拾取1"]["counts"] + itemCount
                    end
                    local newCount = self:GetNumber() or 0
                    if newCount >= maxCount then
                        self:SetNumber(maxCount)
                    end
                end
            end)
            local function itemCountChange(self)
                if not ZL_PLAYERLIST.lootList then return end
                local txt = f.itemNamebox.fontstring:GetText()
                local itemName, itemCount
                if string.match(txt, "|cff00ff00×") then
                    itemName, itemCount = string.match(txt, "^(.-)|cff00ff00×(%d+)|r$")
                    itemCount = tonumber(itemCount)
                else
                    itemName = txt
                    itemCount = 1
                end

                local playerName = f.playerNamebox.fontstring:GetText()
                local newItemCount = self:GetNumber()
                if OverviewFrame.dataType == 2 and newItemCount ~= itemCount and newItemCount > 0 then
                    local bossName = ParseClassColorName(f.bossfontstring:GetText())
                    local data = ZL_PLAYERLIST.lootList[bossName][itemName]
                    if playerName == "拾取1" then
                        if newItemCount < itemCount then
                            local i = 1
                            while true do
                                if not data["未知" .. i] then
                                    data["未知" .. i] = {
                                        counts = newItemCount,
                                    }
                                    break
                                end
                                i = i + 1
                            end
                            data["拾取1"]["counts"] = data["拾取1"]["counts"] - newItemCount
                            OverviewFrame:Update(ZL_PLAYERLIST.lootList)
                        else
                            self:ClearFocus()
                        end
                    else
                        if newItemCount <= itemCount + data["拾取1"]["counts"] and newItemCount ~= itemCount then
                            data[playerName]["counts"] = newItemCount
                            data["拾取1"]["counts"] = data["拾取1"]["counts"] - (newItemCount - itemCount)
                            OverviewFrame:Update(ZL_PLAYERLIST.lootList)
                        else
                            self:ClearFocus()
                        end
                    end
                else
                    self:ClearFocus()
                end
            end
            f.itemNamebox:SetScript("OnEnterPressed", function (self)
                itemCountChange(self)
            end)
            f.itemNamebox:SetScript("OnMouseDown", function (self, button)
                if button == "RightButton" and self:HasFocus() then
                    C_Timer.After(0.5, function ()
                        itemCountChange(self)
                    end)
                end
            end)
            f.itemNamebox.fontstring = f.itemNamebox:CreateFontString(nil, "OVERLAY")
            f.itemNamebox.fontstring:SetPoint("TOPLEFT", 3, -1)
            f.itemNamebox.fontstring:SetPoint("BOTTOMRIGHT", -3, 1)
            f.itemNamebox.fontstring:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            f.itemNamebox.fontstring:SetWordWrap(true)
            f.itemNamebox.fontstring:SetJustifyH("LEFT")
            f.itemNamebox.fontstring:SetJustifyV("MIDDLE")
            f.itemNamebox.fontstring:SetTextColor(0.95, 0.95, 0.95, 1)
            
            f.playerNamebox = CreateEditBox(f, playerNamewidth-1, 20, 12, "LEFT", nil, nil, board_r, board_g, board_b, board_a)
            f.playerNamebox:SetPoint("LEFT", f.itemNamebox, "RIGHT", 0, 0)
            f.playerNamebox.Background:SetColorTexture(0,0,0,0)
            f.playerNamebox.BorderRight:Hide()
            -- f.playerNamebox:Disable()
            f.playerNamebox:SetScript("OnEnter", function (self)
                OnEnter(self)
                if f.lootName and (not self:HasFocus()) and OverviewFrame.dataType == 2 and ParseClassColorName(f.bossfontstring:GetText()) ~= "拍卖合计" then
                    GameTooltipShow(self, "TOPLEFT", "BOTTOMRIGHT")
                    GameTooltip:AddLine("拾取人：" .. f.lootName)
                    GameTooltip:AddLine("激活输入框，输入或选择买家\n，按Enter键或右键保存！", 1, 1, 1)
                    GameTooltip:Show()
                end
            end)
            f.playerNamebox:SetScript("OnLeave", function (self)
                OnLeave(self)
                GameTooltip:Hide()
            end)
            f.playerNamebox:SetScript("OnEditFocusGained", function (self)
                f.playerNamebox.fontstring:Hide()
                if f.playerNamebox.fontstring:GetText() ~= "拾取1" then
                    self:SetText(f.playerNamebox.fontstring:GetText())
                    self:HighlightText()
                end
                local groupMembers = GroupMembersActivityMenu(self)
                if #groupMembers > 0 then
                    ZL.GUI:ToggleMenu(self, GroupMembersActivityMenu(self), 'cursor')
                end
                GameTooltip:Hide()
            end)
            f.playerNamebox:SetScript("OnEditFocusLost", function (self)
                ZL.GUI:CloseMenu()
                self:HighlightText(0, 0)
                if f.playerNamebox.fontstring:GetText() == "拾取1" then
                    f.playerNamebox.fontstring:Hide()
                else
                    f.playerNamebox.fontstring:Show()
                end
                self:SetText("")
            end)
            f.playerNamebox:SetScript("OnTextChanged", function (self)
                if self:GetText() == "拾取1" then self:SetText("") end
            end)
            function OverviewFrame.playerNameChange(self)
                local newPlayerName = self:GetText() or ""
                local pf = self:GetParent()
                local oldPlayerName = pf.playerNamebox.fontstring:GetText()
                if OverviewFrame.dataType == 2 and newPlayerName ~= "" and GetClassColorName(newPlayerName) ~= oldPlayerName then
                    local txt = pf.itemNamebox.fontstring:GetText()
                    local itemName, itemCount
                    if string.match(txt, "|cff00ff00×") then
                        itemName, itemCount = string.match(txt, "^(.-)|cff00ff00×(%d+)|r$")
                        itemCount = tonumber(itemCount)
                    else
                        itemName = txt
                        itemCount = 1
                    end
                    local bossName = ParseClassColorName(pf.bossfontstring:GetText())
                    local data = ZL_PLAYERLIST.lootList[bossName][itemName]
                    if oldPlayerName == "拾取1" then
                        if not data[newPlayerName] then
                            data[newPlayerName] = {
                                counts = 1,
                            }
                        else
                            data[newPlayerName]["counts"] = data[newPlayerName]["counts"] + 1
                        end
                        data["拾取1"]["counts"] = data["拾取1"]["counts"] - 1
                    else
                        data[newPlayerName] = {
                            counts = (data[newPlayerName] and data[newPlayerName]["counts"] or 0) + data[oldPlayerName]["counts"],
                            totalAmount = ((data[newPlayerName] and data[newPlayerName]["totalAmount"]) and data[newPlayerName]["totalAmount"] or 0) + (data[oldPlayerName]["totalAmount"] or 0),
                        }
                        data[oldPlayerName] = nil
                    end
                    OverviewFrame:Update(ZL_PLAYERLIST.lootList)
                else
                    self:ClearFocus()
                end
            end
            f.playerNamebox:SetScript("OnEnterPressed", function (self)
                OverviewFrame.playerNameChange(self)
            end)
            f.playerNamebox:SetScript("OnMouseDown", function (self, button)
                if button == "RightButton" and self:HasFocus() then
                    C_Timer.After(0.5, function ()
                        OverviewFrame.playerNameChange(self)
                    end)
                end
            end)
            f.playerNamebox.fontstring = f.playerNamebox:CreateFontString(nil, "OVERLAY")
            f.playerNamebox.fontstring:SetPoint("TOPLEFT", 3, -1)
            f.playerNamebox.fontstring:SetPoint("BOTTOMRIGHT", -3, 1)
            f.playerNamebox.fontstring:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            f.playerNamebox.fontstring:SetWordWrap(true)
            f.playerNamebox.fontstring:SetJustifyH("LEFT")
            f.playerNamebox.fontstring:SetJustifyV("MIDDLE")
            f.playerNamebox.fontstring:SetTextColor(0.95, 0.95, 0.95, 1)

            f.amountbox = CreateEditBox(f, amountwidth, 20, 12, "RIGHT", nil, nil, board_r, board_g, board_b, board_a)
            f.amountbox:SetPoint("LEFT", f.playerNamebox, "RIGHT", 0, 0)
            f.amountbox.Background:SetColorTexture(0,0,0,0)
            -- f.amountbox:Disable()
            f.amountbox:SetScript("OnEnter", function (self)
                OnEnter(self)
                if OverviewFrame.dataType == 2 and ParseClassColorName(f.bossfontstring:GetText()) ~= "拍卖合计" then
                    GameTooltipShow(self, "LEFT", "RIGHT")
                    GameTooltip:AddLine("提示")
                    GameTooltip:AddLine("激活输入框，输入或鼠标滚轮设置\n总金额，按Enter键或右键保存！", 1, 1, 1)
                    if f.playerNamebox.fontstring:GetText() ~= "拾取1" then
                        GameTooltip:AddLine(" ")
                        GameTooltip:AddLine("留空或者输入0直接删除本条记录")
                    end
                    GameTooltip:Show()
                end
            end)
            f.amountbox:SetScript("OnLeave", function (self)
                OnLeave(self)
                GameTooltip:Hide()
            end)
            f.amountbox:SetScript("OnEditFocusGained", function (self)
                f.amountbox.fontstring:Hide()
                if f.amountbox.fontstring:GetText() then
                    self:SetText(f.amountbox.fontstring:GetText())
                end
                self:HighlightText()
            end)
            f.amountbox:SetScript("OnEditFocusLost", function (self)
                self:HighlightText(0, 0)
                f.amountbox.fontstring:Show()
                self:SetText("")
            end)
            f.amountbox:SetScript("OnMouseWheel", function (self, delta)
                EditOnMouseWheel(self, delta)
            end)
            f.amountbox:SetScript("OnTextChanged", function (self)
                if OverviewFrame.dataType == 2 and ZL_PLAYERLIST.lootList then
                    local newAmount = self:GetNumber()
                    if newAmount < 0 then self:SetNumber(0) end
                end
            end)
            local function amountChange(self)
                local oldAmount = tonumber(f.amountbox.fontstring:GetText()) or 0
                local newAmount = self:GetNumber() or 0
                if OverviewFrame.dataType == 2 and ZL_PLAYERLIST.lootList and newAmount ~= oldAmount then
                    local txt = f.itemNamebox.fontstring:GetText()
                    local itemName, itemCount
                    if string.match(txt, "|cff00ff00×") then
                        itemName, itemCount = string.match(txt, "^(.-)|cff00ff00×(%d+)|r$")
                        itemCount = tonumber(itemCount)
                    else
                        itemName = txt
                        itemCount = 1
                    end
                    local bossName = ParseClassColorName(f.bossfontstring:GetText())
                    local data = ZL_PLAYERLIST.lootList[bossName][itemName]
                    local playerName = f.playerNamebox.fontstring:GetText()
                    if newAmount > 0 then
                        if playerName == "拾取1" then
                            local i = 1
                            while true do
                                if not data["未知" .. i] then
                                    data["未知" .. i] = {
                                        counts = 1,
                                        totalAmount = newAmount,
                                    }
                                    break
                                end
                                i = i + 1
                            end
                            data["拾取1"]["counts"] = data["拾取1"]["counts"] - 1
                        else
                            data[playerName]["totalAmount"] = newAmount
                        end
                    else --输入为0的时候，删除记录
                        data[playerName] = nil
                        data["拾取1"]["counts"] = data["拾取1"]["counts"] + itemCount
                    end
                    OverviewFrame:Update(ZL_PLAYERLIST.lootList)
                else
                    self:ClearFocus()
                end
            end
            f.amountbox:SetScript("OnEnterPressed", function (self)
                amountChange(self)
            end)
            f.amountbox:SetScript("OnMouseDown", function (self, button)
                if button == "RightButton" and self:HasFocus() then
                    C_Timer.After(0.5, function ()
                        amountChange(self)
                    end)
                end
            end)
            f.amountbox.fontstring = f.amountbox:CreateFontString(nil, "OVERLAY")
            f.amountbox.fontstring:SetPoint("TOPLEFT", 3, -1)
            f.amountbox.fontstring:SetPoint("BOTTOMRIGHT", -3, 1)
            f.amountbox.fontstring:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            f.amountbox.fontstring:SetWordWrap(true)
            f.amountbox.fontstring:SetJustifyH("RIGHT")
            f.amountbox.fontstring:SetJustifyV("MIDDLE")
            f.amountbox.fontstring:SetTextColor(0.95, 0.95, 0.95, 1)

            t[v] = f
            return f
        end
    })

    function OverviewFrame:Update(bill)
        for _, f in ipairs(OverviewFrame.entries) do f:Hide() end
        local recordList = {}
        local itemLevelList = {}
        if bill == ZL_CURRENT then
            OverviewFrame.dataType = 1
        elseif bill == ZL_PLAYERLIST.lootList then
            OverviewFrame.dataType = 2
        else
            OverviewFrame.dataType = 3
        end
        if bill and bill.auctionlist and #bill.auctionlist > 0 then
            local numGroupMembers, RLBuTie, totalincome, totalpayout, totalamount, averageamount = GetAveWages(bill)
            for _, data in ipairs(bill.auctionlist) do
                local itemlink = data.itemlink
                local spawnUID = data.spawnUID
                local bossName, playerName, counts, totalAmount, itemList
                itemLevelList[itemlink] = data.itemLevel
                itemList = data.itemList
                if spawnUID and (not data.isPackage) then
                    for _, value in pairs(spawnUID) do
                        bossName = value["bossName"] or value["bossname"]
                        if not recordList[bossName] then recordList[bossName] = {} end
                        if not recordList[bossName][itemlink] then recordList[bossName][itemlink] = {} end
                        if (not value["successBidder"]) or (value["successBidder"] and (not next(value["successBidder"], nil))) then
                            counts = data["itemCount"]
                            if data.state == "waiting" then
                                playerName = "待拍卖"
                            elseif data.state == "auctioning" then
                                playerName = "拍卖中"
                            elseif data.state == "failed" or data.state == "success" then
                                playerName = "流拍"
                            end
                            playerName = playerName or "流拍"
                            if not recordList[bossName][itemlink][playerName] then recordList[bossName][itemlink][playerName] = {} end
                            recordList[bossName][itemlink][playerName]["counts"] = counts -- + (recordList[bossName][itemlink][playerName]["counts"] or 0)
                            recordList[bossName][itemlink][playerName]["itemList"] = itemList
                        else
                            for _palyer, value2 in pairs(value["successBidder"]) do
                                playerName = _palyer
                                totalAmount = value2.amount
                                counts = value2.count
                                if not recordList[bossName][itemlink][playerName] then recordList[bossName][itemlink][playerName] = {} end
                                recordList[bossName][itemlink][playerName]["counts"] = counts + (recordList[bossName][itemlink][playerName]["counts"] or 0)
                                recordList[bossName][itemlink][playerName]["totalAmount"] = totalAmount + (recordList[bossName][itemlink][playerName]["totalAmount"] or 0)
                                recordList[bossName][itemlink][playerName]["itemList"] = itemList
                            end
                        end

                    end
                end
            end
            if bill.IncomeList and #bill.IncomeList > 0 then
                local bossName, playerName
                for _, data in ipairs(bill.IncomeList) do
                    if not data["tradeId"] then
                        bossName = "手动添加"
                        if not recordList[bossName] then recordList[bossName] = {} end
                        if not recordList[bossName][data["notes"]] then recordList[bossName][data["notes"]] = {} end
                        playerName = data["player"] or "其他"
                        if not recordList[bossName][data["notes"]][playerName] then recordList[bossName][data["notes"]][playerName] = {} end
                        recordList[bossName][data["notes"]][playerName]["totalAmount"] = (recordList[bossName][data["notes"]][playerName]["totalAmount"] or 0) + data["amount"]
                        recordList[bossName][data["notes"]][playerName]["counts"] = (recordList[bossName][data["notes"]][playerName]["counts"] or 0) + data["itemCount"]
                    end
                end
            end
            if bill["aveWages"] then
                recordList["收支总览"] = {
                    ["总收入"] = {
                        [" "] = {
                            ["totalAmount"] = totalincome,
                            ["counts"] = " ",
                        },
                    },
                    ["总支出"] = {
                        [" "] = {
                            ["totalAmount"] = totalpayout,
                            ["counts"] = " ",
                        },
                    },
                    ["浄收入"] = {
                        [" "] = {
                            ["totalAmount"] = totalamount,
                            ["counts"] = " ",
                        },
                    },
                }
                recordList["工资分配"] = {
                    ["工资人数"] = {
                        [" "] = {
                            ["totalAmount"] = numGroupMembers,
                            ["counts"] = " ",
                        },
                    },
                    ["人均工资"] = {
                        [" "] = {
                            ["totalAmount"] = averageamount,
                            ["counts"] = " ",
                        },
                    },
                    ["小队工资"] = {
                        [averageamount .. "×5"] = {
                            ["totalAmount"] = averageamount*5,
                            ["counts"] = " ",
                        },
                    },
                }
            end
            if bill["butie"] and #bill["butie"]  > 0 then
                local bossName = "补贴支出"
                local playerName
                if not recordList[bossName] then recordList[bossName] = {} end
                for _, data in ipairs(bill["butie"]) do
                    if not recordList[bossName][data["notes"]] then recordList[bossName][data["notes"]] = {} end
                    playerName = data["player"]
                    if not recordList[bossName][data["notes"]][playerName] then recordList[bossName][data["notes"]][playerName] = {} end
                    recordList[bossName][data["notes"]][playerName]["totalAmount"] = (recordList[bossName][data["notes"]][playerName]["totalAmount"] or 0) + data["amount"]
                    recordList[bossName][data["notes"]][playerName]["counts"] = (recordList[bossName][data["notes"]][playerName]["counts"] or 0) + (data["itemCount"] or 1)
                end
            end
            local playerBuyList = ZL.GetPlayerBuyList(bill)
            local debtList = {}
            for name, data in pairs(playerBuyList) do
                local balanceAmount = 0
                local playerPayToMLamount = 0
                if bill.playerPayToML and bill.playerPayToML[name] then
                    playerPayToMLamount = bill.playerPayToML[name]
                end
                balanceAmount = playerPayToMLamount - data.totalAmount
                if PlayerIsML(name) then
                    balanceAmount = 0
                end
                if balanceAmount < 0 then
                    debtList[name] = balanceAmount
                end
            end
            if next(debtList) then
                local bossName = "欠款名单"
                if not recordList[bossName] then recordList[bossName] = {} end
                if not recordList[bossName][" "] then recordList[bossName][" "] = {} end
                for name, debt in pairs(debtList) do
                    if not recordList[bossName][" "][name] then recordList[bossName][" "][name] = {} end
                    recordList[bossName][" "][name]["totalAmount"] = debt
                    recordList[bossName][" "][name]["counts"] = 1
                end
            end
            wipe(debtList)
            wipe(playerBuyList)
            debtList = nil
            playerBuyList = nil
        elseif bill and bill.type == "拾取记录" then
            recordList = bill
            recordList["拍卖合计"] = {}
            local totalAmount = 0
            for _, value1 in pairs(recordList) do
                if type(value1) == "table" then
                    for _, value2 in pairs(value1) do
                        for playerName, value3 in pairs(value2) do
                            if playerName ~= "拾取1" then
                                totalAmount = totalAmount + (value3.totalAmount or 0)
                            end
                        end
                    end
                end
            end
            local groupMembers = GetNumGroupMembers(1) == 0 and 1 or GetNumGroupMembers(1)
            recordList["拍卖合计"] = {
                ["总收入"] = {
                    ["拾取1"] = {
                        ["lootName"] = " ",
                        ["counts"] = 0,
                        ["itemLevel"] = 1,
                    },
                    [" "] = {
                        counts = 1,
                        totalAmount = totalAmount,
                    }
                },
                ["预估人数"] = {
                    ["拾取1"] = {
                        ["lootName"] = " ",
                        ["counts"] = 0,
                        ["itemLevel"] = 1,
                    },
                    [" "] = {
                        counts = 1,
                        totalAmount = groupMembers,
                    }
                },
                ["人均预估"] = {
                    ["拾取1"] = {
                        ["lootName"] = " ",
                        ["counts"] = 0,
                        ["itemLevel"] = 1,
                    },
                    [" "] = {
                        counts = 1,
                        totalAmount = floor(totalAmount/groupMembers),
                    }
                }
            }
        end
        if recordList and next(recordList, nil) then
            OverviewFrame:SetSize(GetScreenWidth()-65, GetScreenHeight()-50)
            local maxrows = math.floor(OverviewFrame.scrollFrame:GetHeight() / (height+gapheight)) --全屏支持的最大行数
            local bossNameRowsList = {}
            local bossMaxRows = 0
            for bossName, value1 in pairs(recordList) do
                local rows = 0
                if type(value1) == "table" then
                    for _, value2 in pairs(value1) do
                        for _, value3 in pairs(value2) do
                            rows = rows + 1
                            bossMaxRows = bossMaxRows + 1
                            if bossName == "打包拍卖" then
                                for _ in pairs(value3["itemList"]) do
                                    rows = rows + 1
                                    bossMaxRows = bossMaxRows + 1
                                end
                            end
                        end
                    end
                    bossNameRowsList[bossName] = rows
                    bossMaxRows = bossMaxRows + 1
                end
            end
            bossMaxRows = bossMaxRows - 1
            local aveMaxRows = math.floor(bossMaxRows/3) + 3
            maxrows = aveMaxRows > maxrows and aveMaxRows or maxrows
            local index = 1
            local bili = 1
            local bossindex = 0
            local oldbossindex = 1
            local f
            local column = 0
            local row = 1
            local rowMax = 1 --取每列中最大的行
            for _, bossName in ipairs(ZL.BoosList) do
                local value1 = recordList[bossName]
                if value1 and type(value1) == "table" then
                    bossindex = bossindex + 1
                    local index2 = 1
                    oldbossindex = index
                    if next(value1, nil) then
                        local itemList = {}
                        if bossName == "收支总览" then
                            itemList = {"总收入", "总支出", "浄收入"}
                        elseif bossName == "工资分配" then
                            itemList = { "工资人数", "人均工资", "小队工资"}
                        elseif bossName == "补贴支出" then
                            itemList = {"RL补贴", "T补贴", "奶补贴", "DPS补贴", "食物补贴", "修星补贴", "工具人补贴"}
                        elseif bossName == "拍卖合计" then
                            itemList = {"总收入", "预估人数", "人均预估"}
                        else
                            for itemlink in pairs(value1) do
                                tinsert(itemList, itemlink)
                            end
                            table.sort(itemList)
                        end
                        for _, itemlink in ipairs(itemList) do
                            local value2 = value1[itemlink]
                            if value2 then
                                local itemId = tonumber(itemlink:match("|Hitem:(%d+):"))
                                local lootName = value2["拾取1"] and value2["拾取1"]["lootName"] or nil
                                local itemLevel = value2["拾取1"] and value2["拾取1"]["itemLevel"] or nil
                                if next(value2, nil) then
                                    local playerNameList = {}
                                    for playerName in pairs(value2) do
                                        tinsert(playerNameList, playerName)
                                    end
                                    table.sort(playerNameList)
                                    for _, playerName in ipairs(playerNameList) do
                                        local value3 = value2[playerName]
                                        if playerName ~= "拾取1" or (playerName == "拾取1" and value3["counts"] > 0) then
                                            f = OverviewFrame.entries[index]
                                            f:ClearAllPoints()
                                            if lootName then f.lootName = lootName end
                                            if index2 == 1 then
                                                if index == 1 or (row + bossNameRowsList[bossName]) > maxrows then
                                                    f:SetPoint("TOPLEFT", content, "TOPLEFT", (BOSSwidth+itemNamewidth+playerNamewidth+amountwidth+gapwidth-3)*column, 0)
                                                    column = column + 1
                                                    if row > maxrows then
                                                        maxrows = row
                                                    end
                                                    if row > rowMax then
                                                        rowMax = row
                                                    end
                                                    row = 1
                                                else
                                                    f:SetPoint("TOPLEFT", OverviewFrame.entries[index-1], "BOTTOMLEFT", 0, -gapheight)
                                                    row = row + 1
                                                    if row > rowMax then
                                                        rowMax = row
                                                    end
                                                end
                                                if bossName == "打包拍卖" then
                                                    f.bossfontstring:SetText(bossName)
                                                elseif bossName == "总览" or bossName == "工资" then
                                                    f.bossfontstring:SetText("|cff00aaff" .. bossName .. "|r")
                                                elseif bossName == "欠款名单" then
                                                    f.bossfontstring:SetText("|TInterface\\DialogFrame\\DialogAlertIcon.blp:20|t|cffff0000" .. bossName .. "|r")
                                                else
                                                    if bossindex % 2 == 0 then
                                                        f.bossfontstring:SetText("|cffADDFAD" .. bossName .. "|r")
                                                    else
                                                        f.bossfontstring:SetText("|cffFFD700" .. bossName .. "|r")
                                                    end
                                                end
                                                f.bossfontstring:Show()
                                                -- f.itemNamebox.BorderTop:Show()
                                                -- f.playerNamebox.BorderTop:Show()
                                                -- f.amountbox.BorderTop:Show()
                                            else
                                                f:SetPoint("TOPLEFT", OverviewFrame.entries[index-1], "BOTTOMLEFT", 0, -gapheight)
                                                f.bossfontstring:SetText(bossName)
                                                f.bossfontstring:Hide()
                                                -- f.itemNamebox.BorderTop:Hide()
                                                -- f.playerNamebox.BorderTop:Hide()
                                                -- f.amountbox.BorderTop:Hide()
                                                row = row + 1
                                            end
                                            f.playerNamebox.fontstring:Show()
                                            f.amountbox.fontstring:Show()
                                            if OverviewFrame.dataType == 2 and bossName ~= "拍卖合计" then
                                                f.itemNamebox:Enable()
                                                f.playerNamebox:Enable()
                                                f.amountbox:Enable()
                                            else
                                                f.itemNamebox:Disable()
                                                f.playerNamebox:Disable()
                                                f.amountbox:Disable()
                                            end
                                            f:Show()
                                            index = index + 1
                                            f.itemlink = itemlink
                                            if itemId then
                                                f.itemicon:SetNormalTexture(cGetItemIcon(itemlink))
                                                local itemTotalCount = select(4, ZL.GetItemNumbers(itemId))
                                                if itemTotalCount > 0 then
                                                    f.itemicon.itemNumbersIcon:SetTexture([[interface/raidframe/readycheck-ready]])
                                                else
                                                    f.itemicon.itemNumbersIcon:SetTexture()
                                                end
                                            elseif itemlink == "[打包拍卖]" then
                                                f.itemicon:SetNormalTexture("Interface\\AddOns\\" .. addonName .. "\\Images\\ZL.tga")
                                                f.itemicon.itemNumbersIcon:SetTexture()
                                            else
                                                f.itemicon:ClearNormalTexture()
                                                f.itemicon.itemNumbersIcon:SetTexture()
                                            end
                                            f.level:SetTextScale(1)
                                            f.itemNamebox.fontstring:SetTextScale(1)
                                            f.playerNamebox.fontstring:SetTextScale(1)
                                            f.amountbox.fontstring:SetTextScale(1)
                                            if itemLevel and itemLevel >= 30 then
                                                f.level:SetText(itemLevel)
                                            elseif itemLevelList[itemlink] and itemLevelList[itemlink] >= 30 then
                                                f.level:SetText(itemLevelList[itemlink])
                                            else
                                                f.level:SetText("")
                                            end
                                            if type(value3["counts"]) == "number" and value3["counts"] > 1 then
                                                f.itemNamebox.fontstring:SetText(itemlink .. "|cff00ff00×" .. value3["counts"] .. "|r")
                                            else
                                                f.itemNamebox.fontstring:SetText(itemlink)
                                            end
                                            f.playerNamebox.fontstring:SetText(playerName)
                                            if playerName == "拾取1" or string.match(playerName, "^未知%d+$") then
                                                f.playerNamebox.fontstring:Hide()
                                            else
                                                f.playerNamebox.fontstring:Show()
                                            end

                                            f.amountbox.fontstring:SetText(value3["totalAmount"] and format("%.0f", value3["totalAmount"]) or "")
                                            bili = f.level:GetStringWidth()>0 and f.level:GetWidth()/(f.level:GetUnboundedStringWidth()+5) or 1
                                            if bili < 1 then
                                                f.level:SetTextScale(bili)
                                            else
                                                f.level:SetTextScale(1)
                                            end
                                            bili = f.itemNamebox.fontstring:GetStringWidth()>0 and f.itemNamebox.fontstring:GetWidth()/(f.itemNamebox.fontstring:GetUnboundedStringWidth()+5) or 1
                                            if bili < 1 then
                                                f.itemNamebox.fontstring:SetTextScale(bili)
                                            else
                                                f.itemNamebox.fontstring:SetTextScale(1)
                                            end
                                            bili = f.playerNamebox.fontstring:GetStringWidth()>0 and f.playerNamebox.fontstring:GetWidth()/(f.playerNamebox.fontstring:GetUnboundedStringWidth()+5) or 1
                                            if bili < 1 then
                                                f.playerNamebox.fontstring:SetTextScale(bili)
                                            else
                                                f.playerNamebox.fontstring:SetTextScale(1)
                                            end
                                            bili = f.amountbox.fontstring:GetStringWidth()>0 and f.amountbox.fontstring:GetWidth()/(f.amountbox.fontstring:GetUnboundedStringWidth()+5) or 1
                                            if bili < 1 then
                                                f.amountbox.fontstring:SetTextScale(bili)
                                            else
                                                f.amountbox.fontstring:SetTextScale(1)
                                            end
                                            index2 = index2 + 1
                                            if bossName == "打包拍卖" and value3["itemList"] then
                                                index2 = 1
                                                for _itemlink, value4 in pairs(value3["itemList"]) do
                                                    local _itemId = tonumber(_itemlink:match("|Hitem:(%d+):"))
                                                    f = OverviewFrame.entries[index]
                                                    f:ClearAllPoints()
                                                    f:SetPoint("TOPLEFT", OverviewFrame.entries[index-1], "BOTTOMLEFT", 0, -gapheight)
                                                    f.bossfontstring:SetText(bossName)
                                                    f.bossfontstring:Hide()
                                                    if OverviewFrame.dataType == 2 then
                                                        f.itemNamebox:Enable()
                                                        f.playerNamebox:Enable()
                                                        f.amountbox:Enable()
                                                    else
                                                        f.itemNamebox:Disable()
                                                        f.playerNamebox:Disable()
                                                        f.amountbox:Disable()
                                                    end

                                                    -- f.itemNamebox.BorderTop:Hide()
                                                    -- f.playerNamebox.BorderTop:Hide()
                                                    -- f.amountbox.BorderTop:Hide()

                                                    f:Show()
                                                    index = index + 1
                                                    row = row + 1
                                                    if row > rowMax then
                                                        rowMax = row
                                                    end
                                                    f.itemlink = _itemlink
                                                    if _itemId then
                                                        f.itemicon:SetNormalTexture(cGetItemIcon(_itemlink))
                                                    else
                                                        f.itemicon:ClearNormalTexture()
                                                    end
                                                    f.level:SetTextScale(1)
                                                    f.itemNamebox.fontstring:SetTextScale(1)
                                                    f.playerNamebox.fontstring:SetTextScale(1)
                                                    f.amountbox.fontstring:SetTextScale(1)
                                                    if itemLevel and itemLevel >= 30 then
                                                        f.level:SetText(itemLevel)
                                                    elseif itemLevelList[itemlink] and itemLevelList[itemlink] >= 30 then
                                                        f.level:SetText(itemLevelList[itemlink])
                                                    else
                                                        f.level:SetText("")
                                                    end
                                                    if value4["itemCount"] > 1 then
                                                        f.itemNamebox.fontstring:SetText(_itemlink .. "|cff00ff00×" .. value4["itemCount"] .. "|r")
                                                    else
                                                        f.itemNamebox.fontstring:SetText(_itemlink)
                                                    end
                                                    f.playerNamebox.fontstring:SetText("")
                                                    f.amountbox.fontstring:SetText("")
                                                    bili = f.level:GetStringWidth()>0 and (f.level:GetWidth())/(f.level:GetUnboundedStringWidth()+5) or 1
                                                    if bili < 1 then
                                                        f.level:SetTextScale(bili)
                                                    else
                                                        f.level:SetTextScale(1)
                                                    end
                                                    bili = f.itemNamebox.fontstring:GetStringWidth()>0 and f.itemNamebox.fontstring:GetWidth()/(f.itemNamebox.fontstring:GetUnboundedStringWidth()+5) or 1
                                                    if bili < 1 then
                                                        f.itemNamebox.fontstring:SetTextScale(bili)
                                                    else
                                                        f.itemNamebox.fontstring:SetTextScale(1)
                                                    end
                                                    bili = f.playerNamebox.fontstring:GetStringWidth()>0 and f.playerNamebox.fontstring:GetWidth()/(f.playerNamebox.fontstring:GetUnboundedStringWidth()+5) or 1
                                                    if bili < 1 then
                                                        f.playerNamebox.fontstring:SetTextScale(bili)
                                                    else
                                                        f.playerNamebox.fontstring:SetTextScale(1)
                                                    end
                                                    bili = f.amountbox.fontstring:GetStringWidth()>0 and f.amountbox.fontstring:GetWidth()/(f.amountbox.fontstring:GetUnboundedStringWidth()+5) or 1
                                                    if bili < 1 then
                                                        f.amountbox.fontstring:SetTextScale(bili)
                                                    else
                                                        f.amountbox.fontstring:SetTextScale(1)
                                                    end
                                                    index2 = index2 + 1
                                                end
                                            end
                                        end
                                    end
                                end
                            end
                        end
                    end
                    f= OverviewFrame.entries[oldbossindex]
                    f.bossfontstring:SetHeight((index2-1)*(height+gapheight))
                    if row <= maxrows then
                        f = OverviewFrame.entries[index]
                        f:SetPoint("TOPLEFT", OverviewFrame.entries[index-1], "BOTTOMLEFT", 0, -gapheight)
                        f:Hide()
                        index = index + 1
                        row = row + 1
                        if row > rowMax then
                            rowMax = row
                        end
                    end
                end
            end
            rowMax = rowMax - 1
            rowMax = rowMax > 20 and rowMax or 20 --最低显示20行高度
            local contetHeight = (height+gapheight)*rowMax
            content:SetHeight(contetHeight)
            if column == 1 then
                BOSSHeaderBtn2:Hide()
                itemNameHeaderBtn2:Hide()
                playerNameHeaderBtn2:Hide()
                amountHeaderBtn2:Hide()

                BOSSHeaderBtn3:Hide()
                itemNameHeaderBtn3:Hide()
                playerNameHeaderBtn3:Hide()
                amountHeaderBtn3:Hide()
            elseif column == 2 then
                BOSSHeaderBtn2:Show()
                itemNameHeaderBtn2:Show()
                playerNameHeaderBtn2:Show()
                amountHeaderBtn2:Show()

                BOSSHeaderBtn3:Hide()
                itemNameHeaderBtn3:Hide()
                playerNameHeaderBtn3:Hide()
                amountHeaderBtn3:Hide()
            elseif column == 3 then
                BOSSHeaderBtn2:Show()
                itemNameHeaderBtn2:Show()
                playerNameHeaderBtn2:Show()
                amountHeaderBtn2:Show()

                BOSSHeaderBtn3:Show()
                itemNameHeaderBtn3:Show()
                playerNameHeaderBtn3:Show()
                amountHeaderBtn3:Show()
            end
            local OverviewFrameHeight = contetHeight + BOSSHeaderBtn1:GetHeight() + 42
            OverviewFrameHeight = OverviewFrameHeight > (GetScreenHeight()-50) and (GetScreenHeight()-50) or OverviewFrameHeight
            OverviewFrame:SetSize(23+(column-1)*gapwidth+column*(itemNamewidth+playerNamewidth+amountwidth+BOSSwidth-3), OverviewFrameHeight)
        else
            BOSSHeaderBtn2:Hide()
            itemNameHeaderBtn2:Hide()
            playerNameHeaderBtn2:Hide()
            amountHeaderBtn2:Hide()

            BOSSHeaderBtn3:Hide()
            itemNameHeaderBtn3:Hide()
            playerNameHeaderBtn3:Hide()
            amountHeaderBtn3:Hide()
            local OverviewFrameHeight = (height+gapheight)*20 + BOSSHeaderBtn1:GetHeight() + 42
            OverviewFrame:SetSize(23+(itemNamewidth+playerNamewidth+amountwidth+BOSSwidth-3), OverviewFrameHeight)
        end
        if bill and bill.name and bill.auctiondate then
            OverviewFrame.Title:SetText("拍卖账单总览|cffffffff—|r" .. bill.name .. "|cffffffff—|r" .. bill.auctiondate)
        elseif bill and bill.type == "拾取记录" then
            OverviewFrame.Title:SetText("拾取记录")
        else
            OverviewFrame.Title:SetText("没有记录")
        end
        recordList = nil
        itemLevelList = nil
        OverviewFrame:ClearAllPoints()
        OverviewFrame:SetPoint("CENTER")
    end

end

--分解流拍物品界面
function ZL:CreateDisenchantingFrame()
    ZL.DisenchantingFrame = ZLCreateFrame("ZLDisenchantingFrame", ZL, nil, nil, nil, true, true, "流拍物品窗口")
    local DisenchantingFrame = ZL.DisenchantingFrame
    tinsert(UISpecialFrames, DisenchantingFrame:GetName())
    DisenchantingFrame:SetScript("OnMouseUp", function (self)
        self:StopMovingOrSizing()
        if not ZL.glb.ZLDisenchantingFrame then ZL.glb.ZLDisenchantingFrame = {} end
        ZL.glb.ZLDisenchantingFrame.point, _, ZL.glb.ZLDisenchantingFrame.relative, ZL.glb.ZLDisenchantingFrame.x, ZL.glb.ZLDisenchantingFrame.y = self:GetPoint()
    end)
    DisenchantingFrame:SetScript("OnMouseDown", function (self)
        self:StartMoving()
    end)
    DisenchantingFrame:SetScript("OnShow", function (self)
        DisenchantingFrame:Update()
    end)
    DisenchantingFrame:SetScript("OnSizeChanged", function (self, _, height)
        if ZL.DisenchantingLgnoreFrame then
            ZL.DisenchantingLgnoreFrame:SetHeight(height+5)
        end
    end)
    DisenchantingFrame:ClearAllPoints()
    if ZL.glb.ZLDisenchantingFrame and ZL.glb.ZLDisenchantingFrame.point then
        DisenchantingFrame:SetPoint(ZL.glb.ZLDisenchantingFrame.point, UIParent, ZL.glb.ZLDisenchantingFrame.relative, ZL.glb.ZLDisenchantingFrame.x, ZL.glb.ZLDisenchantingFrame.y)
    else
        DisenchantingFrame:SetPoint("CENTER")
    end
    DisenchantingFrame:SetResizeBounds(305, 350, 305, GetScreenHeight()-110)
    DisenchantingFrame:Hide()
    local btnTexture = [[Interface\ACHIEVEMENTFRAME\UI-Achievement-Parchment-Horizontal]]
    DisenchantingFrame.hideBtn = CreateButton(nil, DisenchantingFrame, "隐藏", "TOPLEFT", DisenchantingFrame.TitleBottom, "BOTTOMLEFT", 3, -5, 47)
    local hideBtn = DisenchantingFrame.hideBtn
    hideBtn:GetFontString():SetFont(GameFontNormal:GetFont(), 14, "OUTLINE")
    hideBtn:SetNormalTexture(btnTexture)
    hideBtn:ClearHighlightTexture()

    DisenchantingFrame.itemNameBtn = CreateButton(nil, DisenchantingFrame, "物品名称", "LEFT", hideBtn, "RIGHT", 0, 0, 185)
    local itemNameBtn = DisenchantingFrame.itemNameBtn
    itemNameBtn:GetFontString():SetFont(GameFontNormal:GetFont(), 14, "OUTLINE")
    itemNameBtn:SetNormalTexture(btnTexture)
    itemNameBtn:ClearHighlightTexture()

    DisenchantingFrame.itemLevelBtn = CreateButton(nil, DisenchantingFrame, "装等", "LEFT", itemNameBtn, "RIGHT", 0, 0, 50)
    local itemLevelBtn = DisenchantingFrame.itemLevelBtn
    itemLevelBtn:GetFontString():SetFont(GameFontNormal:GetFont(), 14, "OUTLINE")
    itemLevelBtn:SetNormalTexture(btnTexture)
    itemLevelBtn:ClearHighlightTexture()

    DisenchantingFrame.disenchantingBtn = CreateFrame("Button", "ZLDisenchantButton", DisenchantingFrame, "SecureActionButtonTemplate") --, "SecureActionButtonTemplate"
    local disenchantingBtn = DisenchantingFrame.disenchantingBtn
    disenchantingBtn:SetSize(DisenchantingFrame:GetWidth() - 46, 30)
    disenchantingBtn:SetPoint("BOTTOM", DisenchantingFrame, "BOTTOM", 0, 10)
    -- 设置按钮外观
    do
        local texture = disenchantingBtn:CreateTexture()
        texture:SetColorTexture(0.25,0.25,0.27, 1)
        texture:SetAllPoints()
        disenchantingBtn:SetNormalTexture(texture)
    end
    do
        local texture = disenchantingBtn:CreateTexture()
        texture:SetColorTexture(0.36,0.36,0.38,0.5)
        texture:SetAllPoints()
        disenchantingBtn:SetHighlightTexture(texture)
    end
    disenchantingBtn:SetText("分解流拍物品")

	disenchantingBtn:SetNormalFontObject("GameFontNormal")
	disenchantingBtn:SetHighlightFontObject("GameFontHighlight")
	disenchantingBtn:SetDisabledFontObject("GameFontDisable")
    local fontString = disenchantingBtn:GetFontString()
    if fontString then
	    fontString:SetFont(GameFontNormal:GetFont(), 16)
    end
    -- 设置宏命令
    disenchantingBtn:SetAttribute("type", "macro")
    do
        local line = DisenchantingFrame:CreateLine()
        line:SetColorTexture(1, 1, 1, 0.5)
        line:SetStartPoint("BOTTOMLEFT", 0, 20+disenchantingBtn:GetHeight())
        line:SetEndPoint("BOTTOMRIGHT", 0, 20+disenchantingBtn:GetHeight())
        line:SetThickness(1)
    end

    DisenchantingFrame:RegisterEvent("UNIT_SPELLCAST_START")
    DisenchantingFrame:RegisterEvent("UNIT_SPELLCAST_STOP")
    DisenchantingFrame:RegisterEvent("UNIT_SPELLCAST_FAILED")
    DisenchantingFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
    DisenchantingFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
    DisenchantingFrame:RegisterEvent("BAG_UPDATE_DELAYED")
    DisenchantingFrame:SetScript("OnEvent", function (self, event, unitTarget, _, spellID)
        if unitTarget and unitTarget == "player" and spellID and spellID == 13262 then
            if event == "UNIT_SPELLCAST_START" then
                disenchantingBtn:Disable()
                DisenchantingFrame.hasSpellcastSucceeded = nil
                DisenchantingFrame.startDisenchant = true
            elseif event == "UNIT_SPELLCAST_STOP" then
                DisenchantingFrame.startDisenchant = nil
            elseif event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_INTERRUPTED" then
                disenchantingBtn:Enable()
                DisenchantingFrame.hasSpellcastSucceeded = nil
            elseif event == "UNIT_SPELLCAST_SUCCEEDED" then
                DisenchantingFrame.hasSpellcastSucceeded = true
            end
        end
        if event == "BAG_UPDATE_DELAYED" then
            if DisenchantingFrame.hasSpellcastSucceeded then
                C_Timer.After(0.5, function ()
                    DisenchantingFrame:Update()
                    DisenchantingFrame.hasSpellcastSucceeded = nil
                end)
            elseif (not DisenchantingFrame.startDisenchant) and (ZL.DisenchantingFrame and ZL.DisenchantingFrame:IsShown()) then
                DisenchantingFrame:Update()
            end
        end
    end)

    DisenchantingFrame.lgnoreBtn = CreateFrame("Button", nil, DisenchantingFrame)
    local lgnoreBtn = DisenchantingFrame.lgnoreBtn
    lgnoreBtn:SetPoint("TOPLEFT", 3, -5)
    lgnoreBtn:SetSize(20, 20)
    local lgnoreBtnTexture = [[Interface\MONEYFRAME\Arrow-Left-Up.blp]]
    lgnoreBtn:SetNormalTexture(lgnoreBtnTexture)
    lgnoreBtn:SetHighlightTexture(lgnoreBtnTexture)
    lgnoreBtn:SetScript("OnClick", function ()
        if not ZL.DisenchantingLgnoreFrame then ZL:CreateDisenchantingLgnoreFrame() end
        if ZL.DisenchantingLgnoreFrame:IsShown() then
            ZL.DisenchantingLgnoreFrame:Hide()
            lgnoreBtnTexture = [[Interface\MONEYFRAME\Arrow-Left-Up.blp]]
            lgnoreBtn:SetNormalTexture(lgnoreBtnTexture)
            lgnoreBtn:SetHighlightTexture(lgnoreBtnTexture)
        else
            ZL.DisenchantingLgnoreFrame:Show()
            lgnoreBtnTexture = [[Interface\MONEYFRAME\Arrow-Right-Up.blp]]
            lgnoreBtn:SetNormalTexture(lgnoreBtnTexture)
            lgnoreBtn:SetHighlightTexture(lgnoreBtnTexture)
        end
    end)
    lgnoreBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP", 0, 4)
        GameTooltip:AddLine("永久隐藏物品")
        GameTooltip:Show()
    end)
    lgnoreBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    --创建滚动条
    DisenchantingFrame.scrollFrame = CreateFrame("ScrollFrame", nil, DisenchantingFrame, "UIPanelScrollFrameTemplate")
    DisenchantingFrame.scrollFrame:SetFrameLevel(DisenchantingFrame:GetFrameLevel() + 1) -- 设置为比父框架高1级
    DisenchantingFrame.scrollFrame:SetPoint("TOPLEFT", DisenchantingFrame.TitleBottom, "BOTTOMLEFT", 0, -5-hideBtn:GetHeight())
    DisenchantingFrame.scrollFrame:SetPoint("BOTTOMRIGHT", DisenchantingFrame, "BOTTOMRIGHT", 0, 21+disenchantingBtn:GetHeight())
    DisenchantingFrame.scrollFrame:SetClipsChildren(true) --必须设置为true，scrollFrame所有的子元素才会被剪切
    DisenchantingFrame.scrollFrame:SetScript("OnMouseWheel", ZL.ScrollFrame_OnMouseWheel) --重设滑动条鼠标滚轮事件
    --重设ScrollBar位置，放置到scrollFrame内，防止被剪切掉
    DisenchantingFrame.scrollFrame.ScrollBar:ClearAllPoints()
    DisenchantingFrame.scrollFrame.ScrollBar:SetPoint("TOPLEFT", DisenchantingFrame.scrollFrame, "TOPRIGHT", -20, -17)
    DisenchantingFrame.scrollFrame.ScrollBar:SetPoint("BOTTOMRIGHT", DisenchantingFrame.scrollFrame, "BOTTOMRIGHT", 0, 16)
    DisenchantingFrame.scrollFrame.content = CreateFrame("Frame", nil, DisenchantingFrame.scrollFrame)
    local content = DisenchantingFrame.scrollFrame.content
    content:SetPoint("TOPLEFT", DisenchantingFrame.scrollFrame, "TOPLEFT", 0, 0)
    content:SetSize(DisenchantingFrame.scrollFrame:GetWidth()-20, 100)
    DisenchantingFrame.scrollFrame:SetScrollChild(content)
    DisenchantingFrame.scrollFrame.ScrollBar:SetFrameLevel(content:GetFrameLevel()+100)
    local btnWidth = hideBtn:GetWidth() + itemNameBtn:GetWidth() + itemLevelBtn:GetWidth()
    local btnHeight = 16
    DisenchantingFrame.entries = setmetatable({}, {
        __index = function (t, v)
            local f = CreateFrame("Button", nil, content)
            f:SetSize(btnWidth, btnHeight)
            if v == 1 then
                f:SetPoint("TOPLEFT", content, "TOPLEFT", 3, -1)
            else
                f:SetPoint("TOPLEFT", t[v-1], "BOTTOMLEFT")
            end
            do
                local texture = f:CreateTexture()
                texture:SetColorTexture(0, 0, 0, 1)
                texture:SetAllPoints()
                f:SetNormalTexture(texture)
            end
            do
                local texture = f:CreateTexture()
                texture:SetColorTexture(0.36, 0.36, 0.38, 0.8)
                texture:SetAllPoints()
                f:SetHighlightTexture(texture)
            end
            f:SetScript("OnEnter", function(self)
                if not f.itemLink then return end
                local uiScale, x, y = UIParent:GetEffectiveScale(), GetCursorPosition()
                x, y = x/uiScale, y/uiScale
                local screenWidth = GetScreenWidth() / 2
                if x < screenWidth then
                    GameTooltipShow(self, "TOPLEFT", "TOPRIGHT")
                else
                    GameTooltipShow(self, "TOPRIGHT", "TOPLEFT")
                end
                GameTooltip:ClearLines()
                GameTooltip:SetHyperlink(f.itemLink)
                GameTooltip:Show()
                if _G["ShoppingTooltip1"] and _G["ShoppingTooltip1"]:IsShown() then
                    _G["ShoppingTooltip1"]:ClearAllPoints()
                    if x < screenWidth then
                        _G["ShoppingTooltip1"]:SetPoint("TOPLEFT", GameTooltip, "TOPRIGHT", 0, 0)
                    else
                        _G["ShoppingTooltip1"]:SetPoint("TOPRIGHT", GameTooltip, "TOPLEFT", 0, 0)
                    end
                end
                if _G["ShoppingTooltip2"] and _G["ShoppingTooltip2"]:IsShown() then
                    _G["ShoppingTooltip2"]:ClearAllPoints()
                    if x < screenWidth then
                        _G["ShoppingTooltip2"]:SetPoint("TOPLEFT", _G["ShoppingTooltip1"], "TOPRIGHT", 0, 0)
                    else
                        _G["ShoppingTooltip2"]:SetPoint("TOPRIGHT", _G["ShoppingTooltip1"], "TOPLEFT", 0, 0)
                    end
                end
            end)
            f:SetScript("OnLeave", function(self)
                GameTooltip:Hide()
            end)
            f.hideIcon = CreateFrame("Button", nil, f)
            f.hideIcon:SetSize(btnHeight, btnHeight)
            f.hideIcon:SetPoint("LEFT", f, "LEFT", 7, 0)
            f.hideIcon:SetNormalTexture("Interface\\AddOns\\" .. addonName .. "\\Images\\hide.png")
            f.hideIcon:SetHighlightTexture("Interface\\AddOns\\" .. addonName .. "\\Images\\hide.png")
            f.hideIcon:SetScript("OnEnter", function (self)
                GameTooltipShow(self, "RIGHT", "LEFT", -10, 0)
                GameTooltip:AddLine("左键：|cffffffff角色登出或加载UI前隐藏|r\nShift+左键：|cffffffff永久隐藏|r")
                GameTooltip:Show()
            end)
            f.hideIcon:SetScript("OnLeave", function (self)
                GameTooltip:Hide()
            end)
            f.hideIcon:SetScript("OnClick", function (self)
                if not f.itemLink then return end
                local itemId = tonumber(f.itemLink:match("item:(%d+):"))
                if not itemId then return end
                if IsShiftKeyDown() then
                    if not ZL.opt.disenchantingLgnoreList then ZL.opt.disenchantingLgnoreList = {} end
                    ZL.opt.disenchantingLgnoreList[tostring(itemId)] = f.itemLink
                    ZL.DisenchantingLgnoreFrame:Update()
                    ZL.Print("已永久忽略分解，可到左侧隐藏窗口恢复！", true)
                else
                    if not ZL.disenchantingLgnoreList then ZL.disenchantingLgnoreList = {} end
                    ZL.disenchantingLgnoreList[tostring(itemId)] = f.itemLink
                    ZL.Print("已临时忽略分解，重新加载UI后会显示！", true)
                end
                DisenchantingFrame:Update()
            end)
            f.itemIcon = f:CreateTexture(nil, "OVERLAY")
            f.itemIcon:SetSize(13, 13)
            f.itemIcon:SetPoint("LEFT", f.hideIcon, "RIGHT", 7, 0)

            f.itemName = f:CreateFontString(nil, "OVERLAY")
            f.itemName:SetPoint("LEFT", f.itemIcon, "RIGHT", 7, 0)
            f.itemName:SetWidth(itemNameBtn:GetWidth())
            f.itemName:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            f.itemName:SetWordWrap(false)
            f.itemName:SetJustifyH("LEFT")
            
            f.itemLevel = f:CreateFontString(nil, "OVERLAY")
            f.itemLevel:SetPoint("LEFT", f.itemName, "RIGHT", 0, 0)
            f.itemLevel:SetWidth(itemLevelBtn:GetWidth()-3)
            f.itemLevel:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            f.itemLevel:SetWordWrap(false)
            f.itemLevel:SetJustifyH("RIGHT")
            f.itemLevel:SetTextColor(0.95, 0.95, 0.95, 1)
            -- f.itemLevel:SetText(select(4, cGetItemInfo(itemId)))


            t[v] = f
            return f
        end
    })
    function DisenchantingFrame:Update()
        for _, f in ipairs(DisenchantingFrame.entries) do f:Hide() end
        disenchantingBtn:Disable()
        if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
            local index = 1
            local itemId
            for _, data in ipairs(ZL_CURRENT.auctionlist) do
                itemId = data.itemId
                if data.state == "failed" and data.bindType == 1 and data.spawnUID and ((not ZL.disenchantingLgnoreList) or (not ZL.disenchantingLgnoreList[tostring(itemId)]))
                and ((not ZL.opt.disenchantingLgnoreList) or (not ZL.opt.disenchantingLgnoreList[tostring(itemId)])) and (not NON_DISENCHANTABLE_ITEMS[tostring(itemId)]) and ZL.IsDisenchantAble(itemId) then
                    for _, value in pairs(data.spawnUID) do
                        if value.itemGUID and next(value.itemGUID, nil) then
                            for key in pairs(value.itemGUID) do
                                --判断是否在背包
                                local bag, slot = ZL.FindItemInBag(key)
                                if bag then
                                    if index == 1 then
                                        C_Timer.After(0.3, function ()
                                            disenchantingBtn:Enable()
                                            disenchantingBtn:SetAttribute("macrotext", "/施放 分解\n/use " .. bag .. " " .. slot)
                                        end)
                                    end
                                    local f = DisenchantingFrame.entries[index]
                                    local itemlink = data.itemlink
                                    f.itemLink = itemlink
                                    f.itemIcon:SetTexture(cGetItemIcon(itemlink))
                                    f.itemName:SetText(itemlink)
                                    f.itemLevel:SetText(data.itemLevel)
                                    f:Show()
                                    index = index + 1
                                end
                            end
                        end
                    end
                end
            end
        end
    end
end

--创建不分解物品窗口
function ZL:CreateDisenchantingLgnoreFrame()
    ZL.DisenchantingLgnoreFrame = CreateFrame("Frame", nil, ZL.DisenchantingFrame, "BackdropTemplate")
    local DisenchantingLgnoreFrame = ZL.DisenchantingLgnoreFrame
    DisenchantingLgnoreFrame:SetPoint("TOPRIGHT", ZL.DisenchantingFrame, "TOPLEFT", 0, 2)
    DisenchantingLgnoreFrame:SetSize(200, 300)
    DisenchantingLgnoreFrame:SetBackdrop({
        bgFile = "Interface/ChatFrame/ChatFrameBackground",
        edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
        edgeSize = 16,
        insets = { left = 3, right = 3, top = 3, bottom = 3 }
    })
    DisenchantingLgnoreFrame:SetBackdropColor(0, 0, 0, 0.9)
    DisenchantingLgnoreFrame:SetBackdropBorderColor(0.9, 0.9, 0.9)
    DisenchantingLgnoreFrame:SetScript("OnShow", function (self)
        self:Update()
    end)
    DisenchantingLgnoreFrame.fontString = DisenchantingLgnoreFrame:CreateFontString(nil, "OVERLAY")
    DisenchantingLgnoreFrame.fontString:SetPoint("TOPLEFT", DisenchantingLgnoreFrame, "TOPLEFT", 10, -10)
    DisenchantingLgnoreFrame.fontString:SetWidth(DisenchantingLgnoreFrame:GetWidth() - 20)
    DisenchantingLgnoreFrame.fontString:SetFont(GameFontNormal:GetFont(), 14, "OUTLINE")
    DisenchantingLgnoreFrame.fontString:SetWordWrap(false)
    DisenchantingLgnoreFrame.fontString:SetJustifyH("LEFT")
    DisenchantingLgnoreFrame.fontString:SetText("右键：恢复显示")
    DisenchantingLgnoreFrame:Hide()
    --创建滚动条
    DisenchantingLgnoreFrame.scrollFrame = CreateFrame("ScrollFrame", nil, DisenchantingLgnoreFrame, "UIPanelScrollFrameTemplate")
    DisenchantingLgnoreFrame.scrollFrame:SetFrameLevel(DisenchantingLgnoreFrame:GetFrameLevel() + 1) -- 设置为比父框架高1级
    DisenchantingLgnoreFrame.scrollFrame:SetPoint("TOPLEFT", DisenchantingLgnoreFrame, "TOPLEFT", 5, -20 - DisenchantingLgnoreFrame.fontString:GetHeight())
    DisenchantingLgnoreFrame.scrollFrame:SetPoint("BOTTOMRIGHT", DisenchantingLgnoreFrame, "BOTTOMRIGHT", 0, 3)
    DisenchantingLgnoreFrame.scrollFrame:SetClipsChildren(true) --必须设置为true，scrollFrame所有的子元素才会被剪切
    DisenchantingLgnoreFrame.scrollFrame:SetScript("OnMouseWheel", ZL.ScrollFrame_OnMouseWheel) --重设滑动条鼠标滚轮事件
    
    --重设ScrollBar位置，放置到scrollFrame内，防止被剪切掉
    DisenchantingLgnoreFrame.scrollFrame.ScrollBar:ClearAllPoints()
    DisenchantingLgnoreFrame.scrollFrame.ScrollBar:SetPoint("TOPLEFT", DisenchantingLgnoreFrame.scrollFrame, "TOPRIGHT", -22, -17)
    DisenchantingLgnoreFrame.scrollFrame.ScrollBar:SetPoint("BOTTOMRIGHT", DisenchantingLgnoreFrame.scrollFrame, "BOTTOMRIGHT", -2, 17)
    DisenchantingLgnoreFrame.scrollFrame.content = CreateFrame("Frame", nil, DisenchantingLgnoreFrame.scrollFrame)
    local content = DisenchantingLgnoreFrame.scrollFrame.content
    content:SetPoint("TOPRIGHT", DisenchantingLgnoreFrame.scrollFrame, "TOPRIGHT", 0, 0)
    content:SetSize(DisenchantingLgnoreFrame.scrollFrame:GetWidth()-20, 100)
    DisenchantingLgnoreFrame.scrollFrame:SetScrollChild(content)
    DisenchantingLgnoreFrame.scrollFrame.ScrollBar:SetFrameLevel(content:GetFrameLevel()+100)
    local contentWidth = content:GetWidth()
    DisenchantingLgnoreFrame.entries = setmetatable({}, {
        __index = function (t, v)
            local f = CreateFrame("Button", nil, content)
            f:SetSize(contentWidth, 20)
            if v == 1 then
                f:SetPoint("TOPLEFT", content, "TOPLEFT", 0, 0)
            else
                f:SetPoint("TOPLEFT", t[v-1], "BOTTOMLEFT", 0, 0)
            end
            f:SetNormalFontObject("GameFontNormal")
            f:SetHighlightFontObject("GameFontHighlight")
            f:SetText(" ")
            local font = f:GetFontString()
            if font then
                font:SetPoint("LEFT", 5, 0)
                font:SetTextColor(1, 0.82, 0)
            end
            f:SetHighlightTexture([[Interface\QuestFrame\UI-QuestLogTitleHighlight]])
            f:SetScript("OnEnter", function (self)
                if not f.itemLink then return end
                local uiScale, x, y = UIParent:GetEffectiveScale(), GetCursorPosition()
                x, y = x/uiScale, y/uiScale
                local screenWidth = GetScreenWidth() / 2
                if x < screenWidth then
                    GameTooltipShow(self, "TOPLEFT", "TOPRIGHT")
                else
                    GameTooltipShow(self, "TOPRIGHT", "TOPLEFT")
                end
                GameTooltip:ClearLines()
                GameTooltip:SetHyperlink(f.itemLink)
                GameTooltip:Show()
                if _G["ShoppingTooltip1"] and _G["ShoppingTooltip1"]:IsShown() then
                    _G["ShoppingTooltip1"]:ClearAllPoints()
                    if x < screenWidth then
                        _G["ShoppingTooltip1"]:SetPoint("TOPLEFT", GameTooltip, "TOPRIGHT", 0, 0)
                    else
                        _G["ShoppingTooltip1"]:SetPoint("TOPRIGHT", GameTooltip, "TOPLEFT", 0, 0)
                    end
                end
                if _G["ShoppingTooltip2"] and _G["ShoppingTooltip2"]:IsShown() then
                    _G["ShoppingTooltip2"]:ClearAllPoints()
                    if x < screenWidth then
                        _G["ShoppingTooltip2"]:SetPoint("TOPLEFT", _G["ShoppingTooltip1"], "TOPRIGHT", 0, 0)
                    else
                        _G["ShoppingTooltip2"]:SetPoint("TOPRIGHT", _G["ShoppingTooltip1"], "TOPLEFT", 0, 0)
                    end
                end
            end)
            f:SetScript("OnLeave", function ()
                GameTooltip:Hide()
            end)
            f:RegisterForClicks("RightButtonUp")
            f:SetScript("OnClick", function (self)
                if f.itemId and ZL.opt.disenchantingLgnoreList then
                    ZL.opt.disenchantingLgnoreList[tostring(f.itemId)] = nil
                    ZL.DisenchantingFrame:Update()
                    DisenchantingLgnoreFrame:Update()
                end
            end)
            t[v] = f
            return f
        end
    })

    function DisenchantingLgnoreFrame:Update()
        for _, f in ipairs(DisenchantingLgnoreFrame.entries) do
            f:Hide()
        end
        local index = 1
        if ZL.opt.disenchantingLgnoreList and next(ZL.opt.disenchantingLgnoreList) then
            for itemId, itemLink in pairs(ZL.opt.disenchantingLgnoreList) do
                local f = DisenchantingLgnoreFrame.entries[index]
                f:SetText(itemLink)
                f.itemId = itemId
                f.itemLink = itemLink
                f:Show()
                index = index + 1
            end
        end
        content:SetHeight(index*20)
        DisenchantingLgnoreFrame:SetHeight(ZL.DisenchantingFrame:GetHeight()+5)
    end
end

--ZL主界面更新监控ML是否掉线，如掉线暂停所有正在拍卖的物品
function ZL:FrameUpdate()
    self:SetScript("OnUpdate", function (self)
        if IsInRaid(1) and ZL_CURRENT.MLname and ZL_CURRENT["auctionlist"] and #ZL_CURRENT["auctionlist"] > 0 then
            if (not UnitIsConnected(ZL_CURRENT.MLname)) then
                for index, data in ipairs(ZL_CURRENT["auctionlist"]) do
                    if data.state == "auctioning" and (not data.isPaused) then
                        ZL_CURRENT["auctionlist"][index]["isPaused"] = true
                        ZL_CURRENT["auctionlist"][index]["isPausedLinshi"] = true
                        local f = ZL.AuctionFrame2.entries[index]
                        f:SetValues(index)
                    end
                end
            else
                for index, data in ipairs(ZL_CURRENT["auctionlist"]) do
                    if data.state == "auctioning" and data.isPaused and data.isPausedLinshi then
                        ZL_CURRENT["auctionlist"][index]["isPaused"] = false
                        ZL_CURRENT["auctionlist"][index]["isPausedLinshi"] = nil
                        local f = ZL.AuctionFrame2.entries[index]
                        f:SetValues(index)
                    end
                end
            end
        end
    end)
end