xinelu-doctor-app/pages/homepage/homepage.vue

579 lines
12 KiB
Vue
Raw Normal View History

2023-10-23 09:30:36 +08:00
<template>
<view class="app">
2023-11-13 14:26:58 +08:00
<!-- 家医 -->
<view class="" v-if="status==1">
2023-11-09 15:07:35 +08:00
<u-tabs :list="tabslist" :is-scroll="false" :current="tabscurrent" @change="tabschange"
inactive-color='#fff' active-color='#fff'></u-tabs>
2023-11-13 14:26:58 +08:00
<view class="inputs" style="width: 90%;height: 60rpx;transform: none;margin: 20rpx auto;">
<i class="icon"></i>
<input type="text" name="" id="" class="input" placeholder="搜索" v-model="formdata.name">
2023-10-24 10:09:32 +08:00
</view>
2023-11-13 14:26:58 +08:00
<view class="lists" v-if="listinfo">
<view class="item" v-for="item in listinfo" @tap='goseekadvicefrom(item)'>
<image src="../../static/headsculpture.png" mode=""></image>
<view class="name">
{{item.patientName}}
2023-10-24 10:09:32 +08:00
</view>
2023-11-13 14:26:58 +08:00
<view class="text">
{{Number(item.messageType)==2?'[图片]':item.content}}
2023-10-24 10:09:32 +08:00
</view>
2023-11-13 14:26:58 +08:00
<view class="count" v-if="item.messageCount>0">
{{item.messageCount}}
2023-10-24 10:09:32 +08:00
</view>
</view>
</view>
2023-10-25 11:10:26 +08:00
</view>
2023-11-13 14:26:58 +08:00
<view class="" v-if="status==2">
<protocol :Refresh="Refresh" :down='down'>
2023-11-09 15:07:35 +08:00
</protocol>
</view>
2023-10-24 10:09:32 +08:00
<u-toast ref="uToast" />
2023-10-23 09:30:36 +08:00
</view>
</template>
<script>
2023-10-24 10:09:32 +08:00
import {
getList,
updateStatus,
closeHealthConsultationOrder,
2023-11-06 16:57:05 +08:00
consultationInfolist,
getUserSig,
consultation,
2023-10-24 10:09:32 +08:00
} from '@/api/homepage/index.js'
2023-10-25 11:10:26 +08:00
import {
getSex
} from '@/utils/conversion.js'
2023-11-13 14:26:58 +08:00
import protocol from '@/pages/workorder/workorder.vue'
import socketurl from '@/api/socketurl.js'
2023-10-23 09:30:36 +08:00
export default {
2023-11-09 15:07:35 +08:00
components: {
protocol,
},
2023-10-23 09:30:36 +08:00
data() {
return {
2023-11-09 15:07:35 +08:00
Refresh: 1,
2023-11-13 14:26:58 +08:00
down: 1,
2023-10-23 10:39:04 +08:00
tabslist: [{
2023-11-13 14:26:58 +08:00
name: '全部',
2023-10-24 10:09:32 +08:00
value: '',
2023-10-23 10:39:04 +08:00
}, {
2023-11-13 14:26:58 +08:00
name: '已解决',
value: '2',
2023-10-23 10:39:04 +08:00
}, {
2023-11-13 14:26:58 +08:00
name: '未解决',
value: '1',
2023-10-23 10:39:04 +08:00
}],
tabscurrent: 0,
2023-10-25 11:10:26 +08:00
optionindex: 0,
2023-10-24 10:09:32 +08:00
optionname: '全部',
missionlist: [],
missiontotal: 0,
remark: '',
2023-10-25 11:10:26 +08:00
formdata: {
pageNum: 1,
2023-11-13 14:26:58 +08:00
pageSize: 1000,
2023-11-07 11:14:46 +08:00
doctorId: uni.getStorageSync("id"),
2023-10-25 11:10:26 +08:00
consultationType: 'IMAGE_TEXT_CONSULTATION',
status: '',
},
listinfo: [],
listtotal: 0,
2023-11-10 10:42:10 +08:00
status: '',
2023-11-13 14:26:58 +08:00
SOCKETURL: '',
socketOpen: false,
timeoutObj: null,
status: '',
title: '',
2023-10-23 09:30:36 +08:00
}
},
2023-11-10 10:42:10 +08:00
onReady() { //更改导航栏文字
uni.setNavigationBarTitle({
title: this.title,
});
},
2023-11-13 14:26:58 +08:00
onLoad() {
2023-11-10 10:42:10 +08:00
this.status = uni.getStorageSync("status")
2023-11-09 15:07:35 +08:00
if (this.status == 2) {
2023-11-10 10:42:10 +08:00
this.title = '工单'
} else {
this.title = '消息列表'
2023-11-13 14:26:58 +08:00
this.SOCKETURL = socketurl + uni.getStorageSync("id")
this.connectSocket();
}
},
onShow() {
this.down = 1
this.Refresh = 1
if (this.status == 1) {
this.info()
this.socket();
2023-11-09 15:07:35 +08:00
}
2023-10-23 09:30:36 +08:00
},
methods: {
2023-11-13 14:26:58 +08:00
connectSocket() {
let that = this
console.log(that.SOCKETURL)
try {
uni.connectSocket({
url: that.SOCKETURL
})
uni.onSocketOpen(res => {
console.log('webScoket连接已打开', res);
that.socketOpen = true
that.reset()
})
uni.onSocketError(err => {
console.log('webScoket连接打开失败', err);
if (err && err.code != 1000) {
setTimeout(() => {
that.socketOpen = true
uni.connectSocket({
url: that.SOCKETURL
})
}, 3 * 1000)
}
})
uni.onSocketClose(err => {
console.log('webScoket连接关闭', err);
if (err && err.code !== 1000) {
setTimeout(() => {
that.socketOpen = true
uni.connectSocket({
url: that.SOCKETURL
})
}, 3 * 1000)
}
})
} catch (e) {
console.log(e);
}
},
socket() {
let that = this
uni.onSocketMessage(res => {
console.log("webScoket监听收到的信息", res);
that.info();
})
},
reset() {
let that = this
clearInterval(that.timeoutObj);
that.timeoutObj = setInterval(() => {
uni.sendSocketMessage({
data: 'ping',
success(res) {
console.log('正在发送心跳');
},
fail(err) {
console.log('心跳发送失败,重新连接...');
that.socketOpen = true
uni.connectSocket({
url: that.SOCKETURL
})
}
})
}, 180000)
},
2023-10-25 11:10:26 +08:00
//前往聊天
goseekadvicefrom(item) {
uni.navigateTo({
url: `/pages/seekadvicefrom/seekadvicefrom?item=${JSON.stringify(item)}`
2023-11-13 14:26:58 +08:00
// url: '/pages/seekadvicefrom/seekadvicefrom'
2023-10-25 11:10:26 +08:00
})
},
2023-10-24 10:09:32 +08:00
//详情
gotaskDetails(item) {
uni.navigateTo({
2023-10-25 11:20:45 +08:00
url: `/pages/taskDetails/taskDetails?id=${item.consultationInfoId}&title=${item.orderStatus}`
2023-10-24 10:09:32 +08:00
})
},
//完成
goconfirmCompletion(item) {
var obj = {
"goodsOrderId": item.goodsOrderId,
"orderStatus": "COMPLETED",
}
updateStatus(obj).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '工单已成功',
type: 'success',
duration: '1500'
})
this.info();
}
})
},
//任务退回
gotaskReturn(item) {
2023-10-25 11:32:27 +08:00
uni.navigateTo({
url: `/pages/taskReturn/taskReturn?item=${JSON.stringify(item)}`
2023-10-24 10:09:32 +08:00
})
},
//接单
Receivingorders(item) {
var obj = {
"goodsOrderId": item.goodsOrderId,
"orderStatus": "RECEIVED_GOODS",
}
updateStatus(obj).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '接单成功',
type: 'success',
duration: '1500'
})
this.info();
}
})
},
2023-11-02 11:25:58 +08:00
// 视频通话
2023-11-07 11:14:46 +08:00
govideo(item) {
2023-11-13 14:26:58 +08:00
uni.navigateTo({
url: `/pages/Industrialbutler/Industrialbutler?item=${JSON.stringify(item)}`
2023-11-02 11:25:58 +08:00
})
},
2023-10-24 10:09:32 +08:00
info() {
2023-11-13 14:26:58 +08:00
this.formdata.pageNum = 1
consultationInfolist(this.formdata).then(res => {
this.listinfo = res.rows
this.listtotal = res.total
2023-10-24 10:09:32 +08:00
})
},
2023-10-23 10:39:04 +08:00
tabschange(index) {
this.tabscurrent = index;
2023-11-13 14:26:58 +08:00
this.formdata.status = this.tabslist[index].value
// this.optionname = '全部'
2023-10-25 11:10:26 +08:00
this.optionindex = 0
2023-10-24 10:09:32 +08:00
this.info();
2023-10-23 10:39:04 +08:00
},
2023-11-13 14:26:58 +08:00
// dropitemchange(e) {
// this.optionname = this.options.find(m => m.value === e).label
// this.query.orderStatus = this.options.find(m => m.value === e).value
// this.info();
// },
2023-10-24 10:09:32 +08:00
},
onReachBottom() { //下滑加载
2023-11-13 14:26:58 +08:00
if (this.status == 1) {
if (this.listinfo.length >= this.listtotal) {} else {
this.formdata.pageNum++
consultationInfolist(this.formdata).then(res => {
2023-10-24 10:09:32 +08:00
res.rows.forEach(e => {
2023-11-13 14:26:58 +08:00
this.listinfo.push(e)
2023-10-24 10:09:32 +08:00
})
})
2023-11-13 14:26:58 +08:00
}
} else {
this.down++
2023-10-24 10:09:32 +08:00
}
},
onPullDownRefresh() { //下拉刷新
2023-11-13 14:26:58 +08:00
if (this.status == 1) {
2023-11-09 15:07:35 +08:00
this.info();
} else {
this.Refresh++
2023-11-13 14:26:58 +08:00
this.down = 1
2023-11-09 15:07:35 +08:00
}
2023-10-24 10:09:32 +08:00
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
2023-10-23 09:30:36 +08:00
}
</script>
<style lang="scss">
2023-10-24 10:09:32 +08:00
page {
background-color: #fff;
}
2023-10-23 10:39:04 +08:00
.app {
width: 100%;
// margin: 20rpx auto;
padding: 0 0 100rpx 0;
background-color: #fff;
font-size: 24rpx;
2023-10-24 10:09:32 +08:00
.lists {
width: 96%;
margin: 0 auto;
.item {
position: relative;
height: 180rpx;
.count {
position: absolute;
right: 10rpx;
bottom: 50rpx;
width: 28rpx;
height: 28rpx;
background: #FF0000;
border-radius: 50%;
text-align: center;
line-height: 28rpx;
color: #fff;
font-weight: 400;
color: #FFFFFF;
}
.text {
font-size: 24rpx;
font-weight: 400;
color: #999999;
position: absolute;
left: 160rpx;
bottom: 50rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: calc(100% - 220rpx);
}
.name {
position: absolute;
left: 160rpx;
top: 40rpx;
font-size: 28rpx;
font-weight: 400;
color: #333333;
}
image {
position: absolute;
top: 50%;
left: 20rpx;
transform: translateY(-50%);
width: 110rpx;
height: 110rpx;
border-radius: 50%;
}
}
2023-10-23 10:39:04 +08:00
}
2023-10-24 10:09:32 +08:00
.inputs {
background-color: #fff;
width: 65%;
// height: 60rpx;
// border: 1px solid #F6F6F6;
height: 0rpx;
border-radius: 5rpx;
background-color: #ffffff;
z-index: 999;
position: relative;
top: 50%;
transform: translateY(-50%);
background: #F6F6F6;
border-radius: 38rpx;
.input {
margin: 0 auto;
position: absolute;
height: 60rpx;
// top: 8%;
left: 13%;
width: 80%;
font-size: 26rpx;
color: #000000;
}
.icon {
background: url(@/static/sousuo.png) no-repeat;
width: 30rpx;
height: 28rpx;
background-size: cover;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 3%;
}
}
.btnss {
2023-10-23 10:39:04 +08:00
display: flex;
2023-10-24 10:09:32 +08:00
text-align: center;
border-top: 1rpx solid #f6f6f6;
font-size: 32rpx;
line-height: 100rpx;
width: 100%;
position: absolute;
bottom: 0;
.cancel {
width: 50%;
height: 100rpx;
border-right: 0.5rpx solid #f6f6f6;
}
.Rescind {
width: 50%;
height: 100rpx;
color: #18CBB3;
border-left: 0.5rpx solid #f6f6f6;
}
}
.items {
width: 96%;
margin: 0 auto;
.item {
margin: 15rpx auto;
2023-10-23 10:39:04 +08:00
background-color: #fff;
2023-10-24 10:09:32 +08:00
box-shadow: 0rpx 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
2023-10-23 10:39:04 +08:00
border-radius: 5rpx;
2023-10-24 10:09:32 +08:00
padding: 3%;
width: 100%;
2023-10-23 10:39:04 +08:00
position: relative;
2023-10-24 10:09:32 +08:00
color: #333333;
font-size: 30rpx;
padding-bottom: 60rpx;
2023-10-23 10:39:04 +08:00
2023-10-25 11:10:26 +08:00
.tabscurrent {
width: 100%;
padding: 30rpx;
margin: 0 auto;
background: #F7F9F8;
border-radius: 14rpx;
}
2023-10-24 10:09:32 +08:00
.btns {
margin-top: 60rpx;
display: flex;
position: relative;
height: 30rpx;
.text {
2023-11-02 11:25:58 +08:00
// width: 82rpx;
2023-10-24 10:09:32 +08:00
height: 27rpx;
font-size: 28rpx;
font-weight: 500;
color: #E57726;
line-height: 55rpx;
}
.btnaccept,
.btnreturn {
width: 170rpx;
height: 60rpx;
text-align: center;
line-height: 55rpx;
2023-10-25 11:20:45 +08:00
border-radius: 50rpx;
2023-10-24 10:09:32 +08:00
border: 1px solid #18CBB3;
position: absolute;
}
.btnaccept {
right: 24rpx;
color: #fff;
background-color: #18CBB3;
}
.btnreturn {
right: 220rpx;
color: #18CBB3;
background: #FFFFFF;
}
2023-10-23 10:39:04 +08:00
}
2023-10-24 10:09:32 +08:00
.time {
line-height: 60rpx;
font-size: 24rpx;
font-weight: 400;
color: #333333;
span {
word-break: break-all;
padding-left: 10rpx;
}
}
.itemimg {
2023-10-23 10:39:04 +08:00
position: absolute;
2023-10-24 10:09:32 +08:00
right: 15rpx;
top: 18rpx;
width: 140rpx;
height: 120rpx;
}
.title {
font-size: 32rpx;
line-height: 100rpx;
border-bottom: 1rpx solid #E6E6E6;
color: #333333;
position: relative;
height: 100rpx;
.text {
height: 100%;
overflow: hidden; //超出的文本隐藏
display: -webkit-box;
-webkit-line-clamp: 1; // 超出多少行
-webkit-box-orient: vertical;
width: 50%;
}
.image {
position: absolute;
right: 0%;
top: 50%;
transform: translateY(-50%);
display: inline-block;
font-size: 30rpx;
color: #EA706A;
image {
// vertical-align: middle;
transform: translateY(20%);
width: 40rpx;
height: 40rpx;
padding-right: 10rpx;
}
}
2023-10-23 10:39:04 +08:00
}
}
2023-10-24 10:09:32 +08:00
}
::v-deep .u-tabs {
background-color: #18CBB3 !important;
}
.top {
width: 82%;
margin: 0 auto;
display: flex;
height: 84rpx;
justify-content: space-around;
2023-10-23 10:39:04 +08:00
::v-deep .u-flex {
width: 100% !important;
}
::v-deep .u-dropdown__content {
overflow-y: scroll !important;
height: 500rpx;
.u-flex {
width: 0 !important;
}
}
::v-deep .u-dropdown__content__mask {
background: none !important;
}
::v-deep .u-dropdown__menu__item {
width: 100% !important;
}
::v-deep .u-cell__value {
flex: 0;
}
::v-deep .u-dropdown {
:v-deep .u-dropdown__menu {}
}
::v-deep .u-cell-box {}
}
}
2023-10-25 11:20:45 +08:00
</style>