204 lines
6.9 KiB
Lua
204 lines
6.9 KiB
Lua
|
|
local TimeSettingPanel = import(".TimeSettingPanel")
|
||
|
|
local GroupPartnerZuanShiMember = import(".GroupPartnerZuanShiMember")
|
||
|
|
|
||
|
|
|
||
|
|
-- 开桌统计
|
||
|
|
local GroupMngZuanShiStatView = {}
|
||
|
|
|
||
|
|
local M = GroupMngZuanShiStatView
|
||
|
|
|
||
|
|
function GroupMngZuanShiStatView.new(gid)
|
||
|
|
local self = M
|
||
|
|
self.class = "GroupMngZuanShiStatView"
|
||
|
|
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_GroupZuanShi")
|
||
|
|
|
||
|
|
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")
|
||
|
|
-- lst_mgr_index.visible = false
|
||
|
|
-- if group.lev == 1 then
|
||
|
|
-- lst_mgr_index.visible = true
|
||
|
|
-- end
|
||
|
|
|
||
|
|
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)
|
||
|
|
|
||
|
|
|
||
|
|
-- 搜索玩家
|
||
|
|
local ctr_search = self._view:GetController('search')
|
||
|
|
self._view:GetChild('btn_search').onClick:Set(
|
||
|
|
function()
|
||
|
|
--printlog("aaaaaaaaaa1111111111111111111111111111111111111111111111")
|
||
|
|
ViewUtil.ShowModalWait(nil)
|
||
|
|
local text = self._view:GetChild('tex_id').text
|
||
|
|
local qid, qnick
|
||
|
|
if text == "" then
|
||
|
|
ViewUtil.CloseModalWait()
|
||
|
|
ViewUtil.ErrorTip(nil, '输入不能为空')
|
||
|
|
return
|
||
|
|
end
|
||
|
|
qid = tonumber(text) or 0
|
||
|
|
qnick = text
|
||
|
|
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_FindZuanShiStat(
|
||
|
|
self.group_id,
|
||
|
|
qid,0, 6, time_type,self.begin_time,self.end_time,
|
||
|
|
function(res)
|
||
|
|
-- printlog("aaaaaaaaaaaaaaaa22222222222222222222222222222")
|
||
|
|
-- pt(res)
|
||
|
|
ViewUtil.CloseModalWait()
|
||
|
|
if self._is_destroy then
|
||
|
|
return
|
||
|
|
end
|
||
|
|
if res.ReturnCode ~= 0 then
|
||
|
|
ViewUtil.ErrorTip(res.ReturnCode, '找不到成员')
|
||
|
|
else
|
||
|
|
self._view:GetChild('tex_id').text = ''
|
||
|
|
ctr_search.selectedIndex = 1
|
||
|
|
local item_result = self._view:GetChild('lst_member_find')
|
||
|
|
item_result:RemoveChildrenToPool()
|
||
|
|
|
||
|
|
for j = 1, #res.Data.members do
|
||
|
|
local tem = item_result:AddItemFromPool()
|
||
|
|
self:FillRecordItem(res.Data.members[j],tem)
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
)
|
||
|
|
end
|
||
|
|
)
|
||
|
|
|
||
|
|
local btn_back = self._view:GetChild('btn_back')
|
||
|
|
btn_back.onClick:Set(
|
||
|
|
function()
|
||
|
|
self.lst_record.numItems = #self.record_data
|
||
|
|
end
|
||
|
|
)
|
||
|
|
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_GetZuanShiStat(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
|
||
|
|
--printlog("aaaaaaaaaaaaaacccccccccccccccccccccccccccccccc")
|
||
|
|
--pt(res)
|
||
|
|
for i = 1, #members do
|
||
|
|
self.record_data[#self.record_data + 1] = members[i]
|
||
|
|
end
|
||
|
|
self.lst_record.numItems = #self.record_data
|
||
|
|
local single_total_count = self._view:GetChild("single_total_count")
|
||
|
|
single_total_count.text = res.Data.all_single_diamo_cost / 100
|
||
|
|
local other_total_count = self._view:GetChild("other_total_count")
|
||
|
|
other_total_count.text = res.Data.all_other_diamo_cost / 100
|
||
|
|
end
|
||
|
|
end)
|
||
|
|
end
|
||
|
|
|
||
|
|
-- 显示奖励
|
||
|
|
local function __showRewardsValue(rtype, cur_value, max_value, mng)
|
||
|
|
local str = ""
|
||
|
|
if not mng then
|
||
|
|
str = string.format("%s%%/%s%%", cur_value, max_value)
|
||
|
|
else
|
||
|
|
str = string.format("%s%%", cur_value)
|
||
|
|
end
|
||
|
|
return str
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:FillRecordItem(data, obj)
|
||
|
|
|
||
|
|
local group = DataManager.groups:get(self.group_id)
|
||
|
|
|
||
|
|
obj:GetChild("tex_name").text = ViewUtil.stringEllipsis(data.nick).."("..data.total..")"
|
||
|
|
obj:GetChild("tex_id").text = "ID:" .. data.uid
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
obj:GetChild("tex_round_valid").text = data.single_diamo_cost / 100
|
||
|
|
obj:GetChild("tex_round_total").text = data.other_diamo_cost / 100
|
||
|
|
obj:GetChild("tex_total").text = data.single_diamo_cost / 100 + data.other_diamo_cost / 100
|
||
|
|
|
||
|
|
local btn_detail = obj:GetChild("btn_detail")
|
||
|
|
btn_detail.onClick:Set(function()
|
||
|
|
local time_type = self._view:GetController("type").selectedIndex
|
||
|
|
--printlog("ccccccccccwwwwwwwwwwwwwwwwwwwwwwwwwwww ",self.begin_time," ",self.end_time)
|
||
|
|
local gniv = GroupPartnerZuanShiMember.new(self.group_id,data.uid, 0,self.begin_time,self.end_time)
|
||
|
|
gniv:Show()
|
||
|
|
end)
|
||
|
|
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:OnRenderRecordItem(index, obj)
|
||
|
|
local data = self.record_data[index + 1]
|
||
|
|
self:FillRecordItem(data, obj)
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
return M
|