Browse Source

删除车牌失败时给出提示,申诉成功跳转首页

XWookey 8 tháng trước cách đây
mục cha
commit
1cdf8f4c24
2 tập tin đã thay đổi với 30 bổ sung4 xóa
  1. 10 1
      pages/charging/charging.js
  2. 20 3
      pages/ucenter/car/car.js

+ 10 - 1
pages/charging/charging.js

@@ -48,6 +48,7 @@ function initChart(canvas, width, height, dpr) {
 let log = require('../../utils/log.js');
 var chargingPng;
 var chargingStatus;
+var chargingStatusFlag = true;
 
 Page({
 
@@ -371,6 +372,9 @@ Page({
     }
     let that = this;
     chargingStatus = setInterval(function() {
+      if(!chargingStatusFlag){
+        return;
+      }
       let chargPileIdCache = chargPileId;
       let userIdCache = userId;
       let orderidCache = orderid;
@@ -496,7 +500,7 @@ Page({
     let userInfo = wx.getStorageSync('userInfo');
     let isLogin = wx.getStorageSync('isLogin');
     let that = this;
-
+    
     wx.showModal({
         title: '提示',
         content: '如果您无法正常结束充电,请提交申诉(一小时内最多提交两次)',
@@ -508,6 +512,7 @@ Page({
           if(!res1.confirm){
             return;
           }
+          chargingStatusFlag = false;
           wx.request({
             url: getApp().globalData.postHeadAgreement + '/restapi/pileLog/applyDeleteChargPileLog',
             data: {
@@ -518,6 +523,8 @@ Page({
             success: function (res) {
                 console.info(res);
                 if(res.data.code == 200){
+                    clearInterval(chargingStatus);
+                    chargingStatusFlag = false;
                     wx.showModal({
                         title: '提示',
                         content: '申诉成功,异常订单已删除',
@@ -535,6 +542,7 @@ Page({
                     })
 
                 }else{
+                    chargingStatusFlag = true;
                     console.info(res.data.msg)
                     wx.showModal({
                         title: '提示',
@@ -552,6 +560,7 @@ Page({
                 }
             },
             fail(e) {
+            chargingStatusFlag = true;
             console.log("删除车辆失败");
             log.info('[删除车辆]','[fail]', e);
             }

+ 20 - 3
pages/ucenter/car/car.js

@@ -163,9 +163,26 @@ Page({
             // },
             method: 'POST',
             success: function (res) {
-              console.log("删除车辆成功");
-              console.info(res)
-              that.onShow()
+                console.info(res)
+                if(res.data.code==200){
+                    console.log("删除车辆成功");
+                    that.onShow()
+                }else{
+                    wx.showModal({
+                      title: '提示',
+                      content: res.data.msg,
+                      showCancel: false,
+                      complete: (res) => {
+                        if (res.cancel) {
+                          
+                        }
+                        if (res.confirm) {
+                          
+                        }
+                      }
+                    })
+                }
+
               // that.setData({
               //   userCarList: res.data
               // })