<template>
	<view class="app">
		<view class="details">
			<image :src="baseurl+list.itemPictureUrl" mode=""></image>
			<view class="detailsinfo">
				<view class="change">
					{{list.nurseItemName}}
				</view>
				<view class="time">
					服务时长： {{list.itemServeDurationUnit}}
				</view>
				<view class="price">
					￥ {{list.totalPrice}}
				</view>
			</view>
		</view>
		<view class="info">
			<view class="item">
				姓名： {{list.patientName}}
			</view>
			<view class="item">
				电话：{{list.phone}}
			</view>
			<view class="item" style="border:none;line-height: 60rpx;padding: 20rpx 0;">
				地址：{{list.serviceAddress}}
			</view>
		</view>
		<view class="img" v-if="list.orderStatus=='COMPLETE'">
			<view class="">
				护理员到岗照片
			</view>
			<image :src="baseurl+list.onDutyPictureUrl" mode=""></image>
		</view>
		<view class="img" v-if="list.orderStatus=='COMPLETE'">
			<view class="" >
				服务结束照片
			</view>
			<image :src="baseurl+list.serviceEndPictureUrl" mode=""></image>
		</view>
		<view class="img" v-if="list.orderStatus=='COMPLETE'">
			<view class="">
				签名
			</view>
			<image :src="baseurl+list.userSignaturePictureUrl" mode=""></image>
		</view>
		<view class="submit">
			<view class="return" @tap='goreturn' v-if="list.orderStatus=='NOT_FINISH'">
				任务退回
			</view>
			<view class="finish" @tap='gocomplete' v-if="list.orderStatus=='NOT_FINISH'">
				去完成
			</view>
		</view>
	</view>
</template>

<script>
	import {
		taskDetails
	} from '@/api/taskDetails.js'
	import baseurl from '@/api/baseurl.js'
	export default {
		data() {
			return {
				baseurl: '',
				list: {},
				orderDetailsId: null,
			}
		},
		methods: {
			//详情接口
			taskDetailsinfo(orderDetailsId) {
				taskDetails(orderDetailsId).then(res => {
					this.list = res.data
				})
			},
			goreturn() {
				uni.navigateTo({
					url: `/pages/taskReturn/taskReturn?orderNo=${this.list.orderNo}`
				})
			},
			gocomplete() {
				uni.navigateTo({
					url: `/pages/confirmCompletion/confirmCompletion?orderDetailsId=${this.list.orderDetailsId}&orderNo=${this.list.orderNo}`
				})
			},
		},
		onLoad(options) {
			this.baseurl = baseurl
			this.orderDetailsId = options.orderDetailsId
		},
		onShow() {
			this.taskDetailsinfo(this.orderDetailsId)
		},
	}
</script>

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