TopCard.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view class="top-card" v-if="info">
  3. <view class="card-top">
  4. <image mode="heightFix" src="/static/image/head.png" />
  5. <view class="card-top-right">
  6. <view class="card-top-right-name">{{info.name}}<text class="iconfont" @click="onClick">{{ showIcon ? '&#xe8bf;' : '&#xe901;' }}</text></view>
  7. <view>{{info.addr}}<text class="iconfont">&#xe6ae;</text></view>
  8. <view class="card-top-right-sex">{{info.sex}} | {{info.text}}</view>
  9. </view>
  10. </view>
  11. <view class="card-bottom">
  12. <view>
  13. <view class="label">证件号码</view>
  14. <view>{{info.idCard}}</view>
  15. </view>
  16. <view class="second">
  17. <view class="label">最近就诊</view>
  18. <view>{{info.date}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script lang="ts" setup>
  24. import { ref, onMounted } from 'vue'
  25. import rest from '@/stores/rest'
  26. import {
  27. getSexByCardNo,
  28. maskCardNo,
  29. maskName,
  30. } from '@/lib/util'
  31. const showIcon = ref(false)
  32. const originalInfo = ref({
  33. name: '',
  34. address: '',
  35. addressDetails:'',
  36. addr: '',
  37. sex: '',
  38. text: '近三个月就诊记录',
  39. idCard: '',
  40. date: ''
  41. })
  42. const info = ref({ ...originalInfo.value})
  43. const dataList = ref({
  44. hzsfzh: '510224196901293189',
  45. hzxm: '刘秀碧',
  46. })
  47. const onClick = ()=> {
  48. showIcon.value = !showIcon.value
  49. onUpdate(showIcon.value)
  50. }
  51. // 地址信息拼接
  52. const addressInfSplice = (basic:string, details:string, isShow) => {
  53. if (isShow) {
  54. return basic + details;
  55. } else {
  56. return basic + '*'.repeat(details.length);
  57. }
  58. }
  59. const getInfo = async () => {
  60. // todo 基础信息
  61. let basicInfo = await rest.get('/app-api/bmfw/findList',dataList.value) as BasicInfoVO
  62. console.log("基础信息", basicInfo)
  63. // todo 地址信息
  64. let addressInfo = await rest.get('/default/consignee-info/list',{hzid:dataList.value.hzsfzh})
  65. console.log("地址信息", addressInfo)
  66. if (Array.isArray(basicInfo) && basicInfo.length > 0) {
  67. const firstBasicInfo = basicInfo[0]
  68. originalInfo.value.name = firstBasicInfo.hzxm
  69. originalInfo.value.sex = getSexByCardNo(firstBasicInfo.hzsfzh)
  70. originalInfo.value.idCard = firstBasicInfo.hzsfzh
  71. originalInfo.value.date = firstBasicInfo.cfListDtos?.[0]?.kfrq || ''
  72. }
  73. if (Array.isArray(addressInfo) && addressInfo.length > 0) {
  74. const firstAddressInfo = addressInfo[0]
  75. originalInfo.value.address = `${firstAddressInfo.province || ''}${firstAddressInfo.city || ''}${firstAddressInfo.area || ''}`
  76. originalInfo.value.addressDetails = firstAddressInfo.shrdzxxdz
  77. }
  78. onUpdate(false)
  79. }
  80. const onUpdate = (isMasked: boolean) => {
  81. Object.assign(info.value, {
  82. name: isMasked ? maskName(originalInfo.value.name) : originalInfo.value.name,
  83. addr: addressInfSplice(originalInfo.value.address, originalInfo.value.addressDetails, !isMasked),
  84. idCard: isMasked ? maskCardNo(originalInfo.value.idCard) : originalInfo.value.idCard,
  85. sex: getSexByCardNo(originalInfo.value.idCard),
  86. date: originalInfo.value.date
  87. })
  88. }
  89. onMounted(() => {
  90. getInfo()
  91. })
  92. </script>
  93. <style lang="scss" scoped>
  94. .top-card {
  95. border-radius: 0px 0px $uni-spacing-row-s2 $uni-spacing-row-s2;
  96. background: $uni-color-primary;
  97. padding: $uni-spacing-col-s2 $page-row-spacing $uni-spacing-col-s4;
  98. border: 1px solid $uni-border-color;
  99. .card-top {
  100. @include flex;
  101. margin-bottom: $uni-spacing-col-s4;
  102. color: #fff;
  103. image {
  104. width: 140rpx;
  105. height: 140rpx;
  106. display: block;
  107. margin-right: $uni-spacing-row-s4;
  108. }
  109. .card-top-right {
  110. flex: 1;
  111. line-height: $uni-line-height-base;
  112. .iconfont {
  113. margin-left: 8rpx;
  114. }
  115. .card-top-right-name {
  116. font-size: $uni-font-size-xxxl;
  117. line-height: $uni-line-height-xxxl;
  118. display: flex;
  119. align-items: center;
  120. .iconfont {
  121. line-height: $uni-line-height-xxxl;
  122. font-size: 32rpx;
  123. }
  124. }
  125. .card-top-right-sex {
  126. font-size: $uni-font-size-sm;
  127. line-height: $uni-line-height-sm;
  128. }
  129. }
  130. }
  131. .card-bottom {
  132. background-color: #fff;
  133. color: $uni-text-color;
  134. border-radius: $uni-spacing-row-s2;
  135. padding: $uni-spacing-row-s4;
  136. line-height: $uni-line-height-base;
  137. @include flex;
  138. >view {
  139. flex: 1;
  140. @include flex;
  141. flex-direction: column;
  142. }
  143. .label {
  144. color: $uni-text-color-grey;
  145. margin-bottom: 24rpx;
  146. }
  147. .second {
  148. position: relative;
  149. &::before {
  150. content: '';
  151. position: absolute;
  152. left: 0;
  153. background: $uni-border-color;
  154. width: 1px;
  155. height: 80rpx;
  156. -webkit-transform: scaleX(0.5);
  157. transform: scaleX(0.5);
  158. -webkit-transform-origin: 0 0;
  159. transform-origin: 0 0;
  160. }
  161. }
  162. }
  163. }
  164. </style>