addCarNum.vue
1.48 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
<template>
<div style="padding: 20px 15px;">
<h3>请输入车牌号码</h3>
<div class="demo-two-box">
<vnp-input v-model="value"></vnp-input>
</div>
<van-button type="info" round block style="margin-top: 40px;" @click="toMyCarsPage">立即添加</van-button>
</div>
</template>
<script>
import VnpInput from "@/components/vant-number-plate/vnp-input";
import { userCarsInfoEdit } from "@/api/myCars/myCars";
export default {
name: "addCarNum",
components: {
"vnp-input": VnpInput
},
data() {
return {
show: false,
value: "冀"
};
},
methods: {
toMyCarsPage() {
console.log(this.value)
console.log(this.value.length)
if(this.value.length>6){
this.userCarsInfoEdit()
}else{
this.$toast('输入正确车牌号')
}
},
userCarsInfoEdit(){
let jsondata = {
carNumbers: JSON.stringify([{carNumber:this.value}]),
optType:'00'
};
jsondata.sign = this.$utils.signObject(jsondata);
userCarsInfoEdit(jsondata).then(response => {
console.log(response);
if(response.code==0){
this.$router.push({
name: "myCars"
}
);
}else if(response.code==-10005){
this.$toast('最多绑定三辆车')
}else{
this.$toast(response.message)
}
});
}
}
};
</script>
<style lang="less" scoped>
h3 {
text-align: center;
padding-bottom: 20px;
}
</style>