<template>
	<view>
		<view class="doctor-list" v-if="doctorList&&doctorList.length>0">
			<view class="li ddflex" v-for="(item,index) in doctorList" :key="index">
				<image :src="item.headUrl?item.headUrl:'../../static/pages/images/userimg.png'" mode="aspectFill" class="doctor-img"></image>
				<view class="fflex">
					<view class="doctor-tit">{{item.realName?item.realName:item.nickName}}<text v-if="item.userExtend&&item.userExtend.label">{{item.userExtend.label}}</text></view>
					<view class="doctor-bri tovers" v-if="item.userExtend&&item.userExtend.projects">{{item.userExtend.projects}}</view>
				</view>
				<contact-button button-text="咨询" class-name="doctor-btn"></contact-button>
			</view>
		</view>
		<view class="nodata" v-else>
			<image :src="picUrlss+'empty_jl.png'"></image>
			<view>暂无医生</view>
		</view>
	</view>
</template>

<script>
const req = require('../../utils/request.js');
const api = require('../../utils/api.js');
const util = require('../../utils/util.js');
const app = getApp();
export default {
	data() {
		return {
			picUrlss: req.public.picUrls,
			merchant: {},
			doctorList: [],
		};
	},
	onLoad(options) {
		
	},
	onShow() {
		this.merchant = req.getStorage('MERCHANT')?req.getStorage('MERCHANT'):req.getStorage('defaultMerchant');
		this.getDoctorList();
	},

	methods: {
		// 获取医生列表
		getDoctorList(){
			let that = this;
			let params = {
				merchantId: this.merchant.id
			}
			return new Promise((resolve,reject)=>{
				req.getRequest(api.doctor_listV2, params, data => {
					this.doctorList = data;
					resolve()
				});
			})
		},
	}
};
</script>

<style>
	@import "./index.css";
</style>