activate.vue
3.53 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
<template>
<div class="main">
<div class="input">
<div class="sprite-icon icon-card"></div>
<input
type="text"
placeholder="权益卡号或设备编码"
v-model="no"
>
</div>
<div
class="tips"
@click="jump"
>
<div class="title">常见疑问:</div>
<ul>
<li>1.如何查看您的设备编码<div class="sprite-icon icon-more"></div>
</li>
<li>2.如何查看您的权益卡号<div class="sprite-icon icon-more"></div>
</li>
</ul>
</div>
<div
:class="['btn',{'disabled':disabled}]"
@click="confirm"
>确认</div>
</div>
</template>
<script type='text/ecmascript-6'>
import { equity } from '@r/api.js'
export default {
name: '',
data () {
return {
no: '',
disabled: true
}
},
mounted () {
if (this.isMiniprogram) wx.miniProgram.postMessage({})
},
watch: {
'no' (nelVal) {
this.disabled = nelVal.length < 1 ? true : false
}
},
methods: {
jump () {
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "激活权益",
event_name: "常见疑问",
},
});
window.vm.track.collect(logs);
window.vm.$router.push({ name: 'common.explain' })
},
confirm () {
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "激活权益",
event_name: "确定",
extra_data: {
cardNo: this.no
}
},
});
window.vm.track.collect(logs);
let { no } = this
if (!no) return
let target = 'activateBySn'
let params = {
sn: no
}
if (no.length == 12) {
target = 'activateByCardNo'
params.cardNo = no
delete params.sn
}
this.showLoading('激活中...')
equity[target](params).then(res => {
this.hideLoading()
let { code, message } = res
if (code == 0) {
this.dialog({
title: '提示',
message: '激活成功',
confirmButtonText: '知道了',
showCancelButton: false
}).then(() => {
if (window.__wxjs_environment === 'miniprogram') {
wx.miniProgram.navigateBack()
} else {
window.vm.$router.push({ name: 'equity.index' })
}
})
} else {
this.showToast(message)
}
})
}
}
}
</script>
<style scoped lang='scss'>
.main {
width: auto;
height: auto!important;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
.input {
width: 100%;
display: grid;
grid-template-columns: 23px 1fr;
gap: 0 10px;
align-items: center;
padding-bottom: 5px;
border-bottom: 1px solid #e9e9e9;
margin: 0 auto;
img {
height: 18px;
}
input {
border: none;
outline: none;
background-color: rgba(0, 0, 0, 0);
}
::-webkit-input-placeholder {
color: #999;
}
}
.tips {
margin: 30px 0 0;
color: #2c2c2c;
.title {
font-size: 15px;
margin-bottom: 10px;
}
li {
font-size: 13px;
margin-bottom: 10px;
display: flex;
align-items: center;
}
}
.btn {
margin: 100px auto 0;
width: 300px;
height: 35px;
background: #2f77f3;
border-radius: 4px;
display: grid;
place-items: center;
color: #fff;
font-size: 14px;
transition: all 0.5s;
}
}
</style>