<template>
	<view class="page">
		<pyh-nv ref="nv" :config="nvConfig"></pyh-nv>
		<view class="listBox" :style="{'padding-top':(pageTop+'px')}">
		<view class="content">
			<view class="message-list">
			<view class="titleall-box">
				<view class="titleall-left"><view class="titleall-left-line"></view>逝者信息</view>
			</view>
			<view class="info-box">
				<view class="info-box-list">
					<view class="info-box-width">
						<view>{{info.funeralCallWebDeathInfoPo.deceasedName}}</view>
						<view class="info-box-small">逝者姓名</view>
					</view>
					<view class="info-box-width">
						<view>{{info.funeralCallWebDeathInfoPo.deceasedAge}}</view>
						<view class="info-box-small">逝者年龄</view>
					</view>
				</view>
				<view class="info-box-list">
					<view class="info-box-width">
						<view>{{info.funeralCallWebDeathInfoPo.deceasedSex}}</view>
						<view class="info-box-small">逝者性别</view>
					</view>
					<view class="info-box-width">
						<view>{{info.funeralCallWebDeathInfoPo.idCardNumber}}</view>
						<view class="info-box-small">逝者身份证号</view>
					</view>
				</view>
				<view class="info-box-list">
				</view>
			</view>
			</view>
			
			<view class="message-list">
			<view class="titleall-box">
				<view class="titleall-left"><view class="titleall-left-line"></view>预约人信息</view>
			</view>
			<view class="info-box">
				<view class="info-box-list">
					<view class="info-box-width">
						<view>{{info.funeralCallWebDeathInfoPo.contactName}}</view>
						<view class="info-box-small">预约人姓名</view>
					</view>
					<view class="info-box-width">
						<view>{{info.funeralCallWebDeathInfoPo.contactPhone}}</view>
						<view class="info-box-small">预约人电话</view>
					</view>
				</view>
			</view>
			</view>
			
			<view class="message-list">
			<view class="titleall-box">
				<view class="titleall-left"><view class="titleall-left-line"></view>死亡相关</view>
			</view>
			<view class="info-box">
				<view class="info-box-list">
					<view class="info-box-width">
						<view>{{info.funeralCallWebDeathInfoPo.deathdate}}</view>
						<view class="info-box-small">死亡日期</view>
					</view>
					<view class="info-box-width">
						<view>{{info.funeralCallWebDeathInfoPo.deathCase}}</view>
						<view class="info-box-small">死亡原因</view>
					</view>
				</view>
				<view class="info-box-list">
				</view>
			</view>
			</view>
		</view>
		</view>
		<view class="status-btn" style="">
			<view><text class="red"></text><text class="red big"></text></view>
			<view class="btn" @click="qr">
				<image src="../../static/btn.png" mode="widthFix"></image>
				<text>{{btntitle}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				OrderType: 0,
				nvConfig:{
					title:"详情",
					bgColor:"#ffffff",
					color:"#000000",
					fixedAssist:{
						hide:true,
					},
				},
				price:0,
				number:0,
				info:{},
				btntitle:"确认回车",
			};
		},
		onPageScroll(e) {this.$refs.nv.pageScroll(e)},
		computed:{
			pageTop(){return parseInt(88*uni.getSystemInfoSync().windowWidth/750) + uni.getSystemInfoSync().statusBarHeight}
		},
		onLoad(params) {
			this.info = JSON.parse(params.info)
			this.btntitle = this.info.title
			console.log(this.info);
		},
		methods:{
			/**
			 * 返回点击
			 */
			onBack(){
				uni.navigateBack();
			},
			parseTime(EndTime){
			    var date = new Date(EndTime);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
			    var Y = date.getFullYear() + '';
			    var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1)+ '';
			    var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate())+ '';
			    var h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours())+ '';
			    var m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes())+ '';
			    var s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds())+ '';
			    let strDate = Y+M+D+h+m+s;
				console.log(strDate) //2020-05-08 17:44:56　
				return strDate;
			},
			qr(){
				if(this.btntitle == "确认回车"){
					var info = {
						obituaryOrderNumber:"",
						vehicleNumber:"",
						dispatchTime:"",
						outTime:"",
						returnTime:"",
						driverName:"",
						driverPhone:"",
						undertakerNam:"",
						undertakerPhone:""
					}
					info.vehicleNumber = this.info.funeralCarScheduledInfoPo.orderNumber
					info.dispatchTime = this.info.funeralCarScheduledInfoPo.dispatchTime
					info.outTime = this.info.funeralCarScheduledInfoPo.outTime
					info.returnTime = this.info.funeralCarScheduledInfoPo.returnTime
					info.driverName = this.info.funeralCarScheduledInfoPo.driverName
					info.driverPhone = this.info.funeralCarScheduledInfoPo.driverPhone
					info.undertakerNam = this.info.funeralCarScheduledInfoPo.undertakerNam
					info.obituaryOrderNumber = this.info.funeralCallWebDeathInfoPo.orderNumber
					this.API.hcdd(info).then(res=>{
						console.log("调度信息",res);
						uni.showToast({
							title: '回车成功',
							//将值设置为 success 或者直接不用写icon这个参数
							icon: 'success',
							//显示持续时间为 2秒
							duration: 2000
						})
						uni.navigateBack();
					})
				}
				if(this.btntitle == "确认信息"){
					var info = {
						"confirmedStatus": "1",
						"id": this.info.funeralCallWebDeathInfoPo.id,
						"orderNumber": this.info.funeralCallWebDeathInfoPo.orderNumber
					}
					this.API.pqxxqr(info).then(res=>{
						console.log("信息确认",res);
						uni.showToast({
							title: '信息确认成功',
							//将值设置为 success 或者直接不用写icon这个参数
							icon: 'success',
							//显示持续时间为 2秒
							duration: 2000
						})
						uni.navigateBack();
					})
				}
			},
			

      /**
       * 评价点击
       */
      onEvaluate(){
			  uni.navigateTo({
          url: '/pages/MyEvaluatePush/MyEvaluatePush'
        })
      }
		}
	}
</script>

<style scoped lang="scss">
	@import 'xxqr.scss';
</style>
