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 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 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)

    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.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()
        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 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
                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, "拍卖清单")
    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() 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)
    if ZL.opt.auctionMode == "团队" then
        auctionModeDropdown:SetValue(1)
    elseif ZL.opt.auctionMode == "|cff00ff00明拍|r" then
        auctionModeDropdown:SetValue(2)
    elseif ZL.opt.auctionMode == "|cffff0000匿名|r" then
        auctionModeDropdown:SetValue(3)
    end
    auctionModeDropdown:SetCallback('OnSelectChanged', function ()
        local msgStr
        if PlayerIsML() then
            local addonVersion, WAVersion = 2201, 1101
            local function satisfyNumbers()
                local totalMembers = 0
                local hasAddon = 0
                if ZL_CURRENT.GroupMembersVersion and next(ZL_CURRENT.GroupMembersVersion) and IsInRaid() then
                    for i = 1, MAX_RAID_MEMBERS do
                        local name, _, _, _, _, _, _, online = GetRaidRosterInfo(i)
                        if name and online then
                            totalMembers = totalMembers + 1
                            local playerVer = ZL_CURRENT.GroupMembersVersion[name]
                            if playerVer then
                                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
            local auctionMode = auctionModeDropdown:GetText()
            if auctionMode == "团队" then
                ZL.opt.auctionMode = auctionMode
                ZL.TransmitAddonInfo_Pro()
                if IsInRaid() then
                    msgStr = "已切换为【".. auctionMode .. "】拍卖模式！"
                    ZL.Print(nil, nil, nil, nil, nil, 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() then
                                msgStr = "已切换为插件【" .. auctionMode .. "】模式！未安装插件或拍卖WA字符串的无法参与竞拍"
                                ZL.Print(nil, nil, nil, nil, nil, msgStr)
                                SendChatMessage("已切换为插件【明拍】模式！未安装插件或WA字符串的无法参与竞拍", "RAID")
                            end
                        end
                    else
                        msgStr = "存在未安装或版本过低的插件(要求V2.2.01及以上)\n或拍卖WA字符串(要求WA-V1.2.01及以上)，无法使用【" .. auctionMode .. "】拍卖模式！"
                        ZL.Print(nil, nil, 1, 0, 0, msgStr)
                        auctionModeDropdown:SetValue(1)
                    end
                else
                    msgStr = "不在团队中，无法使用【" .. auctionMode .. "】拍卖模式！"
                    ZL.Print(nil, nil, nil, nil, nil, msgStr)
                    auctionModeDropdown:SetValue(1)
                end
            end
        else
            msgStr = "ML功能，设置无效！"
            ZL.Print(nil, nil, 1, 0, 0, msgStr)
            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 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: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 data.state == "waiting" and (not data.lgnore) and (not data.isPackage) and data.bindType == 1 then
                    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(31)
    MLFrame:SetScript("OnMouseUp", function (self)
        AuctionFrame:StopMovingOrSizing()
    end)
    MLFrame:SetScript("OnMouseDown", function (self)
        AuctionFrame:StartMoving()
    end)
    MLFrame.recordBtn = CreateButton(nil, MLFrame, " ", "TOPLEFT", MLFrame, "TOPLEFT", 1, -5, 25, 25)
    local recordBtn = MLFrame.recordBtn
    recordBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    do
        local texture = [[Interface\Buttons\UI-GuildButton-PublicNote-Up.blp]]
        recordBtn:SetNormalTexture(texture)
        recordBtn:SetHighlightTexture(texture)
    end
    recordBtn:SetScript("OnEnter", function (self)
        local numGroupMembers, RLBuTie, totalincome, totalpayout, totalamount, averageamount = ZL.GetAveWages()
        if not numGroupMembers then return end
        local playerBuyList = ZL.GetPlayerBuyList()
        local uiScale, x, y = UIParent:GetEffectiveScale(), GetCursorPosition()
        x, y = x/uiScale, y/uiScale
        local screenWidth = GetScreenWidth() / 2
        do
            if x < screenWidth then
                GameTooltipShow(recordBtn, "LEFT", "LEFT", AuctionFrame:GetWidth(), 0)
            else
                GameTooltipShow(recordBtn, "RIGHT", "LEFT", -3, 0)
            end
            
            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 " ")
            else
                GameTooltip:AddLine("当前没有收入记录！")
            end
            GameTooltip:Show()
        end
        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 x < screenWidth then
                _G["xiaoFeiToolTip"]:SetPoint("TOPLEFT", GameTooltip, "TOPRIGHT", 0, 0)
            else
                _G["xiaoFeiToolTip"]:SetPoint("TOPRIGHT", GameTooltip, "TOPLEFT", 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
            if not ZL.opt.recordShortcutTipHide then
                _G["debtToolTip"]:AddLine("-----------------------", 1, 1, 1)
                _G["debtToolTip"]:AddLine("快捷键")
                _G["debtToolTip"]:AddDoubleLine("左键：", "打开收支窗口", nil, nil, nil, 1, 1, 1)
                _G["debtToolTip"]:AddDoubleLine("右键：", "打开工资窗口", nil, nil, nil, 1, 1, 1)
                if PlayerIsML() then
                    _G["debtToolTip"]:AddDoubleLine("Shift+左键：", "通报详细收支", nil, nil, nil, 1, 1, 1)
                    _G["debtToolTip"]:AddDoubleLine("Shift+右键", "通报小队工资", nil, nil, nil, 1, 1, 1)
                    _G["debtToolTip"]:AddDoubleLine("Ctrl+左键：", "通报欠款名单", nil, nil, nil, 1, 1, 1)
                    _G["debtToolTip"]:AddDoubleLine("Ctrl+右键：", "全部登记邮寄", nil, nil, nil, 1, 1, 1)
                    _G["debtToolTip"]:AddDoubleLine("Alt+左键：", "通报消费排名", nil, nil, nil, 1, 1, 1)
                end
            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
    end)
    recordBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
        if ZL.debtToolTip then ZL.debtToolTip:Hide() end
        if ZL.xiaoFeiToolTip then ZL.xiaoFeiToolTip:Hide() end
    end)
    recordBtn:SetScript("OnClick", function (self, button)
        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(nil, nil, nil, nil, nil, 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, 10)
                        end
                        wipe(msglist)
                    end
                    index = index + 1
                    C_Timer.After(0.3, sendMessage)
                end
            end
            sendMessage()
        end
        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
        if button == "LeftButton" then
            if (not IsModifierKeyDown()) then
                --打开收支窗口
                ZL.AuctionRecordFrame:Show()
                _G["ZLAuctionRecordFrameTab2"]:Click()
            elseif IsShiftKeyDown() and (not IsControlKeyDown()) and (not IsAltKeyDown()) then
                statistics()
                --Shift+左键：通报详细收支+小队工资
                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(nil, nil, nil, nil, nil, 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
            elseif (not IsShiftKeyDown()) and IsControlKeyDown() and (not IsAltKeyDown()) then
                --Ctrl+左键：通报欠款名单
                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(nil, nil, nil, nil, nil, msgStr)
                    end
                end
            elseif (not IsShiftKeyDown()) and (not IsControlKeyDown()) and IsAltKeyDown() then
                --Alt+左键：通报消费排名
                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()
                end
            end
        elseif button == "RightButton" then
            if (not IsModifierKeyDown()) then
                --打开工资窗口
                ZL.AuctionRecordFrame:Show()
                _G["ZLAuctionRecordFrameTab3"]:Click()
            elseif IsShiftKeyDown() and (not IsControlKeyDown()) and (not IsAltKeyDown()) then
                statistics()
                --Shift+右键：通报小队工资
                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
            elseif (not IsShiftKeyDown()) and IsControlKeyDown() and (not IsAltKeyDown()) then
                --Ctrl+右键：全部登记邮寄
                if (not ZL_CURRENT["mailPlayers"]) then ZL_CURRENT["mailPlayers"] = {} end
                --为当前团队名单时，保存一次名单
                if ZL.opt.wagesGroupMembers == 0 then MLFrame.SaveBtn:Click() 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())
                    C_VoiceChat.SpeakText(C_TTSSettings.GetVoiceOptionID(0), msgStr, 1, 3, 100)
                    ZL.Print(nil, nil, nil, nil, nil, msgStr)
                else
                    msgStr = "没有需要邮寄的成员！"
                    ZL.Print(nil, nil, nil, nil, nil, msgStr)
                end
            elseif (not IsShiftKeyDown()) and (not IsControlKeyDown()) and IsAltKeyDown() then
                --Alt+右键：待定

            end
        end
    end
    )

    MLFrame.auctionRules = CreateButton(nil, MLFrame, " ", "LEFT", recordBtn, "RIGHT", 0, 0, 25, 25, 15)
    local auctionRules = MLFrame.auctionRules
    auctionRules.BorderLeft:Hide()
    do
        local texture = "Interface\\AddOns\\" .. addonName .. "\\Images\\rules.png"
        auctionRules:SetNormalTexture(texture)
        auctionRules:SetHighlightTexture(texture)
    end
    auctionRules:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    auctionRules:SetScript("OnEnter", function (self)
        local uiScale, x, y = UIParent:GetEffectiveScale(), GetCursorPosition()
        x, y = x/uiScale, y/uiScale
        local screenWidth = GetScreenWidth() / 2
        if x < screenWidth then
            GameTooltipShow(recordBtn, "LEFT", "LEFT", AuctionFrame:GetWidth(), 0)
        else
            GameTooltipShow(recordBtn, "RIGHT", "LEFT", -3, 0)
        end
        GameTooltip:AddLine("拍卖规则：")
        if PlayerIsML() then
            if ZL.opt.rulesString 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 _, msg in ipairs(announceStrings) do
                    GameTooltip:AddLine(msg, 1, 1, 1)
                end
                announceStrings:Release()
            else
                GameTooltip:AddLine("未添加拍卖规则，请先添加！", 1, 1, 1)
            end
            GameTooltip:AddLine("   ")
        end
        GameTooltip:AddLine("左键：|cffffffff发送到团队|r(ML功能)")
        GameTooltip:AddLine("右键：|cffffffff修改规则|r")
        GameTooltip:Show()
    end)
    auctionRules:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)
    auctionRules:SetScript("OnClick", function (self, button)
        if button == "LeftButton" then
            if not PlayerIsML() then
                local msgStr = "你不是ML，无法使用这个功能！"
                ZL.Print(nil, nil, nil, nil, nil, msgStr)
                return
            end
            if ZL.opt.rulesString 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.OpenAceConfigDialog("金团拍卖助手")
            end
        elseif button == "RightButton" then
            ZL.OpenAceConfigDialog("金团拍卖助手", "notification")
        end
    end)

    MLFrame.syncAllBtn = CreateButton(nil, MLFrame, " ", "LEFT", auctionRules, "RIGHT", 0, 0, 25, 25, 15)
    local syncAllBtn = MLFrame.syncAllBtn
    syncAllBtn.BorderLeft:Hide()
    do
        local texture = "Interface\\AddOns\\" .. addonName .. "\\Images\\sync.png"
        syncAllBtn:SetNormalTexture(texture)
        syncAllBtn:SetHighlightTexture(texture)
    end
    syncAllBtn:SetScript("OnEnter", function (self)
        local uiScale, x, y = UIParent:GetEffectiveScale(), GetCursorPosition()
        x, y = x/uiScale, y/uiScale
        local screenWidth = GetScreenWidth() / 2
        if x < screenWidth then
            GameTooltipShow(recordBtn, "LEFT", "LEFT", AuctionFrame:GetWidth(), 0)
        else
            GameTooltipShow(recordBtn, "RIGHT", "LEFT", -3, 0)
        end
        GameTooltip:AddLine("同步数据")
        if PlayerIsML() then
            GameTooltip:AddLine("全团成员同步ML当前所有拍卖数据！", 1, 1, 1)
            GameTooltip:AddLine("因API限制，10秒同步一次", 1, 1, 1)
            GameTooltip:AddLine("同步数据的时候不要重载UI，否则无法发送数据", 1, 0, 0)
            GameTooltip:AddLine("使用场景：")
            GameTooltip:AddLine("1、当ML掉线后造成大量数据与其他成员不同步", 1, 1, 1)
            GameTooltip:AddLine("2、将数据同步给其它成员，防止游戏意外崩溃数据丢失", 1, 1, 1)
        else
            GameTooltip:AddLine("同步ML当前所有拍卖数据！", 1, 1, 1)
            GameTooltip:AddLine("因API限制，10秒同步一次", 1, 1, 1)
            GameTooltip:AddLine("同步数据的时候不要重载UI，否则无法接收到数据", 1, 0, 0)
        end
        GameTooltip:Show()
    end)
    syncAllBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)
    syncAllBtn:SetScript("OnClick", function (self)
        local msgStr
        if PlayerIsML() then
            if IsInRaid() then
                if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
                    if GetAuctioningCount() == 0 then
                        local data = {
                            ["type"] = "all",
                            ["data"] = ZL_CURRENT,
                        }
                        MyAddon:SYNCALL(data)
                        msgStr = "数据同步中，请勿加载UI！"
                        self:Disable()
                        C_Timer.After(10, function ()
                            self:Enable()
                        end)
                    else
                        msgStr = "存在拍卖中的物品，请先取消再同步！"
                    end
                else
                    msgStr = "没有拍卖数据需要同步"
                end
            else
                msgStr = "不在团队中，无法同步数据"
            end
            if msgStr then
                ZL.Print(nil, nil, nil, nil, nil, msgStr)
            end
        else
            if IsInRaid() then
                msgStr = "已发送同步拍卖数据请求，等待回应..."
                ZL.Print(nil, nil, nil, nil, nil, msgStr)
                MyAddon:TransmitAddonInfo2("AUTOAUC REQ", "同步拍卖数据", "WHISPER", ZL.GetMLname())
                self:Disable()
                C_Timer.After(10, function ()
                    self:Enable()
                end)
            else
                msgStr = "不在团队中，无法同步数据"
                ZL.Print(nil, nil, nil, nil, nil, msgStr)
            end
        end
    end)

    MLFrame.failedBtn = CreateButton(nil, MLFrame, " ", "LEFT", syncAllBtn, "RIGHT", 0, 0, 25, 25, 15)
    local failedBtn = MLFrame.failedBtn
    failedBtn.BorderLeft:Hide()
    do
        local texture = [[Interface\COMMON\icon-noloot.blp]]
        failedBtn:SetNormalTexture(texture)
        failedBtn:SetHighlightTexture(texture)
    end
    failedBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    failedBtn:SetScript("OnClick", function (self, button)
        local msgStr = ""
        local msglist = {}
        if button == "LeftButton" then
            if not PlayerIsML() then
                msgStr = "你不是ML，无法使用这个功能！"
                ZL.Print(nil, nil, nil, nil, nil, msgStr)
                return
            end
            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 = "没有拍卖记录！"
                SendChatMessage(msgStr, "RAID")
            end
            if IsShiftKeyDown() 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(1, 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
                                    end)
                                end
                            end
                            linshi()
                            index = index + 1
                            C_Timer.After(0.5, changeBag)
                        end
                    end
                    changeBag()
                else
                    msgStr = "背包里没有流拍物品！"
                    ZL.Print(nil, nil, nil, nil, nil, msgStr)
                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")
                            C_VoiceChat.SpeakText(C_TTSSettings.GetVoiceOptionID(0), msgStr, 1, 3, 100)
                            msgStr = "如有流拍未通报的可能是：已分解或已无法交易或不在背包。"
                            SendChatMessage(msgStr, "RAID")
                        end)
                    end)
                else
                    msgStr = "包里没有可交易的流拍物品，可能已分解、过期或不在背包！"
                    SendChatMessage(msgStr, "RAID")
                end
            end
        elseif button == "RightButton" then
            if not PlayerIsML() then
                msgStr = "你不是ML，无法使用这个功能！"
                ZL.Print(nil, nil, nil, nil, nil, msgStr)
                return
            end
            iconHeaderBtn.checkBtn:SetChecked(false)
            local bathFailedList = {}
            local failedItemGUIDList = {}
            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 f.infoFrame.checkBtn:GetChecked() then
                        table.insert(bathFailedList, data)
                        if data.itemCount == 1 then
                            table.insert(msglist, data.itemlink .. "(" .. data.startbidamount .. ")")
                        else
                            table.insert(msglist, data.itemlink .. "(" .. data.startbidamount .. "x" .. data.itemCount .. ")")
                        end
                        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
                        f.infoFrame.checkBtn:SetChecked(false)
                    end
                end
            end
            if #bathFailedList > 0 then
                local data = {
                    ["type"] = "bathFailed",
                    ["data"] = bathFailedList,
                }
                MyAddon:SYNCALL(data)
                msgStr = "{rt6}批量流拍物品如下{rt6}"
                SendChatMessage(msgStr, "RAID")
                C_Timer.After(0.3, function ()
                    for _, itemlink in ipairs(msglist) do
                        SendChatMessage(itemlink, "RAID")
                    end
                    C_Timer.After(0.3, function ()
                        msgStr = "{rt6}以上物品已批量流拍，如有需要请在团队频道发物品链接+出价{rt6}"
                        SendChatMessage(msgStr, "RAID")
                    end)
                end)
                --将流拍物品放到指定背包
                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(1, 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
                                end)
                            end
                        end
                        linshi()
                        index = index + 1
                        C_Timer.After(1, changeBag)
                    end
                end
                changeBag()
            else
                msgStr = "没有需要批量流拍的物品！"
                ZL.Print(nil, nil, nil, nil, nil, msgStr)
            end
        end
    end)
    failedBtn:SetScript("OnEnter", function (self)
        local uiScale, x, y = UIParent:GetEffectiveScale(), GetCursorPosition()
        x, y = x/uiScale, y/uiScale
        local screenWidth = GetScreenWidth() / 2
        if x < screenWidth then
            GameTooltipShow(recordBtn, "LEFT", "LEFT", AuctionFrame:GetWidth(), 0)
        else
            GameTooltipShow(recordBtn, "RIGHT", "LEFT", -3, 0)
        end
        GameTooltip:AddLine("流拍功能(ML功能)")
        GameTooltip:AddLine("左键：|cffffffff流拍通报|r")
        GameTooltip:AddLine("1、不在背包的不通报", 1, 1, 1)
        GameTooltip:AddLine("2、超过交易时间了的不通报", 1, 1, 1)
        GameTooltip:AddLine("3、分解了的不通报", 1, 1, 1)
        GameTooltip:AddLine("----------------------")
        GameTooltip:AddLine("右键：|cffffffff批量流拍待拍卖物品|r")
        GameTooltip:AddLine("　　　不含忽略和装绑物品", 1, 1, 1)
        GameTooltip:AddLine("Shift+左键：|cffffffff将流拍物品放到指定背包|r")
        GameTooltip:AddLine("注意：|cffffffff调整物品的时候不要点鼠标，\n否则会移动失败|r")
        GameTooltip:Show()
    end)
    failedBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    MLFrame.disenchantingBtn = CreateButton(nil, MLFrame, " ", "LEFT", failedBtn, "RIGHT", 0, 0, 25, 25, 15)
    local disenchantingBtn = MLFrame.disenchantingBtn
    disenchantingBtn.BorderLeft:Hide()
    disenchantingBtn:SetNormalTexture(132853)
    disenchantingBtn:SetScript("OnClick", function (self)
        if not ZL.DisenchantingFrame then ZL:CreateDisenchantingFrame() end
        ZL.DisenchantingFrame:Show()
        if not ZL.DisenchantingLgnoreFrame then ZL:CreateDisenchantingLgnoreFrame() end
    end)
    disenchantingBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP", -0, 0)
        GameTooltip:AddLine("分解流拍物品")
        GameTooltip:AddLine("装绑物品不会分解", 1, 1, 1)
        GameTooltip:Show()
    end)
    disenchantingBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    MLFrame.addAuctionBtn = CreateButton(nil, MLFrame, " ", "LEFT", disenchantingBtn, "RIGHT", 0, 0, 25, 25, 15)
    local addAuctionBtn = MLFrame.addAuctionBtn
    addAuctionBtn.BorderLeft:Hide()
    do
        local texture = "Interface\\AddOns\\" .. addonName .. "\\Images\\new.png"
        addAuctionBtn:SetNormalTexture(texture)
        addAuctionBtn:SetHighlightTexture(texture)
    end
    addAuctionBtn:SetScript("OnClick", function ()
        if not PlayerIsML() then
            local msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            return
        end
        StaticPopup_Show("ZL_ADDAUCTIONITEM")
    end)
    addAuctionBtn:SetScript("OnEnter", function (self)
        local uiScale, x, y = UIParent:GetEffectiveScale(), GetCursorPosition()
        x, y = x/uiScale, y/uiScale
        local screenWidth = GetScreenWidth() / 2
        if x < screenWidth then
            GameTooltipShow(recordBtn, "LEFT", "LEFT", AuctionFrame:GetWidth(), 0)
        else
            GameTooltipShow(recordBtn, "RIGHT", "LEFT", -3, 0)
        end
        GameTooltip:AddLine("手动创建拍卖物品")
        GameTooltip:AddLine("没被自动检测到的物品", 1, 1, 1)
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("方法：")
        GameTooltip:AddLine("|cffffffff1、|rCtr+右键|cffffffff点击背包物品自动创建|r")
        GameTooltip:AddLine("|cffffffff2、|rCtr+右键|cffffffff点击聊天窗口物品链接自动创建|r")
        GameTooltip:AddLine("3、直接点击按钮创建", 1, 1, 1)
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("|cffff0000注意：手动创建的拍卖，无法识别可交易名单，都可以参与竞拍！|r")
        GameTooltip:Show()
    end)
    addAuctionBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    MLFrame.reset = CreateButton(nil, MLFrame, " ", "LEFT", addAuctionBtn, "RIGHT", 0, 0, 25, 25, 15)
    local reset = MLFrame.reset
    reset.BorderLeft:Hide()
    do
        local texture = "Interface\\AddOns\\" .. addonName .. "\\Images\\reset.png"
        reset:SetNormalTexture(texture)
        reset:SetHighlightTexture(texture)
    end
    reset:SetScript("OnClick", function (self)
        --"您确定要重置当前拍卖记录么？确定将清空当前拍卖记录，并保存到历史记录中！"
        if (not ZL_CURRENT.auctionlist) or (#ZL_CURRENT.auctionlist == 0) then
            local msgStr = "当前没有拍卖物品记录！"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            ZL_CURRENT = {}
            ZL_PLAYERLIST = {}
            auctionModeDropdown:SetValue(1)
            --获取团队版本号
            local data = {type="request", ver=ZL.addonVersion}
            MyAddon:TransmitAddonInfo2("AUTOAUC VER", data, "RAID")
        else
            local msgStr = "你确定要重置当前拍卖物品记录么？重置将清空当前拍卖记录，并保存到历史记录中（可恢复）！"
            if ZL_CURRENT.name then
                msgStr = msgStr .. "\n\n请为当前拍卖记录输入一个名字\n(不输入将使用当前名字：|cffffd100" .. ZL_CURRENT.name .. "|r)："
            else
                msgStr = msgStr .. "\n\n请为当前拍卖记录输入一个名字\n"
            end
            StaticPopup_Show("ZL_RESETCURRENT", msgStr)
        end
        if PlayerIsML() then
            MyAddon:TransmitAddonInfo("AUTOAUC RESET", "重置")
        end
    end)
    reset:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("重置：")
        if PlayerIsML() then
            GameTooltip:AddLine("1、将全团人员当前拍卖数据保存为历史数据", 1, 1, 1)
            GameTooltip:AddLine("2、开始一个新的副本拍卖记录", 1, 1, 1)
            GameTooltip:AddLine("3、如果重置错了，可以到历史数据中恢复到当前", 1, 1, 1)
        else
            GameTooltip:AddLine("将当前拍卖数据保存为历史数据", 1, 1, 1)
        end
        GameTooltip:Show()
    end)
    reset:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    MLFrame.add = CreateButton(nil, MLFrame, " ", "LEFT", reset, "RIGHT", 0, 0, 25, 25, 15)
    local add = MLFrame.add
    add.BorderLeft:Hide()
    do
        local texture = "Interface\\AddOns\\" .. addonName .. "\\Images\\add.png"
        add:SetNormalTexture(texture)
        add:SetHighlightTexture(texture)
    end
    add:SetScript("OnClick", function (self)
        if not PlayerIsML() then
            local msgStr = "你不是ML，无法使用这个功能！"
            ZL.ScrollingMessageFrame:AddMessage(msgStr)
            return
        end
        local data = {
            ["type"] = "收入"
        }
        StaticPopup_Show("ZL_ADDINCOME", "收入", nil, data)
    end)
    add:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("手动录入|cffffd100【收入】|r(ML功能)", 1, 1, 1)
        GameTooltip:AddLine("如：罚款，手动拍卖收入等", 1, 1, 1)
        GameTooltip:Show()
    end)
    add:SetScript("OnLeave", function (self) GameTooltip:Hide() end)


    MLFrame.rem = CreateButton(nil, MLFrame, " ", "LEFT", add, "RIGHT", 0, 0, 25, 25, 15)
    local rem = MLFrame.rem
    rem.BorderLeft:Hide()
    do
        local texture = "Interface\\AddOns\\" .. addonName .. "\\Images\\rem.png"
        rem:SetNormalTexture(texture)
        rem:SetHighlightTexture(texture)
    end
    rem:SetScript("OnClick", function (self)
        if not PlayerIsML() then
            local msgStr = "你不是ML，无法使用这个功能！"
            ZL.ScrollingMessageFrame:AddMessage(msgStr)
            return
        end
        local data = {
            ["type"] = "支出"
        }
        StaticPopup_Show("ZL_ADDINCOME", "支出", nil, data)
    end)
    rem:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("手动录入|cffffd100【支出】|r(ML功能)", 1, 1, 1)
        GameTooltip:AddLine("如：额外补贴等支出", 1, 1, 1)
        GameTooltip:Show()
    end)
    rem:SetScript("OnLeave", function (self) GameTooltip:Hide() end)

    MLFrame.RemainingTradeTimeBtn = CreateButton(nil, MLFrame, " ", "LEFT", rem, "RIGHT", 0, 0, 25, 25, 15)
    local RemainingTradeTimeBtn = MLFrame.RemainingTradeTimeBtn
    RemainingTradeTimeBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    RemainingTradeTimeBtn.BorderLeft:Hide()
    do
        local texture = "Interface\\AddOns\\" .. addonName .. "\\Images\\remain.png" --remain.png
        RemainingTradeTimeBtn:SetNormalTexture(texture)
        RemainingTradeTimeBtn:SetHighlightTexture(texture)
    end
    RemainingTradeTimeBtn:SetScript("OnClick", function (self, button)
        if not PlayerIsML() then
            local msgStr = "你不是ML，无法使用这个功能！"
            ZL.ScrollingMessageFrame:AddMessage(msgStr)
            return
        end
        if button == "LeftButton" then
            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
        elseif button == "RightButton" then
            if not ZL.WaLoadStateFrame then
                ZL:CreateWaLoadStateFrame()
            else
                if ZL.WaLoadStateFrame:IsShown() then
                    ZL.WaLoadStateFrame:Hide()
                else
                    ZL.WaLoadStateFrame:Show()
                end
            end
        end
    end)
    RemainingTradeTimeBtn:SetScript("OnEnter", function (self)
        local uiScale, x, y = UIParent:GetEffectiveScale(), GetCursorPosition()
        x, y = x/uiScale, y/uiScale
        local screenWidth = GetScreenWidth() / 2
        if x < screenWidth then
            GameTooltipShow(recordBtn, "LEFT", "LEFT", AuctionFrame:GetWidth(), 0)
        else
            GameTooltipShow(recordBtn, "RIGHT", "LEFT", -3, 0)
        end
        if PlayerIsML() then
            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("没有交易剩余时间的装备！(ML功能)")
            end
            GameTooltip:AddLine(" ")
            GameTooltip:AddLine("左键：|cffffffff打开/隐藏交易剩余时间界面|r")
            GameTooltip:AddLine("右键：|cffffffff打开/隐藏拍卖WA发送状态窗口|r")
            wipe(RemainingTradeItems)
        else
            GameTooltip:AddLine("此功能为ML功能")
        end
        GameTooltip:Show()
    end)
    RemainingTradeTimeBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    MLFrame.SaveBtn = CreateButton(nil, MLFrame, " ", "LEFT", RemainingTradeTimeBtn, "RIGHT", 0, 0, 25, 25, 15)
    local SaveBtn = MLFrame.SaveBtn
    SaveBtn.BorderLeft:Hide()
    do
        local texture = "Interface\\AddOns\\" .. addonName .. "\\Images\\save.png"
        SaveBtn:SetNormalTexture(texture)
        SaveBtn:SetHighlightTexture(texture)
    end
    SaveBtn:SetScript("OnClick", function (self)
        if not PlayerIsML() then
            local msgStr = "你不是ML，无法使用这个功能！"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            return
        end
        local msgStr = ""
        if IsInGroup() then
            self:Disable()
            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
            C_VoiceChat.SpeakText(C_TTSSettings.GetVoiceOptionID(0), "团队名单保存成功！", 1, 3, 100)
        else
            msgStr = "不在团队中，无法保存团员名单！"
        end
        C_Timer.After(2, function ()
            self:Enable()
        end)
        ZL.Print(nil, nil, nil, nil, nil, msgStr)
    end)
    SaveBtn:SetScript("OnEnter", function (self)
        local uiScale, x, y = UIParent:GetEffectiveScale(), GetCursorPosition()
        x, y = x/uiScale, y/uiScale
        local screenWidth = GetScreenWidth() / 2
        if x < screenWidth then
            GameTooltipShow(recordBtn, "LEFT", "LEFT", AuctionFrame:GetWidth(), 0)
        else
            GameTooltipShow(recordBtn, "RIGHT", "LEFT", -3, 0)
        end
        GameTooltip:AddLine("保存团队名单")
        local _, msgStr = ZL.GetWagesGroupMembers()
        if msgStr then
            GameTooltip:AddLine("工资计算：" .. msgStr, 1, 1, 1)
        else
            GameTooltip:AddLine("工资计算：|cffff0000没有团队成员数据，无法计算工资！|h", 1, 1, 1)
        end
        GameTooltip:AddLine("注意：")
        GameTooltip:AddLine("选择当前团队名单时，工资计算会根据当前团队人\n数变化而变化(消费老板不计算)！", 1, 0, 0)
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("界面显示")
        GameTooltip:AddLine("打开邮箱时：|cffffffff显示需邮寄人员的工资|r")
        GameTooltip:AddLine("交易中：|cffffffff显示当前交易人的工资|r")
        GameTooltip:AddLine("勾选所有人工资：|cffffffff显示团队所有人的工资|r")
        GameTooltip:AddLine("其他：|cffffffff显示所有欠款或装备未交易人员的工资|r")
        GameTooltip:Show()
    end)
    SaveBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)

    AuctionFrame.selectGroupMembersDropDown = CreateFrame("FRAME", "ZLselectGroupMembersDropDown2", MLFrame, "UIDropDownMenuTemplate")
    UIDropDownMenu_SetWidth(AuctionFrame.selectGroupMembersDropDown , 8)
    AuctionFrame.selectGroupMembersDropDown:SetPoint("LEFT", SaveBtn, "RIGHT", -16, -1)
    AuctionFrame.selectGroupMembersDropDown:SetScale(1)
    _G["ZLselectGroupMembersDropDown2Button"]:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("注意：", 1, 0, 0)
        GameTooltip:AddLine("历史1永远为最新保存名单，依次类推", 1, 1, 1)
        GameTooltip:Show()
    end)
    _G["ZLselectGroupMembersDropDown2Button"]:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)
    UIDropDownMenu_Initialize(AuctionFrame.selectGroupMembersDropDown, function (self, level, menuList)
        -- local info = UIDropDownMenu_CreateInfo()
        -- wipe(info)
        ZL.opt.wagesGroupMembers = (ZL_CURRENT["globalConfig"] and ZL_CURRENT["globalConfig"]["wagesGroupMembers"]) and ZL_CURRENT["globalConfig"]["wagesGroupMembers"] or ZL.opt.wagesGroupMembers
        if (level or 1) == 1 then
            local info = UIDropDownMenu_CreateInfo()
            info.isTitle = 1
            info.text = "选择计算工资名单(ML功能)"
            info.notCheckable = 1
            UIDropDownMenu_AddButton(info, level)

            info.isTitle = nil
            info.disabled = nil

            info.isNotRadio = nil
            info.notCheckable = nil
            info.keepShownOnClick = nil
            info.hasArrow = true
            --在团队中时，生成当前团队成员名单
            if IsInGroup() then
                info.text = "当前成员"
                info.menuList = {["list"]=ZL.GetCurrentRoster()}
                info.checked = (ZL.opt.wagesGroupMembers == 0 and true or false)
                info.func = function()
                    ZL.opt.wagesGroupMembers = 0
                    ZL.TransmitAddonInfo_Pro()
                    CloseDropDownMenus()
                    UIDropDownMenu_Refresh(AuctionFrame.selectGroupMembersDropDown)
                end
                if PlayerIsML() then
                    info.disabled = false
                else
                    info.disabled = true
                end
                UIDropDownMenu_AddButton(info, level)
            end
            --不在团队中时，按照最新保存时间生成历史保存名单
            local currentRoster = ZL_CURRENT["GroupMembersList"]
            if currentRoster and #currentRoster > 0 then
                for index, data in ipairs(currentRoster) do
                    -- 最多展示历史5条记录
                    if index <= 5 then
                        info.text = "历史" .. index
                        info.menuList = data
                        if ZL.opt.wagesGroupMembers == 0 and (not IsInGroup()) and index == 1 then
                            info.checked = true
                        else
                            info.checked = (ZL.opt.wagesGroupMembers == index and true or false)
                        end
                        info.func = function()
                            ZL.opt.wagesGroupMembers = index
                            ZL.TransmitAddonInfo_Pro()
                            CloseDropDownMenus()
                            UIDropDownMenu_Refresh(AuctionFrame.selectGroupMembersDropDown)
                        end
                        if PlayerIsML() then
                            info.disabled = false
                        else
                            info.disabled = true
                        end
                        UIDropDownMenu_AddButton(info, level)
                    end
                end
            end
        elseif level == 2 then
            local info = UIDropDownMenu_CreateInfo()
            if menuList["saveTime"] then
                info.isTitle = 1
                info.text = menuList["saveTime"]
                info.notCheckable = 1
                UIDropDownMenu_AddButton(info, level)

                info.isTitle = nil
                info.disabled = nil
            end
            for i = 1, #menuList.list do
                if #menuList.list[i] > 0 then
                    info.isNotRadio = 1
                    info.notCheckable = 1
                    info.keepShownOnClick = 1
                    info.text = "小队 " .. i
                    info.hasArrow = true
                    info.menuList = menuList.list[i]
                    UIDropDownMenu_AddButton(info, level)
                end
            end
        else
            local info = UIDropDownMenu_CreateInfo()
            for _, name in ipairs(menuList) do
                info.isNotRadio = 1
                info.notCheckable = 1
                info.keepShownOnClick = 1
                info.text = name
                info.hasArrow = false
                UIDropDownMenu_AddButton(info, level)
            end
        end
    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)
        if button == "LeftButton" then
            if IsShiftKeyDown() then
                if not ZL_CURRENT.GroupMembersVersion then ZL_CURRENT.GroupMembersVersion = {} end
                local data = {type="request"}
                MyAddon:TransmitAddonInfo2("AUTOAUC VER", data, "RAID")
                if not ZL.VersionTooltip then
                    ZL.VersionTooltip = CreateFrame("GameTooltip", "VersionTooltip", UIParent, "GameTooltipTemplate")
                    ZL.VersionTooltip:SetMovable(true)
                    ZL.VersionTooltip:SetScript("OnMouseUp", function (self)
                        self:StopMovingOrSizing()
                    end)
                    ZL.VersionTooltip:SetScript("OnMouseDown", function (self)
                        self:StartMoving()
                    end)
                    ZL.VersionTooltip.closeBtn = CreateFrame("Button", nil, ZL.VersionTooltip, "UIPanelCloseButton")
                    local closeBtn = ZL.VersionTooltip.closeBtn
                    closeBtn:SetPoint("TOPRIGHT", ZL.VersionTooltip, "TOPRIGHT", -2, -2)
                    closeBtn:SetSize(30, 30)
                end
                _G["VersionTooltip"]:ClearAllPoints()
                _G["VersionTooltip"]:ClearLines()
                _G["VersionTooltip"]:SetOwner(self, "ANCHOR_NONE")
                _G["VersionTooltip"]:SetPoint("CENTER", UIParent, "CENTER", 0, 100)
                _G["VersionTooltip"]:AddLine("版本信息")
                _G["VersionTooltip"]:AddLine("获取信息中，预计需要1-2秒...", 1, 1, 1)
                _G["VersionTooltip"]:Show()
                C_Timer.After(1, function ()
                    _G["VersionTooltip"]:ClearAllPoints()
                    _G["VersionTooltip"]:ClearLines()
                    _G["VersionTooltip"]:SetOwner(self, "ANCHOR_NONE")
                    _G["VersionTooltip"]:SetPoint("CENTER", UIParent, "CENTER", 0, 100)
                    _G["VersionTooltip"]:AddLine("版本信息")
                    _G["VersionTooltip"]:AddDoubleLine("玩家名", "版本号")
                    if ZL_CURRENT.GroupMembersVersion and next(ZL_CURRENT.GroupMembersVersion, nil) then
                        for i = 1, MAX_RAID_MEMBERS do
                            local name, _, _, _, _, _, _, online, _, _, isML = GetRaidRosterInfo(i)
                            if name then
                                if online then
                                    if ZL_CURRENT.GroupMembersVersion[name] then
                                        if isML then
                                            _G["VersionTooltip"]:AddDoubleLine(GetClassColorName(name) .. "|TInterface\\GroupFrame\\UI-Group-MasterLooter:12|t", ZL_CURRENT.GroupMembersVersion[name], 1, 1, 1, 1, 1, 1)
                                        else
                                            _G["VersionTooltip"]:AddDoubleLine(GetClassColorName(name), ZL_CURRENT.GroupMembersVersion[name], 1, 1, 1, 1, 1, 1)
                                        end
                                    else
                                        _G["VersionTooltip"]:AddDoubleLine(GetClassColorName(name), "|cffffd100未安装|r", 1, 1, 1, 1, 1, 1)
                                    end
                                else
                                    _G["VersionTooltip"]:AddDoubleLine(GetClassColorName(name), "|cffff0000未知(已离线)|r", 1, 1, 1, 1, 1, 1)
                                end
                            end
                        end
                    else
                        _G["VersionTooltip"]:AddLine("未获取到版本信息", 1, 1, 1)
                    end
                    _G["VersionTooltip"]:Show()
                end)
            else
                ZL.OpenAceConfigDialog("金团拍卖助手")
            end
        elseif button == "RightButton" then
            if IsShiftKeyDown() then
                local dataID = "[AutoAuction]金团拍卖助手"
                local sendVer, msgStr = CheckWaVersion(dataID)
                if msgStr then
                    ZL.Print(nil, nil, nil, nil, nil, msgStr)
                end
                if not sendVer then return end
                local function ObfuscateName(name)
                    if (GetCurrentRegion() == 5) then
                        local result = ""
                        for i = 1, #name do
                            local b = name:byte(i)
                            if (b >= 196 and i ~= 1) then
                            -- UTF8 Start byte
                            result = result .. string.char(46, b)
                            else
                            result = result .. string.char(b)
                            end
                        end
                        return result
                    else
                        return name
                    end
                end
                local fullName
                if (not fullName) then
                    local name, realm = UnitFullName("player")
                    if realm then
                        fullName = name.."-".. ObfuscateName(realm)
                    else
                        fullName = name
                    end
                end
                
                local text = "[WeakAuras: " .. fullName .. " - " .. dataID .. " V" .. sendVer .. "]"
                ChatEdit_ActivateChat(ChatEdit_ChooseBoxForSend())
                ChatEdit_InsertLink(text)
            else
                local WaString = [=[
!WA:2!S33AxTXXwIUM18n(0Dn)c0vz57inrWibg8JBSxlzq2O5iaFbr8KJpE4kqTanriXi1yhpNKzHtcgSnySJF)mg)op8J4KRng8J)l3dDlPpL)c3AxV6QQU6wcCsoN5ohFYXwD17x1U21U2v1vTR)M9(3n5Fx2)USZhUCPPnlKVOr5bgoDQK9NyWXkvOu5)P)w0FM69ZMVYufYC00gFI5i5kvEYmMJm1iM5N0yKShTyMjZp2iMtu2OYeLkK9OLp6a5YvXW8V5zzko2eLkV)s5lAoA3j6pDIbNkG3uI80FZu)3gB6kMLMeGy4PYMX0yqJdBu08)BMPrLMXm)yhiFwZj2tC0JLZmMz(sfR01GvmZu2SLrZLVy(kt0YEq)J5)JVkBPri06)9OK)DM)wZvkuASmfcKz6YzgXO4HdSlNFwQCG)4N1c7X2YKnBPI9NzsdembbUfFAm3c2cLecV3nsT0ARwZFx7l(i7l)eRZC)A3z21x942l9vRV2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ftxUmbt7VJ96fBvxk1S)(fRp2GbRpuSTccGeU(ers8ZtIyR7DTRg3Xo88nAdL(B(pAqzJ99DJc)F8rfz0QDM4VtpF3Ub(oCBkXpXi)ViFZqbpA2NwzasHtIl)20FmySqrIlq(kohR)UBoGpFD8Tq3aEnTRlEXwL28k4Ul4g5WlK2tGOyKivQPeAcJsQU0oSM)GER7aEQ3t9U9mUqaIbdVPdielE7CqTIiT5(JaDFobPM(HcWArK1seP3CtPwwLAl(IdaLkz8bHv4B7iCJj9FGfSfafI0eUl83qdYX0WSMqyUbccBaGW4asBoazYY3osqbE8SQheB9(GwKFWij30say2h5NyPxjcqqcWbBGcKxP3kYYiS7MS6)5aar2Halgujq0)ObtiY1N0rIijK4FqtmCAHftFThU(eNC9R(GXfMmeRGrwkk)q8jPlCxIakcbwe2wjkNucPdl9YppGUsdlnsFsJUjODKoAF4lIknueG0GnequKI9lUoGlcbJbe83QVTbJL)OMetYLOR)c3a9v6n)rBdMF01MCx)oq8ITD99NsEUZM(tpV8cFu6h)jPoZxjTLe)STkeLzW4SW)egBOib7jaD6tk5MyOteeDok26WOGuC4JbbIJusSJ)8PM5cPo35tD(7T(fxmZ5xG2gqrhHv0(HwQbu7qx(MuhKhkkQXEsPX4r1DxqE2ZLlAc9na8)RfUCKroOX(1io92pN0VH884KbMes9QFWHwNm3(RsV6Thxq6)c2KCcPJjnwFMq8JykX)CaXNpwIHtIn3B(JKskDaOj(PYV3zs)7E)m3y61x(0zU9kzUXhTeHjuu(yCrGPD4(6ppGp7hNX5N8yeausZQcMFfcMuN6CW8yTGrA(islG18GslAOgVMKW3qz4s53Qw0dLtrFd8BjKED87clbBejF57k)btaLtdLthLs((3g2xMcyGsPHK2J0VPp9uUTnmF4vgP53YvnXABNj7oMWrPmoEUv0W24hUcLPc5qZ)IN75EUnTmiKexyYcY35VEf(yu(kWY9QwcdInDfheYP)M6SNE6S9FQy)7OEpBR(g)PJ8)(R()o
]=]
                if not ZL.WaStringFrame then ZL:CreateWAStringFrame() end
                local editBox = ZL.WaStringFrame.scrollFrame.editBox
                ZL.WaStringFrame.Title:SetText("如果有老版本的，先删除，再复制导入到WA中，然后|cffffffffShift+右键点击齿轮|r发送字符串到聊天窗口")
                editBox:SetScript("OnEscapePressed", function() ZL.WaStringFrame:Hide() end)
                editBox:SetScript("OnMouseUp", function(self) self:HighlightText() end)
                editBox:SetScript("OnTextChanged", function (self) self:HighlightText() end)
                editBox:SetText(WaString)
                editBox:HighlightText()
                editBox:SetFocus()
                ZL.WaStringFrame:Show()
            end
        end
    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("Shift+左键：|cffffffff查看团队成员的版本号|r")
        GameTooltip:AddLine("右键：|cffffffff复制WA端字符串并导入|r")
        GameTooltip:AddLine("Shift+右键：|cffffffff发送字符串到聊天窗口|r")
        GameTooltip:AddLine("注意：不要直接在WA里面Shift+左键发送字符串\n到聊天窗口！这样无法获取到版本信息！", 1, 0, 0)
        GameTooltip:AddLine("-----------------------", 1, 1, 1)
        GameTooltip:AddLine("团队成员导入WA方式：")
        GameTooltip:AddLine("1、按照上面方法发送到聊天窗口")
        GameTooltip:AddLine("优点：|cffffffff可以保留历史配置和关注等数据|r")
        GameTooltip:AddLine("缺点：|cffffffff导入速度慢，需排队，同时只能1人传输|r")
        GameTooltip:AddLine("2、将字符串保存到文本文档发送，团员自己复制导入")
        GameTooltip:AddLine("优点：|cffffffff速度快|r")
        GameTooltip:AddLine("缺点：|cffffffff需删除原字符串，无法保存历史配置和缓存数据|r")
        GameTooltip:Show()
    end)
    settingBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    AuctionFrame.helpBtn = CreateFrame("Button", nil, AuctionFrame)
    local helpBtn = AuctionFrame.helpBtn
    helpBtn:SetPoint("LEFT", settingBtn, "RIGHT", 5, 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
        if ZL_CURRENT.GroupMembersVersion and next(ZL_CURRENT.GroupMembersVersion, nil) and IsInRaid() then
            GameTooltip:AddLine(" ")
            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_CURRENT.GroupMembersVersion[name] then
                            GameTooltip:AddDoubleLine(txt, ZL_CURRENT.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
        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.BorderTop = StateFrame:CreateTexture(nil, "OVERLAY") --BACKGROUND  OVERLAY
    StateFrame.BorderTop:SetColorTexture(1, 1, 1, 0.5)
    StateFrame.BorderTop:SetPoint("TOPLEFT", -1, 1)
    StateFrame.BorderTop:SetPoint("BOTTOMRIGHT", StateFrame, "TOPRIGHT", 1, 0)
    StateFrame:SetPoint("BOTTOMLEFT", AuctionFrame, "BOTTOMLEFT")
    StateFrame:SetPoint("BOTTOMRIGHT", AuctionFrame, "BOTTOMRIGHT")
    StateFrame:SetHeight(50)
    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")
        AuctionFrame:Update()
    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
    local function startOrCanelAuction(v, quickFailed)
        if IsInRaid() then
            local curAuctionList = ZL_CURRENT.auctionlist[v]
            local bindType = curAuctionList.bindType
            local Frame1 = AuctionFrame.entries[v]
            local CancelBtn =  Frame1.MLframe.functionFrame.CancelBtn
            if CancelBtn:GetText() == "取消" then
                if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                    _G["ZL_NewAuctionFrameTab5"]:Click()
                end
                if bindType == 2 then
                    SendChatMessage(("装绑%s拍卖已取消，本次拍卖无效，等待重新拍卖！"):format(curAuctionList.itemlink), ZL.MsgChannel())
                else
                    SendChatMessage(("%s拍卖已取消，本次拍卖无效，等待重新拍卖！"):format(curAuctionList.itemlink), ZL.MsgChannel())
                end
                if Frame1.countDownTimer then
                    if not Frame1.countDownTimer:IsCancelled() then
                        Frame1.countDownTimer:Cancel()
                    end
                    Frame1.countDownTimer = nil
                end
                Frame1.confirmBid = nil
                ZL_CURRENT.auctionlist[v].state = "waiting"
                ZL_CURRENT.auctionlist[v].countdownremaining = 0
                ZL_CURRENT.auctionlist[v].isPaused = false
                ZL_CURRENT.auctionlist[v].bidderlist = {}
                local data = {
                    type = "取消拍卖",
                    data2 = ZL_CURRENT.auctionlist[v],
                }
                MyAddon:TransmitAddonInfo("AUTOAUC SYNC2", data)
            else
                if (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(nil, nil, nil, nil, nil, msgStr)
                else
                    ZL.TransmitAddonInfo_Pro()
                    ZL.GetLootItemGUID()
                    local msgStr = ""
                    if not ZL.IsCanAuction(curAuctionList) then
                        msgStr = curAuctionList.itemlink .. "无法拍卖，原因可能是：物品不存在或已无法交易"
                        SendChatMessage(msgStr, ZL.MsgChannel())
                        ZL.Print(nil, nil, nil, nil, nil, msgStr)
                        return
                    end
                    local isRestart = CancelBtn:GetText()
                    local tradeId = curAuctionList.tradeId
                    if isRestart == "重拍" and curAuctionList["spawnUID"] and next(curAuctionList["spawnUID"], nil) then
                        for _, value in pairs(curAuctionList["spawnUID"]) do
                            value["successBidder"] = nil
                            if value["itemGUID"] and next(value["itemGUID"], nil) then
                                for _, value2 in pairs(value["itemGUID"]) do
                                    value2["isUsed"] = nil
                                end
                            end
                        end
                    end
                    if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                        _G["ZL_NewAuctionFrameTab1"]:Click()
                    end
                    local bidIncrement = curAuctionList.bidIncrement
                    local startbidamount = curAuctionList.startbidamount
                    if ZL_CURRENT.globalConfig.intervalBidIncrement then
                        if startbidamount < ZL_CURRENT.globalConfig.baseAmount1 then
                            bidIncrement = bidIncrement
                        elseif startbidamount < ZL_CURRENT.globalConfig.baseAmount2 then
                            bidIncrement = math.max(ZL_CURRENT.globalConfig.bidIncrement1, bidIncrement)
                        elseif startbidamount < ZL_CURRENT.globalConfig.baseAmount3 then
                            bidIncrement = math.max(ZL_CURRENT.globalConfig.bidIncrement2, bidIncrement)
                        else
                            bidIncrement = math.max(ZL_CURRENT.globalConfig.bidIncrement3, bidIncrement)
                        end
                    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 then
                                        --从第一个背包开始查询空闲的格子，如果不是流拍背包，也不是自己拍到的背包，则放进去
                                        local targetBagID, targetslotIndex
                                        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
                                                    local currentInfo = C_Container.GetContainerItemInfo(_bagID, _slotIndex)
                                                    if not currentInfo then
                                                        targetBagID = _bagID
                                                        targetslotIndex = _slotIndex
                                                        break
                                                    end
                                                end
                                            end
                                        end
                                        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
                                    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)
                                end
                            end
                            linshi()
                        else
                            local msgStr = "|cffff0000注意：流拍物品重拍，但没有合适的物品从流拍背包中取出！|r"
                            ZL.Print(nil, nil, nil, nil, nil, msgStr)
                        end
                    end
                    ZL_CURRENT.auctionlist[v].tradeId = nil
                    ZL_CURRENT.auctionlist[v].startbidamount = startbidamount
                    ZL_CURRENT.auctionlist[v].bidIncrement = bidIncrement
                    if quickFailed and ZL_CURRENT.auctionlist[v].state ~= "failed" then
                        ZL_CURRENT.auctionlist[v].countdownremaining = 1
                    else
                        ZL_CURRENT.auctionlist[v].countdownremaining = ZL.opt.auctionTimer
                    end
                    ZL_CURRENT.auctionlist[v].auctionTimerRefresh = (ZL_CURRENT.globalConfig and ZL_CURRENT.globalConfig["auctionTimerRefresh"]) and ZL_CURRENT.globalConfig["auctionTimerRefresh"] or ZL.opt.auctionTimerRefresh
                    ZL_CURRENT.auctionlist[v].state = "auctioning"
                    ZL_CURRENT.auctionlist[v].isPaused = false
                    ZL_CURRENT.auctionlist[v].bidderlist = {}
                    local data = {
                        type = "开始拍卖",
                        isRestart = isRestart,
                        tradeId = tradeId,
                        data2 = ZL_CURRENT.auctionlist[v],
                    }
                    MyAddon:TransmitAddonInfo("AUTOAUC SYNC1", data)

                end
            end
        else
            local msgStr = "团队模式才能进行拍卖相关行为！"
            ZL.Print(nil, nil, 1, 0.82, 0, msgStr)
        end
    end
    local function quickStartAuction(v)
        if IsInRaid() then
            local Frame1 = AuctionFrame.entries[v]
            local CancelBtn =  Frame1.MLframe.functionFrame.CancelBtn
            if CancelBtn:GetText() == "开始" then
                local curAuctionList = ZL_CURRENT.auctionlist[v]
                curAuctionList.index = v
                local data = {
                    ["type"] = "指定人员",
                    ["data"] = curAuctionList,
                }
                StaticPopup_Show("ZL_ADDINCOME", "收入", nil, data)
            end
        else
            local msgStr = "团队模式才能进行拍卖相关行为！"
            ZL.Print(nil, nil, 1, 0.82, 0, msgStr)
        end
    end
    local function pauseOrResumeAuction(v)
        local curAuctionList = ZL_CURRENT.auctionlist[v]
        if not curAuctionList["isPaused"] then
            curAuctionList.isPaused = true
            local data = {
                type = "暂停拍卖",
                data2 = curAuctionList,
            }
            MyAddon:TransmitAddonInfo("AUTOAUC SYNC3", data)
        else
            curAuctionList.isPaused = false
            local data = {
                type = "继续拍卖",
                data2 = curAuctionList,
            }
            MyAddon:TransmitAddonInfo("AUTOAUC SYNC4", data)
        end
    end
    local function packageAuction(v)
        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
    local function syncAuction(v)
        local data = {
            type = "同步单个",
            data2 = ZL_CURRENT.auctionlist[v],
        }
        MyAddon:TransmitAddonInfo("AUTOAUC SYNC13", data)
    end
    local function sendAuctionInfo(v)
        local msgStr = ""
        local curAuctionList = ZL_CURRENT.auctionlist[v]
        local itemlink = curAuctionList.itemlink
        local itemCount = curAuctionList.itemCount
        local bidderlist = ZL_CURRENT.auctionlist[v].bidderlist
        local _, _, tarbidamount, bidCount = ZL.GetNewBidAmount(v)
        if #bidderlist > 0 and ZL_CURRENT.globalConfig.auctionMode == "|cffff0000匿名|r" then
            msgStr = curAuctionList.itemlink .. "即将倒数，请及时确认是否还需要竞价！"
            SendChatMessage(msgStr, ZL.MsgChannel())
            if curAuctionList.itemlink == "[打包拍卖]" then
                msgStr = string.gsub(msgStr, "[%[%]]", "")
            end
            MyAddon:TransmitAddonInfo("AUTOAUC SOUND", {type="系统", soundName=msgStr})
        else
            if #bidderlist > 0 then
                local totalBidCount = 0
                for _, 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 count  > 1 then
                            msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. "×" .. count .. ")，"
                        else
                            msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. ")，"
                        end
                        totalBidCount = newTotalBidCount
                    else
                        break
                    end
                end
                if itemCount == 1 then
                    msgStr = ("%s当前出价：%s下次最低出价：%d，不要就打P"):format(curAuctionList.itemlink, msgStr, tarbidamount)
                else
                    msgStr = ("%s当前出价：%s下次最低出价：%d，对应最大数量%d，不要就打P"):format(curAuctionList.itemlink, msgStr, tarbidamount, bidCount)
                end
            else
                if itemCount == 1 then
                    msgStr = ("%s当前无人出价，下次最低出价：%d"):format(curAuctionList.itemlink, tarbidamount)
                else
                    msgStr = ("%s当前无人出价，下次最低出价：%d，对应最大数量%d"):format(curAuctionList.itemlink, tarbidamount, bidCount)
                end
            end
            SendChatMessage(msgStr, ZL.MsgChannel())
            if curAuctionList.itemlink == "[打包拍卖]" then
                msgStr = string.gsub(msgStr, "[%[%]]", "")
            end
            msgStr = string.gsub(msgStr, "丶", ""):gsub("丨", ""):gsub("卍", ""):gsub("乄", "")
            MyAddon:TransmitAddonInfo("AUTOAUC SOUND", {type="系统", soundName="拍卖提醒：" .. msgStr})
        end
    end
    local function revokeBidAmount(v, other)
        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
                })
            else
                local data = {itemlink=curAuctionList.itemlink, itemindex=curAuctionList.itemindex}
                StaticPopup_Show("ZL_REVOKEBID", nil, nil, data, ZL.GroupMembersDropdown)
            end
        else
            ZL.Print(nil, nil, nil, nil, nil, "当前无人出价！")
        end
    end
    local function modifyBidRecord(v)
        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 curAuctionList = ZL_CURRENT.auctionlist[v]
        local bidderlist = ZL_CURRENT.auctionlist[v].bidderlist
        local _, _, tarbidamount, bidCount = ZL.GetNewBidAmount(v)
        local Frame1 = AuctionFrame.entries[v]
        if #bidderlist > 0 then --有人出价直接5秒倒数
            if Frame1.countDownTimer then
                if not Frame1.countDownTimer:IsCancelled() then
                    Frame1.countDownTimer:Cancel()
                end
                Frame1.countDownTimer = nil
            end
            ZL_CURRENT.auctionlist[v].countdownremaining = 6
            MyAddon:TransmitAddonInfo("AUTOAUC SOUND", {type="录制", soundName="拍卖倒数.mp3", sysSoundName="拍卖倒数！"})
        else
            --无人出价直接流拍
            ZL_CURRENT.auctionlist[v].countdownremaining = 0.001
        end
        ZL_CURRENT.auctionlist[v].isPaused = false
        local data = {
            type = "手动倒数",
            data2 = ZL_CURRENT.auctionlist[v],
        }
        MyAddon:TransmitAddonInfo("AUTOAUC SYNC5", data)
    end
    local function resetAuctionTime(v)
        local msgStr = ""
        local curAuctionList = ZL_CURRENT.auctionlist[v]
        local itemlink = curAuctionList.itemlink
        local itemCount = curAuctionList.itemCount
        local bidderlist = ZL_CURRENT.auctionlist[v].bidderlist
        local _, _, tarbidamount, bidCount = ZL.GetNewBidAmount(v)
        --取消倒数，重置拍卖时间
        if curAuctionList.countdownremaining > 0 then
            ZL_CURRENT.auctionlist[v].countdownremaining = (ZL_CURRENT.globalConfig and ZL_CURRENT.globalConfig["auctionTimerRefresh"]) and ZL_CURRENT.globalConfig["auctionTimerRefresh"] or ZL.opt.auctionTimerRefresh
            ZL_CURRENT.auctionlist[v].isPaused = false
            MyAddon:TransmitAddonInfo("AUTOAUC SOUND", {type="系统", soundName=itemlink .. "已重置倒计时！", sysSoundName=itemlink .. "已重置倒计时！"})
            local data = {
                type = "取消倒数",
                data2 = ZL_CURRENT.auctionlist[v],
            }
            MyAddon:TransmitAddonInfo("AUTOAUC SYNC5", data)
            if #bidderlist > 0 then
                local totalBidCount = 0
                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
                        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 itemCount > 1 then
                    msgStr = ("%s已重置倒计时，当前出价：%s下次最低出价：%d，对应最大竞拍数量：%d"):format(
                        curAuctionList.itemlink, msgStr, tarbidamount, bidCount
                    )
                else
                    msgStr = ("%s已重置倒计时，当前出价：%s下次最低出价：%d"):format(
                        curAuctionList.itemlink, msgStr, tarbidamount
                    )
                end
                SendChatMessage(msgStr, ZL.MsgChannel())
            else
                if itemCount > 1 then
                    msgStr = ("%s已重置倒计时，当前无人出价，下次最低出价：%d，对应最大竞拍数量：%d"):format(
                        curAuctionList.itemlink, tarbidamount, bidCount
                    )
                else
                    msgStr = ("%s已重置倒计时，当前无人出价，下次最低出价：%d"):format(
                        curAuctionList.itemlink, tarbidamount
                    )
                end
                SendChatMessage(msgStr, ZL.MsgChannel())
            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 data = ZL_CURRENT.auctionlist[v]
                local itemlink = data.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", "BOTTOMLEFT", -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)
                -- Frame1.zlHighlight:Hide()
                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")
            -- itemNumbersIcon:SetAllPoints(timerBtn)

            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.level:SetText(select(4, cGetItemInfo(itemId)))
        
            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.itemindex:SetText(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)
            -- timerBtn.count:SetText(20)
        
            infoFrame.itemName = infoFrame:CreateFontString(nil, "OVERLAY")
            infoFrame.itemName:SetPoint("TOPLEFT", timerBtn, "TOPRIGHT", 2, 1)
            infoFrame.itemName:SetFont(GameFontNormal:GetFont(), 13)
            infoFrame.itemName:SetWordWrap(true)
            infoFrame.itemName:SetSize(100, 20)
            infoFrame.itemName:SetJustifyH("LEFT")

            -- infoFrame.itemName:SetText(select(2, cGetItemInfo(itemId)))
            -- local bili = infoFrame.itemName:GetWidth()/infoFrame.itemName:GetStringWidth()
            -- if bili < 1 then
            --     if bili < 0.8 then bili = 0.8 end
            --     infoFrame.itemName:SetTextScale(bili)
            -- end
        
            infoFrame.sb = CreateFrame("StatusBar", nil, infoFrame)
            local sb = infoFrame.sb
            sb:SetPoint("TOPLEFT", infoFrame.itemName, "BOTTOMLEFT", 0, -1)
            sb:SetPoint("BOTTOMRIGHT", infoFrame.itemName, "BOTTOMRIGHT", 0, -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.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(9+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")
            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
            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
                    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
                    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
                    GameTooltipShow(self, "BOTTOMRIGHT", "TOPRIGHT")
                    GameTooltip:AddLine("提示：")
                    GameTooltip:AddLine("|cff00ff00左键|r：开始/取消/重拍", 1, 1, 1)
                    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() 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
                            startOrCanelAuction(v, true)
                        end
                        btnDelay(self)
                    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(nil, nil, nil, nil, nil, 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 tempMenuTable()
                        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 ()
                                    local msgStr = "警告！确定删除" .. ZL_CURRENT.auctionlist[v].itemlink .. "的拍卖记录?"
                                    StaticPopup_Show("ZL_DELETEAUCTIONWARNING", msgStr, nil, v)
                                end
                            })
                        elseif state == "重拍" then

                        elseif state == "取消" then
                            tinsert(menuList, {
                                text = "通报竞拍信息",
                                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, tempMenuTable(), 'TOPLEFT', self, 'TOPRIGHT', 0, 30)
                elseif button == "LeftButton" then
                    ZL.GUI:CloseMenu()
                    local msgStr
                    if curAuctionList.state == "waiting" then
                        msgStr = itemlink .. "待拍卖"
                        ZL.Print(nil, true, 1, 0.82, 0, msgStr)
                    elseif curAuctionList.state == "failed" then
                        msgStr = itemlink .. "已流拍"
                        ZL.Print(nil, true, 1, 0.82, 0, msgStr)
                    elseif curAuctionList.state == "success" then
                        msgStr = itemlink .. "已拍卖成功"
                        ZL.Print(nil, true, 1, 0.82, 0, msgStr)
                    else
                        sendAuctionInfo(v)
                    end
                    btnDelay(self)
                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)
                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)
                -- Frame1.zlHighlight:Hide()
                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)
            local function bidboxfunc(self)
                local wantBid = self:GetNumber()
                local curAuctionList = ZL_CURRENT.auctionlist[v]
                local itemCount = curAuctionList.itemCount
                local bidderlist = curAuctionList.bidderlist
                tableSort(bidderlist)
                local isSelf = false
                local totalBidCount = 0
                local bidCount = 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 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(v)
                    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
                    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(nil, nil, nil, nil, nil, msgStr)
                    end
                else
                    local msgStr = "你已经是有效最高出价者，无需竞价！"
                    ZL.Print(nil, nil, nil, nil, nil, msgStr)
                end
                C_Timer.After(0.5, function ()
                    self:ClearFocus()
                end)
            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()
                    -- bidboxfunc(self)
                    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, "BOTTOM", "TOP")
                GameTooltip:AddLine("竞拍数量")
                GameTooltip:AddLine("默认为1", 1, 1, 1)
                GameTooltip:AddLine("支持鼠标滚轮", 1, 1, 1)
                GameTooltip:Show()
            end)
            bidCounts:SetScript("OnLeave", function (self)
                -- Frame1.zlHighlight:Hide()
                zlHighlightOnHide(v)
                GameTooltip:Hide()
            end)

            bidFrame.bidBtn = CreateButton(nil, bidFrame, "出价", "LEFT", bidCounts, "RIGHT", 5, 0, 40, 18)
            -- bidFrame.bidBtn = CreateButton(nil, bidFrame, "出价", "TOPLEFT", bidEditBox, "BOTTOMLEFT", 0, -3, 40, 18)
            local bidBtn = bidFrame.bidBtn
            bidBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
            bidBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "BOTTOM", "TOP")
                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)
                -- Frame1.zlHighlight:Hide()
                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 = false
                    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 = "自动出价已结束，当前你竞价|cff00ff00成功|r！"
                    else
                        msgStr = "自动出价已结束，当前你竞价|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 itemTotalCount > 1 and (not Frame1.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
                            local msgStr = "你已经是有效最高出价者，无需竞价！"
                            ZL.Print(nil, nil, nil, nil, nil, msgStr)
                        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 msgStr = ""
                    local curAuctionList = ZL_CURRENT.auctionlist[v]
                    local itemlink = curAuctionList.itemlink
                    local itemCount = curAuctionList.itemCount
                    local bidderlist = ZL_CURRENT.auctionlist[v].bidderlist
                    local _, _, tarbidamount, bidCount = ZL.GetNewBidAmount(v)
                    if button == "LeftButton" then
                        if IsShiftKeyDown() and (not IsControlKeyDown()) and (not IsAltKeyDown()) then
                            --只按下Shift+左键点击：开始/取消/重拍
                            local bindType = curAuctionList.bindType
                            if CancelBtn:GetText() == "取消" then
                                if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                                    _G["ZL_NewAuctionFrameTab5"]:Click()
                                end
                                if bindType == 2 then
                                    SendChatMessage(("装绑%s拍卖已取消，本次拍卖无效，等待重新拍卖！"):format(curAuctionList.itemlink), ZL.MsgChannel())
                                else
                                    SendChatMessage(("%s拍卖已取消，本次拍卖无效，等待重新拍卖！"):format(curAuctionList.itemlink), ZL.MsgChannel())
                                end
                                if Frame1.countDownTimer then
                                    if not Frame1.countDownTimer:IsCancelled() then
                                        Frame1.countDownTimer:Cancel()
                                    end
                                    Frame1.countDownTimer = nil
                                end
                                Frame1.confirmBid = nil
                                ZL_CURRENT.auctionlist[v].state = "waiting"
                                ZL_CURRENT.auctionlist[v].countdownremaining = 0
                                ZL_CURRENT.auctionlist[v].isPaused = false
                                ZL_CURRENT.auctionlist[v].bidderlist = {}
                                local data = {
                                    type = "取消拍卖",
                                    data2 = ZL_CURRENT.auctionlist[v],
                                }
                                MyAddon:TransmitAddonInfo("AUTOAUC SYNC2", data)
                            else
                                if (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
                                    msgStr = "已有相同的物品正在拍卖，无法同时进行！"
                                    ZL.Print(nil, nil, nil, nil, nil, msgStr)
                                else
                                    ZL.GetLootItemGUID()
                                    ZL.TransmitAddonInfo_Pro()
                                    if not ZL.IsCanAuction(curAuctionList) then
                                        msgStr = curAuctionList.itemlink .. "无法拍卖，原因可能是：已分解或已无法交易"
                                        SendChatMessage(msgStr, ZL.MsgChannel())
                                        ZL.Print(nil, nil, nil, nil, nil, msgStr)
                                        return
                                    end
                                    local isRestart = CancelBtn:GetText()
                                    local tradeId = curAuctionList.tradeId
                                    if isRestart == "重拍" and curAuctionList["spawnUID"] and next(curAuctionList["spawnUID"], nil) then
                                        for _, value in pairs(curAuctionList["spawnUID"]) do
                                            value["successBidder"] = nil
                                            if value["itemGUID"] and next(value["itemGUID"], nil) then
                                                for _, value2 in pairs(value["itemGUID"]) do
                                                    value2["isUsed"] = nil
                                                end
                                            end
                                        end
                                    end
                                    if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                                        _G["ZL_NewAuctionFrameTab1"]:Click()
                                    end
                                    local bidIncrement = curAuctionList.bidIncrement
                                    local startbidamount = curAuctionList.startbidamount
                                    if ZL_CURRENT.globalConfig.intervalBidIncrement then
                                        if startbidamount < ZL_CURRENT.globalConfig.baseAmount1 then
                                            bidIncrement = bidIncrement
                                        elseif startbidamount < ZL_CURRENT.globalConfig.baseAmount2 then
                                            bidIncrement = math.max(ZL_CURRENT.globalConfig.bidIncrement1, bidIncrement)
                                        elseif startbidamount < ZL_CURRENT.globalConfig.baseAmount3 then
                                            bidIncrement = math.max(ZL_CURRENT.globalConfig.bidIncrement2, bidIncrement)
                                        else
                                            bidIncrement = math.max(ZL_CURRENT.globalConfig.bidIncrement3, bidIncrement)
                                        end
                                    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 then
                                                        --从第一个背包开始查询空闲的格子，如果不是流拍背包，也不是自己拍到的背包，则放进去
                                                        local targetBagID, targetslotIndex
                                                        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
                                                                    local currentInfo = C_Container.GetContainerItemInfo(_bagID, _slotIndex)
                                                                    if not currentInfo then
                                                                        targetBagID = _bagID
                                                                        targetslotIndex = _slotIndex
                                                                        break
                                                                    end
                                                                end
                                                            end
                                                        end
                                                        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
                                                    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)
                                                end
                                            end
                                            linshi()
                                        else
                                            msgStr = "|cffff0000注意：流拍物品重拍，但没有合适的物品从流拍背包中取出！|r"
                                            ZL.Print(nil, nil, nil, nil, nil, msgStr)
                                        end
                                    end
                                    ZL_CURRENT.auctionlist[v].tradeId = nil
                                    ZL_CURRENT.auctionlist[v].startbidamount = startbidamount
                                    ZL_CURRENT.auctionlist[v].bidIncrement = bidIncrement
                                    ZL_CURRENT.auctionlist[v].countdownremaining = ZL.opt.auctionTimer
                                    ZL_CURRENT.auctionlist[v].auctionTimerRefresh = (ZL_CURRENT.globalConfig and ZL_CURRENT.globalConfig["auctionTimerRefresh"]) and ZL_CURRENT.globalConfig["auctionTimerRefresh"] or ZL.opt.auctionTimerRefresh
                                    ZL_CURRENT.auctionlist[v].state = "auctioning"
                                    ZL_CURRENT.auctionlist[v].isPaused = false
                                    ZL_CURRENT.auctionlist[v].bidderlist = {}
                                    -- ZL_CURRENT.auctionlist[v].Frame1IsShown = true
                                    local data = {
                                        type = "开始拍卖",
                                        isRestart = isRestart,
                                        tradeId = tradeId,
                                        data2 = ZL_CURRENT.auctionlist[v],
                                    }
                                    MyAddon:TransmitAddonInfo("AUTOAUC SYNC1", data)
                                end
                            end
                        elseif (not IsShiftKeyDown()) and IsControlKeyDown() and (not IsAltKeyDown()) then
                            --只按下Ctr+左键点击：停止5秒倒数 ，刷新拍卖计时
                            if curAuctionList.countdownremaining > 0 and curAuctionList.countdownremaining <=5 then
                                ZL_CURRENT.auctionlist[v].countdownremaining = (ZL_CURRENT.globalConfig and ZL_CURRENT.globalConfig["auctionTimerRefresh"]) and ZL_CURRENT.globalConfig["auctionTimerRefresh"] or ZL.opt.auctionTimerRefresh
                                ZL_CURRENT.auctionlist[v].isPaused = false
                                MyAddon:TransmitAddonInfo("AUTOAUC SOUND", {type="录制", soundName="倒数已取消.mp3", sysSoundName=itemlink .. "倒数已取消"})
                                local data = {
                                    type = "取消倒数",
                                    data2 = ZL_CURRENT.auctionlist[v],
                                }
                                MyAddon:TransmitAddonInfo("AUTOAUC SYNC5", data)
                                if #bidderlist > 0 then
                                    local totalBidCount = 0
                                    for _, 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 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 itemCount > 1 then
                                        msgStr = ("%s已停止倒数，请继续竞拍，当前出价：%s下次最低出价：%d，对应最大竞拍数量：%d"):format(
                                            curAuctionList.itemlink, msgStr, tarbidamount, bidCount
                                        )
                                    else
                                        msgStr = ("%s已停止倒数，请继续竞拍，当前出价：%s下次最低出价：%d"):format(
                                            curAuctionList.itemlink, msgStr, tarbidamount
                                        )
                                    end
                                    SendChatMessage(msgStr, ZL.MsgChannel())
                                else
                                    if itemCount > 1 then
                                        msgStr = ("%s已停止倒数，请继续竞拍，当前无人出价，下次最低出价：%d，对应最大竞拍数量：%d"):format(
                                            curAuctionList.itemlink, tarbidamount, bidCount
                                        )
                                    else
                                        msgStr = ("%s已停止倒数，请继续竞拍，当前无人出价，下次最低出价：%d"):format(
                                            curAuctionList.itemlink, tarbidamount
                                        )
                                    end
                                    SendChatMessage(msgStr, ZL.MsgChannel())
                                end
                            end
                        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
                                if #bidderlist > 0 and ZL_CURRENT.globalConfig.auctionMode == "|cffff0000匿名|r" then
                                    msgStr = curAuctionList.itemlink .. "即将倒数，请及时确认是否还需要竞价！"
                                    SendChatMessage(msgStr, ZL.MsgChannel())
                                    if curAuctionList.itemlink == "[打包拍卖]" then
                                        msgStr = string.gsub(msgStr, "[%[%]]", "")
                                    end
                                    MyAddon:TransmitAddonInfo("AUTOAUC SOUND", {type="系统", soundName=msgStr})
                                else
                                    if #bidderlist > 0 then
                                        local totalBidCount = 0
                                        for _, 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 count  > 1 then
                                                    msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. "×" .. count .. ")，"
                                                else
                                                    msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. ")，"
                                                end
                                                totalBidCount = newTotalBidCount
                                            else
                                                break
                                            end
                                        end
                                        if itemCount == 1 then
                                            msgStr = ("%s当前出价：%s下次最低出价：%d，不要就打P"):format(curAuctionList.itemlink, msgStr, tarbidamount)
                                        else
                                            msgStr = ("%s当前出价：%s下次最低出价：%d，对应最大数量%d，不要就打P"):format(curAuctionList.itemlink, msgStr, tarbidamount, bidCount)
                                        end
                                    else
                                        if itemCount == 1 then
                                            msgStr = ("%s当前无人出价，下次最低出价：%d"):format(curAuctionList.itemlink, tarbidamount)
                                        else
                                            msgStr = ("%s当前无人出价，下次最低出价：%d，对应最大数量%d"):format(curAuctionList.itemlink, tarbidamount, bidCount)
                                        end
                                    end
                                    SendChatMessage(msgStr, ZL.MsgChannel())
                                    if curAuctionList.itemlink == "[打包拍卖]" then
                                        msgStr = string.gsub(msgStr, "[%[%]]", "")
                                    end
                                    msgStr = string.gsub(msgStr, "丶", ""):gsub("丨", ""):gsub("卍", ""):gsub("乄", "")
                                    MyAddon:TransmitAddonInfo("AUTOAUC SOUND", {type="系统", soundName="拍卖提醒：" .. msgStr})
                                end
                            end
                        elseif (not IsShiftKeyDown()) and IsControlKeyDown() and (not IsAltKeyDown()) then
                            --只按下Ctr+右键点击：5秒倒数
                            if curAuctionList.countdownremaining > 5 then
                                if #bidderlist > 0 then --有人出价直接5秒倒数
                                    if Frame1.countDownTimer then
                                        if not Frame1.countDownTimer:IsCancelled() then
                                            Frame1.countDownTimer:Cancel()
                                        end
                                        Frame1.countDownTimer = nil
                                    end
                                    ZL_CURRENT.auctionlist[v].countdownremaining = 6
                                    MyAddon:TransmitAddonInfo("AUTOAUC SOUND", {type="录制", soundName="拍卖倒数.mp3", sysSoundName="拍卖倒数"})
                                else
                                    --无人出价直接流拍
                                    ZL_CURRENT.auctionlist[v].countdownremaining = 0.001
                                end
                                ZL_CURRENT.auctionlist[v].isPaused = false
                                local data = {
                                    type = "手动倒数",
                                    data2 = ZL_CURRENT.auctionlist[v],
                                }
                                MyAddon:TransmitAddonInfo("AUTOAUC SYNC5", data)
                            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" 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(nil, nil, nil, nil, nil, msgStr)
                                        end
                                    else
                                        local msgStr = "你已经是有效最高出价者，无需竞价！"
                                        ZL.Print(nil, nil, nil, nil, nil, msgStr)
                                    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 ()
                                        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 = "通报竞拍信息",
                                    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 = "关注",
                                func = function ()
                                    ZL.addItem(itemId)
                                end
                            })
                        else
                            tinsert(menuList, {
                                text = "取消关注",
                                func = function ()
                                    ZL.deleteItem(itemId)
                                end
                            })
                        end
                        if curAuctionList["lgnore"] then
                            tinsert(menuList, {
                                text = "取消忽略",
                                func = function ()
                                    lgnoreBtn:Click()
                                end
                            })
                        else
                            tinsert(menuList, {
                                text = "忽略",
                                func = function ()
                                    lgnoreBtn:Click()
                                end
                            })
                        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", 0, -20)
                else
                    sb:SetPoint("TOPLEFT", infoFrame.itemName, "TOPLEFT", 0, -2)
                    sb:SetPoint("BOTTOMRIGHT", infoFrame.itemName, "BOTTOMRIGHT", 0, -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
--[[
                if functionFrame:IsShown() then
                    local num = 0 --第一排
                    local num2 = 0 --第二排
                    local btnWidth = 5+CancelBtn:GetWidth()
                    if CancelBtn:IsShown() then
                        CancelBtn:ClearAllPoints()
                        CancelBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", num==0 and 5 or btnWidth*num+5, -3)
                        num = num + 1
                    end
                    if PauseBtn:IsShown() then
                        PauseBtn:ClearAllPoints()
                        PauseBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", num==0 and 5 or btnWidth*num+5, -3)
                        num = num + 1
                    end
                    if CountDownBtn:IsShown() then
                        CountDownBtn:ClearAllPoints()
                        CountDownBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", num==0 and 5 or btnWidth*num+5, -3)
                        num = num + 1
                    end
                    if packageBtn:IsShown() then
                        packageBtn:ClearAllPoints()
                        packageBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", num==0 and 5 or btnWidth*num+5, -3)
                        num = num + 1
                    end
                    if reverseBidBtn:IsShown() then
                        reverseBidBtn:ClearAllPoints()
                        if btnWidth*(num+1)+5 > functionFrame:GetWidth()+1 then
                            --前面的宽度+撤销出价按钮的宽度大于功能按钮总宽度，换到第二排
                            reverseBidBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", 5, -6-CancelBtn:GetHeight())
                            num2 = num2 + 1
                        else
                            reverseBidBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", num==0 and 5 or btnWidth*num+5, -3)
                            num = num + 1
                        end
                    end
                    if modifyBidBtn:IsShown() then
                        modifyBidBtn:ClearAllPoints()
                        if num2 > 0 then
                            modifyBidBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", btnWidth*num2+5, -6-CancelBtn:GetHeight())
                            num2 = num2 + 1
                        else
                            if btnWidth*(num+1)+5 > functionFrame:GetWidth()+1 then
                                --前面的宽度+同步按钮的宽度大于功能按钮总宽度，换到第二排
                                modifyBidBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", 5, -6-CancelBtn:GetHeight())
                                num2 = num2 + 1
                            else
                                modifyBidBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", num==0 and 5 or btnWidth*num+5, -3)
                                num = num + 1
                            end
                        end
                    end
                    if syncBtn:IsShown() then
                        syncBtn:ClearAllPoints()
                        if num2 > 0 then
                            syncBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", btnWidth*num2+5, -6-CancelBtn:GetHeight())
                            num2 = num2 + 1
                        else
                            if btnWidth*(num+1)+5 > functionFrame:GetWidth()+1 then
                                --前面的宽度+同步按钮的宽度大于功能按钮总宽度，换到第二排
                                syncBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", 5, -6-CancelBtn:GetHeight())
                                num2 = num2 + 1
                            else
                                syncBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", num==0 and 5 or btnWidth*num+5, -3)
                                num = num + 1
                            end
                        end
                    end
                    if delAuctionBtn:IsShown() then
                        delAuctionBtn:ClearAllPoints()
                        if num2 > 0 then
                            delAuctionBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", btnWidth*num2+5, -6-CancelBtn:GetHeight())
                            num2 = num2 + 1
                        else
                            if btnWidth*(num+1)+5 > functionFrame:GetWidth()+1 then
                                --前面的宽度+撤销出价按钮的宽度大于功能按钮总宽度，换到第二排
                                delAuctionBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", 5, -6-CancelBtn:GetHeight())
                                num2 = num2 + 1
                            else
                                delAuctionBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", num==0 and 5 or btnWidth*num+5, -3)
                                num = num + 1
                            end
                        end
                    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.countdownremaining
                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
                    if bindType == 2 then
                        buweiString:SetText("|cffffd100" .. itemSubType .. "|r")
                    else
                        buweiString:SetText(itemSubType)
                    end
                    do
                        local bili = buweiString:GetWidth()/buweiString:GetStringWidth()
                        if bili < 1 then
                            if bili < 0.8 then bili = 0.8 end
                            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:SetText(_itemlink)
                local bili = infoFrame.itemName:GetWidth()/infoFrame.itemName:GetStringWidth()
                if bili < 1 then
                    if bili < 0.8 then bili = 0.8 end
                    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 and ZL_CURRENT.globalConfig["auctionTimer"]) and ZL_CURRENT.globalConfig["auctionTimer"] or ZL.opt.auctionTimer
                local auctionTimerRefresh = (ZL_CURRENT.globalConfig and ZL_CURRENT.globalConfig["auctionTimerRefresh"]) and ZL_CURRENT.globalConfig["auctionTimerRefresh"] or ZL.opt.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
                    Frame1.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 .. "\n|cff00ff00(以拍卖时为准)|r")
                    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 (tonumber(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)
                        elseif Frame1.countDownTimer:IsCancelled() then
                            Frame1.countDownTimer:Invoke()
                        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 = bidderText .. "\n你|cffffd100(" .. bidData.bidamount .. "x" .. count .. ")|r"
                                        else
                                            bidderText = bidderText .. "\n你|cffffd100(" .. bidData.bidamount .. ")|r"
                                        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 .. "\n|cff00ff00当前无人出价！|r")
                    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
                    Frame1.confirmBid = nil
                    timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
                    timeString:SetTextColor(0.95, 0.95, 0.95, 1)
                    timeString:SetText("成功")
                    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 = 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
                                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 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 itemId = curAuction.itemId
        local itemlink = curAuction.itemlink
        local itemindex = curAuction.itemindex
        local countdownremaining = curAuction.countdownremaining
        local itemCount = curAuction.itemCount
        local bidderlist = curAuction.bidderlist
        local Frame1 = AuctionFrame.entries[_index]
        local sb = Frame1.infoFrame.sb
        local timeString = sb.timeString
        if ZL_CURRENT.auctionlist[_index].isPaused then
            timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            timeString:SetText("|cffff0000暂停中|r")
            return
        end
        countdownremaining = countdownremaining - 1
        sb:SetValue(countdownremaining)
        if ZL.IsCandidate(_index) then
            timeString:SetText(ConvertSecondsToTime(countdownremaining))
        else
            timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
            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
            timeString:SetFont(GameFontNormal:GetFont(), 18, "OUTLINE")
            timeString:SetTextColor(1, 0.82, 0, 1)
            sb:SetStatusBarColor(1, 0, 0)
        elseif countdownremaining > 0 then
            timeString:SetFont(GameFontNormal:GetFont(), 18, "OUTLINE")
            timeString:SetTextColor(1, 0.82, 0, 1)
            sb:SetStatusBarColor(1, 0, 0)
            -- 5秒倒数
            if PlayerIsML() then
                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
                if ZL.opt.CountdownAnnounceRaidWarning and (UnitIsGroupLeader("player") or UnitIsRaidOfficer("player")) then
                    SendChatMessage(msgStr, "RAID_WARNING")
                else
                    SendChatMessage(msgStr, ZL.MsgChannel())
                end
            end
            if ZL.opt.IsVoiceReminder and (((not ZL_CURRENT.globalConfig) or (not ZL_CURRENT.globalConfig.YYSound)) or PlayerIsML()) then
                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
            Frame1.confirmBid = nil
            if curAuction.index then curAuction.index = nil end
            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() then
                            if bidData.bidder == GetClassColorName(UnitName("player")) 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
                        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 = {}
                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() then
                    if isSelf then
                        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
                                        --自己拍卖到的物品放到指定背包
                                        local function linshi()
                                            if InCombatLockdown() or UnitIsDeadOrGhost("player") then
                                                C_Timer.After(0.5, linshi)
                                            else
                                                C_Timer.After(1, function ()
                                                    ZL.PutAuctionItemInBag(itemGUID_key, ZL.opt.selfBagId, ZL.opt.selfDirection)
                                                end)
                                            end
                                        end
                                        linshi()
                                        -- break --自己拍到的物品只需要放置一个就行
                                    end
                                end
                            end
                        end
                    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={}}
                        local data = {}
                        ZL_CURRENT.auctionlist[_index].state = "success"
                        ZL_CURRENT.auctionlist[_index].countdownremaining = 0
                        -- ZL_CURRENT.auctionlist[_index].Frame1IsShown = false
                        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",
                                ["countdownremaining"] = data2.countdownremaining,
                                ["isPaused"] = data2.isPaused,
                                ["stackCount"] = data2.stackCount,
                                ["spawnUID"] = failedSpawnUIDList,
                                ["bidderlist"] = {},
                                ["sourceGUID"] = data2.sourceGUID,
                                ["tradeId"] = nil,
                                -- ["Frame1IsShown"] = false,
                                ["lgnore"] = false,
                                ["itemSubType"] = data2.itemSubType,
                                ["createTime"] = date("%Y-%m-%d %H:%M:%S", time()),
                            },
                        }
                        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)
                        MyAddon:TransmitAddonInfo("AUTOAUC SYNC7", sendData)
                        msgStr = ("%s%d个拍卖成功！获胜者：%s祝贺！%d个流拍！"):format(itemlink, successBidderCount, msgStr, liuPaiItemCount)
                        local index = 1
                        local function changeBag()
                            if index <= #itemGUIDList then
                                local itemGUID = itemGUIDList[index]
                                local function linshi()
                                    if InCombatLockdown() or UnitIsDeadOrGhost("player") then
                                        C_Timer.After(0.5, linshi)
                                    else
                                        C_Timer.After(1, 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
                                        end)
                                    end
                                end
                                linshi()
                                index = index + 1
                                C_Timer.After(1.5, changeBag)
                            end
                        end
                        changeBag()
                    else
                        ZL_CURRENT.auctionlist[_index].state = "success"
                        ZL_CURRENT.auctionlist[_index].countdownremaining = 0
                        -- ZL_CURRENT.auctionlist[_index].Frame1IsShown = false
                        local data = {
                            type = "拍卖成功",
                            data2 = ZL_CURRENT.auctionlist[_index],
                        }
                        MyAddon:TransmitAddonInfo("AUTOAUC SYNC6", data)
                        msgStr = ("%s拍卖成功！获胜者：%s祝贺！"):format(itemlink, msgStr)
                    end
                    SendChatMessage(msgStr, ZL.MsgChannel())
                end
                timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
                timeString:SetTextColor(0.95, 0.95, 0.95, 1)
                timeString:SetText("成功")
            else
                if PlayerIsML() then
                    local itemGUIDList = {}
                    if curAuction["itemGUID"] and next(curAuction["itemGUID"], nil) then
                        for itemGUID, _ in pairs(curAuction["itemGUID"]) do
                            table.insert(itemGUIDList, itemGUID)
                        end
                    end
                    local index = 1
                    local function changeBag()
                        if index <= #itemGUIDList then
                            local itemGUID = itemGUIDList[index]
                            local function linshi()
                                if InCombatLockdown() or UnitIsDeadOrGhost("player") then
                                    C_Timer.After(0.5, linshi)
                                else
                                    C_Timer.After(1, 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
                                    end)
                                end
                            end
                            linshi()
                            index = index + 1
                            C_Timer.After(1, changeBag)
                        end
                    end
                    changeBag()
                    msgStr = ("%s 流拍！"):format(itemlink)
                    SendChatMessage(msgStr, ZL.MsgChannel())
                    ZL_CURRENT.auctionlist[_index].state = "failed"
                    ZL_CURRENT.auctionlist[_index].countdownremaining = 0
                    -- ZL_CURRENT.auctionlist[_index].Frame1IsShown = false
                    local data = {
                        type = "流拍",
                        data2 = ZL_CURRENT.auctionlist[_index],
                    }
                    MyAddon:TransmitAddonInfo("AUTOAUC SYNC8", data)
                end
                timeString:SetFont(GameFontNormal:GetFont(), 13, "OUTLINE")
                timeString:SetTextColor(0.95, 0.95, 0.95, 1)
                timeString:SetText("|cffff0000流拍|r")
                if ZL.opt.IsVoiceReminder and (((not ZL_CURRENT.globalConfig) or (not ZL_CURRENT.globalConfig.YYSound)) or PlayerIsML()) then
                    PlaySoundFile("Interface\\AddOns\\" .. addonName .. "\\sound\\" .. ZL.SoundType .. "\\物品已流拍.mp3", "Master")
                end
            end
            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
        ZL_CURRENT.auctionlist[_index].countdownremaining = countdownremaining
    end
    function AuctionFrame:Update()
        local height = 0
        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()
                    f:SetPoint("TOPLEFT", content, "TOPLEFT", 3, -1-height)
                    f:SetPoint("BOTTOMRIGHT", content, "TOPRIGHT", -1, -47-height)
                    if PlayerIsML() and data.state == "waiting" and (not data.lgnore) and (not data.isPackage) and data.bindType == 1 then
                        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)
        if ZL.FloatAuctionFrame and ZL.FloatAuctionFrame:IsShown() then
            if not ZL_CURRENT.auctionlist then
                ZL.FloatAuctionFrame:Hide()
            else
                ZL.FloatAuctionFrame:Update()
            end
        end
        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())
        -- if changeSize then
        --     AuctionFrame:SetWidth(AuctionFrame:GetWidth()+0.5)
        --     C_Timer.After(0.5, function ()
        --         AuctionFrame:SetWidth(AuctionFrame:GetWidth()-0.5)
        --     end)
        -- end
    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() 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(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, 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:SetText(itemlink)
                local textwidth = math.floor(self.itemNameFont:GetStringWidth()) + 10
                if textwidth > 90 then
                    self.itemNameFont:SetTextScale(92/textwidth)
                else
                    self.itemNameFont:SetTextScale(1)
                end
				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(nil, nil, nil, nil, nil, 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:SetText(itemlink)
                self.lootCheckButton:SetChecked(ZL_SETTING["filterItemId"][v].loot)
                self.auctionCheckButton:SetChecked(ZL_SETTING["filterItemId"][v].auction)
                local textwidth = math.floor(self.itemNameFont:GetStringWidth()) + 10
                if textwidth > 150 then
                    self.itemNameFont:SetTextScale(92/textwidth)
                end
				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.AuctionFrame2.MLFrame.SaveBtn:Click() 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())
                        C_VoiceChat.SpeakText(C_TTSSettings.GetVoiceOptionID(0), msgStr, 1, 3, 100)
                        ZL.Print(nil, nil, nil, nil, nil, msgStr)
                    else
                        ZL.Print(nil, nil, nil, nil, nil, "没有需要邮寄的成员！")
                    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(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, msgStr)
            return
        end
        local playerBuyList = ZL.GetPlayerBuyList()
        local WagesGroupMembers, _, _, RL = ZL.GetWagesGroupMembers()
        if ZL.GetNeedMailNums() > 0 then
            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
                                        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", time())
                                        else
                                            contentText = "尊敬的" .. targetName .. "勇士：\n\n　　感谢您的付出，这是您的工资，请及时查收，期待您下次加入！\n\n\n　　　　　　　" .. date("%Y-%m-%d %H:%M", time())
                                        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
    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(nil, nil, nil, nil, nil, msgStr)
            return
        end
        local numGroupMembers, RLBuTie, totalincome, totalpayout, totalamount, averageamount = GetAveWages()
        local function gourp()
            local delay = 0
            if ZL.mailRegOpen then
                ZL.mailRegOpen = false
                playerBalanceFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
                for i = 1, 2 do
                    SendChatMessage("已停止邮寄登记！", ZL.MsgChannel())
                end
                delay = 0.3
            end
            if not ZL_CURRENT["aveWages"] then
                ZL.Print(nil, nil, nil, nil, nil, "没有工资成员记录！")
                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
                local playerBuyList = ZL.GetPlayerBuyList()
                -- 遍历每个团队成员
                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)
                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, 10)
                        end
                        wipe(msglist)
                    end
                    index = index + 1
                    C_Timer.After(0.3, sendMessage)
                end
            end
            sendMessage()
        end
        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
        if button == "LeftButton" then
            if IsShiftKeyDown() then
                local playerBuyList = ZL.GetPlayerBuyList()
                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()
                end
            else
                statistics()
                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
                        playerBalanceFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
                        for i = 1, 2 do
                            SendChatMessage("已停止邮寄登记！", ZL.MsgChannel())
                        end
                        delay = 0.3
                    end
                    if not ZL_CURRENT["aveWages"] then
                        ZL.Print(nil, nil, nil, nil, nil, "没有工资成员记录！")
                        return
                    end
                    C_Timer.After(delay, function ()
                        local msgStr = ""
                        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
        else
            statistics()
            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
    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:SetText("队")
    groupFont:SetWordWrap(false)
    groupFont:SetJustifyH("CENTER")
    local bili = groupFont:GetWidth()/(groupFont:GetStringWidth()+5)
    if bili < 1 then
        groupFont:SetTextScale(bili)
    end

    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:SetText("比例(%)")
    biLiFont:SetWordWrap(false)
    biLiFont:SetJustifyH("CENTER")
    local stringWidth = biLiFont:GetStringWidth()+5
    if stringWidth > 50 then
        biLiFont:SetTextScale(50/stringWidth)
    end

    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
                        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
                    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
                    ZL.OverviewFrame:Show()
                    ZL.OverviewFrame:Update(ZL_HISTORY[v])
                elseif button == "RightButton" then
                    StaticPopup_Show("ZL_DELETEHISTORYWARNING", nil, nil, 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() then
                    if ZL.AuctionFrame2.MLFrame.syncAllBtn:IsEnabled() then
                        if GetAuctioningCount() > 0 then
                            ZL.Print(nil, nil, nil, nil, nil, "存在正在拍卖中的物品，无法切换！")
                            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()
                        ZL.AuctionFrame2.MLFrame.syncAllBtn:Click() --ML切换后需要全团同步数据
                        historyFrame:Update()
                        currentIncomeFrame:Update()
                        playerBalanceFrame:Update()
                    else
                        msgStr = "距离上次同步还未到15秒，请稍后再切换！"
                        ZL.Print(nil, nil, nil, nil, nil, msgStr)
                    end
                else
                    msgStr = "你不是ML，无法使用切换历史拍卖记录功能！"
                    ZL.Print(nil, nil, nil, nil, nil, 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)
                -- local textwidth = math.floor(self.itemNameFont:GetStringWidth()) + 10
                -- if textwidth > 90 then
                --     self.itemNameFont:SetTextScale(92/textwidth)
                -- end
            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
                            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
                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,
                        }
                        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(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, msgStr)
                    return
                end
                if (not _G["MailFrame"]) or (not _G["MailFrame"]:IsShown()) then
                    ZL.Print(nil, nil, nil, nil, nil, "先打开邮箱！")
                    return
                end
                if ZL.Recipient then
                    ZL.Print(nil, nil, nil, nil, nil, "前面邮件发送还未结束，请稍后重试！")
                    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()
                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", time())
                else
                    contentText = "尊敬的" .. targetName .. "勇士：\n\n　　感谢您的付出，这是您的工资，请及时查收，期待您下次加入！\n\n\n　　　　　　　" .. date("%Y-%m-%d %H:%M", time())
                    -- contentText = "尊敬的" .. targetName .. "勇士：\n\n　　感谢您的付出，补发[堕落黑暗之刃]拍卖所得3000G，这是您的补发工资：" .. gongZi .. "g，请及时查收，期待您下次加入！\n\n\n　　　　　　　" .. date("%Y-%m-%d %H:%M", time())
                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
            -- playerBalanceFont:SetText("工资")
            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("OnEditFocusGained", 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 bidderlist = ZL_CURRENT.auctionlist[index].bidderlist
                                            for _, data in ipairs(bidderlist) do
                                                if data.bidder == playerName then
                                                    ZL.Print(nil, nil, nil, nil, nil, "名字已存在，请重新选择！")
                                                    return
                                                end
                                            end
                                            f.nameEditBox:SetText(playerName)
                                            f.nameEditBox:ClearFocus()
                                            ZL_CURRENT.auctionlist[index].bidderlist[v].bidder = playerName
                                            ZL.AuctionFrame2.entries[index]:SetValues(index)
                                            ZL.AuctionFrame2.entries[index].MLframe.functionFrame.syncBtn:Click()
                                        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 bidAmount = self:GetText()
                bidAmount = bidAmount:gsub("|cffff0000", ""):gsub("|r", "")
                bidAmount = tonumber(bidAmount)
                bidAmount = (bidAmount > 0 and bidAmount) or 0
                if bidAmount> 0 and bidAmount ~= ZL_CURRENT.auctionlist[index].bidderlist[v].bidamount then
                    ZL_CURRENT.auctionlist[index].bidderlist[v].bidamount = bidAmount
                    BidderListFrame:Update(index)
                    ZL.AuctionFrame2.entries[index]:SetValues(index)
                    ZL.AuctionFrame2.entries[index].MLframe.functionFrame.syncBtn:Click()

                    for _, ff in ipairs(BidderListFrame.entries) do ff.bidAmountEditBox:Disable() end
                    C_Timer.After(2, function ()
                        for _, ff in ipairs(BidderListFrame.entries) do ff.bidAmountEditBox:Enable() end
                    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,
                }
                MyAddon:TransmitAddonInfo("AUTOAUC SYNC15", fdata)
                --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(nil, nil, nil, nil, nil, 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 = {}
            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
            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(nil, nil, nil, nil, nil, msgStr)
            end
        else
            msgStr = "没有流拍物品！"
            ZL.Print(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, msgStr)
            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(nil, nil, nil, nil, nil, msgStr)
            return
        end
        if not IsInRaid() then
            msgStr = "不在团队中，无法小队交易工资！"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            return
        end
        local subgroup, members = GetPlayerSubgroupAndMembers(noColorName)
        if not subgroup then
            msgStr = "【" .. tradePartner .. "】不在团队中，无法小队交易工资！"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            return
        end
        local _subgroup = GetPlayerSubgroupAndMembers(UnitName("player"))
        if subgroup == _subgroup then
            msgStr = "【" .. tradePartner .. "】跟你在一个小队，无法小队交易工资，请使用单个交易！"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            return
        end
        if ZL_CURRENT.tradeGroupGongZi and ZL_CURRENT.tradeGroupGongZi[tostring(subgroup)] then
            msgStr = subgroup .. "队|cffff0000已交易过工资，不要重复交易哦！|r"
            ZL.Print(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, msgStr)
            return
        end
        if #isMail > 0 then
            msgStr = "存在需邮寄工资成员：" .. table.concat(isMail, "，") .. "，无法交易工资"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            return
        end
        if groupTotal <= 0 then
            msgStr = "【" .. subgroup .. "队】工资合计：" .. groupTotal .. "，无法交易工资！"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            return
        end
        if GetMoney() < groupTotal*10000 then
            msgStr = "|cffff0000金币不足，无法交易工资！|r"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            return
        end
        MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, groupTotal * 10000)
        ZL.tradeGongZi = nil
        ZL.tradeName = noColorName
        ZL.tradeGroupGongZi = gongziList
        ZL.tradeGroup = subgroup
        local raidIndex = UnitInRaid(noColorName)
        if raidIndex then
            MyAddon:TransmitAddonInfo2("AUTOAUC WSP" .. raidIndex, ZL_CURRENT, "WHISPER", noColorName)
        end
        C_Timer.After(0.5, function ()
            TradeFrameTradeButton:Click()
        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() 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)
        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()
        local msgStr
        if (not ZL_CURRENT["aveWages"]) then
            msgStr = "无法计算工资！"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            return
        end
        if PlayerIsML() then
            if ZL_CURRENT.tradeGongZi and ZL_CURRENT.tradeGongZi[name] then
                msgStr = name .. "|cffff0000已交易过工资！|r"
                ZL.Print(nil, nil, nil, nil, nil, msgStr)
                return
            end
        else
            if ZL_PLAYERLIST.otherTradeGongZi and ZL_PLAYERLIST.otherTradeGongZi[name] then
                msgStr = name .. "|cffff0000已交易过工资！|r"
                ZL.Print(nil, nil, nil, nil, nil, msgStr)
                return
            else
                local subgroup = GetPlayerSubgroupAndMembers(noColorName)
                local _subgroup = GetPlayerSubgroupAndMembers(UnitName("player"))
                if subgroup ~= _subgroup then
                    msgStr = name .. "|cffff0000不是本队成员，无法交易工资！|r"
                    ZL.Print(nil, nil, nil, nil, nil, msgStr)
                    return
                end
            end
        end
        if ZL_CURRENT["mailPlayers"] and ZL_CURRENT["mailPlayers"][name] == true then
            msgStr = "|cffff0000工资已经邮寄！|r"
            ZL.Print(nil, nil, nil, nil, nil, 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(nil, nil, nil, nil, nil, msgStr)
            return
        end
        if GetMoney() < total*10000 then
            msgStr = "|cffff0000金币不足，无法交易工资！|r"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            return
        end
        MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, total * 10000)
        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 ()
            TradeFrameTradeButton:Click()
        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: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("|cfffffff0提醒：请及时加载用户界面(|r|cffffd100/rl|r|cfffffff0)保存数据哦|r")

    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("TOOLTIP")
    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)
end

--创建监控拍卖WA发送状态窗口
function ZL:CreateWaLoadStateFrame()
    ZL.WaLoadStateFrame = ZLCreateFrame(nil, nil, nil, nil, nil, true, true, "拍卖WA发送状态")
    local WaLoadStateFrame = ZL.WaLoadStateFrame
    WaLoadStateFrame:SetPoint("CENTER")
    WaLoadStateFrame:SetResizable(true)
    WaLoadStateFrame:SetSize(270, 220)
    WaLoadStateFrame:SetResizeBounds(270, 220, 270, GetScreenHeight()-110) -- 设置最小尺寸，以避免框架被缩小到看不见
    WaLoadStateFrame.closeButton:SetScript("OnClick", function (self)
        WaLoadStateFrame:Hide()
        print(Prefix("|cff00ff00右键|r点击拍卖清单窗口图标|TInterface\\AddOns\\" .. addonName .. "\\Images\\remain.png:12|t可显示"))
    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
                    SendChatMessage("已重置传输次数，可以重新申请传输WA", "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
    })
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:GetEffectiveScale()
    local height = 20
    local gapwidth = 20
    local gapheight = 0
    local itemNamewidth = 160/UIScale
    local playerNamewidth = 110/UIScale
    local amountwidth = 70/UIScale
    local BOSSwidth =(GetScreenWidth()-65-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
            recordList["拍卖合计"] = {
                ["总收入"] = {
                    ["拾取1"] = {
                        ["lootName"] = " ",
                        ["counts"] = 0,
                        ["itemLevel"] = 1,
                    },
                    [" "] = {
                        counts = 1,
                        totalAmount = totalAmount,
                    }
                }
            }
        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补贴", "食物补贴", "修星补贴", "工具人补贴"}
                        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:GetStringWidth() 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()-8)/f.itemNamebox.fontstring:GetStringWidth() 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()-8)/f.playerNamebox.fontstring:GetStringWidth() 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()-8)/f.amountbox.fontstring:GetStringWidth() 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:GetStringWidth() 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()-8)/f.itemNamebox.fontstring:GetStringWidth() 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()-8)/f.playerNamebox.fontstring:GetStringWidth() 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()-8)/f.amountbox.fontstring:GetStringWidth() 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 (not DisenchantingFrame.startDisenchant) and (ZL.DisenchantingFrame and ZL.DisenchantingFrame:IsShown()) then
                DisenchantingFrame:Update()
            end
            if DisenchantingFrame.hasSpellcastSucceeded then
                C_Timer.After(0.5, function ()
                    DisenchantingFrame:Update()
                    DisenchantingFrame.hasSpellcastSucceeded = nil
                end)
            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(nil, nil, nil, nil, nil, "已永久忽略分解，可到左侧隐藏窗口恢复！")
                else
                    if not ZL.disenchantingLgnoreList then ZL.disenchantingLgnoreList = {} end
                    ZL.disenchantingLgnoreList[tostring(itemId)] = f.itemLink
                    ZL.Print(nil, nil, nil, nil, nil, "已临时忽略分解，重新加载UI后会显示！")
                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() 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