<template>
	<view class="serverMore">
		<view class="tabList">
			<view class="tabItem" v-for="(item, index) in serverList" :key="index" @click="getList2(item.cate_id)">
				<view class="tabImg">
					<image :src="item.photo" mode="" />
				</view>
				<view class="tabName">{{item.cate_name}}</view>
			</view>
		</view>
		<view class="gray"></view>
		<view class="List">
			<view class="item" v-for="(item, index) in tabList" :key="index">
				<view class="item_left">
					<view class="item_left_img">
						<image :src="item.photo" mode="widthFix" />
					</view>
					<view class="item_left_msg">
						<view class="item_left_msg_tit">
							{{item.title}}
							<view class="phone" @click="call">
								<image src="https://static.hshuishang.com/doorToDoor/phone.png" mode="widthFix" />
							</view>
						</view>
						<view class="item_left_msg_time">服务时间：{{item.biz_time}}</view>
						<view class="item_left_msg_money">
							￥ <view>{{item.price}}</view>/{{item.unit}}
						</view>
					</view>
				</view>
				<view class="item_right" @click="reservation(item.appoint_id)">
					预约
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import { apiArr } from '../../../api/communityService';
	import { picUrl, request } from '../../../utils';

	export default {
		data() {
			return {
				flag: false,
				cateid: "",
				page_num: 1,
				page_size: 10,
				serverList: [],
				tabList: [],
			}
		},
		methods: {
			async getCateList(id) {
				const res = await request(apiArr.getAllList, 'POST', {
					cate_id: Number(id),
					page_num: 1,
					page_size: 50
				})
				let flag = false
				if (res.rows && res.rows.length == this.page_size) {
					flag = true
				} else {
					flag = false
				}
				res.rows && res.rows.forEach(item => {
					item.photo = picUrl + item.photo
					item.cate.photo = picUrl + item.cate.photo
				})
				console.log(res, 'ssss');
				this.tabList = this.tabList.concat(res.rows || []);
				this.flag = flag;
				this.page_num = this.page_num + 1;
			},
		},
		onLoad(options) {

			this.cateid = options.id;
			// that.getDoorToDoorList()
			this.getCateList(options.id)
		}
	}
</script>

<style>
	@import url("./index.css");
</style>