* 'develop' of ssh://code.juyouwu.cn:2222/pay/pay-customer: fix:更新 # Conflicts: # .env.development # ci/project.config.json # dist/build/mp-weixin/INDEX/bill/list/index.wxml # dist/build/mp-weixin/INDEX/invitation/index.js # dist/build/mp-weixin/INDEX/invitation/index.json # dist/build/mp-weixin/INDEX/invitation/index.wxml # dist/build/mp-weixin/INDEX/invitation/index.wxss # dist/build/mp-weixin/INDEX/parking_payment/index.js # dist/build/mp-weixin/INDEX/parking_payment/index.wxml # dist/build/mp-weixin/INDEX/parking_payment/index.wxss # dist/build/mp-weixin/INDEX/parking_payment_record/index.js # dist/build/mp-weixin/INDEX/parking_payment_record/index.json # dist/build/mp-weixin/INDEX/parking_payment_record/index.wxml # dist/build/mp-weixin/INDEX/parking_payment_record/index.wxss # dist/build/mp-weixin/INDEX/pay/method.js # dist/build/mp-weixin/INDEX/pay/success.js # dist/build/mp-weixin/INDEX/pay/success.wxml # dist/build/mp-weixin/INDEX/pay/success.wxss # dist/build/mp-weixin/ME/payment_pre_stored/index.js # dist/build/mp-weixin/ME/payment_pre_stored/index.wxml # dist/build/mp-weixin/ME/payment_pre_stored/index.wxss # dist/build/mp-weixin/ME/pre_stored_form/index.js # dist/build/mp-weixin/ME/pre_stored_form/index.wxml # dist/build/mp-weixin/ME/vehicle_management/add/index.js # dist/build/mp-weixin/ME/vehicle_management/add/index.wxml # dist/build/mp-weixin/ME/vehicle_management/add/index.wxss # dist/build/mp-weixin/WORKORDER/add/index.js # dist/build/mp-weixin/WORKORDER/add/index.json # dist/build/mp-weixin/WORKORDER/add/index.wxml # dist/build/mp-weixin/WORKORDER/add/method.js # dist/build/mp-weixin/WORKORDER/list/index.js # dist/build/mp-weixin/WORKORDER/list/index.wxml # dist/build/mp-weixin/WORKORDER/list/index.wxss # dist/build/mp-weixin/WORKORDER/show/index.js # dist/build/mp-weixin/WORKORDER/show/index.json # dist/build/mp-weixin/WORKORDER/show/index.wxml # dist/build/mp-weixin/WORKORDER/show/index.wxss # dist/build/mp-weixin/WORKORDER/show/method.js # dist/build/mp-weixin/WORKORDER/show/model.js # dist/build/mp-weixin/common/components/cc-scroll-loading/cc-scroll-loading.js # dist/build/mp-weixin/common/components/cc-scroll-loading/cc-scroll-loading.wxml # dist/build/mp-weixin/common/components/cc-scroll-loading/cc-scroll-loading.wxss # dist/build/mp-weixin/common/libraries/day.js # dist/build/mp-weixin/common/vendor.js # dist/build/mp-weixin/components/hs-button/hs-button.js # dist/build/mp-weixin/components/hs-button/hs-button.wxml # dist/build/mp-weixin/components/hs-button/hs-button.wxss # dist/build/mp-weixin/components/hs-popup-evaluate/hs-popup-evaluate.js # dist/build/mp-weixin/components/hs-popup-evaluate/hs-popup-evaluate.wxml # dist/build/mp-weixin/components/hs-popup-evaluate/hs-popup-evaluate.wxss # dist/build/mp-weixin/components/hs-reservation-picker/hs-reservation-picker.js # dist/build/mp-weixin/components/hs-reservation-picker/hs-reservation-picker.wxml # dist/build/mp-weixin/components/hs-reservation-picker/hs-reservation-picker.wxss # dist/build/mp-weixin/gen/Apis.js # dist/build/mp-weixin/gen/Enums.js # dist/build/mp-weixin/node-modules/uview-plus/components/u-keyboard/u-keyboard.js # dist/build/mp-weixin/pages/index/components/Classification.js # dist/build/mp-weixin/pages/index/components/Classification.wxml # dist/build/mp-weixin/pages/index/components/Classification.wxss # dist/build/mp-weixin/pages/index/components/ConvenienceServices.js # dist/build/mp-weixin/pages/index/components/ConvenienceServices.json # dist/build/mp-weixin/pages/index/components/ConvenienceServices.wxml # dist/build/mp-weixin/pages/index/components/ConvenienceServices.wxss # dist/build/mp-weixin/pages/index/index.wxss # dist/build/mp-weixin/pages/me/components/AreaFunctional.js # dist/build/mp-weixin/pages/me/components/AreaFunctional.json # dist/build/mp-weixin/pages/me/components/AreaFunctional.wxml # dist/build/mp-weixin/pages/me/components/AreaFunctional.wxss # dist/build/mp-weixin/pages/transfer/index.js # dist/dev/mp-weixin/INDEX/pay/method.js # dist/dev/mp-weixin/INDEX/pay/success.wxml # dist/dev/mp-weixin/WORKORDER/add/index.js # dist/dev/mp-weixin/WORKORDER/list/index.js # dist/dev/mp-weixin/WORKORDER/list/index.json # dist/dev/mp-weixin/WORKORDER/list/index.wxml # dist/dev/mp-weixin/WORKORDER/list/index.wxss # dist/dev/mp-weixin/WORKORDER/show/index.js # dist/dev/mp-weixin/WORKORDER/show/index.json # dist/dev/mp-weixin/WORKORDER/show/index.wxml # dist/dev/mp-weixin/WORKORDER/show/index.wxss # dist/dev/mp-weixin/WORKORDER/show/model.js # dist/dev/mp-weixin/app.js # dist/dev/mp-weixin/common/libraries/day.js # dist/dev/mp-weixin/common/libraries/request.js # dist/dev/mp-weixin/common/vendor.js # dist/dev/mp-weixin/components/hs-popup-evaluate/hs-popup-evaluate.js # dist/dev/mp-weixin/components/hs-reservation-picker/hs-reservation-picker.js # dist/dev/mp-weixin/components/hs-reservation-picker/hs-reservation-picker.wxss # dist/dev/mp-weixin/gen/Enums.js # dist/dev/mp-weixin/node-modules/uview-plus/components/u-keyboard/u-keyboard.js # dist/dev/mp-weixin/pages/transfer/index.js # dist/dev/mp-weixin/project.private.config.json # src/INDEX/pay/method.ts # src/INDEX/pay/success.vue # src/WORKORDER/add/index.vue # src/WORKORDER/list/index.vue # src/WORKORDER/list/style.scss # src/WORKORDER/show/index.vue # src/WORKORDER/show/model.ts # src/WORKORDER/show/style.scss # src/common/libraries/day.ts # src/components/hs-popup-evaluate/hs-popup-evaluate.vue # src/components/hs-reservation-picker/hs-reservation-picker.vue # src/gen/ApiTypes.d.ts # src/gen/Enums.ts # src/pages/transfer/index.vue
109 lines
3.8 KiB
JavaScript
109 lines
3.8 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../vendor.js");
|
|
common_vendor.dayjs.locale("zh-cn");
|
|
common_vendor.dayjs.extend(common_vendor.relativeTime);
|
|
function showDay(time) {
|
|
return common_vendor.dayjs(time).format("YYYY-MM-DD");
|
|
}
|
|
function getTheFutureDay(num = 1) {
|
|
const pastFifteenDays = common_vendor.dayjs().add(num, "day");
|
|
return pastFifteenDays.format("YYYY-MM-DD");
|
|
}
|
|
function getCurrentHour() {
|
|
const now = new Date();
|
|
const currentHour = now.getHours();
|
|
const currentMinute = now.getMinutes();
|
|
console.log(currentHour, currentMinute, "dayjs().hour()");
|
|
return { currentHour, currentMinute };
|
|
}
|
|
function generateTimeSlots(externalDate = null) {
|
|
const baseDate = externalDate ? common_vendor.dayjs(externalDate) : common_vendor.dayjs();
|
|
const now = externalDate ? common_vendor.dayjs(externalDate) : common_vendor.dayjs();
|
|
const startHour = 8;
|
|
const endHour = 18;
|
|
const interval = 2;
|
|
const currentTime = now.valueOf();
|
|
const slots = [];
|
|
let currentStart = startHour;
|
|
while (currentStart < endHour) {
|
|
const currentEnd = Math.min(currentStart + interval, endHour);
|
|
const startTime = baseDate.hour(currentStart).minute(0).second(0);
|
|
const endTime = baseDate.hour(currentEnd).minute(0).second(0);
|
|
const startStr = startTime.format("HH:mm");
|
|
const endStr = endTime.format("HH:mm");
|
|
const isCurrentPeriod = currentTime >= startTime.valueOf() && currentTime < endTime.valueOf();
|
|
if (endTime.valueOf() > currentTime) {
|
|
slots.push({
|
|
label: isCurrentPeriod ? "两个小时内" : `${startStr}-${endStr}`,
|
|
str: startStr,
|
|
end: endStr,
|
|
isCurrent: isCurrentPeriod,
|
|
date: baseDate.format("YYYY-MM-DD"),
|
|
startTimestamp: startTime.valueOf(),
|
|
endTimestamp: endTime.valueOf()
|
|
});
|
|
}
|
|
currentStart = currentEnd;
|
|
}
|
|
console.log("slots", slots);
|
|
return slots;
|
|
}
|
|
function getTimeRangeDisplay(startTime, endTime, currentTime = null) {
|
|
try {
|
|
const start = common_vendor.dayjs(startTime);
|
|
const end = common_vendor.dayjs(endTime);
|
|
const now = currentTime ? common_vendor.dayjs(currentTime) : common_vendor.dayjs();
|
|
if (!start.isValid() || !end.isValid()) {
|
|
return "时间格式错误";
|
|
}
|
|
if (start.isAfter(end)) {
|
|
return "时间顺序错误";
|
|
}
|
|
if (now.isAfter(start) && now.isBefore(end)) {
|
|
return "两个小时内";
|
|
}
|
|
const isSameDay2 = start.isSame(end, "day");
|
|
if (isSameDay2) {
|
|
return `${start.format("YYYY-MM-DD")} ${start.format("HH:mm")}-${end.format("HH:mm")}`;
|
|
} else {
|
|
return `${start.format("YYYY-MM-DD HH:mm")} - ${end.format("YYYY-MM-DD HH:mm")}`;
|
|
}
|
|
} catch (error) {
|
|
return "时间格式错误";
|
|
}
|
|
}
|
|
function getFromNow(time) {
|
|
return time ? common_vendor.dayjs(time).fromNow() : "";
|
|
}
|
|
function getIsInRangeInclusive(start, end) {
|
|
const now = common_vendor.dayjs();
|
|
const startDate = common_vendor.dayjs(start);
|
|
const endDate = common_vendor.dayjs(end);
|
|
return now.isAfter(startDate) && now.isBefore(endDate);
|
|
}
|
|
function getDate(time) {
|
|
return time ? common_vendor.dayjs(time).format("YYYY-MM-DD") : "";
|
|
}
|
|
<<<<<<< HEAD
|
|
=======
|
|
function specificTime(targetTime) {
|
|
const now = common_vendor.dayjs();
|
|
const target = common_vendor.dayjs(targetTime);
|
|
let hoursDiff = Math.abs(target.diff(now, "hour", true)) <= 2 || target.isBefore(now);
|
|
console.log(hoursDiff, "hoursDiff");
|
|
return hoursDiff;
|
|
}
|
|
>>>>>>> 6b1220997d2fd629b6dcb6dfbd7960a21d065f82
|
|
exports.generateTimeSlots = generateTimeSlots;
|
|
exports.getCurrentHour = getCurrentHour;
|
|
exports.getDate = getDate;
|
|
exports.getFromNow = getFromNow;
|
|
exports.getIsInRangeInclusive = getIsInRangeInclusive;
|
|
exports.getTheFutureDay = getTheFutureDay;
|
|
exports.getTimeRangeDisplay = getTimeRangeDisplay;
|
|
exports.showDay = showDay;
|
|
<<<<<<< HEAD
|
|
=======
|
|
exports.specificTime = specificTime;
|
|
>>>>>>> 6b1220997d2fd629b6dcb6dfbd7960a21d065f82
|