司机管理模块,开票通知模块

This commit is contained in:
2023-08-18 14:52:29 +08:00
parent 1a119820dd
commit 90e3353058
17 changed files with 701 additions and 232 deletions

View File

@ -1,59 +0,0 @@
import { formatDate, formatNumber } from '@/utils/common'
// 拼接 预约时间 picker
export function getAppointFun (time) {
let arr = []
// 当天剩余时间段
let obj = getCurrentDatePicker(time)
arr.push(obj)
// 后六天的可选时间段
let tempArr = getAfterTimeList()
arr.push(...tempArr)
return arr
}
// 拼接 当天剩余的可预约时间段(默认第一个是两小时之后可选)
const getCurrentDatePicker = time => {
let obj = {}
obj.text = formatDate(time);
let timeArr = getCurrentTimeList()
obj.children = timeArr
return obj
}
// 当天日期的时间段
const getCurrentTimeList = () => {
let todayDate = new Date()
let tempArr = []
tempArr.push({ text: '尽快到' }); // 首先添加尽快到
if( todayDate.getMinutes() <= 30 && todayDate.getMinutes() > 0 ) {
let tempVal = todayDate.getHours() + 2;
let tempHalfHours = formatNumber(tempVal) + ':30';
tempArr.push({ text: tempHalfHours });
}
let startFlag = (todayDate.getMinutes() == 0) ? (todayDate.getHours() + 2) : (todayDate.getHours() + 3)
tempArr = getDateTimeList(startFlag, tempArr)
return tempArr
}
// 获取后六天的 预约时间 picker
const getAfterTimeList = () => {
let afterArr = []
for(let i = 1; i < 7; i++ ) {
let obj = {};
let tempTime = formatDate(new Date().getTime() + (i * 24* 60 * 60 * 1000))
obj.text = tempTime
let timeArr = []
obj.children = getDateTimeList(0, timeArr)
afterArr.push(obj)
}
return afterArr
}
// 获取某个时间段后的所有可选时段
const getDateTimeList = (startHours = 0, list) => {
for(let i = startHours; i < 24; i++ ) {
list.push({ text: formatNumber(i) + ':' + '00' })
list.push({ text: formatNumber(i) + ':' + '30' })
}
return list
}

View File

@ -22,9 +22,23 @@ const leftCopy = (obj, source) => {
}
}
const timeFormat=(data) =>{
const currentDate = new Date(data);
const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1).padStart(2, '0');
const day = String(currentDate.getDate()).padStart(2, '0');
const hours = String(currentDate.getHours()).padStart(2, '0');
const minutes = String(currentDate.getMinutes()).padStart(2, '0');
const seconds = String(currentDate.getSeconds()).padStart(2, '0');
const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
// console.log("formattedDate",formattedDate)
return formattedDate;
}
module.exports = {
formatNumber,
formatDate,
leftCopy,
timeFormat
}

View File

@ -16,7 +16,7 @@ service.interceptors.request.use(
config.headers['Content-Type'] = config.contentType || 'application/x-www-form-urlencoded'
// const urlParams = new URLSearchParams(window.location.search);
// const token = urlParams.get('token');
let token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzemwiLCJhdWQiOlsic3VwcGxpZXItYXBwIl0sIm5iZiI6MTY5MjE2ODQ3OCwidXNlcl9pbmZvIjp7InVzZXJJZCI6NTQ1ODUsInBob25lIjoiMTc2MzAwMzU2NTgiLCJuYW1lIjoi5bCP5a6LIiwic3VwcGxpZXJOYW1lIjoi5LiK5rW35a6J55WFQSIsInN1cHBsaWVySWQiOjExMjgsInN1cHBsaWVyVHlwZSI6MSwidXNlcm5hbWUiOiJzemwiLCJ1c2VyVHlwZSI6IkFQUCIsImF1dGhvcml0aWVzIjpbXX0sInNjb3BlIjpbImFsbCJdLCJpc3MiOiJodHRwczovL3Npbm9hc3Npc3QuY29tIiwiZXhwIjoxNjkyMjU0ODc4LCJpYXQiOjE2OTIxNjg0Nzh9.yVreEsJqwcEy6jALrhqQ9tasuBKqEE-y3fq_TXfaspE'
let token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzemwiLCJhdWQiOlsic3VwcGxpZXItYXBwIl0sIm5iZiI6MTY5MjI2MzgzOSwidXNlcl9pbmZvIjp7InVzZXJJZCI6NTQ1ODUsInBob25lIjoiMTc2MzAwMzU2NTgiLCJuYW1lIjoi5bCP5a6LIiwic3VwcGxpZXJOYW1lIjoi5LiK5rW35a6J55WFQSIsInN1cHBsaWVySWQiOjExMjgsInN1cHBsaWVyVHlwZSI6MSwidXNlcm5hbWUiOiJzemwiLCJ1c2VyVHlwZSI6IkFQUCIsImF1dGhvcml0aWVzIjpbXX0sInNjb3BlIjpbImFsbCJdLCJpc3MiOiJodHRwczovL3Npbm9hc3Npc3QuY29tIiwiZXhwIjoxNjkyMzUwMjM5LCJpYXQiOjE2OTIyNjM4Mzl9.Mldu7SmfjNEdH-bItFCLVL-zo-IopHWTc8LkTXOtC58'
config.headers['Authorization'] = `${token}`;
return config
},