"use strict";const t=require("../vendor.js");t.dayjs.locale("zh-cn"),t.dayjs.extend(t.relativeTime),exports.ShowLastTime=function(e){return e?t.dayjs(e).fromNow():"-"},exports.generateTimeSlots=function(e=null){const r=e?t.dayjs(e):t.dayjs(),o=(e?t.dayjs(e):t.dayjs()).valueOf(),s=[];let n=8;for(;n<18;){const t=Math.min(n+2,18),e=r.hour(n).minute(0).second(0),a=r.hour(t).minute(0).second(0),u=e.format("HH:mm"),f=a.format("HH:mm"),i=o>=e.valueOf()&&o<a.valueOf();a.valueOf()>o&&s.push({label:i?"两个小时内":`${u}-${f}`,str:u,end:f,isCurrent:i,date:r.format("YYYY-MM-DD"),startTimestamp:e.valueOf(),endTimestamp:a.valueOf()}),n=t}return console.log("slots",s),s},exports.getCurrentHour=function(){const t=new Date,e=t.getHours(),r=t.getMinutes();return console.log(e,r,"dayjs().hour()"),{currentHour:e,currentMinute:r}},exports.getDay=function(e){if(e){const r=t.dayjs().subtract(e,"day");return console.log(r.format("YYYY-MM-DD")),r.format("YYYY-MM-DD")}return t.dayjs().format("YYYY-MM-DD")},exports.getDayTime=function(e){if(e){let r=null==e?void 0:e.replace(/-/g,"/");return t.dayjs(r).format("YYYY-MM-DD HH:mm")}return t.dayjs().format("YYYY-MM-DD HH:mm")},exports.getTheFutureDay=function(e=1){return t.dayjs().add(e,"day").format("YYYY-MM-DD")},exports.getTime=function(){return t.dayjs().format("YYYY-MM-DD HH:mm:ss")},exports.getTimeStatus=function(e){const r=t.dayjs(),o=t.dayjs(e);if(o.isBefore(r)){const t=r.diff(o,"hour"),e=r.diff(o,"minute")%60;let s="已过期望处理时间：";return t>0&&(s+=`${t}个小时`),e>0&&(s+=`${e}分钟`),{label:s,status:"4",color:"#EA0000"}}{const t=o.diff(r,"hour"),e=o.diff(r,"minute")%60;let s,n;t>=24?(s="1",n="#24BC21"):t>=2?(s="2",n="#0082FA"):(s="3",n="#F97316");const a=Math.floor(t/24),u=t%24;let f="上门时间还剩：";return a>0&&(f+=`${a}天`),u>0&&(f+=`${u}个小时`),e>0&&(f+=`${e}分钟`),{label:f,status:s,color:n}}},exports.isDatePassed=function(e){return console.log(t.dayjs().isAfter(t.dayjs(e)),"dayjs().isAfter(dayjs(fixedDate))"),t.dayjs().isAfter(t.dayjs(e),"day")},exports.showCurrentTime=function(){return t.dayjs().format("HH:mm")},exports.showDay=function(e){return e?t.dayjs(e).format("YYYY-MM-DD"):"-"},exports.showWeekDay=function(){return{0:"星期日",1:"星期一",2:"星期二",3:"星期三",4:"星期四",5:"星期五",6:"星期六"}[t.dayjs().day()]},exports.specificTime=function(e){let r=null==e?void 0:e.replace(/-/g,"/");const o=t.dayjs(),s=t.dayjs(r);let n=Math.abs(s.diff(o,"hour",!0))<=2||s.isBefore(o);return console.log(n,"hoursDiff"),n};
