choosePatient.vue 4.7 KB

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