index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <view class="cf-list-page">
  3. <TopCard :info="info" @update="onUpdate" />
  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">
  12. <view class="cf-item-title">
  13. <view><text class="label">开方日期</text>{{item.date}}</view>
  14. <view class="cf-item-title-addr" @click="link.goAddressList()">
  15. <text class="iconfont">&#xe692;</text>
  16. 填写收货地址
  17. </view>
  18. </view>
  19. <view class="row">
  20. <text class="label">处方状态</text>
  21. <!-- 签收/已快递/已发药 绿色, 其他全部橙色 -->
  22. <text class="cf-status" :class="true?'is-green':''">{{item.status}}</text>
  23. </view>
  24. <view class="row">
  25. <text class="label">医疗机构</text>{{item.jj}}
  26. </view>
  27. </view>
  28. </view>
  29. </pub-list-scroll>
  30. </view>
  31. </view>
  32. </template>
  33. <script lang="ts" setup>
  34. import { ref, onMounted } from 'vue'
  35. import dlg from '@/lib/dlg'
  36. import rest from '@/stores/rest'
  37. import * as link from '@/lib/link'
  38. import TopCard from '../index/TopCard.vue'
  39. const loaded = ref(false)
  40. const loadText = ref('数据加载中...')
  41. const status = ref('loading')
  42. const list = ref() //处方列表
  43. const queryParams = ref({
  44. pageNo: 1,
  45. pageSize: 10,
  46. total: 0,
  47. status: 2
  48. })
  49. const originalInfo = ref({
  50. name: '',
  51. address: '',
  52. addressDetails: '',
  53. addr: '',
  54. sex: '',
  55. text: '近三个月就诊记录',
  56. idCard: '',
  57. date: ''
  58. })
  59. const info = ref({ ...originalInfo.value })
  60. const _list = [{
  61. id: 1,
  62. date: '2024-08-22 14:30',
  63. status: '已调剂',
  64. jj: '重庆两江新区中医院1'
  65. },
  66. {
  67. id: 2,
  68. date: '2024-08-22 14:30',
  69. status: '已调剂',
  70. jj: '重庆两江新区中医院2'
  71. }, {
  72. id: 3,
  73. date: '2024-08-22 14:30',
  74. status: '已调剂',
  75. jj: '重庆两江新区中医院3'
  76. }, {
  77. id: 4,
  78. date: '2024-08-22 14:30',
  79. status: '已调剂',
  80. jj: '重庆两江新区中医院4'
  81. }, {
  82. id: 5,
  83. date: '2024-08-22 14:30',
  84. status: '已调剂',
  85. jj: '重庆两江新区中医院5'
  86. }, {
  87. id: 6,
  88. date: '2024-08-22 14:30',
  89. status: '已调剂',
  90. jj: '重庆两江新区中医院6'
  91. }, {
  92. id: 7,
  93. date: '2024-08-22 14:30',
  94. status: '已调剂',
  95. jj: '重庆两江新区中医院7'
  96. }, {
  97. id: 8,
  98. date: '2024-08-22 14:30',
  99. status: '已调剂',
  100. jj: '重庆两江新区中医院8'
  101. }, {
  102. id: 9,
  103. date: '2024-08-22 14:30',
  104. status: '已调剂',
  105. jj: '重庆两江新区中医院9'
  106. }, {
  107. id: 10,
  108. date: '2024-08-22 14:30',
  109. status: '已调剂',
  110. jj: '重庆两江新区中医院10'
  111. }]
  112. const getList = async () => {
  113. try {
  114. loaded.value = true;
  115. let res = ''
  116. if (!list.value) {
  117. list.value = _list;
  118. } else {
  119. list.value = list.value.concat(_list);
  120. }
  121. // queryParams.value.total = res.total
  122. // if (res.total && queryParams.value.pageNo >= queryParams.value.total / queryParams.value.pageSize) {
  123. // status.value = "noMore"
  124. // }
  125. } catch (e) {
  126. dlg.error(e)
  127. } finally {
  128. loaded.value = false;
  129. }
  130. }
  131. //下一页
  132. const onScrollTolower = async () => {
  133. console.log("onScrollTolower")
  134. if (!list.value || queryParams.value.pageNo > (queryParams.value.total / queryParams.value.pageSize)) {
  135. return false;
  136. }
  137. if (queryParams.value.pageNo < queryParams.value.total / queryParams.value.pageSize) {
  138. status.value = "loading";
  139. } else {
  140. status.value = "noMore"
  141. return;
  142. }
  143. queryParams.value.pageNo++;
  144. getList();
  145. }
  146. const onUpdate = (isMasked : boolean) => {
  147. }
  148. onMounted(() => {
  149. getList()
  150. })
  151. </script>
  152. <style lang="scss" scoped>
  153. .cf-list-page {
  154. display: flex;
  155. flex-direction: column;
  156. height: 100%;
  157. .cf-list-section {
  158. flex: 1;
  159. overflow-y: auto;
  160. margin-top: 32rpx;
  161. padding: 0 32rpx;
  162. .no-data {
  163. margin-top: 160rpx;
  164. @include flex-center;
  165. flex-direction: column;
  166. image {
  167. width: 320rpx;
  168. height: 320rpx;
  169. margin-bottom: 48rpx;
  170. color: $uni-text-color-light;
  171. }
  172. }
  173. .cf-list {
  174. .cf-item {
  175. background: #fff;
  176. margin-bottom: 24rpx;
  177. border-radius: 8rpx;
  178. padding: 24rpx 24rpx;
  179. .label {
  180. color: $uni-text-color-grey;
  181. margin-right: 32rpx;
  182. }
  183. .cf-item-title {
  184. border-bottom: 1px solid $uni-border-color;
  185. margin: 0 -24rpx;
  186. padding: 0 24rpx 24rpx;
  187. @include flex-between;
  188. .cf-item-title-addr {
  189. font-size: $uni-font-size-sm;
  190. line-height: $uni-line-height-sm;
  191. color: $uni-color-primary;
  192. @include flex;
  193. .iconfont {
  194. font-size: 40rpx;
  195. margin-right: 8rpx;
  196. }
  197. }
  198. }
  199. .row {
  200. margin-top: 16rpx;
  201. @include flex;
  202. .cf-status {
  203. height: 56rpx;
  204. padding: 0 32rpx;
  205. @include flex-center;
  206. color: $uni-color-orange;
  207. border-radius: 8rpx;
  208. background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), $uni-color-orange;
  209. &.is-green {
  210. color: $uni-color-green;
  211. background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), $uni-color-green;
  212. }
  213. }
  214. }
  215. }
  216. }
  217. ::v-deep .scroll-view {
  218. height: calc(100%);
  219. }
  220. }
  221. }
  222. </style>