This commit is contained in:
DESKTOP-GMUNQ1B\k 2024-04-16 16:21:11 +08:00
parent cd8513ec02
commit c6034c4ae4
6 changed files with 936 additions and 26 deletions

View File

@ -16,8 +16,8 @@
</view>
<view class="search">
<view class="search-time">
<text class="month">2024年04月</text>
<view class="search-time" @click="onOpenTime">
<text class="month">{{where.start_time + (where.end_time ? ( ' 至 ' + where.end_time):'')}}</text>
<u-icon name="arrow-down" color="#333" :bold="true"></u-icon>
</view>
<view class="total">已提现金额{{extractSum}}</view>
@ -34,7 +34,6 @@
<view class="item">
<view class="item_title">
<text>{{`${item.financial_account.bank}`}}</text>
</view>
<view class="item_money">+{{item.extract_money}}</view>
</view>
@ -55,13 +54,12 @@
</view>
</view>
<view style="color:#afafaf;" class='loadingicon acea-row row-center-wrapper' v-if='UserApplylist.length > 0'>
<view style="color:#afafaf;" class='loadingicon acea-row row-center-wrapper'>
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
</view>
<!-- 日期选择 -->
<!-- <u-datetime-picker ref="datetimePicker" :show="true" v-model="value1" mode="year-month"
:formatter="formatter"></u-datetime-picker> -->
<!-- 时间组件 -->
<h-datetime-picker ref="pickerDate" @reset="reset" @confirm="confirm"></h-datetime-picker>
</view>
</template>
@ -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;

View File

@ -0,0 +1,54 @@
## 1.2.62024-04-15
ui调整
## 1.2.52023-12-08
bug修复
## 1.2.42023-12-08
新增上午下午选择
## 1.2.32023-08-30
nvue样式异常修复
## 1.2.22023-08-30
bug修复
## 1.2.12023-08-30
微信小程序端默认时间初始化问题修复
## 1.2.02023-08-28
bug修复
## 1.1.92023-08-15
bug修改
## 1.1.82023-08-15
bug修复
## 1.1.72023-08-01
bug修复
## 1.1.62023-08-01
bug修复
## 1.1.52023-07-31
修复已知bug
## 1.1.42023-07-28
bug修复
## 1.1.32023-07-11
bug修复
## 1.1.22023-07-11
bug修复
## 1.1.12023-07-05
修复年月切换后日不更新bug
## 1.1.02023-06-20
修复mode初始化问题
## 1.0.102023-05-18
样式优化
## 1.0.92023-05-18
补充效果图
## 1.0.82023-05-18
文档说明调整
## 1.0.72023-05-18
新增选择器显示模式
## 1.0.62023-05-18
h5端样式问题修复
## 1.0.52023-05-16
细节优化
## 1.0.32023-05-16
细节优化
## 1.0.22023-05-12
bug修复
## 1.0.12023-05-12
修复已知问题
## 1.0.02023-05-12
1.0.0

View File

@ -0,0 +1,647 @@
<template>
<view>
<uni-popup ref="popup" @maskClick="close">
<view class="popup-box">
<view class="title">
<view class="tabs-box" v-if="mode=='all'">
<view v-for="(item,index) in tabs" :key="index" class="tabs-item" @click="tabChange(index)"
:class="{'tabs-check':index==tabIndex}">
<text class="item-text">{{item}}</text>
</view>
</view>
<view v-else class="title-text">
<text class="text">{{title?title:mode=='multiple'?'日期筛选':'月份选择'}}</text>
</view>
<uni-icons type="closeempty" class="close" size="16" @click="close"></uni-icons>
</view>
<view class="options-box" v-if="tabIndex">
<view class="flex row-between">
<view v-for="(item,index) in options" :key="index" class="option" @click="optionSelect(index)"
:class="{'option-check':opIndex==index}">
<text class="option-text">{{item}}</text>
</view>
</view>
<view class="flex row-between" style="margin-top: 40rpx;">
<view class="option" :class="{'option-check':op1Index==0}"
style="width: 320rpx;padding-left: 0;padding-right: 0;" @click="optionChange(0)">
<text class="option-text">{{startDate}}</text>
</view>
<view style="width: 18rpx;height: 2rpx;background: #7B8686;"></view>
<view class="option" :class="{'option-check':op1Index==1}"
style="width: 320rpx;padding-left: 0;padding-right: 0;" @click="optionChange(1)">
<text class="option-text">{{endDate}}</text>
</view>
</view>
</view>
<view class="picker-body">
<picker-view class="picker-view" :style="{height:tabIndex ? '380rpx' : '660rpx'}"
indicator-style="height:38px;background: rgba(0,0,0,.03);border:none;" :value="valueArr"
@change="change" @touchend="touchend">
<picker-view-column v-if="params.year">
<view class="column-item" v-for="(item,index) in years" :key="index">
<text class="column-item-text">{{item}}</text>
</view>
</picker-view-column>
<picker-view-column v-if="params.month">
<view class="column-item" v-for="(item,index) in months" :key="index">
<text class="column-item-text">{{formatNumber(item)}}</text>
</view>
</picker-view-column>
<picker-view-column v-if="params.day">
<view class="column-item" v-for="(item,index) in days" :key="index">
<text class="column-item-text">{{formatNumber(item)}}</text>
</view>
</picker-view-column>
<picker-view-column v-if="params.half">
<view class="column-item" v-for="(item,index) in halfs" :key="index">
<text class="column-item-text">{{item.label}}</text>
</view>
</picker-view-column>
</picker-view>
</view>
<view class="bottom">
<view class="h-btn h-btn-line" @click="reset">
<text style="color: #333;font-size: 32rpx;">重置</text>
</view>
<view class="h-btn" @click="getResult">
<text style="color: #fff;font-size: 32rpx;">确定</text>
</view>
</view>
</view>
<!-- 底部安全范围 -->
<u-safe-bottom></u-safe-bottom>
</uni-popup>
</view>
</template>
<script>
import timeFormat from "../../js/timeFormat.js"
export default {
props: {
// picker
params: {
type: Object,
default () {
return {
year: true,
month: true,
day: true,
half: false
};
}
},
// 2025-07-02 || 2025-07-02 13:01:00 || 2025/07/02
defaultTime: {
type: String,
default: timeFormat(new Date(), 'yyyy-mm-dd')
},
// month: day:
optionMode: {
type: String,
default: 'month'
},
// single: multiple: all:(bug )
mode: {
type: String,
default: 'all'
},
endTime: {
type: String,
default: timeFormat(new Date(), 'yyyy-mm-dd')
},
state: {
type: Number,
default: 1 //1. 2
},
title: {
type: String,
default: ''
}
},
data() {
return {
timeFormat,
years: [],
months: [],
days: [],
halfs: [{
label: '上午',
value: 1
}, {
label: '下午',
value: 2
}],
valueArr: [],
yearKey: 0,
monthKey: 0,
dayKey: 0,
halfKey: 0,
date: '',
startDate: '',
endDate: '',
time: {},
end_time: {},
tabs: ['选择时间', '自定义时间'],
tabIndex: 0,
opIndex: -1,
op1Index: 0,
options: ['近三月', '近半年', '近一年'],
fmt: 'yyyy-mm-dd',
isClick: false,
}
},
mounted() {
this.init()
},
watch: {
'time.year'(val, oval) {
if (this.params.month && oval) {
this.setMonths()
// this.setDays()
}
if (this.params.day && oval) {
this.setDays()
}
},
'time.month'(val, oval) {
if (this.params.day && oval) {
this.setDays()
}
}
},
methods: {
init(recieve_time) {
this.valueArr = [];
this.tabIndex = this.mode == 'multiple' ? 1 : 0
//
this.time = this.initTimeValue(this.defaultTime);
if (recieve_time) {
this.time = this.initTimeValue(recieve_time.time)
}
//
this.end_time = this.initTimeValue(this.endTime);
let fmt = []
if (this.optionMode == 'day') {
this.options = ['近3天', '近7天', '近15天']
}
if (this.params.year) {
this.valueArr.push(0);
this.yearKey = this.valueArr.length - 1
this.setYears();
fmt.push('yyyy')
}
if (this.params.month) {
this.valueArr.push(0);
this.monthKey = this.valueArr.length - 1
this.setMonths();
fmt.push('mm')
}
if (this.params.day) {
this.valueArr.push(0);
this.dayKey = this.valueArr.length - 1
this.setDays();
fmt.push('dd')
}
if (this.params.half) {
let half_index = 0
if (recieve_time) {
half_index = recieve_time.half == 1 ? 0 : 1
}
this.valueArr.push(half_index);
this.halfKey = this.valueArr.length - 1
}
this.fmt = fmt.join('-')
//
this.date = this.startDate = this.endDate = this.timeFormat(new Date(this.defaultTime.replace(/\-/g, '/')),
this.fmt)
if (recieve_time) {
this.date = this.startDate = this.endDate = this.timeFormat(new Date(recieve_time.time.replace(/\-/g,
'/')),
this.fmt)
}
//console.log(this.valueArr);
},
initDate() {
if (this.params.year) {
this.setYears();
}
if (this.params.month) {
this.setMonths();
}
if (this.params.day) {
this.setDays();
}
},
open() {
uni.hideTabBar({
animation: true
})
this.$refs.popup.open('bottom')
},
close() {
uni.showTabBar({
animation: true
})
this.$refs.popup.close()
},
//
reset() {
this.close();
this.init()
this.$emit('reset');
},
//
getResult() {
let result = {};
let {
date,
time,
halfs,
halfKey,
valueArr
} = this
if (this.tabIndex) {
let change_date = this.endDate
let start_time = {}
let end_time = {}
if (this.startDate.replace(/\-/g, '/') > this.endDate.replace(/\-/g, '/')) {
this.endDate = this.startDate
this.startDate = change_date
this.optionChange(0)
}
//console.log(this.startDate, this.endDate);
if (this.params.year) {
start_time.year = this.formatNumber(this.initTimeValue(this.startDate).year || 0);
end_time.year = this.formatNumber(this.initTimeValue(this.endDate).year || 0);
}
if (this.params.month) {
start_time.month = this.formatNumber(this.initTimeValue(this.startDate).month || 0);
end_time.month = this.formatNumber(this.initTimeValue(this.endDate).month || 0);
}
if (this.params.day) {
start_time.day = this.formatNumber(this.initTimeValue(this.startDate).day || 0);
end_time.day = this.formatNumber(this.initTimeValue(this.endDate).day || 0);
}
start_time.time = this.startDate;
end_time.time = this.endDate;
start_time.timestamp = new Date(this.startDate.replace(/\-/g, '/')).getTime();
end_time.timestamp = new Date(this.endDate.replace(/\-/g, '/')).getTime();
result = {
start_time,
end_time
}
} else {
if (this.params.year) result.year = this.formatNumber(time.year || 0);
if (this.params.month) result.month = this.formatNumber(time.month || 0);
if (this.params.day) result.day = this.formatNumber(time.day || 0);
result.time = date
if (this.params.half) result.half = halfs[valueArr[halfKey]].value
result.timestamp = new Date(date.replace(/\-/g, '/')).getTime();
//console.log(result, date);
}
result.state = this.state
this.$emit('confirm', result);
this.close();
},
// picker
setYears() {
let {
time,
end_time
} = this
let {
year
} = end_time
//
this.years = this.generateArray(1950, year);
// this.valueArrpicker
setTimeout(() => {
this.valueArr.splice(this.yearKey, 1, this.getIndex(this.years, time.year));
}, 10)
},
setMonths() {
let {
time,
end_time
} = this
let {
year,
month
} = end_time
if (year == time.year && this.params.year) {
this.months = this.generateArray(1, month);
} else {
this.months = this.generateArray(1, 12);
}
if (time.month > this.months.length) this.time.month = this.months.length;
//
setTimeout(() => {
this.valueArr.splice(this.monthKey, 1, this.getIndex(this.months, time.month));
}, 10)
},
setDays() {
let {
time,
end_time
} = this
let {
year,
month,
day
} = end_time
let totalDays = new Date(time.year, time.month, 0).getDate();
if (year == time.year && month == time.month && this.params.year) {
this.days = this.generateArray(1, day);
} else {
this.days = this.generateArray(1, totalDays);
}
if (time.day > this.days.length) this.time.day = this.days.length;
setTimeout(() => {
this.valueArr.splice(this.dayKey, 1, this.getIndex(this.days, time.day));
}, 10)
},
//
generateArray: function(start, end) {
// end-yearend+1
start = Number(start);
end = Number(end);
end = end > start ? end : start;
//
return [...Array(end + 1).keys()].slice(start);
},
getIndex: function(arr, val) {
let index = arr.indexOf(val);
// index-1(index)~(-1)=-(-1)-1=0
return ~index ? index : 0;
},
//
initTimeValue(defaultTime) {
// IE(uni)"-"
let fdate = defaultTime.replace(/\-/g, '/');
fdate = fdate && fdate.indexOf('/') == -1 ? `2020/01/01 ${fdate}` : fdate;
let time = null;
if (fdate) time = new Date(fdate);
else time = new Date();
//
return {
year: time.getFullYear(),
month: Number(time.getMonth()) + 1,
day: time.getDate(),
}
},
// 100
formatNumber(num) {
return +num < 10 ? '0' + num : String(num);
},
//
getTimestamp(date) {
// yyyy-mm-ddiOS使"/"
let time = date.year + '/' + date.month + '/' + (date.day || '01');
return new Date(time).getTime();
},
touchend(e) {
this.opIndex = -1
},
// picker
change(e) {
this.valueArr = e.detail.value;
let i = 0;
let time = {
year: 0,
month: 0,
day: 0,
}
if (this.params.year) time.year = this.years[this.valueArr[i++]];
if (this.params.month) time.month = this.months[this.valueArr[i++]];
if (this.params.day) time.day = this.days[this.valueArr[i++]];
this.time = time
let date = this.timeFormat(this.getTimestamp(time), this.fmt)
//
if (this.tabIndex) {
if (this.op1Index) {
this.endDate = date;
} else {
this.startDate = date;
}
} else { //
this.date = date;
}
},
tabChange(i) {
this.tabIndex = i
this.$emit('tabChange', i)
if (!i) {
this.time = this.initTimeValue(this.date);
this.initDate()
} else {
this.optionChange(this.op1Index)
}
},
//
optionSelect(i) {
this.opIndex = i;
let end_time = new Date()
let start_time;
switch (i) {
case 0: //
if (this.optionMode == 'day') {
start_time = end_time.setDate(new Date(end_time).getDate() - 3)
} else {
start_time = end_time.setMonth(new Date(end_time).getMonth() - 3)
}
break;
case 1: //
if (this.optionMode == 'day') {
start_time = end_time.setDate(new Date(end_time).getDate() - 7)
} else {
start_time = end_time.setMonth(new Date(end_time).getMonth() - 6)
}
break;
case 2: //
if (this.optionMode == 'day') {
start_time = end_time.setDate(new Date(end_time).getDate() - 15)
} else {
start_time = end_time.setMonth(new Date(end_time).getMonth() - 12)
}
break;
}
this.endDate = this.timeFormat(new Date(), this.fmt)
this.startDate = this.timeFormat(start_time, this.fmt)
this.time = this.initTimeValue(this.op1Index ? this.endDate : this.startDate);
this.initDate()
},
//
optionChange(i) {
this.op1Index = i
this.time = this.initTimeValue(i ? this.endDate : this.startDate);
this.initDate()
}
}
}
</script>
<style lang="scss" scoped>
.flex {
display: flex;
flex-direction: row;
align-items: center;
}
.row-between {
justify-content: space-between;
}
.popup-box {
background-color: #fff;
border-radius: 24rpx 24rpx 0 0;
padding-bottom: 40rpx;
height: 900rpx;
}
.picker-body {
overflow: hidden;
padding: 32rpx 40rpx;
}
.picker-view {
width: 670rpx;
}
.column-item {
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
color: #23272E;
height: 38px;
}
.column-item-text {
line-height: 38px;
height: 38px;
font-size: 32rpx;
}
.title {
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: row;
position: relative;
.close {
position: relative;
right: 50rpx;
}
.title-text {
width: 750rpx;
padding: 24rpx 0;
display: flex;
flex-direction: row;
justify-content: center;
.text {
font-size: 32rpx;
font-weight: 600;
}
}
}
.tabs-box {
width: 750rpx;
display: flex;
flex-direction: row;
padding: 0 50rpx 0 32rpx;
align-items: center;
border-bottom: 2rpx solid rgba(225, 225, 225, 0.5);
.tabs-item {
padding: 24rpx 0 22rpx 0;
margin-right: 84rpx;
border-bottom: 4rpx solid #fff;
}
.item-text {
font-size: 28rpx;
}
}
.tabs-check {
border-bottom: 4rpx solid #40AE36 !important;
.item-text {
color: #40AE36;
}
}
.bottom {
padding: 0 32rpx;
display: flex;
align-items: center;
flex-direction: row;
position: fixed;
bottom: 0;
width: 100%;
padding-bottom: calc(env(safe-area-inset-bottom) + 10rpx);
.h-btn {
flex: 1;
height: 80rpx;
background: #40AE36;
border-radius: 16rpx;
display: flex;
align-items: center;
border: 2rpx solid #40AE36;
justify-content: center;
}
.h-btn-line {
background: #fff;
border: 2rpx solid #40AE36;
margin-right: 42rpx;
}
}
.option {
padding: 14rpx 58rpx;
font-size: 28rpx;
border-radius: 16rpx;
background: #F4F7F8;
border: 3rpx solid #F4F7F8;
display: flex;
justify-content: center;
flex-direction: row;
.option-text {
font-size: 28rpx;
font-weight: 500;
color: #333333;
line-height: 40rpx;
}
}
.option-check {
background: #F5FFFF;
border-radius: 16rpx;
border: 3rpx solid #40AE36;
.option-text {
color: #40AE36;
}
}
.options-box {
padding: 32rpx;
transition-property: height;
transition-duration: .4s;
}
</style>

View File

@ -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

View File

@ -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"
}
}
}
}
}

View File

@ -0,0 +1,66 @@
## datetime-picker 日期时间选择器
> **组件名h-datetime-picker**
> 代码块: `<h-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
##示例
```
<template>
<view>
<h-datetime-picker ref="pickerDate" @reset="reset" @confirm="confirm"></h-datetime-picker>
</view>
</template>
<script>
export default {
methods: {
//打开选择器
open() {
this.$refs.pickerDate.open()
},
reset(){
console.log('点击了重置');
},
confirm(e){
console.log('点击了确定',e);
}
}
}
</script>
```