index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="home">
  3. <TopCard />
  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 tabCurId = ref(2)//当前tab选中Id
  37. // const loaded = ref(false)
  38. // const status = ref('loading')
  39. // const loadText = ref('数据加载中...')
  40. const navList = ref([{
  41. id: 0,
  42. text: '处方状态',
  43. },
  44. {
  45. id: 1,
  46. text: '物流信息',
  47. },
  48. {
  49. id: 2,
  50. text: '处方内容',
  51. },
  52. {
  53. id: 3,
  54. text: '处方评价',
  55. }
  56. ])
  57. const swiperBoxStyle = () => {
  58. let _h = `calc(100% - 72rpx -
  59. cfListDtos: boolean;${topCardRef.value?.offsetHeight})`;
  60. console.log("_h", _h)
  61. return {
  62. height: '200px',
  63. };
  64. };
  65. //顶部tab点击
  66. const tabClick = (idx : number) => {
  67. tabCurId.value = idx;
  68. }
  69. //滑动标签页
  70. const onChangeTab = (e) => {
  71. let _inx = e.detail.current;
  72. tabClick(_inx);
  73. }
  74. onMounted(() => {
  75. })
  76. </script>
  77. <style lang="scss" scoped>
  78. .home {
  79. display: flex;
  80. flex-direction: column;
  81. height: 100%;
  82. .tabs {
  83. margin: $uni-spacing-row-s4 0 $uni-spacing-row-s3;
  84. height: 88rpx;
  85. background-color: #fff;
  86. padding: 0 24rpx;
  87. @include flex-between;
  88. .tab {
  89. height: 100%;
  90. @include flex-center;
  91. &.is-active {
  92. color: $uni-color-primary;
  93. position: relative;
  94. &::after {
  95. content: '';
  96. position: absolute;
  97. bottom: 0;
  98. left: 0;
  99. background: $uni-color-primary;
  100. width: 100%;
  101. height: 4rpx;
  102. }
  103. }
  104. }
  105. }
  106. .swiper-box {
  107. flex: 1;
  108. .tab-content {
  109. :deep(.pub-loading) {
  110. height: 100%;
  111. }
  112. }
  113. }
  114. }
  115. </style>