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 cGetItemInfo, cGetItemIcon
if WOW_PROJECT_ID == 1 then
    cGetItemInfo = C_Item.GetItemInfo
    cGetItemIcon = C_Item.GetItemIconByID
else --WOW_PROJECT_ID == 11 then
    cGetItemInfo = GetItemInfo
    cGetItemIcon = GetItemIcon
end

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")
    -- startbidEditbox:SetScript("OnTextChanged", function (self)
    --     if strlen(self:GetText()) > 0 then
    --         startbidEditbox.startbidFont:Hide()
    --     else
    --         startbidEditbox.startbidFont:Show()
    --     end
    -- end)
    -- startbidEditbox:SetScript("OnEnter", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Show()
    --     GameTooltipShow(self, "BOTTOM", "TOP")
    --     GameTooltip:AddLine("起拍价111111")
    --     GameTooltip:Show()
    -- end)
    -- startbidEditbox:SetScript("OnLeave", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Hide()
    --     GameTooltip:Hide()
    -- end)
    -- startbidEditbox:SetScript("OnEditFocusLost", function (self)
    --     self:HighlightText(0, 0)
    --     local startbid = self:GetNumber() or 0
    --     local index = ZL.FloatAuctionFrame.index
    --     ZL_CURRENT.auctionlist[index].startbidamount = startbid > 0 and startbid or ZL_CURRENT.auctionlist[index].startbidamount
    --     local f = ZL.AuctionFrame2.entries[index]
    --     f.MLframe.startbidFrame.startbidEditbox:SetNumber(ZL_CURRENT.auctionlist[index].startbidamount)
    -- end)

    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")
    -- incrementEditbox:SetScript("OnTextChanged", function (self)
    --     if strlen(self:GetText()) > 0 then
    --         incrementEditbox.inrementFont:Hide()
    --     else
    --         incrementEditbox.inrementFont:Show()
    --     end
    -- end)
    -- incrementEditbox:SetScript("OnEnter", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Show()
    --     GameTooltipShow(self, "BOTTOM", "TOP")
    --     GameTooltip:AddLine("加价幅度")
    --     GameTooltip:Show()
    -- end)
    -- incrementEditbox:SetScript("OnLeave", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Hide()
    --     GameTooltip:Hide()
    -- end)
    -- incrementEditbox:SetScript("OnEditFocusLost", function (self)
    --     self:HighlightText(0, 0)
    --     local increment = self:GetNumber() or 0
    --     ZL_CURRENT.auctionlist[ZL.FloatAuctionFrame.index].bidIncrement = increment > 0 and increment or ZL_CURRENT.auctionlist[ZL.FloatAuctionFrame.index].bidIncrement
    -- end)
    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")
    -- CancelBtn:SetScript("OnEnter", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Show()
    -- end)
    -- CancelBtn:SetScript("OnLeave", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Hide()
    -- end)

    functionFrame.PauseBtn = CreateButton(nil, functionFrame, "暂停", "LEFT", CancelBtn, "RIGHT", 5, 0, 40, 18)
    local PauseBtn = functionFrame.PauseBtn
    -- PauseBtn:SetScript("OnEnter", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Show()
    -- end)
    -- PauseBtn:SetScript("OnLeave", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Hide()
    -- end)
    functionFrame.CountDownBtn = CreateButton(nil, functionFrame, "倒数", "LEFT", PauseBtn, "RIGHT", 5, 0, 40, 18)
    local CountDownBtn = functionFrame.CountDownBtn
    CountDownBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    -- CountDownBtn:SetScript("OnEnter", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Show()
    -- end)
    -- CountDownBtn:SetScript("OnLeave", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Hide()
    -- end)
    functionFrame.packageBtn = CreateButton(nil, functionFrame, "打包", "LEFT", CountDownBtn, "RIGHT", 5, 0, 40, 18)
    local packageBtn = functionFrame.packageBtn
    -- packageBtn:SetScript("OnEnter", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Show()
    -- end)
    -- packageBtn:SetScript("OnLeave", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Hide()
    -- end)
    functionFrame.reverseBidBtn = CreateButton(nil, functionFrame, "撤销出价", "TOPLEFT", CancelBtn, "BOTTOMLEFT", 0, -3, 85, 18)
    local reverseBidBtn = functionFrame.reverseBidBtn
    reverseBidBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    -- reverseBidBtn:SetScript("OnEnter", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Show()
    -- end)
    -- reverseBidBtn:SetScript("OnLeave", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Hide()
    -- end)
    functionFrame.syncBtn = CreateButton(nil, functionFrame, "同步", "LEFT", reverseBidBtn, "RIGHT", 5, 0, 40, 18)
    local syncBtn = functionFrame.syncBtn
    -- syncBtn:SetScript("OnEnter", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Show()
    -- end)
    -- syncBtn:SetScript("OnLeave", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Hide()
    -- end)
    functionFrame.delAuctionBtn = CreateButton(nil, functionFrame, "删除", "LEFT", syncBtn, "RIGHT", 5, 0, 40, 18)
    local delAuctionBtn = functionFrame.delAuctionBtn
    -- delAuctionBtn:SetScript("OnEnter", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Show()
    -- end)
    -- delAuctionBtn:SetScript("OnLeave", function (self)
    --     ZL.AuctionFrame2.entries[ZL.FloatAuctionFrame.index].zlHighlight:Hide()
    -- end)
    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.3, 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 == "auctioning" then
                    local _, _, tarbidamount = ZL.GetNewBidAmount(ZL.FloatAuctionFrame.index)
                    bidEditBox:SetNumber(tarbidamount)
                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
                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", f.bidFrame.bidEditBox:GetScript("OnTextChanged"))
            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", f.bidFrame.bidCounts:GetScript("OnTextChanged"))
            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("OnTextChanged", sbf.startbidEditbox:GetScript("OnTextChanged"))
            startbidEditbox:SetScript("OnEnter", sbf.startbidEditbox:GetScript("OnEnter"))
            startbidEditbox:SetScript("OnLeave", sbf.startbidEditbox:GetScript("OnLeave"))
            startbidEditbox:SetScript("OnEditFocusLost", sbf.startbidEditbox:GetScript("OnEditFocusLost"))

            incrementEditbox:SetScript("OnTextChanged", sbf.incrementEditbox:GetScript("OnTextChanged"))
            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"))

            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 IsInGroup() 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", 3, -3, 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()
        do
            GameTooltipShow(recordBtn, "RIGHT", "LEFT", -3, 0)
            local msg = select(2, ZL.GetWagesGroupMembers())
            if msg then
                GameTooltip:AddLine(msg)
            end
            local butie = {}
            if RLBuTie and RLBuTie > 0 then
                if ZL.opt.RLBuTieType == 4 then
                    table.insert(butie, {player="", notes="RL提成", amount=-RLBuTie, isTraded=true})
                else
                    table.insert(butie, {player="", notes="RL补贴", amount=-RLBuTie, isTraded=true})
                end
            end
            if ZL.opt.Tbutie and ZL.opt.Tbutie > 0 then
                table.insert(butie, {player="", notes="T补贴", amount=-ZL.opt.Tbutie, isTraded=true})
            end
            if ZL.opt.Nbutie and ZL.opt.Nbutie > 0 then
                table.insert(butie, {player="", notes="奶补贴", amount=-ZL.opt.Nbutie, isTraded=true})
            end
            if ZL.opt.DPSbutie and ZL.opt.DPSbutie > 0 then
                table.insert(butie, {player="", notes="DPS补贴", amount=-ZL.opt.DPSbutie, isTraded=true})
            end
            if ZL.opt.FOODbutie and ZL.opt.FOODbutie > 0 then
                table.insert(butie, {player="", notes="食物补贴", amount=-ZL.opt.FOODbutie, isTraded=true})
            end
            if ZL.opt.xiuXingbutie and ZL.opt.xiuXingbutie > 0 then
                table.insert(butie, {player="", notes="修星补贴", amount=-ZL.opt.xiuXingbutie, isTraded=true})
            end
            if ZL.opt.ANMUbutie and ZL.opt.ANMUbutie > 0 then
                table.insert(butie, {player="", notes="工具人补贴", amount=-ZL.opt.ANMUbutie, isTraded=true})
            end
            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
                            GameTooltip:AddDoubleLine(
                                "|T" .. cGetItemIcon(data.notes) .. ":12|t " .. data.notes,
                                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")
            _G["xiaoFeiToolTip"]:SetPoint("TOPRIGHT", GameTooltip, "TOPLEFT", 0, 0)
            _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)
                _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
            _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.currentIncomeFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
                for i = 1, 2 do
                    SendChatMessage("已停止邮寄登记！", ZL.MsgChannel())
                end
                delay = 0.3
            end
            if not ZL_CURRENT["aveWages"] then
                print(Prefix("没有工资成员记录！"))
                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)
                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
                        wipe(msglist)
                    end
                    index = index + 1
                    C_Timer.After(0.3, sendMessage)
                end
            end
            sendMessage()
        end
        if button == "LeftButton" then
            if (not IsModifierKeyDown()) then
                --打开收支窗口
                ZL.AuctionRecordFrame:Show()
                _G["ZLAuctionRecordFrameTab2"]:Click()
            elseif IsShiftKeyDown() and (not IsControlKeyDown()) and (not IsAltKeyDown()) then
                --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.currentIncomeFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
                        for i = 1, 2 do
                            SendChatMessage("已停止邮寄登记！", ZL.MsgChannel())
                        end
                        delay = 0.3
                    end
                    if not ZL_CURRENT["aveWages"] then
                        print(Prefix("没有工资成员记录！"))
                        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
            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
                        print(Prefix("当前没有欠款成员！"))
                    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
                --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.currentIncomeFrame.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) 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)
                    print(Prefix("已登记全部邮寄工资！"))
                else
                    print(Prefix("没有需要邮寄的成员！"))
                end
            elseif (not IsShiftKeyDown()) and (not IsControlKeyDown()) and IsAltKeyDown() then
                --Alt+右键：待定
                local recordList = {}
                if ZL_CURRENT.auctionlist and #ZL_CURRENT.auctionlist > 0 then
                    for _, data in ipairs(ZL_CURRENT.auctionlist) do
                        local itemlink = data.itemlink
                        local playerName, counts, totalAmount, itemList
                        if not data.isPackage then
                            if data.state == "waiting" then
                                playerName = "待拍卖"
                                counts = data.itemCount
                            elseif data.state == "auctioning" then
                                playerName = "拍卖中"
                                counts = data.itemCount
                            elseif data.state == "failed" then
                                playerName = "流拍"
                                counts = data.itemCount
                            elseif data.state == "success" then
                                local tradeId = data.tradeId
                                if ZL_CURRENT.IncomeList and #ZL_CURRENT.IncomeList > 0 then
                                    for _, incomeData in ipairs(ZL_CURRENT.IncomeList) do

                                    end
                                end
                            end
                        end
                        if itemlink == "[打包拍卖]" then
                            if data.state == "waiting" then
                                playerName = "待拍卖"
                            elseif data.state == "auctioning" then
                                playerName = "拍卖中"
                            elseif data.state == "failed" then
                                playerName = "流拍"
                            elseif data.state == "success" then
                                local bidderData = data.bidderlist[1]
                                playerName = bidderData.bidder
                                totalAmount = bidderData.bidamount
                            end
                            if playerName then
                                recordList[playerName] = {
                                    ["counts"] = 1,
                                    ["totalAmount"] = totalAmount,
                                    ["itemList"] = data.itemList,
                                }
                            end
                        else
                            if not data.isPackage then
                                
                            end
                        end
                    end
                end
            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)
        GameTooltipShow(recordBtn, "RIGHT", "LEFT", -3, 0)
        GameTooltip:AddLine("拍卖规则：")
        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("   ")
        GameTooltip:AddLine("左键：|cffffffff发送到团队|r")
        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 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)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("同步数据")
        GameTooltip:AddLine("全团成员同步ML当前所有拍卖数据！", 1, 1, 1)
        GameTooltip:AddLine("因API限制，15秒同步一次", 1, 1, 1)
        GameTooltip:AddLine("同步数据的时候不要重载UI，否则无法接收到数据", 1, 0, 0)
        GameTooltip:AddLine("使用场景：")
        GameTooltip:AddLine("1、当ML掉线后造成大量数据与其他成员不同步", 1, 1, 1)
        GameTooltip:AddLine("2、将数据同步给其它成员，防止游戏意外崩溃数据丢失", 1, 1, 1)
        GameTooltip:Show()
    end)
    syncAllBtn:SetScript("OnLeave", function (self)
        GameTooltip:Hide()
    end)
    syncAllBtn:SetScript("OnClick", function (self)
        local msgStr
        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(15, function ()
                    self:Enable()
                end)
            else
                msgStr = "存在拍卖中的物品，请先取消再同步！"
            end
        else
            msgStr = "没有拍卖数据需要同步"
        end
        if msgStr then
            print(Prefix(msgStr))
            ZL.ScrollingMessageFrame:AddMessage(msgStr)
        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
            local failedCount = 0 --总的可以交易流拍物品数量
            local failedItemList = {}
            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.itemGUID and next(data.itemGUID, nil) then
                        for key, _ in pairs(data.itemGUID) do
                            --判断是否在背包
                            local bag, slot = ZL.FindItemInBag(key)
                            if bag then
                                --判断是否还有交易剩余时间
                                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
                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
            else
                msgStr = "没有拍卖记录！"
                SendChatMessage(msgStr, "RAID")
            end
        elseif button == "RightButton" then
            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["itemGUID"] and next(data["itemGUID"], nil) then
                            for itemGUID, _ in pairs(data["itemGUID"]) do
                                table.insert(failedItemGUIDList, itemGUID)
                            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.5, changeBag)
                    end
                end
                changeBag()
            else
                msgStr = "没有需要批量流拍的物品！"
                print(Prefix(msgStr))
                ZL.ScrollingMessageFrame:AddMessage(msgStr)
            end
        end
    end)
    failedBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("流拍功能")
        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:Show()
    end)
    failedBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    MLFrame.addAuctionBtn = CreateButton(nil, MLFrame, " ", "LEFT", failedBtn, "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 ()
        StaticPopup_Show("ZL_ADDAUCTIONITEM")
    end)
    addAuctionBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("手动创建拍卖物品")
        GameTooltip:AddLine("没被自动检测到的物品", 1, 1, 1)
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("方法：")
        GameTooltip:AddLine("|cffffffff1、|rCtr+右键|cffffffff点击背包物品自动创建|r")
        GameTooltip:AddLine("|cffffffff2、|rCtr+右键|cffffffff点击聊天窗口物品链接自动创建|r")
        GameTooltip:AddLine("3、直接点击按钮创建", 1, 1, 1)
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("|cffff0000注意：手动创建的拍卖，无法识别可交易名单，都可以参与竞拍！|r")
        GameTooltip:Show()
    end)
    addAuctionBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    MLFrame.reset = CreateButton(nil, MLFrame, " ", "LEFT", addAuctionBtn, "RIGHT", 0, 0, 25, 25, 15)
    local reset = MLFrame.reset
    reset.BorderLeft:Hide()
    do
        local texture = "Interface\\AddOns\\" .. addonName .. "\\Images\\reset.png"
        reset:SetNormalTexture(texture)
        reset:SetHighlightTexture(texture)
    end
    reset:SetScript("OnClick", function (self)
        --"您确定要重置当前拍卖记录么？确定将清空当前拍卖记录，并保存到历史记录中！"
        if (not ZL_CURRENT.auctionlist) or (#ZL_CURRENT.auctionlist == 0) then
            GameTooltipShow(self, "BOTTOM", "TOP")
            GameTooltip:AddLine("当前没有拍卖物品记录！")
            GameTooltip:Show()
            C_Timer.After(3, function ()
                GameTooltip:Hide()
            end)
            print(Prefix("当前没有拍卖物品记录！"))
            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
        MyAddon:TransmitAddonInfo("AUTOAUC RESET", "重置")
    end)
    reset:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("重置：")
        GameTooltip:AddLine("1、将全团人员当前拍卖数据保存为历史数据", 1, 1, 1)
        GameTooltip:AddLine("2、开始一个新的副本拍卖记录", 1, 1, 1)
        GameTooltip:AddLine("3、如果重置错了，可以到历史数据中恢复到当前", 1, 1, 1)
        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)
        StaticPopup_Show("ZL_ADDINCOME", "收入", nil, "收入")
    end)
    add:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("手动录入|cffffd100【收入】|r", 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)
        StaticPopup_Show("ZL_ADDINCOME", "支出", nil, "支出")
    end)
    rem:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("手动录入|cffffd100【支出】|r", 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 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 RemainingTradeItems = ZL.GetRemainingTradeTime(true)
        GameTooltipShow(recordBtn, "RIGHT", "LEFT", -3, 0)
        if #RemainingTradeItems > 0 then
            GameTooltip:AddLine("装备交易剩余时间：", 1, 1, 1)
            GameTooltip:AddDoubleLine("名称", "剩余时间")
            for _, data in ipairs(RemainingTradeItems) do
                if (data.hour*60 + data.min) <= 30 then
                    GameTooltip:AddDoubleLine(data.itemLink, "|cffff0000" .. data.timeRemaining .. "|r", 1, 1, 1, 1, 1, 1)
                else
                    GameTooltip:AddDoubleLine(data.itemLink, data.timeRemaining, 1, 1, 1, 1, 1, 1)
                end
            end
        else
            GameTooltip:AddLine("没有交易剩余时间的装备！")
        end
        GameTooltip:AddLine(" ")
        GameTooltip:AddLine("左键：|cffffffff打开/隐藏交易剩余时间界面|r")
        GameTooltip:AddLine("右键：|cffffffff打开/隐藏拍卖WA发送状态窗口|r")
        GameTooltip:Show()
        wipe(RemainingTradeItems)
    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", ZL.AuctionRecordFrame.playerBalanceFrame.SendMsgBtn:GetScript("OnClick"))
    SaveBtn:SetScript("OnEnter", ZL.AuctionRecordFrame.playerBalanceFrame.SendMsgBtn:GetScript("OnEnter"))
    SaveBtn:SetScript("OnLeave", ZL.AuctionRecordFrame.playerBalanceFrame.SendMsgBtn:GetScript("OnLeave"))

    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)
        if (level or 1) == 1 then
            local info = UIDropDownMenu_CreateInfo()
            info.isTitle = 1
            info.text = "选择计算工资名单"
            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
                    CloseDropDownMenus()
                    UIDropDownMenu_Refresh(AuctionFrame.selectGroupMembersDropDown)
                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
                            CloseDropDownMenus()
                            UIDropDownMenu_Refresh(AuctionFrame.selectGroupMembersDropDown)
                        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
                    print(ZL.Prefix(msgStr))
                    ZL.ScrollingMessageFrame:AddMessage(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 .. " " .. sendVer .. "]"
                ChatEdit_ActivateChat(ChatEdit_ChooseBoxForSend())
                ChatEdit_InsertLink(text)
            else
                local WaString = [=[
!WA:2!S33A3T1nscEMZ(nD2pSN5xaxMt2HCcLwskl5hN4Co0s0wCcLKhjk7jTBpAVs8kj2HIun5L(X0DMJCCKLSTKLD87NX2XVsC8ZK1wwYp(VSTUKuFQ)lSOWJ7faxGlPKD)A32DhBEbkuaOqHcfkuOW)Wo)hN8Fm7)y25cxQyfR85kywQ)HYKovFjlDO(hBSYMw)dLom9hp3OWOtuS0UlMRG1iDLSVmjhyQazZvEQ8ghoJ5HSgESILM0WA4Pg2k3KM0V(hM6)2OvkBvCsaIHMkRHL5aMhWSG1)hJkOunSYn6EZL1AIDKa9zjJrTYvSq5ohOSLrjRw2rUc5S(F8Tzlombh)VgH8Vt)F5)6VjFXrnYhWO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FbCD4J4b(Z40XnTKJobyuP)GjT0egZHNp7y)3gKf1)dfwkjLPss6mUSyQX69nAQz1b62kGAk2bemambfJNhXPkiPzWmZGJw(a96VV((lRYf3c(yNcDZ8S9t7XVcNXOeATPq8hANb(cA)6fuhcoLbG904r19i906j6OT2BRJUoNHFwsj55e0A5LiCWQYgQAhLaetI2)tBako0zdjAipPrmIll3DuO5wAJcADSjhcyQuNVozIhvY23yisIYbacjFOPJ7N9wlNBH)Jt5lbue4PFtDobYQJXziJESZuqrabrEujlpqtMbO(Hz3jbnMbGO8sjrQfGbqQjLey81prdyLreOhiwdCssHt3KeH(3LOr1)Tfuset)(zw8BZn57M7tU75mOc3VWcXCgf5yYwopVpdJxS5CtadQqsi4suj6FUwqYPsu5i0t7H(6rydLWGasFnyod5jmBrJCKLar2Gtf0l8r6mg3z2MptlI(Wpt7T1Eh0qBRtyoAypT3wxOi6(e(DUG9L)OmFX1SN(tZ89FE6p8EuIhQG(VP4LidaUCtO7vFx71qXTATDl5cSEmyfyHRekHsyiqiLangLdM7aQTJsxIdeGAtFXztF1RL(AFtUR)(zV20oYaLP5hJ1vH7ddH8DbikbNCFjN2J1cYTN2(sxDJdey0dY6(WqTN)Za0FUzxaydU3IBzpRLQGICSAOcpyCarPnUPB5EI8xJPFJlrvJqnaZWMuRI12ouj7nVxMvUjOTlrVHdnEN6XTrAIUPVPh65LO)dj6BuhvmIElBUrcXjaaOSqyljC7t1ueNqVHnV1X0aZMCwKiPCmIWCH)i1utnEskS(AREtjR60n4oVjghWZJyWPNye3l2PjFxT1rNTT)Do2pCY))d
]=]
                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(self, "BOTTOM", "TOP")
        GameTooltip:AddLine("帮助反馈")
        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)

    --创建滚动条
    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()

    AuctionFrame.entries = setmetatable({}, {
        __index = function (t, v)
            local Frame1 = CreateFrame("Button", nil, content)
            Frame1:Hide()
            Frame1.maxAutoBid = nil
            Frame1:SetScript("OnEnter", function (self)
                Frame1.zlHighlight:Show()
            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)
                Frame1.zlHighlight:Show()
                local itemlink = ZL_CURRENT.auctionlist[v].itemlink
                if itemlink == "[打包拍卖]" then
                    ZL.PackageListFrame.index = v
                    local itemList = ZL_CURRENT.auctionlist[v]["itemList"]
                    if itemList and next(itemList, nil) then
                        ZL.PackageListFrame:Update(v)
                        ZL.PackageListFrame.OnShow()
                    else
                        GameTooltip:AddLine("没有打包拍卖物品", 1, 1, 1)
                    end
                else
                    GameTooltipShow(self, "RIGHT", "LEFT", -10)
                    GameTooltip:SetHyperlink(itemlink)
                    local itemBagCount = GetItemCount(itemlink) --获取背包物品数量
                    local itemTotalCount = GetItemCount(itemlink, true) --获取背包+银行物品数量
                    local itemBankCount = itemTotalCount - itemBagCount --银行物品数量
                    GameTooltip:AddLine(" ")
                    GameTooltip:AddLine("|T" .. "Interface\\AddOns\\" .. addonName .. "\\Images\\ZL.tga" .. ":10|t|cff3399ffAutoAuction|r")
                    if itemBagCount == 0  and itemBankCount == 0 then
                        GameTooltip:AddLine("你未拥有此物品！")
                    else
                        GameTooltip:AddLine("背包：" .. itemBagCount .. "，银行：" .. itemBankCount)
                    end
                    GameTooltip:AddLine(" ")
                    GameTooltip:AddLine("提示：双击可关注/取关该物品")
                    GameTooltip:AddLine("关注物品拍卖时会有关注语音提醒！")
                    GameTooltip:Show()
                end
                ZL.OnEnterBagHighLight(v)
            end)
            timerBtn:SetScript("OnLeave", function (self)
                Frame1.zlHighlight:Hide()
                GameTooltip:Hide()
                if ZL.PackageListFrame and ZL.PackageListFrame.time and (not ZL.PackageListFrame.time:IsCancelled()) then
                    ZL.PackageListFrame.time:Cancel()
                end
                ZL.PackageListFrame.time = C_Timer.NewTimer(0.3, function (self)
                    ZL.PackageListFrame.OnHide(Frame1.iconBtn)
                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.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)
                Frame1.zlHighlight:Show()
            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).data = 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)
                Frame1.zlHighlight:Show()
                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.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 .. "×" .. 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)
                Frame1.zlHighlight:Show()
            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)
                Frame1.zlHighlight:Show()
                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.ScrollingMessageFrame:AddMessage(msgStr)
                                print(Prefix(msgStr))
                            else
                                ZL.TransmitAddonInfo_Pro()
                                ZL.GetLootItemGUID()
                                local msgStr = ""
                                if not ZL.IsCanAuction(curAuctionList) then
                                    msgStr = curAuctionList.itemlink .. "无法拍卖，原因可能是：已分解或已无法交易"
                                    SendChatMessage(msgStr, ZL.MsgChannel())
                                    print(Prefix(msgStr))
                                    ZL.ScrollingMessageFrame:AddMessage(msgStr)
                                    return
                                end
                                local isRestart = self:GetText()
                                local tradeId = curAuctionList.tradeId
                                if isRestart == "重拍" and curAuctionList["itemGUID"] and next(curAuctionList["itemGUID"], nil) then
                                    for itemGUID, _ in pairs(curAuctionList["itemGUID"]) do
                                        ZL_CURRENT.auctionlist[v]["itemGUID"][itemGUID]["isUsed"] = nil
                                    end
                                end
                                if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                                    _G["ZL_NewAuctionFrameTab1"]:Click()
                                end
                                local bidIncrement = MLframe.startbidFrame.incrementEditbox:GetNumber()
                                local startbidamount = MLframe.startbidFrame.startbidEditbox:GetNumber()
                                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["itemGUID"] and next(curAuctionList["itemGUID"], nil) then
                                    local itemList = {}
                                    for key, _ in pairs(curAuctionList["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
                                    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
                                        print(Prefix("|cffff0000注意：流拍物品重拍，但没有合适的物品从流拍背包中取出！|r"))
                                    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
                                                    print(Prefix("没有打包拍卖物品，请先添加！"))
                                                    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.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
                            StaticPopup_Show("ZL_ADDINCOME", "收入", nil, curAuctionList)
                        end
                    end
                else
                    local msgStr = "团队模式才能进行拍卖相关行为！"
                    print(Prefix(msgStr))
                    ZL.ScrollingMessageFrame:AddMessage(msgStr)
                end
            end)

            functionFrame.reverseBidBtn = CreateButton(nil, functionFrame, "撤销出价", "TOPLEFT", CancelBtn, "BOTTOMLEFT", 0, -3, 85, 18)
            local reverseBidBtn = functionFrame.reverseBidBtn
            reverseBidBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
            reverseBidBtn:SetScript("OnEnter", function (self)
                Frame1.zlHighlight:Show()
                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 = {itemId=curAuctionList.itemId, itemindex=curAuctionList.itemindex}
                        StaticPopup_Show("ZL_REVOKEBID").data = data
                    end
                    btnDelay(self)
                else
                    print(Prefix("当前无人出价！"))
                    ZL.ScrollingMessageFrame:AddMessage("当前无人出价！")
                end
            end)
        
            functionFrame.syncBtn = CreateButton(nil, functionFrame, "同步", "LEFT", reverseBidBtn, "RIGHT", 5, 0, 40, 18)
            local syncBtn = functionFrame.syncBtn
            syncBtn:SetScript("OnEnter", function (self)
                Frame1.zlHighlight:Show()
                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)
                Frame1.zlHighlight:Show()
                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).data = 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("OnTextChanged", function (self)
                if strlen(self:GetText()) > 0 then
                    startbidEditbox.startbidFont:Hide()
                    ZL.FloatAuctionFrame.MLframe.startbidFrame.startbidEditbox.startbidFont:Hide()
                else
                    startbidEditbox.startbidFont:Show()
                    ZL.FloatAuctionFrame.MLframe.startbidFrame.startbidEditbox.startbidFont:Show()
                end
            end)
            startbidEditbox:SetScript("OnEnter", function (self)
                Frame1.zlHighlight:Show()
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("起拍价")
                GameTooltip:AddLine("按Enter键保存生效", 1, 0, 0)
                GameTooltip:Show()
            end)
            startbidEditbox:SetScript("OnLeave", function (self)
                Frame1.zlHighlight:Hide()
                GameTooltip:Hide()
            end)
            startbidEditbox:SetScript("OnEditFocusLost", function (self)
                self:HighlightText(0, 0)
                local startbid = self:GetNumber() or 0
                ZL_CURRENT.auctionlist[v].startbidamount = startbid > 0 and startbid or ZL_CURRENT.auctionlist[v].startbidamount
                startbidEditbox:SetNumber(ZL_CURRENT.auctionlist[v].startbidamount)
                ZL.FloatAuctionFrame.MLframe.startbidFrame.startbidEditbox:SetNumber(ZL_CURRENT.auctionlist[v].startbidamount)
            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("OnTextChanged", function (self)
                if strlen(self:GetText()) > 0 then
                    incrementEditbox.inrementFont:Hide()
                    ZL.FloatAuctionFrame.MLframe.startbidFrame.incrementEditbox.inrementFont:Hide()
                else
                    incrementEditbox.inrementFont:Show()
                    ZL.FloatAuctionFrame.MLframe.startbidFrame.incrementEditbox.inrementFont:Show()
                end
            end)
            incrementEditbox:SetScript("OnEnter", function (self)
                Frame1.zlHighlight:Show()
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("加价幅度")
                GameTooltip:AddLine("按Enter键保存生效", 1, 0, 0)
                GameTooltip:Show()
            end)
            incrementEditbox:SetScript("OnLeave", function (self)
                Frame1.zlHighlight:Hide()
                GameTooltip:Hide()
            end)
            incrementEditbox:SetScript("OnEditFocusLost", function (self)
                self:HighlightText(0, 0)
                local increment = self:GetNumber() or 0
                ZL_CURRENT.auctionlist[v].bidIncrement = increment > 0 and increment or ZL_CURRENT.auctionlist[v].bidIncrement
                incrementEditbox:SetNumber(ZL_CURRENT.auctionlist[v].bidIncrement)
                ZL.FloatAuctionFrame.MLframe.startbidFrame.incrementEditbox:SetNumber(ZL_CURRENT.auctionlist[v].bidIncrement)
            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)
                Frame1.zlHighlight:Show()
                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"
                        print(Prefix(msgStr))
                        ZL.ScrollingMessageFrame:AddMessage(msgStr)
                    end
                else
                    local msgStr = "你已经是有效最高出价者，无需竞价！"
                    print(Prefix(msgStr))
                    ZL.ScrollingMessageFrame:AddMessage(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)
                local _bidCounts = self:GetNumber()
                bidCounts:SetNumber(_bidCounts)
            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)
                Frame1.zlHighlight:Show()
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("竞拍数量")
                GameTooltip:AddLine("默认为1，激活输入框", 1, 1, 1)
                GameTooltip:AddLine("输入或用鼠标滚轮设定竞拍数量", 1, 1, 1)
                GameTooltip:AddLine("按Enter键或右键保存", 1, 0, 0)
                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)
                Frame1.zlHighlight:Show()
                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("|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(data[1], 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
                            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 = "你已经是有效最高出价者，无需竞价！"
                            print(Prefix(msgStr))
                            ZL.ScrollingMessageFrame:AddMessage(msgStr)
                        end
                    else
                        local data = {index=v, f=Frame1}
                        StaticPopup_Show("ZL_AUTOBID", curAuctionList.itemlink).data = 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)
                Frame1.zlHighlight:Show()
            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)
                ZL.FloatAuctionFrame.index = v
                Frame1.zlHighlight:Show()
                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
                local auctionList = ZL_CURRENT["auctionlist"][v]
                if auctionList and auctionList.bidderlist and (#auctionList.bidderlist > 0)then
                    local bidderlist = auctionList.bidderlist
                    tableSort(bidderlist)
                    GameTooltipShow(self, "TOP", "BOTTOM", 0, 0)
                    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
                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.3, function (self)
                    ZL.FloatAuctionFrame.OnHide()
                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.ScrollingMessageFrame:AddMessage(msgStr)
                                    print(Prefix(msgStr))
                                else
                                    ZL.GetLootItemGUID()
                                    ZL.TransmitAddonInfo_Pro()
                                    if not ZL.IsCanAuction(curAuctionList) then
                                        msgStr = curAuctionList.itemlink .. "无法拍卖，原因可能是：已分解或已无法交易"
                                        SendChatMessage(msgStr, ZL.MsgChannel())
                                        print(Prefix(msgStr))
                                        ZL.ScrollingMessageFrame:AddMessage(msgStr)
                                        return
                                    end
                                    local isRestart = CancelBtn:GetText()
                                    local tradeId = curAuctionList.tradeId
                                    if isRestart == "重拍" and curAuctionList["itemGUID"] and next(curAuctionList["itemGUID"], nil) then
                                        for itemGUID, _ in pairs(curAuctionList["itemGUID"]) do
                                            ZL_CURRENT.auctionlist[v]["itemGUID"][itemGUID]["isUsed"] = nil
                                        end
                                    end
                                    if not ZL_CURRENT.globalConfig.allowMultipleAuctions then
                                        _G["ZL_NewAuctionFrameTab1"]:Click()
                                    end
                                    local bidIncrement = MLframe.startbidFrame.incrementEditbox:GetNumber()
                                    local startbidamount = MLframe.startbidFrame.startbidEditbox:GetNumber()
                                    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
                                                    print(Prefix("没有打包拍卖物品，请先添加！"))
                                                    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["itemGUID"] and next(curAuctionList["itemGUID"], nil) then
                                        local itemList = {}
                                        for key, _ in pairs(curAuctionList["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
                                        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
                                            print(Prefix("|cffff0000注意：流拍物品重拍，但没有合适的物品从流拍背包中取出！|r"))
                                        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.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.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
                                    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
                        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.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+2)+5 > functionFrame:GetWidth()+1 then
                            --前面的宽度+撤销出价按钮的宽度大于功能按钮总宽度，换到第二排
                            reverseBidBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", 5, -6-CancelBtn:GetHeight())
                            num2 = num2 + 2
                        else
                            reverseBidBtn:SetPoint("TOPLEFT", functionFrame, "TOPLEFT", num==0 and 5 or btnWidth*num+5, -3)
                            num = num + 2
                        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需要先缓存
                else
                    icon:SetTexture("Interface\\AddOns\\" .. addonName .. "\\Images\\ZL.tga")
                end

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

                if lgnore then
                    lgnoreBtn:SetText("恢复")
                else
                    lgnoreBtn:SetText("忽略")
                end
                sb:SetMinMaxValues(0, ZL.opt.auctionTimer)
                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(" ")
                    -- 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()
                    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("当前无人出价！")
                    end
                    packageBtn:Disable()
                    PauseBtn:Enable()
                    CancelBtn:Enable()
                    CancelBtn:SetText("取消")
                    CountDownBtn:Enable()
                    reverseBidBtn: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)
                    else
                        playerNameString:SetText("当前无人出价！")
                    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()
                    delAuctionBtn:Disable()
                end
            end
            t[v] = Frame1
            return Frame1
        end
    })

    AuctionFrame.scrollFrame:SetScript("OnSizeChanged", function (self, 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)
    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 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 --如果有人出价
                if PlayerIsML() then
                    tableSort(bidderlist)
                    local isSelf = false
                    local failedItemGUIDList = {}
                    local successItemGUIDList = {}
                    local successBidderList = {}
                    local successBidderCount = 0
                    local successIndex
                    --如果出价大于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
                    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 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
                            if count == 1 then
                                msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. ")，"
                            else
                                msgStr = msgStr .. ParseClassColorName(bidData.bidder) .. "(" .. bidData.bidamount .. "x" .. count .. ")，"
                            end
                            --判断获胜者可以交易哪几个物品
                            if curAuction["itemGUID"] and next(curAuction["itemGUID"], nil) then
                                local linshiList = {[bidData.bidder]={}}
                                for itemGUID, data in pairs(curAuction["itemGUID"]) do
                                    local candidates = data.candidates
                                    if (not candidates) or (not next(candidates, nil)) or (candidates[bidData.bidder] == true) then
                                        table.insert(linshiList[bidData.bidder], itemGUID)
                                    end
                                end
                                linshiList.itemGUIDCount = #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.itemGUIDCount < b.itemGUIDCount
                    end)
                    --将获胜者数据添加到收支数据库
                    local tradeId = tostring(curAuction.itemId) .. tostring(time())
                    ZL_CURRENT.auctionlist[_index].tradeId = tradeId
                    local stackCount = curAuction.stackCount
                    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 _, _itemGUID in ipairs(data[name]) do
                                        --查询itemGUID是否已被使用
                                        if not curAuction["itemGUID"][_itemGUID]["isUsed"] then
                                            itemGUID = _itemGUID
                                            ZL_CURRENT.auctionlist[_index]["itemGUID"][_itemGUID]["isUsed"] = name
                                            if stackCount == 1 then
                                                hasCount = hasCount + 1
                                            else
                                                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
                                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 = {}
                            if curAuction.itemGUID and next(curAuction.itemGUID, nil) then
                                for _itemGUID, _data in pairs(curAuction.itemGUID) do
                                    if _data["isUsed"] == name then
                                        table.insert(itemGUIDList, _itemGUID)
                                        itemGUID = _itemGUID
                                        successItemGUIDList[itemGUID] = curAuction["itemGUID"][itemGUID]
                                        -- break
                                    end
                                end
                            end
                            itemList[itemlink] = {
                                itemCount = bidderlist[i].bidCount,
                                stackCount = curAuction.stackCount,
                                itemindex = {itemindex},
                                itemGUID = itemGUIDList,
                                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
                        })
                        -- if itemGUID then
                        --     successItemGUIDList[itemGUID] = curAuction["itemGUID"][itemGUID]
                        -- end
                    end
                    
                    ZL.AuctionRecordFrame.currentIncomeFrame:Update()
                    ZL.AuctionRecordFrame.playerBalanceFrame:Update()
                    if curAuction["itemGUID"] and next(curAuction["itemGUID"], nil) then
                        for key, value in pairs(curAuction["itemGUID"]) do
                            if not value["isUsed"] then
                                failedItemGUIDList[key] = curAuction["itemGUID"][key]
                            end
                        end
                    end
                    if isSelf then
                        local itemGUIDList = curAuction["itemGUID"]
                        if itemGUIDList and next(itemGUIDList, nil) then
                            for itemGUID, data in pairs(itemGUIDList) do
                                if data.isUsed == GetClassColorName(UnitName("player")) then
                                    --将自己拍卖到的物品添加到数据库，交易剩余时间提醒的时候过滤
                                    if not ZL_CURRENT.SelfAuction then ZL_CURRENT.SelfAuction = {} end
                                    ZL_CURRENT.SelfAuction[itemGUID] = 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, ZL.opt.selfBagId, ZL.opt.selfDirection)
                                            end)
                                        end
                                    end
                                    linshi()
                                    break --自己拍到的物品只需要放置一个就行
                                end
                            end
                        end
                    end
                    --如果获胜物品总数小于拍卖物品数量则拆单，没拍卖的创建流拍
                    if successBidderCount < curAuction.itemCount then
                        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].itemGUID = successItemGUIDList
                        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,
                                ["itemGUID"] = failedItemGUIDList,
                                ["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]
                        if curAuction["itemGUID"] and next(curAuction["itemGUID"], nil) then
                            for itemGUID, _ in pairs(curAuction["itemGUID"]) do
                                table.insert(itemGUIDList, itemGUID)
                            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 then
                    PlaySoundFile("Interface\\AddOns\\" .. addonName .. "\\sound\\" .. ZL.SoundType .. "\\物品已流拍.mp3", "Master")
                end
            end
            if info then info = nil 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(changeSize)
        if PlayerIsML() then
            MLFrame:Show()
        else
            MLFrame:Hide()
        end
        -- AuctionFrame.scrollFrame:SetWidth(AuctionFrame.scrollFrame:GetWidth() + 0.5)
        -- C_Timer.After(0.5, function ()
        --     AuctionFrame.scrollFrame:SetWidth(AuctionFrame.scrollFrame:GetWidth() - 0.5)
        -- end)
        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 ZL.FloatAuctionFrame:Update() end

        -- 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()
    end)
    maxFrame:SetScript("OnMouseDown", function (self)
        self:StartMoving()
    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 IsInGroup() 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)))
                print(Prefix("物品ID已存在！起拍价和每次最低出价已更新！"))
            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
            print(Prefix("信息填写不完整！"))
            GameTooltipShow(self, "BOTTOM", "TOP")
            GameTooltip:AddLine("信息填写不完整！")
            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
                print(Prefix("物品ID不存在！"))
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("物品ID不存在！")
                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)))
                print(Prefix("物品ID已存在！"))
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("物品ID已存在！！")
                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
            print(Prefix("信息填写不完整！"))
            GameTooltipShow(self, "BOTTOM", "TOP")
            GameTooltip:AddLine("信息填写不完整！")
            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
                print(Prefix("物品ID不存在！"))
                GameTooltipShow(self, "BOTTOM", "TOP")
                GameTooltip:AddLine("物品ID不存在！")
                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
                        print(Prefix("物品ID已存在！"))
                        GameTooltipShow(self, "BOTTOM", "TOP")
                        GameTooltip:AddLine("物品ID已存在！")
                        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
                        print(Prefix("物品ID已存在！"))
                        GameTooltipShow(self, "BOTTOM", "TOP")
                        GameTooltip:AddLine("物品ID已存在！")
                        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(530, 500) --330, 350
    AuctionRecordFrame:SetResizeBounds(530, 300, 530, 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()
        if PlayerIsML() then
            _G["ZLAuctionRecordFrameTab3"]:Show()
        else
            _G["ZLAuctionRecordFrameTab3"]:Hide()
        end
    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:SetScript("OnClick", function ()
        StaticPopup_Show("ZL_CLEARHISTORYWARNING")
    end)
    historyFrame.autoClearHistoryCheckButton = CreateFrame("CheckButton", nil, historyFrame, "ChatConfigCheckButtonTemplate")
    historyFrame.autoClearHistoryCheckButton:SetPoint("LEFT", ClearHistoryBtn , "RIGHT")
    historyFrame.autoClearHistoryCheckButton.Text:SetText("自动清除")
    historyFrame.autoClearHistoryCheckButton.Text:SetFont(GameFontNormal:GetFont(), 14, "")
    historyFrame.autoClearHistoryCheckButton.Text:SetTextColor(1, 0.82, 0)
    historyFrame.autoClearHistoryCheckButton.Text:ClearAllPoints()
    historyFrame.autoClearHistoryCheckButton.Text:SetPoint("LEFT", historyFrame.autoClearHistoryCheckButton , "RIGHT", -3, 0)
    historyFrame.autoClearHistoryCheckButton:SetHitRectInsets(0, -historyFrame.autoClearHistoryCheckButton.Text:GetWidth(), 0, 0)
    historyFrame.autoClearHistoryCheckButton.tooltip = "勾选将自动清除|cffffffff" .. ZL.opt.autoClearHistoryDays .. "|r天前的记录"
    historyFrame.autoClearHistoryCheckButton:SetChecked(ZL.opt.autoClearHistory)
    historyFrame.autoClearHistoryCheckButton:SetScript("OnClick", function ()
        ZL.opt.autoClearHistory = historyFrame.autoClearHistoryCheckButton:GetChecked()
    end)

    -- 下拉菜单的初始化函数
    local function autoClearHistoryDropDown_CreateMenu(frame, level, menuList)
        local info = UIDropDownMenu_CreateInfo()
        local list = {7, 15, 30}
        if (level or 1) == 1 then
            for i = 1, #list do
                -- info.notCheckable = 1
                info.isNotRadio = false
                info.text = list[i]
                info.checked = (ZL.opt.autoClearHistoryDays == list[i] and true or false)
                info.func = function()
                    UIDropDownMenu_SetSelectedValue(historyFrame.autoClearHistoryDropDown, list[i])
                    ZL.opt.autoClearHistoryDays = UIDropDownMenu_GetSelectedValue(historyFrame.autoClearHistoryDropDown)
                    CloseDropDownMenus()
                    UIDropDownMenu_Refresh(historyFrame.autoClearHistoryDropDown)
                end
                UIDropDownMenu_AddButton(info, level)
            end
        end
    end
    historyFrame.autoClearHistoryDropDown = CreateFrame("FRAME", "ZLautoClearHistoryDropDown", historyFrame, "UIDropDownMenuTemplate")
    historyFrame.autoClearHistoryDropDown:SetPoint("LEFT", historyFrame.autoClearHistoryCheckButton.Text, "RIGHT", -17, 0)
    UIDropDownMenu_SetWidth(historyFrame.autoClearHistoryDropDown, 50)
    historyFrame.autoClearHistoryDropDown:SetScale(1)
    UIDropDownMenu_Initialize(historyFrame.autoClearHistoryDropDown, autoClearHistoryDropDown_CreateMenu)
    UIDropDownMenu_SetSelectedValue(historyFrame.autoClearHistoryDropDown, ZL.opt.autoClearHistoryDays) -- 默认选中30

    historyFrame.autoClearHistoryFont = historyFrame:CreateFontString()
    local autoClearHistoryFont = historyFrame.autoClearHistoryFont
    autoClearHistoryFont:SetPoint("LEFT", historyFrame.autoClearHistoryDropDown, "RIGHT", -12, 0)
    autoClearHistoryFont:SetFont(GameFontNormal:GetFont(), 14)
    autoClearHistoryFont:SetTextColor(1, 0.82, 0)
    autoClearHistoryFont:SetText("天前记录")
    autoClearHistoryFont:SetWordWrap(false)

    historyFrame.nameFont = historyFrame:CreateFontString()
    local nameFont = historyFrame.nameFont
    nameFont:SetPoint("TOPLEFT", ClearHistoryBtn, "BOTTOMLEFT", 5, -8)
    nameFont:SetWidth(150)
    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(100)
    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)

    local function mailConfirmBtnRightClick()
        if ZL.mailRegOpen then
            ZL.mailRegOpen = false
            currentIncomeFrame.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

    currentIncomeFrame.mailConfirmBtn = CreateButton(nil, currentIncomeFrame, "|cffffffff邮寄登记|r", "TOPLEFT", currentIncomeFrame, "TOPLEFT", 3, -2, 80)
    currentIncomeFrame.mailConfirmBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    currentIncomeFrame.mailConfirmBtn:SetScript("OnClick", function (self, button)
        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
                currentIncomeFrame.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) 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)
                    print(Prefix("已登记全部邮寄工资！"))
                else
                    print(Prefix("没有需要邮寄的成员！"))
                end
            else
                ZL.mailRegOpen = true
                currentIncomeFrame.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
    end)
    currentIncomeFrame.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)
    currentIncomeFrame.mailConfirmBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)
    currentIncomeFrame.mailConfirmDropDown = CreateFrame("FRAME", nil, currentIncomeFrame, "UIDropDownMenuTemplate")
    UIDropDownMenu_SetWidth(currentIncomeFrame.mailConfirmDropDown , 8)
    currentIncomeFrame.mailConfirmDropDown:SetPoint("LEFT", currentIncomeFrame.mailConfirmBtn, "RIGHT", -20, -2)
    currentIncomeFrame.mailConfirmDropDown:SetScale(1)
    UIDropDownMenu_Initialize(currentIncomeFrame.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 = "选择邮寄工资名单"
            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 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
                    end
                    UIDropDownMenu_AddButton(info, level)
                end
            end
        end
    end)


    currentIncomeFrame.SendMsgBtn = CreateButton(nil, currentIncomeFrame, "通报", "LEFT", currentIncomeFrame.mailConfirmBtn, "RIGHT", 23, 0, 40)
    local SendMsgBtn = currentIncomeFrame.SendMsgBtn
    SendMsgBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    SendMsgBtn:SetScript("OnClick", function (self, button)
        local numGroupMembers, RLBuTie, totalincome, totalpayout, totalamount, averageamount = GetAveWages()
        local function gourp()
            local delay = 0
            if ZL.mailRegOpen then
                ZL.mailRegOpen = false
                currentIncomeFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
                for i = 1, 2 do
                    SendChatMessage("已停止邮寄登记！", ZL.MsgChannel())
                end
                delay = 0.3
            end
            if not ZL_CURRENT["aveWages"] then
                print(Prefix("没有工资成员记录！"))
                return
            end
            local msgStr = ""
            local msglist = {}
            -- delay = 0.3
            -- if ZL_CURRENT.IncomeList and (#ZL_CURRENT.IncomeList > 0) then
            --     C_Timer.After(delay, function ()
            --         msgStr = "{rt6}<<<小队工资>>>{rt6}"
            --         SendChatMessage(msgStr, "RAID")
            --         C_Timer.After(delay, function ()
                        
            --         end)
            --     end)
            -- else
            --     msgStr = "当前没有收支记录！"
            --     SendChatMessage(msgStr, "RAID")
            -- end
            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
                        wipe(msglist)
                        -- msgStr = "{rt8}{rt8}{rt8}工资已确认，请不要离队、调整队伍，避免漏发错发工资{rt8}{rt8}{rt8}"
                        -- SendChatMessage(msgStr, (UnitIsRaidOfficer("player") or UnitIsGroupLeader("player")) and "RAID_WARNING" or "RAID")
                    end
                    index = index + 1
                    C_Timer.After(0.3, sendMessage)
                end
            end
            sendMessage()
        end
        local msgStr = ""
        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
                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
                        currentIncomeFrame.mailConfirmBtn:SetText("|cffffffff邮寄登记|r")
                        for i = 1, 2 do
                            SendChatMessage("已停止邮寄登记！", ZL.MsgChannel())
                        end
                        delay = 0.3
                    end
                    if not ZL_CURRENT["aveWages"] then
                        print(Prefix("没有工资成员记录！"))
                        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
            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)
    currentIncomeFrame.totalIncomeFont = currentIncomeFrame:CreateFontString()
    local totalIncomeFont = currentIncomeFrame.totalIncomeFont
    totalIncomeFont:SetPoint("LEFT", SendMsgBtn, "RIGHT", 2, 0)
    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", currentIncomeFrame.mailConfirmBtn, "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)
    playerBalanceFrame.SendMsgBtn = CreateButton(nil, playerBalanceFrame, "保存名单", "TOPLEFT", playerBalanceFrame, "TOPLEFT", 5, -5)
    playerBalanceFrame.SendMsgBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
    playerBalanceFrame.SendMsgBtn:SetScript("OnClick", function (self, button)
        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
                msgStr = "团队名单保存成功，并已选择|cffff0000最新历史1|r名单作为工资计算！"
            else
                msgStr = "团队名单保存成功，计算工资名单为：|cffff0000历史" .. ZL.opt.wagesGroupMembers .. "|r"
            end
        else
            msgStr = "不在团队中，无法保存团员名单！"
        end
        C_Timer.After(2, function ()
            self:Enable()
        end)
        print(Prefix(msgStr))
        ZL.ScrollingMessageFrame:AddMessage(msgStr)
    end)
    playerBalanceFrame.SendMsgBtn:SetScript("OnEnter", function (self)
        GameTooltipShow(self, "RIGHT", "LEFT")
        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|cffffd100欠款|r|cffffffff金额|r")
        GameTooltip:AddLine("勾选显示工资：|cffffffff显示团队所有人的工资|r")
        GameTooltip:AddLine("其他：|cffffffff显示所有欠款或装备未交易人员的|r|cffffd100欠款|r|cffffffff金额|r")
        GameTooltip:Show()
    end)
    playerBalanceFrame.SendMsgBtn:SetScript("OnLeave", function ()
        GameTooltip:Hide()
    end)

    playerBalanceFrame.selectGroupMembersDropDown = CreateFrame("FRAME", nil, playerBalanceFrame, "UIDropDownMenuTemplate")
    UIDropDownMenu_SetWidth(playerBalanceFrame.selectGroupMembersDropDown , 8)
    playerBalanceFrame.selectGroupMembersDropDown:SetPoint("LEFT", playerBalanceFrame.SendMsgBtn, "RIGHT", -20, -2)
    playerBalanceFrame.selectGroupMembersDropDown:SetScale(1)
    UIDropDownMenu_Initialize(playerBalanceFrame.selectGroupMembersDropDown, function (self, level, menuList)
        local info = UIDropDownMenu_CreateInfo()
        wipe(info)
        if (level or 1) == 1 then
            info.isTitle = 1
            info.text = "选择计算工资名单"
            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
                    CloseDropDownMenus()
                    UIDropDownMenu_Refresh(playerBalanceFrame.selectGroupMembersDropDown)
                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
                            CloseDropDownMenus()
                            UIDropDownMenu_Refresh(playerBalanceFrame.selectGroupMembersDropDown)
                        end
                        UIDropDownMenu_AddButton(info, level)
                    end
                end
            end
        elseif level == 2 then
            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
            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)

    playerBalanceFrame.SendMailBtn = CreateButton(nil, playerBalanceFrame, "一键邮寄", "LEFT", playerBalanceFrame.SendMsgBtn, "RIGHT", 20, 0)
    playerBalanceFrame.SendMailBtn:Disable()
    playerBalanceFrame.SendMailBtn:SetScript("OnClick", function (self)
        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)
                                            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|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()
    playerBalanceFrame.butieMail:SetPoint("LEFT", playerBalanceFrame.wagesCheckButton, "RIGHT", 65, 0)
    playerBalanceFrame.butieMail:SetFont(GameFontNormal:GetFont(), 13)
    playerBalanceFrame.butieMail:SetTextColor(1, 0.82, 0)
    playerBalanceFrame.butieMail:SetWordWrap(false)
    playerBalanceFrame.butieMail:SetJustifyH("LEFT")
    local butieMail = playerBalanceFrame.butieMail

    playerBalanceFrame.groupFont = playerBalanceFrame:CreateFontString()
    local groupFont = playerBalanceFrame.groupFont
    groupFont:SetPoint("TOPLEFT", playerBalanceFrame.SendMsgBtn, "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()
    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(), 15)
    biLiFont:SetTextColor(1, 0.82, 0)
    biLiFont:SetText("比例(%)")
    biLiFont:SetWordWrap(false)
    biLiFont:SetJustifyH("CENTER")
    local stringWidth = biLiFont:GetStringWidth()
    if stringWidth > 50 then
        biLiFont:SetTextScale(50/stringWidth)
    end

    playerBalanceFrame.buTieFont = playerBalanceFrame:CreateFontString()
    local buTieFont = playerBalanceFrame.buTieFont
    buTieFont:SetPoint("LEFT", biLiFont, "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()
        if tabId == 1 then
            historyFrame:Show()
            currentIncomeFrame:Hide()
            playerBalanceFrame:Hide()
            if historyFrame.Update then historyFrame:Update() end
        elseif tabId == 2 then
            historyFrame:Hide()
            currentIncomeFrame:Show()
            playerBalanceFrame:Hide()
            currentIncomeFrame:Update()
        elseif tabId == 3 then
            historyFrame:Hide()
            currentIncomeFrame:Hide()
            playerBalanceFrame:Show()
            playerBalanceFrame:Update()
        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, ...))
            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
                    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, 150, 25, 14, "LEFT")
            f.nameEditBox:SetPoint("LEFT", f, "LEFT", 5, 0)
            f.nameEditBox:Disable()
            f.nameEditBox:SetScript("OnEnter", function (self)
                OnEnter(self)
            end)
            f.nameEditBox:SetScript("OnLeave", function (self)
                OnLeave(self)
            end)

            f.totalIncomeBox = CreateEditBox(f, 100, 25, 15, "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, 14, "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:SetScript("OnClick", function (self)
                table.remove(ZL_HISTORY, v)
                historyFrame:Update()
            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("\n点击可删除该条拍卖记录，并且无法恢复！")
                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 ()
                if ZL.AuctionFrame2.MLFrame.syncAllBtn:IsEnabled() then
                    if GetAuctioningCount() > 0 then
                        print(Prefix("存在正在拍卖中的物品，无法切换！"))
                        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
                    print(Prefix("距离上次同步还未到15秒，请稍后再切换！"))
                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)
                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]
                if PlayerIsML() then
                    f.res:Show()
                else
                    f.res:Hide()
                end
                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: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)
                currentIncomeFrame.currenIndex = v
                currentIncomeFrame.dropDown:SetPoint("RIGHT", self, "RIGHT", 18, -2)
                _G["ZLcurrentIncomeFrameDropDown"]:SetFrameLevel(f.playerbox:GetFrameLevel() + 1)
                currentIncomeFrame.dropDown:Show()
            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()
                    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:Show()
            end)
            f.amountbox:SetScript("OnLeave", function (self)
                OnLeave(self)
                GameTooltip:Hide()
            end)
            f.bidCountBox = CreateEditBox(f, 35, 25, 14, "RIGHT")
            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("如需修改，只允许填写|cffffd100数字|r！", 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)
                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)
            f.del:SetScript("OnEnter", function (self)
                OnEnter(self)
                GameTooltipShow(self, "LEFT", "RIGHT")
                GameTooltip:AddLine("注意：点击可删除，不可恢复！")
                GameTooltip:AddLine("如需修改，直接在文本框编辑后按Enter键", 1, 1, 1)
                GameTooltip:AddLine("如需填写物品名称，可直接鼠标拖动物品到名称文本框", 1, 1, 1)
                GameTooltip:Show()
            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")
                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.SendMsgBtn:Show()
        else
            currentIncomeFrame.SendMsgBtn: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
                    f.notesbox:Enable()
                    -- f.playerbox:Enable()
                    f.amountbox:Enable()
                    f.del:Show()
                    f.notesbox:SetScript("OnEnter", function (self)
                        OnEnter(self)
                        GameTooltipShow(self,"BOTTOM", "TOP")
                        GameTooltip:AddLine("如需输入物品名，|cffffd100Shift+左键|r\n点击背包物品或拍卖图标", 1, 1, 1)
                        GameTooltip:Show()
                    end)
                    f.playerbox:SetScript("OnEnter", function (self)
                        OnEnter(self)
                        currentIncomeFrame.currenIndex = num
                        currentIncomeFrame.dropDown:SetPoint("RIGHT", self, "RIGHT", 18, -2)
                        _G["ZLcurrentIncomeFrameDropDown"]:SetFrameLevel(f.playerbox:GetFrameLevel() + 1)
                        currentIncomeFrame.dropDown:Show()
                    end)
                    f.amountbox:SetScript("OnEnter", function (self)
                        OnEnter(self)
                        GameTooltipShow(self, "LEFT", "RIGHT")
                        GameTooltip:AddLine("注意：")
                        GameTooltip:AddLine("如需修改，只允许填写|cffffd100数字|r！", 1, 1, 1)
                        GameTooltip:Show()
                    end)
                    f.bidCountBox:SetScript("OnEnter", function (self)
                        OnEnter(self)
                        GameTooltipShow(self, "LEFT", "RIGHT")
                        GameTooltip:AddLine("注意：")
                        GameTooltip:AddLine("如需修改，只允许填写|cffffd100数字|r！", 1, 1, 1)
                        GameTooltip:Show()
                    end)
                else
                    f.notesbox:Disable()
                    f.playerbox:Disable()
                    f.amountbox:Disable()
                    f.bidCountBox:Disable()
                    f.del:Hide()
                end
                f:SetValues(data.notes, data.player, data.amount, data.itemCount)
                f.notes = data.notes
            end
        end
        local butie = {}
        if RLBuTie and RLBuTie > 0 then
            table.insert(butie, {player="", notes="RL补贴", amount=-RLBuTie, isTraded=true})
        end
        if ZL.opt.Tbutie and ZL.opt.Tbutie > 0 then
            table.insert(butie, {player="", notes="T补贴", amount=-ZL.opt.Tbutie, isTraded=true})
        end
        if ZL.opt.Nbutie and ZL.opt.Nbutie > 0 then
            table.insert(butie, {player="", notes="奶补贴", amount=-ZL.opt.Nbutie, isTraded=true})
        end
        if ZL.opt.DPSbutie and ZL.opt.DPSbutie > 0 then
            table.insert(butie, {player="", notes="DPS补贴", amount=-ZL.opt.DPSbutie, isTraded=true})
        end
        if ZL.opt.FOODbutie and ZL.opt.FOODbutie > 0 then
            table.insert(butie, {player="", notes="食物补贴", amount=-ZL.opt.FOODbutie, isTraded=true})
        end
        if ZL.opt.xiuXingbutie and ZL.opt.xiuXingbutie > 0 then
            table.insert(butie, {player="", notes="修星补贴", amount=-ZL.opt.xiuXingbutie, isTraded=true})
        end
        if ZL.opt.ANMUbutie and ZL.opt.ANMUbutie > 0 then
            table.insert(butie, {player="", notes="工具人补贴", amount=-ZL.opt.ANMUbutie, isTraded=true})
        end
        if #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()))
                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的任意整数")
                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"]) then
                    self:SetNumber(100)
                elseif biLi ~= WagesBiLi[name]["biLi"] then
                    self:SetNumber(WagesBiLi[name]["biLi"])
                end
            end)

            f.buTieEditBox = CreateEditBox(f, 55, 25, 14, "RIGHT", true)
            f.buTieEditBox:SetPoint("LEFT", f.biLiEditBox, "RIGHT", 0, 0)
            f.buTieEditBox:SetTextInsets(0, 3, 0, 0)
            f.buTieEditBox:SetScript("OnEnter", function (self)
                OnEnter(self)
                GameTooltipShow(self, "LEFT", "RIGHT")
                GameTooltip:AddLine("注意：", 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)
                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)
                StaticPopup_Show("ZL_ADDTOPLAYER", f.nameEditBox:GetText()).data = 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)
                StaticPopup_Show("ZL_REMFROMPLAYER", f.nameEditBox:GetText()).data = f.nameEditBox:GetText()
            end)
            f.rem:SetScript("OnEnter", function (self)
                OnEnter(self)
            end)
            f.rem:SetScript("OnLeave", function (self)
                OnLeave(self)
            end)
            f.trade = CreateButton(nil, f, "清单", "LEFT", f.rem, "RIGHT", 0, 0, 30, 25, 10)
            f.trade:SetScript("OnClick", function ()
                local name = f.nameEditBox:GetText()
                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 = {}
                    local 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
                        local index = 1
                        local function sendMessage()
                            if index <= #msglist then
                                SendChatMessage(msglist[index], "WHISPER", nil, ParseClassColorName(name))
                                if index == #msglist then
                                    wipe(msglist)
                                end
                                index = index + 1
                                C_Timer.After(0.3, sendMessage)
                            end
                        end
                        sendMessage()
                    else
                        print(Prefix("没有欠款和需要交易的物品！"))
                    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 ZL_CURRENT["mailPlayers"] then
                    if ZL_CURRENT["mailPlayers"][name] == nil then
                        GameTooltip:AddLine("不需要邮寄")
                    elseif ZL_CURRENT["mailPlayers"][name] == false then
                        GameTooltip:AddLine("待邮寄")
                    elseif ZL_CURRENT["mailPlayers"][name] == true then
                        GameTooltip:AddLine("已邮寄")
                    end
                else
                    GameTooltip:AddLine("不需要邮寄")
                end
                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 _G["MailFrame"]) or (not _G["MailFrame"]:IsShown()) then
                    print(Prefix("先打开邮箱！"))
                    return
                end
                if ZL.Recipient then
                    print(Prefix("前面邮件发送还未结束，请稍后重试！"))
                    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)
                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.buTieEditBox:SetNumber(buTie)
                local total = tonumber(ZL.ParseClassColorName(balanceAmount)) + 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)
            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
                                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 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)
                                if balanceAmount + 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
                                    f:SetValues(name, _balanceAmount, group, biLi*100, buTie)
                                    index = index + 1
                                end
                            end
                        end
                    end
                end
            end
        elseif ZL.isTrading and ZL.tradePartner and (playerBuyList[ZL.tradePartner]) then --如果在交易中则工资窗口第一个显示交易对象的记录
            playerBalanceFont:SetText("欠款")
            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
            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 playerBalance = playerPayToMLamount - playerBuyList[ZL.tradePartner].totalAmount
            playerBalance = playerBalance > 0 and 0 or playerBalance
            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 f = self.entries[index]
            f:Show()
            f:SetValues(name, "|cffff0000" .. tostring(playerBalance) .. "|r", group, biLi*100, buTie)
            -- 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
                            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 + amount
                                else
                                    balanceAmount = ZL_CURRENT["aveWages"] * biLi + amount
                                end
                            else
                                balanceAmount = ZL_CURRENT["aveWages"] * biLi + amount
                            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)
                            -- 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 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 playerBalance = playerPayToMLamount - playerBuyList[name].totalAmount
                playerBalance = playerBalance > 0 and 0 or playerBalance
                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
                    playerBalance = 0
                    IsNotTrade = false
                end
                if playerBalance < 0 or IsNotTrade then
                    local f = self.entries[index]
                    f:Show()
                    f:SetValues(name, "|cffff0000" .. tostring(playerBalance) .. "|r", group, biLi*100, buTie)
                    -- 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 .. "|r")
            else
                butieMail:SetText("邮寄补贴：|cffff0000" .. totalBuTieMail .. "|r， 总支出：|cffffffff" .. -totalpayout .. "|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:SetScript("OnEnter", function (self)
        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()
        else

        end
    end)
    BidderListFrame:SetScript("OnShow", function ()
        local index = ZL.BidderListFrame.index
        if (not PlayerIsML()) or ZL_CURRENT.auctionlist[index].state ~= "auctioning" then
            BidderListFrame.dropDown:Hide()
            return
        end
    end)

    BidderListFrame:SetScript("OnLeave", function (self)
        if ZL.BidderListFrame.time and (not ZL.BidderListFrame.time:IsCancelled()) then
            ZL.BidderListFrame.time:Cancel()
        end
        ZL.BidderListFrame.time = C_Timer.NewTimer(0.5, function (self)
            ZL.BidderListFrame.OnHide() --ZL.BidderListFrame.toolFrame
        end)
        GameTooltip:Hide()
    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("金额(g)")
    BidAmountFont:SetWordWrap(false)
    BidAmountFont:SetJustifyH("RIGHT")
    BidderListFrame:Hide()

    BidderListFrame.dropDown = CreateFrame("FRAME", nil, BidderListFrame, "UIDropDownMenuTemplate")
    UIDropDownMenu_SetWidth(BidderListFrame.dropDown, 8)
    BidderListFrame.dropDown:SetScale(0.8)
    BidderListFrame.dropDown:Hide()

    function BidderListFrame.OnShow()
        if ZL.BidderListFrame.time and (not ZL.BidderListFrame.time:IsCancelled()) then
            ZL.BidderListFrame.time:Cancel()
        end
        if not BidderListFrame:IsShown() then
            BidderListFrame:Show()
        end
    end
    function BidderListFrame.OnHide(frame)
        if ((not frame) or (not frame:IsMouseOver())) and (not BidderListFrame:IsMouseOver()) then
            BidderListFrame:Hide()
        end
    end
    BidderListFrame.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
                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
                                        print(Prefix("名字已存在，请重新选择！"))
                                        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].Frame1.MLframe.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 ()
                -- BidderListFrame.dropDown: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("OnEnterPressed", function (self)
                local index = ZL.BidderListFrame.index
                local bidAmount = self:GetText()
                bidAmount = string.gsub(bidAmount, "|cffff0000", "")
                bidAmount = string.gsub(bidAmount, "|r", "")
                bidAmount = tonumber(bidAmount)
                bidAmount = (bidAmount > 0 and bidAmount) or 0
                if bidAmount> 0 and bidAmount ~= ZL_CURRENT.auctionlist[index].bidderlist[v].bidamount then
                    ZL_CURRENT.auctionlist[index].bidderlist[v].bidamount = bidAmount
                    BidderListFrame:Update(index)
                    ZL.AuctionFrame2.entries[index]:SetValues(index)
                    ZL.AuctionFrame2.entries[index].Frame1.MLframe.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)
                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
                -- self:SetText(ZL_CURRENT.auctionlist[index].bidderlist[v].bidamount)
                -- self:ClearFocus()
                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
        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.5, 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", -7, -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)

    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

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