choosePatient.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="patient-container">
  3. <view class="patient-box">
  4. <view class="patient-head">
  5. <view class="patient-title">选择就诊人</view>
  6. <view class="patient-title x-f addbtn" style="color: #fff;" @click="addPatient()"><uni-icons type="plusempty" size="36rpx" color="#fff"></uni-icons>添加</view>
  7. </view>
  8. <scroll-view scroll-x :scroll-into-view="scrollIntoView" :scroll-with-animation="true" class="patient-list" v-if="patientList&&patientList.length>0">
  9. <view :id="'patient_'+i" :class="current == i ? 'patient-item patient-active':'patient-item'" v-for="(item,i) in patientList" :key="item.patientId" @click="handlePatient(item,i)">
  10. <view style="display: flex;flex-direction: column;align-items: flex-start;justify-content: center;flex:1;overflow: hidden;">
  11. <view class="patient-name textOne">{{item.patientName}}</view>
  12. <view class="patient-info">
  13. <text class="text" v-if="item.sex==1">男</text>
  14. <text class="text" v-if="item.sex==2">女</text>
  15. <text class="text">{{$getAge(item.birthday)}}岁</text>
  16. </view>
  17. <uni-icons v-show="current == i" class="checkmarkempty" type="checkmarkempty" size="28rpx" color="#fff"></uni-icons>
  18. </view>
  19. </view>
  20. <view :id="'patient_'+patientList.length" class="patient-item" @click="addPatient()">
  21. <view class="additem">
  22. <uni-icons type="plusempty" size="36rpx" color="#2583EB" style="font-weight: bold;"></uni-icons>
  23. <view class="patient-name" style="color: #2583EB;margin-bottom: 0;margin-top: 8rpx;">添加</view>
  24. </view>
  25. </view>
  26. </scroll-view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {getPatientList} from '@/api/patient'
  32. export default {
  33. props: ['patient'],
  34. data() {
  35. return {
  36. current: 0,
  37. scrollIntoView: 'patient_0',
  38. patientList: [],
  39. }
  40. },
  41. methods: {
  42. getPatientList(){
  43. uni.showLoading({
  44. title:"正在加载中"
  45. })
  46. getPatientList().then(res => {
  47. uni.hideLoading()
  48. if(res.code==200){
  49. this.patientList=res.data;
  50. if(this.patient&&this.patient.patientId) {
  51. const index = this.patientList.findIndex(item=>item.patientId == this.patient.patientId)
  52. this.current = index > -1 ? index : 0
  53. } else {
  54. this.current = 0
  55. }
  56. const patient = this.patientList&&this.patientList.length> 0 ? this.patientList[this.current] : null
  57. this.scrollIntoView = 'patient_'+ this.current
  58. uni.$emit('refreshOrderPatient',patient)
  59. }else{
  60. uni.showToast({
  61. icon:'none',
  62. title: "请求失败",
  63. });
  64. }
  65. },
  66. rej => {}
  67. );
  68. },
  69. addPatient() {
  70. this.$emit('addPatient')
  71. },
  72. handlePatient(item,i) {
  73. const patient = this.patientList&&this.patientList.length> 0 ? this.patientList[i] : null
  74. this.current = i
  75. this.scrollIntoView = 'patient_'+ i
  76. uni.$emit('refreshOrderPatient',patient)
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. @mixin u-flex($flexD, $alignI, $justifyC) {
  83. display: flex;
  84. flex-direction: $flexD;
  85. align-items: $alignI;
  86. justify-content: $justifyC;
  87. }
  88. .additem {
  89. text-align: center;
  90. color: #2583EB !important;
  91. @include u-flex(column, center, center);
  92. height: 100%;
  93. }
  94. .addbtn {
  95. background-color: #2583EB;
  96. padding: 5rpx 10rpx;
  97. box-sizing: border-box;
  98. border-radius: 10rpx;
  99. }
  100. .patient{
  101. &-container {
  102. padding: 15rpx;
  103. }
  104. &-box {
  105. padding: 30rpx 24rpx;
  106. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  107. background-color: #fff;
  108. border-radius: 15rpx;
  109. }
  110. &-head {
  111. @include u-flex(row, center, space-between);
  112. font-size: 26rpx;
  113. font-family: PingFang SC;
  114. color: #222;
  115. }
  116. &-title {
  117. font-size: 32rpx;
  118. font-weight: bold;
  119. }
  120. &-list {
  121. margin-top: 20rpx;
  122. white-space: nowrap;
  123. width: 100%;
  124. }
  125. &-item {
  126. width: 200rpx;
  127. margin-right: 16rpx;
  128. display: inline-block;
  129. box-sizing: border-box;
  130. padding: 10rpx 16rpx;
  131. border-radius: 12rpx;
  132. border: 1px solid #eee;
  133. font-size: 26rpx;
  134. font-family: PingFang SC;
  135. color: #999;
  136. position: relative;
  137. }
  138. &-active{
  139. border: 1px solid #2583EB;
  140. &::after {
  141. position: absolute;
  142. bottom: 0;
  143. right: 0;
  144. content: "";
  145. height: 0;
  146. width: 0;
  147. border-top: 24rpx solid transparent;
  148. border-right: 24rpx solid #2583EB;
  149. border-bottom: 24rpx solid #2583EB;
  150. border-left: 24rpx solid transparent;
  151. border-radius: 0 0 12rpx 0;
  152. }
  153. }
  154. &-name {
  155. width: 100%;
  156. overflow: hidden;
  157. margin-bottom: 10rpx;
  158. font-size: 30rpx;
  159. font-weight: bold;
  160. color: #222;
  161. }
  162. &-info {
  163. @include u-flex(row, center, flex-start);
  164. .text{
  165. margin-right: 19upx;
  166. }
  167. }
  168. }
  169. .checkmarkempty {
  170. position: absolute;
  171. bottom: 0;
  172. right: 0;
  173. z-index: 2;
  174. }
  175. </style>