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
cd6737c1
authored
Dec 27, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into pre
parents
7c3549d8
98df262b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
165 additions
and
8 deletions
components/controller/chat-list.ts
components/message.vue
database/dev-tools.ts
event/index.ts
model/index.ts
model/order.ts
service/order.ts
components/controller/chat-list.ts
View file @
cd6737c1
...
...
@@ -61,6 +61,12 @@ export default class ChatList extends Vue {
@
chatStore
.
State
(
ChatStore
.
STATE_CURRENT_UNREAD_MESSAGE_COUNT
)
protected
readonly
unread
!
:
ChatStore
.
STATE_CURRENT_UNREAD_MESSAGE_COUNT
;
@
chatStore
.
Getter
(
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
)
protected
readonly
currentChat
!
:
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
;
@
chatStore
.
Action
(
ChatStore
.
ACTION_CHAT_FINISH_RECEPTION
)
protected
readonly
_finishReception
!
:
ChatStore
.
ACTION_CHAT_FINISH_RECEPTION
;
protected
parseMesage
(
data
:
ChatItem
)
{
if
(
data
.
last_msg_sender
&&
data
.
last_msg_sender
!==
"0"
)
{
if
(
this
.
userNames
[
data
.
last_msg_sender
]
===
undefined
)
{
...
...
components/message.vue
View file @
cd6737c1
...
...
@@ -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,15 @@
if
(
!
this
.
hoverWithdraw
())
{
return
Xim
.
error
(
"不能撤回"
);
}
if
(
dto
.
MessageTypeController
.
isChargeMessage
(
this
.
data
.
type
))
{
return
this
.
openMessage
({
type
:
MessageEvent
.
WithdrawCharge
,
model
:
{
payment
:
(
this
.
messageBody
.
msg
as
PayMessageBody
).
paymentId
,
msg
:
this
.
data
.
id
,
},
});
}
ximInstance
.
withdraw
(
this
.
chatId
,
this
.
data
.
id
).
finally
(()
=>
{
dbController
.
removeMessage
(
this
.
chatId
,
[
this
.
data
.
id
])
...
...
@@ -504,12 +519,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
)
{
...
...
database/dev-tools.ts
0 → 100644
View file @
cd6737c1
class
DevAppTools
{
private
db
!
:
IDBDatabase
;
private
readonly
key
=
'dev-tools'
;
private
readonly
valueKey
=
'value'
;
private
readonly
table
=
'dev-table'
;
private
onReady
()
{
if
(
this
.
db
)
{
return
Promise
.
resolve
();
}
return
new
Promise
<
void
>
((
resolve
=>
{
if
(
indexedDB
)
{
const
r
=
indexedDB
.
open
(
this
.
key
,
1
);
const
setupDb
=
()
=>
{
if
(
this
.
db
&&
!
this
.
db
.
objectStoreNames
.
contains
(
this
.
table
))
{
this
.
db
.
createObjectStore
(
this
.
table
,
{
keyPath
:
this
.
valueKey
});
}
resolve
();
};
r
.
onsuccess
=
(
e
)
=>
{
this
.
db
=
(
e
.
target
as
any
).
result
;
setupDb
();
};
r
.
onupgradeneeded
=
(
e
)
=>
{
this
.
db
=
(
e
.
target
as
any
).
result
;
setupDb
();
};
r
.
onerror
=
()
=>
setupDb
();
}
else
{
resolve
();
}
}));
}
private
buildTransaction
(
key
:
string
)
{
return
this
.
db
.
transaction
(
key
,
"readwrite"
);
}
private
buildStore
(
key
:
string
)
{
const
transaction
=
this
.
buildTransaction
(
key
);
return
transaction
.
objectStore
(
key
);
}
public
isOpen
()
{
return
new
Promise
<
boolean
>
((
resolve
)
=>
{
this
.
onReady
().
finally
(()
=>
{
if
(
!
this
.
db
)
{
return
resolve
(
false
);
}
setTimeout
(()
=>
{
const
store
=
this
.
buildStore
(
this
.
table
);
const
r
=
store
.
getKey
(
1
);
r
.
onsuccess
=
(
o
)
=>
resolve
((
o
.
target
as
any
).
result
);
r
.
onerror
=
()
=>
resolve
(
false
);
},
300
);
});
});
}
public
toggle
()
{
return
new
Promise
<
boolean
>
((
resolve
)
=>
{
this
.
onReady
().
finally
(()
=>
{
setTimeout
(()
=>
{
this
.
isOpen
().
then
(
r
=>
{
if
(
r
)
{
const
store
=
this
.
buildStore
(
this
.
table
);
const
d
=
store
.
delete
(
1
);
d
.
onsuccess
=
()
=>
resolve
(
false
);
d
.
onerror
=
()
=>
resolve
(
false
);
}
else
{
const
store
=
this
.
buildStore
(
this
.
table
);
const
d
=
store
.
add
({
value
:
1
});
d
.
onsuccess
=
()
=>
resolve
(
true
);
d
.
onerror
=
()
=>
resolve
(
true
);
}
});
},
300
);
});
});
}
}
export
const
devAppTools
=
new
DevAppTools
();
event/index.ts
View file @
cd6737c1
...
...
@@ -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 @
cd6737c1
...
...
@@ -305,3 +305,51 @@ export const enum IMCatalog {
Flb
=
"福利宝"
,
Order
=
"专项业务订单"
,
}
export
class
MessageTypeController
{
private
static
readonly
pays
=
new
Set
<
MessageType
>
([
MessageType
.
Pay
,
MessageType
.
PayResult
,
MessageType
.
PayV1
,
MessageType
.
Refund
,
MessageType
.
RefundV1
,
MessageType
.
Withdraw
,
]);
private
static
readonly
charges
=
new
Set
<
MessageType
>
([
MessageType
.
Pay
,
MessageType
.
PayV1
,
MessageType
.
Refund
,
MessageType
.
RefundV1
,
]);
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
(
"查看订单"
)
);
}
public
static
isOrderClosedMessage
(
e
:
Message
)
{
if
(
e
&&
e
.
msg
&&
!+
e
.
eid
)
{
const
msg
=
e
.
msg
;
return
(
msg
.
includes
(
"办理完成"
)
||
msg
.
includes
(
"办理失败"
)
||
msg
.
includes
(
"订单已取消"
)
);
}
return
false
;
}
}
model/order.ts
View file @
cd6737c1
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
;
...
...
service/order.ts
View file @
cd6737c1
...
...
@@ -224,7 +224,7 @@ class OrderService {
.
query
();
}
public
sendPayAccountInfo
(
params
:
{
send
:
string
})
{
public
sendPayAccountInfo
(
params
:
{
send
:
string
,
type
?:
number
})
{
return
this
.
getSdk
()
.
domainService
(
"hro_spview"
,
"OrderSetting"
,
"sendPayAccountInfo"
)
.
request
(
"get"
,
{
params
});
...
...
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