<template>
|
<uni-popup ref="date" background-color="#fff">
|
<view class="date">
|
<view class="title">
|
<text>时间</text>
|
<view class="title_icon" @click="closeDate">
|
<uni-icons color="#CCCCCB" type="closeempty" size="20"></uni-icons>
|
</view>
|
</view>
|
<view class="content">
|
<picker-view class="picker" :value="date" @change="getime" indicator-style="height:30px;">
|
<picker-view-column>
|
<view class="hours" style="line-height:30px; text-align: center;" v-for="(item,index) in hours" :key="index">{{item}}</view>
|
</picker-view-column>
|
<picker-view-column>
|
<view class="minutes" style="line-height:30px; text-align: center;" v-for="(item,index) in minutes" :key="index">{{item}}</view>
|
</picker-view-column>
|
<picker-view-column>
|
<view style="line-height:30px; text-align: center;">-</view>
|
</picker-view-column>
|
<picker-view-column>
|
<view class="hours" style="line-height:30px; text-align: center;" v-for="(item,index) in hours" :key="index">{{item}}</view>
|
</picker-view-column>
|
<picker-view-column>
|
<view class="minutes" style="line-height:30px; text-align: center;" v-for="(item,index) in minutes" :key="index">{{item}}</view>
|
</picker-view-column>
|
</picker-view>
|
</view>
|
<view class="submit" @click="updata">确定</view>
|
</view>
|
</uni-popup>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
let hours = []
|
let minutes = []
|
for (let i = 0; i <= 23; i++) {
|
hours.push(i>9?i.toString():`0${i}`)
|
}
|
for (let i = 0; i <= 59; i++) {
|
minutes.push(i>9?i.toString():`0${i}`)
|
}
|
return {
|
hours,
|
minutes,
|
date: [0, 0, 0, 23, 59],
|
visible: true,
|
value: ['00', '00', '-', '23', '59'],
|
indicatorStyle: `height: 50px;`
|
}
|
},
|
methods: {
|
open() {
|
this.$refs.date.open('bottom')
|
},
|
getime(v) {
|
const val = v.detail.value
|
this.value[0] = this.hours[val[0]]
|
this.value[1] = this.minutes[val[1]]
|
this.value[3] = this.hours[val[3]]
|
this.value[4] = this.minutes[val[4]]
|
},
|
updata() {
|
this.$emit('updata', this.value)
|
this.$refs.date.close()
|
},
|
closeDate() {
|
this.$refs.date.close()
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.date {
|
padding: 44rpx 32rpx;
|
background-color: #FFFFFF;
|
box-sizing: border-box;
|
.title {
|
width: 100%;
|
text-align: center;
|
position: relative;
|
text {
|
font-size: 32rpx;
|
font-family: PingFang SC-Semibold, PingFang SC;
|
font-weight: 600;
|
color: #333333;
|
}
|
.title_icon {
|
position: absolute;
|
right: 0;
|
top: 0;
|
}
|
}
|
.content {
|
width: 100%;
|
margin-top: 80rpx;
|
// .picker{
|
// width: 100%;
|
// height: 300rpx;
|
// }
|
.picker {
|
width: 100%;
|
height: 600rpx;
|
|
.hours{
|
font-size: 30rpx;
|
font-weight: bold;
|
color: #000;
|
}
|
.minutes{
|
font-size: 30rpx;
|
font-weight: bold;
|
color: #000;
|
}
|
.item {
|
height: 40px;
|
line-height: 40px;
|
text-align: center;
|
}
|
}
|
}
|
.submit {
|
width: 100%;
|
height: 72rpx;
|
line-height: 72rpx;
|
text-align: center;
|
background: linear-gradient(270deg, #D20A0A 0%, #D95A5A 100%);
|
border-radius: 36rpx;
|
font-size: 32rpx;
|
font-family: PingFang SC-Medium, PingFang SC;
|
font-weight: 500;
|
color: #FFFFFF;
|
margin-top: 50rpx;
|
}
|
}
|
|
|
</style>
|