nurseWeChatAppletUI/pages/site/site.vue

284 lines
7.6 KiB
Vue
Raw Normal View History

<template>
<view class="app">
<view class="inputs">
<i class="icon"></i>
2023-02-17 10:50:20 +08:00
<input v-model="searchName" type="text" name="" id="" class="input" placeholder="请输入">
</view>
<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>8'>
<image src="../../static/gd.png" mode=""></image>
<view class="title">
更多
</view>
</view>
</view>
2023-02-17 09:36:17 +08:00
<u-swiper :list="lbinfo" height='200' interval='3000' duration='1500'></u-swiper>
<view class="conNew">
<view class="title">
周边医养机构
</view>
<u-tabs :list="nurseAgencyClassifyInfoList" :current="conNewcurrent" @change="change"></u-tabs>
2023-02-17 10:50:20 +08:00
<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>
</view>
</view>
</view>
2023-02-17 10:50:20 +08:00
<view class="noorder" v-else>
<image src="../../static/noorder.png" mode=""></image>
<view class="">
暂无护理站
</view>
</view>
</view>
<view class="masks" style="" v-if="mask">
<view class="mask">
<view class="picture">
<image src="../../static/locatinsmall.png"></image>
</view>
<view class="text">
请打开系统定位
</view>
<view class="btns">
<view class="bt" @tap='cancel()'>取消</view>
<view class="btn" @tap='getlocation()'>确定</view>
</view>
</view>
</view>
2023-02-20 16:22:42 +08:00
<u-back-top :scroll-top="scrollTop"></u-back-top>
</view>
</template>
<script>
import {
nearbyList,
getPatientInfo,
getNurseClassifyList
} from '@/api/site/site.js';
import baseurl from '@/api/baseurl.js'
export default {
data() {
return {
nurseAgencyClassifyInfoList: [], //护理站分类
conNewcurrent: 0,
nurseItemClassifyInfoList: [], //护理项目分类
2023-02-17 10:50:20 +08:00
lbinfo: [], //轮播list
nursestationlist: [],
mask: false,
pageNum: 1,
pageSize: 10,
total: 0,
latitude: 39.90374,
longitude: 116.397827,
2023-01-12 16:16:36 +08:00
homeLatitudeLongitude: null,
nurseClassId: '', //护理站分类id
itemClassId: '', //护理项目分类id
2023-02-17 10:50:20 +08:00
searchName: '', //通用名称
2023-02-20 16:22:42 +08:00
scrollTop: 0,
}
},
methods: {
//点击护理项目分类
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
})
2023-02-17 10:50:20 +08:00
res.data.poserInfoList.forEach(e => {
2023-02-20 16:22:42 +08:00
e.image = baseurl + e.posterPictureUrl
2023-02-17 10:50:20 +08:00
})
2023-02-20 16:22:42 +08:00
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) {
var that = this
uni.openSetting({
success(res) {
if (res.authSetting['scope.userLocation']) {
2023-01-12 16:16:36 +08:00
// uni.getLocation({
// type: 'wgs84',
// success: function(res) {
// that.latitude = res.latitude
// that.longitude = res.longitude
// that.mask = false
// }
// });
}
}
});
},
requestinfo() {
2022-12-27 09:22:42 +08:00
this.pageNum = 1;
2023-02-17 10:50:20 +08:00
nearbyList(this.pageSize, this.pageNum, this.longitude, this.latitude, this.nurseClassId, this.itemClassId,
this.searchName)
.then(res => {
2023-02-17 10:50:20 +08:00
uni.removeStorageSync('Refresh');
res.rows.forEach(e => {
e.stationPictureUrl = baseurl + e.stationPictureUrl
if (e.classifyInfoList.length >= 1) {
e.classifyInfoList = e.classifyInfoList.slice(0, 2)
}
})
this.nursestationlist = res.rows
this.mask = false
this.total = res.total
})
},
godetails(item) {
uni.navigateTo({
url: `/pages/nursestation/nursestation?nurseStationId=${item.nurseStationId}&distance=${item.distance}`
})
},
cancel() {
this.mask = false
uni.switchTab({
url: '/pages/homepage/homepage',
})
},
},
onReachBottom() { //上滑加载
if (this.nursestationlist.length >= this.total) {} else {
this.pageNum++;
2023-02-20 16:22:42 +08:00
nearbyList(this.pageSize, this.pageNum, this.longitude, this.latitude, this.nurseClassId, this.itemClassId,
this.searchName)
.then(res => {
res.rows.forEach(e => {
e.stationPictureUrl = baseurl + e.stationPictureUrl
if (e.classifyInfoList.length >= 1) {
e.classifyInfoList = e.classifyInfoList.slice(0, 2)
}
this.nursestationlist.push(e)
})
})
}
},
onPullDownRefresh() { //下拉刷新
this.pageNum = 1;
2023-02-17 10:50:20 +08:00
// this.requestinfo()
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
watch: {
2023-02-17 10:50:20 +08:00
searchName() {
2023-02-20 16:22:42 +08:00
this.itemClassId = ''
this.nurseClassId = ''
this.conNewcurrent = 0
2023-02-17 10:50:20 +08:00
this.requestinfo()
},
},
2022-12-27 09:22:42 +08:00
onShow() {
this.nurseClassId = ''
this.itemClassId = ''
var that = this
2023-01-13 09:08:31 +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();
} else {
2023-01-12 16:16:36 +08:00
that.requestinfo();
// uni.getLocation({
// type: 'wgs84',
2023-01-13 09:08:31 +08:00
// success: function(resp) {
// that.latitude = resp.latitude
// that.longitude = resp.longitude
2023-01-12 16:16:36 +08:00
// that.requestinfo();
// },
// fail(err) {
// that.mask = true;
// }
// });
}
} else if (res.code == 9999) {} else {
2023-01-13 09:08:31 +08:00
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();
},
2022-12-28 12:08:50 +08:00
//1.分享给朋友
onShareAppMessage(res) {
2023-01-03 09:02:23 +08:00
let pages = getCurrentPages();
let url = pages[pages.length - 1].$page.fullPath
2022-12-28 12:08:50 +08:00
return {
title: '泉医到家',
2023-01-03 09:02:23 +08:00
path: url,
2022-12-28 12:08:50 +08:00
}
},
//2.分享到朋友圈
onShareTimeline(res) {
2023-01-03 09:02:23 +08:00
let pages = getCurrentPages();
let url = pages[pages.length - 1].$page.fullPath
2022-12-28 12:08:50 +08:00
return {
title: '泉医到家',
2023-01-03 09:02:23 +08:00
path: url,
2022-12-28 12:08:50 +08:00
}
},
2023-02-20 16:22:42 +08:00
onPageScroll(e) {
this.scrollTop = e.scrollTop;
},
}
</script>
<style lang="scss">
@import './site.scss'
</style>