|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|