step-two.vue
3.24 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
<template>
<div class="step-two">
<div class="input-group-box">
<input-group
:value="value"
@input="input"
:error="error"
:pattern="/^[A-Za-z0-9]+$/"
></input-group>
<div
class="err-box"
v-show="error"
>提示:当前输入的{{errText}}</div>
</div>
<div class="line"></div>
<div class="title">如何查找挪车码</div>
<div class="tips-box">
<div class="sprite-icon icon-car-tips"></div>
<div class="tips-text">请在<span>挪车贴</span>上寻找“挪车码”</div>
</div>
<div
:class="['btn',{'btn-disabled':value.length < 6}]"
@click="submit"
@touchstart="touchstart"
@touchend="touchend"
>提交</div>
</div>
</template>
<script type='text/ecmascript-6'>
import InputGroup from '@c/InputGroup'
import { car } from '@r/api'
export default {
name: 'step-two',
data () {
return {
value: '',
error: false,
errText: ''
}
},
props: {
values: null
},
components: {
'input-group': InputGroup,
},
mounted () {
},
methods: {
input (val) {
this.value = val
this.error = false
},
submit () {
let { value, values } = this
if (value.length < 6) return
this.showLoading('校检中...')
car.checkCode({ code: value }).then(res => {
if (res) {
let { code, message } = res
if (code == 0) {
car.bindCarCode({
...values,
code: value
}).then(_res_ => {
console.log(_res_)
if (_res_) {
if (_res_.code == 0) {
this.$emit('step_two_success')
} else {
this.showToast(_res_.message)
}
} else {
this.showToast('系统异常')
}
})
} else {
this.error = true
this.errText = message
}
} else {
this.showToast('系统异常')
}
})
}
}
}
</script>
<style scoped lang='scss'>
.step-two {
padding: 0 20px;
.input-group-box {
padding: 40px 0 66px;
position: relative;
.err-box {
font-size: 12px;
color: #fa5151;
position: absolute;
top: 90px;
left: 0;
}
}
.line {
width: 100%;
height: 2px;
background: #e9e9e9;
border-radius: 1px;
}
.title {
font-size: 14px;
color: #3b3b3b;
margin: 20px 0 10px;
text-align: center;
}
.tips-box {
width: 100%;
height: 119px;
background: #ffffff;
box-shadow: 0 1px 4px 0 rgba(59, 147, 217, 0.3);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
padding-right: 10px;
.sprite-icon {
transform: translateX(38px);
}
.tips-text {
font-size: 12px;
color: #2a2a2a;
span {
color: #52e8ff;
}
}
}
.btn {
display: flex;
align-items: center;
justify-content: center;
width: 226px;
height: 30px;
background: #008fff;
border-radius: 18.5px;
margin: 81px auto 0;
font-size: 14px;
color: #ffffff;
}
.btn-disabled {
background: #e0e0e0;
}
}
</style>