NurseStationApp/pages/nursestation/nursestation.vue
2022-12-02 16:04:52 +08:00

285 lines
8.2 KiB
Vue

<template>
<view class="app">
<view class="content">
<view class="righttext">
<image class="picture" :src="list.stationIntroducePcitureUrl"></image>
<view class="title">
{{list.nurseStationName}}
</view>
<view class="address">{{list.address}} </view>
<view class="call">
<view class="callme" @tap="gophone()">
<u-icon class='icon' name="phone-fill" color="#ffffff" size="30"></u-icon>
<view class="text">联系我们</view>
</view>
<!-- <view class="Navigation">
<image src="/static/daohang.png" mode="">导航</image>
</view> -->
</view>
</view>
<view class="detail">
<view class="Introduction">机构简介</view>
<view class="textInfo" v-html="list.agencyIntroduce">
</view>
</view>
<view class="Nursestationconfiguration">
<view class="configuration">
护理站配置
<view class="" style="margin-top: 30rpx;">
<view class="text" v-for="(item,index) in nurseStationLabelList" :key="index">
{{item.labelDescription}}
</view>
</view>
</view>
</view>
<view class="tive">
<view class="tab-box">
<view class="tab-item" @tap="testTabClick(index)" v-for="(item,index) in tabList" :key="index"
:class="tabIndex == index?'active':''">
{{item.name}}
</view>
</view>
<view class="" v-if="servelist.length>0&&choicetab==false">
<view class="item" v-for="item in servelist" :key="" v-show='choicetab==false'>
<image :src="item.itemPictureUrl"></image>
<view class="huanyao">{{item.nurseItemName}}
</view>
<!-- <view class="pingfen">
<u-rate :count="5" value="2"></u-rate>
</view> -->
<view class="servicetime">服务时长:{{item.serveDurationUnit?item.serveDurationUnit:'0'}}</view>
<view class="appointment" @tap='goappointments(item)'>预约</view>
<view class="price">¥{{item.nurseItemPrice==null?'0':item.nurseItemPrice}}</view>
</view>
</view>
<view class="noorder" v-if='servelist.length==0&&choicetab==false'>
<image src="../../static/noorder.png" mode=""></image>
<view class="">
暂无服务项目
</view>
</view>
<view class="" v-if="productlist.length>0&&choicetab">
<view class="item" v-show='choicetab' v-for="(item,index) in productlist" :key="index">
<image :src="item.goodsPictureUrl"></image>
<view class="product">{{item.goodsName}}</view>
<view class="buy appointment" @tap="goCommodityDetails(item)">购买</view>
<view class="price">{{item.goodsPrice==null?'0':item.goodsPrice}}</view>
</view>
</view>
<view class="noorder" v-if="productlist.length==0&&choicetab">
<image src="../../static/noorder.png" mode=""></image>
<view class="">
暂无产品
</view>
</view>
</view>
</view>
<u-mask :show="usershow" class='mask'>
<view class="information">
<image src="../../static/information.png" mode=""></image>
<view class="title">
请完善个人信息
</view>
<view class="cancel" @tap='usershow=false'>
取消
</view>
<view class="determine" @tap='goinformation'>
去完善
</view>
</view>
</u-mask>
</view>
</template>
<script>
import {
AppIdentification
} from '@/api/AppIdentification/index.js'
import {
introductionList,
itemList,
productInformation,
} from '@/api/nursestation/nursestation.js';
import baseurl from '@/api/baseurl.js'
export default {
data() {
return {
patientId: '', //
usershow: false, //完善信息开关
choicetab: false, //切换
list: [], //护理站list
servelist: [], //服务项目
productlist: [], //产品
servetotal: 0, //服务项目total
producttotal: 0, //产品total
stationid: '', //护理站id
nurseStationLabelList: [], //护理站配置
nearbyNursingStationItemList: [],
nurseStationId: '',
pageNum: 1,
pageSize: 10,
tabIndex: 0,
tabList: [{
name: "服务项目"
}, {
name: "产品"
}, ]
}
},
onShow() {
this.usershow = false
},
onLoad(options) {
this.nurseStationId = options.nurseStationId
this.getInfo()
this.serveinfo()
this.productinfo()
},
methods: {
goappointments(item) {
let that = this
try {
const value = uni.getStorageSync('patientId');
if (value) {
that.patientId = value
AppIdentification(this.patientId).then(res => {
if (res.data.loginFlag) {
uni.navigateTo({
url: `/pages/appointmenttime/appointmenttime?stationId=${item.stationId}&stationItemId=${item.stationItemId}&stationItemPriceId=${item.stationItemPriceId}`,
})
this.usershow = false
} else {
this.usershow = true
}
})
}
} catch (e) {}
},
getInfo() {
introductionList(this.nurseStationId).then(res => {
res.data.stationIntroducePcitureUrl = baseurl + res.data.stationIntroducePcitureUrl
res.data.agencyIntroduce = res.data.agencyIntroduce.replace(/\<img/gi,
"<br/><img class='richPic'")
this.list = res.data
if (res.data.nurseStationLabelList) {
this.nurseStationLabelList = res.data.nurseStationLabelList
}
})
},
serveinfo() {
itemList(this.nurseStationId, this.pageSize, this.pageNum).then(res => {
res.rows.forEach(e => {
e.itemPictureUrl = baseurl + e.itemPictureUrl
})
this.servelist = res.rows
this.servetotal = res.total
})
},
productinfo() {
productInformation(this.nurseStationId, this.pageNum, this.pageSize).then(res => {
res.rows.forEach(e => {
e.goodsPictureUrl = baseurl + e.goodsPictureUrl
})
this.productlist = res.rows
this.producttotal = res.total
})
},
testTabClick(index) {
this.tabIndex = index
this.choicetab = this.tabIndex
console.log(this.choicetab)
},
//跳转商品详情页
goCommodityDetails(item) {
uni.navigateTo({
url: `/pages/CommodityDetails/CommodityDetails?goodsPrice=${item.goodsPrice}&goodsInfoId=${item.goodsInfoId}&buySource=${'NURSE_STATION'}`
})
},
//跳转完善页面
goinformation() {
uni.navigateTo({
url: '/pages/information/information'
})
},
gophone() {
var that = this
uni.getSystemInfo({
success: function(res) {
// console.log(res)
if (res.platform == 'ios') {
uni.makePhoneCall({
phoneNumber: that.list.phone //仅为示例
});
} else {
uni.showActionSheet({
itemList: ['呼叫', ],
success: function(res) {
if (res.tapIndex + 1 == 1) {
console.log(1)
uni.makePhoneCall({
phoneNumber: that.list.phone //仅为示例
});
}
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
},
fail: function(res) {
// console.log(res.errMsg);
}
});
}
}
});
},
},
onReachBottom() { //下滑加载
if (this.choicetab == 0) {
console.log(1)
if (this.servelist.length >= this.servetotal) {} else {
this.pageNum++
itemList(this.nurseStationId, this.pageSize, this.pageNum).then(res => {
res.rows.forEach(e => {
e.itemPictureUrl = baseurl + e.itemPictureUrl
this.servelist.push(e)
})
})
}
} else {
if (this.productlist.length >= this.producttotal) {} else {
this.pageNum++
productInformation(this.nurseStationId, this.pageNum, this.pageSize).then(res => {
res.rows.forEach(e => {
e.goodsPictureUrl = baseurl + e.goodsPictureUrl
this.productlist.push(e)
})
})
}
}
},
onPullDownRefresh() { //下拉刷新
this.pageNum = 1;
if (this.choicetab == 0) {
itemList(this.nurseStationId, this.pageSize, this.pageNum).then(res => {
res.rows.forEach(e => {
e.itemPictureUrl = baseurl + e.itemPictureUrl
})
this.servelist = res.rows
})
} else {
productInformation(this.nurseStationId, this.pageNum, this.pageSize).then(res => {
res.rows.forEach(e => {
e.goodsPictureUrl = baseurl + e.goodsPictureUrl
})
this.productlist = res.rows
})
}
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
}
</script>
<style lang="scss">
@import './nursestation.scss'
</style>