up
This commit is contained in:
@@ -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