This commit is contained in:
曹辉 2023-05-22 09:47:19 +08:00
parent f8a8893dde
commit a09141faa8
9 changed files with 745 additions and 34 deletions

View File

@ -122,7 +122,7 @@
</view> </view>
</view> </view>
<view class="service" @tap="gonursestation"> <view class="service" @tap="gonursestation">
<view class="serviceorder">护理站服务订单</view> <view class="serviceorder">服务订单</view>
<image src="../../static/huijiantou.png" mode=""></image> <image src="../../static/huijiantou.png" mode=""></image>
</view> </view>
<!-- <view class="service" style="top:1100rpx" @tap=""> <!-- <view class="service" style="top:1100rpx" @tap="">

View File

@ -153,9 +153,9 @@
patientId: null, patientId: null,
useritem: null, //optionsuser信息 useritem: null, //optionsuser信息
consumableTotalPrice: 0, //耗材包总价格 consumableTotalPrice: 0, //耗材包总价格
disablingCondition: null, //是否失能 disablingCondition: undefined, //是否失能
orderlist: { orderlist: {
disablingCondition: null, disablingCondition: undefined,
orderCount: 1, orderCount: 1,
patientId: '', patientId: '',
stationId: '', stationId: '',
@ -204,7 +204,6 @@
}) })
}, },
onLoad(options) { onLoad(options) {
this.disablingCondition = null
var that = this var that = this
const value = uni.getStorageSync('openid'); const value = uni.getStorageSync('openid');
if (value) { if (value) {
@ -238,11 +237,12 @@
that.patientId = value that.patientId = value
//被护理人信息 //被护理人信息
getAppPatientList(that.patientId).then(response => { getAppPatientList(that.patientId).then(response => {
if (response.data.disablingCondition == 'NOT_DISABLED') { if (response.data.disablingCondition == 'DISABLED') {
that.checkboxlist[1].checked = true
} else if (response.data.disablingCondition == 'DISABLED') {
that.checkboxlist[0].checked = true that.checkboxlist[0].checked = true
that.disablingCondition = 'DISABLED' that.disablingCondition = 'DISABLED'
} else {
that.checkboxlist[1].checked = true
that.disablingCondition = 'NOT_DISABLED'
} }
that.personInfo = response.data that.personInfo = response.data
that.personInfo.address = response.data.areaName + response.data.address that.personInfo.address = response.data.areaName + response.data.address
@ -389,12 +389,10 @@
}, },
// 选中任一checkbox时,由checkbox-group触发 // 选中任一checkbox时,由checkbox-group触发
checkboxGroupChangetwo(e) { checkboxGroupChangetwo(e) {
if (e[0] == '否') { if (e[0] == '是') {
this.disablingCondition = 'NOT_DISABLED'
} else if (e[0] == '是') {
this.disablingCondition = 'DISABLED' this.disablingCondition = 'DISABLED'
} else { } else {
this.disablingCondition = null this.disablingCondition = 'NOT_DISABLED'
} }
this.orderlist.disablingCondition = this.disablingCondition this.orderlist.disablingCondition = this.disablingCondition
}, },

View File

@ -334,7 +334,7 @@
//跳转 //跳转
gopzyh() { gopzyh() {
uni.navigateTo({ uni.navigateTo({
url: `/pages/nursestation/nursestation?nurseStationId=${13}` url: `/pages/nursestation/nursestation?nurseStationId=${13}&hospitalcare=${true}`
}) })
}, },
//跳转贴心智养 //跳转贴心智养

View File

@ -0,0 +1,141 @@
<template>
<view class="app">
<view class="userinfo">
<view class="item">
<span>姓名:</span>
<u-input :clearable='false' v-model="query.patientName" type="text" placeholder='请输入' maxlength='5' />
</view>
<view class="item">
<span>电话:</span>
<u-input :clearable='false' v-model="query.patientName" type="text" placeholder='请输入' maxlength='11' />
</view>
<view class="item">
<span>医院:</span>
<u-input :clearable='false' v-model="query.patientName" type="text" placeholder='请输入' maxlength='20' />
</view>
<view class="item">
<span>科室:</span>
<u-input :clearable='false' v-model="query.patientName" type="text" placeholder='请输入' maxlength='20' />
</view>
<view class="item">
<span>病床号:</span>
<u-input :clearable='false' v-model="query.patientName" type="text" placeholder='请输入' maxlength='20' />
</view>
<view class="item" style="border: none;" @tap='timepicker=true'>
<span>时间:</span>
<u-input :clearable='false' disabled type="text" placeholder='请选择服务时间' />
</view>
</view>
<picker v-model="timepicker" @confirm='confirm'></picker>
</view>
</template>
<script>
import baseurl from '@/api/baseurl.js'
import picker from '../picker/picker.vue'
export default {
components: {
picker
},
data() {
return {
timepicker: false,
}
},
onShow() {
},
onLoad(options) {
},
methods: {
confirm(e) {
console.log(e)
}
}
}
</script>
<style lang="scss">
.app {
padding: 10rpx 0 0;
.userinfo {
background: #FFFFFF;
box-shadow: 0rpx 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 5rpx;
width: 96%;
margin: 0 auto 20rpx;
padding-bottom: 5rpx;
.item {
width: 94%;
margin: 0 auto;
height: 120rpx;
line-height: 120rpx;
border-bottom: 1rpx solid #D8D4D4;
position: relative;
::v-deep .u-radio__label {
width: 150rpx !important;
height: 120rpx !important;
line-height: 120rpx;
}
::v-deep .u-radio-group {
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 170rpx;
}
::v-deep .u-radio {
padding-left: 10rpx;
width: 150rpx !important;
height: 120rpx !important;
}
.address {
position: absolute;
left: 25%;
top: 50%;
width: 75%;
transform: translateY(-50%);
display: inline-block;
height: 120rpx;
line-height: 120rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
span {
display: inline-block;
line-height: 120rpx;
height: 120rpx;
width: 25%;
font-size: 36rpx;
}
::v-deep .u-input__input {
height: 120rpx;
font-size: 30rpx;
}
::v-deep .uni-input-wrapper {
display: inline-block;
height: 120rpx;
line-height: 120rpx;
}
::v-deep u-input {
height: 120rpx;
line-height: 120rpx;
position: absolute;
left: 25%;
top: 50%;
width: 75%;
transform: translateY(-50%);
}
}
}
}
</style>

View File

@ -24,11 +24,13 @@
phonecode: undefined, phonecode: undefined,
logincode: undefined, logincode: undefined,
timer: undefined, timer: undefined,
scenenurseStationId: undefined
}; };
}, },
onShow() { onShow() {
this.phonecode = undefined this.phonecode = undefined
this.logincode = undefined this.logincode = undefined
this.scenenurseStationId = uni.getStorageSync('scenenurseStationId');
}, },
methods: { methods: {
getPhoneNumberp(val) { getPhoneNumberp(val) {
@ -80,6 +82,7 @@
uni.clearStorageSync(); uni.clearStorageSync();
createMobileToken().then(res => { createMobileToken().then(res => {
uni.setStorageSync("token", res.data.token) uni.setStorageSync("token", res.data.token)
uni.setStorageSync("scenenurseStationId", this.scenenurseStationId)
that.login() that.login()
}) })
}, },

View File

@ -162,6 +162,9 @@
itemList, itemList,
productInformation, productInformation,
} from '@/api/nursestation/nursestation.js'; } from '@/api/nursestation/nursestation.js';
import {
createMobileToken
} from '@/api/login/index.js'
import baseurl from '@/api/baseurl.js' import baseurl from '@/api/baseurl.js'
export default { export default {
data() { data() {
@ -202,6 +205,7 @@
distance: null, //距离 distance: null, //距离
nurseClassifyInfoId: '', //分类id nurseClassifyInfoId: '', //分类id
scrollTop: 0, scrollTop: 0,
hospitalcare: false,
} }
}, },
onShow() { onShow() {
@ -213,9 +217,19 @@
}, },
onLoad(options) { onLoad(options) {
let that = this let that = this
this.GetBanner()
this.nurseStationId = options.nurseStationId this.nurseStationId = options.nurseStationId
this.distance = options.distance this.hospitalcare = options.hospitalcare
// scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
if (options.scene) {
this.nurseStationId = decodeURIComponent(options.scene)
this.hospitalcare = true
if (this.nurseStationId) {
createMobileToken().then(res => {
uni.setStorageSync("token", res.data.token)
})
uni.setStorageSync("scenenurseStationId", this.nurseStationId)
}
}
}, },
methods: { methods: {
//跳转swiper //跳转swiper
@ -254,8 +268,6 @@
this.autoplay = true this.autoplay = true
} }
}, },
// 获取数据
GetBanner() {},
// 处理banner返回的是是视频还是图片 // 处理banner返回的是是视频还是图片
splits(url) { splits(url) {
if (url.indexOf('.') != -1) { if (url.indexOf('.') != -1) {
@ -298,7 +310,29 @@
const value = uni.getStorageSync('openid'); const value = uni.getStorageSync('openid');
const value2 = uni.getStorageSync('patientId'); const value2 = uni.getStorageSync('patientId');
if (value && value2) { if (value && value2) {
AppIdentification(value2).then(res => { if (this.hospitalcare) {
const scenenurseStationId = uni.getStorageSync('scenenurseStationId');
if (scenenurseStationId) {
uni.navigateTo({
url: '/pages/hospitalcare/hospitalcare'
})
} else {
that.goAppIdentification(value2, item)
}
} else {
that.goAppIdentification(value2, item)
}
} else {
that.$refs.uToast.show({
title: '未登录,请先登录',
type: 'error',
url: '/pages/login/login'
})
}
},
goAppIdentification(value, item) {
let that = this
AppIdentification(value).then(res => {
if (res.code == 200) { if (res.code == 200) {
if (res.data.loginFlag) { if (res.data.loginFlag) {
that.usershow = false that.usershow = false
@ -316,17 +350,11 @@
}) })
} }
}) })
} else {
that.$refs.uToast.show({
title: '未登录,请先登录',
type: 'error',
url: '/pages/login/login'
})
}
}, },
getInfo() { getInfo() {
introductionList(this.nurseStationId).then(res => { introductionList(this.nurseStationId).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.distance = res.data.distance
this.Banners = [] this.Banners = []
this.tabList = [{ this.tabList = [{
name: '全部', name: '全部',

View File

@ -242,7 +242,7 @@
paySign: response.data.paySign, paySign: response.data.paySign,
success: function(res) { success: function(res) {
uni.setStorageSync("Refresh", 'Refresh') uni.setStorageSync("Refresh", 'Refresh')
this.goodsOrderinfo() that.goodsOrderinfo()
that.$refs.uToast.show({ that.$refs.uToast.show({
title: '支付成功', title: '支付成功',
type: 'success', type: 'success',

541
pages/picker/picker.vue Normal file
View File

@ -0,0 +1,541 @@
<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 style="flex:2">
<view class="u-column-item">
<text class="u-text">一</text>
</view>
</picker-view-column>
<picker-view-column v-if="!reset && params.endmonth" 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.endday" style="flex:5">
<view class="u-column-item" v-for="(item, index) in enddays" :key="index">
{{ formatNumber(item) }}
<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: true,
month: true,
day: true,
hour: false,
endday: true,
endmonth: true,
endhour: false,
minute: false,
endminute: false,
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: 2023
},
// 年份结束时间
endYear: {
type: [String, Number],
default: 2100
},
// "取消"按钮的颜色
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: [],
enddays: [],
year: 0,
month: 0,
day: 0,
endmonth: 0,
endday: 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}`;
},
yearAndendMonth() {
return `${this.year}-${this.endmonth}`;
},
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();
}
},
yearAndendMonth(val) {
if (this.params.year) {
this.setendDays();
}
},
// 微信和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.endmonth = Number(time.getMonth()) + 1;
this.endday = time.getDate();
// 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.endmonth) {
this.valueArr.push(0);
this.setendMonths();
}
if (this.params.endday) {
this.valueArr.push(0);
this.setendDays();
}
}
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));
},
setendMonths() {
this.months = this.generateArray(1, 12);
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.months, this.endmonth));
},
setendDays() {
let totalDays = new Date(this.year, this.endmonth, 0).getDate();
console.log(totalDays, 'total2')
this.enddays = 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.endmonth) index = 4;
else if (this.params.endmonth) index = 3;
else if (this.params.year) index = 3;
else index = 0;
// 当月份变化时,会导致日期的天数也会变化,如果原来选的天数大于变化后的天数,则重置为变化后的最大值
// 比如原来选中3月31日,调整为2月后,日期变为最大29,这时如果day值继续为31显然不合理,于是将其置为29(picker-column从1开始)
if (this.endday > this.enddays.length) this.endday = this.enddays.length;
this.valueArr.splice(index, 1, this.getIndex(this.enddays, this.endday));
},
// 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;
let i = 0;
let result = {};
if (this.mode == 'time') {
// 这里使用i++,是因为this.valueArr数组的长度是不确定长度的,它根据this.params的值来配置长度
// 进入if规则,i会加1,保证了能获取准确的值
if (this.params.year) result.year = this.years[this.valueArr[i++]];
if (this.params.month) result.month = this.months[this.valueArr[i++]];
if (this.params.day) result.day = this.days[this.valueArr[i++]];
i++
if (this.params.endmonth) result.endmonth = this.months[this.valueArr[i++]];
if (this.params.endday) result.endday = this.enddays[this.valueArr[i++]];
// 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.endmonth) result.endmonth = this.formatNumber(this.endmonth || 0);
// if (this.params.day) result.day = this.formatNumber(this.day || 0);
// if (this.params.endday) result.endday = this.formatNumber(this.endday || 0);
// this.$emit('confirm', result);
}
},
// 用户点击确定按钮
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.endmonth) result.endmonth = this.formatNumber(this.endmonth || 0);
if (this.params.day) result.day = this.formatNumber(this.day || 0);
if (this.params.endday) result.endday = this.formatNumber(this.endday || 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 {
padding-top: 20rpx;
width: 100%;
height: 300rpx;
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>

View File

@ -198,7 +198,7 @@
}, },
godetails(item) { godetails(item) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/nursestation/nursestation?nurseStationId=${item.nurseStationId}&distance=${item.distance}` url: `/pages/nursestation/nursestation?nurseStationId=${item.nurseStationId}`
}) })
}, },
cancel() { cancel() {