choosePatient.vue 4.7 KB

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