TopCard.vue 4.9 KB

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