familyMemberVindicate.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view class="common_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header :title="title" bgColor="#FFFFFF"></cus-header>
  4. <view class="form">
  5. <view class="title">家庭人员信息</view>
  6. <view class="pre adfac" style="margin-top: 40rpx;">
  7. <view class="pre-title"><span>*</span>人员类型</view>
  8. <view class="pre-content adfac">
  9. <view class="pre-content-box adfac" @click="changeMember(1,'personnelType')">
  10. <image v-if="memberInfo.personnelType==1" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/9efae012-a9fd-4a0d-9e14-7ec90001e712.png"></image>
  11. <image v-else src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/5ae64305-d1e0-4ffe-8dc0-f9d3704ac370.png"></image>
  12. <text>成人</text>
  13. </view>
  14. <view class="pre-content-box adfac" @click="changeMember(2,'personnelType')">
  15. <image v-if="memberInfo.personnelType==2" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/9efae012-a9fd-4a0d-9e14-7ec90001e712.png"></image>
  16. <image v-else src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/5ae64305-d1e0-4ffe-8dc0-f9d3704ac370.png"></image>
  17. <text>学生</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="pre adfac">
  22. <view class="pre-title"><span>*</span>姓名</view>
  23. <view class="pre-content">
  24. <up-input v-model="memberInfo.name" border="none" style="font-size: 30rpx;color: #252525;" placeholder="请输入姓名"></up-input>
  25. </view>
  26. </view>
  27. <view class="pre adfac">
  28. <view class="pre-title"><span>*</span>身份证</view>
  29. <view class="pre-content">
  30. <up-input v-model="memberInfo.idCard" border="none" style="font-size: 30rpx;color: #252525;" placeholder="请输入身份证"></up-input>
  31. </view>
  32. </view>
  33. <view class="pre adfac">
  34. <view class="pre-title"><span style="color: #FFFFFF;">*</span>义工号</view>
  35. <view class="pre-content">
  36. <up-input v-model="memberInfo.volunteerNo" border="none" style="font-size: 30rpx;color: #252525;" placeholder="请输入义工号"></up-input>
  37. </view>
  38. </view>
  39. <view class="pre adfac">
  40. <view class="pre-title"><span>*</span>性别</view>
  41. <view class="pre-content adfac">
  42. <view class="pre-content-box adfac" @click="changeMember(0,'gender')">
  43. <image v-if="memberInfo.gender==0" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/9efae012-a9fd-4a0d-9e14-7ec90001e712.png"></image>
  44. <image v-else src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/5ae64305-d1e0-4ffe-8dc0-f9d3704ac370.png"></image>
  45. <text>男</text>
  46. </view>
  47. <view class="pre-content-box adfac" @click="changeMember(1,'gender')">
  48. <image v-if="memberInfo.gender==1" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/9efae012-a9fd-4a0d-9e14-7ec90001e712.png"></image>
  49. <image v-else src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/09/5ae64305-d1e0-4ffe-8dc0-f9d3704ac370.png"></image>
  50. <text>女</text>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="pre adfac" v-if="memberInfo.personnelType==2">
  55. <view class="pre-title"><span>*</span>就读学校</view>
  56. <view class="pre-content">
  57. <up-input v-model="memberInfo.currentSchool" border="none" style="font-size: 30rpx;color: #252525;" placeholder="请输入就读学校"></up-input>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="btn" @click="handleSave">保存</view>
  62. </view>
  63. </template>
  64. <script setup name="">
  65. import CusHeader from '@/components/CusHeader/index.vue'
  66. import { onLoad } from '@dcloudio/uni-app'
  67. import { ref, getCurrentInstance } from 'vue'
  68. const { proxy } = getCurrentInstance()
  69. const title = ref('添加家庭成员')
  70. const memberInfo = ref({
  71. userId:'',
  72. personnelType:1,
  73. name:'',
  74. idCard:'',
  75. volunteerNo:'',
  76. gender:0,
  77. currentSchool:''
  78. })
  79. const changeMember = (value,key) => {
  80. memberInfo.value[key] = value;
  81. }
  82. const handleSave = () => {
  83. if(!memberInfo.value.name) return proxy.$showToast('请输入姓名')
  84. if(!proxy.$reg.idCard(memberInfo.value.idCard)) return proxy.$showToast('请输入正确的身份证号')
  85. if(!memberInfo.value.currentSchool&&memberInfo.value.personnelType==2) return proxy.$showToast('请输入就读学校')
  86. memberInfo.value.gender = memberInfo.value.gender??1;
  87. if(!memberInfo.value.userId) memberInfo.value.userId = JSON.parse(uni.getStorageSync('userInfo')).id;
  88. proxy.$api[memberInfo.value.id?'put':'post']('/core/family/member',memberInfo.value).then(({data:res})=>{
  89. if(res.code!==0) return proxy.$showToast(res.msg)
  90. proxy.$showToast(memberInfo.value.id?'编辑成功':'添加成功')
  91. setTimeout(()=>{
  92. uni.redirectTo({
  93. url:'/pagesMy/familyMember'
  94. })
  95. },1000)
  96. })
  97. }
  98. const getMemberInfo = (id) => {
  99. proxy.$api.get(`/core/family/member/${id}`).then(({data:res})=>{
  100. if(res.code!==0) return proxy.$showToast(res.msg)
  101. if(res.data){
  102. memberInfo.value = {...memberInfo.value,...res.data}
  103. }
  104. })
  105. }
  106. onLoad((options)=>{
  107. const id = options?.id;
  108. if(id){
  109. title.value = '编辑家庭成员';
  110. getMemberInfo(id)
  111. }
  112. })
  113. </script>
  114. <style scoped lang="scss">
  115. .common_page{
  116. padding-bottom: 184rpx;
  117. .form{
  118. background: #FFFFFF;
  119. border-radius: 24rpx;
  120. margin-top: 20rpx;
  121. padding: 36rpx 24rpx 0;
  122. .title{
  123. font-family: PingFang-SC, PingFang-SC;
  124. font-weight: bold;
  125. font-size: 36rpx;
  126. color: #151B29;
  127. line-height: 48rpx;
  128. }
  129. .pre{
  130. padding: 25rpx 0;
  131. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #F2F2F2;
  132. &-title{
  133. width: 209rpx;
  134. font-family: PingFangSC, PingFang SC;
  135. font-weight: 400;
  136. font-size: 28rpx;
  137. color: #676775;
  138. line-height: 40rpx;
  139. label{
  140. font-family: PingFangSC, PingFang SC;
  141. font-weight: 400;
  142. font-size: 30rpx;
  143. color: #F4657A;
  144. line-height: 42rpx;
  145. margin-right: 4rpx;
  146. }
  147. }
  148. &-content{
  149. width: calc(100% - 209rpx);
  150. &-box{
  151. width: 184rpx;
  152. image{
  153. width: 28rpx;
  154. height: 28rpx;
  155. }
  156. text{
  157. font-family: PingFangSC, PingFang SC;
  158. font-weight: 400;
  159. font-size: 30rpx;
  160. color: #252525;
  161. line-height: 42rpx;
  162. margin-left: 16rpx;
  163. }
  164. }
  165. }
  166. }
  167. }
  168. .btn{
  169. width: calc(100% - 80rpx);
  170. height: 90rpx;
  171. background: #B7F358;
  172. border-radius: 45rpx;
  173. font-family: PingFang-SC, PingFang-SC;
  174. font-weight: bold;
  175. font-size: 32rpx;
  176. color: #151B29;
  177. line-height: 90rpx;
  178. text-align: center;
  179. letter-spacing: 2rpx;
  180. position: fixed;
  181. left: 40rpx;
  182. bottom: 64rpx;
  183. }
  184. }
  185. </style>