|
|
@@ -17,9 +17,7 @@
|
|
|
|
|
|
<view class="action-buttons">
|
|
|
<button class="action-btn primary" @click="viewHealthData(family)">健康数据</button>
|
|
|
- <button class="action-btn secondary" @click="viewHealthNews(family)">健康动态</button>
|
|
|
- <button class="action-btn secondary" @click="sendReminder(family)">发送提醒</button>
|
|
|
- <button class="action-btn secondary" @click="inviteRevisitInfo">邀请复诊</button>
|
|
|
+ <button class="action-btn danger" @click="unbindFamily(family)">解除绑定</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -34,7 +32,7 @@
|
|
|
import { ref } from 'vue'
|
|
|
import { onLoad, onShow } from '@dcloudio/uni-app'
|
|
|
import CustomNav from '@/components/custom-nav.vue'
|
|
|
-import { listUserBindingsByBoundUser, type UserBindingResponse, type UserBindingPageResponse } from '@/api/userBinding'
|
|
|
+import { listUserBindingsByBoundUser, deleteUserBinding, type UserBindingResponse, type UserBindingPageResponse } from '@/api/userBinding'
|
|
|
import { downloadAvatar } from '@/api/user'
|
|
|
import { avatarCache } from '@/utils/avatarCache'
|
|
|
|
|
|
@@ -150,26 +148,48 @@ const viewHealthData = (family: FamilyInfo) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const viewHealthNews = (family: FamilyInfo) => {
|
|
|
- uni.showToast({
|
|
|
- title: '健康动态功能开发中',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-const sendReminder = (family: FamilyInfo) => {
|
|
|
- uni.showToast({
|
|
|
- title: '发送提醒功能开发中',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-const inviteRevisitInfo = () => {
|
|
|
+const unbindFamily = (family: FamilyInfo) => {
|
|
|
uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '根据最新规定,家属不能主动邀请复诊。患者需要在患者端主动发起复诊请求。',
|
|
|
- showCancel: false,
|
|
|
- confirmText: '知道了'
|
|
|
+ title: '确认解除绑定',
|
|
|
+ content: `确定要解除与 ${family.boundUserNickname} 的绑定关系吗?`,
|
|
|
+ success: async (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ try {
|
|
|
+ uni.showLoading({ title: '正在解除绑定...' })
|
|
|
+
|
|
|
+ // 调用解除绑定接口
|
|
|
+ const response = await deleteUserBinding({
|
|
|
+ patientUserId: family.patientUserId,
|
|
|
+ boundUserId: family.boundUserId
|
|
|
+ })
|
|
|
+
|
|
|
+ uni.hideLoading()
|
|
|
+
|
|
|
+ const resp = response.data as any
|
|
|
+ if (resp && resp.code === 200) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '解除绑定成功',
|
|
|
+ icon: 'success'
|
|
|
+ })
|
|
|
+
|
|
|
+ // 重新加载家人列表
|
|
|
+ fetchFamilies()
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: resp?.message || '解除绑定失败',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ uni.hideLoading()
|
|
|
+ console.error('解除绑定失败:', error)
|
|
|
+ uni.showToast({
|
|
|
+ title: '解除绑定失败',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -270,6 +290,11 @@ onShow(() => {
|
|
|
color: #333;
|
|
|
}
|
|
|
|
|
|
+.danger {
|
|
|
+ background-color: #ff4757;
|
|
|
+ color: #fff;
|
|
|
+}
|
|
|
+
|
|
|
.empty-state {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|