xvying 3 years ago
parent
commit
b4844daea5

+ 0 - 0
.kaitian/compileMode.json → .mini-ide/compileMode.json


+ 0 - 0
.kaitian/project-ide.json → .mini-ide/project-ide.json


+ 0 - 0
.mini-ide/settings.json


+ 0 - 7
.tea/entryFiles-development/config$.js

@@ -1,7 +0,0 @@
-
-const g = typeof global !== 'undefined' ? global : self;
-g.appXAppJson = {
-  "app": {
-    "$homepage": "pages/index/index"
-  }
-};

+ 0 - 4
.tea/entryFiles-development/importScripts$.js

@@ -1,4 +0,0 @@
-if(!self.Map || !self.Set || !self.Symbol) {
-    importScripts('https://gw.alipayobjects.com/as/g/appx_release/deps/1.0.3/es6-set-map-symbol.js');
-     }
-     

+ 0 - 39
.tea/entryFiles-development/index$.web.js

@@ -1,39 +0,0 @@
-require('@alipay/appx-compiler/lib/sjsEnvInit');
-require('./config$');
-
-require('../../components/foottip/foottip?hash=ec7c5687c7f2ffa836caf3a93e877914426baff6');
-require('../../pages/index/index?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/test/test?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/pay/pay?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/inputcode/inputcode?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/use_bike/use_bike?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/authorization/authorization?hash=55a54d58d54db023cdd93414867929a95382a8fa');
-require('../../pages/buy-card/buy-card?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/pay_success/pay_success?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/depoSuce/depoSuce?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/charge_rule/charge_rule?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/balance/balance?hash=55a54d58d54db023cdd93414867929a95382a8fa');
-require('../../pages/change_mobile/change_mobile?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/trip/trip?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/coupon/coupon?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/breakdown/breakdown?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/weizhang/weizhang?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/mine_card/mine_card?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/ride_zige/ride_zige?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/refund_success/refund_success?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/my_account/my_account?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/ride_rule/ride_rule?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/account_details/account_details?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/trip_detail/trip_detail?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/real_name/real_name?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/set_up/set_up?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/mine/mine?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/phone_verif/phone_verif?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/phonelogin/phonelogin?hash=55a54d58d54db023cdd93414867929a95382a8fa');
-require('../../pages/logs/logs?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../components/foottip/foottip?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/mine_data/mine_data?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/user_rules/user_rules?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/weizhang_detail/weizhang_detail?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/agreement/agreement?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/parking/parking?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');

+ 0 - 73
.tea/entryFiles-development/index$.worker.js

@@ -1,73 +0,0 @@
-if(!self.__appxInited) {
-self.__appxInited = 1;
-require('@alipay/appx-compiler/lib/sjsEnvInit');
-
-require('./config$');
-
-
-      if( navigator.userAgent && (navigator.userAgent.indexOf('LyraVM') > 0 || navigator.userAgent.indexOf('AlipayIDE') > 0) ) {
-        var AFAppX = self.AFAppX.getAppContext ? self.AFAppX.getAppContext().AFAppX : self.AFAppX;
-      } else {
-        importScripts('https://appx/af-appx.worker.min.js');
-        var AFAppX = self.AFAppX;
-      }
-      self.getCurrentPages = AFAppX.getCurrentPages;
-      self.getApp = AFAppX.getApp;
-      self.Page = AFAppX.Page;
-      self.App = AFAppX.App;
-      self.my = AFAppX.bridge || AFAppX.abridge;
-      self.abridge = self.my;
-      self.Component = AFAppX.WorkerComponent || function(){};
-      self.$global = AFAppX.$global;
-      self.requirePlugin = AFAppX.requirePlugin;
-    
-
-if(AFAppX.registerApp) {
-  AFAppX.registerApp({
-    appJSON: appXAppJson,
-  });
-}
-
-if(AFAppX.compilerConfig){ AFAppX.compilerConfig.component2 = true; }
-
-function success() {
-require('../../app');
-require('../../components/foottip/foottip?hash=ec7c5687c7f2ffa836caf3a93e877914426baff6');
-require('../../pages/index/index?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/test/test?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/pay/pay?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/inputcode/inputcode?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/use_bike/use_bike?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/authorization/authorization?hash=55a54d58d54db023cdd93414867929a95382a8fa');
-require('../../pages/buy-card/buy-card?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/pay_success/pay_success?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/depoSuce/depoSuce?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/charge_rule/charge_rule?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/balance/balance?hash=55a54d58d54db023cdd93414867929a95382a8fa');
-require('../../pages/change_mobile/change_mobile?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/trip/trip?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/coupon/coupon?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/breakdown/breakdown?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/weizhang/weizhang?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/mine_card/mine_card?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/ride_zige/ride_zige?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/refund_success/refund_success?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/my_account/my_account?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/ride_rule/ride_rule?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/account_details/account_details?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/trip_detail/trip_detail?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/real_name/real_name?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/set_up/set_up?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/mine/mine?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/phone_verif/phone_verif?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/phonelogin/phonelogin?hash=55a54d58d54db023cdd93414867929a95382a8fa');
-require('../../pages/logs/logs?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../components/foottip/foottip?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/mine_data/mine_data?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/user_rules/user_rules?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/weizhang_detail/weizhang_detail?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/agreement/agreement?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-require('../../pages/parking/parking?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
-}
-self.bootstrapApp ? self.bootstrapApp({ success }) : success();
-}

File diff suppressed because it is too large
+ 0 - 0
.tea/entryFiles-production/index$.worker.js


+ 147 - 356
app.js

@@ -1,14 +1,14 @@
 App({
   onLaunch: function (options) {
-  if (options.query) {
+    if (options.query) {
       console.log('扫码加载')
       var code1 = decodeURIComponent(options.query.qrCode)
       var index = code1.lastIndexOf("\=");
       let code = code1.substring(index + 1, code1.length);
-      this.globalData.scanCode=code
-    console.log(code,'ceode-------------------------------------')
+      this.globalData.scanCode = code
+      console.log(code, 'ceode-------------------------------------')
     }
-    
+
 
     if (my.canIUse('getUpdateManager')) {
       const updateManager = my.getUpdateManager()
@@ -48,7 +48,7 @@ App({
     imgUrl: 'http://resource.bike.hanyiyun.com/',
     screenHeight: '',
     login: false,
-    scanCode:'',//扫描普通二维码跳转小程序解析出的车牌号码
+    scanCode: '',//扫描普通二维码跳转小程序解析出的车牌号码
     platform: '',
     version: '',
     req: true,
@@ -68,107 +68,152 @@ App({
   },
   request(api, params, method, req1) {
     var that = this;
-    if (req1 == false) return;
-    if (req1) {
-      that.globalData.req = false;
-    }
-    if (my.getStorageSync({ 'key': 'token' }).data != '' || my.getStorageSync({ 'key': 'token' }).data != undefined) {
-      if (req1 == true || req1 == undefined) {
-        return new Promise((resolve, reject) => {
-          my.request({
-            url: this.globalData.url + api,
-            data: params,
-            headers: {
-              'content-type': 'application/json',
-              'Accept': 'application/json',
-              'Cache-Control': 'no-cache',
-              'Authorization': my.getStorageSync({ 'key': 'token' }).data,
+    // if (req1 == false) return;
+    // if (req1) {
+    //   that.globalData.req = false;
+    // }
+    // if (my.getStorageSync({ 'key': 'token' }).data != '' || my.getStorageSync({ 'key': 'token' }).data != undefined) {
+    //   if (req1 == true || req1 == undefined) {
+    return new Promise((resolve, reject) => {
+      my.request({
+        url: this.globalData.url + api,
+        data: params,
+        headers: {
+          'content-type': 'application/json',
+          'Accept': 'application/json',
+          'Cache-Control': 'no-cache',
+          'Authorization': my.getStorageSync({ 'key': 'token' }).data,
+          'merchant-id': this.globalData.merchant_id,
+          'source-type': 'alipay'
+        },
+        method: method,
+        success: (res) => {
+          // console.log(res)
+          if (res.status == 450) {
+            return;
+          }
+          if (res.status != 200) {
+            let data = {
+              response: res,
+              'url': api,
+              'data': params,
               'merchant-id': this.globalData.merchant_id,
-              'source-type': 'alipay'
-            },
-            method: method,
-            success: (res) => {
-              // console.log(res)
-              if (res.status == 450) {
-                return;
-              }
-              if (res.status != 200) {
-                if (res.data.message == '订单不存在或订单已结算') {
-                  if (this.globalData.compatible) {
-                    my.reLaunch({
-                      url: '/pages/compatible/index/index',
-                    })
-                  } else {
-                    my.reLaunch({
-                      url: '/pages/index/index',
-                    })
-                  }
-                  return false;
-                } else if (res.data.message == '运动中不能关锁') {
-                  return false;
-                }
-                if (res.message != undefined) {
-                  my.showToast({
-                    content: res.message,
-                    icon: 'none',
-                    duration: 3000,
-                    mask: true
-                  })
-                } else if (res.data.message != undefined) {
-                  my.showToast({
-                    content: res.data.message,
-                    icon: 'none',
-                    duration: 3000,
-                    mask: true
-                  })
-                }
+              'authorization': wx.getStorageSync('token'),
+              type: 'success',
+              user: my.getStorageSync({ 'key': 'userInfo' }).data ? my.getStorageSync({ 'key': 'userInfo' }).data.user : '',
+              version: '1.2.2'
+            }
+            my.request({
+              url: this.globalData.url + '/logs', //仅为示例,并非真实的接口地址
+              data: { data: data },
+              method: 'POST',
+              header: {
+                'content-type': 'application/json', // 默认值
+                'merchant-id': this.globalData.merchant_id
+              },
+              success(res) {
+                console.log(res.data)
               }
-
-              console.log(res, 'token-------------------------------------------')
-              resolve(res)
-            },
-            fail: (err) => {
-
-              if (err.status == 401) {
-                var timeout;
-                console.log('token过期')
-                
-                my.removeStorageSync({key:'token'})
-                my.removeStorageSync({key:'token_time'})
-                // this.token()
+            })
+          }
+          if (res.status != 200) {
+            if (res.data.message == '订单不存在或订单已结算') {
+              if (this.globalData.compatible) {
                 my.reLaunch({
-                  url: '/pages/index/index',
-                })
-              } else if (err.status == 404) {
-                my.navigateTo({
-                  url: '/pages/undefind/undefind',
+                  url: '/pages/compatible/index/index',
                 })
               } else {
-                my.showToast({
-                  content: err.data.message || err.data,
-                  icon: 'none',
-                  mask: true,
-                  duration: 3000,
-                });
+                my.reLaunch({
+                  url: '/pages/index/index',
+                })
               }
-              console.log(err, 'qingqiushibai')
-              reject(err, "请求失败")
+              return false;
+            } else if (res.data.message == '运动中不能关锁') {
+              return false;
+            }
+            if (res.message != undefined) {
+              my.showToast({
+                content: res.message,
+                icon: 'none',
+                duration: 3000,
+                mask: true
+              })
+            } else if (res.data.message != undefined) {
+              my.showToast({
+                content: res.data.message,
+                icon: 'none',
+                duration: 3000,
+                mask: true
+              })
+            }
+          }
+
+          console.log(res, 'token-------------------------------------------')
+          resolve(res)
+        },
+        fail: (err) => {
+
+          if (err.status == 401) {
+            var timeout;
+            console.log('token过期')
+
+            my.removeStorageSync({ key: 'token' })
+            my.removeStorageSync({ key: 'token_time' })
+            // this.token()
+            my.reLaunch({
+              url: '/pages/index/index',
+            })
+          } else if (err.status == 404) {
+            my.navigateTo({
+              url: '/pages/undefind/undefind',
+            })
+          } else {
+            my.showToast({
+              content: err.data.message || err.data,
+              icon: 'none',
+              mask: true,
+              duration: 3000,
+            });
+          }
+          console.log(err, 'qingqiushibai')
+          let data = {
+            response: res,
+            'url': api,
+            'data': params,
+            'merchant-id': this.globalData.merchant_id,
+            'authorization': wx.getStorageSync('token'),
+            type: 'success',
+            user: my.getStorageSync({ 'key': 'userInfo' }).data ? my.getStorageSync({ 'key': 'userInfo' }).data.user : '',
+            version: '1.2.2'
+          }
+          my.request({
+            url: this.globalData.url + '/logs', //仅为示例,并非真实的接口地址
+            data: { data: data },
+            method: 'POST',
+            header: {
+              'content-type': 'application/json', // 默认值
+              'merchant-id': this.globalData.merchant_id
             },
-            complete: () => {
-              that.globalData.req = true
+            success(res) {
+              console.log(res.data)
             }
           })
-        })
-      }
-    }
+          reject(err, "请求失败")
+        },
+        complete: () => {
+          that.globalData.req = true
+        }
+      })
+    })
   },
+
   login() {
     let that = this
     let token = my.getStorageSync({ 'key': 'token' }).data
-    let data = Math.round(new Date() / 1000);
-    let tokenTime = my.getStorageSync({ 'key': 'token_time' }).data;
+    let data = Math.round(new Date().getTime() / 1000).toString();
+    let tokenTime = my.getStorageSync({ 'key': 'token_time' }).data || 0;
     let cha = data - tokenTime
-    let data1 = 60 * 60 * 12
+    let data1 = 60 * 60 * 4
     return new Promise((resolve, reject) => {
       if (token && cha < data1) {
         console.log(Math.round(new Date() / 1000), 'test--------')
@@ -180,14 +225,6 @@ App({
             // 发送 res.code 到后台换取 openId, sessionKey, unionId
             if (res.authCode) {
               console.log(res.authCode)
-              // var data = {
-              //   'code': res.authCode,
-              //   'appid': that.globalData.appid,
-              //   // 'phone_detail': JSON.stringify(arr),
-              //   'phone_detail': '',
-              //   'invite_user_id': that.globalData.id,
-              //   'language': 'zh'
-              // };
               var data = {
                 'code': res.authCode,
                 'appid': that.globalData.appid,
@@ -220,7 +257,7 @@ App({
                   } else if (res.status != 200) {
                     console.log(res, 'cesgu---------------')
                     my.showToast({
-                      content: '登录失败,请刷新',
+                      content: res.data.message,
                       icon: 'none'
                     })
                   } else {
@@ -232,11 +269,16 @@ App({
 
                   resolve()
                 }, fail: (err) => {
-                  my.showToast({
-                    // content: err.message,
-                    content: '121212',
-                    icon: 'none'
+                  my.alert({
+                    title: '提示',
+                    content: '可能网络不太好,请重试!',
+                    success: () => {
+                      my.reLaunch({
+                        url: '/pages/error/error?error=0'
+                      });
+                    }
                   })
+                 
                 }
               })
             } else {
@@ -251,254 +293,3 @@ App({
     })
   },
 })
-// App({
-//   onLaunch: function () {
-
-//     // 登录
-//     var that = this;
-//     my.getSystemInfo({
-//       success: res => {
-//         console.log(res)
-//         var system = res.system.trim().split(/\s+/)[1];
-
-//       }
-//     })
-//     if (my.getStorageSync({'key':'midTimes'}).data != '') {
-//       var time = my.getStorageSync({'key':'midTimes'}).data;
-//       var timestamp = Date.parse(new Date()) / 1000;
-//       if (time <= timestamp) {
-//         console.log('midtimes过期')
-//         my.setStorageSync({'key':'midTimes',data:''})
-//       }
-//     }
-//     var time = my.getStorageSync({'key':'token_time'}).data;
-//     var timestamp = Date.parse(new Date());
-//     if (time <= timestamp / 1000) {
-//       console.log('token过期')
-//       my.removeStorageSync('token_time')
-//     }
-//     if (my.canIUse('getUpdateManager')) {
-//       const updateManager = my.getUpdateManager()
-//       updateManager.onCheckForUpdate(function (res) {
-//         if (res.hasUpdate) {
-//           updateManager.onUpdateReady(function () {
-//             my.alert({
-//               title: '更新提示',
-//               content: '新版本已经准备好,是否重启应用?',
-//               success: function (res) {
-
-//                   updateManager.applyUpdate()
-
-//               }
-//             })
-//           })
-//           updateManager.onUpdateFailed(function () {
-//             my.alert({
-//               title: '已经有新版本了哟~',
-//               content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
-//             })
-//           })
-//         }
-//       })
-//     } else {
-//       my.alert({
-//         title: '提示',
-//         content: '当前支付宝版本过低,无法使用该功能,请升级到最新支付宝版本后重试。'
-//       })
-//     }
-//    //登录
-//   },
-//   globalData: {
-//     statusBarHeight: my.getSystemInfoSync()['statusBarHeight'],
-//     windowHeight: my.getSystemInfoSync()['windowHeight'],
-//     imgUrl: 'http://resource.bike.hanyiyun.com/',
-//     screenHeight: '',
-//     login: false,
-//     platform: '',
-//     version: '',
-//     req: true,
-//     id: 0,
-//     times: 60,
-//     invalid: false,
-//     compatible: '',
-//     title: '禹见你', //全局修改此小程序名称
-//     logoUrl: '../../img/logo.png', //logo图片路径 网络图片/本地图片 dejin.png  shanxianLg.png  yuzhouLg.png dingding.png
-//     appid: '2021002147603404', //小程序的appid wxc5f328a92356183f--遇见你appid
-//     merchant_id: '1',
-//     url: 'https://api.mtu.ximengnaikang.com/api', //线上域名
-//     // url: 'http://api.yutu.site.ximengnaikang.com/api', //本地域名
-//     mapKey: 'GTLBZ-F6BKO-5EDWH-SDHIX-K2ART-O2FRQ' //地图key值
-//   },
-//   request(api, params, method, req1) {
-//     var that = this;
-//     if (req1 == false) return;
-//     if (req1) {
-//       that.globalData.req = false;
-//     }
-//     if (my.getStorageSync({'key':'token'}).data != '' || my.getStorageSync({'key':'token'}).data != undefined) {
-//       if (req1 == true || req1 == undefined) {
-//         return new Promise((resolve, reject) => {
-//           my.request({
-//             url: this.globalData.url + api,
-//             data: params,
-//             headers: {
-//               'content-type': 'application/json',
-//               'Accept': 'application/json',
-//               'Cache-Control': 'no-cache',
-//               'Authorization': my.getStorageSync({'key':'token'}).data,
-//               'merchant-id': this.globalData.merchant_id,
-//                'source-type': 'alipay'
-//             },
-//             method: method,
-//             success: (res) => {
-//               resolve(res)
-//               // console.log(res)
-//               if (res.status == 450) {
-//                 return;
-//               }
-//                if (res.status != 200) {
-//                 if (res.data.message == '订单不存在或订单已结算') {
-//                   if (this.globalData.compatible) {
-//                     my.reLaunch({
-//                       url: '/pages/compatible/index/index',
-//                     })
-//                   } else {
-//                     my.reLaunch({
-//                       url: '/pages/index/index',
-//                     })
-//                   }
-//                   return false;
-//                 } else if (res.data.message == '运动中不能关锁') {
-//                   return false;
-//                 }
-//                 if (res.message != undefined) {
-//                   my.showToast({
-//                     content: res.message,
-//                     icon: 'none',
-//                     duration: 3000,
-//                     mask: true
-//                   })
-//                 } else if (res.data.message != undefined) {
-//                   my.showToast({
-//                     content: res.data.message,
-//                     icon: 'none',
-//                     duration: 3000,
-//                     mask: true
-//                   })
-//                 }
-//               }
-//               if (res.status == 401) {
-//                 var timeout;
-//                 my.removeStorageSync('token')
-//                 my.removeStorageSync('token_time') 
-//                 // this.token()
-//                 my.reLaunch({
-//                   url: '/pages/index/index',
-//                 })
-//               } else if (res.status == 404) {
-//                 my.navigateTo({
-//                   url: '/pages/undefind/undefind',
-//                 })
-//               }
-//             },
-//             fail: (err) => {
-//               my.showToast({
-//                 content: err.data.message || err.data,
-//                 icon: 'none',
-//                 mask: true,
-//                 duration: 3000,
-
-//               });
-//          console.log(err,'qingqiushibai')
-//               reject(err,"请求失败")
-//             },
-//             complete: () => {
-//               that.globalData.req = true
-//             }
-//           })
-//         })
-//       }
-//     }
-//   },
-//   token:function(){
-//     let that=this
-//     my.getAuthCode({
-//       success: function (res) {
-//         my.getSystemInfo({
-//           success(res) {
-//             console.log(arr)
-//           var  arr = [{
-//                 label: '品牌',
-//                 type: 'brand',
-//                 value: res.brand
-//               },
-//               {
-//                 label: '型号',
-//                 type: 'model',
-//                 value: res.model
-//               },
-//               {
-//                 label: '系统平台',
-//                 type: 'platform',
-//                 value: res.platform
-//               },
-//               {
-//                 label: '系统版本',
-//                 type: 'system',
-//                 value: res.system
-//               },
-//               {
-//                 label: '支付宝版本',
-//                 type: 'version',
-//                 value: res.version
-//               },
-//               {
-//                 label: '小程序版本',
-//                 type: 'SDKVersion',
-//                 value: res.SDKVersion
-//               },
-//               {
-//                 label: '定位状态',
-//                 type: 'locationEnabled',
-//                 value: res.locationEnabled ? '开' : '关'
-//               },
-//               {
-//                 label: '定位授权',
-//                 type: 'locationAuthorized',
-//                 value: res.locationAuthorized ? '已授权' : '未授权'
-//               }
-//             ]
-//           }
-//         })
-//         // 发送 res.code 到后台换取 openId, sessionKey, unionId
-//         console.log(res.code)
-//         var data = {
-//         'code': res.authCode,
-//           'appid': that.globalData.appid,
-//           'type': 1
-//         };
-//         my.request({
-//           url: that.globalData.url + '/auth/weapp-login',
-//             data: data,
-//             headers: {
-//               'content-type': 'application/json',
-//               'Accept': 'application/json',
-//               'Cache-Control': 'no-cache',
-//               'Authorization': my.getStorageSync({'key':'token'}).data,
-//               'merchant-id': that.globalData.merchant_id
-//             },
-//           method:'POST',
-//           success:(res)=>{
-//             my.setStorageSync({'key':'token',data:res.data.token});
-//             my.setStorageSync({'key':'session_key',data:res.data.session_key});
-//             my.setStorageSync({'key':'token_time',data:res.data.exp});
-//             my.setStorageSync({'key':'user_ID',data:res.data.user.id});
-//           },err:(err=>{
-//             console.log(err,'登录错误---------------------------------')
-//           })
-//         })
-
-//       }
-//     })
-//   }
-// })

+ 46 - 45
pages/charge_rule/charge_rule.axml

@@ -1,46 +1,47 @@
-<view class="box">
-<view class="tip">——— <text style="color:#333333">{{homeName}}</text>———</view>
-  <view a:if="{{setting.is_deposit}}">
-    <view class="rules-title">
-      <view class="left">骑行押金</view>
-      <view class="right">{{setting.deposit}}元</view>
-    </view>
-    <view class="rules-text">押金随时可退</view>
-  </view>
-  <view>
-    <view class="rules-title">
-      <view class="left">时长费</view>
-    </view>
-    <view class="rules-text">
-      <view class="row">
-        <view class="rl">起步价</view>
-        <view class="rr">{{setting.starting_price}}元({{setting.starting_price_time}}分钟)</view>
-      </view>
-      <view class="row">
-        <view class="rl">时长费</view>
-        <view class="rr">{{setting.per_money}}元/{{setting.per_minute}}分钟</view>
-      </view>
-      <text>临时停车正常计费</text>
-    </view>
-  </view>
-  <view>
-    <view class="rules-title">
-      <view class="left">车辆调度费</view>
-
-    </view>
-    <view class="rules-text">
-      <view class="row">
-        <view class="rl">运营区外调度费</view>
-        <view class="rr">30元</view>
-      </view>
-      <view class="row">
-        <view class="rl">运营区内调度费</view>
-        <view class="rr"></view>
-      </view>
-      <view a:if="{{setting.min_dispatching_fee == 0}}">1、距离最近停车点{{setting.min_limit_km}}m内,免收调度费;</view>
-      <view a:if="{{setting.min_dispatching_fee > 0}}">1、距离最近停车点{{setting.min_limit_km}}m内,收{{setting.min_dispatching_fee}}元;</view>
-      <view>2、超出最近停车点{{setting.min_limit_km}}m时:每多{{setting.over_limit_per_km}}m,增加{{setting.over_limit_per_km_money}}元;{{setting.max_dispatching_fee}}元封顶。</view>
-    </view>
-  </view>
- 
+<view class="box">
+  <view class="tip">———
+    <text style="color:#333333">{{setting ? homeName : '--'}}</text>———</view>
+  <view a:if="{{setting.is_deposit}}">
+    <view class="rules-title">
+      <view class="left">骑行押金</view>
+      <view class="right">{{setting ? setting.deposit : '--'}}元</view>
+    </view>
+    <view class="rules-text">押金随时可退</view>
+  </view>
+  <view>
+    <view class="rules-title">
+      <view class="left">时长费</view>
+    </view>
+    <view class="rules-text">
+      <view class="row">
+        <view class="rl">起步价</view>
+        <view class="rr">{{setting ? setting.starting_price : '--'}}元({{setting ? setting.starting_price_time : '--'}}分钟)</view>
+      </view>
+      <view class="row">
+        <view class="rl">时长费</view>
+        <view class="rr">{{setting ? setting.per_money : '--'}}元/{{setting ? setting.per_minute : '--'}}分钟</view>
+      </view>
+      <text>临时停车正常计费</text>
+    </view>
+  </view>
+  <view>
+    <view class="rules-title">
+      <view class="left">车辆调度费</view>
+      
+    </view>
+    <view class="rules-text">
+      <view class="row">
+        <view class="rl">运营区外调度费</view>
+        <view class="rr">{{setting ? 30 : '--'}}元</view>
+      </view>
+      <view class="row">
+        <view class="rl">运营区内调度费</view>
+        <view class="rr"></view>
+      </view>
+      <view a:if="{{setting.min_dispatching_fee == 0}}">1、距离最近停车点{{setting.min_limit_km}}m内,免收调度费;</view>
+      <view a:if="{{setting.min_dispatching_fee > 0}}">1、距离最近停车点{{setting.min_limit_km}}m内,收{{setting.min_dispatching_fee}}元;</view>
+      <view>2、超出最近停车点{{setting ? setting.min_limit_km : '--'}}m时:每多{{setting ? setting.over_limit_per_km : '--'}}m,增加{{setting ? setting.over_limit_per_km_money: '--'}}元;{{setting ? setting.max_dispatching_fee :'--'}}元封顶。</view>
+    </view>
+  </view>
+  
 </view>

+ 10 - 6
pages/charge_rule/charge_rule.js

@@ -1,9 +1,9 @@
 var app = getApp()
 Page({
   data: {
-    setting:my.getStorageSync({'key':'setting'}).data,
-    title:app.globalData.title,
-    homeName:'',
+    setting:'',
+    title: app.globalData.title,
+    homeName: '',
   },
   onLoad: function (options) {
 
@@ -12,9 +12,13 @@ Page({
 
   },
   onShow: function () {
-    this.setData({setting:my.getStorageSync({'key':'setting'}).data,
-    homeName:my.getStorageSync({'key':'home'}).data.name,
-  })
+    
+      this.setData({
+        setting: my.getStorageSync({ 'key': 'setting' }).data,
+        homeName: my.getStorageSync({ 'key': 'home' }).data.name,
+      })
+  
+
   },
   onHide: function () {
 

+ 2 - 2
pages/index/index.axml

@@ -91,9 +91,9 @@
     <view class="kefu" onTap="findPark">
       <image src="../../img/park.png"></image>
     </view>
-    <view class="kefu" onTap="kefu">
+    <!-- <view class="kefu" onTap="kefu">
       <image src="../../img/kefu.png"></image>
-    </view>
+    </view> -->
     <view class="kefu" onTap="posi">
       <image src="../../img/position.png"></image>
     </view>

+ 141 - 39
pages/index/index.js

@@ -1,10 +1,12 @@
 // index.js
 // 获取应用实例
 //获取应用实例
+// const log = require('../../utils/log')
+const { getCache, setCache, CacheKeys } = require('../../utils/cache')
 const app = getApp();
 var token = my.getStorageSync({ 'key': 'token' }).data;
 const util = require('../../utils/utils.js');
-const { content } = require('/utils/dataTransition.js');
+//const { content } = require('/utils/dataTransition.js');
 var mytime = null;
 let testToken = ''
 Page({
@@ -79,7 +81,7 @@ Page({
     stop_type: '',
     marqueePace: 0.6, //滚动速度
     marqueeDistance: 520, //初始滚动距离 用到
-     size: 26, //通知公告用到
+    size: 26, //通知公告用到
     marqueeWidth: 560, //通知公告用到
     length: '',//通知公告
     swiperCurrent: 0,
@@ -88,6 +90,7 @@ Page({
     img: app.globalData.imgUrl,
     new_user_coupons: [],
     scanCodeErr: false,//扫码失败弹框
+    isScan: false
   },
 
   onLoad: function (query) {
@@ -100,6 +103,7 @@ Page({
       height1: app.globalData.statusBarHeight,
       screenHeight: app.globalData.screenHeight
     })
+    this.reloadMap()
   },
   onShow: function () {
     var that = this;
@@ -112,24 +116,17 @@ Page({
       midbolear: my.getStorageSync({ 'key': 'midTimes' }).data,
       polygons: []
     })
-    app.login().then(res => {
-      console.log('YYYYYYYYYYYYY')
-      that.location()
-      that.getUser()
-      that.userState()
-    })
-    // that.location();
-    // testToken = setInterval(function () {
-    //   let token=my.getStorageSync({'key':'token'}).data
-    //   if (token) {
-    //     console.log('0000')
-    //     clearInterval(testToken)
-
-    //   } else {
-    //     console.log(token,'1')
-    //   }
-    // }, 1000)
-    my.hideBackHome();
+    if (!this.data.isScan) {
+      app.login().then(res => {
+        console.log('YYYYYYYYYYYYY')
+        that.location()
+        that.getUser()
+        that.userState()
+      })
+    }
+    that.setData({
+      isScan: false
+    })
   },
   detail: function () {
     var that = this;
@@ -148,6 +145,24 @@ Page({
     } else {
       area_id = 0
     }
+
+    let isCache = getCache('ads:' + id)
+    if (isCache) {
+      if (isCache == '') return
+      if (isCache instanceof Object && isCache.hasOwnProperty('header')) {
+        that.setData({
+          ads: isCache.header
+        })
+      }
+      if (isCache instanceof Object && isCache.hasOwnProperty('mid')) {
+        that.setData({
+          mid: res.data.mid,
+          adFrame: true
+        })
+      }
+      return
+    }
+
     app.request("/ads?area_id=" + area_id + "&position[]=mid&position[]=header&position[]=footer", '', "GET").then(res => {
       console.log(res)
       if (res.status == 200 && res.data != '') {
@@ -169,6 +184,16 @@ Page({
       console.log(err)
     })
   },
+  reloadMap(classname = 'bottom-bt') {
+    let query = my.createSelectorQuery();
+    let th = this;
+    query.select('.' + classname).boundingClientRect(function (rect) {
+      if (rect != null && rect instanceof Object && rect.hasOwnProperty('height')) {
+        let height = rect.height;
+        th.setData({ mapHeight: 'calc(100vh - ' + height + 'px)' });
+      }
+    }).exec();
+  },
   //点击广告页
   swiper: util.throttle(function (e) {
     // console.log(e)
@@ -217,14 +242,34 @@ Page({
     }
   },
   //通知公告
-    getNotice(id){
+  getNotice(id) {
     let data = {
       'area_id': id
     }
+
+    let isCache = getCache('Notice:' + id)
+    if (isCache) {
+      if (isCache instanceof Object && !isCache.hasOwnProperty('id')) return
+      this.setData({ notice: isCache })
+      var length = isCache.description.length * this.data.size; //计算文字的长度
+      this.setData({
+        length: length
+      })
+      if (this.data.length > this.data.marqueeWidth) {
+        this.noticeRun();
+      } else {
+        this.setData({
+          marqueeDistance: 0
+        })
+      }
+      return
+    }
+
+
     app.request("/index/an", data, "GET").then(res => {
       console.log(res)
-      if(200 == res.status && res.data.id){
-        this.setData({notice:res.data})
+      if (200 == res.status && res.data.id) {
+        this.setData({ notice: res.data })
         var length = res.data.description.length * this.data.size; //计算文字的长度
         this.setData({
           length: length
@@ -255,7 +300,7 @@ Page({
         });
         that.noticeRun();
       }
-    }, 6)
+    }, 10)
   },
   //定位当前位置
   posi: util.throttle(function () {
@@ -276,13 +321,32 @@ Page({
         })
       },
       fail: function (err) {
+        console.log(err, '用户授权失败')
+        if (err.error == 11) {
+          my.showAuthGuide({
+            authType: 'LBS',
+            success: (res) => {
+
+            },
+            fail: (error) => {
+              my.alert({ content: '获取位置授权失败' });
+            },
+          });
+        }
         my.hideLoading()
-        console.log(err, '定位失败打印')
         my.showToast({
           content: '定位失败',
           icon: 'none'
         })
       }
+      // fail: function (err) {
+      //   my.hideLoading()
+      //   console.log(err, '定位失败打印')
+      //   my.showToast({
+      //     content: '定位失败',
+      //     icon: 'none'
+      //   })
+      // }
     })
   }, 1000),
   //点击扫描二维码
@@ -315,7 +379,7 @@ Page({
           var data = res.data;
           console.log(data, '区域')
           let id = data.id
-         this.getNotice(id)
+          this.getNotice(id)
           if (data.points != []) {
             that.setData({
               id: data.id,
@@ -330,7 +394,27 @@ Page({
                 polygons: that.data.polygons.concat(data)
               })
           }
-          clearInterval(mytime)
+          if (res.status == 423) {
+            wx.getLocation({
+              success: function (res) {
+                my.alert({
+                  title: '提示',
+                  content: '您附近暂无运营区域~',
+                })
+                var setting = {
+                  is_deposit: 1
+                }
+                that.setData({
+                  setting
+                })
+              },
+              fail: function (err) {
+                that.setData({
+                  location: true
+                })
+              }
+            })
+          }
           my.setStorageSync({ 'key': 'home', data: data })
         }
         if (data) {
@@ -342,11 +426,11 @@ Page({
         }
 
       }).catch(err => {
-        console.log(err)
-        if (err.data.message == "该附近暂无运营区域") {
-          my.removeStorageSync({ key: 'setting' })
-          my.removeStorageSync({ key: 'home' })
-        }
+        console.log(err, 'lkkkkk')
+        // if (err.data.message == "该附近暂无运营区域") {
+        //   my.removeStorageSync({ key: 'setting' })
+        //   my.removeStorageSync({ key: 'home' })
+        // }
         my.alert({
           title: '提示',
           content: err.data.message,
@@ -360,6 +444,14 @@ Page({
     var data1 = {
       'area_id': id
     }
+    let isCache = getCache('BAN_STOP:' + id)
+    if (isCache) {
+      that.setData({
+        markers: that.data.markers.concat(isCache.centres),
+        polygons: that.data.polygons1.concat(isCache.polygons),
+      })
+      return
+    }
     app.request('/parking/stop-sites', data1, 'GET').then(res => {
       console.log(res)
       if (res.status == 200) {
@@ -661,7 +753,7 @@ Page({
   //用户状态
   userState: function (id) {
     var that = this;
-    app.request("/user/status","GET").then(res => {
+    app.request("/user/status", "GET").then(res => {
       console.log(res)
       if (res.status == 200) {
         console.log(res, 'XYYING================')
@@ -731,7 +823,21 @@ Page({
         }
         my.hideLoading()
       },
-      fail: function () {
+      fail: function (err) {
+        console.log(err, '用户授权失败')
+        if (err.error == 11) {
+
+          my.showAuthGuide({
+            authType: 'LBS',
+            success: (res) => {
+
+            },
+            fail: (error) => {
+              my.alert({ content: '获取位置授权失败' });
+            },
+          });
+
+        }
         my.hideLoading()
         my.getSetting({
           success: function (res) {
@@ -751,6 +857,7 @@ Page({
 
   //底部跳转页面按钮(用户未授权和未实名认证的时候不可以跳转)
   skipPage: function (e) {
+
     let data = e.target.dataset.id
     let that = this
     console.log(that.data, 'oooooo')
@@ -783,11 +890,6 @@ Page({
             that.jiance1();
           }
         }
-      } else if (data.id == 3 && !setting) {
-        my.alert({
-          title: '提示',
-          content: '您附近暂无运营区,暂不可用车',
-        })
       } else if (data.id == 4) {
         if (userStatus.is_bind_mobile == 0) {
           my.navigateTo({

+ 186 - 164
pages/pay/pay.js

@@ -1,4 +1,4 @@
-
+const util = require('../../utils/utils')
 var app = getApp()
 var url = ''
 var intervar;
@@ -60,9 +60,6 @@ Page({
     }
   },
   queding: function () {
-    console.log(this.data.check2)
-    console.log(this.data.check1)
-    console.log(this.data.index)
     if (this.data.check1) {
       //判断当前是不是余额支付
       this.setData({
@@ -104,82 +101,112 @@ Page({
     this.setData({
       screenHeight: app.globalData.screenHeight
     })
-    console.log(this.data.disable, '返回首页')
-    if (options.rent == 'rent') {
+    // if (options.rent == 'rent') {
 
-    } else {
-      url = '/order'
-      //  url = '/rent'
+    // } else {
+    url = '/order'
+    //  url = '/rent'
+    //   this.setData({
+    //     rent: true
+    //   })
+    // }
+    if (options != null &&  options.order.length > 20) {
       this.setData({
-        rent: true
+        order: options.order
+      })
+    } else {
+      my.alert({
+        title: '提示',
+        content: '订单号有误,请重试~',
+        showCancel: false,
+        success: function (res) {
+          wx.reLaunch({
+            url: '/pages/index/index',
+          })
+        }
       })
     }
-    this.setData({
-      order: options.order
-    })
-    console.log(options.order)
+
+
+
   },
   home: function () {
     //点击返回首页
     var that = this;
-    if (app.globalData.compatible) {
-      my.reLaunch({
-        url: '/pages/compatible/index/index',
+
+    if (that.data.index != '') {
+      var data = {
+        pay_type: that.data.index,
+        order_no: that.data.order,
+        coupon_user_bags_id: that.data.coupon_user_bags_id
+      }
+      if (that.data.disable == true) {
+        my.showToast({
+          content: '您的操作过于频繁,请稍后再试~',
+          icon: 'none'
+        })
+        return;
+      }
+      that.setData({
+        disable: true
       })
-    } else {
-      if (that.data.index != '') {
-        var data = {
-          pay_type: that.data.index,
-          order_no: that.data.order,
-          coupon_user_bags_id: that.data.coupon_user_bags_id
-        }
-        if (that.data.disable == true) {
-          return;
-        }
+      if (that.data.date.orders.pay_status == 1) {
+        wx.reLaunch({
+          url: '/pages/index/index',
+        })
+        wx.hideLoading()
+        return
+      }
+      app.request(url + '/pay', data, 'POST').then(res => {
+        console.log(res)
         that.setData({
-          disable: true
+          order: res.data.order_no
         })
-        app.request(url + '/pay', data, 'POST').then(res => {
-          console.log(res)
-          //获取支付参数
-          if (res.status == 200) {
-            if (res.data.pay_order_status == true) {
+        //获取支付参数
+        if (res.status == 200) {
+          this.setData({
+            order: res.data.order_no
+          })
+          if (res.data.pay_order_status == true) {
+            my.reLaunch({
+              url: '/pages/index/index',
+            })
+          } else {
+            if (that.data.index == 1) {
+              my.tradePay({
+                tradeNO: res.data.tradeNo,
+                success(resp) {
+                  console.log(resp, 'zhifubao')
+                  if (resp.resultCode == 9000) {
+                    my.reLaunch({
+                      url: '/pages/index/index',
+                    })
+                  } else {
+                    return
+                  }
+                },
+                fail(err) {
+                  my.showToast({
+                    content: '支付失败',
+                    icon: 'none'
+                  })
+                }
+              })
+              that.setData({
+                disable: false
+              })
+            } else {
               my.reLaunch({
                 url: '/pages/index/index',
               })
-            } else {
-              if (that.data.index == 1) {
-                my.tradePay({
-                  tradeNO: res.data.tradeNo,
-                  success(resp) {
-                    console.log(resp, 'zhifubao')
-                    if (resp.resultCode == 9000) {
-                      my.reLaunch({
-                        url: '/pages/index/index',
-                      })
-                    } else {
-                      return
-                    }
-                  },
-                  fail(err) {
-
-                  }
-                })
-                that.setData({
-                  disable: false
-                })
-              } else {
-                my.reLaunch({
-                  url: '/pages/index/index',
-                })
-              }
             }
           }
-        })
-      }
+        }
+      })
     }
+
   },
-  retryClose: function () {
+  retryClose: util.throttle(function () {
     //点击关锁失败
     var that = this;
     my.showLoading({
@@ -205,7 +232,7 @@ Page({
         })
       },
     })
-  },
+  }, 1000),
   check1: function () {
     //选择余额支付
     this.setData({
@@ -288,19 +315,19 @@ Page({
       animationData1: animation.export()
 
     })
-    setTimeout(function () {
-      var query = my.createSelectorQuery();
-      query.select('.choose').boundingClientRect();
-      query.exec(function (res) {
-        console.log(res)
-        // that.setData({arrowDown:res[0].height+15})
-        animation.translateY(res[0].height).step()
-      })
-      that.setData({
-        animationData1: animation.export(),
-        chooseSize: false
-      })
-    }, 400)
+    // setTimeout(function () {
+    //   var query = my.createSelectorQuery();
+    //   query.select('.choose').boundingClientRect();
+    //   query.exec(function (res) {
+    //     console.log(res)
+    //     // that.setData({arrowDown:res[0].height+15})
+    //     animation.translateY(res[0].height).step()
+    //   })
+    //   that.setData({
+    //     animationData1: animation.export(),
+    //     chooseSize: false
+    //   })
+    // }, 400)
   },
   coupons: function (e) {
     var id = e.currentTarget.dataset.id;
@@ -369,7 +396,12 @@ Page({
       }
     })
   },
-  payment: function () {
+  payment: util.throttle(function () {
+    my.showLoading({
+      content: '加载中',
+      icon: 'none',
+      mask: true
+    })
     //点击立即支付
     var that = this;
     console.log(that.data.index)
@@ -379,71 +411,61 @@ Page({
         order_no: that.data.order,
         coupon_user_bags_id: that.data.coupon_user_bags_id
       }
-      if (that.data.disable == true) {
-        return;
-      }
-      that.setData({
-        disable: true
-      })
+
       app.request(url + '/pay', data, 'POST').then(res => {
         console.log(res)
+        my.hideLoading()
         //获取支付参数
         if (res.status == 200) {
-          if (res.data.pay_order_status == true) {
-            my.reLaunch({
-              url: '/pages/pay_success/pay_success',
-            })
-          } else
-            if (that.data.index == 1) {
-              my.tradePay({
-                tradeNO: res.data.tradeNo,
-                success(resp) {
-                  console.log(resp, 'zhifubao')
-                  if (resp.resultCode == 9000) {
-                    my.reLaunch({
-                      url: '/pages/pay_success/pay_success',
-                    })
-                  } else {
-                    return
-                  }
 
-                },
-                fail(err) {
-                  // console.log(err)
-                  // my.showToast({
-                  //   content: '支付失败',
-                  //   icon: 'none'
-                  // })
-                  // if (res.data.order_no != that.data.order) {
-
-                  //   that.setData({
-                  //     order: res.data.order_no
-                  //   })
-                  // }
+          if (that.data.index == 1) {
+            my.tradePay({
+              tradeNO: res.data.tradeNo,
+              success(resp) {
+                console.log(resp, 'zhifubao')
+                if (resp.resultCode == 9000) {
+                  my.reLaunch({
+                    url: '/pages/pay_success/pay_success',
+                  })
+                } else {
+                  return
                 }
-              })
-              that.setData({
-                disable: false
-              })
-            } else {
 
-            }
-        } else {
-          that.setData({
-            disable: false
-          })
+              },
+              fail(err) {
+                my.hideLoading()
+                my.showToast({
+                  content: '支付失败',
+                  icon: 'none'
+                })
+              }
+            })
+            that.setData({
+              disable: false
+            })
+          } else {
+            my.reLaunch({
+              url: '/pages/pay_success/pay_success?order=' + that.data.date.orders.no,
+            })
+          }
         }
+
       }).catch(err => {
-        console.log(err)
+        my.hideLoading()
+        my.showToast({
+          content: '请求失败,请重试',
+          icon: 'none'
+        })
       })
 
     } else {
+      my.hideLoading()
       my.showToast({
         content: '请选择支付方式',
         icon: 'none'
       })
     }
-  },
+  }, 1500),
   repair: function () {
     my.navigateTo({
       url: '/pages/repair/repair?bike_id=' + this.data.code,
@@ -458,15 +480,8 @@ Page({
     // console.log(this.data.coupon.dataYes)
   },
   onShow: function () {
-    const res = my.getSystemInfoSync()
-    var statusbarH = res.statusBarHeight
-    this.setData({
-      statusbar: statusbarH
-    })
     this.refresh()
-    this.setData({
-      setting: my.getStorageSync({ 'key': 'setting' }).data
-    })
+
   },
   refresh: function () {
     my.showNavigationBarLoading();
@@ -475,43 +490,50 @@ Page({
       content: '加载中...',
       mask: true
     })
-    app.request(url + '/pay-show?order_no=' + that.data.order + '&is_first=true', '', 'GET').then(res => {
-      console.log(res, '支付页面数据')
-      console.log(this.data.disable, '支付页面数据')
+    if (that.data.order.length > 20) {
+      app.request(url + '/pay-show?order_no=' + that.data.order + '&is_first=true', '', 'GET').then(res => {
+        console.log(res, '支付页面数据')
+        console.log(this.data.disable, '支付页面数据')
 
-      if (res.status == 200) {
+        if (res.status == 200) {
 
-        that.setData({
-          date: res.data,
-          balance: res.data.wallet_money,
-          bolear: res.data.wallet_pay_status,
-          code: res.data.orders.bike_no
-        })
-        my.hideLoading({
-          complete: (res) => { },
-        })
-        if (res.data.wallet_pay_status == false) {
           that.setData({
-            check1: false,
-            check2: true,
-            index: 1
+            date: res.data,
+            balance: res.data.wallet_money,
+            bolear: res.data.wallet_pay_status,
+            code: res.data.orders.bike_no
           })
-        } else {
-          that.setData({
-            check1: true,
-            check2: false,
-            index: 2
-          })
-        }
-        if (res.data.user_coupon.is_coupon) {
-          that.setData({
-            coupon_user_bags_id: res.data.user_coupon.coupon_user_bags_id
+          my.hideLoading({
+            complete: (res) => { },
           })
+          if (res.data.wallet_pay_status == false) {
+            that.setData({
+              check1: false,
+              check2: true,
+              index: 1
+            })
+          } else {
+            that.setData({
+              check1: true,
+              check2: false,
+              index: 2
+            })
+          }
+          if (res.data.user_coupon.is_coupon) {
+            that.setData({
+              coupon_user_bags_id: res.data.user_coupon.coupon_user_bags_id
+            })
+          }
+          my.hideNavigationBarLoading()
+          my.stopPullDownRefresh()
         }
-        my.hideNavigationBarLoading()
-        my.stopPullDownRefresh()
-      }
-    })
+      })
+    }
+    else {
+      my.hideLoading()
+      my.hideNavigationBarLoading()
+      my.stopPullDownRefresh()
+    }
   },
   onPullDownRefresh: function () {
     this.refresh()

+ 1 - 1
pages/ride_zige/ride_zige.axml

@@ -31,7 +31,7 @@
   </view>
   <view class="card-list">
     <view class="list-title">交押金用车</view>
-    <view class="card-item" class="{{currentItem==0 ? 'active' :'card-item'}}"   onTap="changeCard" data-id='0' >
+    <view class="card-item" class="{{ currentItem==0 ? 'active' :'card-item'}}"   onTap="changeCard" data-id='0' >
       <view class="item-left">
         <view class="card-title">押金</view>
         <view class="card-text">随时可退 | 极速到账</view>

+ 3 - 8
pages/ride_zige/ride_zige.js

@@ -73,7 +73,7 @@ Page({
     var that = this;
     let url = '';
     var data = '';
-    if (app.globalData.req) {
+    
       console.log(that.data.depShow)
       if (that.data.currentItem == 0) { //缴纳押金
         console.log(11111)
@@ -149,12 +149,7 @@ Page({
           }
         })
       }
-    } else {
-      my.showToast({
-        content: '您的操作过于频繁,请稍后再试~',
-        icon: 'none'
-      })
-    }
+
 
   }, 1000),
   //退还押金
@@ -174,7 +169,7 @@ Page({
         console.log(res);
         if (res.status == 200) {
           my.showToast({
-            content: '申请成功,1个工作日内到账!',
+            content: '押金退回申请成功,请注意查收!',
             icon: 'none'
           })
           setTimeout(function () {

+ 113 - 116
pages/trip/trip.js

@@ -1,117 +1,114 @@
-// pages/trip/trip.js
-var app = getApp()
-const util = require('../../utils/utils.js')
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    orderList: [],
-    pages: 1,//页码
-    links:'',//下一页地址
-  },
-  onLoad: function (options) {
-    this.initial()
-  },
-  initial: util.throttle(function (e) {
-    var that = this;
-    my.showLoading({
-      content: '加载中...',
-      mask: true
-    })
-
-    if (app.globalData.req) {
-      that.getOrder()
-    }
-
-  }, 1000),
-  //获取订单列表
-  getOrder: function () {
-    let that = this
-    let data = {
-      page: that.data.pages
-    }
-    app.request('/orders', data, 'GET', app.globalData.req).then(res => {
-      console.log(res)
-      if (res.status == 200) {
-        let arr=res.data.data
-        var orderList =that.data.orderList.concat(arr);
-        if(arr.length==0){
-          my.showToast({
-            content: '暂无更多~',
-            icon:'none'
-          })
-        }else{
-          
-          that.setData({
-            orderList,
-            links:res.data.meta.pagination.links
-          })
-        }
-      
-        my.hideLoading({
-          complete: (res) => { },
-        })
-      }
-    }).catch(err => {
-      console.log(err)
-    })
-  },
-
-  //跳转订单详情页面
-
-  tripDetail: function (e) {
-    console.log(e, 'ppppppp')
-    let status = e.currentTarget.dataset.index.status
-    let order_no = e.currentTarget.dataset.index.no
-    if (status == 2) {
-      my.navigateTo({
-        url: '/pages/pay/pay?order=' + order_no,
-      })
-    } else {
-      my.navigateTo({
-        url: '/pages/trip_detail/trip_detail?order_no=' + order_no,
-      })
-    }
-
-  },
-  //下拉刷新
-  onReachBottom: function () {
-    if(this.data.links==null){
-      my.showToast({
-        content: '暂无更多',
-        icon:'none'
-      })
-      return
-    }else{
-      let page=this.data.pages++
-      page++
-      this.setData({
-        pages: page
-      })
-      this.getOrder()
-    }
-    
-  },
-  onReady: function () {
-
-  },
-  onShow: function () {
-
-  },
-  onHide: function () {
-
-  },
-  onUnload: function () {
-
-  },
-  onPullDownRefresh: function () {
-
-  },
-
-  onShareAppMessage: function () {
-
-  },
-
+// pages/trip/trip.js
+var app = getApp()
+const util = require('../../utils/utils.js')
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    orderList: [],
+    pages: 1,//页码
+    links:'',//下一页地址
+  },
+  onLoad: function (options) {
+    this.initial()
+  },
+  initial: util.throttle(function (e) {
+    var that = this;
+    my.showLoading({
+      content: '加载中...',
+      mask: true
+    })
+    that.getOrder()
+
+  }, 1000),
+  //获取订单列表
+  getOrder: function () {
+    let that = this
+    let data = {
+      page: that.data.pages
+    }
+    app.request('/orders', data, 'GET').then(res => {
+      console.log(res)
+      if (res.status == 200) {
+        let arr=res.data.data
+        var orderList =that.data.orderList.concat(arr);
+        if(arr.length==0){
+          my.showToast({
+            content: '暂无更多~',
+            icon:'none'
+          })
+        }else{
+          
+          that.setData({
+            orderList,
+            links:res.data.meta.pagination.links
+          })
+        }
+      
+        my.hideLoading({
+          complete: (res) => { },
+        })
+      }
+    }).catch(err => {
+      console.log(err)
+    })
+  },
+
+  //跳转订单详情页面
+
+  tripDetail: function (e) {
+    console.log(e, 'ppppppp')
+    let status = e.currentTarget.dataset.index.status
+    let order_no = e.currentTarget.dataset.index.no
+    if (status == 2) {
+      my.navigateTo({
+        url: '/pages/pay/pay?order=' + order_no,
+      })
+    } else {
+      my.navigateTo({
+        url: '/pages/trip_detail/trip_detail?order_no=' + order_no,
+      })
+    }
+
+  },
+  //下拉刷新
+  onReachBottom: function () {
+    if(this.data.links==null){
+      my.showToast({
+        content: '暂无更多',
+        icon:'none'
+      })
+      return
+    }else{
+      let page=this.data.pages++
+      page++
+      this.setData({
+        pages: page
+      })
+      this.getOrder()
+    }
+    
+  },
+  onReady: function () {
+
+  },
+  onShow: function () {
+
+  },
+  onHide: function () {
+
+  },
+  onUnload: function () {
+
+  },
+  onPullDownRefresh: function () {
+
+  },
+
+  onShareAppMessage: function () {
+
+  },
+
 })

+ 121 - 33
pages/use_bike/use_bike.acss

@@ -1,14 +1,15 @@
-/* required by usingComponents */
 /* pages/use_bike/use_bike.wxss */
 #map {
-  height:90vh;
+  height: calc(100vh - 295px);
+  z-index: 8;
+  /* z-index: 999999999999999999; */
   width: 100%;
 }
 .map-icon {
   position: fixed;
   right:20rpx;
   z-index: 999;
-  bottom:600rpx;
+  bottom:650rpx;
 }
 
 .kefu {
@@ -29,10 +30,11 @@
 
 .use-bike-bottom {
   position: fixed;
-  z-index: 99999;
+  z-index: 999999999;
   background-color: #fff;
   width: 100%;
   bottom: 0;
+  height: 600rpx;
   left: 0;
   padding-bottom: 30rpx;
   border-radius: 40rpx 40rpx 0 0;
@@ -69,7 +71,7 @@
 
 .step1 .bottom-title1 {
 
-  margin-top: 50rpx;
+  margin-top: 70rpx;
   font-size: 60rpx;
 }
 
@@ -79,7 +81,7 @@
   margin-top: 10rpx;
   margin-bottom: 70rpx;
 }
-.bike_no{
+.step1 .bike_no{
   /* margin-bottom: 70rpx; */
   margin-top: 15rpx;
   font-size: 30rpx;
@@ -94,13 +96,26 @@
   font-size: 32rpx;
   font-weight: 600;
   background-color: var(--globleColor);
-   color: var(--fontColor);
+  color: var(--fontColor);
+  margin: 0 auto;
+  margin-top: 20rpx;
+}
+.open_bike1{
+  height: 100rpx;
+  line-height: 100rpx;
+  border-radius: 50rpx;
+  width: 60%;
+  font-size: 32rpx;
+  font-weight: 600;
+  background-color:#999;
+  color: var(--fontColor);
   margin: 0 auto;
 }
 .lanya{
   font-size: 28rpx;
   margin-top: 20rpx;
   color: var(--globleColor);
+  margin-bottom: 30rpx;
 }
 .bottom-list {
   display: flex;
@@ -109,7 +124,7 @@
   text-align: center;
   font-size: 26rpx;
   color: #666666;
-  margin-top: 10rpx;
+  margin-top: 15rpx;
 }
 
 .bottom-list-item {
@@ -124,19 +139,20 @@
 }
 
 .step2-content {
-  margin: 30rpx 0;
+  /* margin: 30rpx 0; */
+  margin-top: 20rpx;
   display: flex;
 }
 
 .step2-left {
-  flex: 0 0 30%;
+  flex: 0 0 23%;
   /* background-color: #f1f1f1; */
   text-align: right;
-  height: 150rpx;
+  /* height: 150rpx; */
 }
 
 .step2-left image {
-  width: 120rpx;
+  width: 100rpx;
   margin-top: 15rpx;
   height: auto;
 }
@@ -150,7 +166,7 @@
 .step2-text {
   font-size: 32rpx;
   font-weight: 500;
-  line-height: 70rpx;
+  line-height: 55rpx;
 }
 
 .step2-text1 {
@@ -198,7 +214,6 @@
   text-align: center;
   border: solid 1rpx var(--globleColor);
   background-color: var(--globleColor);
-   color: var(--fontColor);
 }
 .bell-image{
   height: 40rpx;
@@ -208,12 +223,14 @@
 
 .steps3-list {
   display: flex;
+  margin: 20rpx 0;
 }
 
 .step3-list-item {
   flex: 1;
   text-align: center;
   padding: 30rpx 0;
+  margin-top: 10rpx;
 }
 
 .step3-item-num {
@@ -232,11 +249,14 @@
   padding: 0 50rpx;
   text-align: center;
   height: 100rpx;
-  margin-top: 20rpx;
+  margin-top:40rpx;
   font-size: 34rpx;
   font-weight: bold;
   line-height: 100rpx;
 
+  margin-bottom:55rpx;
+  color: var(--fontColor);
+
 }
 
 .step3-bottom-left {
@@ -259,13 +279,14 @@
 .step3-bottom-right {
   flex: 1;
   background-color: var(--globleColor);
-   color: var(--fontColor);
+  color: var(--fontColor);
   border-radius: 50rpx;
 }
 
 .step3-parking {
   text-align: center;
   padding: 30rpx 0;
+  margin-top: 50rpx;
 }
 
 .step3-park-title1 {
@@ -287,7 +308,7 @@
 .frame {
   background-color: rgba(0, 0, 0, 0.6);
   position: fixed;
-  z-index: 999999;
+  z-index: 9999999999999999;
   top: 0;
   left: 0;
   width: 100%;
@@ -298,9 +319,12 @@
   position: fixed;
   background-color: #fff;
   width: 100%;
+  height: 500rpx;
   border-radius: 40rpx 40rpx 0 0;
   bottom: 0;
+  z-index: 99999999;
   padding-bottom: 100rpx;
+  text-align: center;
 }
 
 .frame-title {
@@ -309,14 +333,17 @@
   padding: 0 30rpx;
   font-size: 28rpx;
 }
-
+.cha{
+  float: left;
+}
 .frame-kefu {
   float: right;
   font-size: 28rpx;
 }
 
 .suo {
-  width: 100%;
+  width: 80%;
+  margin: 0 auto;
 }
 
 .frame-con {
@@ -349,7 +376,7 @@
   margin-left: 50rpx;
   border-radius: 50rpx;
   background-color: var(--globleColor);
-   color: var(--fontColor);
+  color: var(--fontColor);
 }
 /* 未开启位置权限 */
 .pay-frame{
@@ -401,20 +428,20 @@
 .ad-list {
   background-color: #333333;
   opacity: 0.9;
-  height: 80rpx;
+  height: 70rpx;
   border-radius: 50rpx;
-  width: 90%;
-  left: 5%;
+  width: 94%; 
+  left: 3%;
   position: fixed;
-  top: 30rpx;
-  z-index: 9999;
+  top:30rpx;
+  z-index: 9998;
 }
 
 .mess {
   display: inline-block;
   vertical-align: middle;
   height: 40rpx;
-  width: 40rpx;
+  width:40rpx;
 
   margin: 20rpx 30rpx 20rpx 30rpx;
 }
@@ -428,18 +455,18 @@
   margin: 15rpx 30rpx 15rpx 30rpx;
 }
 
-.swiper {
-  height: 80rpx;
+.ad-list .swiper {
+  height: 70rpx;
   position: fixed;
   width: 68%;
   left: 120rpx;
   top: 30rpx;
-  z-index: 99999;
+  z-index: 99998;
 }
 
-.swiper-item {
-  height: 80rpx;
-  line-height: 70rpx;
+.ad-list .swiper .swiper-item {
+  height: 70rpx;
+  line-height:70rpx;
 
 }
 
@@ -447,5 +474,66 @@
   display: inline-block;
   color: #fff;
   font-size: 26rpx;
-  vertical-align: middle;
+  /* vertical-align: middle; */
+}
+.back-home{
+  height: 50rpx;
+  width:50rpx;
+  position: absolute;
+  top: 35rpx;
+  left: 30rpx;
+}
+.marquee {
+  width: 80%;
+  overflow: hidden;
+}
+
+.marqueeTitle {
+  color: #333333;
+  font-size: 26rpx;
+}
+
+.inform {
+  display: flex;
+  align-items: center;
+  width: 94%;
+  left: 3%;
+  height: 68rpx;
+  background: white;
+  color: #333333;
+  position: fixed;
+  z-index: 9999;
+  font-size: 26rpx;
+  justify-content: space-between;
+  border-radius: 10rpx;
+}
+
+.inform-img {
+  display: flex;
+  height: 100%;
+  align-items: center;
+}
+/* 轮播图 */
+.ad-swiper{
+  position: fixed;
+  top: 30rpx;
+  z-index: 9999;
+  height: 200rpx;
+  width: 94%;
+  left: 3%;
+  /* background-color: #fff; */
+}
+.ad-swiper-list{
+  height: 200rpx;
+}
+
+/* 动态绑定地图样式 */
+.map1{
+  height: calc(100vh - 80px)!important;
+}
+.map2{
+  height: calc(100vh - 375px)!important;
 }
+.map3{
+  height: calc(100vh - 270px)!important;
+}

+ 37 - 5
pages/use_bike/use_bike.axml

@@ -17,10 +17,10 @@
   </view>
 
   <!-- 车辆未开锁弹框 -->
-  <view class="frame" a:if="{{frame==true}}">
+  <view class="frame"  hidden="{{!frame}}">
     <view class="frame-content">
       <view class="frame-title">
-        <text class="iconfont icon-cha" onTap="frameClose"></text>
+        <text class="iconfont icon-cha cha" onTap="frameClose"></text>
         <text class="frame-kefu" onTap="keFu">联系客服</text>
       </view>
 
@@ -51,22 +51,53 @@
   <!-- 公告栏 -->
   <view class="ad-list">
     <image src="../../img/mess.png" alt="" class="mess" />
-    <swiper class="swiper" autoplay='true' vertical='true'>
+    <swiper class="swiper" autoplay='true' vertical='true' interval='10000'>
       <swiper-item class="swiper-item">
         <view class="ad-item">不在还车点换车,将收取调度费</view>
       </swiper-item>
-      <swiper-item class="swiper-item">
+      <!-- <swiper-item class="swiper-item">
         <view class="ad-item">车辆静止三十分钟后将自动还车~</view>
-      </swiper-item>
+      </swiper-item> -->
       <swiper-item class="swiper-item" a:if="{{bikeMessage.activity}}">
         <view class="ad-item">{{bikeMessage.activity}}</view>
       </swiper-item>
     </swiper>
     <!-- <image src="../../img/change.png" class="change"></image> -->
   </view>
+  <!-- 轮播图 -->
+  <view class="ad-swiper" a:if="{{ads.length>0 && steps!=3}}">
+    <swiper class="ad-swiper-list" indicator-dots='{{ads.length > 1 ? true : false}}'
+      indicator-color='var(--globleColor)' autoplay='true' interval="5000" current="{{currentSwiper}}"
+      bindchange="swiperChange">
+      <swiper-item a:for="{{ads}}" a:key="key" class="ad-swiper-item">
+        <image src="{{item.surface}}" style="width:100%;height:100%;" bindtap="swiper" data-index="{{index}}"
+          data-type="{{item.type}}" data-name="{{item.name}}" data-detail="{{item.detail}}" data-id="{{item.id}}"
+          a:if="{{item.type!='wxTencentAdvertisement'}}"></image>
+      </swiper-item>
+    </swiper>
+  </view>
+
+  <view class="inform" style="top:{{ads.length>0 && steps!==3 ? '250rpx' : steps==3 ? '60px' : '30rpx'}}"
+    bindtap="tap_notice" a:if="{{notice.id}}" data-id="{{notice.id}}">
+    <view class="inform-img">
+      <image src="../../img/notice.png" class="inform-image" style="width:48rpx;height:48rpx;padding-left:20rpx;">
+      </image>
+    </view>
+    <view class='marquee' style='width:{{marqueeWidth}}rpx;'>
+      <view class='marqueeTitle' style="width:{{length}}rpx;transform:translateX( {{marqueeDistance}}rpx);">
+        {{notice.description}}</view>
+    </view>
+    <image src="../../img/more.png" style="width:48rpx;height:48rpx;"></image>
+  </view>
+  <view class="use-bike-bottom" catchtouchmove='ture' a:if="{{frame == false}}">
+
+
+
+
   <view class="use-bike-bottom" catchtouchmove='ture'>
     <!-- 骑行第一步 -->
     <view class="step1" a:if="{{steps==1}}">
+      <image src="../../img/home.png" class="back-home" bindtap="backHome"></image>
       <view class="bottom-title1">{{bikeMessage.riding_bike_mileage||'--'}}公里</view>
       <view class="bottom-title2">剩余电量可行驶</view>
       
@@ -76,6 +107,7 @@
     </view>
     <!-- 骑行第二步 -->
     <view class="step2" a:if="{{steps==2}}">
+      <image src="../../img/home.png" class="back-home" bindtap="backHome"></image>
       <view class="step2-title">温馨提示</view>
       <view class="step2-content" a:if="{{setting.is_whole_area_huanche!==1}}">
         <view class="step2-left">

+ 405 - 284
pages/use_bike/use_bike.js

@@ -1,4 +1,6 @@
 
+// const log = require('../../utils/log')
+const { getCache, setCache, CacheKeys } = require('../../utils/cache')
 var app = getApp()
 var interval;
 var inter1;
@@ -10,7 +12,7 @@ const util = require('../../utils/utils.js');
 var interval;
 //蓝牙操作方法
 var BluetoothOperate = require('../../service/bluetooth.js');
-const { content } = require('../../service/dataTransition.js');
+//const { content } = require('../../service/dataTransition.js');
 let bluetoothOperate = new BluetoothOperate();
 let machineNO = "" //设备编号
 let key = "" //蓝牙密钥
@@ -18,6 +20,13 @@ let operateType = ''  //'open'开锁 'close'上锁 'bell'寻铃 'temporaryClose'
 
 Page({
   data: {
+    marqueeDistance: 520, //初始滚动距离 用到
+    marqueeWidth: 560, //通知公告用到
+    marqueePace: 0.6, //滚动速度
+    length: '',//通知公告
+    size: 26, //通知公告用到
+    notice: '',//通知公告
+    currentSwiper: 0,
     nowBikeStatus: '',//当前车辆的状态
     money: { time_money: 0, dispatch_money: 0, total_money: 0 },//骑行费用
     steps: 1,//开锁步骤
@@ -57,21 +66,23 @@ Page({
     countTimeShow: false,
     dispatch_money: 0,//调度费
     area_id: '',//区域id
+    mapHeight: 'calc(100vh - 300px)',
 
   },
   onShow: function () {
     let that = this
-     that.setData({
-      polygons1:[],
-      polygons:[]
+    that.setData({
+      polygons1: [],
+      polygons: []
     })
     my.setNavigationBar({
       title: app.globalData.title
     })
     clearInterval(locationTerval);
-    that.userState()
-    that.posiLoca()
+
     app.login().then(res => {
+      that.userState()
+      that.posiLoca()
       that.chushiPosiloc()
       if (that.data.code) {
         that.getBikeMessage()
@@ -80,6 +91,7 @@ Page({
     if (that.data.order != undefined) {
       that.chushi()
     }
+    // that.reloadMap()
   },
   //初始化位之信息并获取区域
   chushiPosiloc: function () {
@@ -103,6 +115,18 @@ Page({
       fail: function (err) {
         console.log(err)
         my.hideLoading()
+        if (err.error == 11) {
+
+          my.showAuthGuide({
+            authType: 'LBS',
+            success: (res) => {
+
+            },
+            fail: (error) => {
+              my.alert({ content: '获取位置授权失败' });
+            },
+          })
+        }
         my.getSetting({
           success: function (res) {
             // console.log(res)
@@ -119,9 +143,34 @@ Page({
     })
   },
   onLoad: function (options) {
-    console.log(options, '--------------------------')
     let that = this
-
+    // if (options != null && options instanceof Object && options.hasOwnProperty('q')) {
+    //   var code1 = decodeURIComponent(options.q)
+    //   var index = code1.lastIndexOf("\=");
+    //   let code = code1.substring(index + 1, code1.length);
+    //   that.setData({
+    //     code: code
+    //   })
+    // } else if (options != null && options instanceof Object && options.hasOwnProperty('order') && options.order.length > 20) {
+    //   that.setData({
+    //     order: options.order,
+    //   })
+    // } else if (options != null && options instanceof Object && options.hasOwnProperty('code')) {
+    //   that.setData({
+    //     code: options.code
+    //   })
+    // } else {
+    //   my.alert({
+    //     title: '提示',
+    //     content: '车牌号有误,请重试~',
+    //     success: function (res) {
+    //       my.reLaunch({
+    //         url: '/pages/index/index',
+    //       })
+    //     }
+    //   })
+    //   return
+    // }
     if (app.globalData.scanCode) {
       // console.log('扫码加载')
       // var code1 = decodeURIComponent(options.query.qrCode)
@@ -140,64 +189,124 @@ Page({
         code: options.code
       })
     }
-    // let that = this
-    // let token = my.getStorageSync({ 'key': 'token' }).data
-    // let data = Math.round(new Date().getTime() / 1000).toString();;
-    // let tokenTime = my.getStorageSync({ 'key': 'token_time' }).data
-    // let cha = data - tokenTime
-    // let data1 = 60 * 60 * 24
-    // if (!token) {
-    //   that.token()
-    // } else if (cha > data1) {
-    //   my.removeStorageSync({ 'key': 'token' }).data
-    //   that.token()
-    // } else {
-    //   console.log(options, 'order_no')
-    //   let home = my.getStorageSync({ 'key': 'home' }).data
-    //   // that.posiLoca();
-    //   let area_id = home.id
-    //   that.ban_stop(area_id)
-    //   if (options.order != undefined) {
-    //     that.setData({
-    //       order: options.order,
-    //     })
-    //     that.chushi()
-    //   }
-    //   if (options.code != undefined) {
-    //     that.setData({
-    //       code: options.code
-    //     })
-    //     this.getBikeMessage(options)
-    //   }
+  },
+  getNotice(id) {
+    let data = {
+      'area_id': id
+    }
+    let isCache = getCache('Notice:' + id)
+    console.log(isCache, 'isCache')
+    if (isCache) {
+      if (isCache != null && isCache instanceof Object && !isCache.hasOwnProperty('id')) return
+      this.setData({ notice: isCache })
+      var length = isCache.description.length * this.data.size; //计算文字的长度
+      this.setData({
+        length: length
+      })
+      if (this.data.length > this.data.marqueeWidth) {
+        this.noticeRun();
+      } else {
+        this.setData({
+          marqueeDistance: 0
+        })
+      }
+      return
+    }
+    app.request("/index/an", data, "GET").then(res => {
+      if (200 == res.status) {
+        setCache('Notice:' + id, res.data)
+        if (res.data != null && res.data instanceof Object && !res.data.hasOwnProperty('id')) return
 
-    //   this.setData({
-    //     code: options.code
-    //   })
-    // }
+        this.setData({ notice: res.data })
+        var length = res.data.description.length * this.data.size; //计算文字的长度
+        this.setData({
+          length: length
+        })
+        if (this.data.length > this.data.marqueeWidth) {
+          this.noticeRun();
+        } else {
+          this.setData({
+            marqueeDistance: 0
+          })
+        }
+      }
+    }).catch(err => {
+      // console.log(err)
+    })
+  },
+  noticeRun: function () {
+    var that = this;
+    clearInterval(mytime);
+    mytime = setInterval(function () {
+      if (-that.data.marqueeDistance < that.data.length) {
+        that.setData({
+          marqueeDistance: that.data.marqueeDistance - that.data.marqueePace,
+        })
+      } else {
+        clearInterval(mytime);
+        that.setData({
+          marqueeDistance: that.data.marqueeWidth
+        });
+        that.noticeRun();
+      }
+    }, 10)
   },
-  //获取token
-  // token: function () {
-  //   my.getAuthCode({
-  //     success: function (res) {
-  //       var data = {
-  //         'code': res.authCode,
-  //         'appid': app.globalData.appid,
-  //         'type': 1
-  //       };
-  //       app.request('/auth/weapp-login', data, 'post').then(res => {
-  //         my.setStorageSync({ 'key': 'token', data: res.data.token });
-  //         my.setStorageSync({ 'key': 'session_key', data: res.data.session_key });
-  //         my.setStorageSync({ 'key': 'token_time', data: res.data.exp });
-  //         my.setStorageSync({ 'key': 'user_ID', data: res.data.user.id });
-  //       })
-  //     }
-  //   })
-  // },
+  //广告列表
+  adsList: function (id) {
+    var that = this;
+    var area_id = ''
+    if (id != undefined) {
+      area_id = id
+    } else {
+      area_id = 0
+    }
+
+    let isCache = getCache('ads:' + id)
+    if (isCache) {
+      if (isCache != '') return
+      if (isCache != null && isCache instanceof Object && isCache.hasOwnProperty('header')) {
+        that.setData({
+          ads: isCache.header
+        })
+      }
+      if (isCache != null && isCache instanceof Object && isCache.hasOwnProperty('mid')) {
+        that.setData({
+          mid: res.data.mid,
+          adFrame: true
+        })
+      }
+      return
+    }
+
+    app.request("/ads?area_id=" + area_id + "&position[]=mid&position[]=header&position[]=footer", '', "GET").then(res => {
+      if (res.status == 200) {
+        setCache('ads:' + id, res.data)
+        if (res.data != '') return
+        if (res.data.header) {
+          that.setData({
+            ads: res.data.header
+          })
+        }
+        if (res.data.mid) {
+          that.setData({
+            mid: res.data.mid,
+            adFrame: true
+          })
+        }
+      }
+    }).catch(err => {
+      // console.log(err)
+    })
+  },
+
+
+
+
   //用户状态
   userState: function (area_id) {
     var that = this;
-   
-    app.request("/user/status","GET").then(res => {
+
+    app.request("/user/status", "GET").then(res => {
       console.log(res, 'zhuangtai')
       if (res.status == 200) {
         my.setStorageSync({ 'key': 'userState', data: res.data });
@@ -207,11 +316,11 @@ Page({
           })
           that.chushi()
         }
-         /**
-        * 未支付直接调转支付
-        * mead
-        */
-        if(res.data.is_pay_order){
+        /**
+       * 未支付直接调转支付
+       * mead
+       */
+        if (res.data.is_pay_order) {
           my.navigateTo({
             url: '/pages/pay/pay?order=' + res.data.is_pay_order,
           })
@@ -233,7 +342,7 @@ Page({
             title: '提示',
             content: '当前车子还未投放请换辆车子骑行吧~',
             success: function (res) {
-              wx.reLaunch({
+              my.reLaunch({
                 url: '/pages/index/index',
               })
             }
@@ -244,7 +353,7 @@ Page({
             title: '提示',
             content: '当前车子电量过低请换辆车子骑行吧~',
             success: function (res) {
-              wx.reLaunch({
+              my.reLaunch({
                 url: '/pages/index/index',
               })
             }
@@ -255,7 +364,7 @@ Page({
             title: '提示',
             content: '当前车子出现故障请换辆车子骑行吧~',
             success: function (res) {
-              wx.reLaunch({
+              my.reLaunch({
                 url: '/pages/index/index',
               })
             }
@@ -266,7 +375,7 @@ Page({
             title: '提示',
             content: '当前车子正在骑行请换辆车子骑行吧~',
             success: function (res) {
-              wx.reLaunch({
+              my.reLaunch({
                 url: '/pages/index/index',
               })
             }
@@ -281,7 +390,6 @@ Page({
   //骑行区禁停区车辆
   home: function () {
     //请求首页接口和一些设置。
-    console.log('测试')
     var that = this;
     if (that.data.longitude != '' && that.data.latitude != '') {
       //116.411027
@@ -299,6 +407,8 @@ Page({
           })
           let area_id = res.data.id
           that.ban_stop(area_id)
+          that.getNotice(area_id)
+          that.adsList(area_id)
           console.log(data, '区域')
           my.setStorageSync({ 'key': 'home', data: data });
 
@@ -328,6 +438,16 @@ Page({
     that.setData({
       polygons1: that.data.polygons1.concat(home)
     })
+
+    let isCache = getCache('BAN_STOP:' + area_id)
+    if (isCache) {
+      that.setData({
+        markers: that.data.markers.concat(isCache.centres),
+        polygons: that.data.polygons1.concat(isCache.polygons),
+      })
+      return
+    }
+
     var data1 = {
       'area_id': area_id
     }
@@ -383,12 +503,16 @@ Page({
           that.setData({
             steps: 3
           })
+          my.setStorageSync({ 'key': 'nowBikeStatus', data: 0 })
+          //   that.reloadMap()
         } else if (bike_status == 0 && userStatus.is_ride_order != false) {
           // 临时停车
           that.setData({
             parkStatus: 1,
             steps: 3
           })
+          my.setStorageSync({ 'key': 'nowBikeStatus', data: 1 })
+          //  that.reloadMap()
           that.stopDownTime()
         }
         app.request('/bike/' + that.data.code, '', 'GET').then(res => {
@@ -428,21 +552,51 @@ Page({
   //获取当前位置
   posiLoca: function () {
     var that = this;
-    locationTerval = setInterval(function () {
-      my.getLocation({
-        type: 'gcj02',
-        success: (res) => {
-          console.log('经纬度为:+++++++++++2323++++++++++' + res.latitude + '++++++++' + res.longitude)
-          var latitude = res.latitude
-          var longitude = res.longitude
-          my.hideLoading()
-          that.setData({
-            longitude: longitude,
-            latitude: latitude,
+    my.showLoading({
+      content: '正在定位...',
+      icon: 'none'
+    })
+    // locationTerval = setInterval(function () {
+    my.getLocation({
+      type: 'gcj02',
+      success: (res) => {
+        var latitude = res.latitude
+        var longitude = res.longitude
+        my.hideLoading()
+        that.setData({
+          longitude: longitude,
+          latitude: latitude,
+        })
+        that.home()
+      },
+      fail: function (err) {
+       my.hideLoading()
+        if (err.error == 11) {
+          my.showAuthGuide({
+            authType: 'LBS',
+            success: (res) => {
+
+            },
+            fail: (error) => {
+              my.alert({ content: '获取位置授权失败' });
+            },
           })
-        },
-      })
-    }, 5000)
+        }
+        my.getSetting({
+          success: function (res) {
+            // console.log(res)
+            var statu = res.authSetting;
+            if (statu['scope.userLocation'] == false) {
+              that.setData({
+                background: true,
+                location: true
+              })
+            }
+          }
+        })
+      }
+    })
+
   },
   //获取蓝牙秘钥
   getSecretKey(box_no) {
@@ -581,6 +735,7 @@ Page({
 
   //获取车辆信息
   getBikeMessage: function () {
+    my.showLoading()
     var that = this;
     app.request('/bike/' + that.data.code, '', 'GET').then(res => {
       console.log(res, '车辆信息--------------------')
@@ -593,66 +748,6 @@ Page({
           steps: 1
         }),
           key = res.data.key
-        // if (res.data.is_link == 0) {
-        //   my.alert({
-        //     title: '提示',
-        //     content: '当前车子已下线请换辆车子骑行吧~',
-        //     success: function (res) {
-        //       my.reLaunch({
-        //         url: '/pages/index/index',
-        //       })
-        //     }
-        //   })
-        //   return;
-        // } else if (res.data.put_status == 0) {
-        //   my.alert({
-        //     title: '提示',
-        //     content: '当前车子还未投放请换辆车子骑行吧~',
-        //     success: function (res) {
-        //       my.reLaunch({
-        //         url: '/pages/index/index',
-        //       })
-        //     }
-        //   })
-        //   return;
-        // } else if (res.data.is_low_battery_power == 0) {
-        //   my.alert({
-        //     title: '提示',
-        //     content: '当前车子电量过低请换辆车子骑行吧~',
-        //     success: function (res) {
-        //       my.reLaunch({
-        //         url: '/pages/index/index',
-        //       })
-        //     }
-        //   })
-        //   return;
-        // } else if (res.data.is_trouble == 1) {
-        //   my.alert({
-        //     title: '提示',
-        //     content: '当前车子出现故障请换辆车子骑行吧~',
-        //     success: function (res) {
-        //       my.reLaunch({
-        //         url: '/pages/index/index',
-        //       })
-        //     }
-        //   })
-        //   return;
-        // } else if (res.data.is_riding == 1) {
-        //   my.alert({
-        //     title: '提示',
-        //     content: '当前车子正在骑行请换辆车子骑行吧~',
-        //     success: function (res) {
-        //       my.reLaunch({
-        //         url: '/pages/index/index',
-        //       })
-        //     }
-        //   })
-        //   return;
-        // } else {
-        // let box_no = res.data.box_no
-
-        // that.getSecretKey(box_no)
-        // }
       } else {
         setTimeout(function () {
           my.reLaunch({
@@ -669,115 +764,135 @@ Page({
     let that = this
     var userStatus = my.getStorageSync({ 'key': 'userState' }).data;
     var setting = my.getStorageSync({ 'key': 'setting' }).data;
-    console.log(userStatus,'旭颖')
-    console.log(setting,'旭颖')
-
-    //未绑定手机号
+    console.log(userStatus, '旭颖')
+    console.log(setting, '旭颖')
     if (userStatus.is_bind_mobile == 0) {
       my.navigateTo({
         url: '/pages/authorization/authorization',
       })
       //未实名认证
-    } else if (userStatus.is_card_certified == 0 && setting.is_card == 1) {
-      my.navigateTo({
-        url: '/pages/real_name/real_name',
-      })
-    } else if (userStatus.is_deposit == 0 && setting.is_deposit != 0 && userStatus.is_coupon_deposit_free == false) {
-      my.navigateTo({
-        url: '/pages/ride_zige/ride_zige',
-      })
-    } else if (userStatus.is_ride_order !== false) {
-      console.log(userStatus, 'yyyyyyyyyyyyyyy')
-      my.alert({
-        title: '提示',
-        content: '您有一个正在骑行中的订单',
-        success: function (res) {
-          my.reLaunch({
-            url: '/pages/index/index',
-          })
-        }
-      })
-    } else if (userStatus.is_pay_order != false && userStatus.is_pay_order != undefined) {
-      my.alert({
-        title: '提示',
-        content: '您有一个待支付订单,请先支付',
-        success: function (res) {
-          my.reLaunch({
-            url: '/pages/index/index',
-          })
-        }
-      })
-    }
-    else {
-      that.setData({
-        steps: 2
-      })
     }
+    else
+      if (userStatus.is_card_certified == 0 && setting.is_card == 1) {
+        my.navigateTo({
+          url: '/pages/real_name/real_name',
+        })
+      }//是否缴纳押金 
+      else if (userStatus.is_deposit == 0 && setting.is_deposit != 0 && userStatus.is_coupon_deposit_free == false) {
+        my.navigateTo({
+          url: '/pages/ride_zige/ride_zige',
+        })
+      } else if (userStatus.is_ride_order != false) {
+        my.alert({
+          title: '提示',
+          content: '您有一个正在骑行中的订单',
+          success: function (res) {
+            my.reLaunch({
+              url: '/pages/index/index',
+            })
+          }
+        })
+      } else if (userStatus.is_pay_order != false && userStatus.is_pay_order != undefined) {
+        my.alert({
+          title: '提示',
+          content: '您有一个待支付订单,请先支付',
+          success: function (res) {
+            my.reLaunch({
+              url: '/pages/index/index',
+            })
+          }
+        })
+      }
+      else {
+        that.setData({
+          steps: 2
+        })
+        //   this.reloadMap()
+      }
+
+
+
+  },
+
+
+
+  reloadMap(classname = 'use-bike-bottom') {
+    let query = my.createSelectorQuery();
+    let th = this;
+    query.select('.' + classname).boundingClientRect(function (rect) {
+      if (rect != null && rect instanceof Object && rect.hasOwnProperty('height')) {
+        let height = rect.height || 300;
+        th.setData({ mapHeight: 'calc(100vh - ' + (height) + 'px)' });
+      } else {
+        let height = 300;
+        th.setData({ mapHeight: 'calc(100vh - ' + height + 'px)' });
+      }
+    }).exec();
   },
   //倒计时
 
   //临时停车倒计时
   stopDownTime() {
-    let that = this
-    let endTime = Date.parse(new Date()); //date日期类型
-    let startTime
-    if (!that.data.temporaryTime || that.data.temporaryTime == null) {
-      startTime = endTime
-    } else {
-      let data1 = that.data.temporaryTime
-      let data2 = data1.replace(/-/g, '/')
-      let data3 = new Date(data2)
-      startTime = data3.getTime()
-    }
-    let totleTime = 1800
-    clearInterval(linshiStop)
-    console.log(endTime, 'endTime')
-    console.log(startTime, 'startTime')
-    let date3 = endTime - startTime;
-    console.log(date3, 'date3')
-    //计算出相差天数
-    var days = Math.floor(date3 / (24 * 3600 * 1000));
-    //计算出小时数
-    var leave1 = date3 % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
-    var hours = Math.floor(leave1 / (3600 * 1000));
-    //计算相差分钟数
-    var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
-    var minutes = Math.floor(leave2 / (60 * 1000));
-    //计算相差秒数
-    var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
-    var seconds = Math.round(leave3 / 1000);
-    console.log(minutes, 'minutes')
+    // let that = this
+    // let endTime = Date.parse(new Date()); //date日期类型
+    // let startTime
+    // if (!that.data.temporaryTime || that.data.temporaryTime == null) {
+    //   startTime = endTime
+    // } else {
+    //   let data1 = that.data.temporaryTime
+    //   let data2 = data1.replace(/-/g, '/')
+    //   let data3 = new Date(data2)
+    //   startTime = data3.getTime()
+    // }
+    // let totleTime = 1800
+    // clearInterval(linshiStop)
+    // console.log(endTime, 'endTime')
+    // console.log(startTime, 'startTime')
+    // let date3 = endTime - startTime;
+    // console.log(date3, 'date3')
+    // //计算出相差天数
+    // var days = Math.floor(date3 / (24 * 3600 * 1000));
+    // //计算出小时数
+    // var leave1 = date3 % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
+    // var hours = Math.floor(leave1 / (3600 * 1000));
+    // //计算相差分钟数
+    // var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
+    // var minutes = Math.floor(leave2 / (60 * 1000));
+    // //计算相差秒数
+    // var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
+    // var seconds = Math.round(leave3 / 1000);
+    // console.log(minutes, 'minutes')
 
-    let chaTime = totleTime - minutes * 60
-    console.log(chaTime, 'chaTime')
-    linshiStop = setInterval(function () {
-      let test = 30 * 60 * 1000
-      console.log(test, 'test')
-      if (date3 > test) {
-        that.setData({
-          stopMiao: 0,
-          stopmMinute: 0
-        })
-        clearInterval(linshiStop)
-      } else if (chaTime <= 0) {
-        that.setData({
-          stopMiao: 0,
-          stopmMinute: 0
-        })
-        clearInterval(linshiStop)
-      } else {
-        console.log(minutes, 'pppp')
-        chaTime--
+    // let chaTime = totleTime - minutes * 60
+    // console.log(chaTime, 'chaTime')
+    // linshiStop = setInterval(function () {
+    //   let test = 30 * 60 * 1000
+    //   console.log(test, 'test')
+    //   if (date3 > test) {
+    //     that.setData({
+    //       stopMiao: 0,
+    //       stopmMinute: 0
+    //     })
+    //     clearInterval(linshiStop)
+    //   } else if (chaTime <= 0) {
+    //     that.setData({
+    //       stopMiao: 0,
+    //       stopmMinute: 0
+    //     })
+    //     clearInterval(linshiStop)
+    //   } else {
+    //     console.log(minutes, 'pppp')
+    //     chaTime--
 
-        let fen = parseInt(chaTime / 60);
-        let miao = parseInt(chaTime % 60);
-        that.setData({
-          stopMiao: miao,
-          stopmMinute: fen
-        })
-      }
+    //     let fen = parseInt(chaTime / 60);
+    //     let miao = parseInt(chaTime % 60);
+    //     that.setData({
+    //       stopMiao: miao,
+    //       stopmMinute: fen
+    //     })
+    //   }
 
-    }, 1000)
+    // }, 1000)
 
   },
   //开锁方法
@@ -793,7 +908,7 @@ Page({
       lng: that.data.longitude,
       area_id: my.getStorageSync({ 'key': 'home' }).data.id,
     }
-    app.request('/bike/open-lock', data, 'POST', app.globalData.req).then(res => {
+    app.request('/bike/open-lock', data, 'POST').then(res => {
       console.log(res)
       if (res.status == 200) {
         that.setData({
@@ -804,6 +919,7 @@ Page({
         //蓝牙开锁
         operateType = 'open'
         bluetoothOperate.start(operateType, machineNO, key, (flag) => {
+          bluetoothOperate.end((flag) => { });
         });
         my.hideLoading()
       } else {
@@ -841,6 +957,7 @@ Page({
           my.hideLoading()
           operateType = 'open'
           bluetoothOperate.start(operateType, machineNO, key, (flag) => {
+            bluetoothOperate.end((flag) => { });
           });
           my.showToast({
             content: '开锁成功',
@@ -946,6 +1063,7 @@ Page({
           //flag == true 操作成功
           //flag == false 操作失败
           //end
+          bluetoothOperate.end((flag) => { });
         });
         res.data.is_ok == true && my.showToast({
           content: '找车成功',
@@ -992,6 +1110,7 @@ Page({
           //flag == true 操作成功
           //flag == false 操作失败
           //end
+          bluetoothOperate.end((flag) => { });
         });
         my.showToast({
           content: '停车成功',
@@ -1039,6 +1158,7 @@ Page({
           //flag == true 操作成功
           //flag == false 操作失败
           //end
+          bluetoothOperate.end((flag) => { });
         });
         my.showToast({
           content: '开车成功',
@@ -1102,78 +1222,59 @@ Page({
       lat: that.data.latitude,
       lng: that.data.longitude
     }
-    app.request('/bike/check-is-riding-area', data, 'POST').then(res => {
-      console.log(res)
-      if (res.status == 200) {
-        clearInterval(linshiStop);
-        my.setStorageSync({ 'key': 'stopMiao', data: 0 })
-        my.setStorageSync({ 'key': 'stopmMinute', data: 30 })
-        my.hideNavigationBarLoading(), my.hideLoading()
-        that.closeLock(data)
-        //订单结束关闭蓝牙
-        bluetoothOperate.end((flag) => { });
-      } else if (res.status == 450) {
-        my.showToast({
-          content: '运动中不能关锁,请稍后重试',
-          icon: 'none',
-          duration: 5000,
-          mask: true
-        })
-        my.hideLoading()
-      }
-    }).catch(err => {
-      my.hideLoading()
-      console.log(err)
-    })
-  }, 1000),
-  closeLock: function (data) {
-    var that = this;
-
     app.request('/bike/close-lock', data, 'POST').then(res => {
       console.log(res)
+      my.hideLoading()
       if (res.status == 200) {
-        console.log('锁车成功')
-        clearInterval(interval);
+        console.log(res, '结束用车')
         clearInterval(linshiStop);
-        //蓝牙锁车操作 确定结束用车
-        operateType = 'close'
-        bluetoothOperate.start(operateType, machineNO, key, (flag) => {
-          //flag == true 操作成功
-          //flag == false 操作失败
-          //end
-        });
+        clearInterval(interval);
         my.setStorageSync({ 'key': 'stopMiao', data: 0 })
         my.setStorageSync({ 'key': 'stopmMinute', data: 30 })
-        my.hideLoading()
-
+        my.hideNavigationBarLoading(), my.hideLoading()
         my.reLaunch({
           url: '../pay/pay?order=' + res.data.no
         })
+        //蓝牙锁车操作 确定结束用车
+        if (machineNO && key) {
+          operateType = 'close'
+          bluetoothOperate.start(operateType, machineNO, key, (flag) => {
+            //flag == true 操作成功
+            //flag == false 操作失败
+            //end
+            //订单结束关闭蓝牙
+            bluetoothOperate.end((flag) => { });
+          });
+        }
 
       } else if (res.status == 450) {
-        //运动中不能锁车请5s后重试
         my.showToast({
           content: '运动中不能关锁,请稍后重试',
           icon: 'none',
           duration: 5000,
           mask: true
         })
-        my.hideLoading()
-
       }
     }).catch(err => {
-      console.log(err)
+      my.showToast({
+        content: '关锁失败,请重试。',
+        icon: 'none',
+        duration: 5000,
+      })
+      wx.hideLoading()
     })
+  }, 1000),
 
-  },
   //取消锁车
   cancelEndBike: function () {
     console.log(my.getStorageSync({ 'key': 'nowBikeStatus' }).data)
     let that = this
     that.setData({
       chaButton: 0,
+      dispatch_money: 0,
       parkStatus: my.getStorageSync({ 'key': 'nowBikeStatus' }).data
     })
+    // that.reloadMap()
   },
   //计价规则
   chargeRule: function () {
@@ -1206,6 +1307,7 @@ Page({
     that.setData({
       frame: false
     })
+    //  that.reloadMap()
   },
   //关闭弹框
   frameShow: function () {
@@ -1213,9 +1315,14 @@ Page({
     that.setData({
       frame: true
     })
+    that.reloadMap('frame')
   },
   //故障上报
   guzhang: function () {
+    this.setData({
+      frame: false,
+    })
+    // this.reloadMap()
     my.navigateTo({
       url: '/pages/breakdown/breakdown',
     })
@@ -1226,8 +1333,16 @@ Page({
       url: '/pages/parking/parking',
     })
   },
+  onHide: function () {
+    console.log('onHide5555')
+    // clearInterval(testToken
+    clearInterval(mytime)
+    clearInterval(interval)
+    bluetoothOperate.end((flag) => { });
+  },
   onUnload: function () {
     clearInterval(locationTerval)
+    bluetoothOperate.end((flag) => { });
     // 停止位置跟踪
     // my.stopLocationUpdate({
     //   success: (res) => {
@@ -1237,5 +1352,11 @@ Page({
     //     console.log("onUnload stopLocationUpdate fail", err)
     //   }
     // })
+  },
+  //返回首页
+  backHome() {
+    my.reLaunch({
+      url: '/pages/index/index',
+    })
   }
 })

+ 2 - 2
service/bluetooth.js

@@ -66,7 +66,7 @@ function BluetoothOperate() {
     if (_listenerTimer) {
       clearTimeout(_listenerTimer);
     }
-    my.closeBLEConnection({
+    my.disconnectBLEDevice({
       deviceId: _deviceId,
       complete: () => {
         _closeBluetoothAdapter();
@@ -265,7 +265,7 @@ function BluetoothOperate() {
   //通过deviceId连接蓝牙设备
   const _startConnectDevices = () => {
     if (_deviceId.length > 0) {
-      my.createBLEConnection({
+      my.connectBLEDevice({
         deviceId: _deviceId,
         timeout: 15000,
         success: (res) => {

+ 28 - 0
utils/cache.js

@@ -0,0 +1,28 @@
+function getCache(key, hour = 4) {
+  let k = 'chche:' + key
+  let ct = Date.parse(new Date()) / 1000;
+  let ca = my.getStorageSync({ 'key': 'k' }).data
+  if (ca) {
+    if ((ct - ca.time) < (hour * 60 * 60)) {
+      return ca.value
+    }
+    return false
+  }
+  return false
+}
+
+function setCache(key, data = {}, hour = 4) {
+  let k = 'chche:' + key
+  let ct = Date.parse(new Date()) / 1000;
+  my.setStorageSync({ 'key': 'k', 'data': { 'time': ct, 'value': data } })
+}
+
+const CacheKeys = {
+  '': ""
+}
+
+module.exports = {
+  getCache: getCache,
+  setCache: setCache,
+  CacheKeys: CacheKeys
+}

File diff suppressed because it is too large
+ 0 - 0
utils/fundebug.1.6.0.min.js


+ 25 - 0
utils/log.js

@@ -0,0 +1,25 @@
+var log = wx.getRealtimeLogManager ? wx.getRealtimeLogManager() : null
+
+module.exports = {
+  debug() {
+    if (!log) return
+    log.debug.apply(log, arguments)
+  },
+  info() {
+    if (!log) return
+    log.info.apply(log, arguments)
+  },
+  warn() {
+    if (!log) return
+    log.warn.apply(log, arguments)
+  },
+  error() {
+    if (!log) return
+    log.error.apply(log, arguments)
+  },
+  setFilterMsg(msg) { // 从基础库2.7.3开始支持
+    if (!log || !log.setFilterMsg) return
+    if (typeof msg !== 'string') return
+    log.setFilterMsg(msg)
+  }
+}

Some files were not shown because too many files changed in this diff