2025-05-24 14:29:14 +08:00
|
|
|
-- 开桌统计
|
2025-05-29 02:30:53 +08:00
|
|
|
local TimeSettingPanel = import(".TimeSettingPanelTog")
|
2025-05-24 14:29:14 +08:00
|
|
|
local GroupMngPlayStatView = {}
|
|
|
|
|
|
|
|
|
|
local M = GroupMngPlayStatView
|
|
|
|
|
|
|
|
|
|
function GroupMngPlayStatView.new(gid)
|
|
|
|
|
local self = M
|
|
|
|
|
self.class = "GroupMngPlayStatView"
|
|
|
|
|
self.group_id = gid
|
|
|
|
|
self:InitView()
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:initData()
|
|
|
|
|
self:GetConsumeStatData()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:InitView()
|
|
|
|
|
self._view = UIPackage.CreateObjectFromURL("ui://NewGroup/View_GroupPlayStat")
|
2025-05-29 02:30:53 +08:00
|
|
|
|
2025-07-29 00:37:15 +08:00
|
|
|
local group = DataManager.groups:get(self.group_id)
|
2025-05-29 02:30:53 +08:00
|
|
|
self.consume_stat = {} --消耗统计
|
2025-05-24 14:29:14 +08:00
|
|
|
|
|
|
|
|
self.lst_consume_stat = self._view:GetChild("lst_consume_stat")
|
2025-05-29 02:30:53 +08:00
|
|
|
self.lst_consume_stat:SetVirtual()
|
2025-05-24 14:29:14 +08:00
|
|
|
self.lst_consume_stat.itemRenderer = function(index, obj)
|
2025-05-29 02:30:53 +08:00
|
|
|
self:OnRenderConsumeItem(index, obj)
|
|
|
|
|
end
|
2025-05-24 14:29:14 +08:00
|
|
|
|
|
|
|
|
self._view:GetChild("btn_search").onClick:Set(function()
|
|
|
|
|
self.consume_stat = {}
|
|
|
|
|
self.lst_consume_stat.numItems = 0
|
2025-05-29 02:30:53 +08:00
|
|
|
self:GetConsumeStatData()
|
2025-05-24 14:29:14 +08:00
|
|
|
end)
|
|
|
|
|
|
2025-05-29 02:30:53 +08:00
|
|
|
self.time_panel = TimeSettingPanel.new(self._view, self._view:GetChild("btn_date1"), self._view:GetChild("btn_date2"),
|
|
|
|
|
-308, 0, function()
|
2025-07-29 00:37:15 +08:00
|
|
|
self.consume_stat = {}
|
|
|
|
|
self.lst_consume_stat.numItems = 0
|
|
|
|
|
self:GetConsumeStatData()
|
|
|
|
|
end, { showDay = group.lev < 3 and 30 or 7 })
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
2025-05-29 02:30:53 +08:00
|
|
|
function M:GetConsumeStatData()
|
|
|
|
|
ViewUtil.ShowModalWait()
|
2025-05-24 14:29:14 +08:00
|
|
|
local begin_time, end_time = self.time_panel:GetDate()
|
|
|
|
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
2025-05-29 02:30:53 +08:00
|
|
|
fgCtr:FG_GetConsumeStat(self.group_id, begin_time, end_time, function(res)
|
2025-05-24 14:29:14 +08:00
|
|
|
if self._is_destroy then
|
|
|
|
|
return
|
|
|
|
|
end
|
2025-05-29 02:30:53 +08:00
|
|
|
ViewUtil.CloseModalWait()
|
|
|
|
|
if res.ReturnCode ~= 0 then
|
2025-05-24 14:29:14 +08:00
|
|
|
ViewUtil.ErrorTip(res.ReturnCode, "获取统计数据失败")
|
|
|
|
|
else
|
|
|
|
|
self.consume_stat = res.Data.cosume_logs
|
|
|
|
|
|
|
|
|
|
local top = #self.consume_stat + 1
|
2025-05-29 02:30:53 +08:00
|
|
|
self.consume_stat[top] = { round = 0, valid = 0, no_valid = 0, diamo_cost = 0, pid = 0 }
|
2025-05-24 14:29:14 +08:00
|
|
|
|
2025-05-29 02:30:53 +08:00
|
|
|
for i = 1, #self.consume_stat - 1 do
|
|
|
|
|
self.consume_stat[top].round = (self.consume_stat[top].round + self.consume_stat[i].round)
|
|
|
|
|
self.consume_stat[top].valid = (self.consume_stat[top].valid + self.consume_stat[i].valid)
|
|
|
|
|
self.consume_stat[top].no_valid = (self.consume_stat[top].no_valid + self.consume_stat[i].no_valid)
|
|
|
|
|
self.consume_stat[top].diamo_cost = (self.consume_stat[top].diamo_cost + self.consume_stat[i].diamo_cost)
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
2025-05-29 02:30:53 +08:00
|
|
|
self.lst_consume_stat.numItems = #self.consume_stat
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:OnRenderConsumeItem(index, obj)
|
|
|
|
|
local ci = index + 1
|
2025-05-29 02:30:53 +08:00
|
|
|
local data = self.consume_stat[ci]
|
2025-05-24 14:29:14 +08:00
|
|
|
|
|
|
|
|
local play = DataManager.groups:get(self.group_id):getPlay(data.pid)
|
|
|
|
|
obj:GetChild("title").text = play and play.name or "总计"
|
|
|
|
|
|
|
|
|
|
if ci ~= #self.consume_stat then
|
|
|
|
|
obj:GetController("total").selectedIndex = 0
|
|
|
|
|
else
|
|
|
|
|
obj:GetController("total").selectedIndex = 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
obj:GetChild("tex_round").text = data.round / 100
|
|
|
|
|
obj:GetChild("tex_finish").text = data.valid / 100
|
|
|
|
|
obj:GetChild("tex_unfinish").text = data.no_valid / 100
|
|
|
|
|
obj:GetChild("tex_diamond").text = data.diamo_cost / 100
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-29 02:30:53 +08:00
|
|
|
return M
|