<template>
  <view>
	<view v-if="datalist.length>0">
		<!-- 预约 -->
		<block v-if="type==1">
			<view class="ylist" v-for="(ite,idx) in datalist" :key='idx' @click="getDetail(ite.reservatId)">
				
			</view>
		</block>
		<view class="shax" v-if="wtdt">{{wtdt}}</view>
	</view>
	<block v-else>
		<no-data></no-data>
	</block>
  </view>
</template>

<script>
	import { selectDictValue } from '@/utils/common.js';
	import noData from "@/components/nodata/nodata.vue"
  export default {
	props:{
		datalist: {
			type: Array,
			default () {
				return []
			}
		},
		adrlist:{
			type: Array,
			default () {
				return []
			}
		},
		wtdt:{
			type: String,
			default () {
				return ''
			}
		},
		type:{
			type: [String,Number],
			default () {
				return ''
			}
		},
	},
	components:{
		noData
	},
	data(){
		return{
		}
	},
	onLoad: function() {
	},
	methods:{
		kaType(data, list) {
			return selectDictValue(list, data);
		},
		getDelFn(id){
			var that=this;
			uni.showModal({
				title: '确认删除',
				content: "是否确认删除该预约",
				cancelText: '取消',
				confirmText: '确认',
				success: function(res) {
					if (res.confirm) {
						that.$emit("getDelFn",id)
					} else if (res.cancel) {
						// console.log('用户点击取消');
					}
				}
			});
		},
		gettypeFn(type,id){
			var that=this;
			var str="拒绝"
			if(type==3){
				str='同意'
			}
			uni.showModal({
				title: '确认'+str,
				content: "是否确认"+str+"该预约",
				cancelText: '取消',
				confirmText: '确认',
				success: function(res) {
					if (res.confirm) {
						var newobj={
							type:type,
							id:id
						}
						that.$emit("gettypeFn",newobj)
					} else if (res.cancel) {
						// console.log('用户点击取消');
					}
				}
			});
		},
		getDetail(e){
			this.$emit('getDetail',e)
		},
		typeFn(data){
			if(data){
				var newArr=[]
				var astr=data.split('-')
				astr.forEach(ite=>{
					var a=ite.substring(0,5);
					newArr.push(a)
				})
				return newArr.join('-')
			}else{
				return ''
			}
			
			
		},
	},
	
  }
</script>

<style lang="scss" scoped>
// 预约
.ylist{background: #FFFFFF;border-radius: 14rpx;margin-bottom: 30rpx;position: relative;
}

</style>
