Blame view

绿纤uni-app/service/utils.js 1.83 KB
29608708   李宇   增加unia-app和html
1
2
3
  import oauth from '@/apis/modules/oauth.js'
  import clueApi from '@/apis/modules/clue.js'
  const utils = {
ba43caee   李宇   最新
4
5
6
7
  	async getstorelist() {
  		const result = await oauth.getStoreList();
  		return result
  	},
29608708   李宇   增加unia-app和html
8
9
  	gettime() {
  		const now = new Date();
0f14a621   李宇   最新
10
  		const formatTime = uni.$u.timeFormat(now,'yyyy-mm-dd hh:MM:ss')
29608708   李宇   增加unia-app和html
11
12
13
  		console.log('当前时间:', formatTime);
  		return formatTime
  	},
0f14a621   李宇   最新
14
15
16
17
18
  	// 获取今天的日期字符串
  	getTodayString() {
  		const today = new Date()
  		return uni.$u.timeFormat(today,'yyyy-mm-dd')
  	},
29608708   李宇   增加unia-app和html
19
20
21
22
23
24
25
26
27
28
29
  	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
0f14a621   李宇   最新
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
  	},
  	// 格式化时间
  	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()]
  	},
  	
29608708   李宇   增加unia-app和html
62
63
64
  
  };
  export default utils;