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
89e76ac1
authored
Dec 13, 2021
by
zhousil
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into pre
parents
2a016425
959d9b39
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
99 additions
and
30 deletions
components/controller/index.ts
components/message-item/notify-message.vue
components/message-item/pay-message.vue
components/message.vue
model/index.ts
model/order.ts
service/order.ts
utils/index.ts
utils/user-info.ts
xim/models/chat.ts
xim/xim.ts
components/controller/index.ts
View file @
89e76ac1
...
@@ -14,6 +14,7 @@ const mapping = new Map<MessageType, string>([
...
@@ -14,6 +14,7 @@ const mapping = new Map<MessageType, string>([
[
MessageType
.
PayV1
,
'付款通知'
],
[
MessageType
.
PayV1
,
'付款通知'
],
[
MessageType
.
Refund
,
'退款通知'
],
[
MessageType
.
Refund
,
'退款通知'
],
[
MessageType
.
RefundV1
,
'退款通知'
],
[
MessageType
.
RefundV1
,
'退款通知'
],
[
MessageType
.
Notify
,
'通知'
],
])
])
export
function
parserMessage
(
type
:
MessageType
,
rawMsg
:
string
)
{
export
function
parserMessage
(
type
:
MessageType
,
rawMsg
:
string
)
{
...
...
components/message-item/notify-message.vue
0 → 100644
View file @
89e76ac1
<
template
>
<div
class=
"msg-detail inline-text"
v-html=
"notifyMessage"
></div>
</
template
>
<
script
lang=
"ts"
>
import
{
Component
}
from
"vue-property-decorator"
;
import
BaseMessage
from
"./index"
;
@
Component
({
components
:
{}
})
export
default
class
Index
extends
BaseMessage
{
private
get
notifyData
()
{
return
this
.
messageBody
.
msg
as
{
text
:
string
;
remark
:
string
;
resultId
:
string
;
};
}
private
get
notifyMessage
()
{
return
this
.
notifyData
?
this
.
notifyData
.
text
||
`
${
this
.
notifyData
.
remark
}
, 工单ID
${
this
.
notifyData
.
resultId
||
"无"
}
`
:
"[通知消息]"
;
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.inline-text
{
display
:
inline-block
;
white-space
:
pre-wrap
;
text-align
:
left
;
/deep/
.highlight
{
color
:
#e87005
;
}
}
</
style
>
\ No newline at end of file
components/message-item/pay-message.vue
View file @
89e76ac1
...
@@ -46,11 +46,11 @@
...
@@ -46,11 +46,11 @@
}
}
private
get
title
()
{
private
get
title
()
{
return
this
.
payData
.
itemName
;
return
this
.
payData
.
itemName
||
this
.
payData
.
totalName
;
}
}
private
get
amount
()
{
private
get
amount
()
{
return
+
this
.
payData
.
amount
;
return
+
this
.
payData
.
amount
||
this
.
payData
.
totalMoney
;
}
}
private
get
status
()
{
private
get
status
()
{
...
...
components/message.vue
View file @
89e76ac1
...
@@ -165,6 +165,7 @@
...
@@ -165,6 +165,7 @@
import
MyWelfareMessage
from
"./message-item/my-welfare-message.vue"
;
import
MyWelfareMessage
from
"./message-item/my-welfare-message.vue"
;
import
QuestionAnswerMessage
from
"./message-item/question-answer-message.vue"
;
import
QuestionAnswerMessage
from
"./message-item/question-answer-message.vue"
;
import
PayMessage
from
"./message-item/pay-message.vue"
;
import
PayMessage
from
"./message-item/pay-message.vue"
;
import
NotifyMessage
from
"./message-item/notify-message.vue"
;
import
{
ChatRole
}
from
"@/customer-service/model"
;
import
{
ChatRole
}
from
"@/customer-service/model"
;
import
{
getUserMapping
}
from
"../utils/user-info"
;
import
{
getUserMapping
}
from
"../utils/user-info"
;
import
Xim
from
"@/customer-service/xim"
;
import
Xim
from
"@/customer-service/xim"
;
...
@@ -187,6 +188,8 @@
...
@@ -187,6 +188,8 @@
[
dto
.
MessageType
.
PayV1
,
"pay-message"
],
[
dto
.
MessageType
.
PayV1
,
"pay-message"
],
[
dto
.
MessageType
.
Refund
,
"pay-message"
],
[
dto
.
MessageType
.
Refund
,
"pay-message"
],
[
dto
.
MessageType
.
RefundV1
,
"pay-message"
],
[
dto
.
MessageType
.
RefundV1
,
"pay-message"
],
[
dto
.
MessageType
.
PayResult
,
"notify-message"
],
[
dto
.
MessageType
.
Notify
,
"notify-message"
],
]);
]);
@
Component
({
@
Component
({
...
@@ -204,6 +207,7 @@
...
@@ -204,6 +207,7 @@
QuestionAnswerMessage
,
QuestionAnswerMessage
,
ActionMessage
,
ActionMessage
,
PayMessage
,
PayMessage
,
NotifyMessage
},
},
})
})
export
default
class
Message
extends
Vue
{
export
default
class
Message
extends
Vue
{
...
...
model/index.ts
View file @
89e76ac1
...
@@ -117,6 +117,7 @@ export const enum MessageType {
...
@@ -117,6 +117,7 @@ export const enum MessageType {
MpNavigate
=
"mp-navigate"
,
MpNavigate
=
"mp-navigate"
,
PayV1
=
'gpay'
,
PayV1
=
'gpay'
,
Pay
=
"gpay2"
,
Pay
=
"gpay2"
,
PayResult
=
"gresult"
,
RefundV1
=
'grefund'
,
RefundV1
=
'grefund'
,
Refund
=
"grefund2"
,
Refund
=
"grefund2"
,
Card
=
'card'
Card
=
'card'
...
...
model/order.ts
View file @
89e76ac1
...
@@ -58,6 +58,7 @@ export interface OrderTableListItem {
...
@@ -58,6 +58,7 @@ export interface OrderTableListItem {
lastMsgContent
:
string
;
lastMsgContent
:
string
;
lastMsgTime
:
string
;
lastMsgTime
:
string
;
unreadCount
:
number
;
unreadCount
:
number
;
PayPaymentNum
?:
string
|
number
;
//付款笔数
}
}
export
const
orderPredict
=
{
export
const
orderPredict
=
{
...
@@ -78,7 +79,8 @@ export const orderPredict = {
...
@@ -78,7 +79,8 @@ export const orderPredict = {
chatTypeCode
:
"UniplatChatTypeCode"
,
chatTypeCode
:
"UniplatChatTypeCode"
,
lastMsgContent
:
"UniplatLastMsgContent"
,
lastMsgContent
:
"UniplatLastMsgContent"
,
lastMsgTime
:
"UniplatLastMsgTime"
,
lastMsgTime
:
"UniplatLastMsgTime"
,
unreadCount
:
0
unreadCount
:
0
,
PayPaymentNum
:
"PayPaymentNum"
};
};
export
const
enum
PayStatus
{
export
const
enum
PayStatus
{
...
@@ -131,7 +133,7 @@ export interface OrderPayItem {
...
@@ -131,7 +133,7 @@ export interface OrderPayItem {
bankAccountName
?:
string
;
bankAccountName
?:
string
;
OpenningBankName
?:
string
;
OpenningBankName
?:
string
;
bankAccountNo
?:
string
;
bankAccountNo
?:
string
;
p
roviderHandle
Id
?:
number
;
p
aymentItem
Id
?:
number
;
}
}
export
const
orderPayItemPredict
=
{
export
const
orderPayItemPredict
=
{
...
@@ -150,7 +152,7 @@ export const orderPayItemPredict = {
...
@@ -150,7 +152,7 @@ export const orderPayItemPredict = {
bankAccountName
:
"ProviderHandleId#ServiceProviderBank.AccountName"
,
bankAccountName
:
"ProviderHandleId#ServiceProviderBank.AccountName"
,
OpenningBankName
:
"ProviderHandleId#ServiceProviderBank.OpenningBankName"
,
OpenningBankName
:
"ProviderHandleId#ServiceProviderBank.OpenningBankName"
,
bankAccountNo
:
"ProviderHandleId#ServiceProviderBank.AccountNo"
,
bankAccountNo
:
"ProviderHandleId#ServiceProviderBank.AccountNo"
,
p
roviderHandleId
:
"ProviderHandleId#ServiceProviderBank.ID
"
,
p
aymentItemId
:
"PaymentItemId
"
,
}
}
export
const
enum
ChatOpenDirection
{
export
const
enum
ChatOpenDirection
{
...
...
service/order.ts
View file @
89e76ac1
...
@@ -206,7 +206,7 @@ class OrderService {
...
@@ -206,7 +206,7 @@ class OrderService {
.
query
();
.
query
();
}
}
public
sendPayAccountInfo
(
params
:
{
send
:
string
;
accountId
:
number
})
{
public
sendPayAccountInfo
(
params
:
{
send
:
string
})
{
return
this
.
getSdk
().
domainService
(
"hro_spview"
,
"OrderSetting"
,
"sendPayAccountInfo"
)
return
this
.
getSdk
().
domainService
(
"hro_spview"
,
"OrderSetting"
,
"sendPayAccountInfo"
)
.
request
(
"get"
,
{
params
})
.
request
(
"get"
,
{
params
})
}
}
...
...
utils/index.ts
View file @
89e76ac1
/* eslint-disable */
/* eslint-disable */
export
function
throttle
(
time
:
number
=
100
)
{
export
function
throttle
(
time
:
number
=
100
)
{
let
pending
=
false
let
pending
=
false
return
function
(
target
:
any
,
name
:
string
):
any
{
return
function
(
target
:
any
,
name
:
string
):
any
{
const
originFunc
=
target
[
name
]
const
originFunc
=
target
[
name
]
const
newFunc
=
function
(
this
:
Vue
,
...
params
:
any
[])
{
const
newFunc
=
function
(
this
:
Vue
,
...
params
:
any
[])
{
if
(
pending
)
{
if
(
pending
)
{
return
return
}
}
...
@@ -22,7 +22,7 @@ export function throttle(time: number = 100) {
...
@@ -22,7 +22,7 @@ export function throttle(time: number = 100) {
}
}
export
function
unique
<
T
>
(
arr
:
T
[],
existed
:
(
item
:
T
,
all
:
T
[])
=>
number
)
{
export
function
unique
<
T
>
(
arr
:
T
[],
existed
:
(
item
:
T
,
all
:
T
[])
=>
number
)
{
return
arr
.
filter
(
function
(
item
,
index
,
arr
)
{
return
arr
.
filter
(
function
(
item
,
index
,
arr
)
{
return
index
===
existed
(
item
,
arr
)
return
index
===
existed
(
item
,
arr
)
})
})
}
}
...
@@ -62,10 +62,20 @@ const URL_REGEX =
...
@@ -62,10 +62,20 @@ const URL_REGEX =
const
LINE_URL_REGEX
=
const
LINE_URL_REGEX
=
/
((?:(?:
https
?
|ftp|file
)
:
\/\/
|www
\.
|ftp
\.)(?:\([
-A-Z0-9+&@#
\/
%=~_|$?!:,.
]
*
\)
|
[
-A-Z0-9+&@#
\/
%=~_|$?!:,.
])
*
(?:\([
-A-Z0-9+&@#
\/
%=~_|$?!:,.
]
*
\)
|
[
A-Z0-9+&@#
\/
%=~_|$
]))
/i
/
((?:(?:
https
?
|ftp|file
)
:
\/\/
|www
\.
|ftp
\.)(?:\([
-A-Z0-9+&@#
\/
%=~_|$?!:,.
]
*
\)
|
[
-A-Z0-9+&@#
\/
%=~_|$?!:,.
])
*
(?:\([
-A-Z0-9+&@#
\/
%=~_|$?!:,.
]
*
\)
|
[
A-Z0-9+&@#
\/
%=~_|$
]))
/i
const
mobile_reg
=
/
(
1
[
0-9_
]{8,14})
/ig
export
function
replaceText2Link
(
text
:
string
)
{
export
function
replaceText2Link
(
text
:
string
)
{
return
text
.
replace
(
URL_REGEX
,
'<a href="$1" target="_blank">$1</a>'
)
return
text
.
replace
(
URL_REGEX
,
'<a href="$1" target="_blank">$1</a>'
)
}
}
export
function
replaceText2Dom
(
text
:
string
,
className
:
string
)
{
return
text
.
replace
(
URL_REGEX
,
`<span class="
${
className
}
">$1</span>`
)
}
export
function
replacePhone2Dom
(
text
:
string
,
className
:
string
)
{
return
text
.
replace
(
mobile_reg
,
`<a href="tel:$1" class="
${
className
}
">$1</a>`
)
}
export
function
isUrl
(
text
:
string
)
{
export
function
isUrl
(
text
:
string
)
{
return
LINE_URL_REGEX
.
test
(
text
)
return
LINE_URL_REGEX
.
test
(
text
)
}
}
utils/user-info.ts
View file @
89e76ac1
...
@@ -11,30 +11,36 @@ export type UserMapping = {
...
@@ -11,30 +11,36 @@ export type UserMapping = {
const
userMapping
:
UserMapping
=
{};
const
userMapping
:
UserMapping
=
{};
interface
UserInfo
{
avatar_url
:
string
;
email
:
string
;
id
:
string
;
mobile
:
string
;
realname
:
string
;
uniplatId
:
string
;
username
:
string
;
}
export
const
getUserMapping
=
()
=>
userMapping
;
export
const
getUserMapping
=
()
=>
userMapping
;
export
async
function
getUserInfo
(
eid
:
string
,
sdk
?:
UniplatSdk
)
{
export
async
function
getUserInfo
(
eid
:
string
,
sdk
?:
UniplatSdk
)
{
if
(
userMapping
[
eid
])
{
if
(
userMapping
[
eid
])
{
return
userMapping
[
eid
];
return
userMapping
[
eid
];
}
}
if
(
!+
eid
)
{
if
(
!+
eid
||
+
eid
<
0
)
{
return
{
name
:
''
,
phone
:
''
,
icon
:
''
};
return
{
name
:
""
,
phone
:
""
,
icon
:
""
};
}
}
const
info
=
await
(
sdk
||
Chat
.
getSdk
())
const
info
=
await
(
sdk
||
Chat
.
getSdk
())
.
domainService
(
'passport'
,
'anonymous'
,
`oidc.account/user_info?id=
${
eid
}
`
)
.
domainService
(
.
request
<
any
,
any
,
{
"passport"
,
avatar_url
:
string
;
"anonymous"
,
email
:
string
;
`oidc.account/user_info?id=
${
eid
}
`
id
:
string
;
)
mobile
:
string
;
.
request
<
any
,
any
,
UserInfo
>
(
"get"
);
realname
:
string
;
uniplatId
:
string
;
username
:
string
;
}
>
(
'get'
);
const
data
=
{
const
data
=
{
name
:
info
.
username
||
info
.
realname
||
info
.
mobile
||
info
.
mobile
,
name
:
info
.
username
||
info
.
realname
||
info
.
mobile
||
info
.
mobile
,
phone
:
info
.
mobile
,
phone
:
info
.
mobile
,
icon
:
info
.
avatar_url
icon
:
info
.
avatar_url
,
};
};
userMapping
[
eid
]
=
data
;
userMapping
[
eid
]
=
data
;
return
data
;
return
data
;
...
...
xim/models/chat.ts
View file @
89e76ac1
...
@@ -2,7 +2,7 @@ import {
...
@@ -2,7 +2,7 @@ import {
MessageHandled
,
MessageHandled
,
MessageType
,
MessageType
,
PayMethod
,
PayMethod
,
PayStatus
PayStatus
,
}
from
"@/customer-service/model"
;
}
from
"@/customer-service/model"
;
export
interface
Chat
{
export
interface
Chat
{
...
@@ -208,6 +208,15 @@ export interface PayMessageBody {
...
@@ -208,6 +208,15 @@ export interface PayMessageBody {
itemName
:
string
;
itemName
:
string
;
amount
:
string
;
amount
:
string
;
paymentId
:
string
;
paymentId
:
string
;
/**
* 对应v1版本itemName
*/
totalName
?:
string
;
/**
* 对应v1版本amount
*/
totalMoney
?:
string
;
}
}
export
interface
CsUser
{
export
interface
CsUser
{
...
...
xim/xim.ts
View file @
89e76ac1
...
@@ -194,13 +194,9 @@ export class Xim {
...
@@ -194,13 +194,9 @@ export class Xim {
return
chat
return
chat
.
getSdk
()
.
getSdk
()
.
getAxios
()
.
getAxios
()
.
get
(
.
get
<
any
,
Message
[]
>
(
`/general/xim/model/
${
p
.
model
}
/
${
`/general/xim/model/
${
p
.
model
}
/
${
p
.
obj
}
/msgs?lid=
${
lid
}
&rid=
${
rid
}
&limit=
${
limit
}
&desc=
${
desc
?
0
:
1
}
`
p
.
obj
)
}
/msgs?lid=
${
lid
}
&rid=
${
rid
}
&limit=
${
limit
}
&desc=
${
desc
?
0
:
1
}
`
);
}
}
private
setMessagesRead
(
chatId
:
number
,
msg
:
Message
[])
{
private
setMessagesRead
(
chatId
:
number
,
msg
:
Message
[])
{
...
...
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