import oauth from '@/apis/modules/oauth.js' import clueApi from '@/apis/modules/clue.js' const utils = { async getstorelist() { const result = await oauth.getStoreList(); return result }, gettime() { const now = new Date(); const formatTime = uni.$u.timeFormat(now,'yyyy-mm-dd hh:MM:ss') console.log('当前时间:', formatTime); return formatTime }, // 获取今天的日期字符串 getTodayString() { const today = new Date() return uni.$u.timeFormat(today,'yyyy-mm-dd') }, async gethy(e) { let c1 = '暂无' const result = await clueApi.getCustomerClues({ currentPage: 1, pageSize: 1, keyword: e }); if(result.code == 200 && result.data.list.length>0){ c1 = result.data.list[0].id } return c1 }, // 格式化时间 formatTime(timestamp) { if (!timestamp) return '无' const date = new Date(timestamp) return uni.$u.timeFormat(date,'yyyy-mm-dd hh:MM') }, formatTimeday(timestamp) { if (!timestamp) return '无' const date = new Date(timestamp) return uni.$u.timeFormat(date,'yyyy-mm-dd') }, formatTimess(timestamp) { if (!timestamp) return '无' const date = new Date(timestamp) return uni.$u.timeFormat(date,'yyyy-mm-dd hh:MM:ss') }, // 获取今天的日期范围 getTodayRange() { const today = new Date() const startOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate()) const endOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59, 999) return [startOfDay.getTime(), endOfDay.getTime()] }, // 获取本月时间范围 getCurrentMonthRange() { const today = new Date() const startOfDay = new Date(today.getFullYear(), today.getMonth(), 1) const endOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59, 999) return [startOfDay.getTime(), endOfDay.getTime()] }, }; export default utils;