新增
This commit is contained in:
parent
a0435a1417
commit
27eeed6de8
@ -2,7 +2,6 @@
|
|||||||
<view class="app">
|
<view class="app">
|
||||||
<view class="productlist">
|
<view class="productlist">
|
||||||
<view class="item" @tap='goCommodityDetails(item)' v-for="(item,index) in goodsList" :key="index">
|
<view class="item" @tap='goCommodityDetails(item)' v-for="(item,index) in goodsList" :key="index">
|
||||||
|
|
||||||
<image :src="item.goodsPictureUrl" mode=""></image>
|
<image :src="item.goodsPictureUrl" mode=""></image>
|
||||||
<view class="title">
|
<view class="title">
|
||||||
{{item.goodsName}} 1{{item.goodsUnit}}
|
{{item.goodsName}} 1{{item.goodsUnit}}
|
||||||
@ -11,7 +10,6 @@
|
|||||||
¥{{item.goodsPrice}}
|
¥{{item.goodsPrice}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -55,7 +53,6 @@
|
|||||||
console.log(this.goodsCategoryList)
|
console.log(this.goodsCategoryList)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
//跳转详情页
|
//跳转详情页
|
||||||
goCommodityDetails() {
|
goCommodityDetails() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|||||||
@ -10,12 +10,11 @@
|
|||||||
<span>电话:</span>
|
<span>电话:</span>
|
||||||
<span>{{personInfo.phone}}</span>
|
<span>{{personInfo.phone}}</span>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<span>地址:</span>
|
<span>地址:</span>
|
||||||
<span>{{personInfo.address}}</span>
|
<span>{{personInfo.address}}</span>
|
||||||
</view>
|
</view>
|
||||||
<view class="selecttime" @tap='timeshow2=true'>
|
<view class="selecttime" @tap='timeshow=true'>
|
||||||
<span>时间:</span>
|
<span>时间:</span>
|
||||||
<text v-if="usertime==''">请选择时间</text>
|
<text v-if="usertime==''">请选择时间</text>
|
||||||
<text v-else>{{usertime}}</text>
|
<text v-else>{{usertime}}</text>
|
||||||
@ -25,7 +24,6 @@
|
|||||||
<view class="remarks">
|
<view class="remarks">
|
||||||
服务时长:{{orderlist.serveDurationUnit}}
|
服务时长:{{orderlist.serveDurationUnit}}
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="Package">套餐信息:
|
<view class="Package">套餐信息:
|
||||||
<text class="money">¥{{orderlist.nurseItemPrice}}</text>
|
<text class="money">¥{{orderlist.nurseItemPrice}}</text>
|
||||||
<text class="detail">
|
<text class="detail">
|
||||||
@ -57,12 +55,13 @@
|
|||||||
<view class="queren" @tap='updata'>确认预约</view>
|
<view class="queren" @tap='updata'>确认预约</view>
|
||||||
</view>
|
</view>
|
||||||
<u-toast ref="uToast" />
|
<u-toast ref="uToast" />
|
||||||
<u-picker @confirm='confirm2()' mode="time" v-model="timeshow2" start-year='2022' :params="params2">
|
<!-- <u-picker @confirm='confirm2()' mode="time" v-model="timeshow2" start-year='2022' :params="params2">
|
||||||
</u-picker>
|
</u-picker>
|
||||||
<u-picker @confirm='confirm3()' mode="time" v-model="timeshow3" start-year='2022' :params="params3">
|
<u-picker @confirm='confirm3()' mode="time" v-model="timeshow3" start-year='2022' :params="params3">
|
||||||
</u-picker>
|
</u-picker>
|
||||||
<u-picker @confirm='confirm4()' mode="time" v-model="timeshow4" start-year='2022' :params="params4">
|
<u-picker @confirm='confirm4()' mode="time" v-model="timeshow4" start-year='2022' :params="params4">
|
||||||
</u-picker>
|
</u-picker> -->
|
||||||
|
<upicker v-model="timeshow" mode="time" start-year='2022' :params="timeparams" @confirm='timeconfirm'></upicker>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -72,17 +71,23 @@
|
|||||||
submitAppointment
|
submitAppointment
|
||||||
} from '@/api/appointmenttime/appointmenttime.js'
|
} from '@/api/appointmenttime/appointmenttime.js'
|
||||||
import baseurl from '@/api/baseurl.js'
|
import baseurl from '@/api/baseurl.js'
|
||||||
|
import upicker from '../u-picker/u-picker.vue'
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
upicker
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
params2: {
|
timeparams: {
|
||||||
year: true,
|
year: true,
|
||||||
month: true,
|
month: true,
|
||||||
day: true,
|
day: true,
|
||||||
hour: true,
|
hour: true,
|
||||||
|
endhour: true,
|
||||||
minute: true,
|
minute: true,
|
||||||
second: false
|
endminute: true,
|
||||||
},
|
},
|
||||||
|
timeshow: false,
|
||||||
timeshow2: false,
|
timeshow2: false,
|
||||||
timeshow3: false,
|
timeshow3: false,
|
||||||
timeshow4: false,
|
timeshow4: false,
|
||||||
@ -134,9 +139,13 @@
|
|||||||
this.orderlist.stationItemId = options.stationItemId
|
this.orderlist.stationItemId = options.stationItemId
|
||||||
this.orderlist.stationItemPriceId = options.stationItemPriceId
|
this.orderlist.stationItemPriceId = options.stationItemPriceId
|
||||||
//耗材包详情方法调用
|
//耗材包详情方法调用
|
||||||
this.getPatientInfo(options.stationId, options.stationItemId, options.stationItemPriceId)
|
// this.getPatientInfo(options.stationId, options.stationItemId, options.stationItemPriceId)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//获取时间
|
||||||
|
timeconfirm(e){
|
||||||
|
console.log(e)
|
||||||
|
},
|
||||||
getInfo() { //被护理人信息
|
getInfo() { //被护理人信息
|
||||||
getAppPatientList(this.patientId).then(res => {
|
getAppPatientList(this.patientId).then(res => {
|
||||||
this.personInfo = res.data[0]
|
this.personInfo = res.data[0]
|
||||||
@ -314,13 +323,13 @@
|
|||||||
height: 34rpx;
|
height: 34rpx;
|
||||||
border-radius: 70%;
|
border-radius: 70%;
|
||||||
border: 2rpx solid #178ffb;
|
border: 2rpx solid #178ffb;
|
||||||
margin: 6px 25px -10px -10px;
|
margin: 6px 25px -10px -10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.agreement {
|
.agreement {
|
||||||
font-size: 34rpx;
|
font-size: 34rpx;
|
||||||
color: #878987;
|
color: #878987;
|
||||||
margin-left: 14%;
|
margin-left: 14%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio-right {
|
.radio-right {
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="app">
|
<view class="app">
|
||||||
<view class="cards">
|
<view class="cards">
|
||||||
@ -6,28 +5,15 @@
|
|||||||
v-for="(item,index) in goodsCategoryList" :key="index">
|
v-for="(item,index) in goodsCategoryList" :key="index">
|
||||||
<!-- <image src="../../static/sp.png" mode=""></image> -->
|
<!-- <image src="../../static/sp.png" mode=""></image> -->
|
||||||
<image :src="item.goodsCatrgoryPicture" mode=""></image>
|
<image :src="item.goodsCatrgoryPicture" mode=""></image>
|
||||||
<view class="title">
|
<view class="title" style="font-size:42rpx">
|
||||||
{{item.goodsCategoryName}}
|
{{item.goodsCategoryName}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class=" item">
|
<view class="item">
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="item" style="background-color: #E1AE3C;">
|
|
||||||
<image src="../../static/znsb.png" mode=""></image>
|
|
||||||
<view class="title" style="font-size: 42rpx;">
|
|
||||||
可穿戴医疗设备
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="item" style="background: #4C7BC9;">
|
|
||||||
<image src="../../static/cp.png" mode=""></image>
|
|
||||||
<view class="title" style="font-size: 42rpx;">
|
|
||||||
适老化改造
|
|
||||||
</view>
|
|
||||||
</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
goodsCategoryList
|
goodsCategoryList
|
||||||
@ -40,27 +26,18 @@
|
|||||||
pageSize: 999,
|
pageSize: 999,
|
||||||
goodsCategoryList: [],
|
goodsCategoryList: [],
|
||||||
listcolor: ['#00C176', '#D43953', '#E1AE3C', '#4C7BC9', '#00C176'],
|
listcolor: ['#00C176', '#D43953', '#E1AE3C', '#4C7BC9', '#00C176'],
|
||||||
// img: '',
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.goodsCategory()
|
this.goodsCategory()
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//跳转到商品列表页面
|
//跳转到商品列表页面
|
||||||
goProductList(item) {
|
goProductList(item) {
|
||||||
console.log(item)
|
console.log(item)
|
||||||
// if (number == 1) {
|
|
||||||
// var titlename = '特医食品'
|
|
||||||
// uni.navigateTo({
|
|
||||||
// url: `/pages/ProductList/ProductList?title=${titlename}&goodsCategoryId=${this.id}`
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/ProductList/ProductList?title=${item.goodsCategoryName}&goodsCategoryId=${item.id}`
|
url: `/pages/ProductList/ProductList?title=${item.goodsCategoryName}&goodsCategoryId=${item.id}`
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
//获取商城信息
|
//获取商城信息
|
||||||
goodsCategory() {
|
goodsCategory() {
|
||||||
@ -76,12 +53,4 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.app {
|
|
||||||
// background-color: #F4F5F7;
|
|
||||||
// width: 100%;
|
|
||||||
// height: 100vh;
|
|
||||||
// position: relative;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,36 +1,31 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="concent">
|
<view class="app">
|
||||||
<view class="page-body" style="margin-top: -80rpx;">
|
<view>
|
||||||
<view class="nursetation" @tap='detailed()'>
|
<view class="nursetation" @tap='detailed()'>
|
||||||
<text class="what">什么是护理站?</text>
|
<text class="what">什么是护理站?</text>
|
||||||
<u-icon class="icon" name="arrow-right"></u-icon>
|
<u-icon class="icon" name="arrow-right"></u-icon>
|
||||||
<!-- <image src="../../static/jiantou.png" mode=""></image> -->
|
|
||||||
</view>
|
</view>
|
||||||
<view class="map">
|
<view class="map">
|
||||||
<!-- <map style="width:100%; height:40vh;" scale="17" :latitude="latitude" :longitude="longitude"
|
<map style="width:100%; height:40vh;" scale="17" :latitude="latitude" :longitude="longitude"
|
||||||
:markers="markers"></map> -->
|
:markers="markers"></map>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="conNew">
|
<view class="conNew">
|
||||||
<view class="addressContent">
|
<view class="addressContent">
|
||||||
<view class="lists" v-for="(item,index) in nearbylist" :key="index">
|
<view class="lists" v-for="(item,index) in nearbylist" :key="index">
|
||||||
<text class="nurse">{{item.nurseStationName}}</text>
|
<view class="nurse">{{item.nurseStationName}}</view>
|
||||||
<text class="distance">距离您800米</text>
|
<view class="distance">距离您800米</view>
|
||||||
<view class="background">
|
<view class="background">
|
||||||
<view class="picture">
|
<image src="/static/logo.png" mode=""></image>
|
||||||
<image src="/static/logo.png" mode=""></image>
|
|
||||||
</view>
|
|
||||||
<text class="qyttext">泉医通</text>
|
|
||||||
<text class="lianmeng">济卫护理联盟NO.1</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="click" @tap='godetails()'>
|
<view class="understand" @tap='godetails()'>
|
||||||
点击了解
|
点击了解
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="masks" style="" v-if="mask">
|
<view class="masks" style="" v-if="locationmask">
|
||||||
<view class="mask">
|
<view class="mask">
|
||||||
<view class="picture2">
|
<view class="picture2">
|
||||||
<image src="../../static/locatinsmall.png"></image>
|
<image src="../../static/locatinsmall.png"></image>
|
||||||
@ -56,11 +51,15 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
nearbylist: [],
|
nearbylist: [],
|
||||||
mask: true,
|
locationmask: false,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
longitude:116.397128,
|
//map地图所需
|
||||||
latitude:39.916527,
|
id: 0, // 使用 marker点击事件 需要填写id
|
||||||
|
latitude: 39.909,
|
||||||
|
longitude: 116.39742,
|
||||||
|
markers: [],
|
||||||
|
covers: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
@ -112,9 +111,8 @@
|
|||||||
} else {
|
} else {
|
||||||
uni.request({
|
uni.request({
|
||||||
url: baseurl +
|
url: baseurl +
|
||||||
`/nurseApplet/nearbyNursingStation/nearbyList`, //仅为示例,并非真实接口地址。
|
`/nurseApplet/nearbyNursingStation/nearbyList`,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log(res)
|
|
||||||
this.nearbylist = res.data.rows
|
this.nearbylist = res.data.rows
|
||||||
console.log(this.nearbylist)
|
console.log(this.nearbylist)
|
||||||
}
|
}
|
||||||
@ -122,7 +120,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
godetails() {
|
godetails() {
|
||||||
// console.log("111");
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/nursestation/nursestation`
|
url: `/pages/nursestation/nursestation`
|
||||||
})
|
})
|
||||||
@ -132,312 +129,109 @@
|
|||||||
url: `/pages/detail/detail`
|
url: `/pages/detail/detail`
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// nurse() {
|
|
||||||
// uni.navigateTo({
|
|
||||||
// url: `/pages/nursestation/nursestation`
|
|
||||||
// })
|
|
||||||
// },
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.mask = false
|
this.mask = false
|
||||||
// uni.reLaunch({
|
|
||||||
// url: `/pages/site/site`
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.concent {
|
//护理站列表
|
||||||
width: 100%;
|
|
||||||
height: 1000px;
|
|
||||||
background-color: #F4F5F7;
|
|
||||||
// box-sizing: border-box;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.conNew {
|
.conNew {
|
||||||
width: 100%;
|
width: 96%;
|
||||||
height: 1000000px;
|
|
||||||
background-color: #F4F5F7;
|
background-color: #F4F5F7;
|
||||||
// box-sizing: border-box;
|
|
||||||
position: relative;
|
|
||||||
// box-sizing: border-box;
|
|
||||||
// padding: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.addressContent {
|
|
||||||
position: absolute;
|
|
||||||
top: -91px;
|
|
||||||
// margin: 0 auto;
|
|
||||||
width: 100%;
|
|
||||||
// height: 100%;
|
|
||||||
// background: #F4F5F7;
|
|
||||||
// box-sizing: border-box;
|
|
||||||
padding: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.map {
|
|
||||||
width: 750rpx;
|
|
||||||
height: 544rpx;
|
|
||||||
background-color: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
.picture2 image {
|
|
||||||
// position: absolute;
|
|
||||||
display: block;
|
|
||||||
margin: 0 auto;
|
|
||||||
width: 86rpx;
|
|
||||||
height: 102rpx;
|
|
||||||
// margin-top: 20%;
|
|
||||||
// text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.masks {
|
|
||||||
|
|
||||||
border-radius: 30px;
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
position: absolute;
|
|
||||||
opacity: 0.9;
|
|
||||||
top: 0;
|
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
}
|
|
||||||
|
|
||||||
.mask {
|
|
||||||
// margin-top: 50%;
|
|
||||||
position: relative;
|
|
||||||
width: 520rpx;
|
|
||||||
height: 348rpx;
|
|
||||||
background-color: #ffffff;
|
|
||||||
margin: 47% auto;
|
|
||||||
position: relative;
|
|
||||||
border-radius: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
width: 254rpx;
|
|
||||||
height: 35rpx;
|
|
||||||
font-size: 37rpx;
|
|
||||||
// margin: 0 auto;
|
|
||||||
text-align: center;
|
|
||||||
margin-top: 10%;
|
|
||||||
margin-left: 30%;
|
|
||||||
font-family: Adobe Heiti Std;
|
|
||||||
font-weight: normal;
|
|
||||||
color: #000000;
|
|
||||||
// line-height: rpx;
|
|
||||||
// height: 100rpx;
|
|
||||||
// line-height: 100rpx;
|
|
||||||
// border-bottom: 1px solid #eeeeee;
|
|
||||||
// /* background-color: red; */
|
|
||||||
// font-size: 36rpx;
|
|
||||||
// margin: 0px auto;
|
|
||||||
// width: 100%;
|
|
||||||
// text-align: center;
|
|
||||||
// /* line-height: 80rpx; */
|
|
||||||
}
|
|
||||||
|
|
||||||
.text {
|
|
||||||
margin-top: 30rpx;
|
|
||||||
font-size: 30rpx;
|
|
||||||
width: 100%;
|
|
||||||
text-align: left;
|
|
||||||
/* padding-top: 40rpx; */
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn1 {
|
|
||||||
|
|
||||||
height: 62rpx;
|
|
||||||
line-height: 62rpx;
|
|
||||||
text-align: center;
|
|
||||||
// border-top: 1px solid #eeeeee;
|
|
||||||
// border-right: 1px solid #eeeeee;
|
|
||||||
// position: inherit;
|
|
||||||
|
|
||||||
margin-top: 10%;
|
|
||||||
margin-left: 10%;
|
|
||||||
background: #C5BFBF;
|
|
||||||
color: #ffffff;
|
|
||||||
width: 198rpx;
|
|
||||||
border-radius: 23rpx;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn2 {
|
|
||||||
height: 62rpx;
|
|
||||||
line-height: 62rpx;
|
|
||||||
text-align: center;
|
|
||||||
color: #ffffff;
|
|
||||||
// display: inline-block;
|
|
||||||
// position: absolute;
|
|
||||||
// bottom: 0;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin-top: -12%;
|
top: 400rpx;
|
||||||
margin-left: 58%;
|
left: 2%;
|
||||||
width: 198rpx;
|
|
||||||
background-color: #4486e8;
|
.addressContent {
|
||||||
border-radius: 23rpx;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lists {
|
.lists {
|
||||||
// bottom: 5%;
|
background-color: #ffffff;
|
||||||
// display: block;
|
width: 100%;
|
||||||
// position: absolute;
|
height: 240rpx;
|
||||||
// top: -191px;
|
margin-bottom: 14rpx;
|
||||||
// margin: 0 auto;
|
border-radius: 20rpx;
|
||||||
background-color: #ffffff;
|
position: relative;
|
||||||
// width: 698.8rpx;
|
|
||||||
width: 100%;
|
.nurse {
|
||||||
height: 227.8rpx;
|
font-size: 30rpx;
|
||||||
margin-bottom: 3%;
|
position: absolute;
|
||||||
border-radius: 20rpx;
|
top: 15%;
|
||||||
z-index: 99999;
|
left: 35%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.background {
|
.distance {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 180rpx;
|
top: 40%;
|
||||||
height: 180rpx;
|
font-size: 14rpx;
|
||||||
background-color: #4C7BC9;
|
margin-left: 35%;
|
||||||
margin-top: 4%;
|
color: #666666;
|
||||||
margin-left: 7%;
|
}
|
||||||
border-radius: 30rpx;
|
|
||||||
}
|
.background {
|
||||||
|
width: 180rpx;
|
||||||
.background image {
|
height: 180rpx;
|
||||||
|
background-color: #4C7BC9;
|
||||||
width: 99rpx;
|
position: absolute;
|
||||||
height: 99rpx;
|
top: 12%;
|
||||||
// margin: 0 auto;
|
left: 7%;
|
||||||
text-align: center;
|
border-radius: 30rpx;
|
||||||
margin-top: 5%;
|
}
|
||||||
margin-left: 20%;
|
|
||||||
|
.background image {
|
||||||
}
|
width: 99rpx;
|
||||||
|
height: 99rpx;
|
||||||
.qyttext {
|
// margin: 0 auto;
|
||||||
// text-align: center;
|
text-align: center;
|
||||||
// margin-top: 10%;
|
margin-top: 5%;
|
||||||
margin-left: 28%;
|
margin-left: 20%;
|
||||||
display: block;
|
}
|
||||||
|
|
||||||
// width: 30px;
|
.understand {
|
||||||
// height: 10px;
|
color: #ffffff;
|
||||||
font-size: 25rpx;
|
width: 170rpx;
|
||||||
// font-family: Adobe Heiti Std;
|
height: 70rpx;
|
||||||
// font-weight: normal;
|
line-height: 70rpx;
|
||||||
color: #FFFFFF;
|
text-align: center;
|
||||||
|
background-color: #4C7BC9;
|
||||||
}
|
position: absolute;
|
||||||
|
bottom: 10%;
|
||||||
.lianmeng {
|
right: 5%;
|
||||||
display: block;
|
border-radius: 35rpx;
|
||||||
margin-left: 5%;
|
}
|
||||||
font-size: 14rpx;
|
}
|
||||||
// font-family: Adobe Heiti Std;
|
|
||||||
// font-weight: normal;
|
|
||||||
color: #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.click {
|
|
||||||
// position: absolute;
|
|
||||||
color: #ffffff;
|
|
||||||
float: right;
|
|
||||||
width: 167.3rpx;
|
|
||||||
height: 34px;
|
|
||||||
line-height: 34px;
|
|
||||||
// height: 58.5rpx;
|
|
||||||
// line-height: 58.5rpx;
|
|
||||||
// margin: 0 auto;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #4C7BC9;
|
|
||||||
margin-top: 20%;
|
|
||||||
margin-right: 5%;
|
|
||||||
border-radius: 17px;
|
|
||||||
// margin-top: 6%;
|
|
||||||
// margin-left: 40%;
|
|
||||||
// border-radius: 10rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wenzi {
|
|
||||||
color: #ffffff;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nurse {
|
|
||||||
position: absolute;
|
|
||||||
float: right;
|
|
||||||
margin-top: 5%;
|
|
||||||
font-size: 30rpx;
|
|
||||||
margin-left: 35%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
height: 60rpx;
|
|
||||||
width: 80%;
|
|
||||||
line-height: 60rpx;
|
|
||||||
position: absolute;
|
|
||||||
// float: right;
|
|
||||||
margin-left: 85%;
|
|
||||||
margin-top: -9%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.distance {
|
|
||||||
position: absolute;
|
|
||||||
float: right;
|
|
||||||
margin-top: 12%;
|
|
||||||
font-size: 14rpx;
|
|
||||||
margin-left: 35%;
|
|
||||||
font-family: Adobe Heiti Std;
|
|
||||||
font-weight: normal;
|
|
||||||
color: #666666;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.nursestation image {
|
|
||||||
position: relative;
|
|
||||||
width: 16rpx;
|
|
||||||
height: 24rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//什么是护理站
|
||||||
.nursetation {
|
.nursetation {
|
||||||
position: relative;
|
|
||||||
// display: block;
|
|
||||||
// margin:0 auto;
|
|
||||||
top: 50px;
|
|
||||||
left: 0px;
|
|
||||||
float: left;
|
|
||||||
// background-color: white;
|
|
||||||
border: 1px solid #f0f0f0;
|
|
||||||
width: 80%;
|
width: 80%;
|
||||||
height: 60rpx;
|
|
||||||
margin: 10rpx 0 10rpx 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
border-radius: 20rpx;
|
|
||||||
background-color: red;
|
|
||||||
z-index: 100;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.what {
|
|
||||||
display: block;
|
|
||||||
// margin: 0 auto;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 50rpx;
|
top: 20px;
|
||||||
top: 5%;
|
left: 10%;
|
||||||
left: 12%;
|
float: left;
|
||||||
// background-color: #4486e8;
|
border: 1px solid #f0f0f0;
|
||||||
position: relative;
|
border-radius: 20rpx;
|
||||||
height: 60rpx;
|
background-color: #ffffff;
|
||||||
width: 80%;
|
z-index: 100;
|
||||||
line-height: 60rpx;
|
height: 85rpx;
|
||||||
margin-left: 5%;
|
line-height: 85rpx;
|
||||||
|
box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
|
||||||
|
|
||||||
|
.what {
|
||||||
|
margin-left: 10%;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
display: inline-block;
|
||||||
|
height: 85rpx;
|
||||||
|
line-height: 85rpx;
|
||||||
|
margin-left: 45%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
7
pages/u-picker/style.components.scss
Normal file
7
pages/u-picker/style.components.scss
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// 定义混入指令,用于在非nvue环境下的flex定义,因为nvue没有display属性,会报错
|
||||||
|
@mixin vue-flex($direction: row) {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
flex-direction: $direction;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
563
pages/u-picker/u-picker.vue
Normal file
563
pages/u-picker/u-picker.vue
Normal file
@ -0,0 +1,563 @@
|
|||||||
|
<template>
|
||||||
|
<u-popup :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="value" length="auto"
|
||||||
|
:safeAreaInsetBottom="safeAreaInsetBottom" @close="close" :z-index="uZIndex">
|
||||||
|
<view class="u-datetime-picker">
|
||||||
|
<view class="u-picker-header" @touchmove.stop.prevent="">
|
||||||
|
<view class="u-btn-picker u-btn-picker--tips" :style="{ color: cancelColor }" hover-class="u-opacity"
|
||||||
|
:hover-stay-time="150" @tap="getResult('cancel')">{{cancelText}}</view>
|
||||||
|
<view class="u-picker__title">{{ title }}</view>
|
||||||
|
<view class="u-btn-picker u-btn-picker--primary" :style="{ color: moving ? cancelColor : confirmColor }"
|
||||||
|
hover-class="u-opacity" :hover-stay-time="150" @touchmove.stop="" @tap.stop="getResult('confirm')">
|
||||||
|
{{confirmText}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-picker-body">
|
||||||
|
<picker-view :value="valueArr" @change="change" class="u-picker-view" @pickstart="pickstart"
|
||||||
|
@pickend="pickend">
|
||||||
|
<picker-view-column v-if="!reset && params.year" style="flex:6">
|
||||||
|
<view class="u-column-item" v-for="(item, index) in years" :key="index">
|
||||||
|
{{ item }}
|
||||||
|
<text class="u-text" v-if="showTimeTag">年</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column v-if="!reset && params.month" style="flex:5">
|
||||||
|
<view class="u-column-item" v-for="(item, index) in months" :key="index">
|
||||||
|
{{ formatNumber(item) }}
|
||||||
|
<text class="u-text" v-if="showTimeTag">月</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column v-if="!reset && params.day" style="flex:5">
|
||||||
|
<view class="u-column-item" v-for="(item, index) in days" :key="index">
|
||||||
|
{{ formatNumber(item) }}
|
||||||
|
<text class="u-text" v-if="showTimeTag">日</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column v-if="!reset && params.hour" style="flex:6">
|
||||||
|
<view class="u-column-item" v-for="(item, index) in hours" :key="index">
|
||||||
|
<view class="" style="font-size:38rpx">
|
||||||
|
{{ formatNumber(item) }}
|
||||||
|
</view>
|
||||||
|
<text class="u-text" v-if="showTimeTag">时</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column v-if="!reset && params.minute" style="flex:6">
|
||||||
|
<view class="u-column-item" v-for="(item, index) in minutes" :key="index">
|
||||||
|
<view class="" style="font-size:38rpx">
|
||||||
|
{{ formatNumber(item) }}
|
||||||
|
</view>
|
||||||
|
<text class="u-text" v-if="showTimeTag">分</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column style="flex:2">
|
||||||
|
<view class="u-column-item">
|
||||||
|
<text class="u-text">至</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column v-if="!reset && params.endhour" style="flex:6">
|
||||||
|
<view class="u-column-item" v-for="(item, index) in endhours" :key="index">
|
||||||
|
<view class="" style="font-size:38rpx">
|
||||||
|
{{ formatNumber(item) }}
|
||||||
|
</view>
|
||||||
|
<text class="u-text" v-if="showTimeTag">时</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column v-if="!reset && params.endminute" style="flex:6">
|
||||||
|
<view class="u-column-item" v-for="(item, index) in endminutes" :key="index">
|
||||||
|
<view class="" style="font-size:38rpx">
|
||||||
|
{{ formatNumber(item) }}
|
||||||
|
</view>
|
||||||
|
<text class="u-text" v-if="showTimeTag">分</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
</picker-view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* picker picker弹出选择器
|
||||||
|
* @description 此选择器有两种弹出模式:一是时间模式,可以配置年,日,月,时,分,秒参数 二是地区模式,可以配置省,市,区参数
|
||||||
|
* @tutorial https://www.uviewui.com/components/picker.html
|
||||||
|
* @property {Object} params 需要显示的参数,见官网说明
|
||||||
|
* @property {String} mode 模式选择,region-地区类型,time-时间类型(默认time)
|
||||||
|
* @property {String Number} start-year 可选的开始年份,mode=time时有效(默认1950)
|
||||||
|
* @property {String Number} end-year 可选的结束年份,mode=time时有效(默认2050)
|
||||||
|
* @property {Boolean} safe-area-inset-bottom 是否开启底部安全区适配(默认false)
|
||||||
|
* @property {Boolean} show-time-tag 时间模式时,是否显示后面的年月日中文提示
|
||||||
|
* @property {String} cancel-color 取消按钮的颜色(默认#606266)
|
||||||
|
* @property {String} confirm-color 确认按钮的颜色(默认#2979ff)
|
||||||
|
* @property {String} default-time 默认选中的时间,mode=time时有效
|
||||||
|
* @property {String} confirm-text 确认按钮的文字
|
||||||
|
* @property {String} cancel-text 取消按钮的文字
|
||||||
|
* @property {String} default-region 默认选中的地区,中文形式,mode=region时有效
|
||||||
|
* @property {String} default-code 默认选中的地区,编号形式,mode=region时有效
|
||||||
|
* @property {Boolean} mask-close-able 是否允许通过点击遮罩关闭Picker(默认true)
|
||||||
|
* @property {String Number} z-index 弹出时的z-index值(默认1075)
|
||||||
|
* @property {Array} default-selector 数组形式,其中每一项表示选择了range对应项中的第几个
|
||||||
|
* @property {Array} range 自定义选择的数据,mode=selector或mode=multiSelector时有效
|
||||||
|
* @property {String} range-key 当range参数的元素为对象时,指定Object中的哪个key的值作为选择器显示内容
|
||||||
|
* @event {Function} confirm 点击确定按钮,返回当前选择的值
|
||||||
|
* @event {Function} cancel 点击取消按钮,返回当前选择的值
|
||||||
|
* @example <u-picker v-model="show" mode="time"></u-picker>
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
name: 'u-picker',
|
||||||
|
props: {
|
||||||
|
// picker中需要显示的参数
|
||||||
|
params: {
|
||||||
|
type: Object,
|
||||||
|
default () {
|
||||||
|
return {
|
||||||
|
year: false,
|
||||||
|
month: true,
|
||||||
|
day: true,
|
||||||
|
hour: true,
|
||||||
|
endhour: true,
|
||||||
|
minute: true,
|
||||||
|
endminute: true,
|
||||||
|
second: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 当mode=selector或者mode=multiSelector时,提供的数组
|
||||||
|
range: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 当mode=selector或者mode=multiSelector时,提供的默认选中的下标
|
||||||
|
defaultSelector: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return [0];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 当 range 是一个 Array<Object> 时,通过 range-key 来指定 Object 中 key 的值作为选择器显示内容
|
||||||
|
rangeKey: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
// 模式选择,region-地区类型,time-时间类型,selector-单列模式,multiSelector-多列模式
|
||||||
|
mode: {
|
||||||
|
type: String,
|
||||||
|
default: 'time'
|
||||||
|
},
|
||||||
|
// 年份开始时间
|
||||||
|
startYear: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: 1950
|
||||||
|
},
|
||||||
|
// 年份结束时间
|
||||||
|
endYear: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: 2050
|
||||||
|
},
|
||||||
|
// "取消"按钮的颜色
|
||||||
|
cancelColor: {
|
||||||
|
type: String,
|
||||||
|
default: '#606266'
|
||||||
|
},
|
||||||
|
// "确定"按钮的颜色
|
||||||
|
confirmColor: {
|
||||||
|
type: String,
|
||||||
|
default: '#2979ff'
|
||||||
|
},
|
||||||
|
// 默认显示的时间,2025-07-02 || 2025-07-02 13:01:00 || 2025/07/02
|
||||||
|
defaultTime: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
// 时间模式时,是否显示后面的年月日中文提示
|
||||||
|
showTimeTag: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
safeAreaInsetBottom: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 是否允许通过点击遮罩关闭Picker
|
||||||
|
maskCloseAble: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
// 通过双向绑定控制组件的弹出与收起
|
||||||
|
value: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 弹出的z-index值
|
||||||
|
zIndex: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
// 顶部标题
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '预约时间'
|
||||||
|
},
|
||||||
|
// 取消按钮的文字
|
||||||
|
cancelText: {
|
||||||
|
type: String,
|
||||||
|
default: '取消'
|
||||||
|
},
|
||||||
|
// 确认按钮的文字
|
||||||
|
confirmText: {
|
||||||
|
type: String,
|
||||||
|
default: '确认'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
years: [],
|
||||||
|
months: [],
|
||||||
|
days: [],
|
||||||
|
hours: [],
|
||||||
|
endhours: [],
|
||||||
|
minutes: [],
|
||||||
|
endminutes: [],
|
||||||
|
seconds: [],
|
||||||
|
year: 0,
|
||||||
|
month: 0,
|
||||||
|
day: 0,
|
||||||
|
hour: 0,
|
||||||
|
endhour: 0,
|
||||||
|
minute: 0,
|
||||||
|
endminute: 0,
|
||||||
|
second: 0,
|
||||||
|
reset: false,
|
||||||
|
startDate: '',
|
||||||
|
endDate: '',
|
||||||
|
valueArr: [],
|
||||||
|
moving: false // 列是否还在滑动中,微信小程序如果在滑动中就点确定,结果可能不准确
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
propsChange() {
|
||||||
|
// 引用这几个变量,是为了监听其变化
|
||||||
|
return `${this.mode}-${this.defaultTime}-${this.startYear}-${this.endYear}-${this.defaultRegion}-${this.areaCode}`;
|
||||||
|
},
|
||||||
|
regionChange() {
|
||||||
|
// 引用这几个变量,是为了监听其变化
|
||||||
|
return `${this.province}-${this.city}`;
|
||||||
|
},
|
||||||
|
yearAndMonth() {
|
||||||
|
return `${this.year}-${this.month}`;
|
||||||
|
},
|
||||||
|
uZIndex() {
|
||||||
|
// 如果用户有传递z-index值,优先使用
|
||||||
|
return this.zIndex ? this.zIndex : this.$u.zIndex.popup;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
propsChange() {
|
||||||
|
this.reset = true;
|
||||||
|
setTimeout(() => this.init(), 10);
|
||||||
|
},
|
||||||
|
// 如果地区发生变化,为了让picker联动起来,必须重置this.citys和this.areas
|
||||||
|
regionChange(val) {
|
||||||
|
this.citys = citys[this.province];
|
||||||
|
this.areas = areas[this.province][this.city];
|
||||||
|
},
|
||||||
|
// watch监听月份的变化,实时变更日的天数,因为不同月份,天数不一样
|
||||||
|
// 一个月可能有30,31天,甚至闰年2月的29天,平年2月28天
|
||||||
|
yearAndMonth(val) {
|
||||||
|
if (this.params.year) this.setDays();
|
||||||
|
},
|
||||||
|
// 微信和QQ小程序由于一些奇怪的原因(故同时对所有平台均初始化一遍),需要重新初始化才能显示正确的值
|
||||||
|
value(n) {
|
||||||
|
if (n) {
|
||||||
|
this.reset = true;
|
||||||
|
setTimeout(() => this.init(), 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 标识滑动开始,只有微信小程序才有这样的事件
|
||||||
|
pickstart() {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
this.moving = true;
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
// 标识滑动结束
|
||||||
|
pickend() {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
this.moving = false;
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
// 对单列和多列形式的判断是否有传入变量的情况
|
||||||
|
getItemValue(item, mode) {
|
||||||
|
// 目前(2020-05-25)uni-app对微信小程序编译有错误,导致v-if为false中的内容也执行,错误导致
|
||||||
|
// 单列模式或者多列模式中的getItemValue同时被执行,故在这里再加一层判断
|
||||||
|
if (this.mode == mode) {
|
||||||
|
return typeof item == 'object' ? item[this.rangeKey] : item;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 小于10前面补0,用于月份,日期,时分秒等
|
||||||
|
formatNumber(num) {
|
||||||
|
return +num < 10 ? '0' + num : String(num);
|
||||||
|
},
|
||||||
|
// 生成递进的数组
|
||||||
|
generateArray: function(start, end) {
|
||||||
|
// 转为数值格式,否则用户给end-year等传递字符串值时,下面的end+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() {
|
||||||
|
// 格式化时间,在IE浏览器(uni不存在此情况),无法识别日期间的"-"间隔符号
|
||||||
|
let fdate = this.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();
|
||||||
|
// 获取年日月时分秒
|
||||||
|
this.year = time.getFullYear();
|
||||||
|
this.month = Number(time.getMonth()) + 1;
|
||||||
|
this.day = time.getDate();
|
||||||
|
this.hour = time.getHours();
|
||||||
|
this.minute = time.getMinutes();
|
||||||
|
this.endhour = time.getHours();
|
||||||
|
this.endminute = time.getMinutes();
|
||||||
|
// this.second = time.getSeconds();
|
||||||
|
},
|
||||||
|
init() {
|
||||||
|
this.valueArr = [];
|
||||||
|
this.reset = false;
|
||||||
|
if (this.mode == 'time') {
|
||||||
|
this.initTimeValue();
|
||||||
|
if (this.params.year) {
|
||||||
|
this.valueArr.push(0);
|
||||||
|
this.setYears();
|
||||||
|
}
|
||||||
|
if (this.params.month) {
|
||||||
|
this.valueArr.push(0);
|
||||||
|
this.setMonths();
|
||||||
|
}
|
||||||
|
if (this.params.day) {
|
||||||
|
this.valueArr.push(0);
|
||||||
|
this.setDays();
|
||||||
|
}
|
||||||
|
if (this.params.hour) {
|
||||||
|
this.valueArr.push(0);
|
||||||
|
this.setHours();
|
||||||
|
}
|
||||||
|
if (this.params.minute) {
|
||||||
|
this.valueArr.push(0);
|
||||||
|
this.setMinutes();
|
||||||
|
}
|
||||||
|
if (this.params.endhour) {
|
||||||
|
this.valueArr.push(0);
|
||||||
|
this.setendHours();
|
||||||
|
}
|
||||||
|
if (this.params.endminute) {
|
||||||
|
this.valueArr.push(0);
|
||||||
|
this.setendMinutes();
|
||||||
|
}
|
||||||
|
// if (this.params.second) {
|
||||||
|
// this.valueArr.push(0);
|
||||||
|
// this.setSeconds();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
this.$forceUpdate();
|
||||||
|
},
|
||||||
|
// 设置picker的某一列值
|
||||||
|
setYears() {
|
||||||
|
// 获取年份集合
|
||||||
|
this.years = this.generateArray(this.startYear, this.endYear);
|
||||||
|
// 设置this.valueArr某一项的值,是为了让picker预选中某一个值
|
||||||
|
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.years, this.year));
|
||||||
|
},
|
||||||
|
setMonths() {
|
||||||
|
this.months = this.generateArray(1, 12);
|
||||||
|
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.months, this.month));
|
||||||
|
},
|
||||||
|
setDays() {
|
||||||
|
let totalDays = new Date(this.year, this.month, 0).getDate();
|
||||||
|
this.days = this.generateArray(1, totalDays);
|
||||||
|
let index = 0;
|
||||||
|
// 这里不能使用类似setMonths()中的this.valueArr.splice(this.valueArr.length - 1, xxx)做法
|
||||||
|
// 因为this.month和this.year变化时,会触发watch中的this.setDays(),导致this.valueArr.length计算有误
|
||||||
|
if (this.params.year && this.params.month) index = 2;
|
||||||
|
else if (this.params.month) index = 1;
|
||||||
|
else if (this.params.year) index = 1;
|
||||||
|
else index = 0;
|
||||||
|
// 当月份变化时,会导致日期的天数也会变化,如果原来选的天数大于变化后的天数,则重置为变化后的最大值
|
||||||
|
// 比如原来选中3月31日,调整为2月后,日期变为最大29,这时如果day值继续为31显然不合理,于是将其置为29(picker-column从1开始)
|
||||||
|
if (this.day > this.days.length) this.day = this.days.length;
|
||||||
|
this.valueArr.splice(index, 1, this.getIndex(this.days, this.day));
|
||||||
|
},
|
||||||
|
setHours() {
|
||||||
|
this.hours = this.generateArray(0, 23);
|
||||||
|
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.hours, this.hour));
|
||||||
|
},
|
||||||
|
setMinutes() {
|
||||||
|
this.minutes = this.generateArray(0, 59);
|
||||||
|
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.minutes, this.minute));
|
||||||
|
},
|
||||||
|
setendHours() {
|
||||||
|
this.endhours = this.generateArray(0, 23);
|
||||||
|
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.endhours, this.endhour));
|
||||||
|
},
|
||||||
|
setendMinutes() {
|
||||||
|
this.endminutes = this.generateArray(0, 59);
|
||||||
|
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.endminutes, this.endminute));
|
||||||
|
},
|
||||||
|
// setSeconds() {
|
||||||
|
// this.seconds = this.generateArray(0, 59);
|
||||||
|
// this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.seconds, this.second));
|
||||||
|
// },
|
||||||
|
close() {
|
||||||
|
this.$emit('input', false);
|
||||||
|
},
|
||||||
|
// 用户更改picker的列选项
|
||||||
|
change(e) {
|
||||||
|
this.valueArr = e.detail.value;
|
||||||
|
console.log(this.valueArr)
|
||||||
|
let i = 0;
|
||||||
|
if (this.mode == 'time') {
|
||||||
|
// 这里使用i++,是因为this.valueArr数组的长度是不确定长度的,它根据this.params的值来配置长度
|
||||||
|
// 进入if规则,i会加1,保证了能获取准确的值
|
||||||
|
if (this.params.year) this.year = this.years[this.valueArr[i++]];
|
||||||
|
if (this.params.month) this.month = this.months[this.valueArr[i++]];
|
||||||
|
if (this.params.day) this.day = this.days[this.valueArr[i++]];
|
||||||
|
if (this.params.hour) this.hour = this.hours[this.valueArr[i++]];
|
||||||
|
if (this.params.minute) this.minute = this.minutes[this.valueArr[i++]];
|
||||||
|
if (this.params.endhour) this.endhour = this.hours[this.valueArr[6]]
|
||||||
|
if (this.params.endminute) this.endminute = this.endminutes[this.valueArr[7]];
|
||||||
|
// if (this.params.second) this.second = this.seconds[this.valueArr[i++]];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 用户点击确定按钮
|
||||||
|
getResult(event = null) {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
if (this.moving) return;
|
||||||
|
// #endif
|
||||||
|
let result = {};
|
||||||
|
// 只返回用户在this.params中配置了为true的字段
|
||||||
|
if (this.mode == 'time') {
|
||||||
|
if (this.params.year) result.year = this.formatNumber(this.year || 0);
|
||||||
|
if (this.params.month) result.month = this.formatNumber(this.month || 0);
|
||||||
|
if (this.params.day) result.day = this.formatNumber(this.day || 0);
|
||||||
|
if (this.params.hour) result.hour = this.formatNumber(this.hour || 0);
|
||||||
|
if (this.params.minute) result.minute = this.formatNumber(this.minute || 0);
|
||||||
|
if (this.params.endhour) result.endhour = this.formatNumber(this.endhour || 0);
|
||||||
|
if (this.params.endminute) result.endminute = this.formatNumber(this.endminute || 0);
|
||||||
|
// if (this.params.second) result.second = this.formatNumber(this.second || 0);
|
||||||
|
// if (this.params.timestamp) result.timestamp = this.getTimestamp();
|
||||||
|
}
|
||||||
|
if (event) this.$emit(event, result);
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
// 获取时间戳
|
||||||
|
getTimestamp() {
|
||||||
|
// yyyy-mm-dd为安卓写法,不支持iOS,需要使用"/"分隔,才能二者兼容
|
||||||
|
let time = this.year + '/' + this.month + '/' + this.day + ' ' + this.hour + ':' + this.minute + ':' + this
|
||||||
|
.second;
|
||||||
|
return new Date(time).getTime() / 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
// 定义混入指令,用于在非nvue环境下的flex定义,因为nvue没有display属性,会报错
|
||||||
|
@mixin vue-flex($direction: row) {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
flex-direction: $direction;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-datetime-picker {
|
||||||
|
position: relative;
|
||||||
|
z-index: 999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-picker-view {
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-picker-header {
|
||||||
|
width: 100%;
|
||||||
|
height: 90rpx;
|
||||||
|
padding: 0 40rpx;
|
||||||
|
@include vue-flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 30rpx;
|
||||||
|
background: #fff;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-picker-header::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
border-bottom: 1rpx solid #eaeef1;
|
||||||
|
-webkit-transform: scaleY(0.5);
|
||||||
|
transform: scaleY(0.5);
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-picker__title {
|
||||||
|
color: $u-content-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-picker-body {
|
||||||
|
width: 100%;
|
||||||
|
height: 500rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-column-item {
|
||||||
|
@include vue-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: $u-main-color;
|
||||||
|
padding: 0 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
padding-left: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-btn-picker {
|
||||||
|
padding: 16rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-opacity {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-btn-picker--primary {
|
||||||
|
color: $u-type-primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-btn-picker--tips {
|
||||||
|
color: $u-tips-color;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user