--牌友圈转让View local GroupRemitView = {} local GroupNumberInputView = import(".MngView.GroupNumberInputView") local M = GroupRemitView function GroupRemitView.new(blur_view, curGroup) setmetatable(M, { __index = BaseWindow }) local self = setmetatable({}, { __index = M }) self.class = "GroupRemitView" self._close_destroy = true self._blur_view = blur_view self.curGroup = curGroup self:init("ui://NewGroup/Win_Remit") self:FillView() return self end function M:FillView() local fgCtr = ControllerManager.GetController(NewGroupController) self._ctr_result = self._view:GetController("result") local remite_id, remite_num local btn_id = self._view:GetChild("btn_id") btn_id.onClick:Set(function() local gfv = GroupNumberInputView.new(self._root_view, function(num) remite_id = num btn_id.title = num self._ctr_result.selectedIndex = 0 end) gfv:Show() end) local btn_num = self._view:GetChild("btn_num") btn_num.onClick:Set(function() local gfv = GroupNumberInputView.new(self._root_view, function(num) remite_num = num btn_num.title = num end) gfv:Show() end) local btn_search = self._view:GetChild("btn_search") btn_search.onClick:Set(function() self._ctr_result.selectedIndex = 0 if not remite_id then ViewUtil.ErrorTip(nil, "请输入玩家ID") return end ViewUtil.ShowModalWait2(nil) fgCtr:FG_RemitFindMember(self.curGroup.id, remite_id, function(res) ViewUtil.CloseModalWait2() if self._is_destroy then return end if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode, "查询玩家失败") return else if not res.Data.uid then ViewUtil.ErrorTip(nil, "查询玩家失败") return end self._ctr_result.selectedIndex = 1 self._view:GetChild("tex_id").text = res.Data.uid self._view:GetChild("tex_name").text = res.Data.nick if res.Data.portrait then ImageLoad.Load(res.Data.portrait, self._view:GetChild("btn_head")._iconObject) end end end) end) local btn_ok = self._view:GetChild("btn_ok") btn_ok.onClick:Set(function() local msgbox = MsgWindow.new(self._root_view, "确定要转让积分吗?", MsgWindow.MsgMode.OkAndCancel) msgbox.onOk:Add(function(...) if not remite_id then ViewUtil.ErrorTip(nil, "请输入玩家ID") return end if self._ctr_result.selectedIndex == 0 then ViewUtil.ErrorTip(nil, "请先搜索玩家") return end if not remite_num then ViewUtil.ErrorTip(nil, "请输入转让数量") return end ViewUtil.ShowModalWait2(nil) fgCtr:FG_FagRemit(self.curGroup.id, remite_id, ad2d(remite_num), function(res) ViewUtil.CloseModalWait2() if self._is_destroy then return end if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode, "转让失败") return else local msgbox2 = MsgWindow.new(self._root_view, "转让积分成功", MsgWindow.MsgMode.OnlyOk) msgbox2:Show() end end) end) msgbox:Show() end) end function M:SetCallback(callback) self.callback = callback end -- 销毁窗口 function M:Destroy(remove_map) if self.change and self.callback then self.callback() end BaseWindow.Destroy(self, remove_map) end return M