<template>
	<view class="app">
		<u-navbar :is-back="false" :background="background" class="u-navbar">
			<image src="@/static/pagesB/fanhui.png" mode="" @tap="goprevious"></image>
			<view class="title" v-if="list.orderStatus=='WAIT_PAY'">待付款</view>
			<view class="title" v-if="list.orderStatus=='WAIT_REFUND'">退款中</view>
			<view class="title" v-if="list.orderStatus=='CANCEL'">已取消</view>
			<view class="title" v-if="list.orderStatus=='WAIT_RECEIVED_GOODS'">待接单</view>
			<!-- 	<view class="title" v-if="list.orderStatus=='WAIT_RECEIVED_GOODS'&&list.orderType !='HEALTH_CONSULTATION'">
				待收货</view> -->
			<!-- <view class="title" v-if="list.orderStatus=='WAIT_RECEIVED_GOODS'&&list.orderType =='HEALTH_CONSULTATION'">
				待咨询</view> -->
			<view class="title" v-if="list.orderStatus=='COMPLETED'">待评价</view>
			<view class="title" v-if="list.orderStatus=='RECEIVED_GOODS'">待服务</view>
			<view class="title" v-if="list.orderStatus=='EVALUATED'">已评价</view>

			<view class="title" v-if="list.orderStatus=='PAY'">待发货</view>
			<view class="title" v-if="list.orderStatus=='REFUNDED'">已退款</view>
			<view class="title" v-if="list.orderStatus=='WAIT_RETURNED_GOODS'">待退货</view>
			<view class="title" v-if="list.orderStatus=='RETURNED_GOODS'">退款成功</view>

		</u-navbar>

		<view class="time" style="" v-if="list.orderStatus=='WAIT_PAY'">
			<!-- v-if="list.orderStatus!='WAIT_PAY' -->
			剩余付款时间：
			<u-count-down style='' :timestamp="timestamp">
			</u-count-down>
		</view>
		<view class="OrderStatus" v-if="list.orderStatus=='REFUNDED'||list.orderStatus=='CANCEL'">
			订单已关闭
		</view>

		<view class="content">
			<view class="service">
				<image src="/static/pagesB/persone.png" mode=""></image>
				<span>医生服务</span>
			</view>
			<view class="orderitem">
				<view class="details">
					<image src="../../static/headsculpture.png" mode=""></image>
					<view class="ppointment">
						<view class="doctorname">
							<span>{{list.hospitalPersonName}}</span>
						</view>
						<view class="reservation">
							<span>齐鲁医院</span>
							<span v-if="list.academicTitle=='DEPUTY_CHIEF_PHYSICIAN'">副主任医师</span>
							<span v-if="list.academicTitle=='CHIEF_PHYSICIAN'">主任医师</span>
							<span v-if="list.academicTitle=='ATTENDING_DOCTOR'">主治医师</span>
							<span v-if="list.academicTitle=='PHYSICIAN'">医师</span>
							<span v-if="list.academicTitle=='HEALER'">医士</span>
							<span v-if="list.academicTitle=='RESIDENT_PHYSICIAN'">住院医师</span>
						</view>

					</view>
				</view>

			</view>
			<view class="doctordetails">
				<view class="doctorphone">
					医生电话
				</view>
				<view class="phone" v-if="list.personPhone">
					·{{list.personPhone}}
				</view>
			</view>
			<view class="doctordetails">
				<view class="doctorphone">
					预约时间
				</view>
				<view class="phone" v-if="list.healthAppointDate">
					{{list.healthAppointDate}}
				</view>
			</view>
			<view class="doctordetailstwo">
				<view class="doctorphonetwo">
					咨询内容
				</view>
				<view class="phonetwo advicetwo" v-if="list.healthConsultationContent">
					·{{list.healthConsultationContent}}
				</view>
			</view>
			<view class="amount">
				<span>预约金额</span><span>￥{{list.totalPrice}}</span>

			</view>
			<view class="doctordetailstwo">
				<view class="doctorphonetwo">
					备注
				</view>
				<view class="phonetwo advicetwo" v-if="list.remark">
					·{{list.remark}}
				</view>
			</view>

		</view>
		<view class="bottom">
			<span>更多</span>
			<span @tap="cancle"
			
				v-if="list.orderStatus!='WAIT_PAY'&&list.orderStatus!='EVALUATED'&&list.orderStatus!='WAIT_REFUND'&&list.orderStatus!='COMPLETED'&&list.orderStatus!='RECEIVED_GOODS'&&list.orderStatus!='REFUNDED'">取消订单</span>
			<!-- <span@tap="evaluate" v-if="list.orderStatus=='COMPLETED'">服务评价</span> -->
		</view>
		<!-- 	<u-popup v-model="evaluateshow" mode="bottom" length="45%" border-radius="30" :closeable='true'>
			<view class="evaluate">
				服务评价
			</view>
			<view class="star">
				<u-rate size="70" active-color="#F4EA2A" v-model="countvalue" inactive-color="#b2b2b2" gutter="20"></u-rate>
				<span>非常差/差/满意/非常满意</span>
			</view>
			<view class="submits">
				提交
			</view>
		</u-popup> -->


	</view>
</template>

<script>
	import {
		confirmReceipt,
		ssgoodsOrder,
	} from '@/api/pagesB/CommodityOrder/index.js'
	import baseurl from '@/api/baseurl.js'
	export default {
		data() {
			return {
				timestamp: 0,
				countvalue: 0,
				list: [],
				// 评价弹框
				background: {
					backgroundColor: '#26A888',
				},
				evaluateshow: false,
				orderTypeList: {
					goodsOrderId: null,
					patientId: '',
					openid: null,
					orderType: 'HEALTH_CONSULTATION',
					orderStatus: 'WAIT_PAY',
					// orderTypeList: [
					// 	'INTEGRAL_EXCHANGE',
					// 	'DIRECT_BUY',
					// ],
					// orderStatus: '',
					pageSize: 15,
					pageNum: 1,
					goodsName: '',
				},

			}
		},
		onLoad(options) {
			this.list = JSON.parse(options.item)
			// console.log(this.list, '99')
			// console.log(options,'88')
			this.baseurl = baseurl
			this.orderTypeList.goodsOrderId = options.goodsOrderId
			let that = this
			// const value = uni.getStorageSync('patientId');
			// const value2 = uni.getStorageSync('openid');
			// if (value && value2) {
			// 	that.orderTypeList.patientId = value
			// 	that.orderTypeList.openid = value2
			// }
		},
		methods: {
			goprevious() {
				uni.navigateBack({
					delta: 1
				})
			},
			goodsOrderinfo() {
				ssgoodsOrder(this.orderTypeList).then(
					res => {
						this.order = res.rows[0]
						var ordertimes = this.order.orderTime.replaceAll(/\-/gi, "/")
						var time = new Date(ordertimes).getTime() / 1000 + (60 * 60 * 2)
						var times = new Date().getTime() / 1000
						this.timestamp = time - times
						if (this.timestamp >= 0) {
							this.timecount = this.timestamp
							this.Timers = setInterval(() => {
								this.timecount--;
							}, 1000)
						}
					})
			},
			// 取消订单
			cancle() {
				var list = this.list
				uni.navigateTo({
					url: `/pagesB/refundType/refundType?list=${JSON.stringify(this.list)}`
				})
			},
			// 服务评价
			evaluate() {
				this.evaluateshow = true;

			},

		}
	}
</script>
<style lang="scss">
	@import './consulted.scss'
</style>