From e8eacf5d4f4496c07f90a74567f8ca72abb028da Mon Sep 17 00:00:00 2001 From: Sliverber <2622874537@qq.com> Date: Thu, 6 Jun 2024 18:04:50 +0800 Subject: [PATCH] 11 --- page_user/yj.vue | 8 +- pages/index/index.vue | 1078 +++++++++++++++++++++++------------ pages_admin/admin_index.vue | 11 +- 3 files changed, 716 insertions(+), 381 deletions(-) diff --git a/page_user/yj.vue b/page_user/yj.vue index 5c36f5d..1cdd05d 100644 --- a/page_user/yj.vue +++ b/page_user/yj.vue @@ -1,7 +1,7 @@ <template> <view class="page"> <u-navbar title="押金" :border-bottom="false" :background="bgc" title-color='#000' title-size='36' - height='40'></u-navbar> + height='45'></u-navbar> <view class="norecord" v-if="userinfo.balance==0"> <view class="card"> <view class="tit">充值押金</view> @@ -101,7 +101,7 @@ <view class="tip_box" v-if="show"> <view class="top"> <view class="txt"> - 押金体现后,下次使用电单车仍需要重 + 押金提现后,下次使用电单车仍需要重 </view> <view class="txt"> 新充值押金,您要继续提现吗? @@ -459,7 +459,7 @@ margin-top: 8rpx; width: 100%; font-weight: 400; - font-size: 20rpx; + font-size: 24rpx; color: #979797; } } @@ -482,7 +482,7 @@ width: 100rpx; text-align: right; font-weight: 400; - font-size: 20rpx; + font-size: 24rpx; color: #4C97E7; } } diff --git a/pages/index/index.vue b/pages/index/index.vue index b8a19d2..0adff90 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -14,20 +14,19 @@ title-size='36' height='36'></u-navbar> --> <map class="map" id="map" ref="map" :scale="zoomSize" show-location v-if="showmap" :latitude="latitude" :longitude="longitude" :show-location="true" :markers="markers" :polygons="polyline" - @markertap="onMarkerTap"> + @markertap="onMarkerTap" @tap="onMapTap"> </map> <view class="my-location" @click="setMapScale"> - <image class="img" src="https://lxnapi.ccttiot.com/bike/img/static/uBgKFW3JgiBfjM4ea3uV" - ></image> + <image class="img" src="https://lxnapi.ccttiot.com/bike/img/static/uBgKFW3JgiBfjM4ea3uV"></image> </view> <view class="park" @click="toggleIconAndCallout"> <image src="https://lxnapi.ccttiot.com/bike/img/static/uRiYQZQEb3l2LsltEsyW" mode=""></image> </view> <view class="botmbox2" v-if="showdevice"> - <view class="close" @click="close()"> + <!-- <view class="close" @click="close()"> <image src="https://lxnapi.ccttiot.com/bike/img/static/uBeBBKwQu2K2ZBdT7iN7" mode=""></image> - </view> + </view> --> <view class="page1" v-if="deviceIndex==0"> <view class="top"> <view class="left"> @@ -64,11 +63,11 @@ </view> </view> <view class="bot"> - + <view class=" left_btn" @click="Reserve()"> 预约用车 </view> - <view class="right_btn" @click="deviceInfo(1)"> + <view class="right_btn" @click="lockDevice() "> 解锁用车 </view> </view> @@ -253,14 +252,14 @@ {{timeString}} </view> </view> - <view class="card"> + <view class="cardss"> <view class="tit"> 电单车 </view> <view class="cont"> <view class="left"> <view class="text"> - 可继续行驶53公里 + 可继续行驶{{OrderdeviceInfos.remainingMileage}}公里 </view> <view class="speed"> <view class="speeds" :style="{ width: OrderdeviceInfos.remainingPower + '%' }"> @@ -349,7 +348,7 @@ 押金充值 </view> </view> - <!-- <view class="cont" @click="topage(2)"> + <!-- <view class="cont" @click="topage(2)"> <image src="https://api.ccttiot.com/smartmeter/img/static/uFHC2R6R3pgUOTShLxoQ" mode="" style="width: 28rpx;height: 28rpx;"></image> <view class="text"> @@ -357,22 +356,19 @@ </view> </view> --> <view class="cont" @click="topage(3)"> - <image src="https://api.ccttiot.com/smartmeter/img/static/utP4rdOzXLlQPx6Ug8cO" mode="" - ></image> + <image src="https://api.ccttiot.com/smartmeter/img/static/utP4rdOzXLlQPx6Ug8cO" mode=""></image> <view class="text"> 用车指南 </view> </view> <view class="cont" @click="topage(4)"> - <image src="https://api.ccttiot.com/smartmeter/img/static/uFaJV6NJGhmmodpEuWMy" mode="" - ></image> + <image src="https://api.ccttiot.com/smartmeter/img/static/uFaJV6NJGhmmodpEuWMy" mode=""></image> <view class="text"> 编号开锁 </view> </view> - <view class="cont"@click="topage(5)"> - <image src="https://api.ccttiot.com/smartmeter/img/static/uucc9g8b2MM6G9vp8HWa" mode="" - ></image> + <view class="cont" @click="topage(5)"> + <image src="https://api.ccttiot.com/smartmeter/img/static/uucc9g8b2MM6G9vp8HWa" mode=""></image> <view class="text"> 故障上报 </view> @@ -384,14 +380,17 @@ </view> <view class="tipss_box"> - <swiper class="swiper" circular :autoplay="autoplay" :interval="interval" :duration="duration"> - <swiper-item v-if="orderinfo.status"> - <view class="tipss" v-if="orderinfo.status" @click="starTime"> - 您有正在进行中的订单 <view class="iconfont icon-xiangyou1" style="margin-left: 20rpx;"> + <view class="tipss" v-if="orderinfo.status" @click="starTime"> + 您有正在进行中的订单 <view class="iconfont icon-xiangyou1" style="margin-left: 20rpx;"> + + </view> + </view> + <view class="" v-if="!orderinfo.status" style="background: none;width: 350rpx; + height: 64rpx;"> + + </view> + <swiper class="swiper" circular :autoplay="autoplay" :interval="interval" :duration="duration"> - </view> - </view> - </swiper-item> <swiper-item> <view class="tipss"> 点击车辆可以预约用车 @@ -437,43 +436,91 @@ </view> <u-mask :show="showtcs" @click="showtc = false" :z-index='100' /> - <u-mask :show="showTips" @click="show = false" :z-index='100' /> + <u-mask :show="showTips" @click="showTips = false" :z-index='100' /> + + <u-mask :show="showYjTip" @click="showYjTip = false" :z-index='100' /> + <view class="pops" v-if="showYjTip"> + <view class="tit" style="font-weight: 600;"> + 您未充值押金 + </view> + <view class="cont_box" style="text-align: center;color: #808080;justify-content: center;font-size: 36rpx;"> + 请在充值押金后使用共享电动车 + </view> + + <view class="btn_box"> + <view class="btn1" @click="showYjTip = false"> + 取消 + </view> + <view class="btn2"@click="topage(1)"> + 前往充值 + </view> + </view> + <!-- <view class="btn" @click="showtcs=false" style="margin-bottom: 0rpx;"> + 点击查看 + + </view> --> + + </view> <view class="pops" v-if="showtcs"> - <view class="tit"> - {{orderinfo.rule.name}} + <view class="tit" style="font-weight: 600;"> + 您有正在进行的订单 </view> - <view class="text"> - <view class="yuan"> - + <view class="cont_box"> + <view class="left"> + 电单车 </view> - <span>在套餐时间为结束是可随意进行车辆预约和解锁</span> - - </view> - <view class="text"> - <view class="yuan"> - - </view> - <span>车辆二维码模糊可使用下方编号开锁</span> - <view class="time"> + <view class="right"> </view> </view> - <view class="time"> - {{timeString}}后 + <view class="cont_box"> + <view class="left"> + <view class="km"> + 可继续行驶{{OrderdeviceInfos.remainingMileage}}公里 + </view> + <view class="speed"> + <view class="speeds" :style="{ width: OrderdeviceInfos.remainingPower + '%' }"> + + </view> + </view> + <view class="NO"> + NO.{{OrderdeviceInfos.sn}} + </view> + </view> + <view class="right"> + <image src="https://lxnapi.ccttiot.com/bike/img/static/uqKmFMF9YHTX8lAQARSd" mode=""></image> + </view> </view> - <view class="time" style="color:#3D3D3D ;font-size: 28rpx;"> - 您将失去该套餐 + <view class="cont_box"> + <view class="left"> + 已骑行 + </view> + <view class="right"> + {{timeString}} + </view> + </view> + <view class="cont_box"> + <view class="left"> + 预估金额 + </view> + <view class="right"> + {{money}}元 + </view> </view> <view class="btn" @click="showtcs=false" style="margin-bottom: 50rpx;"> - 我已知晓 + 点击查看 + + </view> + <view class="close" @click="showtcs = false"> + <image src="https://lxnapi.ccttiot.com/bike/img/static/uyPRLCHBTUeN7UHzDEGR" mode=""></image> </view> </view> - <view class="pops" v-if="showTips" > + <view class="pops" v-if="showTips"> <view class="tit"> 安全骑行 禁止超载 </view> - <view class="cont" v-html="areaInfo.agreement" > - + <view class="cont" v-html="areaInfo.agreement"> + </view> <!-- <view class="text"> <view class="yuan"> @@ -704,7 +751,7 @@ freeListIndex: 0, freeInfo: {}, socket: null, - sn: '', + sn: 0, eventKey: 0, orderinfo: {}, timer: null, @@ -719,28 +766,32 @@ showmap: true, userinfo: {}, parkingList: [], - timer: null, + timers: null, listData: [], oldMarkers: [], curtitidx: 0, swiperHeight: 50, - background: ['color1', 'color2', 'color3'], + indicatorDots: true, autoplay: true, interval: 2000, duration: 500, - showTips:false, + showTips: false, + showYjTip:false // userId:this.$store.getters.userId, } }, watch: { userId(newValue, oldValue) { // 处理userId变化的逻辑 - console.log('userId 发生变化', newValue, oldValue); + // console.log('userId 发生变化', newValue, oldValue); this.getisInOrder() + }, + sn(newValue, oldValue){ + console.log('sn 发生变化', newValue, oldValue); } }, - + onLoad(e) { console.log(e, 'eeeeeeeeeeeeeeeeeee'); if (e.q) { @@ -766,11 +817,14 @@ setTimeout(() => { + if (!this.orderinfo.status) { this.deviceInfo(1) // this.showdevice = true // this.deviceIndex = 1 // this.type = 1 + } else { + // this.showtcs=true } }, 1000) @@ -793,11 +847,17 @@ } } - setTimeout(()=>{ + setTimeout(() => { this.$store.commit('SET_SHOWTIPS', true); - },500) + }, 500) }, onShow() { + this.timers = setInterval(() => { + // console.log('定时器运行中...'); + this.getmarks() + // 在这里执行你的逻辑 + }, 3000); // 每秒执行一次 + if (this.seeDetail == false) { if (uni.getStorageSync('role')) { @@ -840,26 +900,21 @@ } else { this.getinfo() } - this.timer = setInterval(() => { - // console.log('定时器运行中...'); - this.getmarks() - // 在这里执行你的逻辑 - }, 3000); // 每秒执行一次 }, onHide() { // 页面隐藏时清除定时器 - if (this.timer) { - clearInterval(this.timer); - this.timer = null; + if (this.timers) { + clearInterval(this.timers); + this.timers = null; console.log('定时器已清除'); } }, onUnload() { // 页面卸载时清除定时器 - if (this.timer) { - clearInterval(this.timer); - this.timer = null; + if (this.timers) { + clearInterval(this.timers); + this.timers = null; console.log('定时器已清除'); } }, @@ -896,14 +951,47 @@ }, }, methods: { + onMapTap(event) { + this.showdevice = false + this.deviceIndex = 0 + // this.sn = '' + this.type = 0 + this.freeInfo = {} + this.freeListIndex = 0 + // const { + // latitude, + // longitude + // } = event.detail; + // console.log('Map tapped at:', latitude, longitude); + // this.close() + // 在这里添加你的回调逻辑 + }, + lockDevice() { + if (this.orderinfo.status) { + this.showtcs = true + } else { + if (this.deviceInfos.status != 1) { + uni.showToast({ + title: '车辆正在使用中,请使用其他车辆', + icon: 'none', + duration: 2000 + }); + } else { + this.showdevice = true; + this.type = 1; + this.deviceIndex = 1; + } + } + + }, changetips() { if (this.showTips) { - + uni.setStorageSync('hasShownPopup', false); - this.showTips=uni.getStorageSync('hasShownPopup') + this.showTips = uni.getStorageSync('hasShownPopup') } else { uni.setStorageSync('hasShownPopup', true); - this.showTips=uni.getStorageSync('hasShownPopup') + this.showTips = uni.getStorageSync('hasShownPopup') } }, @@ -972,44 +1060,49 @@ }, // 扫码开锁 qecodelock() { - this.seeDetail = true - uni.scanCode({ - onlyFromCamera: true, - scanType: ['qrCode'], - success: res => { + if (this.orderinfo.status) { + this.showtcs = true + } else { + this.seeDetail = true + uni.scanCode({ + onlyFromCamera: true, + scanType: ['qrCode'], + success: res => { - let sn = null; - let queryParams = res.result.split('?')[1]; - if (queryParams) { - let params = queryParams.split('&'); - params.forEach(param => { - let [key, value] = param.split('='); - if (key === 'sn') { - sn = value; - } - }); + let sn = null; + let queryParams = res.result.split('?')[1]; + if (queryParams) { + let params = queryParams.split('&'); + params.forEach(param => { + let [key, value] = param.split('='); + if (key === 'sn') { + sn = value; + } + }); + } + + this.sn = sn + if (this.sn != '') { + setTimeout(() => { + if (!this.orderinfo.status) { + this.deviceInfo(1) + + } + }, 1000) + + } + + }, + fail: err => { + // console.error('扫描失败:', err); + // uni.showToast({ + // title: '扫描失败', + // icon: 'none' + // }); } + }); + } - this.sn = sn - if (this.sn != '') { - setTimeout(() => { - if (!this.orderinfo.status) { - this.deviceInfo(1) - - } - }, 1000) - - } - - }, - fail: err => { - // console.error('扫描失败:', err); - // uni.showToast({ - // title: '扫描失败', - // icon: 'none' - // }); - } - }); }, feedetail(item, index) { this.freeInfo = item @@ -1357,10 +1450,14 @@ } + uni.showLoading({ + + }) console.log('点击了'); let that = this this.$u.post('/appVerify/pre/order', data).then((res) => { if (res.code === 200) { + uni.hideLoading() // this.freList=res.rows uni.requestPayment({ provider: 'wxpay', @@ -1405,10 +1502,14 @@ } + uni.showLoading({ + + }) console.log('点击了'); let that = this this.$u.post('/appVerify/pre/order', data).then((res) => { if (res.code === 200) { + uni.hideLoading() // this.freList=res.rows uni.requestPayment({ provider: 'wxpay', @@ -1447,75 +1548,141 @@ // url:'' // }) } else if (num == 1) { - let that = this - wx.login({ - success(res) { - if (res.code) { - console.log('登录!', res); - let data = { - wxOpenId: res.code, - - }; - let areaId = uni.getStorageSync('areaId'); - that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId).then( - res => { - uni.hideLoading(); - if (res.code == 200) { - uni.setStorageSync('token', res.token); - if (that.areaInfo.authentication == 1) { - that.$u.get("/getAppInfo").then((res) => { - console.log('进入跳转'); - if (res.code == 200) { - that.userinfo = res.user - that.$store.commit('SET_USERID', res.user - .userId); - if (res.user.isAuthentication == 0) { - that.seeDetail = true - uni.navigateTo({ - url: "/page_user/idcard_test" - }) - } else { - uni.navigateTo({ - url: '/page_user/yj' - }) - } + uni.showLoading({ + + }) + if (uni.getStorageSync('token')) { + if (this.areaInfo.authentication == 1) { + this.$u.get("/getAppInfo").then(res => { + if (res.code == 200) { + this.userinfo = res.user; + this.$store.commit('SET_USERID', res.user.userId); + if (res.user.isAuthentication == 0) { + uni.hideLoading() + this.seeDetail = true; + uni.navigateTo({ + url: "/page_user/idcard_test" + }); + } else { + uni.hideLoading() + uni.navigateTo({ + url: '/page_user/yj' + }); + } + } else { + uni.hideLoading() + uni.showToast({ + title: '未登录,请登录后尝试', + icon: 'none', + duration: 2000 + }); + } + }); + } else { + uni.hideLoading() + uni.navigateTo({ + url: '/page_user/yj' + }); + } + this.showYjTip = false + } else { + + let that = this; + wx.login({ + success(res) { + if (res.code) { + console.log('登录成功!', res); + let areaId = uni.getStorageSync('areaId'); + uni.showLoading({ + title: '登录中...' + }); + that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId) + .then(res => { + uni.hideLoading(); + if (res.code == 200) { + uni.setStorageSync('token', res.token); + if (that.areaInfo.authentication == 1) { + that.$u.get("/getAppInfo").then(res => { + if (res.code == 200) { + that.userinfo = res.user; + that.$store.commit('SET_USERID', res + .user.userId); + if (res.user.isAuthentication == 0) { + uni.hideLoading() + that.seeDetail = true; + uni.navigateTo({ + url: "/page_user/idcard_test" + }); + } else { + uni.hideLoading() + uni.navigateTo({ + url: '/page_user/yj' + }); + } + } else { + uni.hideLoading() + uni.showToast({ + title: '未登录,请登录后尝试', + icon: 'none', + duration: 2000 + }); + } + }); } else { - uni.showToast({ - title: '未登录,请登录后尝试', - icon: 'none', - duration: 2000 + uni.hideLoading() + uni.navigateTo({ + url: '/page_user/yj' }); } + } else if (res.code == 501) { + uni.hideLoading() + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } else { + uni.hideLoading() + uni.redirectTo({ + url: '/pages/login/login' + }); + } + }).catch(err => { + uni.hideLoading(); + uni.showToast({ + title: '请求失败,请稍后重试', + icon: 'none', + duration: 2000 }); - - } else { - uni.navigateTo({ - url: '/page_user/yj' - }) - } - - - - } else if (res.code == 501) { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 + console.error('请求失败:', err); }); - } else { - // console.log("老用户登录",res.data) - uni.redirectTo({ - url: '/pages/login/login' - }) - } + } else { + uni.hideLoading() + uni.showToast({ + title: '登录失败,请重试', + icon: 'none', + duration: 2000 + }); + console.error('微信登录失败:', res); + } + }, + fail(err) { + uni.hideLoading() + uni.showToast({ + title: '微信登录接口调用失败', + icon: 'none', + duration: 2000 }); - } - }, + console.error('微信登录接口调用失败:', err); + } + }); + - }); + } + } else if (num == 2) { uni.navigateTo({ url: '/page_user/jfgz' @@ -1525,81 +1692,23 @@ url: '/page_user/yczn' }) } else if (num == 4) { - uni.navigateTo({ - url: '/page_user/bhks' - }) + if (this.orderinfo.status) { + this.showtcs = true + } else { + uni.navigateTo({ + url: '/page_user/bhks' + }) + } + } else if (num == 5) { + uni.navigateTo({ url: '/page_user/gzsb' }) } else if (num == 6) { - let that = this - wx.login({ - success(res) { - if (res.code) { - console.log('登录!', res); - let data = { - wxOpenId: res.code, - - }; - let areaId = uni.getStorageSync('areaId'); - that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId).then( - res => { - uni.hideLoading(); - if (res.code == 200) { - uni.setStorageSync('token', res.token); - if (that.areaInfo.authentication == 1) { - that.$u.get("/getAppInfo").then((res) => { - console.log('进入跳转'); - if (res.code == 200) { - that.userinfo = res.user - that.$store.commit('SET_USERID', res.user - .userId); - if (res.user.isAuthentication == 0) { - that.seeDetail = true - uni.navigateTo({ - url: "/page_user/idcard_test" - }) - } else { - uni.navigateTo({ - url: '/pages/my' - }) - } - - } else { - uni.showToast({ - title: '未登录,请登录后尝试', - icon: 'none', - duration: 2000 - }); - } - }); - - } else { - uni.navigateTo({ - url: '/pages/my' - }) - } - - - - } else if (res.code == 501) { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); - } else { - // console.log("老用户登录",res.data) - uni.redirectTo({ - url: '/pages/login/login' - }) - } - }); - } - }, - - }); + uni.navigateTo({ + url: '/pages/my' + }) } else if (num == 7) { uni.navigateTo({ @@ -1688,14 +1797,66 @@ }, // 确认开锁 sub1() { + uni.showLoading({ + + }) if (this.areaInfo.authentication == 1) { + if (this.userinfo.isAuthentication == 0) { + uni.hideLoading() this.seeDetail = true uni.navigateTo({ url: "/page_user/idcard_test" }) + }else{ + if (this.freeInfo.ruleId) { + let data = { + userId: this.userId, + sn: this.sn, + ruleId: this.freeInfo.ruleId, + // money: this.freeInfo.fee, + mark: "确认开锁", + type: '1' + + + } + this.$u.post('/appVerify/device/snSwitch', data).then((res) => { + uni.hideLoading() + this.seeDetail = false + if (res.code === 200) { + this.getisInOrder() + + } else { + + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + + if(res.msg=='您还未充值押金,请先充值押金'){ + this.close() + this.showYjTip=true + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + } + }) + } else { + uni.hideLoading() + uni.showToast({ + title: '请选择套餐', + icon: 'none', + duration: 2000 + }); + } } } else { + if (this.freeInfo.ruleId) { let data = { userId: this.userId, @@ -1708,19 +1869,28 @@ } this.$u.post('/appVerify/device/snSwitch', data).then((res) => { + uni.hideLoading() this.seeDetail = false if (res.code === 200) { this.getisInOrder() } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + + + if(res.msg=='您还未充值押金,请先充值押金'){ + this.close() + this.showYjTip=true + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } } }) } else { + uni.hideLoading() uni.showToast({ title: '请选择套餐', icon: 'none', @@ -1828,11 +1998,18 @@ // this.freList=res.rows } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + + + if(res.msg=='您还未充值押金,请先充值押金'){ + this.close() + this.showYjTip=true + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } } }) } else { @@ -1873,11 +2050,17 @@ // this.freList=res.rows } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + + if(res.msg=='您还未充值押金,请先充值押金'){ + this.close() + this.showYjTip=true + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } } }) } else { @@ -1956,15 +2139,23 @@ }, getisInOrder() { + uni.showLoading({ + + }) this.orderinfo = {} if (this.userId) { this.$u.post('/app/user/isInOrder?userId=' + this.userId, ).then((res) => { + uni.hideLoading() if (res.code === 200) { // this.freList=res.rows if (res.data != '') { this.orderinfo = res.data[0] - - this.starTime() + if(this.orderinfo.status==4){ + this.getisInOrder() + }else{ + this.starTime() + } + } else { this.orderinfo = {} this.showdevice = false @@ -2010,35 +2201,39 @@ // 预约车辆 Reserve() { + if (this.orderinfo.status) { + this.showtcs = true + } else { + if (this.$store.getters.userId == undefined) { + // this.$u.get("/getAppInfo").then((res) => { + // console.log('进入跳转'); + // if(res.code==200){ + // this.$store.commit('SET_USERID', res.user.userId); - if (this.$store.getters.userId == undefined) { - // this.$u.get("/getAppInfo").then((res) => { - // console.log('进入跳转'); - // if(res.code==200){ - // this.$store.commit('SET_USERID', res.user.userId); - - // } - // }); - this.$store.dispatch('userInfo', this.$u).then(() => { + // } + // }); + this.$store.dispatch('userInfo', this.$u).then(() => { + this.deviceIndex = 1 + this.type = 2 + console.log(this.$store.getters.userId, + 'this.$store.getters.userIdthis.$store.getters.userId'); + // 执行其他操作... + }); + } else { this.deviceIndex = 1 this.type = 2 - console.log(this.$store.getters.userId, - 'this.$store.getters.userIdthis.$store.getters.userId'); - // 执行其他操作... - }); - } else { - this.deviceIndex = 1 - this.type = 2 + } } + }, // 关闭弹出 close() { this.showdevice = false this.deviceIndex = 0 - this.sn = '' + // this.sn = '' this.type = 0 this.freeInfo = {} this.freeListIndex = 0 @@ -2074,97 +2269,104 @@ console.log('点击了标记:', e.markerId); // 这里可以根据需要处理点击标记的逻辑 // 阻止事件冒泡\ - this.sn = e.markerId - this.deviceInfo(0) + this.sn = e.markerId; + this.deviceInfo(0); + const markerExists = this.listData.some(item => item.sn == e.markerId); + if (markerExists) { + // 处理点击标记的逻辑 + + } else { + console.log('标记ID不存在于列表数据中'); + } + // 阻止事件冒泡 + e.stopPropagation(); } }, - deviceInfo(num) { - let that = this - if (uni.getStorageSync('token')) { - this.$u.get('/app/device/info?sn=' + this.sn).then((res) => { - if (res.code === 200) { - this.deviceInfos = res.data - if (num == 0) { - // this.showindex = 0 - this.showdevice = true - this.type = 0 - } else { - // this.showindex = 1 - this.showdevice = true - this.type = 1 - this.deviceIndex = 1 - } - + deviceInfo(num) { + if (uni.getStorageSync('token')) { + + this.$u.get('/app/device/info?sn=' + this.sn).then((res) => { + if (res.code === 200) { + this.deviceInfos = res.data; + + if (num == 0) { + this.showdevice = true; + this.type = 0; } else { - this.showdevice = false - this.deviceIndex = 0 - this.type = 0 - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + if (this.deviceInfos.status != 1) { + uni.showToast({ + title: '车辆正在使用中,请使用其他车辆', + icon: 'none', + duration: 2000 + }); + } else { + this.showdevice = true; + this.type = 1; + this.deviceIndex = 1; + } } - }) - } else { - wx.login({ - success(res) { - if (res.code) { - console.log('登录!', res); - let data = { - wxOpenId: res.code, - - }; - let areaId = uni.getStorageSync('areaId'); - that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId).then( - res => { - uni.hideLoading(); - if (res.code == 200) { - uni.setStorageSync('token', res.token); - that.$u.get('/app/device/info?sn=' + that.sn).then((res) => { - if (res.code === 200) { - that.deviceInfos = res.data - that.showindex = 0 - that.showdevice = true - } else { - that.showdevice = false - that.deviceIndex = 0 - that.type = 0 - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); - } - }) - - - } else if (res.code == 501) { + } else { + this.showdevice = false; + this.deviceIndex = 0; + this.type = 0; + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }); + } else { + console.log('判断2'); + wx.login({ + success: (res) => { + if (res.code) { + console.log('登录!', res); + let data = { + wxOpenId: res.code, + }; + let areaId = uni.getStorageSync('areaId'); + this.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId).then((res) => { + uni.hideLoading(); + if (res.code == 200) { + uni.setStorageSync('token', res.token); + this.$u.get('/app/device/info?sn=' + this.sn).then((res) => { + if (res.code === 200) { + this.deviceInfos = res.data; + this.showindex = 0; + this.showdevice = true; + } else { + this.showdevice = false; + this.deviceIndex = 0; + this.type = 0; uni.showToast({ title: res.msg, icon: 'none', duration: 2000 }); - } else { - // console.log("老用户登录",res.data) - uni.redirectTo({ - url: '/pages/login/login' - }) } }); - } - }, - - }); - } - - - - }, + } else if (res.code == 501) { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } else { + uni.redirectTo({ + url: '/pages/login/login' + }); + } + }); + } + }, + }); + } + }, // onMapTap(e) { // console.log('点击了地图非标记区域:', e); // // 这里可以根据需要处理点击地图非标记区域的逻辑 @@ -2302,19 +2504,19 @@ this.getisInOrder() } - const hasShownPopup = uni.getStorageSync('hasShownPopup'); - console.log(hasShownPopup, 'hasShownPopup'); - - if (hasShownPopup === '' || hasShownPopup === null) { - console.log('1111111111'); - this.showTips = true; - uni.setStorageSync('hasShownPopup', true); - } else { - console.log('222'); - this.showTips = uni.getStorageSync('hasShownPopup'); - console.log(this.showTips, 'this.showTips'); - } - this.setMapScale() + const hasShownPopup = uni.getStorageSync('hasShownPopup'); + console.log(hasShownPopup, 'hasShownPopup'); + + if (hasShownPopup === '' || hasShownPopup === null) { + console.log('1111111111'); + this.showTips = true; + uni.setStorageSync('hasShownPopup', true); + } else { + console.log('222'); + this.showTips = uni.getStorageSync('hasShownPopup'); + console.log(this.showTips, 'this.showTips'); + } + this.setMapScale() // if(!hasShownPopup){ // console.log(typeof(hasShownPopup),'hasShownPopuphasShownPopup'); // this.showTips=uni.getStorageSync('hasShownPopup') @@ -2322,7 +2524,7 @@ // this.showTips=true // uni.setStorageSync('hasShownPopup', true); // } - + // this.$store.commit('SET_SHOWTIPS', true); // console.log(this.polyline); } else { @@ -2643,9 +2845,30 @@ width: 370rpx; height: 73rpx; position: fixed; - bottom: 520rpx; + bottom: 600rpx; left: 38rpx; + .tipss { + // position: fixed; + margin-top: 15rpx; + display: flex; + align-items: center; + justify-content: center; + flex-wrap: nowrap; + + image { + margin-right: 15rpx; + width: 24rpx; + height: 24rpx; + } + + width: 350rpx; + height: 64rpx; + background: #FFFFFF; + box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.3); + border-radius: 53rpx 53rpx 53rpx 53rpx; + } + .swiper { height: 80rpx; @@ -2863,7 +3086,7 @@ display: flex; flex-wrap: nowrap; width: 100%; - height: 284rpx; + // height: 284rpx; .left { display: flex; @@ -2959,8 +3182,9 @@ overflow-x: auto; // 添加水平滚动条 margin-bottom: 200rpx; white-space: nowrap; // 确保子元素不换行 - + padding: 20rpx 0; .card { + width: 500rpx !important; // 确保宽度被应用 height: 288rpx; margin-right: 20rpx; @@ -3092,11 +3316,12 @@ width: 750rpx; height: 648rpx; - background: #fff; - box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); + // background: #fff; + // box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); border-radius: 50rpx 50rpx 0 0; .info { + margin-top: 20rpx; padding: 0 60rpx; display: flex; flex-wrap: nowrap; @@ -3106,17 +3331,21 @@ height: 100rpx; background: #FFFFFF; border-radius: 20rpx 20rpx 20rpx 20rpx; + box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); } - view {} - .card { - margin-top: 12rpx; + + .cardss { + position: absolute; + bottom: 220rpx; + // margin-top: 20rpx; padding: 20rpx 30rpx; - width: 708rpx; - height: 288rpx; - background: #FFFFFF; + width: 695rpx; + // height: 288rpx; + background: #fff; border-radius: 20rpx 20rpx 20rpx 20rpx; + box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); .tit { font-weight: 500; @@ -3125,6 +3354,7 @@ } .cont { + margin-top: 30rpx; display: flex; flex-wrap: nowrap; align-items: center; @@ -3215,6 +3445,8 @@ .page4 { .bot_btn { + padding-top: 20rpx; + margin-top: 20rpx; // padding: 26rpx 34rpx 48rpx 34rpx; // position: fixed; // display: flex; @@ -3222,9 +3454,9 @@ // justify-content: center; // bottom: 0; width: 750rpx; - height: 420rpx; + height: 400rpx; background: #FFFFFF; - box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); + // box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); border-radius: 30rpx; .time { @@ -3334,7 +3566,7 @@ image { width: 44rpx; - height:44rpx; + height: 44rpx; } .text { @@ -3360,6 +3592,48 @@ border-radius: 20rpx 20rpx 20rpx 20rpx; z-index: 110; + .close { + position: absolute; + left: 266rpx; + bottom: -100rpx; + + image { + width: 80rpx; + height: 80rpx; + } + } + .btn_box{ + margin-top: 80rpx; + display: flex; + align-items: center; + justify-content: space-between; + .btn1{ + display: flex; + align-items: center; + justify-content: center; + width: 216rpx; + height: 90rpx; + background: #989898; + border-radius: 54rpx 54rpx 54rpx 54rpx; + + font-weight: 500; + font-size: 40rpx; + color: #FFFFFF; + } + .btn2{ + display: flex; + align-items: center; + justify-content: center; + width: 268rpx; + height: 90rpx; + background: #4C97E7; + border-radius: 54rpx 54rpx 54rpx 54rpx; + + font-weight: 500; + font-size: 40rpx; + color: #FFFFFF; + } + } .time { margin-top: 20rpx; text-align: center; @@ -3367,11 +3641,13 @@ font-size: 48rpx; color: #4C97E7; } - .cont{ + + .cont { height: 300rpx; - overflow-x: hidden; - overflow-y: auto; + overflow-x: hidden; + overflow-y: auto; } + .tit { // width: 604rpx; text-align: center; @@ -3381,6 +3657,60 @@ margin-bottom: 54rpx; } + .cont_box { + margin-top: 36rpx; + display: flex; + flex-wrap: nowrap; + align-items: center; + justify-content: space-between; + + .left { + display: flex; + flex-wrap: wrap; + font-weight: 600; + font-size: 36rpx; + color: #3D3D3D; + + .km { + font-weight: 400; + font-size: 28rpx; + color: #3D3D3D; + } + + .speed { + margin-top: 18rpx; + width: 226rpx; + height: 22rpx; + background: #ccc; + border-radius: 16rpx 16rpx 16rpx 16rpx; + + .speeds { + // width: 90%; + height: 100%; + background: #77B8FD; + border-radius: 16rpx 16rpx 16rpx 16rpx; + } + } + + .NO { + font-weight: 400; + font-size: 24rpx; + color: #3D3D3D; + } + } + + .right { + font-weight: 600; + font-size: 36rpx; + color: #3D3D3D; + + image { + width: 244rpx; + height: 196rpx; + } + } + } + .text { margin-top: 36rpx; display: flex; diff --git a/pages_admin/admin_index.vue b/pages_admin/admin_index.vue index feb4145..c4d8080 100644 --- a/pages_admin/admin_index.vue +++ b/pages_admin/admin_index.vue @@ -166,6 +166,11 @@ this.getmarks() this.getordernum() this.allVehicleNum() + this.getmarks(); + }, + onLoad() { + + this.getParking() }, computed: { userId() { @@ -423,7 +428,7 @@ // 可以在这里执行其他针对每个项的操作 }); this.markstause() - this.getParking() + // this.getParking() // this.markers = markers; } else { @@ -459,7 +464,7 @@ // 可以在这里执行其他针对每个项的操作 }); this.markstause() - this.getParking() + // this.getParking() // this.markers = markers; } else { @@ -482,7 +487,7 @@ // 可以在这里执行其他针对每个项的操作 }); this.markstause() - this.getParking() + // this.getParking() // this.markers = markers; } else {