35b48aa6
liuqimichale
init
|
1
2
|
<template>
<div class="inout-wrap">
|
05b3e86b
liuqimichale
eslint
|
3
|
<div class="title">无牌车{{ toflag =='0' ? '入场' : '出场' }}结算</div>
|
35b48aa6
liuqimichale
init
|
4
|
<div :class="tipsClass" class="tips-text" >{{ tipsText }}</div>
|
05b3e86b
liuqimichale
eslint
|
5
|
<div class="inout-fix"></div>
|
35b48aa6
liuqimichale
init
|
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<input v-show="inputType" ref="phoneVal" type="text" placeholder="请输入手机号" maxlength="11">
<input v-show="!inputType" ref="carVal" type="text" placeholder="请输入车牌号" maxlength="8">
<div class="toggle-btn" @click="togglebtn">
<img src="../assets/toggle-btn.png">
{{ toggleText }}
</div>
<div class="commit-btn" @click="commitsure">确定</div>
</div>
</template>
<script>
import { mapActions } from 'vuex'
export default {
name: 'InOut',
|
05b3e86b
liuqimichale
eslint
|
21
22
23
24
25
26
|
props: {
toflag: {
type: Number,
default: 0
}
},
|
35b48aa6
liuqimichale
init
|
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
|
data() {
return {
tipsText: '请输入手机号',
toggleText: '切换车牌',
inputType: true,
tipsClass: ''
}
},
methods: {
...mapActions([
'handleShow', 'handleHide', 'handlePayFlag'
]),
togglebtn() {
this.tipsClass = ''
this.inputType = !this.inputType
// this.toggleText=this.toggleText === '切换车牌' ? '切换手机' : '切换车牌'
if (this.toggleText === '切换车牌') {
this.toggleText = '切换手机'
this.tipsText = '请输入车牌号'
} else {
this.toggleText = '切换车牌'
this.tipsText = '请输入手机号'
}
},
commitsure() { // 确定事件
|
05b3e86b
liuqimichale
eslint
|
52
|
console.log(this.toflag) // 如果为1 就需要去支付
|
35b48aa6
liuqimichale
init
|
53
54
55
56
57
58
59
60
61
62
63
64
|
if (this.inputType) {
const phonetext = this.$refs.phoneVal.value.trim()
const phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/
if (phonetext) {
if (phoneReg.test(phonetext)) {
// ajax
this.handleShow()
// 模拟成功
setTimeout(() => {
this.handleHide()
this.tipsText = '绑定成功'
this.tipsClass = 'successClass'
|
05b3e86b
liuqimichale
eslint
|
65
|
if (this.toflag === 1) {
|
35b48aa6
liuqimichale
init
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
this.handlePayFlag()
}
}, 2000)
} else {
this.tipsText = '请输入正确手机号'
this.tipsClass = 'errorClass'
return
}
} else {
this.tipsText = '请输入手机号'
this.tipsClass = ''
return
}
} else {
const cartext = this.$refs.carVal.value.trim()
const carReg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/
|
05b3e86b
liuqimichale
eslint
|
82
|
const carnewreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/
|
35b48aa6
liuqimichale
init
|
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
if (cartext) {
if (cartext.length === 7) { // 正常车牌
if (carReg.test(cartext)) {
// ajax
this.handleShow()
// 模拟成功
setTimeout(() => {
this.handleHide()
this.tipsText = '绑定成功'
this.tipsClass = 'successClass'
}, 2000)
} else {
this.tipsText = '请输入正确车牌号'
this.tipsClass = 'errorClass'
return
}
} else if (cartext.length === 8) { // 新能源
if (carnewreg.test(cartext)) {
// ajax
this.handleShow()
// 模拟成功
setTimeout(() => {
this.handleHide()
this.tipsText = '绑定成功'
this.tipsClass = 'successClass'
}, 2000)
} else {
this.tipsText = '请输入正确车牌号'
this.tipsClass = 'errorClass'
return
}
} else {
this.tipsText = '请输入正确车牌号'
this.tipsClass = 'errorClass'
return
}
} else {
this.tipsText = '请输入车牌号'
this.tipsClass = ''
return
}
}
}
}
}
</script>
<style lang="scss" scoped>
$corlorwhit: #fff;
.inout-wrap {
width: 100%;
height: 100%;
background: url("../assets/inout-bg.png") repeat-x;
position: relative;
text-align: center;
.title {
height: 42px;
line-height: 42px;
background-color: rgba(255, 255, 255, .9);
font-size: 17px;
color: #4A4A4A;
font-weight: 500;
}
.tips-text {
margin-top: 44px;
margin-bottom: 10px;
font-size: 17px;
color: $corlorwhit;
}
.normalClass {
color: $corlorwhit;
}
.successClass {
color: #0f0;
}
.errorClass {
color: #f00;
}
input{
border: 0;
outline: 0;
width: 80%;
height: 47px;
line-height: 47px;
padding-left: 20px;
background-color: #fff;
font-size: 18px;
color: #4A4A4A;
border-radius: 4px;
}
.toggle-btn {
height: 17px;
margin-top: 18px;
text-align: center;
cursor: pointer;
color: $corlorwhit;
img {
width: 16px;
height: 16px;
vertical-align: top;
}
}
.commit-btn {
width: 80%;
height: 42px;
margin: 156px auto 0;
line-height: 42px;
border-radius: 21px;
background: #fff;
font-size: 18px;
color: #75CBBE;
cursor: pointer;
}
.inout-fix {
width: 100%;
height: 122px;
position: absolute;
bottom: 0;
background: url("../assets/inout-fix.png") no-repeat;
background-size: 100% 100%;
}
}
</style>
|