Selaa lähdekoodia

增加场站品牌名称回显;修复余额支付未刷新页面;优化扫一扫判断未支付订单查询

jiuling 1 kuukausi sitten
vanhempi
commit
51d83d1f9d

+ 1 - 1
components/parking-order/parking-order.wxml

@@ -10,7 +10,7 @@
           <image src='/images/zhangweifei.png'></image>
         </view>
         <view class='charging_text_title1'>
-          <text class='bold occupyTest'>{{item.chargstationname}}</text>
+          <text class='bold occupyTest'>{{item.brandName || ''}}{{item.chargstationname}}</text>
           <text class="chargpile occupyTest">{{item.chargpileids}} </text>
         </view>
       </view>

+ 36 - 32
pages/index/index.js

@@ -858,9 +858,9 @@ Page({
 
   async click_scan_control(scanResult,inner) {
     if (this.data.isLogin) {
-      this.queryParkOrder(3).then(res=>{
-        console.log("查询未支付成功",res);
-        if (res.total > 0) {
+      const resultOrder = await this.queryParkOrder(3);
+        console.log("查询未支付成功",resultOrder);
+        if (resultOrder.total > 0) {
           wx.showModal({
             showCancel: false,
             confirmText: '去支付',
@@ -876,8 +876,8 @@ Page({
               }
             }
           });
+          return;
         }
-      })
       const result = await this.queryParkOrder(2);
       if (result.total > 0) { // 有占位费订单不启动扫码充电
         this.setData({
@@ -1280,35 +1280,39 @@ Page({
     }
   },
   // 根据状态查询占位费订单
-  queryParkOrder(status) {
-    return new Promise((resolve, reject) => {
-      let that = this;
-      wx.request({
-        url: getApp().globalData.postHeadAgreement + '/restapi/wechat/queryOccupyFeeOrder',
-        data: {
-          userId: wx.getStorageSync('userInfo').userId,
-          searchIndex: status,
-          pagenum: that.data.pagenum++,
-          pagesize: 10,
-        },
-        method: 'POST',
-        success(res) {
-          console.log('请求成功,处理数据');
-          if(res.data.code==200){
-            if (res.data.result.total > 0) {
-              resolve(res.data.result);
-            }
-        }else{
-          resolve(res.data);
-        }
-        },
-        fail(err) {
-          console.error('请求失败', err);
-          reject(err);
+  async queryParkOrder(status) {
+    let that = this;
+    let userId = wx.getStorageSync('userInfo').userId;
+    let pagenum = that.data.pagenum; // 先取值,防止影响下一次请求
+    that.data.pagenum++; // 递增页码
+
+    try {
+        let res = await new Promise((resolve, reject) => {
+            wx.request({
+                url: getApp().globalData.postHeadAgreement + '/restapi/wechat/queryOccupyFeeOrder',
+                method: 'POST',
+                data: {
+                    userId,
+                    searchIndex: status,
+                    pagenum,
+                    pagesize: 10
+                },
+                success: resolve,
+                fail: reject 
+            });
+        });
+
+        console.log('请求成功,处理数据');
+        if (res.data && res.data.code === 200) {
+            return res.data.result.total > 0 ? res.data.result : res.data;
+        } else {
+            return res.data || {}; // 确保返回的是对象,防止 undefined
         }
-      });
-    });
-  },
+    } catch (err) {
+        console.error('请求失败', err);
+        throw err;
+    }
+},
 
   /**
    * 生命周期函数--监听页面显示

+ 6 - 0
pages/ucenter/zhanw/zhanw.js

@@ -277,6 +277,12 @@ Page({
                     showCancel: false,
                     content: data.msg,
                     confirmColor:'#00AADD',
+                    success(res) {
+                      if (res.confirm) {
+                        that.resetListZero(); 
+                        that.getPage();
+                      }
+                    }
                   });
                 }
                 log.info('[订单支付]', '[服务端订单支付]', '[余额支付成功]', data);

+ 1 - 1
pages/ucenter/zhanw/zhanw.wxml

@@ -18,7 +18,7 @@
           <image src='/images/zhangweifei.png'></image>
         </view>
         <view class='charging_text_title1'>
-          <text class='bold'>{{item.chargstationname}}</text>
+          <text class='bold'>{{item.brandName || ''}}{{item.chargstationname}}</text>
           <text class="h1">{{item.chargpileids}}</text>
         </view>
       </view>