index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="cf-list-page">
  3. <TopCard :data="queryParams" />
  4. <view class="cf-list-section">
  5. <pub-list-scroll @next="onScrollTolower" :loaded="loaded" :text="loadText" :status="status">
  6. <view class="no-data" v-if="!list || list.length == 0">
  7. <image mode="heightFix" src="/static/image/no-data.png" />
  8. 暂无数据
  9. </view>
  10. <view class="cf-list" v-else>
  11. <view v-for="(item,index) in list" :key="'cf'+index" class="cf-item" @click.native="cardClick(item)">
  12. <view class="cf-item-title">
  13. <view><text class="label">开方日期</text>{{item.kfrq}}</view>
  14. <view class="cf-item-title-addr" v-if="isShowTag(item)" @click="skipAddressList($event,item)">
  15. <text class="iconfont">&#xe692;</text>
  16. 填写收货地址
  17. </view>
  18. </view>
  19. <view class="row">
  20. <text class="label">处方状态</text>
  21. <!-- 已签收/已快递/已发药 绿色, 其他全部橙色 -->
  22. <text
  23. :class="['cf-status', { 'is-green': ['09', '10', '11'].includes(item.cfzt) }]">{{ DictLabelCFZT(item.cfzt) }}</text>
  24. </view>
  25. <view class="row">
  26. <text class="label">医疗机构</text>{{item.orgFullName}}
  27. </view>
  28. </view>
  29. </view>
  30. </pub-list-scroll>
  31. </view>
  32. </view>
  33. </template>
  34. <script lang="ts" setup>
  35. import { ref, onMounted } from 'vue'
  36. import { onLoad } from "@dcloudio/uni-app";
  37. import { aesEncrypt, aesDecrypt } from "@/lib/encryption";
  38. import dlg from '@/lib/dlg'
  39. import rest from '@/stores/rest'
  40. import TopCard from '../index/TopCard.vue'
  41. import { BasicInfoVO } from '../../lib/type'
  42. import { DictLabelCFZT } from '@/lib/util'
  43. import * as link from '@/lib/link'
  44. const loaded = ref(false)
  45. const loadText = ref('数据加载中...')
  46. const status = ref('loading')
  47. const list = ref() //处方列表
  48. const queryParams = ref({
  49. pageNo: 1,
  50. pageSize: 10,
  51. zjhm: '',
  52. hzxm:'',
  53. })
  54. const total = ref(0)
  55. const getList = async () => {
  56. try {
  57. loaded.value = true;
  58. let res = await rest.get('/app-api/bmfw/findList', queryParams.value) as BasicInfoVO
  59. console.log("基础信息", res)
  60. let _list = res.list
  61. if (!list.value) {
  62. list.value = _list;
  63. } else {
  64. list.value = list.value.concat(_list);
  65. }
  66. total.value = res.total
  67. if (res.total && queryParams.value.pageNo >= total.value / queryParams.value.pageSize) {
  68. status.value = "noMore"
  69. }
  70. } catch (e) {
  71. dlg.error(e)
  72. } finally {
  73. loaded.value = false;
  74. }
  75. }
  76. //下一页
  77. const onScrollTolower = async () => {
  78. console.log("onScrollTolower")
  79. if (!list.value || queryParams.value.pageNo > (total.value / queryParams.value.pageSize)) {
  80. return false;
  81. }
  82. if (queryParams.value.pageNo < total.value / queryParams.value.pageSize) {
  83. status.value = "loading";
  84. } else {
  85. status.value = "noMore"
  86. return;
  87. }
  88. queryParams.value.pageNo++;
  89. getList();
  90. }
  91. const cardClick = (item) => {
  92. link.goCFDetails(aesEncrypt(item.ptwybm),aesEncrypt(queryParams.value.zjhm),aesEncrypt(queryParams.value.hzxm))
  93. }
  94. const isShowTag = (item) => {
  95. if (['3', '5'].includes(item.fyfslx) && ['00', '001', '01', '02', '05', '06', '07', '08'].includes(item.cfzt)) {
  96. return true
  97. }
  98. return false
  99. }
  100. const skipAddressList = (event, item) => {
  101. event.stopPropagation();
  102. link.goAddressList(aesEncrypt(queryParams.value.zjhm), aesEncrypt(item.ptwybm))
  103. }
  104. onLoad((data) => {
  105. queryParams.value.zjhm = aesDecrypt(data.hzsfzh)
  106. queryParams.value.hzxm = aesDecrypt(data.hzxm)
  107. getList()
  108. })
  109. </script>
  110. <style lang="scss" scoped>
  111. .cf-list-page {
  112. display: flex;
  113. flex-direction: column;
  114. height: 100%;
  115. .cf-list-section {
  116. flex: 1;
  117. overflow-y: auto;
  118. margin-top: 32rpx;
  119. padding: 0 32rpx;
  120. .cf-list {
  121. .cf-item {
  122. background: #fff;
  123. margin-bottom: 24rpx;
  124. border-radius: 8rpx;
  125. padding: 24rpx 24rpx;
  126. .label {
  127. color: $uni-text-color-grey;
  128. margin-right: 32rpx;
  129. }
  130. .cf-item-title {
  131. border-bottom: 1px solid $uni-border-color;
  132. margin: 0 -24rpx;
  133. padding: 0 24rpx 24rpx;
  134. @include flex-between;
  135. .cf-item-title-addr {
  136. font-size: $uni-font-size-sm;
  137. line-height: $uni-line-height-sm;
  138. color: $uni-color-primary;
  139. @include flex;
  140. .iconfont {
  141. font-size: 40rpx;
  142. margin-right: 8rpx;
  143. }
  144. }
  145. }
  146. .row {
  147. margin-top: 16rpx;
  148. @include flex;
  149. .cf-status {
  150. height: 56rpx;
  151. padding: 0 32rpx;
  152. @include flex-center;
  153. color: $uni-color-orange;
  154. border-radius: 8rpx;
  155. font-size: $uni-font-size-sm;
  156. line-height: $uni-line-height-sm;
  157. background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), $uni-color-orange;
  158. &.is-green {
  159. color: $uni-color-green;
  160. background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), $uni-color-green;
  161. }
  162. }
  163. }
  164. }
  165. }
  166. ::v-deep .scroll-view {
  167. height: calc(100%);
  168. }
  169. }
  170. }
  171. </style>