index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="home">
  3. <TopCard :info="info" @update="onUpdate" />
  4. <!-- tab导航栏 -->
  5. <view class="tabs">
  6. <view v-for="(item, index) in navList" :key="index" class="tab" :class="{'is-active': tabCurId === item.id}"
  7. @click="tabClick(index)">
  8. {{item.text}}
  9. </view>
  10. </view>
  11. <swiper :current="tabCurId" class="swiper-box" duration="300" @change="onChangeTab">
  12. <swiper-item class="tab-content" v-for="(_tabItem,tabIndex) in navList" :key="tabIndex">
  13. <CfStatus v-if="tabCurId==0" />
  14. <CfLogistics v-if="tabCurId==1" />
  15. <CfContent v-if="tabCurId==2" />
  16. <CfAppraise v-if="tabCurId==3" />
  17. </swiper-item>
  18. </swiper>
  19. </view>
  20. </template>
  21. <script lang="ts" setup>
  22. import { ref, nextTick, onMounted } from 'vue'
  23. import rest from '@/stores/rest'
  24. import { BasicInfoVO } from '../../lib/type'
  25. import TopCard from './TopCard.vue'
  26. import CfStatus from './CfStatus.vue'
  27. import CfLogistics from './CfLogistics.vue'
  28. import CfContent from './CfContent.vue'
  29. import CfAppraise from './CfAppraise.vue'
  30. import {
  31. getSexByCardNo,
  32. maskCardNo,
  33. maskName,
  34. } from '@/lib/util'
  35. const topCardRef = ref()
  36. const originalInfo = ref({
  37. name: '',
  38. address: '',
  39. addressDetails:'',
  40. addr: '',
  41. sex: '',
  42. text: '近三个月就诊记录',
  43. idCard: '',
  44. date: ''
  45. })
  46. const info = ref({ ...originalInfo.value})
  47. const tabCurId = ref(2)//当前tab选中Id
  48. // const loaded = ref(false)
  49. // const status = ref('loading')
  50. // const loadText = ref('数据加载中...')
  51. const navList = ref([{
  52. id: 0,
  53. text: '处方状态',
  54. },
  55. {
  56. id: 1,
  57. text: '物流信息',
  58. },
  59. {
  60. id: 2,
  61. text: '处方内容',
  62. },
  63. {
  64. id: 3,
  65. text: '处方评价',
  66. }
  67. ])
  68. const swiperBoxStyle = () => {
  69. let _h = `calc(100% - 72rpx -
  70. cfListDtos: boolean;${topCardRef.value?.offsetHeight})`;
  71. console.log("_h", _h)
  72. return {
  73. height: '200px',
  74. };
  75. };
  76. //顶部tab点击
  77. const tabClick = (idx : number) => {
  78. tabCurId.value = idx;
  79. }
  80. //滑动标签页
  81. const onChangeTab = (e) => {
  82. let _inx = e.detail.current;
  83. tabClick(_inx);
  84. }
  85. const dataList = ref({
  86. hzsfzh: '510224196901293189',
  87. hzxm: '刘秀碧',
  88. })
  89. const cfDataList = ref([]) // 处方列表
  90. // 地址信息拼接
  91. const addressInfSplice = (basic:string, details:string, isShow) => {
  92. if (isShow) {
  93. return basic + details;
  94. } else {
  95. return basic + '*'.repeat(details.length);
  96. }
  97. }
  98. const getInfo = async () => {
  99. // todo 基础信息
  100. let basicInfo = await rest.get('/app-api/bmfw/findList',dataList.value) as BasicInfoVO
  101. console.log("基础信息", basicInfo)
  102. // todo 地址信息
  103. let addressInfo = await rest.get('/default/consignee-info/list',{hzid:dataList.value.hzsfzh})
  104. console.log("地址信息", addressInfo)
  105. if (Array.isArray(basicInfo) && basicInfo.length > 0) {
  106. const firstBasicInfo = basicInfo[0]
  107. originalInfo.value.name = firstBasicInfo.hzxm
  108. originalInfo.value.sex = getSexByCardNo(firstBasicInfo.hzsfzh)
  109. originalInfo.value.idCard = firstBasicInfo.hzsfzh
  110. originalInfo.value.date = firstBasicInfo.cfListDtos?.[0]?.kfrq || ''
  111. }
  112. if (Array.isArray(addressInfo) && addressInfo.length > 0) {
  113. const firstAddressInfo = addressInfo[0]
  114. originalInfo.value.address = `${firstAddressInfo.province || ''}${firstAddressInfo.city || ''}${firstAddressInfo.area || ''}`
  115. originalInfo.value.addressDetails = firstAddressInfo.shrdzxxdz
  116. }
  117. cfDataList.value = basicInfo[0]?.cfListDtos || []
  118. console.log("处方列表", cfDataList.value)
  119. onUpdate(false)
  120. }
  121. const onUpdate = (isMasked: boolean) => {
  122. info.value.name = isMasked ? maskName(originalInfo.value.name) : originalInfo.value.name
  123. info.value.addr = addressInfSplice(originalInfo.value.address, originalInfo.value.addressDetails, !isMasked)
  124. info.value.idCard = isMasked ? maskCardNo(originalInfo.value.idCard) : originalInfo.value.idCard
  125. info.value.sex = getSexByCardNo(originalInfo.value.idCard)
  126. info.value.date = originalInfo.value.date
  127. console.log("onUpdate", info.value)
  128. }
  129. onMounted(() => {
  130. getInfo()
  131. })
  132. </script>
  133. <style lang="scss" scoped>
  134. .home {
  135. display: flex;
  136. flex-direction: column;
  137. height: 100%;
  138. .tabs {
  139. margin: $uni-spacing-row-s4 0 $uni-spacing-row-s3;
  140. height: 88rpx;
  141. background-color: #fff;
  142. padding: 0 24rpx;
  143. @include flex-between;
  144. .tab {
  145. height: 100%;
  146. @include flex-center;
  147. &.is-active {
  148. color: $uni-color-primary;
  149. position: relative;
  150. &::after {
  151. content: '';
  152. position: absolute;
  153. bottom: 0;
  154. left: 0;
  155. background: $uni-color-primary;
  156. width: 100%;
  157. height: 4rpx;
  158. }
  159. }
  160. }
  161. }
  162. .swiper-box {
  163. flex: 1;
  164. .tab-content {
  165. :deep(.pub-loading) {
  166. height: 100%;
  167. }
  168. }
  169. }
  170. }
  171. </style>