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;
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 {
// width: 100rpx;
height: 40rpx;
line-height: 40rpx;
text-align: center;
background: #FFFFFF;
border: 2rpx solid #FFA115;
border-radius: 5rpx;
font-size: 24rpx;
padding: 0 10rpx;
padding: 5rpx 10rpx;
color: #FFA115;
position: absolute;
bottom: 8%;

View File

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