|
@@ -6,10 +6,10 @@ const {
|
|
|
} = require('../../utils/cache')
|
|
|
var app = getApp()
|
|
|
var interval;
|
|
|
-var inter1;
|
|
|
+// var inter1;
|
|
|
var locationTerval;
|
|
|
var huancheTime;
|
|
|
-var coundDown; //运动中不可锁车倒计时
|
|
|
+// var coundDown; //运动中不可锁车倒计时
|
|
|
var linshiStop; //临时停车倒计时
|
|
|
const util = require('../../utils/utils.js');
|
|
|
var interval;
|
|
@@ -76,11 +76,18 @@ Page({
|
|
|
area_id: '', //区域id
|
|
|
mapHeight: 'calc(100vh - 300px)',
|
|
|
isHour: false, //及时判断是否含有小时
|
|
|
- popShow:false
|
|
|
-
|
|
|
-
|
|
|
+ popShow: false,
|
|
|
+ centerLon: '', //地图中心点经纬度
|
|
|
+ centerLat: '', //地图中心点经纬度
|
|
|
+ is_out_area: false, //当前用户是否超出区域
|
|
|
+ load_num: 0, //超出区域弹窗提示弹出次数控制控制弹窗弹出次数
|
|
|
+ isUseTK: app.globalData.isUseTK, //是否使用头盔
|
|
|
+ ifKnowUseTK: true, //是否已点击使用头盔
|
|
|
},
|
|
|
onShow: function () {
|
|
|
+ let isLearn = my.getStorageSync({
|
|
|
+ 'key': 'videoLearn'
|
|
|
+ }).data
|
|
|
let that = this
|
|
|
that.setData({
|
|
|
polygons1: [],
|
|
@@ -90,7 +97,11 @@ Page({
|
|
|
title: app.globalData.title
|
|
|
})
|
|
|
clearInterval(locationTerval);
|
|
|
-
|
|
|
+ if (isLearn == false || !isLearn) {
|
|
|
+ my.navigateTo({
|
|
|
+ url: '/pages/video/video?code=' + this.data.code,
|
|
|
+ })
|
|
|
+ }
|
|
|
app.login().then(res => {
|
|
|
that.userState()
|
|
|
that.posiLoca()
|
|
@@ -532,6 +543,37 @@ Page({
|
|
|
data: res.data.status
|
|
|
})
|
|
|
|
|
|
+ if (res.data.is_out_area == true) {
|
|
|
+ that.setData({
|
|
|
+ load_num: that.data.load_num + 1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (res.data.is_out_area == true && that.data.load_num == 1) {
|
|
|
+ my.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '您当前已超出骑行区域,车辆已经断电,请将车辆骑回运营区,或联系客服进行车辆回电',
|
|
|
+ cancelText: '联系客服',
|
|
|
+ confirmText: '我知道了',
|
|
|
+ complete: (res) => {
|
|
|
+ if (res.cancel) {
|
|
|
+ my.makePhoneCall({
|
|
|
+ number: my.getStorageSync({
|
|
|
+ 'key': 'home'
|
|
|
+ }).data.customer_service_phone,
|
|
|
+ })
|
|
|
+ that.setData({
|
|
|
+ load_num: 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.confirm) {
|
|
|
+ that.setData({
|
|
|
+ load_num: 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
if (res.data.start_use_bike_time <= 0) {
|
|
|
that.setData({
|
|
|
minute: 0
|
|
@@ -678,6 +720,13 @@ Page({
|
|
|
longitude: longitude,
|
|
|
latitude: latitude,
|
|
|
})
|
|
|
+ if (!that.data.centerLon) {
|
|
|
+ //第一次进入当前页面时为为中心点坐标赋值
|
|
|
+ that.setData({
|
|
|
+ centerLon: res.longitude,
|
|
|
+ centerLat: res.latitude,
|
|
|
+ })
|
|
|
+ }
|
|
|
that.home()
|
|
|
},
|
|
|
fail: function (err) {
|
|
@@ -1300,28 +1349,41 @@ Page({
|
|
|
let data = res.data.dispatch_money
|
|
|
res.data.time_money = parseFloat(res.data.time_money)
|
|
|
let data1 = parseFloat(data)
|
|
|
- console.log(data1, 'ppppppppppppppppppp')
|
|
|
- that.setData({
|
|
|
- dispatch_money: data1,
|
|
|
- money: res.data,
|
|
|
- chaButton: 1,
|
|
|
- parkStatus: 2
|
|
|
- })
|
|
|
|
|
|
+ if (res.data.is_app_check_helmet_status == true && res.data.helmet_status == 1) {
|
|
|
+ my.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '头盔未放好!请将头盔放置在头盔卡槽后重新结束用车',
|
|
|
+ confirmText: '我知道了',
|
|
|
+ showCancel: false,
|
|
|
+ complete: (res) => {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ that.setData({
|
|
|
+ dispatch_money: data1,
|
|
|
+ money: res.data,
|
|
|
+ chaButton: 1,
|
|
|
+ parkStatus: 2
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
//确定结束用车
|
|
|
sureEndUseBike: util.throttle(function () {
|
|
|
-
|
|
|
- if(this.data.dispatch_money!=0){
|
|
|
- this.setData({popShow:true})
|
|
|
- }else{
|
|
|
+
|
|
|
+ if (this.data.dispatch_money != 0) {
|
|
|
+ this.setData({
|
|
|
+ popShow: true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
this.huanche()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}, 1000),
|
|
|
- huanche(){
|
|
|
+ huanche() {
|
|
|
//还车接口
|
|
|
my.showLoading({
|
|
|
content: '结算中...',
|
|
@@ -1382,11 +1444,37 @@ Page({
|
|
|
my.hideLoading()
|
|
|
})
|
|
|
},
|
|
|
+ //开关头盔锁
|
|
|
+ controlToukui: util.throttle(function () {
|
|
|
+ var that = this;
|
|
|
+ my.showLoading({
|
|
|
+ title: '开锁中...',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ let data = {
|
|
|
+ order_no: that.data.order,
|
|
|
+ bike_no: that.data.code
|
|
|
+ }
|
|
|
+ // if (app.globalData.req) {
|
|
|
+ app.request('/order/retry-open-helmet-lock', data, 'GET', app.globalData.req).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ my.hideLoading()
|
|
|
+ if (res.data.status == 1) {
|
|
|
+ //that.reloadMap()
|
|
|
+ my.hideLoading()
|
|
|
+ my.showToast({
|
|
|
+ content: '头盔锁已开启',
|
|
|
+ type: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // log.warn('重试开锁失败(order/retry-open-lock)' + '用户id' + '--' + wx.getStorageSync('user_ID'))
|
|
|
+ my.hideLoading()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }, 1000),
|
|
|
//取消锁车
|
|
|
cancelEndBike: function () {
|
|
|
- console.log(my.getStorageSync({
|
|
|
- 'key': 'nowBikeStatus'
|
|
|
- }).data)
|
|
|
let that = this
|
|
|
that.setData({
|
|
|
chaButton: 0,
|
|
@@ -1410,9 +1498,11 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- popHide(){
|
|
|
+ popHide() {
|
|
|
//取消继续还车
|
|
|
- this.setData({popShow:false})
|
|
|
+ this.setData({
|
|
|
+ popShow: false
|
|
|
+ })
|
|
|
},
|
|
|
//骑行优惠券
|
|
|
bikeCoupon: function () {
|
|
@@ -1422,10 +1512,14 @@ Page({
|
|
|
},
|
|
|
//客服
|
|
|
keFu: function () {
|
|
|
+ console.log('点击联系客服', my.getStorageSync({
|
|
|
+ 'key': 'home'
|
|
|
+ }).data.customer_service_phone)
|
|
|
+ let phone = my.getStorageSync({
|
|
|
+ 'key': 'home'
|
|
|
+ }).data.customer_service_phone
|
|
|
my.makePhoneCall({
|
|
|
- number: my.getStorageSync({
|
|
|
- 'key': 'home'
|
|
|
- }).data.customer_service_phone,
|
|
|
+ number: phone || '13203706613'
|
|
|
})
|
|
|
},
|
|
|
//车辆为未开锁弹框
|
|
@@ -1493,4 +1587,17 @@ Page({
|
|
|
adFrame: false
|
|
|
})
|
|
|
},
|
|
|
+ //佩戴头盔提示
|
|
|
+ knowToukui() {
|
|
|
+ this.setData({
|
|
|
+ ifKnowUseTK: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //将地图将当前位置展示在屏幕中央,防止用户滑动查看停车区时频繁定位中心点
|
|
|
+ getPosition: function () {
|
|
|
+ this.setData({
|
|
|
+ centerLon: this.data.longitude,
|
|
|
+ centerLat: this.data.latitude,
|
|
|
+ })
|
|
|
+ },
|
|
|
})
|