Commit 176eff96fb3be3e94bca9aced0915e1a594b5f19
1 parent
6ea1f7ef
添加车牌
Showing
6 changed files
with
129 additions
and
67 deletions
src/api/myCars/myCars.js
0 → 100644
1 | +import request from '@/utils/request' | |
2 | + | |
3 | +export function queryUserCars(params) { //获取已经绑定的车牌号信息 | |
4 | + return request({ | |
5 | + url: 'user/car/queryUserCars', | |
6 | + method: 'post', | |
7 | + data: params | |
8 | + }) | |
9 | +} | |
10 | + | |
11 | + | |
12 | +export function userCarsInfoEdit(params) { //编辑车牌号 | |
13 | + return request({ | |
14 | + url: 'user/car/userCarsInfoEdit', | |
15 | + method: 'post', | |
16 | + data: params | |
17 | + }) | |
18 | +} | |
19 | + | |
20 | + | |
21 | +export function uploadPic(params) { //上传图片 | |
22 | + return request({ | |
23 | + url: 'pic/uploadPic', | |
24 | + method: 'post', | |
25 | + data: params | |
26 | + }) | |
27 | +} | |
28 | + | ... | ... |
src/router/index.js
src/views/binding/binDing.vue
... | ... | @@ -71,7 +71,6 @@ export default { |
71 | 71 | phone: this.phone |
72 | 72 | }; |
73 | 73 | jsondata.sign = this.$utils.signObject(jsondata); |
74 | - console.log("停车记录传参 " + JSON.stringify(jsondata)); | |
75 | 74 | sendverificode(jsondata).then(response => { |
76 | 75 | console.log(response); |
77 | 76 | this.$toast("获取验证码成功"); |
... | ... | @@ -114,7 +113,6 @@ export default { |
114 | 113 | openid:'oWw3o5rY_bFsiT_nFd2CEQWGZfhs' // 正式注释 |
115 | 114 | }; |
116 | 115 | jsondata.sign = this.$utils.signObject(jsondata); |
117 | - console.log("停车记录传参 " + JSON.stringify(jsondata)); | |
118 | 116 | bindCustByOpenId(jsondata).then(response => { |
119 | 117 | if(response.code=='0'){ |
120 | 118 | this.getTokenByOpenId() // 获取token和用户手机号 |
... | ... | @@ -132,7 +130,6 @@ export default { |
132 | 130 | openid:'oWw3o5rY_bFsiT_nFd2CEQWGZfhs' // 正式注释 |
133 | 131 | }; |
134 | 132 | jsondata.sign = this.$utils.signObject(jsondata); |
135 | - console.log("停车记录传参 " + JSON.stringify(jsondata)); | |
136 | 133 | getTokenByOpenId(jsondata).then(response => { |
137 | 134 | if(response.code=='0'){ |
138 | 135 | this.$toast("亲,您已绑定成功!"); | ... | ... |
src/views/mySelf/myCars/addCarNum.vue
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 | |
12 | 12 | <script> |
13 | 13 | import VnpInput from "@/components/vant-number-plate/vnp-input"; |
14 | +import { userCarsInfoEdit } from "@/api/myCars/myCars"; | |
14 | 15 | export default { |
15 | 16 | name: "addCarNum", |
16 | 17 | components: { |
... | ... | @@ -26,10 +27,32 @@ export default { |
26 | 27 | toMyCarsPage() { |
27 | 28 | console.log(this.value) |
28 | 29 | console.log(this.value.length) |
29 | - this.$router.push({ | |
30 | - name: "myCars" | |
30 | + if(this.value.length>6){ | |
31 | + this.userCarsInfoEdit() | |
32 | + }else{ | |
33 | + this.$toast('输入正确车牌号') | |
34 | + } | |
35 | + | |
36 | + }, | |
37 | + userCarsInfoEdit(){ | |
38 | + let jsondata = { | |
39 | + carNumbers: JSON.stringify([{carNumber:this.value}]), | |
40 | + optType:'00' | |
41 | + }; | |
42 | + jsondata.sign = this.$utils.signObject(jsondata); | |
43 | + userCarsInfoEdit(jsondata).then(response => { | |
44 | + console.log(response); | |
45 | + if(response.code==0){ | |
46 | + this.$router.push({ | |
47 | + name: "myCars" | |
48 | + } | |
49 | + ); | |
50 | + }else if(response.code==-10005){ | |
51 | + this.$toast('最多绑定三辆车') | |
52 | + }else{ | |
53 | + this.$toast('添加车牌失败') | |
31 | 54 | } |
32 | - ); | |
55 | + }); | |
33 | 56 | } |
34 | 57 | } |
35 | 58 | }; | ... | ... |
src/views/mySelf/myCars/myCars.vue
... | ... | @@ -2,49 +2,20 @@ |
2 | 2 | <section style="padding: 20px 15px;"> |
3 | 3 | <p style="color: #343434;font-size: 30px;font-weight: 600;padding-bottom: 15px;">我的车辆</p> |
4 | 4 | <div> |
5 | - <van-row> | |
5 | + <van-row v-for="item in carList" :key="item.id"> | |
6 | 6 | <van-col span="3" style="text-align: center"> |
7 | 7 | <van-image style="margin-top: 18px;" :src="require('../../../assets/images/myCars/carNumBg.png')"/> |
8 | 8 | </van-col> |
9 | 9 | <van-col span="14" style="font-size: 16px;"> |
10 | - 京A1231231 | |
10 | + {{item.carNumber}} | |
11 | 11 | </van-col> |
12 | - <van-col span="5"> | |
13 | - <!--<p style="color: #FF555D">立即认证</p>--> | |
14 | - <p style="color: #1aad19">通过认证</p> | |
12 | + <van-col span="5" v-if="item.examineState == 0" @click="toRzcarNumber(item.carNumber,item.id)"> | |
13 | + <p style="color: #1aad19">立即认证</p> | |
15 | 14 | </van-col> |
16 | - <van-col span="2"> | |
17 | - <p> | |
18 | - <van-icon name="cross" color="#D1D1D6"/> | |
19 | - </p> | |
20 | - </van-col> | |
21 | - </van-row> | |
22 | - | |
23 | - <van-row> | |
24 | - <van-col span="3" style="text-align: center"> | |
25 | - <van-image style="margin-top: 18px;" :src="require('../../../assets/images/myCars/carNumBg.png')"/> | |
26 | - </van-col> | |
27 | - <van-col span="14" style="font-size: 16px;"> | |
28 | - 京A1231231 | |
29 | - </van-col> | |
30 | - <van-col span="5"> | |
31 | - <p style="color: #FF555D" @click="toRzcarNumber">立即认证</p> | |
32 | - </van-col> | |
33 | - <van-col span="2"> | |
34 | - <p> | |
35 | - <van-icon name="cross" color="#D1D1D6"/> | |
36 | - </p> | |
15 | + <van-col span="5" v-else-if="item.examineState == 0"> | |
16 | + <p style="color: #FF555D">通过认证</p> | |
37 | 17 | </van-col> |
38 | - </van-row> | |
39 | - | |
40 | - <van-row> | |
41 | - <van-col span="3" style="text-align: center"> | |
42 | - <van-image style="margin-top: 18px;" :src="require('../../../assets/images/myCars/carNumBg.png')"/> | |
43 | - </van-col> | |
44 | - <van-col span="14" style="font-size: 16px;"> | |
45 | - 京A1231231 | |
46 | - </van-col> | |
47 | - <van-col span="5"> | |
18 | + <van-col span="5" v-else> | |
48 | 19 | <p style="color: #2282C5">审核中</p> |
49 | 20 | </van-col> |
50 | 21 | <van-col span="2"> |
... | ... | @@ -54,7 +25,7 @@ |
54 | 25 | </van-col> |
55 | 26 | </van-row> |
56 | 27 | |
57 | - <section class="addBtnBg" @click="toAddCarPage"> | |
28 | + <section class="addBtnBg" @click="toAddCarPage" v-if="carList.length<3"> | |
58 | 29 | <van-image style="margin-top: 10px" :src="require('../../../assets/images/myCars/addBtn.png')"/> |
59 | 30 | 添加车辆 |
60 | 31 | </section> |
... | ... | @@ -96,18 +67,40 @@ |
96 | 67 | </template> |
97 | 68 | |
98 | 69 | <script> |
70 | + | |
71 | +import { queryUserCars } from "@/api/myCars/myCars"; | |
99 | 72 | export default { |
100 | 73 | name: "myCars", |
74 | + data() { | |
75 | + return { | |
76 | + carList: [] | |
77 | + }; | |
78 | + }, | |
79 | + created() { | |
80 | + this.queryUserCars(); | |
81 | + }, | |
101 | 82 | methods: { |
83 | + queryUserCars() { | |
84 | + let jsondata = {}; | |
85 | + jsondata.sign = this.$utils.signObject(jsondata); | |
86 | + queryUserCars(jsondata).then(response => { | |
87 | + console.log(response); | |
88 | + this.carList = response.data; | |
89 | + }); | |
90 | + }, | |
102 | 91 | toAddCarPage() { |
103 | 92 | this.$router.push({ |
104 | 93 | name: "addCarNum" |
105 | 94 | } |
106 | 95 | ); |
107 | 96 | }, |
108 | - toRzcarNumber(){ | |
97 | + toRzcarNumber(carNumber, id) { | |
109 | 98 | this.$router.push({ |
110 | - name: "rzCarNumber" | |
99 | + name: "rzCarNumber", | |
100 | + query: { | |
101 | + carNumber: carNumber, | |
102 | + id: id | |
103 | + } | |
111 | 104 | } |
112 | 105 | ); |
113 | 106 | } | ... | ... |
src/views/mySelf/myCars/rzCarNumber.vue
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | <div style="background: #fff;width: 100%;height: 100%"> |
3 | 3 | <h3 style="padding: 10px 10px;border-bottom: 5px solid #f5f5f5"> |
4 | 4 | 车牌号码: |
5 | - <b style="color:#2282C5">京A12321</b> | |
5 | + <b style="color:#2282C5">{{$route.query.carNumber}}</b> | |
6 | 6 | </h3> |
7 | 7 | |
8 | 8 | <div style="padding: 10px 10px"> |
... | ... | @@ -11,11 +11,11 @@ |
11 | 11 | |
12 | 12 | <!--<!–<div class="uploadBg"></div>–>--> |
13 | 13 | <!--<van-image style="width: 100%;height: 200px;"--> |
14 | - <!--:src="require('../../../assets/images/myCars/fornt.png')" />--> | |
14 | + <!--:src="require('../../../assets/images/myCars/fornt.png')" />--> | |
15 | 15 | </van-uploader> |
16 | 16 | |
17 | 17 | <!--<div class="uploadBg">--> |
18 | - <!----> | |
18 | + <!----> | |
19 | 19 | <!--</div>--> |
20 | 20 | |
21 | 21 | |
... | ... | @@ -31,48 +31,69 @@ |
31 | 31 | |
32 | 32 | <van-button type="info" round block style="margin-top: 40px;" @click="toMyCarsPage">立即验证</van-button> |
33 | 33 | |
34 | - | |
35 | - | |
36 | 34 | </div> |
37 | 35 | |
38 | - | |
39 | - | |
40 | - | |
41 | 36 | </div> |
42 | 37 | |
43 | 38 | </template> |
44 | 39 | |
45 | 40 | <script> |
41 | +import { uploadPic } from "@/api/myCars/myCars"; | |
46 | 42 | export default { |
47 | 43 | name: "rzCarNumber", |
48 | 44 | data() { |
49 | 45 | return { |
50 | 46 | fileList: [], |
47 | + path:'' | |
51 | 48 | }; |
52 | 49 | }, |
53 | - methods:{ | |
50 | + created() { | |
51 | + console.log(this.$route.query); | |
52 | + }, | |
53 | + methods: { | |
54 | 54 | afterRead(file) { |
55 | 55 | // 此时可以自行将文件上传至服务器 |
56 | - console.log(file); | |
56 | + console.log(file.content); | |
57 | + this.path = file.content | |
58 | + this.uploadPic() | |
57 | 59 | }, |
58 | 60 | toMyCarsPage() { |
59 | - console.log(this.fileList) | |
60 | - console.log(this.fileList.length) | |
61 | - this.$router.push({ | |
62 | - name: "myCars" | |
61 | + console.log(this.fileList); | |
62 | + console.log(this.fileList.length); | |
63 | + // this.$router.push({ | |
64 | + // name: "myCars" | |
65 | + // } | |
66 | + // ); | |
67 | + | |
68 | + if(this.fileList.length==0){ | |
69 | + this.$toast('请先上传图片') | |
70 | + }else{ | |
71 | + | |
72 | + } | |
73 | + }, | |
74 | + uploadPic() { | |
75 | + let jsondata = { | |
76 | + fileType: '11', | |
77 | + picFile: this.path | |
78 | + }; | |
79 | + jsondata.sign = this.$utils.signObject(jsondata); | |
80 | + uploadPic(jsondata).then(response => { | |
81 | + console.log(jsondata) | |
82 | + if(response.code=='0'){ | |
83 | + | |
63 | 84 | } |
64 | - ); | |
85 | + }); | |
65 | 86 | } |
66 | 87 | } |
67 | 88 | }; |
68 | 89 | </script> |
69 | 90 | |
70 | 91 | <style scoped> |
71 | -.uploadBg{ | |
72 | - width: 100%; | |
73 | - height: 200px; | |
74 | - background:#eee url("../../../assets/images/myCars/fornt.png") no-repeat; | |
75 | - background-size: 100% 100%; | |
92 | + .uploadBg { | |
93 | + width: 100%; | |
94 | + height: 200px; | |
95 | + background: #eee url("../../../assets/images/myCars/fornt.png") no-repeat; | |
96 | + background-size: 100% 100%; | |
76 | 97 | |
77 | -} | |
98 | + } | |
78 | 99 | </style> | ... | ... |