纸板小程序:订单/送货单:列表与详情功能

This commit is contained in:
2026-06-11 11:26:40 +08:00
commit ef9ede1605
2317 changed files with 61642 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
export const formatTime = (date: Date) => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return (
[year, month, day].map(formatNumber).join('/') +
' ' +
[hour, minute, second].map(formatNumber).join(':')
)
}
const formatNumber = (n: number) => {
const s = n.toString()
return s[1] ? s : '0' + s
}
export const getMonthDay = () => {
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth(); // 0~11,0代表1月
// 当月第一天
const firstDay = new Date(year, month, 1);
// 当月最后一天:下个月的第0天
const lastDay = new Date(year, month + 1, 0);
// 格式化日期为 YYYY-MM-DD
const format = (date) => {
const y = date.getFullYear();
const m = (date.getMonth() + 1).toString().padStart(2, '0');
const d = date.getDate().toString().padStart(2, '0');
return `${y}-${m}-${d}`;
};
const firstStr = format(firstDay); // 例如 2026-06-01
const lastStr = format(lastDay); // 例如 2026-06-30
return [firstStr,lastStr]
}