TopCard.vue 5.1 KB

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