<template>
	<view class="hzIndex">
		<hzHeader title="留餐申请详情"></hzHeader>
		<view class="hzContent" style="padding-top: 200upx;">
		<view class="details">
			<view class="detail_msg">
				
				<view class="info-item">
					<text class="label">申请人： </text>
					<text class="infoSpan">{{item.USER_NAME}}</text>
				</view> 
				<view class="info-item">
					<text class="label">食堂： </text>
					<text class="infoSpan">{{item.LOCATION}}</text>
				</view> 
				<view class="info-item">
					<text class="label">留餐类别： </text>
					<text class="infoSpan">{{formatFoodType(item.NEA_TYPE)}}</text>
				</view> 
				<view class="info-item">
					<text class="label">就餐人数： </text>
					<text class="infoSpan">{{ item.NEAL_NUM }}</text>
				</view>
				
				<view class="info-item">
					<text class="label">就餐时间： </text>	
					<text class="infoSpan">{{item.NEAL_TIME}}</text>
				</view>
				<view class="info-item status">
					<text class="label">服务状态： </text>
					<text v-if="item.EXAMINE_STATE =='0'" class="infoSpan2" style="color: green;" >待处理</text><!-- statusred -->
					<text v-if="item.EXAMINE_STATE =='1'" class="infoSpan" style="color: green;">已同意</text>
					<text v-if="item.EXAMINE_STATE =='2'" class="infoSpan" >已拒绝</text>
				</view>
				<view class="info-item" v-if="item.EXAMINE_NAME">
					<text class="label">办理人:</text>
					<text class="infoSpan">{{ item.EXAMINE_NAME }}</text>
				</view>
				<!-- <view class="info-item">
					<text class="label">申请人： </text>
					<text class="infoSpan">{{ item.USER_NAME }}</text>
				</view> 
				<view class="info-item" v-if="item.EXAMINE_NAME">
					<text class="label">办理人:</text>
					<text class="infoSpan">{{ item.EXAMINE_NAME }}</text>
				</view>
				<view class="info-item" v-if="item.FEEDBACK">
					<view style="color: #333;font-size: 30upx;font-weight: bold;padding: 10upx 0px;">
						<text>服务反馈结果：</text>
					</view>
					<view style="width: 100%;border: 1px solid #E5E5E5;margin-top: 20upx;padding: 20upx;min-height: 250upx;color: #666;border-radius: 10upx;">
						<textarea class="textarea"  v-model="item.FEEDBACK"  placeholder="请输入服务反馈结果" disabled="true"  maxlength="100"/>
					</view>
				</view> -->
				
				<view class="img-box" >
					<image v-for="(itemImg,imgIndex) in item.pictures" :key="imgIndex" :src="formatImgUrl(itemImg)" mode="" @click="vbPicture(new Array(formatImgUrl(itemImg)))"></image>
				</view>
			</view> 
			
		</view>
		<view class="details" v-if="item.reply_flag!='0'" v-for="(reply,replyIndex) in item.replyList" :key="replyIndex">
			<view class="detail_msg" >
				<view class="info-item">
					<text class="label">回复内容： </text>	
					<text class="infoSpan">{{reply.reply_content}}</text>
				</view>
				<view  class="info-item" >
					<text class="label">回复时间： </text>	
					<text class="infoSpan">{{ formatDate(reply.reply_date,'dateTime')}}</text>
				</view>
				<view class="img-box" >
					<image v-for="(itemImg,imgIndex) in reply.replyPictures" :key="imgIndex" :src="formatImgUrl(itemImg)" mode=""  @click="vbPicture(new Array(formatImgUrl(itemImg)))"></image>
				</view>
			</view>
		</view>
	
		</view>
	</view>
</template>

<script>
	import {
		getWeekMeal
	} from '@/common/api.js';
	import {
		callbackRequest,
		getStorage,
		alertTip,
		formatDate,
		sureAlterTip,
		vbPicture,
		formatImgUrl
	} from '@/common/util.js';
	export default {
		
		data() {
			return {
				vbPicture:vbPicture,
				formatImgUrl:formatImgUrl,
				userInfo:getStorage('userInfo'),
				userId:getStorage('userInfo').userId,
				formatDate:formatDate,
				item: {},
				foodTypes:[{ id: '0', name: '早餐' }, { id: '1', name: '午餐' },{ id: '2', name: '晚餐' }],
				id:0,
			}
		},
		onLoad(option) {
			this.id = option.id||0;
			this.getWeekMeal();
		},
		methods: {
			getWeekMeal(){
				let params =  {
						method: getWeekMeal,
						data: {
							USER_ID:this.userId,
							ID:this.id
						}
					};
				callbackRequest(params).then(res => {
					res = res.data;
					console.log(res)
					if (res.returnCode == 1) {
						this.item = res.returnData[0];
					} else {
						alertTip(res.returnMsg);
					}
				});
			},
			formatFoodType(NEA_TYPE){
				for(let i=0;i<this.foodTypes.length;i++){
					let obj = this.foodTypes[i];
					if(obj.id == NEA_TYPE){
						return obj.name;
					}
				}
			},
		}
	}
</script>

<style lang="scss">
	@import '@/static/css/common.scss';
 
	.details{
		position: relative;
		// height: 550upx;
		background: white;
		margin: 20upx;
		border-radius: 20upx;
		padding-bottom:60upx;
		font-size: 26upx;
		.detail_header {
			border-bottom: #f8f8f8 5upx solid;
			height: 90upx;
			line-height: 90upx;
			margin: 15upx;
			border-radius: 10upx;
			.blueSign {
				height: 28upx;
				width: 5upx;
				background: #00c277;
				display: inline-block;
				margin-left: 20upx;
			}
			.font-tilte {
				font-weight:bold;
				margin-left: 20upx;
			}
		}
		.detail_msg {
			margin-left: 20upx;
			border-radius: 10upx;
			.info-item{
				border-bottom:1px solid #f8f8f8;
				padding:20upx 10upx;
				line-height: 50upx;
				.label{
					display:inline-block;
					width:180upx;
					font-size:28upx;
					color:#333;
					font-weight:bold;
				}
			}
			.status {
				.infoSpan{
					color: #00c277;
				}
				.infoSpan2{
					color: red;
				}
			}
			.img-box {
				// background: #fff;
				image{
					width: 200upx;
					height: 200upx;
					margin:20upx 20upx 0 0;
				}
			}
		}
	}

</style>
