index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <view class="cf-list-page">
  3. <TopCard :data="queryParams" />
  4. <view class="cf-list-section">
  5. <pub-list-scroll ref="pubListScrollRef" @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>{{ formatDate(item.kfrq,'{y}-{m}-{d} {h}:{i}:{s}')}}</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 } from 'vue'
  36. import { onLoad, onShow } 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,globalState,formatDate } from '@/lib/util'
  43. import * as link from '@/lib/link'
  44. const shrdzxxdz = ref()
  45. const pubListScrollRef = ref(null)
  46. const loaded = ref(false)
  47. const loadText = ref('数据加载中...')
  48. const status = ref('loading')
  49. const list = ref() //处方列表
  50. const queryParams = ref({
  51. pageNo: 1,
  52. pageSize: 10,
  53. zjhm: '',
  54. hzxm:'',
  55. })
  56. const total = ref(0)
  57. const getList = async () => {
  58. try {
  59. loaded.value = true;
  60. let res = await rest.get('/app-api/bmfw/findList', queryParams.value) as BasicInfoVO
  61. console.log("基础信息", res)
  62. let _list = res.list
  63. if (queryParams.value.pageNo === 1) {
  64. list.value = _list;
  65. } else {
  66. list.value = list.value.concat(_list);
  67. }
  68. // 最近就诊
  69. if (list.value.length > 0){
  70. const firstBasicInfo = list.value[0]
  71. globalState.lastVisitDate = formatDate(firstBasicInfo.kfrq, '{y}-{m}-{d}')
  72. }
  73. total.value = res.total
  74. if (res.total && queryParams.value.pageNo >= total.value / queryParams.value.pageSize) {
  75. status.value = "noMore"
  76. }
  77. // 重置滚动位置
  78. if (queryParams.value.pageNo === 1) {
  79. pubListScrollRef.value.goTop()
  80. }
  81. } catch (e) {
  82. dlg.error(e)
  83. } finally {
  84. loaded.value = false;
  85. }
  86. }
  87. //下一页
  88. const onScrollTolower = async () => {
  89. console.log("onScrollTolower")
  90. if (!list.value || queryParams.value.pageNo > (total.value / queryParams.value.pageSize)) {
  91. return false;
  92. }
  93. if (queryParams.value.pageNo < total.value / queryParams.value.pageSize) {
  94. status.value = "loading";
  95. } else {
  96. status.value = "noMore"
  97. return;
  98. }
  99. queryParams.value.pageNo++;
  100. getList();
  101. }
  102. const cardClick = (item) => {
  103. link.goCFDetails(aesEncrypt(item.ptwybm),aesEncrypt(queryParams.value.zjhm),aesEncrypt(queryParams.value.hzxm))
  104. }
  105. const isShowTag = (item) => {
  106. if (['3', '5'].includes(item.fyfslx) && ['00', '001', '01', '02', '05', '06', '07', '08'].includes(item.cfzt)) {
  107. return true
  108. }
  109. return false
  110. }
  111. const skipAddressList = (event, item) => {
  112. event.stopPropagation();
  113. link.goAddressList(aesEncrypt(queryParams.value.zjhm), aesEncrypt(item.ptwybm))
  114. }
  115. onLoad((data) => {
  116. queryParams.value.zjhm = aesDecrypt(data.hzsfzh)
  117. queryParams.value.hzxm = aesDecrypt(data.hzxm)
  118. })
  119. onShow(() => {
  120. queryParams.value.pageNo = 1;
  121. getList()
  122. })
  123. </script>
  124. <style lang="scss" scoped>
  125. .cf-list-page {
  126. display: flex;
  127. flex-direction: column;
  128. height: 100%;
  129. .cf-list-section {
  130. flex: 1;
  131. overflow-y: auto;
  132. margin-top: 32rpx;
  133. padding: 0 32rpx;
  134. .cf-list {
  135. .cf-item {
  136. background: #fff;
  137. margin-bottom: 24rpx;
  138. border-radius: 8rpx;
  139. padding: 24rpx 24rpx;
  140. .label {
  141. color: $uni-text-color-grey;
  142. margin-right: 32rpx;
  143. }
  144. .cf-item-title {
  145. border-bottom: 1px solid $uni-border-color;
  146. margin: 0 -24rpx;
  147. padding: 0 24rpx 24rpx;
  148. @include flex-between;
  149. .cf-item-title-addr {
  150. font-size: $uni-font-size-sm;
  151. line-height: $uni-line-height-sm;
  152. color: $uni-color-primary;
  153. @include flex;
  154. .iconfont {
  155. font-size: 40rpx;
  156. margin-right: 8rpx;
  157. }
  158. }
  159. }
  160. .row {
  161. margin-top: 16rpx;
  162. @include flex;
  163. .cf-status {
  164. height: 56rpx;
  165. padding: 0 32rpx;
  166. @include flex-center;
  167. color: $uni-color-orange;
  168. border-radius: 8rpx;
  169. font-size: $uni-font-size-sm;
  170. line-height: $uni-line-height-sm;
  171. background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), $uni-color-orange;
  172. &.is-green {
  173. color: $uni-color-green;
  174. background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), $uni-color-green;
  175. }
  176. }
  177. }
  178. }
  179. }
  180. ::v-deep .scroll-view {
  181. height: calc(100%);
  182. }
  183. }
  184. }
  185. </style>