Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-marketing
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 6bd370cd
authored
Jul 08, 2022
by
张权
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
定向礼包开发
1 parent
4ceee9cf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
12 deletions
src/api/modules/giftBag.js
src/common/constant.js
src/views/giftBag/giftList.vue
src/api/modules/giftBag.js
View file @
6bd370c
...
@@ -130,4 +130,14 @@ const toVoidGift = params => {
...
@@ -130,4 +130,14 @@ const toVoidGift = params => {
})
})
}
}
export
default
{
getFollowerStaffListApi
,
getListApi
,
giftExportApi
,
deleteGiftApi
,
getGiftInfoApi
,
getReceivedGiftInfoApi
,
exportGiftInfoApi
,
getDirectionalGiftListApi
,
insertGiftApi
,
templateModal
,
getghDirectionalGiftListApi
,
toVoidGift
}
const
getQrcode
=
params
=>
{
params
.
method
=
'scrm.api.coupon.directional.gift.qr.code'
return
http
({
url
:
'rop-scrm-coupon/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
})
}
export
default
{
getFollowerStaffListApi
,
getListApi
,
giftExportApi
,
deleteGiftApi
,
getGiftInfoApi
,
getReceivedGiftInfoApi
,
exportGiftInfoApi
,
getDirectionalGiftListApi
,
insertGiftApi
,
templateModal
,
getghDirectionalGiftListApi
,
toVoidGift
,
getQrcode
}
src/common/constant.js
View file @
6bd370c
...
@@ -31,6 +31,27 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max
...
@@ -31,6 +31,27 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max
}
}
}
}
function
downloadIamge
(
imgsrc
,
name
=
new
Date
().
getTime
())
{
//下载图片地址和图片名
var
image
=
new
Image
()
// 解决跨域 Canvas 污染问题
image
.
setAttribute
(
'crossOrigin'
,
'anonymous'
)
image
.
onload
=
function
()
{
var
canvas
=
document
.
createElement
(
'canvas'
)
canvas
.
width
=
image
.
width
canvas
.
height
=
image
.
height
var
context
=
canvas
.
getContext
(
'2d'
)
context
.
drawImage
(
image
,
0
,
0
,
image
.
width
,
image
.
height
)
var
url
=
canvas
.
toDataURL
(
'image/png'
)
//得到图片的base64编码数据
var
a
=
document
.
createElement
(
'a'
)
// 生成一个a元素
var
event
=
new
MouseEvent
(
'click'
)
// 创建一个单击事件
a
.
download
=
name
||
'photo'
// 设置图片名称
a
.
href
=
url
// 将生成的URL设置为a.href属性
a
.
dispatchEvent
(
event
)
// 触发a的单击事件
}
image
.
src
=
imgsrc
}
function
getExplorer
()
{
function
getExplorer
()
{
var
ua
=
navigator
.
userAgent
.
toLocaleLowerCase
()
var
ua
=
navigator
.
userAgent
.
toLocaleLowerCase
()
var
browserType
=
null
var
browserType
=
null
...
@@ -204,4 +225,4 @@ const stateList = [
...
@@ -204,4 +225,4 @@ const stateList = [
}
}
]
]
export
{
limitPrice
,
getExplorer
,
exportFn
,
aToExport
,
orderManageStatusList
,
afterSaleStatusList
,
orderSourceList
,
deliveryTypeList
,
statusList
,
serviceStatusList
,
memberTypeList
,
stateList
,
orderTypesList
,
orderStatusList
}
export
{
limitPrice
,
getExplorer
,
exportFn
,
aToExport
,
downloadIamge
,
orderManageStatusList
,
afterSaleStatusList
,
orderSourceList
,
deliveryTypeList
,
statusList
,
serviceStatusList
,
memberTypeList
,
stateList
,
orderTypesList
,
orderStatusList
}
src/views/giftBag/giftList.vue
View file @
6bd370c
...
@@ -40,13 +40,15 @@
...
@@ -40,13 +40,15 @@
</GLTable>
</GLTable>
<!-- 表格区域 end -->
<!-- 表格区域 end -->
</div>
</div>
<glsx-dialog
class=
"dialog"
width=
"720px"
title=
"生成二维码"
btnOkLabel=
"下载"
:isVisible
.
sync=
"isQrcodeVisible"
@
confirmDialog=
"handleCancelConfirm"
@
closeDialog=
"handleCancelClose"
>
<glsx-dialog
class=
"
qr-
dialog"
width=
"720px"
title=
"生成二维码"
btnOkLabel=
"下载"
:isVisible
.
sync=
"isQrcodeVisible"
@
confirmDialog=
"handleCancelConfirm"
@
closeDialog=
"handleCancelClose"
>
<div
class=
"qrcode-body"
>
<div
class=
"qrcode-body"
>
<p>
可生成对应发放员工的领取二维码
</p>
<p>
可生成对应发放员工的
小程序
领取二维码
</p>
<el-select
v-model=
"curStaff
"
placeholder=
"请选择
"
>
<el-select
v-model=
"curStaff
Id"
@
change=
"changeStaff"
placeholder=
"请选择发放员工
"
>
<el-option
v-for=
"item in curStaffList"
:key=
"item.staffUUID"
:label=
"item.staffName"
:value=
"item.staffUUID"
></el-option>
<el-option
v-for=
"item in curStaffList"
:key=
"item.staffUUID"
:label=
"item.staffName"
:value=
"item.staffUUID"
></el-option>
</el-select>
</el-select>
<img
:src=
"url"
alt=
""
/>
<div
class=
"img"
v-loading=
"imgLoading"
>
<el-image
:src=
"curQrcode"
alt=
""
></el-image>
</div>
</div>
</div>
</glsx-dialog>
</glsx-dialog>
</div>
</div>
...
@@ -55,7 +57,7 @@
...
@@ -55,7 +57,7 @@
<
script
>
<
script
>
import
*
as
dayjs
from
'dayjs'
import
*
as
dayjs
from
'dayjs'
import
url
from
'@/assets/empty.png'
import
url
from
'@/assets/empty.png'
import
{
aToExport
}
from
'@/common/constant'
import
{
aToExport
,
downloadIamge
}
from
'@/common/constant'
import
glsxDialog
from
'@/components/glsx-dialog'
import
glsxDialog
from
'@/components/glsx-dialog'
export
default
{
export
default
{
name
:
'giftList'
,
name
:
'giftList'
,
...
@@ -65,8 +67,11 @@ export default {
...
@@ -65,8 +67,11 @@ export default {
data
()
{
data
()
{
return
{
return
{
isQrcodeVisible
:
false
,
isQrcodeVisible
:
false
,
curStaff
:
''
,
curId
:
''
,
curStaffId
:
''
,
imgLoading
:
false
,
curStaffList
:
[],
curStaffList
:
[],
curQrcode
:
''
,
attrToIcon
:
{
attrToIcon
:
{
2
:
'discount'
,
2
:
'discount'
,
3
:
'cash'
,
3
:
'cash'
,
...
@@ -290,16 +295,52 @@ export default {
...
@@ -290,16 +295,52 @@ export default {
},
},
methods
:
{
methods
:
{
getQrcode
(
staffId
)
{
// 正式版为:release,体验版为: trial 开发版为:develop
let
merchantId
=
this
.
$globalState
.
session
.
merchantId
const
appId
=
this
.
getAppId
()
const
params
=
{
appId
,
path
:
'packageEquity/pages/directional/directional'
,
envVersion
:
process
.
env
.
NODE_ENV
===
'production'
?
'release'
:
'trial'
,
scene
:
`id=
${
this
.
curId
}
&merchantId=
${
merchantId
}
&staffUUID=
${
staffId
}
`
}
this
.
imgLoading
=
true
this
.
$apis
.
giftBag
.
getQrcode
(
params
).
then
(
res
=>
{
if
(
res
)
{
this
.
curQrcode
=
res
}
this
.
imgLoading
=
false
})
},
getAppId
(){
const
host
=
window
.
location
.
host
if
(
host
.
indexOf
(
'beta'
)
>-
1
){
return
'wx9f91c1ec493eb425'
}
else
if
(
host
.
indexOf
(
'cgacar'
)
>-
1
){
return
'wxfe82b8d65d07808f'
}
else
{
return
'wxe10067a63c1856ac'
}
},
changeStaff
(
e
)
{
this
.
getQrcode
(
e
)
},
makeQrcode
(
row
)
{
makeQrcode
(
row
)
{
this
.
curId
=
row
.
id
this
.
curStaffList
=
row
.
staffList
this
.
curStaffList
=
row
.
staffList
this
.
curStaffId
=
row
.
staffList
[
0
].
staffUUID
this
.
isQrcodeVisible
=
true
this
.
isQrcodeVisible
=
true
this
.
getQrcode
(
this
.
curStaffId
)
},
},
handleCancelConfirm
()
{
handleCancelConfirm
()
{
downloadIamge
(
this
.
curQrcode
)
this
.
handleCancelClose
()
this
.
handleCancelClose
()
},
},
handleCancelClose
()
{
handleCancelClose
()
{
console
.
log
(
this
.
curStaff
)
this
.
curId
=
''
this
.
curStaff
=
''
this
.
curStaffId
=
''
this
.
curQrcode
=
''
this
.
curStaffList
=
[]
this
.
curStaffList
=
[]
this
.
isQrcodeVisible
=
false
this
.
isQrcodeVisible
=
false
},
},
...
@@ -455,9 +496,12 @@ export default {
...
@@ -455,9 +496,12 @@ export default {
display
:
inline-block
;
display
:
inline-block
;
}
}
.dialog
{
.
qr-
dialog
{
/deep/.el-dialog__body
{
/deep/.el-dialog__body
{
padding
:
20px
;
padding
:
20px
;
.el-scrollbar__wrap
{
overflow
:
hidden
;
}
.qrcode-body
{
.qrcode-body
{
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
...
@@ -475,10 +519,13 @@ export default {
...
@@ -475,10 +519,13 @@ export default {
line-height
:
36px
;
line-height
:
36px
;
}
}
}
}
.img
{
margin-top
:
16px
;
&,
img
{
img
{
width
:
160px
;
width
:
160px
;
height
:
160px
;
height
:
160px
;
margin-top
:
16px
;
}
}
}
}
}
}
}
...
...
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