From a87979d20fa83ac843457f45290da8f3cf423b2e Mon Sep 17 00:00:00 2001 From: tx <2622874537@qq.com> Date: Fri, 25 Oct 2024 18:05:22 +0800 Subject: [PATCH] 11 --- page_user/carStore.vue | 22 +++- page_user/mapSele.vue | 21 ++- page_user/ordder.vue | 82 ++++++------ page_user/user_order.vue | 273 +++++++++++++++++++++++++++++---------- pages/index/index.vue | 1 + pages/login/login.vue | 8 +- pages/my.vue | 9 +- 7 files changed, 292 insertions(+), 124 deletions(-) diff --git a/page_user/carStore.vue b/page_user/carStore.vue index 456ca35..169622a 100644 --- a/page_user/carStore.vue +++ b/page_user/carStore.vue @@ -93,9 +93,12 @@ 日租¥{{item.price}} - + 立即租 + @@ -196,10 +199,19 @@ }, methods: { toOrdder(item,items){ - console.log(items,'toOrdder'); - uni.navigateTo({ - url:'/page_user/ordder?storeId='+item.storeId+'&modelId='+items.modelId - }) + if(items.rentalCar>0){ + console.log(items,'toOrdder'); + uni.navigateTo({ + url:'/page_user/ordder?storeId='+item.storeId+'&modelId='+items.modelId + }) + }else{ + uni.showToast({ + title: '改车型已没货,请查看其他车型', + icon: 'none', + duration: 2000 + }); + } + }, mapFun() { console.log('点击了'); diff --git a/page_user/mapSele.vue b/page_user/mapSele.vue index 4efad5e..1faf6dd 100644 --- a/page_user/mapSele.vue +++ b/page_user/mapSele.vue @@ -222,7 +222,7 @@ - + @@ -289,7 +289,7 @@ 日租¥ {{item.price}} - + 立即租 @@ -476,9 +476,19 @@ methods: { toOrdder(item,items){ console.log(items,'toOrdder'); - uni.navigateTo({ - url:'/page_user/ordder?storeId='+item.storeId+'&modelId='+items.modelId - }) + + if(items.rentalCar>0){ + console.log(items,'toOrdder'); + uni.navigateTo({ + url:'/page_user/ordder?storeId='+item.storeId+'&modelId='+items.modelId + }) + }else{ + uni.showToast({ + title: '改车型已没货,请查看其他车型', + icon: 'none', + duration: 2000 + }); + } }, toStore(item){ console.log(item,'itemitemitem'); @@ -700,6 +710,7 @@ chooseData(item, index) { this.dataInfo = item this.dataIndex = index + this.showdata=false }, closeData() { this.showdata = false diff --git a/page_user/ordder.vue b/page_user/ordder.vue index 0caf221..33630a8 100644 --- a/page_user/ordder.vue +++ b/page_user/ordder.vue @@ -35,7 +35,7 @@ 自行前往门店 - @@ -118,7 +118,7 @@ - 2024年09月04日 16:00 更改时间 + @@ -472,62 +473,30 @@ } console.log(e, 'eee'); - }, - onShow() { - // this.getToken() - let that = this - uni.getLocation({ - type: 'gcj02', - success: function(lb) { - - that.gps.latitude = lb.latitude; - that.gps.longitude = lb.longitude; - that.getKm() - }, - fail: function(error) { - uni.showToast({ - title: '未获取到定位信息,请点击设置勾选允许位置信息,即可使用全部功能', - icon: 'none', - duration: 2000 - }); - // that.getmarks() - // 在这里处理获取位置信息失败的情况 - } - - }) - this.$nextTick(() => { - const query = uni.createSelectorQuery().in(this); - query.select('.getcar').boundingClientRect(data => { - - this.height = data.height + 45 - console.log('ips_box height:', this.height); - }).exec(); - }, 300); this.calculateDistance(0); this.getmodelInfo() this.getstoreInfo() - const now = new Date(); const year = now.getFullYear(); const month = now.getMonth() + 1; // 月份从0开始,因此加1 const day = now.getDate(); - + // 设置一个小时后的时间 let hour = now.getHours() + 1; let nextDay = day; let nextMonth = month; - + // 如果 hour 超过 23,调整日期 if (hour >= 24) { hour = 0; nextDay += 1; - + // 获取当前月份的天数 const daysInMonth = new Date(year, month, 0).getDate(); if (nextDay > daysInMonth) { nextDay = 1; nextMonth += 1; - + // 如果超过12月,调整到下一年 if (nextMonth > 12) { nextMonth = 1; @@ -543,6 +512,41 @@ `${year}年${nextMonth < 10 ? '0' : ''}${nextMonth}月${nextDay < 10 ? '0' : ''}${nextDay}日 ${hour < 10 ? '0' : ''}${hour}:${minute < 10 ? '0' : ''}${minute}`; // 初始化 pickertime 为当天的默认日期 this.pickertime = this.startDate; + let that = this + uni.getLocation({ + type: 'gcj02', + success: function(lb) { + + that.gps.latitude = lb.latitude; + that.gps.longitude = lb.longitude; + that.getKm() + }, + fail: function(error) { + uni.showToast({ + title: '未获取到定位信息,请点击设置勾选允许位置信息,即可使用全部功能', + icon: 'none', + duration: 2000 + }); + // that.getmarks() + // 在这里处理获取位置信息失败的情况 + } + + }) + this.$nextTick(() => { + const query = uni.createSelectorQuery().in(this); + query.select('.getcar').boundingClientRect(data => { + + this.height = data.height + 45 + console.log('ips_box height:', this.height); + }).exec(); + }, 300); + }, + onShow() { + // this.getToken() + + + + console.log('startDate:', this.startDate); console.log('time:', this.time); @@ -1153,7 +1157,7 @@ .sub_box { position: fixed; - + z-index: 110; bottom: 0; .detail { diff --git a/page_user/user_order.vue b/page_user/user_order.vue index 4ca857f..9934546 100644 --- a/page_user/user_order.vue +++ b/page_user/user_order.vue @@ -1,8 +1,8 @@