Files
xk-client-wx/subPackages/my/myappiont.vue
2026-05-15 16:42:32 +08:00

432 lines
9.6 KiB
Vue

<template>
<view class="container safe-area-inset-bottom">
<MessageNotification />
<view class="head" @click="toChoose">
<view class="head_name">{{infoUserList[0].name || '请选择就诊人'}}</view>
<view class="head_qh">
切换就诊人
<text class="iconfont icon-jiantou1"></text>
</view>
</view>
<!-- 空页 -->
<view class="empty" v-if="infoList.length==0">
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/empty/orders.png" mode="aspectFit"></image>
<view class="word">暂无挂号记录~</view>
</view>
<!-- 挂号记录 -->
<view class="list" v-for="(item,index) in infoList" :key="item.id">
<view class="li_title">
<text>{{item.created_at}}</text>
<text class="text"
v-if="item.status<4">{{item.status==0&&'待支付'||item.status==1&&'待接诊' || item.status==2&&'接诊中' || item.status==3&&'已结束'}}</text>
<text class="txt" v-if="item.status>=4">{{item.status==4&&'已取消' || item.status==7&&'已拒诊'}}</text>
</view>
<view class="info">
<view class="list_name">
患者姓名
</view>
<text>{{item.patient}}</text>
</view>
<view class="info">
<view class="list_name">
预约诊所
</view>
<text>{{item.store}}</text>
</view>
<view class="info">
<view class="list_name">
预约科室
</view>
<text>{{item.depart}}</text>
</view>
<view class="info">
<view class="list_name">
预约医生
</view>
<text>{{item.doctor}}</text>
</view>
<view class="info">
<view class="list_name">
预约序号
</view>
<text>{{item.order_number}}</text>
</view>
<view class="info">
<view class="list_name">
挂号金额
</view>
<text>{{item.store}}</text>
</view>
<!-- 转诊卡片 -->
<TransferPrescriptionCard
v-if="item.is_from_transfer == 1 && item.transfer_prescription"
:transfer-data="item.transfer_prescription"
@agree="handleTransferAgree"
@reject="handleTransferReject"
/>
<!-- 查看详情 -->
<view class="detail" @click="getInfo(item.id)"><text>查看详情</text></view>
</view>
<u-loadmore :status="status" />
<u-back-top :scroll-top="scrollTop"></u-back-top>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
userList
} from '../../request/api/api'
import {
getRegisterListApi
} from '../../request/api/register'
import {
agreeTransferPrescriptionApi,
rejectTransferPrescriptionApi
} from '../../request/api/transferPrescription'
import TransferPrescriptionCard from './components/TransferPrescriptionCard.vue'
export default {
components: {
TransferPrescriptionCard
},
data() {
return {
status: 'nomore',
infoList: [],
infoUserList: [],
myinfo: [],
id: "",
page: 1, // 当前页数
total: "", // 总条数
totalPage: "", // 总页数
pageSize: 20, // 每页条数
scrollTop: 0
}
},
onLoad() {
},
created() {
this.getInfolist()
},
methods: {
// 切换
toChoose() {
uni.navigateTo({
url: "/subPackages/my/myinfo?id="
})
},
// 详情
getInfo(id) {
uni.navigateTo({
url: "/subPackages/register/register-info?id=" + id + '&type=' + 1
})
},
// 同意转诊
handleTransferAgree(transferData) {
uni.showModal({
title: '确认转诊',
content: '确定同意转诊吗?',
success: (res) => {
if (res.confirm) {
agreeTransferPrescriptionApi({ id: transferData.id }).then((result) => {
if (result.data.code == 0) {
uni.showToast({
title: '同意转诊成功',
icon: 'success'
})
// 跳转到咨询页面
setTimeout(() => {
uni.redirectTo({
url: `/subPackages/transfer/transfer-consultation?transfer_id=${transferData.id}`,
fail: (err) => {
console.error('跳转失败:', err)
uni.showToast({ title: '跳转失败,请重试', icon: 'none' })
}
})
}, 1000)
} else {
uni.showToast({
title: result.data.message || '操作失败',
icon: 'none'
})
}
}).catch((error) => {
console.error('同意转诊失败:', error)
uni.showToast({
title: '操作失败,请重试',
icon: 'none'
})
})
}
}
})
},
// 拒绝转诊
handleTransferReject(transferData) {
uni.showModal({
title: '拒绝转诊',
content: '确定拒绝转诊吗?',
success: (res) => {
if (res.confirm) {
rejectTransferPrescriptionApi({ id: transferData.id }).then((result) => {
if (result.data.code == 0) {
uni.showToast({
title: '已拒绝转诊',
icon: 'success'
})
// 刷新列表
this.page = 1
this.infoList = []
this.getInfos()
} else {
uni.showToast({
title: result.data.message || '操作失败',
icon: 'none'
})
}
}).catch((error) => {
console.error('拒绝转诊失败:', error)
uni.showToast({
title: '操作失败,请重试',
icon: 'none'
})
})
}
}
})
},
// 就诊人列表
getInfolist() {
userList({
method: "post",
data: {
store_id: uni.getStorageSync('store_id') || 11001,
}
}).then((res) => {
if (res.data.errcode == 0) {
this.infoUserList = res.data.data.filter((item) => item.is_default == 1)
// console.log(this.infoUserList, 'info');
if (this.infoUserList != '') {
this.id = this.infoUserList[0].id
}
}
this.getInfos()
})
},
// 列表
getInfos() {
getRegisterListApi({
store_id: uni.getStorageSync('store_id') || 11001,
patient_id: this.id || '',
page: this.page
}).then((res) => {
// console.log(res, 'info');
if (res.data.code == 0) {
const data = res.data.result
// this.infoList = (data.list).reverse()
this.totalPage = data.pagination.totalPage
this.total = data.pagination.total
if (this.page > 1) {
this.infoList = [...this.infoList, ...data.list]
} else {
this.infoList = data.list
}
}
})
},
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
},
// 触底触发
onReachBottom() {
if (this.page < this.totalPage) {
this.page += 1
uni.showToast({
title: "加载中",
duration: 700,
mask: false,
icon: 'loading'
})
setTimeout(() => {
this.getInfos();
}, 700)
}
},
onPullDownRefresh() {
// console.log("触发了下拉刷新")
// if (this.page <= 1) return
if (this.page <= 1) {
this.getInfos();
setTimeout(() => {
uni.stopPullDownRefresh()
}, 300)
}
// if (this.page <= 1) return
this.page = 1
this.infoList = []
this.getInfos(() => uni.stopPullDownRefresh())
//重置一下数据
// this.page = 1
// //重新发起请求
// this.getOrder(() => uni.stopPullDownRefresh())
},
mounted() {
},
onShow() {
this.getInfolist();
}
}
</script>
<style lang="scss" scoped>
.container {
width: 750rpx;
min-height: 100vh;
max-height: 100%;
background-color: #F9FAFB;
padding-top: 32rpx;
padding-bottom: env(safe-area-inset-bottom);
.head {
width: 750rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 42rpx;
position: -webkit-sticky;
position: sticky;
top: var(--window-top);
z-index: 99;
margin-bottom: 10rpx;
background-color: #F9FAFB;
font-size: 28rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
.iconfont {
font-size: 28rpx;
margin-left: 10rpx;
}
}
.empty {
width: 440rpx;
height: 393rpx;
margin: 200rpx auto;
text-align: center;
image {
width: 100%;
height: 100%;
z-index: 10;
}
.word {
margin-top: 10rpx;
}
}
.list {
margin: 0rpx auto 30rpx;
width: 710rpx;
background: #FFFFFF;
border-radius: 8rpx;
padding: 32rpx;
.detail {
width: 648rpx;
display: flex;
justify-content: flex-end;
align-items: center;
text {
width: 160rpx;
height: 58rpx;
line-height: 52rpx;
text-align: center;
border-radius: 64rpx;
border: 1rpx solid #999999;
font-size: 28rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #999999;
}
}
.li_title {
width: 648rpx;
height: 76rpx;
line-height: 66rpx;
font-size: 28rpx;
margin: 0 auto;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #475569;
justify-content: space-between;
border-bottom: 2rpx solid #E2E8F0;
display: flex;
.text {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #4175EE;
}
.txt {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #FC3636;
}
}
.info {
width: 628rpx;
display: flex;
align-items: center;
margin: 40rpx auto;
.list_name {
width: 170rpx;
line-height: 40rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #94A3B8;
}
text {
width: 466rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #1E293B;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
overflow: hidden;
}
}
}
}
</style>