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

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

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

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

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

    functionFrame.syncBtn = CreateButton(nil, functionFrame, "同步", "LEFT", modifyBidBtn, "RIGHT", 5, 0, 40, 18)
    local syncBtn = functionFrame.syncBtn

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

    functionFrame:SetSize(bidFrame:GetWidth(), 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)
        ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Hide()
    end)
    function FloatAuctionFrame.OnShow()
        if ZL.FloatAuctionFrame.time and (not ZL.FloatAuctionFrame.time:IsCancelled()) then
            ZL.FloatAuctionFrame.time:Cancel()
        end
        if not FloatAuctionFrame:IsShown() then
            FloatAuctionFrame:Show()
        end
    end
    function FloatAuctionFrame.OnHide()
        if (not FloatAuctionFrame: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]
            self:ClearAllPoints()
            self:SetPoint("LEFT", f.bidderFrame, "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

                local curAuction = ZL_CURRENT.auctionlist[ZL.FloatAuctionFrame.index]
                if curAuction.state and curAuction.state == "auctioning" then
                    local _, bidIncrement, newBid, _bidCount, successList = ZL.GetNewBidAmount(ZL.FloatAuctionFrame.index)
                    local bidCount = bidCounts:GetNumber()
                    local itemCount = curAuction.itemCount
                    bidCount = bidCount > 0 and bidCount or 1
                    bidCount = bidCount > itemCount and itemCount or bidCount
                    if bidCount > _bidCount and #successList > 0 then
                        for i = #successList, 1, -1 do
                            if successList[i][2] >= bidCount then
                                newBid = successList[i][1] + bidIncrement
                                break
                            end
                        end
                    end
                    bidEditBox:SetNumber(newBid)
                else
                    bidEditBox:SetText("")
                end
                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("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
    AuctionFrame.iconHeaderBtn = CreateHeaderButton(AuctionFrame, 151, 21)
    local iconHeaderBtn = AuctionFrame.iconHeaderBtn
    iconHeaderBtn:SetPoint("TOPLEFT", AuctionFrame.TitleBottom, "BOTTOMLEFT", 3, -5)
    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("双击物品图标可|cffff0000关注/取关|r该物品", 1, 1, 1)
        GameTooltip:AddLine("关注物品开始拍卖时会强制弹窗\n并且有拍卖语音提醒", 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, -5)
    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))
                            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
                            )  -- data.itemCount or 
                        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")
                            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)
        --"您确定要重置当前拍卖记录么？确定将清空当前拍卖记录，并保存到历史记录中！"
        ZL_PLAYERLIST = {}
        if (not ZL_CURRENT.auctionlist) or (#ZL_CURRENT.auctionlist == 0) then
            local msgStr = "当前没有拍卖物品记录！"
            ZL.Print(nil, nil, nil, nil, nil, msgStr)
            ZL_CURRENT = {}
        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)

    --记录：[[Interface\Buttons\UI-GuildButton-PublicNote-Up.blp]]
    --规则通知："Interface\\Buttons\\UI-GuildButton-MOTD-Up.blp" 
    --规则通知2：[[Interface\FriendsFrame\UI-FriendsList-Large-Up.blp]]
    --同步：
    --聊天："Interface\\CHATFRAME\\UI-ChatIcon-Chat-Up.blp"
    --开始：[[Interface\BUTTONS\UI-SpellbookIcon-NextPage-Up.blp]]
    --暂停：[[Interface\TIMEMANAGER\PauseButton.blp]]
    --停止：[[Interface\TIMEMANAGER\ResetButton.blp]]
    --流拍：[[Interface\COMMON\icon-noloot.blp]]
    --出价：[[Interface\CURSOR\Buy.blp]]
    --警告：[[Interface\DialogFrame\UI-Dialog-Icon-AlertNew.blp]]
    --倒数：[[Interface\FriendsFrame\Battlenet-D3icon.blp]]
    --撤销：[[Interface\GLUES\CHARACTERCREATE\UI-RotationRight-Big-Up.blp]]
    --问号：[[Interface\GossipFrame\ActiveQuestIcon.blp]]
    --邮寄：[[Interface\MINIMAP\TRACKING\Mailbox.blp]]
    --忽略：[[Interface\PaperDollInfoFrame\UI-GearManager-LeaveItem-Transparent.blp]]
    --打包：[[Interface\TUTORIALFRAME\UI-TutorialFrame-Bag.blp]]


    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!S3BA3TvoscIE6Z8n9P50)c4W8LVMStknKuwYlN0(COLOTyNusEKOspz5YTEuIxjXoPivtELx6QY(iNzklzBjl707RP3TZfVKlpBzjV8FzkDjP(u9xyqGTlaUaxsj7ABMYvw28ceiqGabceaiqG)H98po5)yU)XCZhUCPPTlKVOv5(hkt6u9LS8r6FSXQyz)pm1hLlFLPkK9OzSoI9WJvQ8KzThEQHTZpP1W5oAXStMF0HTNOSvLjkvi3rlFuAX(5SfhDIsL3xP8fThPRK9Lj5atfWmMiF9pm1)1rNUIDPjbigAQCzTTgW6qwfT)FLDAuQzTZp6(ZNZEIDNa9z5SJANVuXkDoqf7SLTBz35lM3()3VjxPH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XBJCXUjttUa58KjitrMKmo5JiXQM8hcs(ZTrg2fzebYhiKY0yhpVXWxNGn81V55sXUNgT1BTPnTjxleoRRqvLsmoBSg4UQsYfxKDzBKxSBO(e)H8CQ4OcunHx4rrsOqFCa0hmOVajK6y47G2RiX9IUbsli5QVa5AK5iZdx(Yw)LTOgQv3n2K7o2Yq)NJ))(
]=]
                if not ZL.WaStringFrame then
                    local titleText = "如果有老版本的，先删除，再复制导入到WA中，然后|cffffffffShift+右键点击齿轮|r发送字符串到聊天窗口"
                    ZL.WaStringFrame = ZLCreateFrame(nil, nil, nil, nil, nil, true, true, titleText)
                    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(), 10, "")
                    editBox:SetTextColor(0.95, 0.95, 0.95)
                end
                local editBox = ZL.WaStringFrame.scrollFrame.editBox
                editBox:SetText(WaString)
                editBox:HighlightText()
                editBox:SetFocus()
                ZL.WaStringFrame:Show()
            end
        end
    end)
    settingBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "RIGHT", "LEFT", -5, 0)
        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)
        GameTooltipShow(settingBtn, "RIGHT", "LEFT", -5, 0)
        GameTooltip:AddLine("点击查看帮助反馈")
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("下面为斜杠快捷命令，可添加到宏里")
        for _, key in ipairs(ZL.commandInfoKeyList) do
            local value = ZL.commandInfo[key]
            if value and value.label then
                if value.key == "" then
                    GameTooltip:AddLine("|cffffaa00/aa|r - " .. value.label, 1, 1, 1)
                else
                    GameTooltip:AddLine("|cffffaa00/aa " .. value.key .. "|r - " .. value.label, 1, 1, 1)
                end
            end
        end
        GameTooltip:Show()
    end)
    helpBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)
    helpBtn:SetScript("OnClick", function (self)
        ZL.OpenAceConfigDialog("金团拍卖助手", "help")
    end)

    AuctionFrame.StateFrame = CreateFrame("Frame", nil, AuctionFrame)
    local StateFrame = AuctionFrame.StateFrame
    StateFrame.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
        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 = tostring(data.itemId)
                        if ZL.opt.concern and ZL.opt.concern[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)

    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:SetScript("OnClick", StateFrameBtn_Set)
    ConcernBtn:SetScript("OnEnter", function (self)
        local concernCounts = select(7, stateCounts())
        GameTooltipShow(self, "TOP", "BOTTOM")
        GameTooltip:AddDoubleLine("关注：", concernCounts, nil, nil, nil, 1, 1, 1)
        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
    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)
                Frame1.zlHighlight:Hide()
                ZL.FloatAuctionFrame:Hide()
            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
            do
                local texture = Frame1:CreateTexture(nil, "BACKGROUND")
                texture:SetColorTexture(1, 0, 0, 0.5)
                texture:SetPoint("TOPLEFT")
                texture:SetPoint("BOTTOMRIGHT")
                texture:SetBlendMode("ADD")
                Frame1.concern = texture
                Frame1.concern: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()
                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 itemlink = ZL_CURRENT.auctionlist[v].itemlink
                local edit = GetCurrentKeyBoardFocus()
                if edit then
                    edit:Insert(itemlink)
                end
                -- HandleModifiedItemClick(itemlink)
            end)
            timerBtn:SetScript("OnDoubleClick", function (self, button)
                if not ZL.opt.concern then ZL.opt.concern = {} end
                local itemId = tostring(ZL_CURRENT.auctionlist[v].itemId)
                if ZL.opt.concern[itemId] then
                    ZL.opt.concern[itemId] = nil
                else
                    --关注物品不忽略
                    ZL.opt.concern[itemId] = true
                    ZL_CURRENT.auctionlist[v].lgnore = false
                end
                if ZL.opt.concern and ZL.opt.concern[itemId] then
                    Frame1.concern:Show()
                else
                    Frame1.concern:Hide()
                end
                AuctionFrame:Update()
            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:SetAllPoints(timerBtn)

            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)
            -- buweiString:SetText("主手")
        
            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()
            end)
            packageBtn:SetScript("OnClick", function (self)
                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)

            functionFrame.CountDownBtn = CreateButton(nil, functionFrame, "倒数", "RIGHT", packageBtn, "LEFT", -5, 0, 40, 18)
            local CountDownBtn = functionFrame.CountDownBtn
            CountDownBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
            CountDownBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("提示：")
                GameTooltip:AddLine("左键点击：|cffffffff有人出价直接5秒倒数|r")
                GameTooltip:AddLine("　　　　　|cffffffff没人出价直接流拍|r")
                GameTooltip:AddLine("Ctr+左键：|cffffffff停止倒数，刷新拍卖计时|r")
                GameTooltip:AddLine("右键点击：|cffffffff发送当前竞拍信息|r")
                GameTooltip:Show()
            end)
            CountDownBtn:SetScript("OnLeave", function (self)
                Frame1.zlHighlight:Hide()
                GameTooltip:Hide()
            end)
            CountDownBtn:SetScript("OnClick", function (self, button)
                local msgStr = ""
                local curAuctionList = ZL_CURRENT.auctionlist[v]
                local itemlink = curAuctionList.itemlink
                local bidderlist = ZL_CURRENT.auctionlist[v].bidderlist
                local _, _, tarbidamount, bidCount = ZL.GetNewBidAmount(v)
                if button == "LeftButton" then
                    if IsControlKeyDown() then
                        --取消倒数，重置拍卖时间
                        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 < curAuctionList.itemCount then
                                        local count = bidData["bidCount"] or 1
                                        local newTotalBidCount = totalBidCount + count
                                        if newTotalBidCount > curAuctionList.itemCount then
                                            count = curAuctionList.itemCount - totalBidCount
                                        end
                                        if count  > 1 then
                                            msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. "x" .. count .. ")，"
                                        else
                                            msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. ")，"
                                        end
                                        totalBidCount = newTotalBidCount
                                    else
                                        break
                                    end
                                end
                                msgStr = ("%s已停止倒数，请继续竞拍，当前出价：%s下次最低出价：%d，对应最大竞拍数量：%d"):format(
                                    curAuctionList.itemlink, msgStr, tarbidamount, bidCount
                                )
                                SendChatMessage(msgStr, ZL.MsgChannel())
                            else
                                msgStr = ("%s已停止倒数，请继续竞拍，当前无人出价，下次最低出价：%d，对应最大竞拍数量：%d"):format(
                                    curAuctionList.itemlink, tarbidamount, bidCount
                                )
                                SendChatMessage(msgStr, ZL.MsgChannel())
                            end
                        end
                    else
                        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 button == "RightButton" then --右键点击发送当前拍卖竞价信息，不倒数
                    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 count  > 1 then
                                    msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. "x" .. count .. ")，"
                                else
                                    msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. ")，"
                                end
                                totalBidCount = newTotalBidCount
                            else
                                break
                            end
                        end
                        msgStr = ("%s 当前出价：%s下次最低出价：%d，对应最大数量%d，不要就打P"):format(curAuctionList.itemlink, msgStr, tarbidamount, bidCount)
                    else
                        msgStr = ("%s 当前无人出价，下次最低出价：%d，对应最大数量%d"):format(curAuctionList.itemlink, tarbidamount, bidCount)
                    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)

            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)
                Frame1.zlHighlight:Hide()
            end)
            PauseBtn:SetScript("OnClick", function (self, button)
                local curAuctionList = ZL_CURRENT.auctionlist[v]
                if self:GetText() == "暂停" then
                    SendChatMessage(("%s已暂停拍卖！"):format(curAuctionList.itemlink), ZL.MsgChannel())
                    ZL_CURRENT.auctionlist[v].isPaused = true
                    local data = {
                        type = "暂停拍卖",
                        data2 = ZL_CURRENT.auctionlist[v],
                    }
                    MyAddon:TransmitAddonInfo("AUTOAUC SYNC3", data)
                else
                    local msgStr = ""
                    local bidderlist = ZL_CURRENT.auctionlist[v].bidderlist
                    tableSort(bidderlist)
                    local _, bidIncrement, newBid, bidCount = ZL.GetNewBidAmount(v)
                    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 count  > 1 then
                                    msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. "x" .. count .. ")，"
                                else
                                    msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. ")，"
                                end
                                totalBidCount = newTotalBidCount
                            else
                                break
                            end
                        end
                        msgStr = ("%s已恢复拍卖，有效出价：%s下次最低出价：%d，对应最大竞拍数量：%d"):format(
                            curAuctionList.itemlink, msgStr, newBid, bidCount
                        )
                        SendChatMessage(msgStr, ZL.MsgChannel())
                    else
                        SendChatMessage(("%s已恢复拍卖，当前无人出价，下次最低出价：%d，对应最大竞拍数量：%d"):format(
                            curAuctionList.itemlink, newBid, bidCount), ZL.MsgChannel()
                        )
                    end
                    ZL_CURRENT.auctionlist[v].isPaused = false
                    local data = {
                        type = "继续拍卖",
                        data2 = ZL_CURRENT.auctionlist[v],
                    }
                    MyAddon:TransmitAddonInfo("AUTOAUC SYNC4", data)
                end
                btnDelay(self)
            end)

            functionFrame.CancelBtn = CreateButton(nil, functionFrame, "开始", "RIGHT", PauseBtn, "LEFT", -5, 0, 40, 18)
            local CancelBtn = functionFrame.CancelBtn
            CancelBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
            CancelBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("提示：")
                GameTooltip:AddLine("|cff00ff00左键|r：开始/取消/重拍", 1, 1, 1)
                if self:GetText() ~= "取消" then
                    GameTooltip:AddLine("|cff00ff00Shift+左键|r：快速流拍", 1, 1, 1)
                end
                if self:GetText() == "开始" then
                    GameTooltip:AddLine("|cff00ff00Shift+右键|r：指定人员", 1, 1, 1)
                end
                GameTooltip:Show()
            end)
            CancelBtn:SetScript("OnLeave", function (self)
                Frame1.zlHighlight:Hide()
                GameTooltip:Hide()
            end)
            CancelBtn:SetScript("OnClick", function (self, button)
                if IsInRaid() then
                    local curAuctionList = ZL_CURRENT.auctionlist[v]
                    local bindType = curAuctionList.bindType
                    if button == "LeftButton" then
                        if self:GetText() == "取消" then
                            if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                                _G["ZL_NewAuctionFrameTab5"]:Click()
                            end
                            -- if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
                            --     for index, data in ipairs(ZL_CURRENT.auctionlist) do
                            --         if data.Frame1IsShown and (data.state == "waiting") and (not data.lgnore) and index ~= v then
                            --             ZL_CURRENT.auctionlist[index].Frame1IsShown = false
                            --         end
                            --     end
                            -- 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
                            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 = self: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 IsShiftKeyDown() and ZL_CURRENT.auctionlist[v].state ~= "failed" then
                                    ZL_CURRENT.auctionlist[v].countdownremaining = 1
                                else
                                    if curAuctionList.itemCount == 1 then
                                        if bindType == 2 then
                                            SendChatMessage(("装绑%s起拍价：%d，加价幅度：%d"):format(
                                                curAuctionList.itemlink, startbidamount, bidIncrement), ZL.MsgChannel()
                                            )
                                        else
                                            if curAuctionList.itemlink == "[打包拍卖]" then
                                                local itemList = ZL_CURRENT.auctionlist[v]["itemList"]
                                                if itemList and next(itemList, nil) then
                                                    SendChatMessage("打包拍卖清单：", "RAID")
                                                    C_Timer.After(0.3, function ()
                                                        for _itemlink, data in pairs(itemList) do
                                                            msgStr = _itemlink .. "x" .. data.itemCount
                                                            SendChatMessage(msgStr, "RAID")
                                                        end
                                                        C_Timer.After(0.3, function ()
                                                            SendChatMessage(("以上%s，起拍价：%d，加价幅度：%d"):format(
                                                                curAuctionList.itemlink, startbidamount, bidIncrement), ZL.MsgChannel()
                                                            )
                                                        end)
                                                    end)
                                                else
                                                    msgStr = "没有打包拍卖物品，请先添加！"
                                                    ZL.Print(nil, nil, nil, nil, nil, msgStr)
                                                    return
                                                end
                                            else
                                                SendChatMessage(("%s起拍价：%d，加价幅度：%d"):format(
                                                    curAuctionList.itemlink, startbidamount, bidIncrement), ZL.MsgChannel()
                                                )
                                            end
                                        end
                                    else
                                        if bindType == 2 then
                                            SendChatMessage(("装绑%sx%d，起拍价：%d，加价幅度：%d"):format(
                                                curAuctionList.itemlink, curAuctionList.itemCount, startbidamount, bidIncrement), ZL.MsgChannel()
                                            )
                                        else
                                            SendChatMessage(("%sx%d，起拍价：%d，加价幅度：%d"):format(
                                                curAuctionList.itemlink, curAuctionList.itemCount, startbidamount, bidIncrement), ZL.MsgChannel()
                                            )
                                            if curAuctionList.itemId == 47242 then
                                                C_Timer.After(0.3, function ()
                                                    SendChatMessage(("出价格式为：出价x数量，中间支持：*-xX和空格，不支持中文乘号！相同出价的先出价的优先！"), ZL.MsgChannel())
                                                end)
                                            end
                                        end
                                    end
                                    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 = {}
                                -- 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
                        btnDelay(self)
                    elseif button == "RightButton" then
                        if self:GetText() == "开始" and IsShiftKeyDown() then
                            curAuctionList.index = v
                            local data = {
                                ["type"] = "指定人员",
                                ["data"] = curAuctionList,
                            }
                            StaticPopup_Show("ZL_ADDINCOME", "收入", nil, data)
                        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)
                Frame1.zlHighlight:Hide()
                GameTooltip:Hide()
            end)
            reverseBidBtn:SetScript("OnClick", function (self, button)
                local curAuctionList = ZL_CURRENT.auctionlist[v]
                local bidderlist = ZL_CURRENT.auctionlist[v].bidderlist
                if bidderlist and #bidderlist > 0 then
                    if button == "LeftButton" then
                        MyAddon:TransmitAddonInfo("AUTOAUC REVOKE", {
                            itemlink=curAuctionList.itemlink, itemindex=curAuctionList.itemindex, playerName=bidderlist[1].bidder
                        })
                    elseif button == "RightButton" then
                        local data = {itemlink=curAuctionList.itemlink, itemindex=curAuctionList.itemindex}
                        StaticPopup_Show("ZL_REVOKEBID", nil, nil, data, ZL.GroupMembersDropdown)
                    end
                    btnDelay(self)
                else
                    ZL.Print(nil, nil, nil, nil, nil, "当前无人出价！")
                end
            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)
                Frame1.zlHighlight:Hide()
                GameTooltip:Hide()
            end)
            modifyBidBtn:SetScript("OnClick", function (self)
                ZL.BidderListFrame.index = v
                local BidderListFrame = ZL.BidderListFrame
                if BidderListFrame:IsShown() then
                    BidderListFrame:Hide()
                else
                    BidderListFrame:ClearAllPoints()
                    BidderListFrame:SetPoint("TOPRIGHT", Frame1.bidderFrame, "BOTTOMRIGHT", 0, 0)
                    BidderListFrame:Show()
                    BidderListFrame:Update(v)
                end
            end)

            functionFrame.syncBtn = CreateButton(nil, functionFrame, "同步", "LEFT", modifyBidBtn, "RIGHT", 5, 0, 40, 18)
            local syncBtn = functionFrame.syncBtn
            syncBtn:SetScript("OnEnter", function (self)
                zlHighlightOnShow(v)
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("全团成员同步ML单个拍卖物品数据", 1, 1, 1)
                GameTooltip:Show()
            end)
            syncBtn:SetScript("OnLeave", function (self)
                Frame1.zlHighlight:Hide()
                GameTooltip:Hide()
            end)
            syncBtn:SetScript("OnClick", function (self)
                local data = {
                    type = "同步单个",
                    data2 = ZL_CURRENT.auctionlist[v],
                }
                MyAddon:TransmitAddonInfo("AUTOAUC SYNC13", data)
                btnDelay(self)
            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)
                Frame1.zlHighlight:Hide()
                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+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()
                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()
                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()
                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 not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                            SendChatMessage(msgStr, "RAID")
                        else
                            SendChatMessage(curAuctionList.itemlink .. msgStr, "RAID")
                        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", bidboxfunc)
            bidEditBox:SetScript("OnMouseDown", function(self, button)
                if button == "RightButton" and self:HasFocus() then
                    bidboxfunc(self)
                end
            end)
            bidEditBox:SetScript("OnEditFocusLost",function (self)
                self:HighlightText(0, 0)
            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()
                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()
                GameTooltip:Hide()
            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
                            if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                                SendChatMessage(msgStr, "RAID")
                            else
                                SendChatMessage(curAuctionList.itemlink .. msgStr, "RAID")
                            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
                    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
                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()
            end)
            lgnoreBtn:SetScript("OnClick", function(self)
                if lgnoreBtn:GetText() == "忽略" then
                    lgnoreBtn:SetText("恢复")
                    ZL_CURRENT.auctionlist[v].lgnore = true
                    --如果关注物品则取消关注
                    local itemId = tostring(ZL_CURRENT.auctionlist[v].itemId)
                    if ZL.opt.concern and ZL.opt.concern[itemId] then
                        ZL.opt.concern[itemId] = nil
                    end
                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)
            -- playerNameString:SetText("潇湘凌风|cffffd100(20000)|r\n潇湘笛晕|cffffd100(500000)|r") --"潇湘凌风(2000)\n潇湘笛晕打的(2000)"
            bidderFrame:RegisterForClicks("LeftButtonUp", "RightButtonUp", "MiddleButtonUp")
            bidderFrame:SetScript("OnEnter", function (self)
                if (not PlayerIsML()) or (not ZL.BidderListFrame:IsShown()) then
                    local auctionList = ZL_CURRENT["auctionlist"][v]
                    if auctionList and auctionList.bidderlist and (#auctionList.bidderlist > 0)then
                        local bidderlist = auctionList.bidderlist
                        tableSort(bidderlist)
                        GameTooltipShow(self, "TOPRIGHT", "BOTTOMRIGHT")
                        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
                                bidderName = bidData["bidder"]
                            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:Show()
                    end
                end
                ZL.FloatAuctionFrame.index = v
                zlHighlightOnShow(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()
                ZL.BagHighLight()
                ZL.OnEnterBagHighLight(v)
            end)
            bidderFrame:SetScript("OnLeave", function (self)
                Frame1.zlHighlight:Hide()
                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)
                -- 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(bidderFrame)
                -- end)
                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 ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
                                --     for index, data in ipairs(ZL_CURRENT.auctionlist) do
                                --         if data.Frame1IsShown and (data.state == "waiting") and (not data.lgnore) and index ~= v then
                                --             ZL_CURRENT.auctionlist[index].Frame1IsShown = false
                                --         end
                                --     end
                                -- 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
                                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 itemCount == 1 then
                                        if bindType == 2 then
                                            SendChatMessage(("装绑%s起拍价：%d，加价幅度：%d"):format(
                                                curAuctionList.itemlink, startbidamount, bidIncrement), ZL.MsgChannel()
                                            )
                                        else
                                            if curAuctionList.itemlink == "[打包拍卖]" then
                                                local itemList = ZL_CURRENT.auctionlist[v]["itemList"]
                                                if itemList and next(itemList, nil) then
                                                    SendChatMessage("打包拍卖清单：", "RAID")
                                                    C_Timer.After(0.3, function ()
                                                        for _itemlink, data in pairs(itemList) do
                                                            msgStr = _itemlink .. "x" .. data.itemCount
                                                            SendChatMessage(msgStr, "RAID")
                                                        end
                                                        C_Timer.After(0.3, function ()
                                                            SendChatMessage(("以上%s，起拍价：%d，加价幅度：%d"):format(
                                                                curAuctionList.itemlink, startbidamount, bidIncrement), ZL.MsgChannel()
                                                            )
                                                        end)
                                                    end)
                                                else
                                                    ZL.Print(nil, nil, nil, nil, nil, "没有打包拍卖物品，请先添加！")
                                                    return
                                                end
                                            else
                                                SendChatMessage(("%s起拍价：%d，加价幅度：%d"):format(
                                                    curAuctionList.itemlink, startbidamount, bidIncrement), ZL.MsgChannel()
                                                )
                                            end
                                        end
                                    else
                                        if bindType == 2 then
                                            SendChatMessage(("装绑%sx%d，起拍价：%d，加价幅度：%d"):format(
                                                curAuctionList.itemlink, itemCount, startbidamount, bidIncrement), ZL.MsgChannel()
                                            )
                                        else
                                            SendChatMessage(("%sx%d，起拍价：%d，加价幅度：%d"):format(
                                                curAuctionList.itemlink, itemCount, startbidamount, bidIncrement), ZL.MsgChannel()
                                            )
                                            if curAuctionList.itemId == 47242 then
                                                C_Timer.After(0.3, function ()
                                                    SendChatMessage(("出价格式为：出价x数量，中间支持：*-xX和空格，不支持中文乘号！相同出价的先出价的优先！"), ZL.MsgChannel())
                                                end)
                                            end
                                        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 count  > 1 then
                                                msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. "x" .. count .. ")，"
                                            else
                                                msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. ")，"
                                            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 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
                        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
            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"
                if ZL.opt.concern and ZL.opt.concern[tostring(itemId)] then
                    self.concern:Show()
                else
                    self.concern:Hide()
                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
                    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(0)
                    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 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)
                    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
                    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:SetText(" ")
                    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
            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, -5)
            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, -5)
            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, -5)
        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 count  > 1 then
                                msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. "x" .. count .. ")，"
                            else
                                msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. ")，"
                            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
            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
        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: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:RegisterForClicks("LeftButtonUp", "RightButtonUp")
            f.trade:SetScript("OnClick", function (self, button)
                local msgStr = ""
                if not PlayerIsML() then
                    msgStr = "你不是ML，无法使用这个功能！"
                    ZL.Print(nil, nil, nil, nil, nil, msgStr)
                    return
                end
                local name = f.nameEditBox:GetText()
                local noColorName = ParseClassColorName(name)
                if button == "LeftButton" then
                    local playerBuyList = ZL.GetPlayerBuyList()
                    local name_table = playerBuyList[name]
                    if name_table then
                        local balance = 0
                        local playerPayToMLamount = 0
                        if ZL_CURRENT.playerPayToML and ZL_CURRENT.playerPayToML[name] then
                            playerPayToMLamount = ZL_CURRENT.playerPayToML[name]
                        end
                        balance = playerPayToMLamount - name_table.totalAmount
                        local msglist = {}
                        msgStr = "您还有待交易装备："
                        if name_table.items and #name_table.items > 0 then
                            for _, data in ipairs(name_table.items) do
                                if (not data["isTraded"]) then
                                    local itemId = tonumber(string.match(data.notes, "|c........|Hitem:(%d+):"))
                                    if itemId then
                                        if strlen(msgStr) + strlen(data.notes) > 255 then
                                            table.insert(msglist, msgStr)
                                            msgStr = data.notes
                                        else
                                            msgStr = msgStr .. data.notes
                                        end
                                    end
                                end
                            end
                        end
                        if balance < 0 then
                            if msgStr == "您还有待交易装备：" then
                                msgStr = "您还欠款：" .. -balance .. "g，请及时交易我支付，感谢配合"
                            else
                                local balanceStr = "欠款：" .. -balance .. "g，请及时交易我，感谢配合"
                                if strlen(msgStr) + strlen(balanceStr) + 1 > 255 then
                                    table.insert(msglist, msgStr)
                                    msgStr = balanceStr
                                else
                                    msgStr = msgStr .. "，" .. balanceStr
                                end
                            end
                            table.insert(msglist, msgStr)
                        end
                        if #msglist > 0 then
                            InitiateTrade(noColorName)
                            local index = 1
                            local function sendMessage()
                                if index <= #msglist then
                                    SendChatMessage(msglist[index], "WHISPER", nil, noColorName)
                                    if index == #msglist then
                                        wipe(msglist)
                                    end
                                    index = index + 1
                                    C_Timer.After(0.3, sendMessage)
                                end
                            end
                            sendMessage()
                        else
                            msgStr = "没有欠款和需要交易的物品！"
                            ZL.Print(nil, nil, nil, nil, nil, msgStr)
                        end
                    else
                        msgStr = "没有欠款和需要交易的物品！"
                        ZL.Print(nil, nil, nil, nil, nil, msgStr)
                    end
                elseif button == "RightButton" then
                    if ZL_CURRENT.tradeGongZi and ZL_CURRENT.tradeGongZi[name] then
                        msgStr = "|cffff0000已交易过工资！|r"
                        ZL.Print(nil, nil, nil, nil, nil, msgStr)
                        return
                    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 gongzi = tonumber(ParseClassColorName(f.balanceEditBox:GetText()))
                    local butie = tonumber(ParseClassColorName(f.buTieEditBox:GetText()))
                    local total = gongzi + butie
                    if total == 0 then return end
                    if GetMoney() < total*10000 then
                        msgStr = "|cffff0000金币不足，无法交易工资！|r"
                        ZL.Print(nil, nil, nil, nil, nil, msgStr)
                        return
                    end
                    if not (CheckInteractDistance(noColorName, 2)) then
                        msgStr = "距离太远，请靠近我，等待我交易你工资！"
                        SendChatMessage(msgStr, "WHISPER", nil, noColorName)
                        return
                    end
                    InitiateTrade(noColorName )
                    MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, total * 10000)
                    ZL.tradeGongZi = total
                    if total > 0 then
                        C_Timer.After(1, function ()
                            if _G["TradeFrame"] and _G["TradeFrame"]:IsShown() then
                                
                                ZL.tradeName = name
                                TradeFrameTradeButton:Click()
                                msgStr = "工资：" .. gongzi
                                if butie > 0 then
                                    msgStr = msgStr .. "，补贴：" .. butie .. "，最终工资：" .. total
                                end
                                msgStr = msgStr .. "，请及时确认交易！"
                                SendChatMessage(msgStr, "WHISPER", nil, noColorName)
                            end
                        end)
                    end
                end
            end)
]=]
            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()
        -- local index = ZL.BidderListFrame.index
        -- if PlayerIsML() and ZL_CURRENT.auctionlist[index].state == "auctioning" then
        --     GameTooltipShow(self, "BOTTOM", "TOP")
        --     GameTooltip:AddLine("如需修改，鼠标不要移出窗口")
        --     GameTooltip:AddLine("2秒内最多修改1次", 1, 1, 1)
        --     GameTooltip:Show()
        -- end
    end)
    BidderListFrame:SetScript("OnLeave", function (self)
        ZL.AuctionFrame2.entries[ZL.BidderListFrame.index].zlHighlight:Hide()
        -- 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", 10, -10-TitleFont:GetHeight())
    PlayerNameFont:SetWidth(90)
    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", 10, 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()

    BidderListFrame.dropDown = CreateFrame("FRAME", "ZLBidderListFrameDropdown", BidderListFrame, "UIDropDownMenuTemplate")
    UIDropDownMenu_SetWidth(BidderListFrame.dropDown, 8)
    BidderListFrame.dropDown:SetScale(0.8)
    BidderListFrame.dropDown:Hide()
    _G["ZLBidderListFrameDropdownButton"]:SetScript("OnEnter", function ()
        local index = ZL.BidderListFrame.index
        ZL.AuctionFrame2.entries[index].zlHighlight:Show()
    end)
    _G["ZLBidderListFrameDropdownButton"]:SetScript("OnLeave", function ()
        local index = ZL.BidderListFrame.index
        ZL.AuctionFrame2.entries[index].zlHighlight:Hide()
    end)

    -- 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, 0)
                f:SetPoint("TOPRIGHT", t[v - 1], "BOTTOMRIGHT", 0, 0)
            else
                f:SetPoint("TOPLEFT", PlayerNameFont, "BOTTOMLEFT", 0, -3)
                f:SetPoint("TOPRIGHT", PlayerNameFont, "BOTTOMRIGHT", 0, -3)
            end
            f:SetHeight(15)

            f.nameEditBox = CreateFrame("EditBox", nil, f) --, "InputBoxTemplate"

            f.nameEditBox:SetPoint("LEFT", f, "LEFT", 0, 0)
            f.nameEditBox:SetSize(80, 20)
            f.nameEditBox:SetFont(GameFontNormal:GetFont(), 12, "")
            f.nameEditBox:SetMultiLine(false)
            f.nameEditBox:SetTextColor(1, 1, 1)
            f.nameEditBox:SetJustifyH("LEFT")
            f.nameEditBox:SetAutoFocus(false)
            f.nameEditBox:Disable()  --OnEditFocusGained
            f.nameEditBox:SetScript("OnEnter", function (self)
                local index = ZL.BidderListFrame.index
                ZL.AuctionFrame2.entries[index].zlHighlight:Show()
                if (not PlayerIsML()) or ZL_CURRENT.auctionlist[index].state ~= "auctioning" then
                    BidderListFrame.dropDown:Hide()
                    return
                end
                BidderListFrame.dropDown:SetPoint("LEFT", self, "RIGHT", -18, -2)
                UIDropDownMenu_Initialize(BidderListFrame.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()
                                local bidderlist = ZL_CURRENT.auctionlist[index].bidderlist
                                for _, data in ipairs(bidderlist) do
                                    if data.bidder == name then
                                        ZL.Print(nil, nil, nil, nil, nil, "名字已存在，请重新选择！")
                                        return
                                    end
                                end
                                f.nameEditBox:SetText(name)
                                info.checked = true
                                CloseDropDownMenus()
                                f.nameEditBox:ClearFocus()
                                ZL_CURRENT.auctionlist[index].bidderlist[v].bidder = name
                                ZL.AuctionFrame2.entries[index]:SetValues(index)
                                ZL.AuctionFrame2.entries[index].MLframe.functionFrame.syncBtn:Click()

                                -- _G["ZLBidderListFrameButton"]:Disable()
                                for _, ff in ipairs(BidderListFrame.entries) do ff.bidAmountEditBox:Disable() end
                                C_Timer.After(2, function ()
                                    -- _G["ZLBidderListFrameButton"]:Enable()
                                    for _, ff in ipairs(BidderListFrame.entries) do ff.bidAmountEditBox:Enable() end
                                end)
                            end
                            UIDropDownMenu_AddButton(info, level)
                        end
                    end
                end)
                BidderListFrame.dropDown:Show()
            end)
            f.nameEditBox:SetScript("OnLeave", function ()
                local index = ZL.BidderListFrame.index
                ZL.AuctionFrame2.entries[index].zlHighlight:Hide()
            end)
            f.bidAmountEditBox = CreateFrame("EditBox", nil, f) --, "InputBoxTemplate"
            f.bidAmountEditBox:SetPoint("LEFT", f.nameEditBox, "RIGHT", 15, 0)
            f.bidAmountEditBox:SetSize(60, 20)
            f.bidAmountEditBox:SetFont(GameFontNormal:GetFont(), 12, "")
            f.bidAmountEditBox:SetMultiLine(false)
            f.bidAmountEditBox:SetTextColor(1, 1, 1)
            f.bidAmountEditBox:SetJustifyH("RIGHT")
            -- f.bidAmountEditBox:SetNumeric(true)
            f.bidAmountEditBox:SetAutoFocus(false)
            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)
            f.bidAmountEditBox:SetScript("OnEnterPressed", function (self)
                local index = ZL.BidderListFrame.index
                local bidAmount = tonumber(ParseClassColorName(self:GetText()))
                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("OnEscapePressed", function (self)
                local index = ZL.BidderListFrame.index
                BidderListFrame:Update(index)
            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
                if data.state == "failed" and data.spawnUID then --and data.bindType == 1
                    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
                                    
                                    --判断是否还有交易剩余时间
                                    -- 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
                                    --             tinsert(failedItemList, {bag, slot})
                                    --             if #failedItemList >= 6 then  --每次最多只能交易6个
                                    --                 return failedItemList
                                    --             end
                                    --             break
                                    --         end
                                    --     end
                                    -- end
                                end
                            end
                        end
                    end
                end
            end
            return failedItemList
        end
        if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
            local failedItemList = GetFailedItemList()
            if #failedItemList > 0 then
                local index = 1
                local function tempfuc()
                    if index <= #failedItemList then
                        PickupContainerItemToTrade(failedItemList[index][1], failedItemList[index][2])
                        index = index + 1
                        C_Timer.After(0.3, tempfuc)
                    end
                end
                tempfuc()
            else
                msgStr = "没有流拍物品！"
                ZL.Print(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)
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.8, 0.8, 0.8, 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)
            -- if v == 1 then
            --     f:SetPoint("TOPLEFT", content, "TOPLEFT", 0, -1)
            -- else
            --     f:SetPoint("TOPLEFT", t[v-1], "BOTTOMLEFT")
            -- end
            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.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
                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()) 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()
                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)
                GameTooltipShow(self, "LEFT", "RIGHT")
                GameTooltip:AddLine("提示")
                GameTooltip:AddLine("激活输入框，输入或鼠标滚轮设置\n总金额，按Enter键或右键保存！", 1, 1, 1)
                GameTooltip:Show()
            end)
            f.amountbox:SetScript("OnLeave", function (self)
                OnLeave(self)
                GameTooltip:Hide()
            end)
            f.amountbox:SetScript("OnEditFocusGained", function (self)
                f.amountbox.fontstring:Hide()
            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 > 0 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 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
                    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
        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")
                                                else
                                                    if bossindex % 2 == 0 then
                                                        f.bossfontstring:SetText("|cffADDFAD" .. bossName .. "|r")
                                                    else
                                                        f.bossfontstring:SetText("|cffFFD700" .. bossName .. "|r")
                                                    end
                                                end
                                                f.bossfontstring:Show()
                                            else
                                                f:SetPoint("TOPLEFT", OverviewFrame.entries[index-1], "BOTTOMLEFT", 0, -gapheight)
                                                f.bossfontstring:SetText(bossName)
                                                f.bossfontstring:Hide()
                                                row = row + 1
                                            end
                                            f.playerNamebox.fontstring:Show()
                                            f.amountbox.fontstring:Show()
                                            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: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"] 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: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
                                        disenchantingBtn:Enable()
                                        disenchantingBtn:SetAttribute("macrotext", "/施放 分解\n/use " .. bag .. " " .. slot)
                                    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