<template>
	<view class="main">
		<view class="margin-bottom-sm bg-white">
			<u-dropdown>
				<u-dropdown-item @change="allserive" v-model="value1" :title="options1[value1].label" :options="options1"></u-dropdown-item>
				<u-dropdown-item @change="city" v-model="value2" :title="options2[value2].label" :options="options2"></u-dropdown-item>
				<u-dropdown-item @change="recommend" v-model="value3" :title="options3[value3].label" :options="options3"></u-dropdown-item>
			</u-dropdown>
			<u-search :clearabled="true" shape="round" :show-action="false" @blur="searchg" placeholder="搜索医生姓名、医院名" v-model="keyword"></u-search>
			<view style="width: 100%;background-color: #FFFFFF;">
				<view @click="goinfo" class="recommendstyle margin-top-xs" v-for="(item,index) in test" :key="index" style="position: relative;overflow: hidden;height: 485rpx;">
					<view class="base_item">
						<view class="base_item_zi">
							<view class="base_item_zi_items">
								<view class="base_item_zi_content">
									<u-image :fade="true" duration="450" width="120rpx" height="120rpx" src="https://file.supermm.me/UEditor/uploadFile/2020-09-21/D229A665CBFB4817A518A5C47726AB18.jpg"
									 shape="circle"></u-image>
									<view class="content_right">
										<view class="" style="display: flex;align-items: center;">
											<text style="font-size: 32rpx; font-weight: bold;">张三</text>
											<text class="text_style">全科医学科</text>
											<text class="text_style">医生</text>
										</view>
										<view class="m_gray_small">
											昆明市西山区永昌西区社区卫生服务中心昆明市西山区永昌西区社区卫生服务中心
										</view>
										<view class="flex justify-start align-center flex-wrap" style="position: relative;">
											<u-tag style="margin-top:20rpx ; margin-right: 20rpx;" text="图文" shape="circle" mode="dark" type="primary" />
											<u-tag style="margin-top:20rpx ; margin-right: 20rpx;" text="电话" shape="circle" mode="dark" type="warning" />
											<u-tag style="margin-top:20rpx ; margin-right: 20rpx;" text="门诊" shape="circle" mode="dark" type="error" />
										</view>
									</view>
								</view>
								<view class="foot_juli padding-sm">
									<u-line color="#f6f6f6" />
									<view class="flex justify-center margin-top-sm" style="color: rgba(0,0,0,0.54);">
										<view class="text-sm" style="flex: 1; text-align: left;">
											评分：
											<text style="color: #FF7B72;">5.0分</text>
										</view>
										<view class="text-sm" style="flex: 1; text-align: center;">
											服务：
											<text style="color: #FF7B72;">7人</text>
										</view>
										<view class="text-sm" style="flex: 1; text-align: right;">
											距离：
											<text style="color: #FF7B72;">650km</text>
										</view>
									</view>
								</view>
							</view>
						</view>
						<view class="padding-sm doctor_style">
							<view class="doctor_style_item">
								2010年毕业于红河卫校，2010年8月工作至今，从事预防接种工作7年，对预防接种工作排苗等其他流程熟练，对接种疫苗后出现的一些不良反应有一定经验。
							</view>
							<view class="text-black flex justify-between align-center margin-top-xs" style="font-size: 30rpx;">
								<view>急速响应</view>
								<view class="">
									服务
									<text class="text-red">￥19.90</text>
									起
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="margin-tb padding-tb-xs">
			<u-loadmore :status="nomore" :icon-type="flower" />
		</view>
		<u-back-top :scroll-top="scrollTop" bottom="80" top="400"></u-back-top>
	</view>
</template>

<script>
	var user = require('../../common/user.js');
	import {
		mapState,
		mapMutations,
		mapGetters,
		mapActions
	} from 'vuex';
	export default {
		onLoad(options) {


		},
		mounted() {
			console.log(this.value1)
			this.getDoctorList()
		},
		data() {
			return {
				scrollTop: 0,
				keyword: "",
				test: [1, 2, 3, 4, 5],
				value1: 0,
				value2: 0,
				value3: 0,
				options1: [{
						label: '全部服务',
						value: 0,
					}, {
						label: '电话咨询',
						value: 1,
					},
					{
						label: '图文咨询',
						value: 2,
					},
					{
						label: '门诊预约',
						value: 3,
					}
				],
				options2: [{
						label: '成都市',
						value: 0,
					}, {
						label: 'xx市',
						value: 1,
					},
					{
						label: 'xx市',
						value: 2,
					},
				],
				options3: [{
						label: '推荐排序',
						value: 0,
					}, {
						label: '距离最近',
						value: 1,
					},
					{
						label: '好评最多',
						value: 2,
					},
					{
						label: '服务最多',
						value: 3,
					},
				],
			}
		},
		methods: {
			//监听滚动
			onPageScroll(e) {
				this.scrollTop = e.scrollTop;
			},
			allserive(value) {
				this.value1 = value
				this.getDoctorList()
			},
			city(value) {
				this.value2 = value
			},
			recommend(value) {
				this.value3 = value
				this.getDoctorList()
			},
			goinfo() {
				uni.navigateTo({
					url: "./doctor_info"
				})
			},
			getDoctorList: async function() {
				let res = await this.$request.post("/api/v1/docter/docterList", {
					page: 1,
					list_type: this.value1,
					name: this.keyword,
					sort_type: this.value3
				}, )
				console.log(res)
			},
			searchg(value) {
				console.log(this.value1, this.value3)
				this.getDoctorList()
			}
		}
	};
</script>

<style scoped lang="scss">
	.main {
		padding-top: 10rpx;
		padding-left: 20rpx;
		padding-right: 20rpx;
	}

	.base_item {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		z-index: 1;
		width: 100%;
		height: auto;
		box-sizing: border-box;
	}

	.doctor_style {
		color: rgba(0, 0, 0, 0.54);
	}

	.doctor_style_item {
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.base_item_zi {
		padding-top: 20rpx;
		margin: 0 20rpx;
		position: relative;
		box-sizing: border-box;
	}

	.base_item_zi_items {
		box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
		background-color: #fff;
		position: relative;
		border-radius: 8rpx;
		box-sizing: border-box;
	}

	.base_item_zi_content {
		display: flex;
		justify-content: center;
		align-items: center;
		padding: 30rpx 30rpx;
		overflow: hidden;
		position: relative;
		width: 100%;
		box-sizing: border-box;
	}

	.text_style {
		font-size: 24rpx;
		color: rgba(0, 0, 0, .54);
		display: block;
		margin-left: 10rpx;
	}

	.m_gray_small {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		color: rgba(0, 0, 0, 0.54);
		margin-top: 20rpx;
		font-size: 28rpx;
	}

	.content_right {
		flex: 1;
		margin-left: 20rpx;
		overflow: hidden;
		position: relative;
		box-sizing: border-box;
	}

	.foot_item {
		background-color: #F7F7F7;
		box-sizing: border-box;
	}

	.grid-text {
		font-size: 28rpx;
		margin-top: 4rpx;
		color: $u-type-info;
	}

	.tltleStyle {
		padding: 30rpx 30rpx 15rpx 15rpx;
		font-weight: bold;
		font-size: 40rpx;
		background-color: #fff;
	}
</style>
