index.vue 5.2 KB

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