InviteDialog.vue
2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!-- 邀请销售顾问 -->
<template>
<GLDialog title="邀请销售顾问" mode="mid" :visible.sync="isVisible" :before-close="handleClose" @onOk="handleClose" @onCancel="handleClose">
<div class="share-dialog">
<div class="box">
<div class="title">邀请方式1:二维码邀请</div>
<div class="flex">
<img style="width: 118px; height: 118px;" :src="inviteData.qrcodeUrl" />
<el-button style="padding: 8px 0;" :size="size" type="text" @click="handleSaveImg(inviteData.qrcodeUrl)">下载图片</el-button>
</div>
</div>
<div class="box">
<div class="title">邀请方式2:链接邀请</div>
<span class="txt-blue">{{ inviteData.inviteUrl }}</span>
<el-button :size="size" type="text" @click="handleSaveTxt(inviteData.inviteUrl)">复制</el-button>
</div>
</div>
</GLDialog>
</template>
<script>
export default {
name: 'InviteDialog',
data() {
return {
inviteData: {}
}
},
props: {
isVisible: {
type: Boolean,
default: false
},
inviteInfo: {
type: Object,
default: () => { }
}
// hideStatus: Boolean
},
mounted() {
this.getInviteCode()
},
methods: {
getInviteCode() {
let sceneStr = ''
let sceneToNum = {
SC001: 0,
SC002: 1,
SC003: 2,
SC004: 3
}
this.inviteInfo.sceneCodeList && this.inviteInfo.sceneCodeList.forEach(item => {
sceneStr = sceneStr + (sceneStr ? (',' + sceneToNum[item]) : sceneToNum[item])
})
let params = {
merchantId: this.inviteInfo.shopMerchantId,
staffLabel: sceneStr
}
this.$apis.customer.getInviteCode(params).then(res => {
this.inviteData = res
})
},
handleSaveImg(url, downloadTxt = '海报') {
var alink = document.createElement('a')
alink.href = url
alink.setAttribute('target', '_blank')
alink.download = downloadTxt
alink.click()
alink.remove()
},
handleSaveTxt(txt) {
this.$message({
message: '复制成功',
type: 'success',
customClass: 'message-Z-zinde'
})
const input = document.createElement('input')
document.body.appendChild(input)
input.setAttribute('value', txt)
input.select()
document.execCommand('Copy')
document.body.removeChild(input)
},
handleClose() {
this.$emit('handleClose')
}
}
}
</script>
<style scoped>
.share-dialog {
display: flex;
}
.share-dialog .flex {
display: flex;
align-items: flex-end;
}
.share-dialog .box {
box-sizing: border-box;
width: calc((100% - 16px) / 2);
height: 182px;
padding: 20px;
background: #f9f9f9;
}
.share-dialog .box:first-child {
margin-right: 16px;
}
.share-dialog .title {
font-size: 14px;
color: #333333;
font-weight: 500;
margin-bottom: 8px;
}
.txt-blue {
font-size: 14px;
color: #5092ff;
}
</style>