Member.vue 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <div class="page_patientManagement">
  3. <div class="patientBox">
  4. <van-list
  5. v-model="loading"
  6. :finished="finished"
  7. finished-text="没有更多了"
  8. @load="onLoad"
  9. >
  10. <div class="patientOne" v-for="(item,index) in patients" :key="index"
  11. @click="toPatientDetail(item.id)"
  12. >
  13. <img :src="item.avatar" alt />
  14. <p>{{ item.name }}</p>
  15. </div>
  16. </van-list>
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import { getAllMemberPatient, getMemberSearchPatient } from '@/api/patient/patient'
  23. export default {
  24. props: {
  25. searchValue: String
  26. },
  27. data () {
  28. return {
  29. loading: false,
  30. finished: false,
  31. limit: 10,
  32. page: 1,
  33. total: 0,
  34. patients: [],
  35. list: []
  36. }
  37. },
  38. methods: {
  39. getAllMemberPatient () {
  40. getAllMemberPatient(this.page, this.limit).then(response => {
  41. if (response.data.state === 1) {
  42. var patients = response.data.data.memberpatient
  43. // console.log('会员管理', patients)
  44. let arr = this.patients
  45. arr.push(...patients)
  46. this.patients = arr
  47. var total = response.data.data.total
  48. // console.log('total', total)
  49. this.total = total
  50. }
  51. })
  52. },
  53. onLoad () {
  54. setTimeout(() => {
  55. for (let i = 0; i < this.limit; i++) {
  56. this.list.push(this.list.length + 1)
  57. }
  58. // 加载状态结束
  59. this.loading = false
  60. if (this.patients.length > 10) {
  61. this.page++
  62. }
  63. this.getAllSlowPatient(this.page, this.limit)
  64. // 数据全部加载完成
  65. if (this.list.length >= this.total) {
  66. this.finished = true
  67. }
  68. }, 1000)
  69. },
  70. toPatientDetail (id) {
  71. this.$router.push('/patientdetail?patientid=' + id)
  72. },
  73. getMemberSearchPatient (value) {
  74. getMemberSearchPatient(value).then(response => {
  75. if (response.data.state === 1) {
  76. var memberpatient = response.data.data.memberPatient
  77. console.log('会员病人', memberpatient)
  78. }
  79. })
  80. }
  81. },
  82. created () {
  83. console.log(this.searchValue)
  84. if(this.searchValue){
  85. this.getMemberSearchPatient(this.searchValue)
  86. }else{
  87. this.getAllMemberPatient()
  88. }
  89. },
  90. watch: {
  91. searchValue (newVal) {
  92. console.log(newVal)
  93. this.getMemberSearchPatient(newVal)
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .page_patientManagement {
  100. overflow-y: auto;
  101. height: 100%;
  102. background: #fff;
  103. .patientManagementTitle {
  104. background: #fff;
  105. padding: 0 1.125rem;
  106. height: 3.125rem;
  107. display: flex;
  108. align-items: center;
  109. justify-content: space-between;
  110. }
  111. .jiantou {
  112. font-size: 1.5rem;
  113. font-weight: 600;
  114. margin-right: 3rem;
  115. }
  116. .titleName {
  117. font-size: 1.125rem;
  118. font-weight: 600;
  119. }
  120. .iconBox {
  121. display: flex;
  122. align-items: center;
  123. float: right;
  124. }
  125. .iconOne {
  126. font-size: 1.5rem;
  127. }
  128. .add {
  129. margin-left: 1.25rem;
  130. }
  131. .toolBox {
  132. display: flex;
  133. height: 3.125rem;
  134. align-items: center;
  135. .toolOne {
  136. width: 5.625rem;
  137. height: 1.875rem;
  138. background: rgba(246, 246, 246, 1);
  139. border-radius: 5px;
  140. text-align: center;
  141. font-size: 0.8125rem;
  142. color: #8d8d8d;
  143. display: flex;
  144. align-items: center;
  145. justify-content: space-around;
  146. margin-left: 0.875rem;
  147. }
  148. }
  149. .van-dropdown-menu__title {
  150. width: 5.625rem;
  151. height: 1.875rem;
  152. line-height: 1.875rem;
  153. background: rgba(246, 246, 246, 1);
  154. border-radius: 5px;
  155. color: #8d8d8d;
  156. font-size: 0.875rem;
  157. }
  158. .van-dropdown-menu__title::after {
  159. right: 0.5rem;
  160. }
  161. .patientBox {
  162. padding: 0 0.875rem;
  163. .patientOne {
  164. display: flex;
  165. align-items: center;
  166. height: 3.75rem;
  167. img {
  168. width: 2.5rem;
  169. height: 2.5rem;
  170. margin-right: 0.875rem;
  171. }
  172. }
  173. }
  174. }
  175. ::-webkit-scrollbar {
  176. width: 0;
  177. }
  178. </style>
  179. <style lang="scss">
  180. .page_patientManagement {
  181. .searchBox {
  182. .van-cell__value {
  183. display: flex;
  184. align-items: center;
  185. }
  186. .van-field__body {
  187. width: 100%;
  188. }
  189. }
  190. }
  191. </style>