invite-code.vue
3.28 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<template>
<div class="wrapper">
<template v-if="data.showInviteCode">
<div class="item title mg4">我的邀请码</div>
<div class="item code mg3">{{data.showInviteCode}}</div>
<div class="item mg2">
<div class="btn copy">
复制
</div>
</div>
<div class="item count-wrapper">
<div >
<div class="count">{{data.inviteeUidNum}}</div>
<div class="tip">已经邀请好友</div>
</div>
<div >
<div class="count">{{data.finishedOrderNum}}</div>
<div class="tip">好友完成订单数</div>
</div>
</div>
</template>
<template v-else>
<div class="item mg5">
<div class="tip2">您还未入驻</div>
<div class="tip2">请先入驻获得邀请码</div>
</div>
<div class="item mg2">
<div class="btn" @click="onClick">
立即入驻
</div>
</div>
</template>
</div>
</template>
<script>
import ClipboardJS from 'clipboard';
import {get} from 'lodash';
export default {
name: 'InviteCode',
props: {
data: {
type: Object,
default() {
return {};
}
}
},
mounted() {
let vm = this;
this.clipboard = new ClipboardJS(this.$el.getElementsByClassName('copy'), {
text: () => {
return this.data.showInviteCode;
}
});
this.clipboard.on('success', function() {
vm.$createToast({
type: 'text',
txt: '复制成功'
}).show();
});
this.clipboard.on('error', function() {
vm.$createToast({
type: 'text',
txt: '复制失败'
}).show();
});
},
methods: {
async onClick() {
const result = await this.$store.dispatch('license/form/getStoreStatus', null, { root: true});
if (result.data === true || get(result, 'data.isStoredSeller', false)) {
this.$yoho.goPage('go.ufo', {
pagename: 'merchantsSettled',
isnavhidden: 1,
disabledSwiper: 1
});
} else if (result.data.storedBefore) {
this.$createToast({
txt: '您已退出入驻,没有入驻资格',
type: 'warn',
}).show();
} else {
this.$yoho.goPage('go.ufo', { pagename: 'MerchantEntry' });
}
}
}
};
</script>
<style lang="scss" scoped>
.wrapper {
width: 650px;
height: 504px;
text-align: center;
overflow: hidden;
background: url("~statics/image/invite/invite_bg@3x.png");
background-size: cover;
}
.item {
margin-top: 40px;
}
.title {
color: black;
font-size: 28px;
font-weight: bold;
}
.code {
color: black;
font-weight: bolder;
font-size: 80px;
letter-spacing: 4px;
}
.mg2 {
margin-top: 20px;
}
.mg3 {
margin-top: 12px;
}
.mg4 {
margin-top: 84px;
}
.mg5 {
margin-top: 116px;
margin-bottom: 54px;
}
.btn {
display: inline-block;
width: 464px;
height: 100px;
color: white;
background-color: #08304b;
font-size: 28px;
line-height: 100px;
}
.count-wrapper {
display: flex;
justify-content: space-around;
}
.count {
font-size: 28px;
height: 40px;
line-height: 40px;
}
.tip {
font-size: 22px;
color: #999;
height: 32px;
line-height: 32px;
}
.tip2 {
font-size: 40px;
font-weight: bold;
margin-bottom: 12px;
}
</style>