2020-07-10 22:33:30 +08:00
|
|
|
|
---@type IDBasePanel
|
|
|
|
|
|
local TRBasePanel = require("ui.panel.TRBasePanel")
|
2020-08-01 17:55:18 +08:00
|
|
|
|
---@class TRPNewFollowTask:TRBasePanel
|
2020-07-18 21:12:14 +08:00
|
|
|
|
local TRPNewFollowTask = class("TRPNewFollowTask", TRBasePanel)
|
2020-07-10 22:33:30 +08:00
|
|
|
|
|
|
|
|
|
|
local uiobjs = {}
|
|
|
|
|
|
|
|
|
|
|
|
local stars = {}
|
|
|
|
|
|
-- 初始化,只会调用一次
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:init(csObj)
|
|
|
|
|
|
TRPNewFollowTask.super.init(self, csObj)
|
2020-07-10 22:33:30 +08:00
|
|
|
|
self:initFiledsAttr()
|
|
|
|
|
|
self:setEventDelegate()
|
2020-08-06 22:56:33 +08:00
|
|
|
|
MyUtl.setContentView(getChild(self.transform, "PanelContent"), MyUtl.defaultTopHeight, 190)
|
2020-07-10 22:33:30 +08:00
|
|
|
|
---@type UIScrollView
|
|
|
|
|
|
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
|
2020-08-01 17:55:18 +08:00
|
|
|
|
uiobjs.scrollView.dampenStrength = MyUtl.dampenStrength
|
2020-07-10 22:33:30 +08:00
|
|
|
|
---@type UITable
|
|
|
|
|
|
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
|
|
|
|
|
|
---@type CLUIFormRoot
|
|
|
|
|
|
uiobjs.DetailFromRoot = getCC(uiobjs.Table.transform, "DetailRoot", "CLUIFormRoot")
|
|
|
|
|
|
uiobjs.DetailRoot = getCC(uiobjs.Table.transform, "DetailRoot", "CLCellLua")
|
|
|
|
|
|
---@type UITable
|
|
|
|
|
|
uiobjs.DetailRootTabel = uiobjs.DetailRoot:GetComponent("UITable")
|
|
|
|
|
|
|
|
|
|
|
|
uiobjs.ButtonSave = getChild(self.transform, "Top/ButtonSave")
|
2020-08-06 22:56:33 +08:00
|
|
|
|
uiobjs.ButtonCustDetail = getChild(self.transform, "ButtonCustDetail")
|
2020-08-07 22:40:04 +08:00
|
|
|
|
uiobjs.ButtonNewFollow = getChild(self.transform, "ButtonNewFollow")
|
2020-07-10 22:33:30 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:initFiledsAttr()
|
2020-07-10 22:33:30 +08:00
|
|
|
|
---@type _ParamFieldAttr
|
|
|
|
|
|
local attr
|
|
|
|
|
|
self.baseFiledsAttr = {}
|
|
|
|
|
|
attr = {}
|
2020-07-20 22:20:21 +08:00
|
|
|
|
attr.attrName = "预约内容"
|
2020-07-18 21:12:14 +08:00
|
|
|
|
attr.id = "bookingNote"
|
|
|
|
|
|
attr.attrType = DBCust.FieldType.multext
|
|
|
|
|
|
attr.ifMust = 1
|
2020-07-10 22:33:30 +08:00
|
|
|
|
attr.donotJoinKey = true
|
|
|
|
|
|
table.insert(self.baseFiledsAttr, attr)
|
|
|
|
|
|
|
|
|
|
|
|
attr = {}
|
2020-07-20 22:20:21 +08:00
|
|
|
|
attr.attrName = "预约时间"
|
2020-08-01 17:55:18 +08:00
|
|
|
|
attr.id = "bookingTime"
|
2020-07-18 21:12:14 +08:00
|
|
|
|
attr.attrType = DBCust.FieldType.dateTime
|
|
|
|
|
|
attr.ifTime = 1
|
2020-07-10 22:33:30 +08:00
|
|
|
|
attr.ifMust = 1
|
|
|
|
|
|
attr.donotJoinKey = true
|
|
|
|
|
|
table.insert(self.baseFiledsAttr, attr)
|
|
|
|
|
|
|
|
|
|
|
|
attr = {}
|
2020-07-18 21:12:14 +08:00
|
|
|
|
attr.attrName = "跟进人员"
|
|
|
|
|
|
attr.id = "loginNo"
|
|
|
|
|
|
attr.attrType = DBCust.FieldType.popuplist
|
2020-07-10 22:33:30 +08:00
|
|
|
|
attr.ifMust = 1
|
|
|
|
|
|
attr.donotJoinKey = true
|
2020-07-18 21:12:14 +08:00
|
|
|
|
local popList = DBCust.getFilter4Popup(DBCust.FilterGroup.loginNoList)
|
|
|
|
|
|
attr.popOptions = popList.options
|
|
|
|
|
|
attr.popValues = popList.values
|
2020-07-10 22:33:30 +08:00
|
|
|
|
table.insert(self.baseFiledsAttr, attr)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 设置数据
|
2020-07-18 21:12:14 +08:00
|
|
|
|
---@param paras _ParamTRPNewFollowTask
|
|
|
|
|
|
function TRPNewFollowTask:setData(paras)
|
2020-08-03 23:05:29 +08:00
|
|
|
|
if paras and paras.bookingNote then
|
2020-08-01 17:55:18 +08:00
|
|
|
|
self.mdata = paras
|
|
|
|
|
|
self.isNewFollow = false
|
|
|
|
|
|
else
|
|
|
|
|
|
self.mdata = {}
|
|
|
|
|
|
self.mdata.custId = paras.custId
|
|
|
|
|
|
self.mdata.taskId = paras.taskId
|
|
|
|
|
|
self.mdata.loginNo = NetProto.loginNo
|
|
|
|
|
|
|
|
|
|
|
|
self.mdata.bookingTime = DateEx.nowString()
|
2020-07-10 22:33:30 +08:00
|
|
|
|
|
2020-08-01 17:55:18 +08:00
|
|
|
|
self.isNewFollow = true
|
|
|
|
|
|
end
|
2020-07-10 22:33:30 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
2020-08-03 23:05:29 +08:00
|
|
|
|
---public 当有通用背板显示时的回调
|
|
|
|
|
|
---@param cs Coolape.CLPanelLua
|
|
|
|
|
|
function TRPNewFollowTask:onShowFrame(cs)
|
|
|
|
|
|
if cs.frameObj then
|
|
|
|
|
|
---@type _BGFrame1Param
|
|
|
|
|
|
local d = {}
|
|
|
|
|
|
-- d.title = LGet(cs.titleKeyName)
|
|
|
|
|
|
if self.isNewFollow then
|
|
|
|
|
|
d.title = "新建预约"
|
|
|
|
|
|
else
|
|
|
|
|
|
d.title = "预约详情"
|
|
|
|
|
|
end
|
|
|
|
|
|
d.panel = cs
|
|
|
|
|
|
cs.frameObj:init(d)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-10 22:33:30 +08:00
|
|
|
|
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:show()
|
2020-08-06 22:56:33 +08:00
|
|
|
|
if self.isNewFollow then
|
|
|
|
|
|
SetActive(uiobjs.ButtonCustDetail.gameObject, false)
|
2020-08-07 22:40:04 +08:00
|
|
|
|
SetActive(uiobjs.ButtonNewFollow.gameObject, false)
|
2020-08-06 22:56:33 +08:00
|
|
|
|
else
|
|
|
|
|
|
---@type Coolape.CLPanelLua
|
|
|
|
|
|
local panel = CLPanelManager.getPanel("PanelCustDetail")
|
|
|
|
|
|
if panel and panel.gameObject.activeInHierarchy then
|
|
|
|
|
|
SetActive(uiobjs.ButtonCustDetail.gameObject, false)
|
2020-08-07 22:40:04 +08:00
|
|
|
|
SetActive(uiobjs.ButtonNewFollow.gameObject, false)
|
2020-08-06 22:56:33 +08:00
|
|
|
|
else
|
|
|
|
|
|
SetActive(uiobjs.ButtonCustDetail.gameObject, true)
|
2020-08-07 22:40:04 +08:00
|
|
|
|
SetActive(uiobjs.ButtonNewFollow.gameObject, true)
|
2020-08-06 22:56:33 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-10 22:33:30 +08:00
|
|
|
|
self:refreshContent()
|
|
|
|
|
|
SetActive(uiobjs.ButtonSave.gameObject, self.isNewFollow)
|
|
|
|
|
|
|
|
|
|
|
|
uiobjs.scrollView:ResetPosition()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:refreshContent()
|
2020-07-10 22:33:30 +08:00
|
|
|
|
self:showBaseFields()
|
|
|
|
|
|
self.csSelf:invoke4Lua(self:wrapFunc(self.reposition), 0.1)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:showBaseFields()
|
2020-07-10 22:33:30 +08:00
|
|
|
|
---@type _ParamCellExtendFiledRoot
|
|
|
|
|
|
local param = {}
|
|
|
|
|
|
param.data = self.mdata or {}
|
|
|
|
|
|
param.onFinish = self:wrapFunc(self.setExtendFieldsMode)
|
|
|
|
|
|
param.fields = {}
|
|
|
|
|
|
---@type _ParamCellExtendFiled
|
|
|
|
|
|
local filedInfor
|
|
|
|
|
|
|
|
|
|
|
|
for i, v in ipairs(self.baseFiledsAttr) do
|
|
|
|
|
|
-- 工单模板
|
|
|
|
|
|
filedInfor = {}
|
|
|
|
|
|
filedInfor.attr = v
|
2020-08-01 17:55:18 +08:00
|
|
|
|
if self.isNewFollow then
|
|
|
|
|
|
filedInfor.showMode = _FieldMode.inputOnly
|
|
|
|
|
|
else
|
|
|
|
|
|
filedInfor.showMode = _FieldMode.showOnly
|
|
|
|
|
|
end
|
2020-07-10 22:33:30 +08:00
|
|
|
|
if filedInfor.attr.attrType == DBCust.FieldType.multext then
|
|
|
|
|
|
filedInfor.onMultTextInputChg = self:wrapFunc(self.reposition)
|
|
|
|
|
|
end
|
|
|
|
|
|
filedInfor.onClick = nil
|
|
|
|
|
|
filedInfor.onSelect = self:wrapFunc(self.onPopupFieldValChg)
|
|
|
|
|
|
table.insert(param.fields, filedInfor)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
uiobjs.DetailRoot:init(param, nil)
|
|
|
|
|
|
end
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:onPopupFieldValChg(go)
|
2020-07-10 22:33:30 +08:00
|
|
|
|
---@type CLUIElement
|
|
|
|
|
|
local el = go:GetComponent("CLUIElement")
|
|
|
|
|
|
if el.jsonKey == "dealFlag" then
|
|
|
|
|
|
if uiobjs.followUpContent and isNilOrEmpty(uiobjs.followUpContent.value) then
|
|
|
|
|
|
local popList = go:GetComponent("UIPopupList")
|
|
|
|
|
|
uiobjs.followUpContent.value = popList.selectedItem
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:reposition()
|
2020-07-10 22:33:30 +08:00
|
|
|
|
uiobjs.DetailRootTabel.repositionNow = true
|
|
|
|
|
|
uiobjs.Table.repositionNow = true
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:setExtendFieldsMode(root)
|
2020-07-10 22:33:30 +08:00
|
|
|
|
local elements = root:GetComponentsInChildren(typeof(CLUIElement), true)
|
|
|
|
|
|
for i = 0, elements.Length - 1 do
|
2020-08-01 17:55:18 +08:00
|
|
|
|
-- self:setElementMode(elements[i])
|
2020-07-10 22:33:30 +08:00
|
|
|
|
if elements[i].jsonKey == "followUpContent" then
|
|
|
|
|
|
---@type CLUIElement
|
|
|
|
|
|
uiobjs.followUpContent = elements[i]
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
self:reposition()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:setElementMode(el)
|
2020-07-10 22:33:30 +08:00
|
|
|
|
local isPopList = el:GetComponent("UIPopupList")
|
|
|
|
|
|
local isPopCheckbox = el:GetComponent("CLUICheckbox")
|
|
|
|
|
|
---@type UIInput
|
|
|
|
|
|
local input = el:GetComponent("UIInput")
|
|
|
|
|
|
local inputOnGUI = el:GetComponent("UIInputOnGUI")
|
|
|
|
|
|
local boxcollider = el:GetComponent("BoxCollider")
|
|
|
|
|
|
local ButtonReset = getCC(el.transform, "ButtonReset", "MyInputReset")
|
|
|
|
|
|
|
|
|
|
|
|
if (not self.isNewFollow) and (el.jsonKey == "taskId" or el.jsonKey == "phoneNo") then
|
|
|
|
|
|
boxcollider.enabled = false
|
|
|
|
|
|
else
|
|
|
|
|
|
boxcollider.enabled = true
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if ButtonReset then
|
|
|
|
|
|
ButtonReset.disabled = (not self.isNewFollow)
|
|
|
|
|
|
end
|
|
|
|
|
|
if input then
|
|
|
|
|
|
if isPopList or isPopCheckbox then
|
|
|
|
|
|
input.enabled = false
|
|
|
|
|
|
if inputOnGUI then
|
|
|
|
|
|
inputOnGUI.enabled = false
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
if self.isNewFollow then
|
|
|
|
|
|
input.enabled = true
|
|
|
|
|
|
if inputOnGUI then
|
|
|
|
|
|
inputOnGUI.enabled = true
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
input.enabled = false
|
|
|
|
|
|
if inputOnGUI then
|
|
|
|
|
|
inputOnGUI.enabled = false
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 刷新
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:refresh()
|
2020-07-10 22:33:30 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 关闭页面
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:hide()
|
2020-07-10 22:33:30 +08:00
|
|
|
|
if uiobjs.DetailRoot.luaTable then
|
|
|
|
|
|
uiobjs.DetailRoot.luaTable.release()
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:procNetwork(cmd, succ, msg, paras)
|
2020-07-10 22:33:30 +08:00
|
|
|
|
if (succ == NetSuccess) then
|
|
|
|
|
|
if cmd == NetProto.cmds.update_customer then
|
|
|
|
|
|
self:refreshContent()
|
2020-08-07 22:40:04 +08:00
|
|
|
|
elseif cmd == NetProto.cmds.create_followUp_record then
|
|
|
|
|
|
self:refreshContent()
|
2020-07-10 22:33:30 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:setEventDelegate()
|
2020-07-10 22:33:30 +08:00
|
|
|
|
self.EventDelegate = {
|
|
|
|
|
|
ButtonSave = function()
|
|
|
|
|
|
local err = uiobjs.DetailFromRoot:checkValid()
|
|
|
|
|
|
if not isNilOrEmpty(err) then
|
|
|
|
|
|
MyUtl.toastW(err)
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
self.mdata = uiobjs.DetailFromRoot:getValue(self.mdata, true)
|
2020-08-07 22:40:04 +08:00
|
|
|
|
-- 时间处理
|
|
|
|
|
|
local setDt = DateTime.Parse( self.mdata.bookingTime)
|
|
|
|
|
|
if setDt:ToFileTime() < DateTime.Now:ToFileTime() then
|
|
|
|
|
|
MyUtl.toastW("预约时间已过,请选择未来的预约时间")
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
2020-07-10 22:33:30 +08:00
|
|
|
|
showHotWheel()
|
2020-08-01 17:55:18 +08:00
|
|
|
|
NetProto.send.create_followUp_task(
|
|
|
|
|
|
self.mdata,
|
|
|
|
|
|
function(content)
|
|
|
|
|
|
hideHotWheel()
|
|
|
|
|
|
if content.success then
|
|
|
|
|
|
MyUtl.toastS("创建成功")
|
|
|
|
|
|
hideTopPanel(self.csSelf)
|
|
|
|
|
|
end
|
2020-07-10 22:33:30 +08:00
|
|
|
|
end
|
2020-08-01 17:55:18 +08:00
|
|
|
|
)
|
2020-08-06 22:56:33 +08:00
|
|
|
|
end,
|
|
|
|
|
|
ButtonCustDetail = function()
|
|
|
|
|
|
showHotWheel()
|
|
|
|
|
|
NetProto.send.get_customerById(
|
|
|
|
|
|
self.mdata.custId,
|
|
|
|
|
|
function(content)
|
|
|
|
|
|
hideHotWheel()
|
|
|
|
|
|
if content.success then
|
|
|
|
|
|
local cust = content.result
|
|
|
|
|
|
if cust then
|
2020-08-07 22:40:04 +08:00
|
|
|
|
---@type _ParamTRPCustDetail
|
|
|
|
|
|
local param = {}
|
|
|
|
|
|
param.cust = cust
|
|
|
|
|
|
param.bookingData = self.mdata
|
|
|
|
|
|
param.needShowMore = false
|
2020-08-06 22:56:33 +08:00
|
|
|
|
getPanelAsy(
|
2020-08-07 22:40:04 +08:00
|
|
|
|
"PanelCustDetail",
|
|
|
|
|
|
onLoadedPanelTF,
|
|
|
|
|
|
param
|
2020-08-06 22:56:33 +08:00
|
|
|
|
)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
)
|
2020-08-07 22:40:04 +08:00
|
|
|
|
end,
|
|
|
|
|
|
ButtonNewFollow = function()
|
|
|
|
|
|
---@type _ParamTRPNewFollow
|
|
|
|
|
|
local param = {}
|
|
|
|
|
|
param.cust = self.mdata
|
|
|
|
|
|
param.bookingData = self.mdata
|
|
|
|
|
|
getPanelAsy("PanelNewFollow", onLoadedPanelTT, param)
|
2020-07-10 22:33:30 +08:00
|
|
|
|
end
|
|
|
|
|
|
}
|
|
|
|
|
|
end
|
|
|
|
|
|
-- 处理ui上的事件,例如点击等
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:uiEventDelegate(go)
|
2020-07-10 22:33:30 +08:00
|
|
|
|
local func = self.EventDelegate[go.name]
|
|
|
|
|
|
if func then
|
|
|
|
|
|
func()
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 当顶层页面发生变化时回调
|
2020-07-18 21:12:14 +08:00
|
|
|
|
function TRPNewFollowTask:onTopPanelChange(topPanel)
|
2020-07-10 22:33:30 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------
|
2020-07-18 21:12:14 +08:00
|
|
|
|
return TRPNewFollowTask
|