diff --git a/pages/users/gather_list/index.vue b/pages/users/gather_list/index.vue index eab6331..e305260 100644 --- a/pages/users/gather_list/index.vue +++ b/pages/users/gather_list/index.vue @@ -16,8 +16,8 @@ - - 2024年04月 + + {{where.start_time + (where.end_time ? ( ' 至 ' + where.end_time):'')}} 已提现金额{{extractSum}} @@ -34,7 +34,6 @@ {{`${item.financial_account.bank}`}} - +{{item.extract_money}} @@ -55,13 +54,12 @@ - + {{loadTitle}} - - + + @@ -85,6 +83,7 @@ }, data() { return { + currTab: 0, //自定义选择时间tab sum: 0, count: 0, scrollTop: 0, @@ -92,7 +91,6 @@ merId: '', UserApplylist: [], - loaded: false, loading: false, loadTitle: '加载更多', @@ -100,13 +98,12 @@ page: 1, limit: 15, keyword: '', - start_time: '' + start_time: '', + end_time: '' }, all_extract: 0, all_count: 0, extractSum: 0, - - value1: Number(new Date()) } }, computed: { @@ -117,9 +114,8 @@ onLoad(option) { this.merId = option.mer_id; - let date = new Date(); - this.endDate = `${date.getFullYear()}-${date.getMonth()+1}-01` - this.ApplyList() + this.where.start_time = new Date().format('yyyy-MM-dd'); + this.ApplyList(); }, // 下拉到底部 @@ -128,19 +124,33 @@ }, methods: { - - formatter(type, value) { - if (type === 'year') { - return `${value}年` - } - if (type === 'month') { - return `${value}月` - } - if (type === 'day') { - return `${value}日` - } - return value + // 选择时间 + onOpenTime() { + this.$refs.pickerDate.open() }, + + // 确认 + confirm(e) { + + if (e.time) { + this.where.start_time = e.time; + this.where.end_time = ''; + } else { + this.where.start_time = e.start_time.time; + this.where.end_time = e.end_time.time; + } + this.where.page = 1; + this.loaded = false; + this.ApplyList(); + }, + + // 重置 + reset(e) { + this.where.end_time = ''; + this.where.start_time = new Date().format('yyyy-MM-dd'); + this.ApplyList(); + }, + // 查看 handleView(item) { if (!item.image || item.length == 0) return; diff --git a/uni_modules/h-datetime-picker/changelog.md b/uni_modules/h-datetime-picker/changelog.md new file mode 100644 index 0000000..3663363 --- /dev/null +++ b/uni_modules/h-datetime-picker/changelog.md @@ -0,0 +1,54 @@ +## 1.2.6(2024-04-15) +ui调整 +## 1.2.5(2023-12-08) +bug修复 +## 1.2.4(2023-12-08) +新增上午下午选择 +## 1.2.3(2023-08-30) +nvue样式异常修复 +## 1.2.2(2023-08-30) +bug修复 +## 1.2.1(2023-08-30) +微信小程序端默认时间初始化问题修复 +## 1.2.0(2023-08-28) +bug修复 +## 1.1.9(2023-08-15) +bug修改 +## 1.1.8(2023-08-15) +bug修复 +## 1.1.7(2023-08-01) +bug修复 +## 1.1.6(2023-08-01) +bug修复 +## 1.1.5(2023-07-31) +修复已知bug +## 1.1.4(2023-07-28) +bug修复 +## 1.1.3(2023-07-11) +bug修复 +## 1.1.2(2023-07-11) +bug修复 +## 1.1.1(2023-07-05) +修复年月切换后日不更新bug +## 1.1.0(2023-06-20) +修复mode初始化问题 +## 1.0.10(2023-05-18) +样式优化 +## 1.0.9(2023-05-18) +补充效果图 +## 1.0.8(2023-05-18) +文档说明调整 +## 1.0.7(2023-05-18) +新增选择器显示模式 +## 1.0.6(2023-05-18) +h5端样式问题修复 +## 1.0.5(2023-05-16) +细节优化 +## 1.0.3(2023-05-16) +细节优化 +## 1.0.2(2023-05-12) +bug修复 +## 1.0.1(2023-05-12) +修复已知问题 +## 1.0.0(2023-05-12) +1.0.0 diff --git a/uni_modules/h-datetime-picker/components/h-datetime-picker/h-datetime-picker.vue b/uni_modules/h-datetime-picker/components/h-datetime-picker/h-datetime-picker.vue new file mode 100644 index 0000000..e2ed211 --- /dev/null +++ b/uni_modules/h-datetime-picker/components/h-datetime-picker/h-datetime-picker.vue @@ -0,0 +1,647 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/h-datetime-picker/js/timeFormat.js b/uni_modules/h-datetime-picker/js/timeFormat.js new file mode 100644 index 0000000..0372f2f --- /dev/null +++ b/uni_modules/h-datetime-picker/js/timeFormat.js @@ -0,0 +1,51 @@ +// padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序 +// 所以这里做一个兼容polyfill的兼容处理 +if (!String.prototype.padStart) { + // 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解 + String.prototype.padStart = function(maxLength, fillString = ' ') { + if (Object.prototype.toString.call(fillString) !== "[object String]") throw new TypeError( + 'fillString must be String') + let str = this + // 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉 + if (str.length >= maxLength) return String(str) + + let fillLength = maxLength - str.length, + times = Math.ceil(fillLength / fillString.length) + while (times >>= 1) { + fillString += fillString + if (times === 1) { + fillString += fillString + } + } + return fillString.slice(0, fillLength) + str; + } +} + +// 其他更多是格式化有如下: +// yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合 +function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd') { + // 如果为null,则格式化当前时间 + if (!dateTime) dateTime = Number(new Date()); + // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式 + if (dateTime.toString().length == 10) dateTime *= 1000; + let date = new Date(dateTime); + let ret; + let opt = { + "y+": date.getFullYear().toString(), // 年 + "m+": (date.getMonth() + 1).toString(), // 月 + "d+": date.getDate().toString(), // 日 + "h+": date.getHours().toString(), // 时 + "M+": date.getMinutes().toString(), // 分 + "s+": date.getSeconds().toString() // 秒 + // 有其他格式化字符需求可以继续添加,必须转化成字符串 + }; + for (let k in opt) { + ret = new RegExp("(" + k + ")").exec(fmt); + if (ret) { + fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) + }; + }; + return fmt; +} + +export default timeFormat diff --git a/uni_modules/h-datetime-picker/package.json b/uni_modules/h-datetime-picker/package.json new file mode 100644 index 0000000..89f2324 --- /dev/null +++ b/uni_modules/h-datetime-picker/package.json @@ -0,0 +1,82 @@ +{ + "id": "h-datetime-picker", + "displayName": "时间日期选择器", + "version": "1.2.6", + "description": "时间日期选择器", + "keywords": [ + "h-datetime-picker" +], + "repository": "", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "type": "component-vue", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y", + "alipay": "n" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "u" + }, + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "钉钉": "u", + "快手": "u", + "飞书": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/h-datetime-picker/readme.md b/uni_modules/h-datetime-picker/readme.md new file mode 100644 index 0000000..603eddc --- /dev/null +++ b/uni_modules/h-datetime-picker/readme.md @@ -0,0 +1,66 @@ + + +## datetime-picker 日期时间选择器 +> **组件名:h-datetime-picker** +> 代码块: `` +> 关联组件:`uni-popup uni-icons`。 + +## 属性说明 +参数|说明|类型|默认值 +-|-|-|- +params|需要显示的日期格式|Object|{year: true,month: true,day: true,hour: false,minute: false,second: false,timestamp: true,} +defaultTime|默认显示的时间(默认为当前时间)|String|'' +startYear|年份开始时间|String,Number|1950 +endYear|年份结束时间|String,Number|2050 +endMonth|月份结束时间|String,Number|12 +optionMode|自定义时间选择栏顶部快捷时间段选择类型,可选值:month(月)、day(天)|String|month +mode|选择器模式 all(显示月份选择以及时间段选择)、single(仅显示单月份选择)、multiple(仅显示时间段选择) |String|all +startTime|默认起始日期 仅在mode='multiple'时生效 例如:2022-5-18 12:00|String|'' +endTime|默认截止日期 仅在mode='multiple'时生效 例如:2023-5-18 12:00|String|'' +@reset|点击重置回调|Handler|无 +@confirm|点击确定回调|Handler|无 + +##@confirm返回说明(对应params) +###单日期(时间)选择 +参数|说明|类型 +-|-|-|- +year|年|String +month|月|String +day|日|String +hour|时|String +minute|分|String +second|秒|String +timestamp|时间戳|Number + +###时间段选择 +参数|说明|类型 +-|-|-|- +start_time|起始时间 格式与上一致|Object +end_time|截至时间 格式与上一致|Object + +##示例 +``` + + +``` +