<template>
	<view class="">
		<view class="zxkjyr">
			<view :class="['zxkjyra',Inv==0?'zxkjyrff':'']" @click="changeInv(0)">
				<text>咨询中</text>
				<view class="zxkjxh"></view>
			</view>
			<view :class="['zxkjyra',Inv==1?'zxkjyrff':'']" @click="changeInv(1)">
				<text>已结束</text>
				<view class="zxkjxh"></view>
			</view>
		</view>
			<view style="margin-top: 30rpx;">
				<view class="nodata_box" v-if="list.length==0">
					<image src="/static/user/no_data_img.png" mode="" style="width: 220rpx; height: 302rpx;"></image>
					<text>暂无数据</text>
				</view>
				<navigator class="fzctob wdlbgt" :url="'../index/zxshi?id=' + item1.course_data.lecturer_id + '&type=0'" hover-class="none" v-for="(item1,index1) in list" :key="index1">
					<image :src="item1.course_data.img"
						style="width: 148rpx;height: 148rpx;min-width: 148rpx;border-radius:160rpx;" mode=""></image>
					<view class="flztoa wdkkjruy">
						<view class="fsxto">
							<text class="wdtxtut">{{item1.course_data.title}}</text>
							<view class="wdtxtut"> 电话:{{item1.lecturer_data.phone}}</view>
							<view class="fzctob wdtxtuta">
								<text v-for="(item2,index2) in item1.lecturer_data.tag" :key="index2">{{item2}}</text>
							</view>
							<view class="fzctob wdtxtutb" @click.stop="lookaddress(item1.lecturer_data.lotx,item1.lecturer_data.loty,item1.lecturer_data.address)">
								<image src="/static/lecturer/lea2.png"
									style="width: 32rpx;height: 32rpx;min-width: 32rpx;" mode=""></image>
								<text>{{item1.course_data.city}}</text>
							</view>
						</view>
						<view class="fzddrew">
							<view class="fzctob" style="height: 40rpx;margin-top: 76rpx;">
								<text class="wdjga">¥</text>
								<text class="wdjgb">{{item1.reality_price}}</text>
							</view>
						</view>
					</view>
				</navigator>
			</view>
		<view style="height: 120rpx;"></view>
		<view class="dibuboot">
			<navigator class="dibubootlb" url="../index/index" open-type="redirect" hover-class="none">
				<image src="/static/dibu/boa1.png" style="width: 48rpx;height: 48rpx;"></image>
				<text>首页</text>
			</navigator>
<!-- 			<navigator class="dibubootlb" url="../lecturer/wdzx" open-type="redirect" hover-class="none">
				<image src="/static/dibu/bob2.png" style="width: 48rpx;height: 48rpx;"></image>
				<text style="color: #374B6E">咨询</text>
			</navigator>
			<navigator class="dibubootlb" url="../index/jiehuo" open-type="redirect" hover-class="none">
				<image src="/static/dibu/boa3.png" style="width: 48rpx;height: 48rpx;"></image>
				<text>解惑</text>
			</navigator> -->
			<navigator class="dibubootlb" url="../lecturer/my" open-type="redirect" hover-class="none">
				<image src="/static/dibu/boa4.png" style="width: 48rpx;height: 48rpx;"></image>
				<text>我的</text>
			</navigator>
		</view>
	</view>
</template>
<style>
	page {
		background: #FAFAFA;
	}
</style>
<script>
	export default {
		data() {
			return {
				Inv: 0,
				page: 1,
				num: 20,
				list: [],
				total: 0,
				user_id: '',

			}
		},
		onLoad() {
			this.user_id = uni.getStorageSync('id');
			this.getlist();
		},
		onReachBottom() {
			if (this.list.length < this.total) {
				this.page = this.page + 1
				this.getlist();
			} else {
				uni.showToast({
					title: '没有更多数据了',
					icon: 'none'
				})
			}
		},
		methods: {
			changeInv(indexs) {
				let that = this;
				that.Inv = indexs;
				that.list = [];
				that.page = 1;
				that.getlist();
			},
			getlist() {
				let that = this;
				this.$post({
					data: {
						do: 'MyCourseOrder',
						data: {
							page: that.page,
							num: that.num,
							good_type: '2',
							user_id: that.user_id,
							type: that.Inv == 0 ? '2' : '3'
						}
					}
				}).then(res => {
					that.list = [...that.list,...res.data.list]
					that.total = res.data.total
				})
			},
			lookaddress(latitude,longitude,name){
				// latitude: 39.947309,   	// 纬度示例
				// longitude: 116.390965,		// 经度示例
					uni.openLocation({
						latitude:latitude/1,   	// 纬度
						longitude:longitude/1,		// 经度
						name,
						success: res=> {
							console.log(res,'success');
						}
					});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.nodata_box{
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			margin: 0 auto;
			margin-top: 250rpx;
		}

</style>
