up
This commit is contained in:
@@ -31,8 +31,8 @@ CLLMainLua.init = function()
|
||||
MyCfg.mode = GameMode.none
|
||||
-- 日志logveiw
|
||||
if ReporterMessageReceiver.self ~= nil then
|
||||
ReporterMessageReceiver.self.gameObject:SetActive(false)
|
||||
ReporterMessageReceiver.self.luaPath = "KOK/upgradeRes/priority/lua/toolkit/KKLogListener.lua"
|
||||
ReporterMessageReceiver.self.gameObject:SetActive(true)
|
||||
ReporterMessageReceiver.self.luaPath = "trCrm/upgradeRes/priority/lua/toolkit/KKLogListener.lua"
|
||||
ReporterMessageReceiver.self:setLua()
|
||||
end
|
||||
-- 设置显示状态栏
|
||||
@@ -43,6 +43,7 @@ CLLMainLua.init = function()
|
||||
-- AndroidStatusBar.setFlags(AndroidStatusBar.WINDOW_FLAG_FORCE_NOT_FULLSCREEN)
|
||||
-- CS.ApplicationChrome.statusBarState = CS.ApplicationChrome.States.Visible
|
||||
-- CS.ApplicationChrome.dimmed = false
|
||||
CS.ApplicationChrome.setSoftInputMode(CS.ApplicationChrome.ADJUST_PAN);
|
||||
|
||||
--设置帧率
|
||||
Application.targetFrameRate = 10
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---@class _DBCust
|
||||
---@field custName
|
||||
---@field custType
|
||||
---@field phone
|
||||
---@field phoneNo
|
||||
---@field address
|
||||
---@field companyName
|
||||
---@field taskId
|
||||
@@ -80,10 +80,10 @@ DBCust.onGetFilter = function(data)
|
||||
end
|
||||
|
||||
DBCust.getFieldsByTask = function(taskValue)
|
||||
taskValue = tostring(taskValue)
|
||||
if not taskValue then
|
||||
return {}
|
||||
end
|
||||
taskValue = tostring(taskValue)
|
||||
return db.taskFields[taskValue] or {}
|
||||
end
|
||||
|
||||
|
||||
@@ -85,7 +85,9 @@ DBMessage.onGetMessage = function(type, list)
|
||||
db.list = db.list or {}
|
||||
db.list[type] = db.list[type] or {}
|
||||
db.lastGetTime = db.lastGetTime or {}
|
||||
db.lastGetTime[type] = list[1].CREATETIME -- 更新最后取得的时间
|
||||
if list and #list > 0 then
|
||||
db.lastGetTime[type] = list[1].CREATETIME -- 更新最后取得的时间
|
||||
end
|
||||
---@param v _DBMessage
|
||||
for i, v in ipairs(list) do
|
||||
table.insert(db.list[type], v) -- 倒序
|
||||
|
||||
@@ -3,7 +3,7 @@ local db = {}
|
||||
|
||||
DBOrder.PopListGroup = {
|
||||
urgencyLevels = "urgencyLevels", -- 紧急程序
|
||||
templateList = "templateList", -- 订单模板
|
||||
templateList = "templateList" -- 订单模板
|
||||
}
|
||||
|
||||
DBOrder.onGetFilter = function(data)
|
||||
@@ -11,26 +11,76 @@ DBOrder.onGetFilter = function(data)
|
||||
|
||||
-- 转换成poplist
|
||||
db.filtersPopup = {}
|
||||
db.templateFields = {}
|
||||
db.templateInfor = {}
|
||||
db.nextHandlerList = {}
|
||||
for k, cells in pairs(data) do
|
||||
db.filtersPopup[k] = {}
|
||||
---@type System.Collections.ArrayList
|
||||
db.filtersPopup[k].options = ArrayList()
|
||||
db.filtersPopup[k].values = ArrayList()
|
||||
|
||||
-- db.filtersPopup[k].options:Add("")
|
||||
-- db.filtersPopup[k].values:Add("")
|
||||
for i, s in ipairs(cells) do
|
||||
local key = tostring(s.value)
|
||||
db.filtersPopup[k].options:Add(s.name)
|
||||
db.filtersPopup[k].values:Add(tostring(s.value))
|
||||
db.filtersPopup[k].values:Add(key)
|
||||
if k == DBOrder.PopListGroup.templateList then
|
||||
db.templateInfor[key] = s
|
||||
db.templateFields[key] = s.fieldAttr -- 设置任务的扩展字段
|
||||
-- db.templateFields[key]
|
||||
if s.nextHandlerList then
|
||||
db.nextHandlerList[key] = {} -- 下一步处理人
|
||||
db.nextHandlerList[key].options = ArrayList()
|
||||
db.nextHandlerList[key].values = ArrayList()
|
||||
for l, u in ipairs(s.nextHandlerList) do
|
||||
db.nextHandlerList[key].options:Add(u.loginName)
|
||||
db.nextHandlerList[key].values:Add(tostring(u.loginNo))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
DBCust.getPopupList = function(popGroup)
|
||||
DBOrder.getPopupList = function(popGroup)
|
||||
if popGroup then
|
||||
return db.filtersPopup[popGroup]
|
||||
end
|
||||
return db.filters
|
||||
end
|
||||
|
||||
DBOrder.getFields = function(templateId)
|
||||
if not templateId then
|
||||
return {}
|
||||
end
|
||||
templateId = tostring(templateId)
|
||||
return db.templateFields[templateId] or {}
|
||||
end
|
||||
|
||||
DBOrder.getTemplateInfor = function(templateId)
|
||||
if not templateId then
|
||||
return {}
|
||||
end
|
||||
templateId = tostring(templateId)
|
||||
return db.templateInfor[templateId] or {}
|
||||
end
|
||||
|
||||
DBOrder.getNextHandler = function(templateId)
|
||||
if not templateId then
|
||||
return nil
|
||||
end
|
||||
templateId = tostring(templateId)
|
||||
return db.nextHandlerList[templateId]
|
||||
end
|
||||
|
||||
--==============================================================================
|
||||
DBOrder.onGetProducts = function(content)
|
||||
db.products = content.productList
|
||||
end
|
||||
|
||||
DBOrder.getProducts = function()
|
||||
return db.products
|
||||
end
|
||||
--==============================================================================
|
||||
return DBOrder
|
||||
|
||||
@@ -39,7 +39,9 @@ DBRoot.funcs = {
|
||||
[NetProto.cmds.load_wfTicket_Settings] = function(data)
|
||||
DBOrder.onGetFilter(data.result)
|
||||
end,
|
||||
|
||||
[NetProto.cmds.selectProductInfo] = function(data)
|
||||
DBOrder.onGetProducts(data.result)
|
||||
end,
|
||||
}
|
||||
|
||||
DBRoot.onReceiveData = function(cmd, data)
|
||||
|
||||
@@ -24,6 +24,7 @@ function DBUser.getPopList()
|
||||
return poplist
|
||||
end
|
||||
|
||||
---@return _DBUser
|
||||
function DBUser.getUserById(loginNo)
|
||||
local user = db[loginNo]
|
||||
if user == nil then
|
||||
|
||||
@@ -8,15 +8,12 @@ NetProto.send = {}
|
||||
---------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------
|
||||
local host = "47.111.20.34"
|
||||
local host = "app.ttf-cti.com" -- "47.111.20.34"
|
||||
local port = 29004
|
||||
-- local host = "192.168.1.126"
|
||||
-- local port = 29000
|
||||
-- local baseUrl = "http://app.ttf-cti.com:29000/open_api/"
|
||||
local baseUrl = joinStr("http://", host, ":", port, "/open_api/")
|
||||
-- local baseUrl2 = "http://47.111.20.34:29004/open_api/"
|
||||
-- local socketUrl = "ws://app.ttf-cti.com:29000/tr_socket/websocket/"
|
||||
-- local socketUrl = "ws://47.111.20.34:29004/tr_socket/websocket/"
|
||||
-- local baseUrl = "http://47.111.20.34/home/open_api/"
|
||||
local socketUrl = joinStr("ws://", host, ":", port, "/tr_socket/websocket/")
|
||||
|
||||
---@type Dist.SpringWebsocket.Client
|
||||
@@ -241,8 +238,9 @@ NetProto.cmds = {
|
||||
update_customer = "update_customer", -- 更新客户信息
|
||||
save_customer = "save_customer", -- 新建客户
|
||||
create_followUp_record = "create_followUp_record", -- 新建跟进
|
||||
load_wfTicket_Settings = "load_wfTicket_Settings", -- 工单配置信息
|
||||
load_wfTicket_Settings = "load_WfTicket_Settings", -- 工单配置信息
|
||||
selectProductInfo = "selectProductInfo", -- 商品列表
|
||||
createWfInfo = "createWfInfo", -- 创建订单
|
||||
}
|
||||
---------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------
|
||||
@@ -296,9 +294,9 @@ end
|
||||
|
||||
---@param frame Dist.SpringWebsocket.StompFrame
|
||||
NetProto.OnReceiveStompMsg = function(frame)
|
||||
if isDebug then
|
||||
print(frame.Code, frame.Content)
|
||||
end
|
||||
-- if isDebug then
|
||||
-- print(frame.Code, frame.Content)
|
||||
-- end
|
||||
if frame.Code == StompStatus.OPENSERVER then
|
||||
socket:Connect(nil, NetProto.OnReceiveStompMsg)
|
||||
elseif frame.Code == StompStatus.CONNECTED then
|
||||
@@ -336,6 +334,10 @@ NetProto.OnReceiveStompMsg = function(frame)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if isDebug then
|
||||
printw(cmd, frame.Content)
|
||||
end
|
||||
if cmd then
|
||||
doCallbackSocket(content)
|
||||
dispatch(content, {cmd = cmd})
|
||||
@@ -362,6 +364,7 @@ NetProto.doReconnectSocket = function()
|
||||
NetProto.reconnectTimes = NetProto.reconnectTimes or 0
|
||||
NetProto.isReconnect = true
|
||||
if NetProto.reconnectTimes > 1 then
|
||||
NetProto.reconnectTimes = 0
|
||||
-- 重连失败提示
|
||||
CLUIUtl.showConfirm("服务器连接失败,请重试", NetProto.doReconnectSocket)
|
||||
else
|
||||
@@ -541,12 +544,27 @@ NetProto.send.load_wfTicket_Settings = function(callback, timeOutSec)
|
||||
NetProto.sendSocket(content, callback, timeOutSec)
|
||||
end
|
||||
|
||||
NetProto.send.selectProductInfo = function(callback, timeOutSec)
|
||||
NetProto.send.selectProductInfo = function(searchKey, page, callback, timeOutSec)
|
||||
local content = {}
|
||||
content.action = NetProto.cmds.selectProductInfo
|
||||
content.loginNo = NetProto.loginNo
|
||||
content.groupId = NetProto.groupId
|
||||
content.current_page = page
|
||||
content.search = searchKey
|
||||
NetProto.sendSocket(content, callback, timeOutSec)
|
||||
end
|
||||
|
||||
NetProto.send.createWfInfo = function(workFlowInfo, callback, timeOutSec)
|
||||
local content = {}
|
||||
content.action = NetProto.cmds.createWfInfo
|
||||
local user = DBUser.getUserById(NetProto.loginNo)
|
||||
content.wfStatus = "正常工单"
|
||||
content.loginName = user.loginName
|
||||
content.loginNo = NetProto.loginNo
|
||||
content.groupId = NetProto.groupId
|
||||
content.workFlowInfo = workFlowInfo
|
||||
NetProto.sendSocket(content, callback, timeOutSec)
|
||||
end
|
||||
|
||||
------------------------------------------------------
|
||||
return NetProto
|
||||
|
||||
@@ -1,36 +1,14 @@
|
||||
-- 日志监听
|
||||
do
|
||||
KKLogListener = {}
|
||||
KKLogListener = {}
|
||||
|
||||
function KKLogListener.OnLogError(log)
|
||||
-- 当有异常日志时
|
||||
if KKWhiteList and KKWhiteList.isWhiteName() then
|
||||
if CLAlert.self ~= nil then
|
||||
alertInfo("有异常日志,请在屏幕画圈查看详细!", Color.red, 3, 4)
|
||||
end
|
||||
end
|
||||
|
||||
-- 记录到服务器
|
||||
if __recodeErrorLog__ then
|
||||
if
|
||||
(not startswith(log.condition, "get attr is nil")) and
|
||||
(not startswith(log.condition, "Releasing render texture that is set as Camera")) and
|
||||
(not startswith(log.condition, "Billing disabled")) and
|
||||
(not startswith(log.condition, "propNames is null")) and
|
||||
(not string.find(log.condition, "/KokManagement/ErrorServlet"))
|
||||
then
|
||||
local url = joinStr(__httpBaseUrl3, "/KokManagement/ErrorServlet")
|
||||
local formData = Hashtable()
|
||||
formData:Add("errorKey", joinStr(log.condition, "\n", log.stacktrace))
|
||||
WWWEx.post(url, formData, CLAssetType.text, nil, nil, nil, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function KKLogListener.OnLogWarning(log)
|
||||
-- 当有警告日志时
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return KKLogListener
|
||||
function KKLogListener.OnLogError(log)
|
||||
-- 当有异常日志时
|
||||
MyUtl.toastE("有异常日志,请在屏幕画圈查看详细!")
|
||||
end
|
||||
|
||||
function KKLogListener.OnLogWarning(log)
|
||||
-- 当有警告日志时
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return KKLogListener
|
||||
|
||||
@@ -40,7 +40,7 @@ function CLToastRoot.borrow()
|
||||
else
|
||||
cell = queue:deQueue()
|
||||
end
|
||||
cell.name = string.format("%11d",index)
|
||||
cell.name = string.format("%11d", index)
|
||||
index = index + 1
|
||||
return cell
|
||||
end
|
||||
@@ -51,6 +51,9 @@ function CLToastRoot.returnToast(cell)
|
||||
end
|
||||
|
||||
function CLToastRoot.toast(msg, type, staySec)
|
||||
if isNilOrEmpty(msg) then
|
||||
return
|
||||
end
|
||||
local cell = CLToastRoot.borrow()
|
||||
SetActive(cell.gameObject, true)
|
||||
cell:init({msg = msg, type = type, staySec = staySec}, nil)
|
||||
|
||||
@@ -39,9 +39,9 @@ function _cell.init(csObj)
|
||||
uiobjs.spriteBg = getCC(transform, "Background", "UISprite")
|
||||
end
|
||||
|
||||
if uiobjs.spriteBg then
|
||||
uiobjs.spriteBg.width = NumEx.getIntPart(CSPMain.contentRect.z)
|
||||
end
|
||||
-- if uiobjs.spriteBg then
|
||||
-- uiobjs.spriteBg.width = NumEx.getIntPart(CSPMain.contentRect.z)
|
||||
-- end
|
||||
|
||||
uiobjs.boxCollider = csSelf:GetComponent("BoxCollider")
|
||||
---@type UIInput
|
||||
|
||||
@@ -88,16 +88,6 @@ function _cell.onLoadField(name, go, orgs)
|
||||
local param = mData.fields[index]
|
||||
local cell = go:GetComponent("CLCellLua")
|
||||
SetActive(go, true)
|
||||
--[[
|
||||
---@type _ParamCellExtendFiled
|
||||
local param = {
|
||||
attr = fileAttr,
|
||||
onMultTextInputChg = _cell.onMultTextInputChg,
|
||||
isEditMode = isEditMode,
|
||||
onClick = mData.onClick,
|
||||
onSelect = mData.onSelect
|
||||
}
|
||||
]]
|
||||
if param.attr.attrType == DBCust.FieldType.multext then
|
||||
-- 要设置一次
|
||||
param.orgOnMultTextInputChg = param.onMultTextInputChg
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
-- xx单元
|
||||
local _cell = {}
|
||||
---@type Coolape.CLCellLua
|
||||
local csSelf = nil
|
||||
local transform = nil
|
||||
local mData = nil
|
||||
local uiobjs = {}
|
||||
|
||||
-- 初始化,只调用一次
|
||||
function _cell.init(csObj)
|
||||
csSelf = csObj
|
||||
transform = csSelf.transform
|
||||
---@type CLUIFormRoot
|
||||
uiobjs.formRoot = csSelf:GetComponent("CLUIFormRoot")
|
||||
---@type UIToggle
|
||||
uiobjs.Toggle = getCC(transform, "Toggle", "UIToggle")
|
||||
end
|
||||
|
||||
-- 显示,
|
||||
-- 注意,c#侧不会在调用show时,调用refresh
|
||||
function _cell.show(go, data)
|
||||
mData = data
|
||||
uiobjs.formRoot:setValue(mData.data, true)
|
||||
_cell.selected(mData.isSelected)
|
||||
end
|
||||
|
||||
-- 取得数据
|
||||
function _cell.getData()
|
||||
return mData
|
||||
end
|
||||
|
||||
function _cell.selected(val)
|
||||
mData.isSelected = val
|
||||
uiobjs.Toggle.value = val
|
||||
end
|
||||
|
||||
function _cell.uiEventDelegate(go)
|
||||
if go.name == "Toggle" then
|
||||
_cell.selected(uiobjs.Toggle.value)
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return _cell
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 156c8a77e4fb8424da798e7fd2682597
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,44 @@
|
||||
-- xx单元
|
||||
local _cell = {}
|
||||
---@type Coolape.CLCellLua
|
||||
local csSelf = nil
|
||||
local transform = nil
|
||||
local mData = nil
|
||||
local uiobjs = {}
|
||||
_cell.onDeleteProduct = nil
|
||||
|
||||
-- 初始化,只调用一次
|
||||
function _cell.init(csObj)
|
||||
csSelf = csObj
|
||||
transform = csSelf.transform
|
||||
---@type CLUIFormRoot
|
||||
uiobjs.formRoot = csSelf:GetComponent("CLUIFormRoot")
|
||||
end
|
||||
|
||||
-- 显示,
|
||||
-- 注意,c#侧不会在调用show时,调用refresh
|
||||
function _cell.show(go, data)
|
||||
mData = data
|
||||
uiobjs.formRoot:setValue(mData)
|
||||
end
|
||||
|
||||
-- 取得数据
|
||||
function _cell.getData()
|
||||
return mData
|
||||
end
|
||||
|
||||
function _cell.uiEventDelegate(go)
|
||||
if go.name == "ButtonEdit" then
|
||||
getPanelAsy("PanelEditPrice", onLoadedPanelTT, {data = mData, callback = _cell.onFinishEditPrice})
|
||||
elseif go.name == "ButtonDel" then
|
||||
Utl.doCallback(_cell.onDeleteProduct, mData)
|
||||
end
|
||||
end
|
||||
|
||||
function _cell.onFinishEditPrice(d)
|
||||
mData = d
|
||||
uiobjs.formRoot:setValue(mData)
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return _cell
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4500701b5daa743d7bcb2147cedf4101
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -43,7 +43,7 @@ function CLLPStart.setLuasAtBegainning()
|
||||
-- 日志监听
|
||||
if ReporterMessageReceiver.self and ReporterMessageReceiver.self.gameObject then
|
||||
-- if KKWhiteList.isWhiteName() then
|
||||
ReporterMessageReceiver.self.gameObject:SetActive(false)
|
||||
ReporterMessageReceiver.self.gameObject:SetActive(true)
|
||||
-- else
|
||||
-- ReporterMessageReceiver.self.gameObject:SetActive(false)
|
||||
-- end
|
||||
@@ -193,11 +193,16 @@ function CLLPStart.doEnterGame()
|
||||
if content.success then
|
||||
local currGroup = Prefs.getCurrGroup(Prefs.getUserName())
|
||||
if isNilOrEmpty(currGroup) then
|
||||
---@type _ParamTRPSelectGroup
|
||||
local d = {}
|
||||
d.isHideCloseBtn = true
|
||||
d.companyList = content.result
|
||||
getPanelAsy("PanelSelectCompany", onLoadedPanel, d)
|
||||
if #(content.result) == 1 then
|
||||
Prefs.setCurrGroup(Prefs.getUserName(), json.encode(content.result[1]))
|
||||
getPanelAsy("PanelConnect", onLoadedPanel)
|
||||
else
|
||||
---@type _ParamTRPSelectGroup
|
||||
local d = {}
|
||||
d.isHideCloseBtn = true
|
||||
d.companyList = content.result
|
||||
getPanelAsy("PanelSelectCompany", onLoadedPanel, d)
|
||||
end
|
||||
CLLPStart.hideSplash()
|
||||
else
|
||||
local useOldCurrGroup = false
|
||||
@@ -213,11 +218,16 @@ function CLLPStart.doEnterGame()
|
||||
if useOldCurrGroup then
|
||||
getPanelAsy("PanelConnect", onLoadedPanel)
|
||||
else
|
||||
---@type _ParamTRPSelectGroup
|
||||
local d = {}
|
||||
d.isHideCloseBtn = true
|
||||
d.companyList = content.result
|
||||
getPanelAsy("PanelSelectCompany", onLoadedPanel, d)
|
||||
if #(content.result) == 1 then
|
||||
Prefs.setCurrGroup(Prefs.getUserName(), json.encode(content.result[1]))
|
||||
getPanelAsy("PanelConnect", onLoadedPanel)
|
||||
else
|
||||
---@type _ParamTRPSelectGroup
|
||||
local d = {}
|
||||
d.isHideCloseBtn = true
|
||||
d.companyList = content.result
|
||||
getPanelAsy("PanelSelectCompany", onLoadedPanel, d)
|
||||
end
|
||||
end
|
||||
CLLPStart.hideSplash()
|
||||
end
|
||||
|
||||
@@ -21,6 +21,8 @@ function CSPTasks.init(csObj)
|
||||
uiobjs.Content.baseClipRegion = CSPTasks.contentRect
|
||||
|
||||
uiobjs.TableContent = getCC(uiobjs.Content.transform, "Table", "UITable")
|
||||
---@type UIToggle
|
||||
uiobjs.ToggleCust = getCC(uiobjs.TableContent.transform, "Statistics/grid/ToggleCust", "UIToggle")
|
||||
uiobjs.Statistics = getChild(uiobjs.TableContent.transform, "Statistics")
|
||||
|
||||
---@type UIScrollView
|
||||
@@ -61,6 +63,7 @@ function CSPTasks.show()
|
||||
end
|
||||
-- uiobjs.TableTask:setList(list, nil)
|
||||
|
||||
uiobjs.ToggleCust:Set(true)
|
||||
CSPTasks.showReportform("reportform1")
|
||||
uiobjs.scrollView:ResetPosition()
|
||||
end
|
||||
|
||||
@@ -88,7 +88,6 @@ function TRPConnect.getDataFromServer()
|
||||
NetProto.send.booking_query()
|
||||
NetProto.send.replenish_query()
|
||||
NetProto.send.load_wfTicket_Settings()
|
||||
NetProto.send.selectProductInfo()
|
||||
end
|
||||
|
||||
-- 处理ui上的事件,例如点击等
|
||||
|
||||
@@ -226,6 +226,7 @@ function TRPCustDetail:procNetwork(cmd, succ, msg, paras)
|
||||
elseif cmd == NetProto.cmds.update_customer then
|
||||
if self.currToggle == 1 then
|
||||
self:showDetail()
|
||||
uiobjs.Head:setValue(self.mdata)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
---@type IDBasePanel
|
||||
local TRBasePanel = require("ui.panel.TRBasePanel")
|
||||
---@class TRPEditPrice:TRBasePanel 邮件列表
|
||||
local TRPEditPrice = class("TRPEditPrice", TRBasePanel)
|
||||
|
||||
local uiobjs = {}
|
||||
local callback
|
||||
-- 初始化,只会调用一次
|
||||
function TRPEditPrice:init(csObj)
|
||||
TRPEditPrice.super.init(self, csObj)
|
||||
|
||||
self:setEventDelegate()
|
||||
---@type CLUIFormRoot
|
||||
uiobjs.formRoot = self.csSelf:GetComponent("CLUIFormRoot")
|
||||
|
||||
end
|
||||
|
||||
-- 设置数据
|
||||
---@param paras _ParamTRPEditPrice
|
||||
function TRPEditPrice:setData(paras)
|
||||
self.mdata = paras.data
|
||||
callback = paras.callback
|
||||
end
|
||||
|
||||
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
||||
function TRPEditPrice:show()
|
||||
uiobjs.formRoot:setValue(self.mdata)
|
||||
end
|
||||
|
||||
-- 刷新
|
||||
function TRPEditPrice:refresh()
|
||||
end
|
||||
|
||||
-- 关闭页面
|
||||
function TRPEditPrice:hide()
|
||||
end
|
||||
|
||||
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
||||
function TRPEditPrice:procNetwork(cmd, succ, msg, paras)
|
||||
if (succ == NetSuccess) then
|
||||
--[[
|
||||
if cmd == xx then
|
||||
end
|
||||
]]
|
||||
end
|
||||
end
|
||||
|
||||
function TRPEditPrice:setEventDelegate()
|
||||
self.EventDelegate = {
|
||||
ButtonCancel = function()
|
||||
hideTopPanel(self.csSelf)
|
||||
end,
|
||||
ButtonOkay = function()
|
||||
hideTopPanel(self.csSelf)
|
||||
self.mdata = uiobjs.formRoot:getValue(self.mdata, true)
|
||||
if tonumber(self.mdata.productNum) <= 0 then
|
||||
MyUtl.toastW("数量不能低于1")
|
||||
return
|
||||
end
|
||||
Utl.doCallback(callback, self.mdata)
|
||||
end
|
||||
}
|
||||
end
|
||||
-- 处理ui上的事件,例如点击等
|
||||
function TRPEditPrice:uiEventDelegate(go)
|
||||
local func = self.EventDelegate[go.name]
|
||||
if func then
|
||||
func()
|
||||
end
|
||||
end
|
||||
|
||||
-- 当顶层页面发生变化时回调
|
||||
function TRPEditPrice:onTopPanelChange(topPanel)
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return TRPEditPrice
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dff0f4357a1c44e81914c15a6a5d71a9
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -102,11 +102,16 @@ function TRPLogin:setEventDelegate()
|
||||
|
||||
local currGroup = Prefs.getCurrGroup(Prefs.getUserName())
|
||||
if isNilOrEmpty(currGroup) then
|
||||
---@type _ParamTRPSelectGroup
|
||||
local d = {}
|
||||
d.isHideCloseBtn = true
|
||||
d.companyList = content.result
|
||||
getPanelAsy("PanelSelectCompany", onLoadedPanel, d)
|
||||
if #(content.result) == 1 then
|
||||
Prefs.setCurrGroup(Prefs.getUserName(), json.encode(content.result[1]))
|
||||
getPanelAsy("PanelConnect", onLoadedPanel)
|
||||
else
|
||||
---@type _ParamTRPSelectGroup
|
||||
local d = {}
|
||||
d.isHideCloseBtn = true
|
||||
d.companyList = content.result
|
||||
getPanelAsy("PanelSelectCompany", onLoadedPanel, d)
|
||||
end
|
||||
else
|
||||
getPanelAsy("PanelConnect", onLoadedPanel)
|
||||
end
|
||||
|
||||
@@ -83,9 +83,8 @@ function TRPNewCust:show()
|
||||
optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.taskList)
|
||||
uiobjs.InputTask:refreshItems(optionInfor.options, optionInfor.values)
|
||||
|
||||
-- optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.loginNoList)
|
||||
local poplist = DBUser.getPopList()
|
||||
uiobjs.InputLogin:refreshItems(poplist.options, poplist.values)
|
||||
optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.loginNoList)
|
||||
uiobjs.InputLogin:refreshItems(optionInfor.options, optionInfor.values)
|
||||
|
||||
self:refreshContent()
|
||||
|
||||
|
||||
@@ -24,6 +24,15 @@ function TRPNewOrder:init(csObj)
|
||||
uiobjs.ExtendRoot = getCC(uiobjs.Table.transform, "ExtendRoot", "CLCellLua")
|
||||
---@type CLUIFormRoot
|
||||
uiobjs.ExtendFormRoot = uiobjs.ExtendRoot:GetComponent("CLUIFormRoot")
|
||||
|
||||
---@type UITable
|
||||
uiobjs.StepRoot = getCC(uiobjs.Table.transform, "StepRoot", "UITable")
|
||||
---@type CLUIFormRoot
|
||||
uiobjs.StepFormRoot = uiobjs.StepRoot:GetComponent("CLUIFormRoot")
|
||||
---@type UIPopupList
|
||||
uiobjs.InputNextLogino = getCC(uiobjs.StepRoot.transform, "InputNextLogino", "UIPopupList")
|
||||
uiobjs.gridProjects = getCC(uiobjs.Table.transform, "InputSelectProduct/Products", "UIGrid")
|
||||
uiobjs.gridProjectsPrefab = getChild(uiobjs.gridProjects.transform, "00000").gameObject
|
||||
-- uiobjs.elements = uiobjs.DetailRoot.gameObject:GetComponentsInChildren(typeof(CLUIElement), true)
|
||||
uiobjs.ButtonSave = getChild(self.transform, "Top/ButtonSave")
|
||||
end
|
||||
@@ -34,15 +43,18 @@ function TRPNewOrder:initFiledsAttr()
|
||||
self.baseFiledsAttr = {}
|
||||
attr = {}
|
||||
attr.attrName = "工单模板"
|
||||
attr.id = ""
|
||||
attr.id = "templetId"
|
||||
attr.attrType = DBCust.FieldType.popuplist
|
||||
attr.ifMust = 1
|
||||
attr.donotJoinKey = true
|
||||
local popInfor = DBOrder.getPopupList(DBOrder.PopListGroup.templateList)
|
||||
attr.popOptions = popInfor.options
|
||||
attr.popValues = popInfor.values
|
||||
table.insert(self.baseFiledsAttr, attr)
|
||||
|
||||
attr = {}
|
||||
attr.attrName = "工单名称"
|
||||
attr.id = ""
|
||||
attr.id = "title"
|
||||
attr.attrType = DBCust.FieldType.text
|
||||
attr.ifMust = 1
|
||||
attr.donotJoinKey = true
|
||||
@@ -50,10 +62,13 @@ function TRPNewOrder:initFiledsAttr()
|
||||
|
||||
attr = {}
|
||||
attr.attrName = "紧急程序"
|
||||
attr.id = ""
|
||||
attr.id = "urgency"
|
||||
attr.attrType = DBCust.FieldType.popuplist
|
||||
attr.ifMust = 0
|
||||
attr.donotJoinKey = true
|
||||
local popInfor = DBOrder.getPopupList(DBOrder.PopListGroup.urgencyLevels) or {}
|
||||
attr.popOptions = popInfor.options
|
||||
attr.popValues = popInfor.values
|
||||
table.insert(self.baseFiledsAttr, attr)
|
||||
|
||||
attr = {}
|
||||
@@ -101,7 +116,7 @@ function TRPNewOrder:initFiledsAttr()
|
||||
|
||||
attr = {}
|
||||
attr.attrName = "订单内容"
|
||||
attr.id = ""
|
||||
attr.id = "content"
|
||||
attr.attrType = DBCust.FieldType.multext
|
||||
attr.ifMust = 0
|
||||
attr.donotJoinKey = true
|
||||
@@ -115,16 +130,25 @@ function TRPNewOrder:setData(paras)
|
||||
self.isNewOrder = false
|
||||
self.mdata = paras
|
||||
|
||||
if type(self.mdata.jsonStr) == "string" then
|
||||
self.mdata.jsonStr = json.decode(self.mdata.jsonStr)
|
||||
if type(self.mdata.attrJson) == "string" then
|
||||
self.mdata.attrJson = json.decode(self.mdata.attrJson)
|
||||
end
|
||||
self.mdata.jsonStr = self.mdata.jsonStr or {}
|
||||
self.mdata.attrJson = self.mdata.attrJson or {}
|
||||
---@type _DBCust
|
||||
self.cust = nil
|
||||
else
|
||||
--//TODO:初始值
|
||||
self.isNewOrder = true
|
||||
---@type _DBCust
|
||||
self.cust = paras
|
||||
self.mdata = {}
|
||||
local popInfor = DBOrder.getPopupList(DBOrder.PopListGroup.templateList)
|
||||
self.mdata.templetId = popInfor.values[0]
|
||||
popInfor = DBOrder.getPopupList(DBOrder.PopListGroup.urgencyLevels)
|
||||
self.mdata.urgency = popInfor.values[0]
|
||||
local templateInfor = DBOrder.getTemplateInfor(self.mdata.templetId)
|
||||
self.mdata.content = templateInfor.content
|
||||
self.selectedProducts = {}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -154,12 +178,39 @@ end
|
||||
|
||||
function TRPNewOrder:refreshContent()
|
||||
self:showBaseFields()
|
||||
local taskId = self.mdata and self.mdata.taskId or nil
|
||||
self:showExtentFiles(taskId)
|
||||
self:showProducts()
|
||||
local templetId = self.mdata and self.mdata.templetId or nil
|
||||
self:showExtentFiles(templetId)
|
||||
|
||||
self.csSelf:invoke4Lua(self:wrapFunc(self.reposition), 0.1)
|
||||
end
|
||||
|
||||
function TRPNewOrder:showProducts()
|
||||
local products
|
||||
if self.isNewOrder then
|
||||
products = self.selectedProducts
|
||||
else
|
||||
products = json.decode(self.mdata.prodJson)
|
||||
end
|
||||
CLUIUtl.resetList4Lua(uiobjs.gridProjects, uiobjs.gridProjectsPrefab, products, self:wrapFunc(self.initProductCell))
|
||||
self:reposition()
|
||||
end
|
||||
|
||||
function TRPNewOrder:initProductCell(cell, data)
|
||||
cell:init(data, nil)
|
||||
cell.luaTable.onDeleteProduct = self:wrapFunc(self.onDeleteProduct)
|
||||
end
|
||||
|
||||
function TRPNewOrder:onDeleteProduct(data)
|
||||
for i, v in ipairs(self.selectedProducts) do
|
||||
if v.id == data.id then
|
||||
table.remove(self.selectedProducts, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
self:showProducts()
|
||||
end
|
||||
|
||||
function TRPNewOrder:showBaseFields()
|
||||
---@type _ParamCellExtendFiledRoot
|
||||
local param = {}
|
||||
@@ -182,9 +233,9 @@ function TRPNewOrder:showBaseFields()
|
||||
if filedInfor.attr.attrType == DBCust.FieldType.multext then
|
||||
filedInfor.onMultTextInputChg = self:wrapFunc(self.reposition)
|
||||
end
|
||||
filedInfor.onSelect = self:wrapFunc(self.onPopupFieldValChg)
|
||||
if not self.isNewOrder then
|
||||
filedInfor.onClick = self:wrapFunc(self.onClickInputField)
|
||||
filedInfor.onSelect = self:wrapFunc(self.onPopupFieldValChg)
|
||||
end
|
||||
table.insert(param.fields, filedInfor)
|
||||
end
|
||||
@@ -193,30 +244,62 @@ function TRPNewOrder:showBaseFields()
|
||||
end
|
||||
|
||||
---public 显示扩展字段
|
||||
function TRPNewOrder:showExtentFiles(taskId)
|
||||
---@type _ParamCellExtendFiledRoot
|
||||
local param = {}
|
||||
param.data = self.mdata and self.mdata.jsonStr or {}
|
||||
-- param.isEditMode = true
|
||||
param.onFinish = self:wrapFunc(self.setExtendFieldsMode)
|
||||
param.fields = {}
|
||||
local fields = DBCust.getFieldsByTask(taskId) or {}
|
||||
---@type _ParamCellExtendFiled
|
||||
local filedInfor
|
||||
for i, v in ipairs(fields) do
|
||||
filedInfor = {}
|
||||
filedInfor.attr = v
|
||||
filedInfor.isEditMode = true
|
||||
if filedInfor.attr.attrType == DBCust.FieldType.multext then
|
||||
filedInfor.onMultTextInputChg = self:wrapFunc(self.reposition)
|
||||
function TRPNewOrder:showExtentFiles(templetId)
|
||||
local cfgInfor = DBOrder.getTemplateInfor(templetId)
|
||||
local fields = DBOrder.getFields(templetId) or {}
|
||||
if #fields > 0 then
|
||||
---@type _ParamCellExtendFiledRoot
|
||||
local param = {}
|
||||
param.data = self.mdata and self.mdata.attrJson or {}
|
||||
-- param.isEditMode = true
|
||||
param.onFinish = self:wrapFunc(self.setExtendFieldsMode)
|
||||
param.fields = {}
|
||||
---@type _ParamCellExtendFiled
|
||||
local filedInfor
|
||||
for i, v in ipairs(fields) do
|
||||
filedInfor = {}
|
||||
filedInfor.attr = v
|
||||
filedInfor.isEditMode = true
|
||||
if filedInfor.attr.attrType == DBCust.FieldType.multext then
|
||||
filedInfor.onMultTextInputChg = self:wrapFunc(self.reposition)
|
||||
end
|
||||
if not self.isNewOrder then
|
||||
filedInfor.onClick = self:wrapFunc(self.onClickInputField4Extend)
|
||||
filedInfor.onSelect = self:wrapFunc(self.onPopupFieldValChg4Extend)
|
||||
end
|
||||
table.insert(param.fields, filedInfor)
|
||||
end
|
||||
if not self.isNewOrder then
|
||||
filedInfor.onClick = self:wrapFunc(self.onClickInputField4Extend)
|
||||
filedInfor.onSelect = self:wrapFunc(self.onPopupFieldValChg4Extend)
|
||||
end
|
||||
table.insert(param.fields, filedInfor)
|
||||
SetActive(uiobjs.ExtendRoot.gameObject, true)
|
||||
uiobjs.ExtendRoot:init(param, nil)
|
||||
else
|
||||
SetActive(uiobjs.ExtendRoot.gameObject, false)
|
||||
end
|
||||
uiobjs.ExtendRoot:init(param, nil)
|
||||
|
||||
-- next Step
|
||||
local nextStep = DBOrder.getNextHandler(templetId)
|
||||
if nextStep and tonumber(cfgInfor.ifToLoginNo) == 1 then
|
||||
SetActive(uiobjs.StepFormRoot.gameObject, true)
|
||||
uiobjs.InputNextLogino:refreshItems(nextStep.options, nextStep.values)
|
||||
uiobjs.StepFormRoot:setValue(self.mdata)
|
||||
else
|
||||
SetActive(uiobjs.StepFormRoot.gameObject, false)
|
||||
end
|
||||
|
||||
-- product
|
||||
if tonumber(cfgInfor.ifProduct) == 1 then
|
||||
SetActive(uiobjs.gridProjects.transform.parent.gameObject, true)
|
||||
self.selectedProducts = {}
|
||||
self:showProducts()
|
||||
else
|
||||
SetActive(uiobjs.gridProjects.transform.parent.gameObject, false)
|
||||
end
|
||||
|
||||
-- refresh content
|
||||
local d = uiobjs.DetailFromRoot:getValue(true)
|
||||
d.content = cfgInfor.content
|
||||
uiobjs.DetailFromRoot:setValue(d)
|
||||
-------
|
||||
uiobjs.StepRoot:Reposition()
|
||||
end
|
||||
|
||||
function TRPNewOrder:reposition()
|
||||
@@ -241,7 +324,7 @@ function TRPNewOrder:setElementMode(el)
|
||||
local boxcollider = el:GetComponent("BoxCollider")
|
||||
local ButtonReset = getCC(el.transform, "ButtonReset", "MyInputReset")
|
||||
|
||||
if (not self.isNewOrder) and (el.jsonKey == "taskId" or el.jsonKey == "phoneNo") then
|
||||
if el.jsonKey == "taskId" or el.jsonKey == "phoneNo" then
|
||||
boxcollider.enabled = false
|
||||
else
|
||||
boxcollider.enabled = true
|
||||
@@ -296,18 +379,21 @@ function TRPNewOrder:procNetwork(cmd, succ, msg, paras)
|
||||
end
|
||||
|
||||
function TRPNewOrder:onPopupFieldValChg(go)
|
||||
if self.isNewOrder then
|
||||
return
|
||||
end
|
||||
---@type CLUIElement
|
||||
local el = go:GetComponent("CLUIElement")
|
||||
if el then
|
||||
local err = el:checkValid()
|
||||
if tostring(el.value) ~= tostring(self.mdata[el.jsonKey]) then
|
||||
if isNilOrEmpty(err) then
|
||||
self:sendModifymsg(el.jsonKey, el.value, false)
|
||||
else
|
||||
MyUtl.toastW(err)
|
||||
if self.isNewOrder then
|
||||
if el and el.jsonKey == "templetId" then
|
||||
self:showExtentFiles(el.value)
|
||||
end
|
||||
else
|
||||
if el then
|
||||
local err = el:checkValid()
|
||||
if tostring(el.value) ~= tostring(self.mdata[el.jsonKey]) then
|
||||
if isNilOrEmpty(err) then
|
||||
self:sendModifymsg(el.jsonKey, el.value, false)
|
||||
else
|
||||
MyUtl.toastW(err)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -416,33 +502,71 @@ end
|
||||
function TRPNewOrder:setEventDelegate()
|
||||
self.EventDelegate = {
|
||||
ButtonSave = function()
|
||||
local err = uiobjs.DetailRoot:checkValid()
|
||||
local err = uiobjs.DetailFromRoot:checkValid()
|
||||
err = joinStr(err, uiobjs.ExtendFormRoot:checkValid())
|
||||
if not isNilOrEmpty(err) then
|
||||
MyUtl.toastW(err)
|
||||
return
|
||||
end
|
||||
|
||||
local cust = uiobjs.DetailRoot:getValue(true)
|
||||
cust.customerLabel = self.mdata.customerLabel
|
||||
local jsonStr = uiobjs.ExtendFormRoot:getValue(true)
|
||||
cust.jsonStr = jsonStr
|
||||
local order = uiobjs.DetailFromRoot:getValue(true)
|
||||
order.custId = self.cust.custId
|
||||
local attrJson = uiobjs.ExtendFormRoot:getValue(true)
|
||||
order.attrJson = attrJson
|
||||
if uiobjs.StepFormRoot.gameObject.activeInHierarchy then
|
||||
order = uiobjs.StepFormRoot:getValue(order, true)
|
||||
end
|
||||
local templateInfor = DBOrder.getTemplateInfor(order.templetId)
|
||||
order.ifToLoginNo = templateInfor.ifToLoginNo
|
||||
order.ifMail = templateInfor.ifMail
|
||||
order.ifProduct = templateInfor.ifProduct
|
||||
if uiobjs.gridProjects.gameObject.activeInHierarchy then
|
||||
if self.selectedProducts == nil or #(self.selectedProducts) <= 0 then
|
||||
MyUtl.toastW("请添加产品")
|
||||
return
|
||||
end
|
||||
order.prodJson = self.selectedProducts
|
||||
-- 计算价格
|
||||
for i, v in ipairs(order.prodJson) do
|
||||
v.totalPrice = tonumber(v.productNum) * tonumber(v.price)
|
||||
v.salePrice = tonumber(v.productNum) * tonumber(v.productPrice)
|
||||
end
|
||||
end
|
||||
order.wfType = "0" -- 0:正常工单,1:退货工单
|
||||
showHotWheel()
|
||||
NetProto.send.save_customer(
|
||||
cust,
|
||||
NetProto.send.createWfInfo(
|
||||
order,
|
||||
function(content)
|
||||
if content.success then
|
||||
getPanelAsy("PanelCustDetail", onLoadedPanel, cust)
|
||||
MyUtl.toastS("订单创建成功")
|
||||
hideTopPanel(self.csSelf)
|
||||
end
|
||||
hideHotWheel()
|
||||
end
|
||||
)
|
||||
end,
|
||||
InputSeachKey = function()
|
||||
local queryKey = uiobjs.InputSeachKey.value
|
||||
NetProto.send.selectProductInfo(queryKey, 1)
|
||||
end,
|
||||
InputSelectProduct = function()
|
||||
getPanelAsy("PanelSelectProduct", onLoadedPanelTT)
|
||||
-- 选择商品
|
||||
getPanelAsy(
|
||||
"PanelSelectProduct",
|
||||
onLoadedPanelTT,
|
||||
{selectedProducts = self.selectedProducts, callback = self:wrapFunc(self.onGetSelectedProducts)}
|
||||
)
|
||||
end,
|
||||
InputAttachment = function()
|
||||
-- 添加附件
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
function TRPNewOrder:onGetSelectedProducts(list)
|
||||
self.selectedProducts = list
|
||||
self:showProducts()
|
||||
end
|
||||
|
||||
-- 处理ui上的事件,例如点击等
|
||||
function TRPNewOrder:uiEventDelegate(go)
|
||||
local func = self.EventDelegate[go.name]
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
---@type IDBasePanel
|
||||
local TRBasePanel = require("ui.panel.TRBasePanel")
|
||||
---@class TRPSelectProduct:TRBasePanel 邮件列表
|
||||
local TRPSelectProduct = class("TRPSelectProduct", TRBasePanel)
|
||||
|
||||
local uiobjs = {}
|
||||
local selectedMap = {}
|
||||
-- 初始化,只会调用一次
|
||||
function TRPSelectProduct:init(csObj)
|
||||
TRPSelectProduct.super.init(self, csObj)
|
||||
|
||||
self:setEventDelegate()
|
||||
|
||||
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 298, 200)
|
||||
uiobjs.InputSeachKey = getCC(self.transform, "Top/InputSeachKey", "UIInput")
|
||||
---@type UIScrollView
|
||||
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
|
||||
---@type Coolape.CLUILoopGrid
|
||||
uiobjs.Grid = getCC(uiobjs.scrollView.transform, "Grid", "CLUILoopGrid")
|
||||
|
||||
uiobjs.ButtonEndList = getChild(uiobjs.Grid.transform, "ButtonEndList")
|
||||
uiobjs.ButtonEndListLb = getCC(uiobjs.ButtonEndList, "Label", "UILabel")
|
||||
end
|
||||
|
||||
-- 设置数据
|
||||
---@param paras _ParamTRPSelectProduct
|
||||
function TRPSelectProduct:setData(paras)
|
||||
selectedMap = {}
|
||||
self.callback = paras.callback
|
||||
for i, v in ipairs(paras.selectedProducts or {}) do
|
||||
selectedMap[v.id] = v
|
||||
end
|
||||
end
|
||||
|
||||
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
||||
function TRPSelectProduct:show()
|
||||
uiobjs.InputSeachKey.value = ""
|
||||
showHotWheel()
|
||||
NetProto.send.selectProductInfo(uiobjs.InputSeachKey.value, 1)
|
||||
self:showList({})
|
||||
end
|
||||
|
||||
function TRPSelectProduct:showList(products)
|
||||
SetActive(uiobjs.ButtonEndList.gameObject, false)
|
||||
local list = {}
|
||||
for i, v in ipairs(products or {}) do
|
||||
table.insert(list, {data = v, isSelected = selectedMap[v.id] and true or false})
|
||||
end
|
||||
uiobjs.Grid:setList(list, self:wrapFunc(self.initCell), nil, self:wrapFunc(self.onEndList))
|
||||
uiobjs.scrollView:ResetPosition()
|
||||
end
|
||||
function TRPSelectProduct:appList(list)
|
||||
SetActive(uiobjs.ButtonEndList.gameObject, false)
|
||||
uiobjs.Grid:appendList(list)
|
||||
end
|
||||
|
||||
function TRPSelectProduct:initCell(cell, data)
|
||||
cell:init(data, nil)
|
||||
end
|
||||
|
||||
function TRPSelectProduct:onEndList(tail)
|
||||
printw("到最后了==" .. tail.name)
|
||||
if self.pageInfo and self.pageInfo.current_page < self.pageInfo.total_pages then
|
||||
local queryKey = uiobjs.InputSeachKey.value
|
||||
showHotWheel()
|
||||
-- 取得下一页
|
||||
NetProto.send.selectProductInfo(queryKey, self.pageInfo.current_page + 1)
|
||||
else
|
||||
uiobjs.ButtonEndList.localPosition = tail.transform.localPosition + Vector3.up * -210
|
||||
SetActive(uiobjs.ButtonEndList.gameObject, true)
|
||||
end
|
||||
end
|
||||
|
||||
function TRPSelectProduct:getSelected()
|
||||
local list = {}
|
||||
if uiobjs.Grid.list ~= nil then
|
||||
for i = 0, uiobjs.Grid.list.Count - 1 do
|
||||
local d = uiobjs.Grid.list[i]
|
||||
if d.isSelected then
|
||||
d.data.productNum = d.data.productNum or 1
|
||||
d.data.productPrice = d.data.price
|
||||
table.insert(list, d.data)
|
||||
end
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
-- 刷新
|
||||
function TRPSelectProduct:refresh()
|
||||
end
|
||||
|
||||
-- 关闭页面
|
||||
function TRPSelectProduct:hide()
|
||||
end
|
||||
|
||||
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
||||
function TRPSelectProduct:procNetwork(cmd, succ, msg, paras)
|
||||
if (succ == NetSuccess) then
|
||||
if cmd == NetProto.cmds.selectProductInfo then
|
||||
local result = paras.result or {}
|
||||
self.pageInfo = result.meta
|
||||
if self.pageInfo and self.pageInfo.current_page > 1 then
|
||||
self:appList(result.data)
|
||||
else
|
||||
self:showList(result.data)
|
||||
end
|
||||
hideHotWheel()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TRPSelectProduct:setEventDelegate()
|
||||
self.EventDelegate = {
|
||||
ButtonCancel = function()
|
||||
hideTopPanel(self.csSelf)
|
||||
end,
|
||||
ButtonOkay = function()
|
||||
hideTopPanel(self.csSelf)
|
||||
Utl.doCallback(self.callback, self:getSelected())
|
||||
end
|
||||
}
|
||||
end
|
||||
-- 处理ui上的事件,例如点击等
|
||||
function TRPSelectProduct:uiEventDelegate(go)
|
||||
local func = self.EventDelegate[go.name]
|
||||
if func then
|
||||
func()
|
||||
end
|
||||
end
|
||||
|
||||
-- 当顶层页面发生变化时回调
|
||||
function TRPSelectProduct:onTopPanelChange(topPanel)
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return TRPSelectProduct
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86e6d69b882e04ce9889f5823ad95f66
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user