NurseStationApp/pages/site/site.vue

310 lines
8.6 KiB
Vue
Raw Normal View History

2022-10-13 11:30:22 +08:00
<template>
2022-10-21 11:01:04 +08:00
<view class="app">
2023-02-23 10:45:26 +08:00
<view class="inputs">
<i class="icon"></i>
<input v-model="searchName" type="text" name="" id="" class="input" placeholder="请输入">
2022-10-24 16:40:37 +08:00
</view>
2023-02-23 10:45:26 +08:00
<view class="Classificationlist">
<view v-for="(item,index) in nurseItemClassifyInfoList" :key="index" @tap='tapitemclass(item)'
:class="item.id == itemClassId?'itemclass':'item'">
<image :src="item.classifyPictureUrl" mode=""></image>
<view class="title">
{{item.classifyName}}
</view>
</view>
<view class="item" v-if='nurseItemClassifyInfoList.length==7&&lengthlistshow' @tap='lengthlist(true)'>
<image src="../../static/gd.png" mode=""></image>
<view class="title">
更多
</view>
</view>
<view class="item" v-if='nurseItemClassifyInfoList.length>7&&!lengthlistshow' @tap='lengthlist(false)'>
<image src="../../static/gd.png" mode=""></image>
<view class="title">
收起
</view>
</view>
2022-10-13 11:30:22 +08:00
</view>
2023-02-23 10:45:26 +08:00
<u-swiper :list="lbinfo" height='200' interval='3000' duration='1500' mode='none'></u-swiper>
2022-10-14 19:48:48 +08:00
<view class="conNew">
2023-02-23 10:45:26 +08:00
<view class="title">
周边医养机构
</view>
<u-tabs :list="nurseAgencyClassifyInfoList" :current="conNewcurrent" @change="change"></u-tabs>
<view class="" v-if="nursestationlist.length>0">
<view class="addressContent" v-for="(item,index) in nursestationlist" :key="index">
<view class="lists" @tap='godetails(item)'>
<view class="nurse">{{item.nurseStationName}}</view>
<view class="distance"
v-show="homeLatitudeLongitude.homeLatitude&&homeLatitudeLongitude.homeLongitude">
距离您{{item.distance}}KM</view>
<image class="background" :src="item.stationPictureUrl" mode=""></image>
<view class="tags">
<view class="tag" v-for="uitem in item.classifyInfoList">
{{uitem.classifyName}}
</view>
</view>
2022-10-14 19:48:48 +08:00
</view>
</view>
2022-10-13 11:30:22 +08:00
</view>
2023-02-23 10:45:26 +08:00
<view class="noorder" v-else>
<image src="../../static/noorder.png" mode=""></image>
<view class="">
暂无护理站
</view>
</view>
2022-10-13 16:31:59 +08:00
</view>
2022-10-24 16:40:37 +08:00
<view class="masks" style="" v-if="mask">
2022-10-13 16:31:59 +08:00
<view class="mask">
2022-10-24 16:40:37 +08:00
<view class="picture">
2022-10-13 16:31:59 +08:00
<image src="../../static/locatinsmall.png"></image>
</view>
2022-10-24 16:40:37 +08:00
<view class="text">
2022-10-13 16:31:59 +08:00
请打开系统定位
</view>
<view class="btns">
2022-10-24 16:40:37 +08:00
<view class="bt" @tap='cancel()'>取消</view>
2022-10-31 09:04:45 +08:00
<view class="btn" @tap='getlocation()'>确定</view>
2022-10-13 11:30:22 +08:00
</view>
</view>
</view>
2023-02-23 10:45:26 +08:00
<u-back-top :scroll-top="scrollTop"></u-back-top>
2022-10-13 16:31:59 +08:00
</view>
2022-10-13 11:30:22 +08:00
</template>
<script>
2022-10-14 19:48:48 +08:00
import {
2022-11-10 14:20:16 +08:00
nearbyList,
2023-02-23 10:45:26 +08:00
getPatientInfo,
getNurseClassifyList
2022-10-20 09:15:48 +08:00
} from '@/api/site/site.js';
2022-10-14 19:48:48 +08:00
import baseurl from '@/api/baseurl.js'
2022-10-13 11:30:22 +08:00
export default {
data() {
return {
2023-02-23 10:45:26 +08:00
nurseAgencyClassifyInfoList: [], //护理站分类
conNewcurrent: 0,
nurseItemClassifyInfoList: [], //护理项目分类
nurseItemClassifyInfolength: 0,
nurseItemClassifyInfolistlength: [],
lengthlistshow: true,
lbinfo: [], //轮播list
2022-10-24 16:40:37 +08:00
nursestationlist: [],
2022-10-31 09:04:45 +08:00
mask: false,
2022-10-14 19:48:48 +08:00
pageNum: 1,
pageSize: 10,
2022-10-31 09:04:45 +08:00
total: 0,
2023-02-23 10:45:26 +08:00
latitude: 39.90374,
longitude: 116.397827,
homeLatitudeLongitude: null,
nurseClassId: '', //护理站分类id
itemClassId: '', //护理项目分类id
searchName: '', //通用名称
scrollTop: 0,
2022-10-13 11:30:22 +08:00
}
},
2022-10-31 09:04:45 +08:00
methods: {
2023-02-23 10:45:26 +08:00
lengthlist(item) {
uni.showLoading({
title: '',
duration: 1000
});
setTimeout((e) => {
this.lengthlistshow = !this.lengthlistshow
if (item) {
this.nurseItemClassifyInfoList = this.nurseItemClassifyInfolistlength
} else {
this.nurseItemClassifyInfoList = this.nurseItemClassifyInfolistlength.slice(0, 7)
}
uni.hideLoading();
}, 1000)
},
//点击护理项目分类
tapitemclass(item) {
if (this.itemClassId == item.id) {
this.itemClassId = ''
} else {
this.itemClassId = item.id
}
this.requestinfo()
},
//护理站和护理项目分类
getNurseClassifyinfo() {
getNurseClassifyList().then(res => {
this.nurseAgencyClassifyInfoList.push({
name: '全部',
id: '',
})
res.data.nurseAgencyClassifyInfoList.forEach(e => {
e.name = e.classifyName
this.nurseAgencyClassifyInfoList.push(e)
})
res.data.nurseItemClassifyInfoList.forEach(e => {
e.classifyPictureUrl = baseurl + e.classifyPictureUrl
})
res.data.poserInfoList.forEach(e => {
e.image = baseurl + e.posterPictureUrl
})
this.nurseItemClassifyInfolength = res.data.nurseItemClassifyInfoList.length
this.nurseItemClassifyInfolistlength = res.data.nurseItemClassifyInfoList
this.lbinfo = res.data.poserInfoList
this.nurseItemClassifyInfoList = res.data.nurseItemClassifyInfoList.slice(0, 7)
})
},
change(index) {
this.conNewcurrent = index;
this.nurseClassId = this.nurseAgencyClassifyInfoList[index].id
this.requestinfo()
},
getlocation(value) {
2022-12-01 17:03:02 +08:00
var that = this
2023-02-23 10:45:26 +08:00
uni.openSetting({
success(res) {
if (res.authSetting['scope.userLocation']) {
// uni.getLocation({
// type: 'wgs84',
// success: function(res) {
// that.latitude = res.latitude
// that.longitude = res.longitude
// that.mask = false
// }
// });
}
2022-10-20 09:15:48 +08:00
}
});
2022-10-14 19:48:48 +08:00
},
requestinfo() {
2023-02-23 10:45:26 +08:00
this.pageNum = 1;
nearbyList(this.pageSize, this.pageNum, this.longitude, this.latitude, this.nurseClassId, this.itemClassId,
this.searchName)
.then(res => {
uni.removeStorageSync('Refresh');
res.rows.forEach(e => {
e.stationPictureUrl = baseurl + e.stationPictureUrl
if (e.classifyInfoList && e.classifyInfoList.length >= 1) {
e.classifyInfoList = e.classifyInfoList.slice(0, 2)
}
})
this.nursestationlist = res.rows
this.mask = false
this.total = res.total
2022-10-31 09:04:45 +08:00
})
2022-10-14 19:48:48 +08:00
},
2022-10-24 16:40:37 +08:00
godetails(item) {
2022-10-14 19:48:48 +08:00
uni.navigateTo({
2023-02-23 10:45:26 +08:00
url: `/pages/nursestation/nursestation?nurseStationId=${item.nurseStationId}&distance=${item.distance}`
2022-10-14 19:48:48 +08:00
})
},
cancel() {
this.mask = false
2022-11-10 14:20:16 +08:00
uni.switchTab({
url: '/pages/homepage/homepage',
})
2022-10-14 19:48:48 +08:00
},
},
2023-02-23 10:45:26 +08:00
onReachBottom() { //上滑加载
2022-10-31 09:04:45 +08:00
if (this.nursestationlist.length >= this.total) {} else {
this.pageNum++;
2023-02-23 10:45:26 +08:00
nearbyList(this.pageSize, this.pageNum, this.longitude, this.latitude, this.nurseClassId, this.itemClassId,
this.searchName)
2022-10-31 09:04:45 +08:00
.then(res => {
res.rows.forEach(e => {
e.stationPictureUrl = baseurl + e.stationPictureUrl
2023-02-23 10:45:26 +08:00
if (e.classifyInfoList && e.classifyInfoList.length >= 1) {
e.classifyInfoList = e.classifyInfoList.slice(0, 2)
}
2022-10-31 09:04:45 +08:00
this.nursestationlist.push(e)
})
})
}
},
2022-11-10 14:20:16 +08:00
onPullDownRefresh() { //下拉刷新
this.pageNum = 1;
2023-02-23 10:45:26 +08:00
// this.requestinfo()
2022-11-10 14:20:16 +08:00
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
2022-10-31 09:04:45 +08:00
watch: {
2023-02-23 10:45:26 +08:00
searchName() {
this.itemClassId = ''
this.nurseClassId = ''
this.conNewcurrent = 0
this.requestinfo()
2022-10-31 09:04:45 +08:00
},
},
2022-12-27 09:21:01 +08:00
onShow() {
2023-02-23 10:45:26 +08:00
this.nurseClassId = ''
this.itemClassId = ''
2022-11-10 14:20:16 +08:00
var that = this
2023-02-23 10:45:26 +08:00
const value = uni.getStorageSync('patientId');
if (value) {
getPatientInfo(value).then(res => {
if (res.code == 200) {
this.homeLatitudeLongitude = res.data
if (res.data.homeLatitude && res.data.homeLongitude) {
that.latitude = res.data.homeLatitude
that.longitude = res.data.homeLongitude
that.requestinfo();
2022-11-10 14:20:16 +08:00
} else {
2023-02-23 10:45:26 +08:00
that.requestinfo();
// uni.getLocation({
// type: 'wgs84',
// success: function(resp) {
// that.latitude = resp.latitude
// that.longitude = resp.longitude
// that.requestinfo();
// },
// fail(err) {
// that.mask = true;
// }
// });
2022-11-10 14:20:16 +08:00
}
2023-02-23 10:45:26 +08:00
} else if (res.code == 9999) {} else {
that.requestinfo();
}
})
} else {
that.requestinfo();
// uni.getLocation({
// type: 'wgs84',
// success: function(res) {
// that.latitude = res.latitude
// that.longitude = res.longitude
// that.requestinfo();
// },
// fail(err) {
// that.mask = true;
// }
// });
}
},
onLoad() {
this.getNurseClassifyinfo();
},
//1.分享给朋友
onShareAppMessage(res) {
let pages = getCurrentPages();
let url = pages[pages.length - 1].$page.fullPath
return {
title: '泉医到家',
path: url,
}
},
//2.分享到朋友圈
onShareTimeline(res) {
let pages = getCurrentPages();
let url = pages[pages.length - 1].$page.fullPath
return {
title: '泉医到家',
path: url,
}
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
2022-10-31 09:04:45 +08:00
},
2022-10-14 19:48:48 +08:00
}
2022-10-13 11:30:22 +08:00
</script>
<style lang="scss">
2022-10-31 09:04:45 +08:00
@import './site.scss'
2022-10-13 11:30:22 +08:00
</style>