| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 | 
							- <template>
 
- 	<view class="patient-container">
 
- 		<view class="patient-box">
 
- 			<view class="patient-head">
 
- 				<view class="patient-title">选择就诊人</view>
 
- 				<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>
 
- 			</view>
 
- 			<scroll-view scroll-x :scroll-into-view="scrollIntoView" :scroll-with-animation="true" class="patient-list" v-if="patientList&&patientList.length>0">
 
- 				<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)">
 
- 					<view style="display: flex;flex-direction: column;align-items: flex-start;justify-content: center;flex:1;overflow: hidden;">
 
- 						<view class="patient-name one-t">{{item.patientName}}</view>
 
- 						<view class="patient-info">
 
- 							<text class="text" v-if="item.sex==1">男</text>
 
- 							<text class="text" v-if="item.sex==2">女</text>
 
- 							<text class="text">{{$getAge(item.birthday)}}岁</text>
 
- 						</view>
 
- 						<view class="checkmarkempty">
 
- 							<u-icon v-show="current == i" name="checkmark" size="28rpx" color="#fff"></u-icon>
 
- 						</view>
 
- 					</view>
 
- 				</view>
 
- 				<view :id="'patient_'+patientList.length" class="patient-item"  @click="addPatient()">
 
- 					<view class="additem">
 
- 						<u-icon name="plus" size="36rpx" color="#FF5C03" :bold="true"></u-icon>
 
- 						<view class="patient-name" style="color: #ff5c03;margin-bottom: 0;margin-top: 10rpx;">添加</view>
 
- 					</view>
 
- 				</view>
 
- 			</scroll-view>
 
- 		</view>
 
- 	</view>
 
- </template>
 
- <script>
 
- 	import {getPatientList} from '@/api/patient'
 
- 	export default {
 
- 		props: ['patient'],
 
- 		data() {
 
- 			return {
 
- 				current: 0,
 
- 				scrollIntoView: 'patient_0',
 
- 				patientList: [],
 
- 			}
 
- 		},
 
- 		methods: {
 
- 			getPatientList(){
 
- 				uni.showLoading({
 
- 					title:"正在加载中"
 
- 				})
 
- 				getPatientList().then(
 
- 					res => {
 
- 						uni.hideLoading()
 
- 						if(res.code==200){
 
- 							this.patientList=res.data;
 
- 							if(this.patient&&this.patient.patientId) {
 
- 								const index = this.patientList.findIndex(item=>item.patientId == this.patient.patientId)
 
- 								this.current = index > -1 ? index : 0
 
- 							} else {
 
- 								this.current = 0
 
- 							}
 
- 							const patient = this.patientList&&this.patientList.length> 0 ? this.patientList[this.current] : null
 
- 							this.scrollIntoView = 'patient_'+ this.current
 
- 							uni.$emit('refreshOrderPatient',patient)
 
- 						}else{
 
- 							uni.showToast({
 
- 								icon:'none',
 
- 								title: "请求失败",
 
- 							});
 
- 						}
 
- 					},
 
- 					rej => {}
 
- 				);
 
- 			},
 
- 			addPatient() {
 
- 				this.$emit('addPatient')
 
- 			},
 
- 			handlePatient(item,i) {
 
- 				const patient = this.patientList&&this.patientList.length> 0 ? this.patientList[i] : null
 
- 				this.current = i
 
- 				this.scrollIntoView = 'patient_'+ i
 
- 				uni.$emit('refreshOrderPatient',patient)
 
- 			}
 
- 		}
 
- 	}
 
- </script>
 
- <style lang="scss" scoped>
 
- 	@mixin u-flex($flexD, $alignI, $justifyC) {
 
- 		display: flex;
 
- 		flex-direction: $flexD;
 
- 		align-items: $alignI;
 
- 		justify-content: $justifyC;
 
- 	}
 
- 	.additem {
 
- 		text-align: center;
 
- 		color: #ff5c03 !important;
 
- 		@include u-flex(column, center, center);
 
- 		height: 100%;
 
- 	}
 
- 	.addbtn {
 
- 		background-color: #FF5C03;
 
- 		padding: 5rpx 10rpx;
 
- 		box-sizing: border-box;
 
- 		border-radius: 10rpx;
 
- 	}
 
- 	.patient{
 
- 		&-container {
 
- 			padding: 15rpx;
 
- 		}
 
- 		&-box {
 
- 			padding: 30rpx 24rpx;
 
- 			box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
 
- 			background-color: #fff;
 
- 			border-radius: 15rpx;
 
- 		}
 
- 		&-head {
 
- 			@include u-flex(row, center, space-between);
 
- 			font-size: 26rpx;
 
- 			font-family: PingFang SC;
 
- 			color: #222;
 
- 		}
 
- 		&-title {
 
- 			font-size: 32rpx;
 
- 			font-weight: bold;
 
- 		}
 
- 		&-list {
 
- 			margin-top: 20rpx;
 
- 			white-space: nowrap;
 
- 			width: 100%;
 
- 		}
 
- 		&-item {
 
- 			width: 200rpx;
 
- 			margin-right: 16rpx;
 
- 			display: inline-block;
 
- 			box-sizing: border-box;
 
- 			padding: 10rpx 16rpx;
 
- 			border-radius: 12rpx;
 
- 			border: 1px solid #eee;
 
- 			font-size: 26rpx;
 
- 			font-family: PingFang SC;
 
- 			color: #999;
 
- 			position: relative;
 
- 		}
 
- 		&-active{
 
- 			border: 1px solid #FF5C03;
 
- 			&::after {
 
- 				position: absolute;
 
- 				bottom: 0;
 
- 				right: 0;
 
- 				content: "";
 
- 				height: 0;
 
- 				width: 0;
 
- 				border-top: 24rpx solid transparent;
 
- 				border-right: 24rpx solid #FF5C03;
 
- 				border-bottom: 24rpx solid #FF5C03;
 
- 				border-left: 24rpx solid transparent;
 
- 				border-radius: 0 0 12rpx 0;
 
- 			}
 
- 		}
 
- 		&-name {
 
- 			width: 100%;
 
- 			overflow: hidden;
 
- 			margin-bottom: 10rpx;
 
- 			font-size: 30rpx;
 
- 			font-weight: bold;
 
- 			color: #222;
 
- 		}
 
- 		&-info {
 
- 			@include u-flex(row, center, flex-start);
 
- 			.text{
 
- 				margin-right: 19upx;
 
- 			}
 
- 		}
 
- 	}
 
- 	.checkmarkempty {
 
- 		position: absolute;
 
- 		bottom: 0;
 
- 		right: 0;
 
- 		z-index: 2;
 
- 	}
 
- </style>
 
 
  |