Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8b626fd2
authored
Dec 27, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update withdraw message
parent
b509c106
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
11 deletions
components/message.vue
event/index.ts
model/index.ts
model/order.ts
components/message.vue
View file @
8b626fd2
...
...
@@ -170,10 +170,10 @@
import
{
ChatRole
}
from
"@/customer-service/model"
;
import
{
getUserMapping
}
from
"../utils/user-info"
;
import
Xim
from
"@/customer-service/xim"
;
import
{
CustomerServiceEvent
}
from
"../event"
;
import
{
CustomerServiceEvent
,
MessageEvent
}
from
"../event"
;
import
{
PayMessageBody
}
from
"../xim/models/chat"
;
const
twoMinutes
=
2
*
60
*
1000
;
const
twoHours
=
2
*
60
*
60
*
1000
;
const
messageMapping
=
new
Map
<
dto
.
MessageType
,
string
>
([
[
dto
.
MessageType
.
Image
,
"image-message"
],
...
...
@@ -269,12 +269,18 @@
private
isWithdraw
=
true
;
private
get
isPayMessage
()
{
return
dto
.
MessageTypeController
.
isPayMessage
(
this
.
data
.
type
);
}
private
get
canWithdraw
()
{
if
(
this
.
backend
&&
this
.
data
)
{
if
(
this
.
isPayMessage
)
{
return
true
;
}
if
(
this
.
needReadTip
)
{
return
new
Date
().
valueOf
()
-
this
.
data
.
ts
*
1000
<
twoMinutes
;
}
return
new
Date
().
valueOf
()
-
this
.
data
.
ts
*
1000
<
twoHours
;
}
return
false
;
}
...
...
@@ -493,6 +499,12 @@
if
(
!
this
.
hoverWithdraw
())
{
return
Xim
.
error
(
"不能撤回"
);
}
if
(
dto
.
MessageTypeController
.
isChargeMessage
(
this
.
data
.
type
))
{
return
this
.
openMessage
({
type
:
MessageEvent
.
WithdrawCharge
,
model
:
(
this
.
messageBody
.
msg
as
PayMessageBody
).
paymentId
,
});
}
ximInstance
.
withdraw
(
this
.
chatId
,
this
.
data
.
id
).
finally
(()
=>
{
dbController
.
removeMessage
(
this
.
chatId
,
[
this
.
data
.
id
])
...
...
@@ -504,12 +516,14 @@
}
private
hoverWithdraw
()
{
if
(
this
.
isPayMessage
)
{
return
true
;
}
if
(
!
this
.
isWithdraw
||
!
this
.
isMyMessage
)
{
return
false
;
}
return
(
this
.
isWithdraw
=
this
.
needReadTip
?
new
Date
().
valueOf
()
-
this
.
data
.
ts
*
1000
<
twoMinutes
:
new
Date
().
valueOf
()
-
this
.
data
.
ts
*
1000
<
twoHours
);
return
(
this
.
isWithdraw
=
new
Date
().
valueOf
()
-
this
.
data
.
ts
*
1000
<
twoMinutes
);
}
private
openReaderList
(
e
:
MouseEvent
)
{
...
...
event/index.ts
View file @
8b626fd2
...
...
@@ -2,6 +2,7 @@ export const enum MessageEvent {
Default
=
"open-message"
,
PayMessage
=
"pay-message"
,
PositionMessage
=
"position-message"
,
WithdrawCharge
=
"widthdraw-charge"
,
}
export
class
CustomerServiceEvent
{
...
...
model/index.ts
View file @
8b626fd2
...
...
@@ -306,7 +306,6 @@ export const enum IMCatalog {
Order
=
"专项业务订单"
,
}
export
class
MessageTypeController
{
private
static
readonly
pays
=
new
Set
<
MessageType
>
([
MessageType
.
Pay
,
...
...
@@ -314,21 +313,40 @@ export class MessageTypeController {
MessageType
.
PayV1
,
MessageType
.
Refund
,
MessageType
.
RefundV1
,
MessageType
.
Withdraw
MessageType
.
Withdraw
,
]);
private
static
readonly
charges
=
new
Set
<
MessageType
>
([
MessageType
.
Pay
,
MessageType
.
PayV1
,
]);
public
static
isPayMessage
(
type
:
MessageType
)
{
return
this
.
pays
.
has
(
type
);
}
public
static
isChargeMessage
(
type
:
MessageType
)
{
return
this
.
charges
.
has
(
type
);
}
public
static
isOrderOpenedMessage
(
e
:
Message
)
{
return
e
&&
!+
e
.
eid
&&
e
.
msg
&&
e
.
msg
.
includes
(
'订单详情'
)
&&
e
.
msg
.
includes
(
'查看订单'
);
return
(
e
&&
!+
e
.
eid
&&
e
.
msg
&&
e
.
msg
.
includes
(
"订单详情"
)
&&
e
.
msg
.
includes
(
"查看订单"
)
);
}
public
static
isOrderClosedMessage
(
e
:
Message
)
{
if
(
e
&&
e
.
msg
&&
!+
e
.
eid
)
{
const
msg
=
e
.
msg
;
return
msg
.
includes
(
'办理完成'
)
||
msg
.
includes
(
'办理失败'
)
||
msg
.
includes
(
'订单已取消'
);
return
(
msg
.
includes
(
"办理完成"
)
||
msg
.
includes
(
"办理失败"
)
||
msg
.
includes
(
"订单已取消"
)
);
}
return
false
;
}
...
...
model/order.ts
View file @
8b626fd2
import
{
Chat
}
from
"../xim/models/chat"
;
import
{
GeneralOrderDirection
}
from
'./order-product'
;
import
{
action
}
from
'uniplat-sdk'
;
export
interface
ChatGroup
extends
Chat
{
children
?:
ChatGroup
[];
...
...
@@ -143,7 +144,7 @@ export interface OrderPayItem {
desc
:
string
;
agent
:
string
;
createdTime
:
string
;
actions
?:
a
ny
[];
actions
?:
a
ction
[];
bankAccountName
?:
string
;
OpenningBankName
?:
string
;
bankAccountNo
?:
string
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment