xinelu-applet-ui/pagesB/managefamily/managefamily.vue
2024-07-10 09:10:50 +08:00

154 lines
4.1 KiB
Vue

<template>
<view class="app">
<view class="forlist">
<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 ?"未签约":'已签约'}}
</view>
</view>
<view class="primaryAccountFlag" v-if="Number(item.primaryAccountFlag)==0">
主账号
</view>
<view class="card">
{{item.cardNo}}
</view>
<view class="border"></view>
<view class="identityname" v-if="item.householdRelationship">
{{item.householdRelationship=='1'?"户主本人":''}}
{{item.householdRelationship=='2'?"配偶":''}}
{{item.householdRelationship=='3'?"子女":''}}
{{item.householdRelationship=='4'?"(外)孙子女":''}}
{{item.householdRelationship=='5'?"父母":''}}
{{item.householdRelationship=='6'?"(外)祖父母":''}}
{{item.householdRelationship=='7'?"兄弟姐妹":''}}
{{item.householdRelationship=='8'?"儿媳":''}}
{{item.householdRelationship=='9'?"女婿":''}}
{{item.householdRelationship=='10'?"孙子女":''}}
{{item.householdRelationship=='11'?"侄子女":''}}
{{item.householdRelationship=='12'?"曾孙子女":''}}
{{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">
<view class="text">
每位微信用户最多可以绑定8名家庭成员
</view>
<view class="btn" @tap="add">
添加家庭成员
</view>
</view>
<u-popup v-model="updatashow" mode="center" width="80%" height="400rpx" class="popup" closeable>
<view class="title">
提示
</view>
<view class="text">是否确认设置该用户为主账号?</view>
<view class="text" style="color: red;">
30天内只能设置一次
</view>
<view class="btns">
<view class="btn" @click="updatashow=false">
取消
</view>
<view class="btn" @click="updataconfirm" style="background-color: #26A888;color: #fff;">
确定
</view>
</view>
</u-popup>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
getCurrentUser,
editPrimaryAccountFlag
} from '@/api/pages/myinformation/myinformation.js';
export default {
data() {
return {
familyList: {},
updatashow: false,
updataitem: {},
};
},
onShow() {
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',
})
}
this.updatashow = false
})
},
// 获取成员
getpersnoal() {
getCurrentUser(uni.getStorageSync('openid')).then(res => {
this.familyList = res.data
})
},
// 添加家庭成员
add() {
if (uni.getStorageSync('openid')) {
uni.navigateTo({
url: '/pagesB/AddMembers/AddMembers'
})
}
},
gofamilymemberdetail(item) {
uni.navigateTo({
url: `/pagesB/familymemberdetail/familymemberdetail?patientCode=${item.patientCode}`
})
}
},
// onReachBottom() { //下滑加载
// if (this.couponlist.length >= this.total) {} else {
// this.pageNum++;
// selectCoupon(this.pageNum, this.pageSize, this.patientId, this.couponstatus).then(res => {
// res.rows.forEach(e => {
// this.couponlist.push(e)
// })
// })
// }
// },
onPullDownRefresh() { //下拉刷新
this.pageNum = 1;
this.getlist();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
}
</script>
<style lang="scss">
@import './managefamily.scss';
</style>