131 lines
4.0 KiB
Lua
131 lines
4.0 KiB
Lua
local TimeSettingPanel = import(".TimeSettingPanel")
|
|
local GroupPartnerStatMember = import(".GroupPartnerStatMember")
|
|
local GroupPartnerStatPlay = import(".GroupPartnerStatPlay")
|
|
local GroupNumberInputView = import(".GroupNumberInputView")
|
|
-- 开桌统计
|
|
local GroupMngXingYunStatView = {}
|
|
|
|
local M = GroupMngXingYunStatView
|
|
|
|
function GroupMngXingYunStatView.new(gid)
|
|
local self = M
|
|
self.class = "GroupMngXingYunStatView"
|
|
self.group_id = gid
|
|
self:InitView()
|
|
return self
|
|
end
|
|
|
|
function M:initData()
|
|
self.lst_record.numItems = 0
|
|
self.record_data = {}
|
|
|
|
local now_time = os.date("*t",now)
|
|
local today = os.time({year=now_time.year, month=now_time.month, day=now_time.day, hour=0,min=0,sec=0})
|
|
self.begin_time = today
|
|
self.end_time = today + 86400
|
|
self:GetRecordData(0)
|
|
|
|
end
|
|
|
|
|
|
|
|
function M:InitView()
|
|
self._view = UIPackage.CreateObjectFromURL("ui://NewGroup/View_GroupXingYunStat")
|
|
|
|
local group = DataManager.groups:get(self.group_id)
|
|
-- if group.lev ~= 3 then
|
|
-- self._view:GetController("mng").selectedIndex = 1
|
|
-- end
|
|
|
|
local lst_mgr_index = self._view:GetChild("lst_mgr_index")
|
|
|
|
|
|
self.lst_record = self._view:GetChild("lst_record")
|
|
self.lst_record:SetVirtual()
|
|
self.lst_record.itemRenderer = function(index, obj)
|
|
self:OnRenderRecordItem(index, obj)
|
|
end
|
|
self.lst_record.scrollPane.onPullUpRelease:Set(function()
|
|
self:GetRecordData(self.lst_record.numItems)
|
|
end)
|
|
|
|
self.time_panel = TimeSettingPanel.new(self._view, self._view:GetChild("btn_date1"), self._view:GetChild("btn_date2"), -308, 0, nil, true)
|
|
|
|
local ctr_page = self._view:GetController("type")
|
|
ctr_page.onChanged:Set(function()
|
|
self.record_data = {}
|
|
self.lst_record.numItems = 0
|
|
if ctr_page.selectedIndex == 0 then
|
|
local now_time = os.date("*t",now)
|
|
local today = os.time({year=now_time.year, month=now_time.month, day=now_time.day, hour=0,min=0,sec=0})
|
|
self.begin_time = today
|
|
self.end_time = today + 86400
|
|
else
|
|
local now_time = os.date("*t",now)
|
|
local today = os.time({year=now_time.year, month=now_time.month, day=now_time.day, hour=0,min=0,sec=0})
|
|
self.begin_time = today - 86400 * ctr_page.selectedIndex
|
|
self.end_time = today - 86400 * (ctr_page.selectedIndex - 1)
|
|
end
|
|
self:GetRecordData(0)
|
|
end)
|
|
|
|
self._view:GetChild("btn_search").onClick:Set(function()
|
|
self.record_data = {}
|
|
self.lst_record.numItems = 0
|
|
|
|
self.begin_time, self.end_time = self.time_panel:GetDate()
|
|
self:GetRecordData(0)
|
|
end)
|
|
|
|
self.totalwin = self._view:GetChild("tex_alltotal")
|
|
|
|
end
|
|
|
|
|
|
function M:GetRecordData(index)
|
|
|
|
ViewUtil.ShowModalWait()
|
|
|
|
local time_type = self._view:GetController("type").selectedIndex
|
|
if self.begin_time ~= nil and self.end_time ~= nil then
|
|
time_type = 0
|
|
end
|
|
|
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
|
fgCtr:FG_GetXingYunStat(self.group_id, index, 6, time_type,self.begin_time,self.end_time,function(res)
|
|
|
|
ViewUtil.CloseModalWait()
|
|
|
|
if res.ReturnCode == 0 then
|
|
|
|
local members = res.Data.members
|
|
|
|
self.totalwin.text = d2ad(res.Data.all_total_win)
|
|
for i = 1, #members do
|
|
self.record_data[#self.record_data + 1] = members[i]
|
|
end
|
|
self.lst_record.numItems = #self.record_data
|
|
end
|
|
end)
|
|
end
|
|
|
|
|
|
function M:FillRecordItem(data, obj)
|
|
|
|
local group = DataManager.groups:get(self.group_id)
|
|
|
|
obj:GetChild("tex_name").text = ViewUtil.stringEllipsis(data.nick)
|
|
obj:GetChild("tex_id").text = "ID:" .. data.uid
|
|
obj:GetChild("tex_round_total").text = data.total_round
|
|
obj:GetChild("tex_total").text = d2ad(data.total_win)
|
|
obj:GetChild("tex_round_youxiao").text = data.valid_round / 100
|
|
|
|
end
|
|
|
|
function M:OnRenderRecordItem(index, obj)
|
|
local data = self.record_data[index + 1]
|
|
self:FillRecordItem(data, obj)
|
|
end
|
|
|
|
|
|
return M |