This commit is contained in:
2021-03-31 22:22:59 +08:00
parent e913caa8f8
commit bf55cc7e54
41 changed files with 2182 additions and 1013 deletions

View File

@@ -44,7 +44,8 @@ DBMessage.MsgType = {
SysNotice = 3, -- 系统通知
Task = 4,
Task4Cust = 5, -- 跟进客户
Task4Support = 6 -- 代办补货
Task4Support = 6, -- 代办补货
Timeout = 7 -- 到期提醒
}
DBMessage.ReadFlag = {
@@ -95,6 +96,7 @@ DBMessage.onGetMessage = function(type, list, meta)
end
---@param v _DBMessage
for i, v in ipairs(list) do
v.NOTICETYPE = type
table.insert(db.list[type], v) -- 倒序
end
-- //TODO:保存到本地
@@ -155,6 +157,14 @@ function DBMessage.getUnreadNum(type)
count = count + 1
end
end
elseif type == DBMessage.MsgType.Timeout then
local list = DBMessage.getMessages(DBMessage.MsgType.Timeout)
---@param v
for i, v in ipairs(list) do
if v.ReadFlag == DBMessage.ReadFlag.unread then
count = count + 1
end
end
end
return count

View File

@@ -33,6 +33,9 @@ DBRoot.funcs = {
[NetProto.cmds.replenish_query] = function(data) -- 待跟进客户
DBMessage.onGetMessage(DBMessage.MsgType.Task4Support, data.result.data)
end,
[NetProto.cmds.wforder_expiry_reminder] = function(data) -- 到期提醒
DBMessage.onGetMessage(DBMessage.MsgType.Timeout, data.result.data)
end,
[NetProto.cmds.filter_customers] = function(data) -- 过滤条件
DBCust.onGetFilter(data.result)
end,

View File

@@ -20,7 +20,7 @@ NetProto.setSever = function(_host, _port)
socketUrl = joinStr("ws://", host, ":", port, "/tr_socket/websocket/")
end
NetProto.isDebug = false
NetProto.isDebug = true
---@type Dist.SpringWebsocket.Client
local socket = Client4Stomp.self
@@ -276,6 +276,7 @@ NetProto.cmds = {
announcement_query = "announcement_query", -- 系统公告
booking_query = "booking_query", -- 待跟进客户
replenish_query = "replenish_query", -- 待补货
wforder_expiry_reminder = "wforder_expiry_reminder", -- 到期提醒
filter_customers = "filter_customers", -- 过滤条件
list_customers = "list_customers", -- 客户列表
person_view_query = "person_view_query", -- 头像
@@ -489,6 +490,14 @@ NetProto.send.booking_query = function(callback, timeOutSec)
NetProto.sendSocket(content, callback, timeOutSec)
end
---public 到期提醒
NetProto.send.wforder_expiry_reminder = function(callback, timeOutSec)
local content = {}
content.action = NetProto.cmds.wforder_expiry_reminder
content.groupId = NetProto.groupId
NetProto.sendSocket(content, callback, timeOutSec)
end
---public 待补货
NetProto.send.replenish_query = function(callback, timeOutSec)
local content = {}

View File

@@ -42,6 +42,15 @@ function _cell.show(go, data)
else
uiobjs.LabelTime.text = ""
end
elseif mData.type == DBMessage.MsgType.Timeout then
---@type _DBMessage
local newestMsg = DBMessage.getNewestMessage(mData.type)
uiobjs.LabelNewest.text = newestMsg and newestMsg.content or ""
if newestMsg then
uiobjs.LabelTime.text = newestMsg.createTime
else
uiobjs.LabelTime.text = ""
end
elseif mData.type == DBMessage.MsgType.Task then
---@type _DBTaskCust
-- local newestMsg = DBMessage.getNewestMessage(mData.type)

View File

@@ -47,7 +47,7 @@ function _cell.show(go, data)
mData.gap = math.abs(mData.gap)
uiobjs.SpritePersent.fillAmount = mData.finishPersent / 100
mData.finishPersent = string.format("%.2f", mData.finishPersent)
uiobjs.formRoot:setValue(mData)
end
end,

View File

@@ -24,14 +24,18 @@ function _cell.show(go, data)
mData = data
uiobjs.LabelStatus.text = mData.READFLAG == DBMessage.ReadFlag.unread and "未读" or "已读"
SetActive(uiobjs.SpriteReddot.gameObject, mData.READFLAG == DBMessage.ReadFlag.unread)
uiobjs.LabelTitle.text = mData.TITLE
local time = mData.CREATETIME
uiobjs.LabelTitle.text = mData.TITLE or mData.title
local time = mData.CREATETIME or mData.createTime
if time then
uiobjs.LabelTime.text = DateEx.formatByMs(time * 1000)
if(type(time) == "string") then
uiobjs.LabelTime.text = time
else
uiobjs.LabelTime.text = DateEx.formatByMs(time * 1000)
end
else
uiobjs.LabelTime.text = ""
end
uiobjs.LabelContent.text = mData.CONTENT
uiobjs.LabelContent.text = mData.CONTENT or mData.content
end
-- 取得数据

View File

@@ -54,7 +54,7 @@ function CLLPStart.setLuasAtBegainning()
ReporterMessageReceiver.self.gameObject:SetActive(true)
end
else
NetProto.isDebug = false
NetProto.isDebug = false or CLCfgBase.self.isEditMode
if ReporterMessageReceiver.self and ReporterMessageReceiver.self.gameObject then
ReporterMessageReceiver.self.gameObject:SetActive(false)
end

View File

@@ -10,7 +10,8 @@ local isShowdDragFrefresh = false
local dragVal = Vector3.zero
local objs = {}
local defaulList = {
{icon = "news_news_1", bgColor = 0xfff1c40f, type = DBMessage.MsgType.Sys, name = "公告"}
{icon = "news_news_1", bgColor = 0xfff1c40f, type = DBMessage.MsgType.Sys, name = "公告"},
{icon = "news_news_1", bgColor = 0xff2990dc, type = DBMessage.MsgType.Timeout, name = "到期提醒"}
-- {icon="news_news_2", bgColor=0xff2990dc,type=DBMessage.MsgType.SysNotice, name="系统消息"},
-- {icon="news_news_3", bgColor=0xff1abc9c,type=DBMessage.MsgType.Task, name="待办任务"},
}

View File

@@ -85,6 +85,7 @@ function TRPConnect.getDataFromServer()
5
)
NetProto.send.announcement_query()
NetProto.send.wforder_expiry_reminder()
NetProto.send.booking_query()
NetProto.send.replenish_query()
NetProto.send.load_wfTicket_Settings()

View File

@@ -10,9 +10,16 @@ function TRPEditPrice:init(csObj)
TRPEditPrice.super.init(self, csObj)
self:setEventDelegate()
---@type UITable
uiobjs.Table = getCC(self.csSelf.transform, "Table", "UITable")
---@type CLUIFormRoot
uiobjs.formRoot = self.csSelf:GetComponent("CLUIFormRoot")
uiobjs.formRoot = uiobjs.Table.gameObject:GetComponent("CLUIFormRoot")
---@type CLUIElement
uiobjs.InputNum = getCC(uiobjs.formRoot.transform, "InputNum", "CLUIElement")
---@type CLUIElement
uiobjs.InputStartTime = getCC(uiobjs.formRoot.transform, "InputStartTime", "CLUIElement")
---@type CLUIElement
uiobjs.InputEndTime = getCC(uiobjs.formRoot.transform, "InputEndTime", "CLUIElement")
end
-- 设置数据
@@ -25,6 +32,47 @@ end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPEditPrice:show()
uiobjs.formRoot:setValue(self.mdata)
-- 产品属性:1-服务类产品0/null为实物类产品
if (not isNilOrEmpty(self.mdata.productAttribute)) and tonumber(self.mdata.productAttribute) == 1 then
SetActive(uiobjs.InputStartTime.gameObject, true)
SetActive(uiobjs.InputEndTime.gameObject, true)
uiobjs.InputStartTime.value = self.mdata.validStartTime or DateEx.format(DateEx.fmt_yyyy_MM_dd)
self:calculateEndDate(uiobjs.InputStartTime.value)
else
SetActive(uiobjs.InputStartTime.gameObject, false)
SetActive(uiobjs.InputEndTime.gameObject, false)
end
uiobjs.Table:Reposition()
end
function TRPEditPrice:calculateEndDate(startDate)
if not uiobjs.InputEndTime.gameObject.activeInHierarchy then
return
end
local begain = DateTime.Now
if not isNilOrEmpty(startDate) then
local days = strSplit(startDate, "-")
begain = DateTime(tonumber(days[1]), tonumber(days[2]), tonumber(days[3]))
end
local enddate
local num = tonumber(uiobjs.InputNum.value) or 1
--服务产品消耗时间类型默认NULL0按日1按月2按季度3按年
if not isNilOrEmpty(self.mdata.productComsuingType) then
local productComsuingType = tonumber(self.mdata.productComsuingType)
if productComsuingType == 0 then
enddate = begain:AddDays(num)
elseif productComsuingType == 1 then
enddate = begain:AddMonths(num)
elseif productComsuingType == 2 then
enddate = begain:AddMonths(num * 3)
elseif productComsuingType == 3 then
enddate = begain:AddYears(num)
else
return ""
end
uiobjs.InputEndTime.value = enddate:ToString(DateEx.fmt_yyyy_MM_dd)
end
return ""
end
-- 刷新
@@ -57,7 +105,19 @@ function TRPEditPrice:setEventDelegate()
MyUtl.toastW("数量不能低于1")
return
end
if (not isNilOrEmpty(self.mdata.productAttribute)) and tonumber(self.mdata.productAttribute) == 1 then
if isNilOrEmpty(uiobjs.InputStartTime.value) then
MyUtl.toastW("请设置开始日期")
return
end
end
Utl.doCallback(callback, self.mdata)
end,
InputNum = function()
self:calculateEndDate(uiobjs.InputStartTime.value)
end,
InputStartTime = function()
self:calculateEndDate(uiobjs.InputStartTime.value)
end
}
end

View File

@@ -90,6 +90,10 @@ function TRPSelectProduct:getSelected()
if d.isSelected then
d.data.productNum = d.data.productNum or 1
d.data.productPrice = d.data.price
if (not isNilOrEmpty(d.data.productAttribute)) and tonumber(d.data.productAttribute) == 1 then
d.data.validStartTime = DateEx.format(DateEx.fmt_yyyy_MM_dd)
d.data.validEndTime = self:calculateEndDate(d.data)
end
table.insert(list, d.data)
end
end
@@ -97,6 +101,30 @@ function TRPSelectProduct:getSelected()
return list
end
function TRPSelectProduct:calculateEndDate(data)
local days = strSplit(data.validStartTime, "-")
local begain = DateTime(tonumber(days[1]), tonumber(days[2]), tonumber(days[3]))
local enddate
local num = data.productNum or 1
--服务产品消耗时间类型默认NULL0按日1按月2按季度3按年
if not isNilOrEmpty(data.productComsuingType) then
local productComsuingType = tonumber(data.productComsuingType)
if productComsuingType == 0 then
enddate = begain:AddDays(num)
elseif productComsuingType == 1 then
enddate = begain:AddMonths(num)
elseif productComsuingType == 2 then
enddate = begain:AddMonths(num * 3)
elseif productComsuingType == 3 then
enddate = begain:AddYears(num)
else
return ""
end
return enddate:ToString(DateEx.fmt_yyyy_MM_dd)
end
return ""
end
-- 刷新
function TRPSelectProduct:refresh()
end

View File

@@ -40,9 +40,19 @@ function TRPSysMsgDetail:onShowFrame(cs)
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPSysMsgDetail:show()
self.uiobjs.LabelContent.text = joinStr(" ", self.mdata.CONTENT)
self.uiobjs.LabelTime.text = self.mdata.CREATETIME and DateEx.formatByMs(tonumber(self.mdata.CREATETIME) * 1000) or ""
self.uiobjs.LabelTitle.text = self.mdata.TITLE
self.uiobjs.LabelContent.text = joinStr(" ", self.mdata.CONTENT or self.mdata.content)
local time = self.mdata.CREATETIME or self.mdata.createTime
if time then
if(type(time) == "string") then
self.uiobjs.LabelTime.text = time
else
self.uiobjs.LabelTime.text = DateEx.formatByMs(time * 1000)
end
else
self.uiobjs.LabelTime.text = ""
end
self.uiobjs.LabelTitle.text = self.mdata.TITLE or self.mdata.title
self.uiobjs.scrollView:ResetPosition()
end

View File

@@ -35,6 +35,8 @@ function TRPSysMsgList:onShowFrame(cs)
d.title = "公告"
elseif self.mdata.type == DBMessage.MsgType.Task then
d.title = "代办任务"
elseif self.mdata.type == DBMessage.MsgType.Timeout then
d.title = "到期提醒"
end
d.panel = cs
@@ -106,7 +108,10 @@ function TRPSysMsgList:onClickCell(cell, data)
getPanelAsy("PanelSysMsgDetail", onLoadedPanelTT, data)
elseif data.NOTICETYPE == DBMessage.MsgType.Task4Cust then
getPanelAsy("PanelCustListProc", onLoadedPanelTT, data)
elseif data.NOTICETYPE == DBMessage.MsgType.Timeout then
getPanelAsy("PanelSysMsgDetail", onLoadedPanelTT, data)
else
printw("没有处理该消息类型", data.NOTICETYPE)
end
end