This commit is contained in:
2024-03-20 09:54:20 +08:00
parent 90ab3585d9
commit 340ff4afd7
3 changed files with 91 additions and 30 deletions

View File

@ -57,3 +57,15 @@ export function switchResident(openid,patientCode) {
}, },
}) })
} }
//设置主账号
export function editPrimaryAccountFlag(data) {
return request({
url: `/applet/register/editPrimaryAccountFlag`,
method: 'put',
data,
header: {
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
},
})
}

View File

@ -40,16 +40,39 @@
height: 310rpx; height: 310rpx;
position: relative; position: relative;
.primaryAccountFlag{
text-align: center;
background: #FFFFFF;
border: 2rpx solid #26A888;
border-radius: 5rpx;
font-size: 24rpx;
padding: 5rpx 10rpx;
color: #26A888;
position: absolute;
top: 30%;
right: 7%;
}
.button{
text-align: center;
border: 2rpx solid #26A888;
border-radius: 5rpx;
font-size: 24rpx;
padding: 5rpx 10rpx;
color: #fff;
background-color: #26A888;
position: absolute;
bottom: 8%;
right: 7%;
}
.identityname { .identityname {
// width: 100rpx;
height: 40rpx;
line-height: 40rpx;
text-align: center; text-align: center;
background: #FFFFFF; background: #FFFFFF;
border: 2rpx solid #FFA115; border: 2rpx solid #FFA115;
border-radius: 5rpx; border-radius: 5rpx;
font-size: 24rpx; font-size: 24rpx;
padding: 0 10rpx; padding: 5rpx 10rpx;
color: #FFA115; color: #FFA115;
position: absolute; position: absolute;
bottom: 8%; bottom: 8%;

View File

@ -1,15 +1,18 @@
<template> <template>
<view class="app"> <view class="app">
<view class="forlist"> <view class="forlist">
<view class="item" @tap='gofamilymemberdetail(item)' v-for="item in familyList"> <view class="item" @click.stop='gofamilymemberdetail(item)' v-for="item in familyList">
<view class="namesigning"> <view class="namesigning">
<span class="name"> <span class="name">
{{item.patientName}} {{item.patientName}}
</span> </span>
<view class="signing"> <view class="signing">
{{item.signNo==null ?"未签约":'已签约'}} {{!item.signNo ?"未签约":'已签约'}}
</view> </view>
</view> </view>
<view class="primaryAccountFlag">
{{Number(item.primaryAccountFlag)==0?'主账号':''}}
</view>
<view class="card"> <view class="card">
{{item.cardNo}} {{item.cardNo}}
</view> </view>
@ -30,6 +33,9 @@
{{item.householdRelationship=='13'?"祖父母":''}} {{item.householdRelationship=='13'?"祖父母":''}}
{{item.householdRelationship=='99'?"其他":''}} {{item.householdRelationship=='99'?"其他":''}}
</view> </view>
<view class="button" @click.stop="updata(item)" v-if='Number(item.primaryAccountFlag)!=0'>
设置为主账号
</view>
</view> </view>
</view> </view>
<view class="bottom"> <view class="bottom">
@ -40,34 +46,57 @@
添加家庭成员 添加家庭成员
</view> </view>
</view> </view>
<u-modal v-model="updatashow" content="是否确认设置该用户为主账号?" :show-cancel-button='true'
@confirm='updataconfirm'></u-modal>
<u-toast ref="uToast" />
</view> </view>
</template> </template>
<script> <script>
import { import {
getCurrentUser, getCurrentUser,
editPrimaryAccountFlag
} from '@/api/pages/myinformation/myinformation.js'; } from '@/api/pages/myinformation/myinformation.js';
export default { export default {
data() { data() {
return { return {
familyList: {}, familyList: {},
valueopenid:'', updatashow: false,
updataitem: {},
}; };
}, },
onShow() { onShow() {
this.valueopenid = uni.getStorageSync('openid');
this.getpersnoal() this.getpersnoal()
}, },
methods: { methods: {
updata(item) {
this.updataitem = item
this.updatashow = true
},
updataconfirm() {
var obj = {
cardNo: this.updataitem.cardNo,
bindOpenId: uni.getStorageSync('openid'),
}
editPrimaryAccountFlag(obj).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '设置主账号成功',
type: 'success',
})
this.getpersnoal()
} else {
this.$refs.uToast.show({
title: res.msg,
type: 'error',
})
}
})
},
// //
getpersnoal() { getpersnoal() {
getCurrentUser(this.valueopenid).then(res => { getCurrentUser(uni.getStorageSync('openid')).then(res => {
console.log(res)
this.familyList = res.data this.familyList = res.data
}) })
}, },
// //
@ -75,11 +104,8 @@
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/AddMembers/AddMembers' url: '/pagesB/AddMembers/AddMembers'
}) })
}, },
gofamilymemberdetail(item) { gofamilymemberdetail(item) {
console.log((item))
uni.navigateTo({ uni.navigateTo({
url: `/pagesB/familymemberdetail/familymemberdetail?patientCode=${item.patientCode}` url: `/pagesB/familymemberdetail/familymemberdetail?patientCode=${item.patientCode}`
}) })