修复 业主小程序端:报修时候选择预约日期及时间,当下之前的日期及时间应该灰掉,不能选择过往日期及时间 bug

This commit is contained in:
java110 2022-07-04 11:22:13 +08:00
parent 6d2c08a96f
commit cca6a2d45d
2 changed files with 19 additions and 2 deletions

View File

@ -39,6 +39,18 @@ export function formatTime(date) {
const second = date.getSeconds(); const second = date.getSeconds();
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':'); return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':');
} }
/**
*
* 将时间转换为 字符串
* @desc: 格式化时间
* @return: eg: '2018/04/09 21:31:00'
* @param {Date对象} date
*/
export function formatHourAndMin(date) {
const hour = date.getHours();
const minute = date.getMinutes();
return [hour, minute].map(formatNumber).join(':');
}
/** /**
* 将日期转换为 字符串 * 将日期转换为 字符串
* @desc: 格式化日期 * @desc: 格式化日期

View File

@ -56,7 +56,7 @@
</view> </view>
<view class="cu-form-group arrow"> <view class="cu-form-group arrow">
<view class="title">预约日期</view> <view class="title">预约日期</view>
<picker mode="date" :value="bindDate" start="2020-09-01" end="2050-09-01" @change="dateChange"> <picker mode="date" :value="bindDate" :start="todayDate" end="2050-09-01" @change="dateChange">
<view class="picker"> <view class="picker">
{{bindDate}} {{bindDate}}
</view> </view>
@ -64,7 +64,7 @@
</view> </view>
<view class="cu-form-group arrow"> <view class="cu-form-group arrow">
<view class="title">预约时间</view> <view class="title">预约时间</view>
<picker mode="time" :value="bindTime" start="08:30" end="22:00" @change="timeChange"> <picker mode="time" :value="bindTime" :start="todayDateTime" end="22:00" @change="timeChange">
<view class="picker"> <view class="picker">
{{bindTime}} {{bindTime}}
</view> </view>
@ -113,6 +113,7 @@
import context from '../../lib/java110/Java110Context.js' import context from '../../lib/java110/Java110Context.js'
const constant = context.constant; const constant = context.constant;
const factory = context.factory; const factory = context.factory;
import {formatDate,formatHourAndMin} from '@/lib/java110/utils/DateUtil.js'
export default { export default {
data() { data() {
@ -169,6 +170,8 @@
unitNum: '', unitNum: '',
unitId: '', unitId: '',
priceScope: '', priceScope: '',
todayDate:'',
todayDateTime:''
}; };
}, },
@ -199,6 +202,8 @@
// //
this._loadRepairTypes(); this._loadRepairTypes();
this.todayDate = formatDate(new Date());
this.todayDateTime = formatHourAndMin(new Date())
}, },
/** /**