index.vue 3.9 KB

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