Browse Source

fix: 车牌管理优化

John-Hong 2 years ago
parent
commit
aa07991588
1 changed files with 74 additions and 33 deletions
  1. 74 33
      src/pages/parkingFee/vehicleAddOrEdit.vue

+ 74 - 33
src/pages/parkingFee/vehicleAddOrEdit.vue

@@ -221,6 +221,7 @@ import uniPop from '@/components/uni-popup/uni-popup.vue';
 import plateNumber from '@/components/plate-number/plateNumber.vue';
 // const app = getApp()
 import uni from '@/utils/uniHooks';
+import { Dialog } from 'vant';
 
 const app = {};
 import { LICENSE_PLATE_TYPE_ARR } from '@/constants.js';
@@ -255,9 +256,9 @@ export default {
   mounted() {
     setTimeout(() => {
       uni.setNavigationBarTitle({
-        title: "绑定车牌号"
-      })
-    }, 300)
+        title: '绑定车牌号',
+      });
+    }, 300);
     const params = this.$route.query;
     console.log(252, params);
     if (params.carType) {
@@ -396,31 +397,52 @@ export default {
                   confirm_type: 'edit',
                   redirect_url: 'pages/parkingFee/vehicleManagement',
                 });
-                uni.showToast({
-                  title: '修改车牌成功',
-                  duration: 1300,
-                  icon: 'none',
-                });
-                setTimeout(() => {
+                // uni.showToast({
+                //   title: '修改车牌成功',
+                //   duration: 1300,
+                //   icon: 'none',
+                // });
+                Dialog.alert({
+                  message: '绑定车牌成功',
+                  confirmButtonColor: '#333',
+                }).then(() => {
+                  // on confirm
                   this.$router.back();
-                }, 1500);
+                });
+                // setTimeout(() => {
+                //   this.$router.back();
+                // }, 1500);
               }
             } else {
               const message = result.message || '修改车牌失败';
-              uni.showToast({
-                title: message,
-                duration: 2000,
-                icon: 'none',
+              // uni.showToast({
+              //   title: message,
+              //   duration: 2000,
+              //   icon: 'none',
+              // });
+              Dialog.alert({
+                message: message,
+                confirmButtonColor: '#333',
+              }).then(() => {
+                // on confirm
+                // this.$router.back();
               });
             }
           })
           .catch((err) => {
             uni.hideLoading();
             console.error(err);
-            uni.showToast({
-              title: '修改车牌失败',
-              duration: 2000,
-              icon: 'none',
+            // uni.showToast({
+            //   title: '修改车牌失败',
+            //   duration: 2000,
+            //   icon: 'none',
+            // });
+            Dialog.alert({
+              message: '修改车牌失败',
+              confirmButtonColor: '#333',
+            }).then(() => {
+              // on confirm
+              // this.$router.back();
             });
           });
       } else {
@@ -437,21 +459,33 @@ export default {
                 redirect_url: 'pages/parkingFee/vehicleManagement',
               });
               if (result.data) {
-                uni.showToast({
-                  title: '绑定车牌成功',
-                  duration: 1300,
-                  icon: 'none',
-                });
-                setTimeout(() => {
+                Dialog.alert({
+                  message: '绑定车牌成功',
+                  confirmButtonColor: '#333',
+                }).then(() => {
+                  // on confirm
                   this.$router.back();
-                }, 1500);
+                });
+                // setTimeout(() => {
+                //   // this.$router.back();
+                //   this.$router.replace({
+                //     path: '/vehicleManagement',
+                //   });
+                // }, 1500);
               }
             } else {
               const message = result.message || '绑定车牌失败';
-              uni.showToast({
-                title: message,
-                duration: 2000,
-                icon: 'none',
+              // uni.showToast({
+              //   title: message,
+              //   duration: 2000,
+              //   icon: 'none',
+              // });
+              Dialog.alert({
+                message: message,
+                confirmButtonColor: '#333',
+              }).then(() => {
+                // on confirm
+                // this.$router.back();
               });
             }
           })
@@ -459,10 +493,17 @@ export default {
             uni.hideLoading();
             console.log(366);
             console.error(err);
-            uni.showToast({
-              title: '绑定车牌失败',
-              duration: 2000,
-              icon: 'none',
+            // uni.showToast({
+            //   title: '绑定车牌失败',
+            //   duration: 2000,
+            //   icon: 'none',
+            // });
+            Dialog.alert({
+              message: '绑定车牌失败',
+              confirmButtonColor: '#333',
+            }).then(() => {
+              // on confirm
+              // this.$router.back();
             });
           });
       }