This commit is contained in:
2020-07-20 22:20:21 +08:00
parent 3429ffd1b1
commit 7dc1332dba
39 changed files with 3116 additions and 759 deletions

View File

@@ -8,6 +8,7 @@ local uiobjs = {}
function TRPCustDetail:init(csObj)
TRPCustDetail.super.init(self, csObj)
self:prepareMoreData()
self:setEventDelegate()
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132 + 400 + 160 + 60, 200)
@@ -27,8 +28,12 @@ function TRPCustDetail:init(csObj)
uiobjs.starGrid = getCC(uiobjs.Head.transform, "LabelStars/Grid", "UIGrid")
uiobjs.starGridPrefab = getChild(uiobjs.starGrid.transform, "00000").gameObject
---@type UIGrid
uiobjs.SpriteToggle = getCC(self.transform, "Top/SpriteToggle", "UIGrid")
local width = NumEx.getIntPart(CSPMain.contentRect.z / 4)
uiobjs.SpriteToggle.cellWidth = width
---@type UIToggle
uiobjs.ToggleDetail = getCC(self.transform, "Top/SpriteToggle/ToggleDetail", "UIToggle")
uiobjs.ToggleDetail = getCC(uiobjs.SpriteToggle.transform, "ToggleDetail", "UIToggle")
---@type CLUIFormRoot
uiobjs.DetailRoot = getCC(uiobjs.Table.transform, "DetailRoot", "CLUIFormRoot")
uiobjs.InputTask = getCC(uiobjs.DetailRoot.transform, "InputTask", "UIPopupList")
@@ -44,6 +49,51 @@ function TRPCustDetail:init(csObj)
uiobjs.ButtonEndList = getChild(uiobjs.Records.transform, "ButtonEndList")
uiobjs.ExtendRoot = getCC(uiobjs.Table.transform, "ExtendRoot", "CLCellLua")
---@type Coolape.CLUILoopGrid
uiobjs.OrderRoot = getCC(uiobjs.Table.transform, "OrderRoot", "CLUILoopGrid")
uiobjs.ButtonEndListOrder = getChild(uiobjs.OrderRoot.transform, "ButtonEndList")
uiobjs.MoreRoot = getCC(uiobjs.Table.transform, "MoreRoot", "CLCellLua")
end
function TRPCustDetail:prepareMoreData()
self.moreProcList = {}
---@type _ParamFieldAttr
local attr = {}
attr.id = "follows"
attr.attrName = "跟进记录"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.height = 180
attr.donotJoinKey = true
table.insert(self.moreProcList, attr)
attr = {}
attr.id = "followTasks"
attr.attrName = "预约记录"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.height = 180
attr.donotJoinKey = true
table.insert(self.moreProcList, attr)
attr = {}
attr.id = "smsList"
attr.attrName = "短信记录"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.height = 180
attr.donotJoinKey = true
table.insert(self.moreProcList, attr)
attr = {}
attr.id = "opList"
attr.attrName = "操作记录"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.height = 180
attr.donotJoinKey = true
table.insert(self.moreProcList, attr)
end
-- 设置数据
@@ -72,6 +122,7 @@ end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPCustDetail:show()
self.records = nil
self.orders = nil
local optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.dealFlagList)
uiobjs.LabelStatus:refreshItems(optionInfor.options, optionInfor.values)
uiobjs.InputStatus:refreshItems(optionInfor.options, optionInfor.values)
@@ -109,9 +160,12 @@ function TRPCustDetail:initStarCell(cell, data)
end
function TRPCustDetail:showDetail()
self:release()
SetActive(uiobjs.DetailRoot.gameObject, true)
SetActive(uiobjs.ExtendRoot.gameObject, true)
SetActive(uiobjs.OrderRoot.gameObject, false)
SetActive(uiobjs.Records.gameObject, false)
SetActive(uiobjs.MoreRoot.gameObject, false)
uiobjs.DetailRoot:setValue(self.mdata)
-- uiobjs.ExtendRoot:init({data = self.mdata, isEditMode = false}, nil)
@@ -126,6 +180,7 @@ function TRPCustDetail:showDetail()
CLUIUtl.resetList4Lua(uiobjs.starGrid2, uiobjs.starGridPrefab2, stars, self:wrapFunc(self.initStarCell))
uiobjs.Table:Reposition()
uiobjs.scrollView.disableDragIfFits = true
uiobjs.scrollView:ResetPosition()
end
@@ -149,9 +204,12 @@ function TRPCustDetail:showExtentFiles(taskId)
end
function TRPCustDetail:showRecords()
self:release()
SetActive(uiobjs.DetailRoot.gameObject, false)
SetActive(uiobjs.ExtendRoot.gameObject, false)
SetActive(uiobjs.OrderRoot.gameObject, false)
SetActive(uiobjs.Records.gameObject, true)
SetActive(uiobjs.MoreRoot.gameObject, false)
if self.records then
uiobjs.Records:setList(
self.records.data or {},
@@ -166,6 +224,7 @@ function TRPCustDetail:showRecords()
end
uiobjs.Table:Reposition()
uiobjs.scrollView.disableDragIfFits = false
uiobjs.scrollView:ResetPosition()
end
@@ -189,15 +248,115 @@ function TRPCustDetail:onEndList(tail)
end
end
function TRPCustDetail:showOrders()
self:release()
SetActive(uiobjs.DetailRoot.gameObject, false)
SetActive(uiobjs.ExtendRoot.gameObject, false)
SetActive(uiobjs.Records.gameObject, false)
SetActive(uiobjs.OrderRoot.gameObject, true)
SetActive(uiobjs.MoreRoot.gameObject, false)
if self.orders then
uiobjs.OrderRoot:setList(
self.orders.data or {},
self:wrapFunc(self.initOrderCell),
self:wrapFunc(self.onOrderHeadList),
self:wrapFunc(self.onOrderEndList)
)
else
showHotWheel()
-- //TODO:
NetProto.send.query_cust_calllog(self.mdata.phoneNo, nil, 1)
uiobjs.OrderRoot:setList({}, self:wrapFunc(self.initOrderCell))
end
uiobjs.Table:Reposition()
uiobjs.scrollView.disableDragIfFits = false
uiobjs.scrollView:ResetPosition()
end
function TRPCustDetail:initOrderCell(cell, data)
cell:init(data, nil)
end
function TRPCustDetail:onOrderHeadList(head)
printw("到最顶端了")
end
function TRPCustDetail:onOrderEndList(tail)
printw("到最后了==" .. tail.name)
if self.orders and self.orders.meta.current_page < self.orders.meta.total_pages then
showHotWheel()
-- //TODO:取得下一页
NetProto.send.query_cust_calllog(self.mdata.phoneNo, nil, self.orders.meta.current_page + 1)
else
uiobjs.ButtonEndListOrder.localPosition = tail.transform.localPosition + Vector3.up * -270
SetActive(uiobjs.ButtonEndListOrder.gameObject, true)
end
end
function TRPCustDetail:showMore()
self:release()
SetActive(uiobjs.DetailRoot.gameObject, false)
SetActive(uiobjs.ExtendRoot.gameObject, false)
SetActive(uiobjs.Records.gameObject, false)
SetActive(uiobjs.OrderRoot.gameObject, false)
SetActive(uiobjs.MoreRoot.gameObject, true)
if not self.hasSetMoreProc then
self.hasSetMoreProc = true
---@type _ParamCellExtendFiledRoot
local param = {}
param.data = nil
param.onFinish = function()
uiobjs.scrollView:ResetPosition()
end
param.fields = {}
---@type _ParamCellExtendFiled
local filedInfor
for i, v in ipairs(self.moreProcList) do
filedInfor = {}
filedInfor.attr = v
filedInfor.showMode = _FieldMode.button
filedInfor.onClick = self:wrapFunc(self.onClickMoreProc)
table.insert(param.fields, filedInfor)
end
uiobjs.MoreRoot:init(param, nil)
end
uiobjs.Table:Reposition()
uiobjs.scrollView.disableDragIfFits = true
uiobjs.scrollView:ResetPosition()
end
---@param el CLUIElement
function TRPCustDetail:onClickMoreProc(el)
if el.jsonKey == "follows" then
-- 跟进记录
elseif el.jsonKey == "followTasks" then
-- 预约记录
elseif el.jsonKey == "smsList" then
-- 短信记录
elseif el.jsonKey == "opList" then
-- 操作记录
end
end
-- 刷新
function TRPCustDetail:refresh()
end
-- 关闭页面
function TRPCustDetail:hide()
function TRPCustDetail:release()
if uiobjs.ExtendRoot.luaTable then
uiobjs.ExtendRoot.luaTable.release()
end
if uiobjs.MoreRoot.luaTable then
uiobjs.MoreRoot.luaTable.release()
end
self.hasSetMoreProc = false
end
-- 关闭页面
function TRPCustDetail:hide()
self:release()
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
@@ -243,6 +402,14 @@ function TRPCustDetail:setEventDelegate()
self.currToggle = 2
self:showRecords()
end,
ToggleOrders = function()
self.currToggle = 3
self:showOrders()
end,
ToggleMore = function()
self.currToggle = 4
self:showMore()
end,
ButtonNewFollow = function()
getPanelAsy("PanelNewFollow", onLoadedPanelTT, self.mdata)
end,