<template>
	<view class="content">
		<mescroll-body top="0rpx" bottom="0" ref="mescrollRef" @init="mescrollInit"    :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
		<view class="doctor-box">
			<view class="doctor"  @click="navTo('../doctor/doctorDetails?doctorId='+item.doctorId)" v-for="(item) in dataList">
				<view class="item">
					<image mode="aspectFill" class="doc-img" :src="item.avatar==null?'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/my_heads_icon.png':item.avatar"></image>
					<view class="right"> 
						<view class="doc-box">
							<view class="doc-name">
								{{item.doctorName}}
							</view>
							<view class="ping-star">
								<u-rate activeColor="#ffc603" count="5" readonly v-model="item.pingStar"></u-rate>
							</view>
						</view>
						<view class="doc-ping-content">
							{{item.pingContent}}
						</view>
						<view class="doc-ping-time">
							{{item.pingTime}}
						</view>
					</view>
					
				</view>
			</view>
		</view>
		</mescroll-body>
	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	import {getMyInquiryOrderPingList} from '@/api/inquiryOrder'
	export default {
		mixins: [MescrollMixin], // 使用mixin
		data() {
			return {
				mescroll:null,
				downOption: {   //下拉刷新
				 	use:true,
					auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
				},
				upOption: {
					onScroll:false,
					use: true, // 是否启用上拉加载; 默认true
					page: {
						pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
						size: 10 // 每页数据的数量,默认10
					},
					noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
					textNoMore:"已经到底了",
					empty: {
						icon:'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/empty_icon.png',
						tip: '暂无数据'
					}
				},
				dataList: []
			}
		},
		onShow() {
		},
		methods: {
			navTo(url){
				uni.navigateTo({
					url: url
				})
			},
			mescrollInit(mescroll) {
				this.mescroll = mescroll;
			},
			/*下拉刷新的回调 */
			downCallback() {
				this.mescroll.resetUpScroll()
			},
			/*上拉加载的回调*/
			upCallback(page) {   
				//联网加载数据
				var that = this;
				var data = {
					pageNum: page.num,
					pageSize: page.size
				};
				getMyInquiryOrderPingList(data).then(res => {
					if(res.code==200){
						if (page.num == 1) {
							that.dataList = res.data.list; 
							
						} else {
							that.dataList = that.dataList.concat(res.data.list);
							 
						}
						that.mescroll.endBySize(res.data.list.length, res.data.total);
						
					}else{
						uni.showToast({
							icon:'none',
							title: "请求失败",
						});
						that.dataList = null;
						that.mescroll.endErr();
					}
				});
			},
			
		}
	}
</script>

<style lang="scss">
	page{
		
		height: 100%;
		background: #f6f6f6;
	}
</style>
<style scoped lang="scss">
	.content{
		height: 100%;
		.top-fixed{
			width: 100%;
			// position: fixed;
			top: 0;
			left: 0;
			z-index: 10;
			height: 88upx;
			background-color: #fff;
		}
		.doctor-box{
			width: 100%;
			padding: 20rpx;
			box-sizing: border-box;
			display: flex;
			flex-direction: column;
			align-items: flex-start;
			justify-content: flex-start;
			.doctor{
				padding: 15rpx;
				box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
				background-color: #fff;
				border-radius: 15rpx;
				width: 100%;
				margin-bottom: 15rpx;
				padding: 15rpx;
				display: flex;
				flex-direction: column;
				align-items: flex-start;
				justify-content: flex-start;
				&:last-child{
					margin-bottom: 0rpx;
				}
				.item{
					width: 100%;
					display: flex;
					align-items: flex-start;
					justify-content: flex-start;
					.doc-img{
						width:80rpx;
						height:80rpx;
						border-radius: 50%;
					}
					.right{
						width: calc(100% - 100rpx); 
						margin-left: 20rpx;
						display: flex;
						flex-direction: column;
						align-items: flex-start;
						justify-content: flex-start;
						.doc-box{
							display: flex;
							align-items: center;
							justify-content: space-between;
							.doc-name{
								font-size: 32upx;
								font-family: PingFang SC;
								font-weight: bold;
								color: #111111;
								
							}
							.ping-star{
								margin-left: 30rpx;
							}
						}
						.doc-ping-time{
							margin-top: 15rpx;
							font-size: 28upx;
							font-family: PingFang SC;
							color: #9a9a9c;
						}
						.doc-ping-content{
							word-break:break-all;
							margin-top: 15rpx;
							font-size: 28upx;
							font-family: PingFang SC;
							color: #2d2b36;
						}
					}
				}
				
			}
			
		}
		
	}
	 
</style>
