<template>
	<view class="app">
		<u-navbar :is-back="false" :background="background" class="u-navbar">
			<image src="@/static/fanhui.png" mode="" @tap="goprevious"></image>
			<view class="title" @tap="goprevious">
				服务预约
			</view>
			<view class="inputs">
				<i class="icon"></i>
				<input v-model="projectName" type="text" name="" id="" class="input" placeholder="搜索服务"
					placeholder-class="placeholder">
			</view>
		</u-navbar>
		<view class="content" v-for="(item ,index) in listinfo" :key="index">
			<view class="big">{{item.projectName}}
				<span v-if="item.sourceType ==1">{{item.performanceCount}}/{{item.serviceFreq}}</span>
			</view>
			<view class="servename">
				{{item.packageName}}
			</view>
			<view class="appoint" @tap="goapponint(item)">
				预约
			</view>
		</view>
		<u-toast ref="uToast" />

	</view>
</template>

<script>
	import {
		getForm,

	} from '@/api/pagesC/ServiceAppointment/ServiceAppointment.js'
	export default {
		data() {
			return {
				background: {
					backgroundColor: '#26A888',
				},
				projectName: '',
				identity: '',
				listinfo: [],
				appointlist: [],
				packageNo: '',
				formName: '',
				formNo: '',

			};
		},
		onShow() {
			this.getlist()
		},
		watch: { //监听
			projectName(e) {
				this.getlist()
			},
		},
		methods: {
			getlist() {
				this.userinfo = uni.getStorageSync('userinfo');
				this.identity = this.userinfo.cardNo
				getForm(this.identity, this.projectName).then(res => {
					if (res.code == 500) {
						this.$refs.uToast.show({
							title: res.msg,
							type: 'error',
							duration: '1000',
						})
					} else {
						this.listinfo = res.data

					}
				})
			},
			goprevious() {
				uni.navigateBack({
					delta: 1
				})
			},
			goapponint(item) {
				uni.navigateTo({
					url: `/pagesC/appointmenttime/appointmenttime?item=${JSON.stringify(item)}`
				})



			}
		},
	}
</script>

<style lang="scss">
	@import './ServiceAppointment.scss'
</style>