更新小程序仓库
This commit is contained in:
@@ -0,0 +1,277 @@
|
||||
// pages/allotDoctor/allotDoctor.js
|
||||
const app = getApp()
|
||||
import {
|
||||
assignDoctor
|
||||
} from "../../api/consult"
|
||||
import {
|
||||
doctorDetail,
|
||||
fllowDoctor,
|
||||
notfllowDoctor
|
||||
} from "../../api/consultExpert"
|
||||
import {throttle} from "../../utils/util"
|
||||
import {cancelOrder} from "../../api/consultOrder"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
order_inquiry_id: "",
|
||||
doctor_id: '',
|
||||
showDialog: false,
|
||||
order_type: '',
|
||||
fromType:'',
|
||||
chat_id: '',
|
||||
time: 0,
|
||||
timeData: {},
|
||||
allotCountDown:300000,
|
||||
countDown:3000,
|
||||
isAllot: 1, //1分配 //2 分配成功 //3分配超时
|
||||
isLock: false,
|
||||
timer: null,
|
||||
timer2: null,
|
||||
countTime: 0,
|
||||
doctor: {
|
||||
avatar: '',
|
||||
user_name: '',
|
||||
doctor_title_name: '',
|
||||
department_custom_name: '',
|
||||
hospital: {},
|
||||
multi_point_status: null,
|
||||
multi_point_enable:0,
|
||||
follow: false
|
||||
},
|
||||
img_host:'https://oss.prod.applets.igandanyiyuan.com/applet/patient/static'
|
||||
},
|
||||
getDeatil(id) {
|
||||
doctorDetail(id).then((res) => {
|
||||
let doctor = this.data.doctor;
|
||||
for (const key in doctor) {
|
||||
let item=`doctor.${key}`;
|
||||
if (res[key]) {
|
||||
this.setData({
|
||||
[item]: res[key]
|
||||
})
|
||||
}
|
||||
};
|
||||
})
|
||||
},
|
||||
toggleFllow() {
|
||||
if (this.data.doctor.follow) {
|
||||
this.handenotfllowDoctor()
|
||||
} else {
|
||||
this.handelfllowDoctor()
|
||||
}
|
||||
},
|
||||
handelCancelOrder(){
|
||||
let { order_inquiry_id, fromType} = this.data;
|
||||
cancelOrder(order_inquiry_id).then(data=>{
|
||||
app.method.navigateTo({
|
||||
url: '/pages/orderDetail/orderDetail?order_inquiry_id='+order_inquiry_id+"&fromType="+fromType,
|
||||
})
|
||||
|
||||
})
|
||||
},
|
||||
handelfllowDoctor() {
|
||||
let id = this.data.doctor_id
|
||||
fllowDoctor(id).then(data => {
|
||||
this.setData({
|
||||
"doctor.follow": true
|
||||
})
|
||||
wx.showToast({
|
||||
title: '关注成功',
|
||||
icon: "none"
|
||||
})
|
||||
})
|
||||
},
|
||||
handenotfllowDoctor() {
|
||||
let id = this.data.doctor_id;
|
||||
notfllowDoctor(id).then(data => {
|
||||
this.setData({
|
||||
"doctor.follow": false
|
||||
})
|
||||
wx.showToast({
|
||||
title: '已取消关注',
|
||||
icon: "none"
|
||||
})
|
||||
})
|
||||
},
|
||||
close(event) {
|
||||
this.handelCancelOrder();
|
||||
},
|
||||
confirm(){
|
||||
this.setData({
|
||||
showDialog:false
|
||||
})
|
||||
},
|
||||
goDetail:throttle(function(){
|
||||
let {
|
||||
order_inquiry_id,
|
||||
fromType
|
||||
} = this.data;
|
||||
app.method.navigateTo({
|
||||
url: '/pages/orderDetail/orderDetail?order_inquiry_id='+order_inquiry_id+"&fromType="+fromType
|
||||
})
|
||||
}),
|
||||
finished(){
|
||||
this.goChat();
|
||||
},
|
||||
finishedAllot(){
|
||||
clearTimeout(this.data.timer);
|
||||
this.setData({
|
||||
isAllot: 3
|
||||
})
|
||||
|
||||
},
|
||||
onChangeCountDown(e){
|
||||
let time=e.detail;
|
||||
this.setData({
|
||||
timeData:time
|
||||
})
|
||||
if(time.minutes==3 && time.seconds==0)
|
||||
this.setData({
|
||||
showDialog: true
|
||||
})
|
||||
},
|
||||
//计算请求时间
|
||||
countReqTime() {
|
||||
var timer2 = setInterval(() => {
|
||||
let countTime = this.data.countTime;
|
||||
if (this.data.time >= 180000) {
|
||||
this.setData({
|
||||
isAllot: 3
|
||||
})
|
||||
};
|
||||
if (this.data.time >= 300000) {
|
||||
clearTimeout(this.data.timer);
|
||||
this.setData({
|
||||
showDialog: true
|
||||
})
|
||||
};
|
||||
let currentTime = this.data.time + 1000;
|
||||
this.setData({
|
||||
time: currentTime
|
||||
})
|
||||
this.setData({
|
||||
countTime: ++countTime
|
||||
});
|
||||
}, 1000);
|
||||
this.setData({
|
||||
timer2: timer2
|
||||
})
|
||||
},
|
||||
//定时发送请求
|
||||
reqCount(order_id){
|
||||
var timer = setInterval(() => {
|
||||
this.handelAssignDoctor(order_id);
|
||||
}, 10000);
|
||||
this.setData({
|
||||
timer: timer
|
||||
})
|
||||
},
|
||||
handelAssignDoctor(id) {
|
||||
assignDoctor(id).then(data => {
|
||||
if (data.user_id) {
|
||||
this.setData({
|
||||
chat_id: data.user_id,
|
||||
doctor_id: data.doctor_id,
|
||||
isAllot: 2
|
||||
})
|
||||
this.getDeatil(data.doctor_id);
|
||||
let {timer, timer2} = this.data;
|
||||
clearInterval(timer);
|
||||
clearInterval(timer2);
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
handleGochat(){
|
||||
const countDown = this.selectComponent('.control-count-down');
|
||||
countDown.pause();
|
||||
this.goChat();
|
||||
},
|
||||
goChat(){
|
||||
|
||||
let {
|
||||
order_inquiry_id,
|
||||
inquiry_type,
|
||||
chat_id,
|
||||
fromType
|
||||
} = this.data;
|
||||
app.method.navigateTo({
|
||||
url: '/TUIService/pages/index?currentConversationID=' + chat_id + "&order_inquiry_id=" + order_inquiry_id + "&inquiry_type=" + inquiry_type+"&fromType="+fromType
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
let order_inquiry_id = options.order_inquiry_id;
|
||||
let inquiry_type = options.inquiry_type;
|
||||
let order_id = options.order_id;
|
||||
if(options.fromType){
|
||||
this.setData({
|
||||
fromType:options.fromType
|
||||
})
|
||||
}
|
||||
if (order_inquiry_id) {
|
||||
this.setData({
|
||||
order_inquiry_id,
|
||||
order_id,
|
||||
inquiry_type
|
||||
})
|
||||
this.handelAssignDoctor(order_id);
|
||||
this.reqCount(order_id);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.setData({
|
||||
img_host:app.hostConfig().imghost
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
clearInterval(this.data.timer);
|
||||
clearInterval(this.data.timer2)
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
|
||||
})
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"dialog":"../../components/dialog/dialog",
|
||||
"van-count-down": "@vant/weapp/count-down/index",
|
||||
"nav":"../../components/nav/nav"
|
||||
},
|
||||
"navigationStyle":"custom",
|
||||
"navigationBarTitleText": "肝胆相照互联网医院"
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<!--pages/allotDoctor/allotDoctor.wxml-->
|
||||
<nav navName="智能分配"></nav>
|
||||
<view class="page">
|
||||
<view class="info" wx:if="{{isAllot==1}}">
|
||||
<image src="{{img_host+'/fenpei.gif'}}" class="dongtu"></image>
|
||||
<view class="tips">正在为您智能分配医生中~</view>
|
||||
</view>
|
||||
<view class="info" wx:elif="{{isAllot==2}}">
|
||||
<image src="{{img_host+'/waitSuccess.png'}}" class="dongtu"></image>
|
||||
<view class="tips">已为您成功分配医生</view>
|
||||
</view>
|
||||
<view class="info" wx:elif="{{isAllot==3}}">
|
||||
<image src="{{img_host+'/waitNone.png'}}" class="dongtu"></image>
|
||||
<view class="tips">很抱歉,因当前服务排队人较多,暂无空闲医生,请您见谅。</view>
|
||||
</view>
|
||||
<view class="counttime" wx:if="{{isAllot==1}}">
|
||||
<van-count-down time="{{allotCountDown}}" use-slot bind:finish="finishedAllot" format="mm ss" bind:change="onChangeCountDown" >
|
||||
<text class="item">{{ timeData.minutes}}分</text>
|
||||
<text class="item">{{ timeData.seconds }}秒</text>
|
||||
</van-count-down>
|
||||
</view>
|
||||
<view class="counttime" wx:if="{{isAllot==2}}"><van-count-down class="control-count-down" time="{{countDown }}" format=" ss 秒" bind:finish="finished" /></view>
|
||||
<view class="orderDetail" wx:if="{{isAllot==3}}" bindtap="goDetail">订单详情</view>
|
||||
<view class="infobox" hidden="{{!(isAllot==2)}}" bindtap="handleGochat">
|
||||
<view class="namebox">
|
||||
<image src="{{doctor.avatar}}" class="head" wx:if="{{doctor.avatar}}" mode="aspectFill"></image>
|
||||
<image src="{{img_host+'/doctor_avatar.png'}}" class="head" wx:else></image>
|
||||
<view class="namewraper">
|
||||
<view class="row">
|
||||
<view class="name">{{doctor.user_name}}</view>
|
||||
<view class="type" wx:if="{{doctor.hospital.hospital_level_name != '未知' && doctor.hospital.hospital_level_name}}">{{doctor.hospital.hospital_level_name}}</view>
|
||||
<view class="type" wx:if="{{doctor.multi_point_status==1 && doctor.multi_point_enable==1}}">可处方</view>
|
||||
</view>
|
||||
<view class="hospital"><text class="doctor_title" wx:if="{{doctor.doctor_title_name}}">{{doctor.doctor_title_name}}</text><text>{{doctor.department_custom_name}}</text></view>
|
||||
<view class="hospital">{{doctor.hospital.hospital_name}}</view>
|
||||
</view>
|
||||
<view class="guanzhu" wx:if="{{!doctor.follow}}" catchtap="toggleFllow">
|
||||
<image src="{{img_host+'/star.png'}}"></image>
|
||||
<text decode="true"> 关注</text>
|
||||
</view>
|
||||
<view class="guanzhu" wx:else catchtap="toggleFllow">
|
||||
<image src="{{img_host+'/star_on.png'}}"></image>
|
||||
<text decode="true"> 关注</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<dialog bind:confirm="confirm" bind:cancel="close" canceltext="取消问诊" showDialog="{{showDialog}}" message="当前服务排队人较多,暂无空闲医生进行接诊,是否继续等待" confirmtext="继续等待"></dialog>
|
||||
@@ -0,0 +1,164 @@
|
||||
/* pages/allotDoctor/allotDoctor.wxss */
|
||||
.dongtu {
|
||||
width: 750rpx;
|
||||
margin: 172rpx auto 0;
|
||||
height: 850rpx;
|
||||
}
|
||||
.item {
|
||||
display: inline-block;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.tips {
|
||||
width: 420rpx;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
margin: -100rpx auto 0;
|
||||
}
|
||||
.counttime {
|
||||
position: absolute;
|
||||
top: 202rpx;
|
||||
right: 30rpx;
|
||||
padding: 0 20rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
height: 48rpx;
|
||||
background: #F8F8F8;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 24rpx;
|
||||
border: 1rpx solid #CCCCCC;
|
||||
}
|
||||
.infobox {
|
||||
width:100%;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
box-sizing: border-box;
|
||||
padding: 40rpx 20rpx 40rpx;
|
||||
background: #FFF5E0;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.namebox .head {
|
||||
flex-shrink: 0;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.namebox {
|
||||
display: flex;
|
||||
|
||||
}
|
||||
|
||||
.namewraper {
|
||||
flex: 1;
|
||||
max-width:420rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-direction: column;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.namebox .row {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.namebox {
|
||||
display: flex;
|
||||
align-items:center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.namewraper .row{
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.namebox .name {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
max-width:300rpx;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.position {
|
||||
font-size: 30rpx;
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.hospital {
|
||||
margin-left: 20rpx;
|
||||
margin-top: 12rpx;
|
||||
color: #333333;
|
||||
font-size: 30rpx;
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
.doctor_title{
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.type {
|
||||
height: 32rpx;
|
||||
display: flex;
|
||||
margin-bottom: 6rpx;
|
||||
line-height: 32rpx;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
margin-left: 18rpx;
|
||||
padding: 0rpx 6rpx;
|
||||
background: #ED9C00;
|
||||
border-radius: 4rpx;
|
||||
color: #FFFFFF;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.namebox .position {
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
margin-left: 15rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.guanzhu {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
height: 60rpx;
|
||||
white-space: nowrap;
|
||||
color: #3CC7C0;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 24rpx;
|
||||
|
||||
}
|
||||
.namebox .guanzhu image {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
}
|
||||
.orderDetail {
|
||||
bottom: 160rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
position: absolute;
|
||||
width: 360rpx;
|
||||
height: 70rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 10rpx;
|
||||
border: 2rpx solid #353535;
|
||||
font-size: 32rpx;
|
||||
color: #353535;
|
||||
}
|
||||
Reference in New Issue
Block a user