Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a68bd6cb
authored
Feb 25, 2022
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
--no commit message
1 parent
0deecd14
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
104 additions
and
69 deletions
linkwe-mobile/src/api/common.js
linkwe-mobile/src/config.js
linkwe-mobile/src/utils/index.js
linkwe-mobile/src/views/redPacket/index.vue
linkwe-mobile/src/views/redPacket/receive.vue
linkwe-ui/src/api/redPacketTool/staffManage.js
linkwe-ui/src/views/redPacketTool/staffManage.vue
linkwe-mobile/src/api/common.js
View file @
a68bd6c
...
...
@@ -50,7 +50,7 @@ export function getUserInfo(code, agentId) {
* @returns
*/
export
function
getUserOpenid
(
code
)
{
return
request
({
url
:
`http://demo.linkwechat.cn:80
9
0/weixin/auth/getToken?code=
${
code
}
`
})
return
request
({
url
:
`http://demo.linkwechat.cn:80
7
0/weixin/auth/getToken?code=
${
code
}
`
})
}
/**
...
...
@@ -59,7 +59,7 @@ export function getUserOpenid(code) {
*/
export
function
getWechatUserInfo
(
openId
)
{
return
request
({
url
:
`http://demo.linkwechat.cn:80
9
0/weixin/auth/getUserInfo`
,
url
:
`http://demo.linkwechat.cn:80
7
0/weixin/auth/getUserInfo`
,
params
:
{
openId
,
lang
:
'zh_CN'
,
...
...
linkwe-mobile/src/config.js
View file @
a68bd6c
...
...
@@ -2,9 +2,9 @@ const config = {
appId
:
'wx863c031a74f589a0'
,
// 微信公众号id
cookieExpires
:
1
,
//token在Cookie中存储的天数,默认1天
homeName
:
'home'
,
//默认打开的首页的路由name值,默认为home
services
=
{
services
:
{
wecom
:
'/wecom'
,
}
}
,
}
export
default
config
linkwe-mobile/src/utils/index.js
View file @
a68bd6c
...
...
@@ -59,17 +59,17 @@ export function getQueryValue(name) {
export
async
function
getWxCode
()
{
let
userinfo
=
localStorage
.
getItem
(
'userinfo'
)
//取缓存中的用户信息
if
(
userinfo
)
{
try
{
userinfo
=
JSON
.
parse
(
userinfo
)
}
catch
(
error
)
{
alert
(
error
)
}
return
}
//
if (userinfo) {
//
try {
//
userinfo = JSON.parse(userinfo)
//
} catch (error) {
//
alert(error)
//
}
// return userinfo.openId
//
}
//缓存中没有用户信息,进入授权流程
let
appid
=
'wx863c031a74f589a0'
// 公众号appid
let
appid
=
window
.
CONFIG
.
appId
// 公众号appid
// let appid = 'wx8bfe6bc2ca5c45ae' // 公众号appid
let
code
=
getQueryValue
(
'code'
)
//是否存在code
let
local
=
window
.
location
.
origin
.
includes
(
'localhost'
)
...
...
@@ -78,15 +78,22 @@ export async function getWxCode() {
// let local = 'http://h5.x*****o.com/'
if
(
!
code
)
{
//不存在就打开上面的地址进行授权
window
.
location
.
href
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=
${
appid
}
&redirect_uri=
${
encodeURIComponent
(
let
url
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=
${
appid
}
&redirect_uri=
${
encodeURIComponent
(
local
)}
&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
return
false
window
.
location
.
href
=
url
return
// window.location.href =
// `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`;
}
let
{
data
}
=
getUserOpenid
(
code
)
let
data
=
''
try
{
data
=
await
getUserOpenid
(
code
)
}
catch
(
error
)
{
alert
(
error
)
}
data
=
data
.
data
if
(
data
&&
data
.
openId
)
{
localStorage
.
setItem
(
'userinfo'
,
JSON
.
stringify
(
data
))
return
data
.
openId
...
...
linkwe-mobile/src/views/redPacket/index.vue
View file @
a68bd6c
<
script
>
import
{
getList
}
from
'@/api/redPacket.js'
import
{
getList
,
sendCustomerPersonalRedPacket
,
sendCustomerEnterpriseRedPacket
,
sendCustomerGroupPersonalRedPacket
,
sendCustomerGroupEnterpriseRedPacket
,
}
from
'@/api/redPacket.js'
import
{
obj2query
,
param2Obj
}
from
'@/utils/index.js'
export
default
{
name
:
''
,
...
...
@@ -125,28 +131,54 @@ export default {
})
},
showDialog
(
type
,
row
=
{})
{
this
.
form
=
{
redEnvelopeAmount
:
row
.
money
,
redenvelopesId
:
row
.
id
}
this
.
form
=
{
redEnvelopeAmount
:
row
.
money
,
redenvelopesId
:
row
.
id
,
externalUserid
:
this
.
form
.
externalUserid
}
this
.
redPacketType
=
type
this
.
visible
=
true
},
// transMoney(value) {
// this.form.redEnvelopeAmount = +(+value).toFixed(2)
// },
async
send
()
{
sendRedPacket
()
{
this
.
$toast
.
loading
({
duration
:
0
,
forbidClick
:
true
,
})
let
request
=
''
if
(
this
.
form
.
sceneType
==
1
)
{
request
=
{
personal
:
sendCustomerPersonalRedPacket
,
enterprise
:
sendCustomerEnterpriseRedPacket
,
}[
this
.
redPacketType
]
}
else
{
request
=
{
personal
:
sendCustomerGroupPersonalRedPacket
,
enterprise
:
sendCustomerGroupEnterpriseRedPacket
,
}[
this
.
redPacketType
]
}
let
form
=
Object
.
assign
({},
this
.
form
)
// 单位换算 元转分
form
.
redEnvelopeAmount
*=
100
request
(
form
).
then
(({
data
,
msg
})
=>
{
this
.
$toast
.
clear
()
this
.
send
(
form
,
data
||
msg
)
})
},
async
send
(
form
,
orderId
)
{
let
that
=
this
let
mes
=
{}
try
{
let
form
=
Object
.
assign
({},
this
.
form
)
// 单位换算 元转分
form
.
redEnvelopeAmount
*=
100
let
query
=
param2Obj
(
window
.
location
.
search
)
let
hash
=
param2Obj
(
window
.
location
.
hash
)
Object
.
assign
(
form
,
{
sendUserId
:
this
.
userId
,
sceneType
:
this
.
sceneType
,
redPacketType
:
this
.
redPacketType
},
{
orderId
,
sendUserId
:
this
.
userId
,
},
query
,
hash
)
delete
form
.
code
let
formQueryString
=
obj2query
(
form
)
let
baseUrl
=
location
.
protocol
+
'//'
+
location
.
host
+
process
.
env
.
VUE_APP_BASE_URL
let
redPacketUrl
=
`
${
baseUrl
}
?
${
formQueryString
}
#/redPacketReceive`
...
...
@@ -212,7 +244,7 @@ export default {
v-model=
"visible"
:description=
"(redPacketType.includes('personal') ? '个人' : '企业') + '红包'"
>
<van-form
colon
@
submit=
"send"
>
<van-form
colon
@
submit=
"send
RedPacket
"
>
<!-- 企业红包相关字段 -->
<van-field
v-if=
"redPacketType.includes('enterprise')"
...
...
linkwe-mobile/src/views/redPacket/receive.vue
View file @
a68bd6c
<
script
>
import
{
sendCustomerPersonalRedPacket
,
sendCustomerEnterpriseRedPacket
,
sendCustomerGroupPersonalRedPacket
,
sendCustomerGroupEnterpriseRedPacket
,
receiveRedPacket
,
getReceiveList
,
}
from
'@/api/redPacket.js'
import
{
receiveRedPacket
,
getReceiveList
}
from
'@/api/redPacket.js'
import
{
param2Obj
,
getWxCode
}
from
'@/utils/index.js'
export
default
{
name
:
''
,
...
...
@@ -16,57 +9,41 @@ export default {
list
:
[],
opened
:
false
,
redPacket
:
{},
form
:
{
orderNo
:
''
,
// 订单id
openId
:
''
,
// 客户公众号id
appId
:
window
.
CONFIG
.
appId
,
// 微信公众号id
externalUserid
:
''
,
// 客户企微id
},
}
},
computed
:
{},
watch
:
{},
created
()
{
this
.
init
()
this
.
sendRedPacket
()
},
mounted
()
{},
methods
:
{
init
()
{
getWxCode
().
then
((
openId
)
=>
(
this
.
form
.
openId
=
openId
))
},
sendRedPacket
()
{
this
.
$toast
.
loading
({
duration
:
0
,
forbidClick
:
true
,
})
getWxCode
().
then
((
openId
)
=>
{
if
(
openId
)
{
this
.
receive
(
openId
)
}
else
{
this
.
$toast
.
clear
()
}
})
},
receive
(
openId
)
{
let
query
=
param2Obj
(
window
.
location
.
search
)
let
hash
=
param2Obj
(
window
.
location
.
hash
)
Object
.
assign
(
query
,
hash
)
this
.
redPacket
=
query
this
.
form
.
externalUserid
=
query
.
externalUserid
let
request
=
''
if
(
query
.
sceneType
==
1
)
{
request
=
{
personal
:
sendCustomerPersonalRedPacket
,
enterprise
:
sendCustomerEnterpriseRedPacket
,
}[
query
.
redPacketType
]
}
else
{
request
=
{
personal
:
sendCustomerGroupPersonalRedPacket
,
enterprise
:
sendCustomerGroupEnterpriseRedPacket
,
}[
query
.
redPacketType
]
let
form
=
{
orderNo
:
query
.
orderId
,
// 订单id
openId
,
// 客户公众号id
appId
:
window
.
CONFIG
.
appId
,
// 微信公众号id
externalUserid
:
query
.
externalUserid
,
// 客户企微id
}
request
(
query
).
then
((
res
)
=>
{
this
.
$toast
.
clear
()
})
},
receive
()
{
this
.
$toast
.
loading
({
duration
:
0
,
forbidClick
:
true
,
})
receiveRedPacket
()
receiveRedPacket
(
form
)
.
then
(()
=>
{
return
getReceiveList
()
})
...
...
linkwe-ui/src/api/redPacketTool/staffManage.js
View file @
a68bd6c
...
...
@@ -8,6 +8,21 @@ const service = window.CONFIG.services.system + window.CONFIG.services.wecom + '
pageNum 是 当前页
pageSize 是 每页显示条数
userId 是 检索条件,传员工id
return [
{
"id": 1483367396696686593,//主键
"userId": "haon",//员工id
"singleCustomerReceiveNum": 90,//限额总笔数
"singleCustomerReceiveMoney": 90,//限额总金额
"todayIssuedAmount": 0,//今日已发放金额
"todayNoIssuedAmount": 90,//今日未发放金额
"todayIssuedNum": 0,//今日已发放次数
"todayNoIssuedNum": 90,//今日未发放次数
"totalIssuedNum": 0,//累计发放次数
"totalIssuedAmount": 0,//累计方法金额
"userName": null //员工姓名
}
]
}
*/
export
function
getList
(
params
)
{
...
...
linkwe-ui/src/views/redPacketTool/staffManage.vue
View file @
a68bd6c
...
...
@@ -48,12 +48,12 @@
</el-table-column>
<el-table-column
label=
"今日已发放金额/剩余金额"
align=
"center"
>
<
template
slot-scope=
"{ row }"
>
{{
row
.
todayIssuedAmount
}}
/
{{
row
.
todayIssuedAmount
-
row
.
singleCustomerReceiveMoney
}}
{{
row
.
todayIssuedAmount
}}
/
{{
row
.
todayIssuedAmount
-
row
.
todayNoIssuedAmount
}}
</
template
>
</el-table-column>
<el-table-column
label=
"今日已发放次数/剩余次数"
align=
"center"
>
<
template
slot-scope=
"{ row }"
>
{{
row
.
todayIssuedNum
}}
/
{{
row
.
todayIssuedNum
-
row
.
singleCustomerReceive
Num
}}
{{
row
.
todayIssuedNum
}}
/
{{
row
.
todayIssuedNum
-
row
.
todayNoIssued
Num
}}
</
template
>
</el-table-column>
<el-table-column
label=
"累计已发放次数/金额"
align=
"center"
width=
"180"
>
...
...
@@ -225,8 +225,9 @@ export default {
this
.
query
.
userId
=
''
this
.
getList
(
1
)
},
edit
(
row
)
{
this
.
addMemberForm
=
Object
.
assign
({},
row
||
defaultForm
)
edit
(
row
=
defaultForm
)
{
this
.
addMemberForm
=
Object
.
assign
({},
row
)
this
.
addMemberForm
.
singleCustomerReceiveMoney
/=
100
this
.
addVisible
=
true
this
.
$nextTick
(()
=>
this
.
$refs
.
addMemberForm
.
clearValidate
())
},
...
...
@@ -259,7 +260,10 @@ export default {
}
this
.
$refs
.
addMemberForm
.
validate
((
validate
)
=>
{
if
(
!
validate
)
return
;(
this
.
batchUpdate
?
batchUpdate
:
addOrUpdate
)(
this
.
addMemberForm
).
then
((
res
)
=>
{
let
form
=
Object
.
assign
({},
this
.
addMemberForm
)
form
.
singleCustomerReceiveMoney
/=
100
;(
this
.
batchUpdate
?
batchUpdate
:
addOrUpdate
)(
form
).
then
((
res
)
=>
{
this
.
getList
()
this
.
addVisible
=
false
this
.
msgSuccess
(
'操作成功'
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment