master
王文杰 8 months ago
parent 33e9e4f175
commit 953f04e5ff

@ -1,10 +1,18 @@
<!--
* @Author: 王文杰
* @Date: 2024-03-05 09:42:03
* @LastEditors: 王文杰
* @LastEditTime: 2024-03-07 11:02:48
* @FilePath: /app-nx-personal/src/pages/booking/booking-success.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<script setup lang="ts">
const handleHome = () => {
uni.switchTab({ url: '/pages/index/index' })
}
const handleOrder = () => {
uni.switchTab({ url: '/pages/index/index' })
uni.switchTab({ url: '/pages/orderList/list' })
}
</script>
@ -69,4 +77,4 @@ page {
}
}
}
</style>
</style>

@ -163,7 +163,7 @@ const handleAddressPopChange = (val) => {
}
const handleSitePopChange = (obj) => {
isShowSitePop.value = false
siteLabel.value ='回收站点: ' + obj.stationName
siteLabel.value = obj.stationName
recycleStationId.value = obj.id
}
@ -174,8 +174,8 @@ const handleBooking = async () => {
}
const arr = appointmentTime.value.split(' ')
const yymmdd = arr[0]
const appointmentTimeStart = yymmdd + ' ' + arr[1].split('-')[0]
const appointmentTimeEnd = yymmdd + ' ' + arr[1].split('-')[1]
const appointmentTimeStart = yymmdd + ' ' + arr[1].split('-')[0] + ':00'
const appointmentTimeEnd = yymmdd + ' ' + arr[1].split('-')[1] + ':00'
const params = {
appointmentTimeStart,
appointmentTimeEnd,
@ -191,7 +191,8 @@ const handleBooking = async () => {
}
const res = await postBookingAPI(params)
if (res.code == 200) {
uni.navigateTo({ url: '/pages/booking/booking-success' })
uni.showToast({ icon: 'none', title: '预约成功' })
// uni.navigateTo({ url: '/pages/booking/booking-success' })
}
}

@ -44,28 +44,28 @@ const getDate = (date, AddDayCount = 0) => {
}
}
//
const getNextDay = () => {
const getNextDay = () => {
const day = getWeekDate(new Date().getDay());
const newDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(new Date())
const isDay = getDate().fullDate;
const newDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(new Date())
const isDay = getDate().fullDate;
const nextDay = getWeekDate(new Date(new Date().getTime() + 24 * 60 * 60 * 1000).getDay());
const nDate = getDate(new Date(new Date().getTime()+ 24 * 60 * 60 * 1000)).fullDate;
console.log(nDate);
const HDay = getWeekDate(new Date(new Date().getTime() + 48 * 60 * 60 * 1000).getDay());
const hDate=getDate(new Date(new Date().getTime()+ 48 * 60 * 60 * 1000)).fullDate;
let d1 = hDate.substr(hDate.indexOf('-')+1)
const hDate=getDate(new Date(new Date().getTime()+ 48 * 60 * 60 * 1000)).fullDate;
let d1 = hDate.substr(hDate.indexOf('-')+1)
sLDate.value = isDay;
selectLDate(1);
jmhDay.value = [{name:day,id:1,formatDate:isDay,desc:'今天'},{name:nextDay,id:2,formatDate:nDate,desc:'明天'},
{name:HDay,id:3,formatDate:hDate,desc:d1.substr(0,d1.indexOf('-'))+'月'+d1.substr(d1.indexOf('-')+1)+'日'}]
{name:HDay,id:3,formatDate:hDate,desc:d1.substr(0,d1.indexOf('-'))+'月'+d1.substr(d1.indexOf('-')+1)+'日'}]
}
const getWeekDate = (day) => {
const weeks = new Array("周日", "周一", "周二", "周三", "周四", "周五", "周六");
const week = weeks[day];
const weeks = new Array("周日", "周一", "周二", "周三", "周四", "周五", "周六");
const week = weeks[day];
return week;
}
const selectRDate = (item) => {
if(item.disabled){
if(item.disabled){
return;
}
sRightDate.value = item.time;
@ -86,8 +86,8 @@ const selectLDate = (val) => {
{disabled:false,time:'19:00-21:00',id:5},
{disabled:false,time:'21:00-23:00',id:6}
]
if(val.desc=='今天'||val==1){
if(new Date().getHours()<=10){
if(val.desc=='今天'||val==1){
if(new Date().getHours()<=10){
timeList = t;
}else if(new Date().getHours()<=12){
t[0].disabled=true;
@ -95,12 +95,12 @@ const selectLDate = (val) => {
}else if(new Date().getHours()<=14){
t[0].disabled=true;
t[1].disabled=true;
timeList = t;
timeList = t;
}else if(new Date().getHours()<=16){
t[0].disabled=true;
t[1].disabled=true;
t[2].disabled=true;
timeList = t;
timeList = t;
}else if(new Date().getHours()<=18){
t[0].disabled=true;
t[1].disabled=true;
@ -114,12 +114,12 @@ const selectLDate = (val) => {
t[3].disabled=true;
t[4].disabled=true;
timeList = t;
}
}
console.log('最终的时间列表');
console.log(timeList);
} else {
} else {
timeList = t;
}
}
sRightDate.value = '';
}
@ -136,39 +136,35 @@ const hide = ()=> {
</script>
<template>
<uni-popup ref="popup" type="bottom">
<view class="pBoxUp">
<view class="textCenter f32 psTitle border-bottom">
请选择取件时间
</view>
<view class="shopPopup bgff justify-between default-flex">
<view class="f30 t666 lBox">
<view v-for="(item,index) in jmhDay" @click="selectLDate(item)" :class="sLDate==item.formatDate?'ed':''" class="boxLDate"
:key="index">{{item.desc}}({{item.name}})
</view>
</view>
<view >
<view v-for="(item,index) in timeList" @click="selectRDate(item)"
:class="[sRightDate==item.time?'ed':'',item.disabled?'disabled':'']" :key="index" class="rBox"
>
{{item.time}}{{item.disabled?' (超出配送时间)':''}}
</view>
<view class="empty f28 text-center" style="color: #999;margin-top: 40rpx;"
v-if="timeList.length<1">
今天没有时间了,看看明天吧
</view>
</view>
</view>
<view class="cancelButton" @click="hide()">
取消
</view>
</view>
<view class="pBoxUp">
<view class="textCenter f32 psTitle border-bottom">请选择取件时间</view>
<view class="shopPopup bgff justify-between default-flex">
<view class="f30 t666 lBox">
<view v-for="(item,index) in jmhDay" @click="selectLDate(item)" :class="sLDate==item.formatDate?'ed':''" class="boxLDate"
:key="index">{{item.desc}}({{item.name}})
</view>
</view>
<view >
<view v-for="(item,index) in timeList" @click="selectRDate(item)"
:class="[sRightDate==item.time?'ed':'',item.disabled?'disabled':'']" :key="index" class="rBox"
>
{{item.time}}{{item.disabled?' (超出配送时间)':''}}
</view>
<view class="empty f28 text-center" style="color: #999;margin-top: 40rpx;"
v-if="timeList.length<1">
今天没有时间了,看看明天吧
</view>
</view>
</view>
<view class="cancelButton" @click="hide()"></view>
</view>
</uni-popup>
</template>
<style lang="scss" scoped>
.pBoxUp{
background: #f5f5f5;
.psTitle{
line-height: 100rpx;
line-height: 100rpx;
text-align: center;
border-bottom: 1rpx solid #f7f7f7;
}
@ -207,11 +203,11 @@ const hide = ()=> {
line-height: 80rpx;
}
.cancelButton{
font-size: 36rpx;
font-size: 32rpx;
color: #999;
text-align: center;
height: 100rpx;
line-height: 100rpx;
height: 120rpx;
line-height: 120rpx;
border-top: 1px solid #e5e5e5;
background: #FFF;
}

@ -168,7 +168,7 @@ const handleNewsList = () => {
hover-class="none"
>
<image class="img" src="/static/images/cart_selected.png" mode="scaleToFill" />
<view class="text"> 订单 </view>
<view class="text"> 我的订单 </view>
</navigator>
</view>
</view>

Loading…
Cancel
Save