|
@@ -1,15 +1,15 @@
|
|
import uniPop from '@/components/uni-popup/uni-popup.vue';
|
|
import uniPop from '@/components/uni-popup/uni-popup.vue';
|
|
import plateNumber from '@/components/plate-number/plateNumber.vue';
|
|
import plateNumber from '@/components/plate-number/plateNumber.vue';
|
|
import uni from '@/utils/uniHooks';
|
|
import uni from '@/utils/uniHooks';
|
|
-import { Toast } from 'vant';
|
|
|
|
|
|
+import {Toast} from 'vant';
|
|
|
|
|
|
-import { LICENSE_PLATE_TYPE_ARR } from '@/constants.js';
|
|
|
|
|
|
+import {LICENSE_PLATE_TYPE_ARR} from '@/constants.js';
|
|
import {
|
|
import {
|
|
kipAddMemberVehicles,
|
|
kipAddMemberVehicles,
|
|
kipModifyMemberVehicles,
|
|
kipModifyMemberVehicles,
|
|
} from '@/utils/api-kip.js';
|
|
} from '@/utils/api-kip.js';
|
|
-import { mapState } from 'vuex';
|
|
|
|
-import { addVehicles, editVehicles } from '@/api/parking/index'
|
|
|
|
|
|
+import {mapState} from 'vuex';
|
|
|
|
+import {addVehicles, editVehicles} from '@/api/parking/index'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
@@ -61,7 +61,6 @@ export default {
|
|
this.ind = 0;
|
|
this.ind = 0;
|
|
this.active = 0;
|
|
this.active = 0;
|
|
this.carType = index;
|
|
this.carType = index;
|
|
-
|
|
|
|
if (this.carType == '1') {
|
|
if (this.carType == '1') {
|
|
this.numArr = [
|
|
this.numArr = [
|
|
this.numArr[0],
|
|
this.numArr[0],
|
|
@@ -84,10 +83,11 @@ export default {
|
|
this.numArr[6],
|
|
this.numArr[6],
|
|
];
|
|
];
|
|
}
|
|
}
|
|
|
|
+ this.vehicleNumber = this.numArr.toString().replace(/,/g, '')
|
|
},
|
|
},
|
|
// 唤起键盘
|
|
// 唤起键盘
|
|
clickShowKeyboard(index) {
|
|
clickShowKeyboard(index) {
|
|
- if ( this.carType !== 1 && index === 7) return
|
|
|
|
|
|
+ if (this.carType !== 1 && index === 7) return
|
|
this.ind = index;
|
|
this.ind = index;
|
|
this.active = index;
|
|
this.active = index;
|
|
// console.log('唤起键盘', this.ind, this.active);
|
|
// console.log('唤起键盘', this.ind, this.active);
|
|
@@ -146,15 +146,39 @@ export default {
|
|
licensePlateType: this.licensePlateTypeArr[this.carType].value,
|
|
licensePlateType: this.licensePlateTypeArr[this.carType].value,
|
|
vehicleNo: this.vehicleNumber,
|
|
vehicleNo: this.vehicleNumber,
|
|
};
|
|
};
|
|
- if(this.carInfo?.id) {
|
|
|
|
- // 修改
|
|
|
|
- const res = await editVehicles(this.carInfo?.id, {
|
|
|
|
- id: this.carInfo?.id,
|
|
|
|
- ...params
|
|
|
|
- })
|
|
|
|
- if(res.id) {
|
|
|
|
|
|
+ try {
|
|
|
|
+ if (this.carInfo?.id) {
|
|
|
|
+ // 修改
|
|
|
|
+ const res = await editVehicles(this.carInfo?.id, {
|
|
|
|
+ id: this.carInfo?.id,
|
|
|
|
+ ...params
|
|
|
|
+ })
|
|
|
|
+ if (res.id) {
|
|
|
|
+ Toast({
|
|
|
|
+ message: '修改车牌成功',
|
|
|
|
+ position: 'top',
|
|
|
|
+ onClose: () => {
|
|
|
|
+ // this.$router.replace({
|
|
|
|
+ // path: `vehicleManagement`,
|
|
|
|
+ // });
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.$router.go(-1)
|
|
|
|
+ }, 300)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ const message = res.langMessage || '修改车牌失败';
|
|
|
|
+ Toast({
|
|
|
|
+ message: message,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // 添加
|
|
|
|
+ const res = await addVehicles(this.kipUserId, params)
|
|
|
|
+ if (res?.id) {
|
|
Toast({
|
|
Toast({
|
|
- message: '修改车牌成功',
|
|
|
|
|
|
+ message: '绑定车牌成功',
|
|
position: 'top',
|
|
position: 'top',
|
|
onClose: () => {
|
|
onClose: () => {
|
|
// this.$router.replace({
|
|
// this.$router.replace({
|
|
@@ -166,34 +190,16 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
- const message = res.langMessage || '修改车牌失败';
|
|
|
|
|
|
+ const message = res.langMessage || '绑定车牌失败';
|
|
Toast({
|
|
Toast({
|
|
message: message,
|
|
message: message,
|
|
|
|
+ position: 'top',
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- return
|
|
|
|
- }
|
|
|
|
- // 添加
|
|
|
|
- const res= await addVehicles( this.kipUserId, params )
|
|
|
|
- if(res?.id) {
|
|
|
|
- Toast({
|
|
|
|
- message: '绑定车牌成功',
|
|
|
|
- position: 'top',
|
|
|
|
- onClose: () => {
|
|
|
|
- // this.$router.replace({
|
|
|
|
- // path: `vehicleManagement`,
|
|
|
|
- // });
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.$router.go(-1)
|
|
|
|
- }, 300)
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- const message = res.langMessage || '绑定车牌失败';
|
|
|
|
- Toast({
|
|
|
|
- message: message,
|
|
|
|
- position: 'top',
|
|
|
|
- });
|
|
|
|
|
|
+ } catch (err) {
|
|
|
|
+ if (err.code === 'FOUND_DUPLICATE') {
|
|
|
|
+ Toast('当前车牌已经存在,请勿重复绑定');
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
handleAddLicensePlateByKipMember() {
|
|
handleAddLicensePlateByKipMember() {
|
|
@@ -225,7 +231,7 @@ export default {
|
|
onClose: () => {
|
|
onClose: () => {
|
|
this.$router.replace({
|
|
this.$router.replace({
|
|
path: `vehicleManagement`,
|
|
path: `vehicleManagement`,
|
|
- query:{
|
|
|
|
|
|
+ query: {
|
|
...this.$route.query,
|
|
...this.$route.query,
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -262,22 +268,22 @@ export default {
|
|
onClose: () => {
|
|
onClose: () => {
|
|
this.$router.replace({
|
|
this.$router.replace({
|
|
path: `vehicleManagement`,
|
|
path: `vehicleManagement`,
|
|
- query:{
|
|
|
|
|
|
+ query: {
|
|
...this.$route.query,
|
|
...this.$route.query,
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- /* Dialog.alert({
|
|
|
|
- message: '绑定车牌成功',
|
|
|
|
- confirmButtonColor: '#333',
|
|
|
|
- }).then(() => {
|
|
|
|
- // on confirm
|
|
|
|
- this.$router.replace({
|
|
|
|
- path: `vehicleManagement`,
|
|
|
|
- });
|
|
|
|
- // this.$router.back();
|
|
|
|
- });*/
|
|
|
|
|
|
+ /* Dialog.alert({
|
|
|
|
+ message: '绑定车牌成功',
|
|
|
|
+ confirmButtonColor: '#333',
|
|
|
|
+ }).then(() => {
|
|
|
|
+ // on confirm
|
|
|
|
+ this.$router.replace({
|
|
|
|
+ path: `vehicleManagement`,
|
|
|
|
+ });
|
|
|
|
+ // this.$router.back();
|
|
|
|
+ });*/
|
|
// setTimeout(() => {
|
|
// setTimeout(() => {
|
|
// // this.$router.back();
|
|
// // this.$router.back();
|
|
// this.$router.replace({
|
|
// this.$router.replace({
|